diff options
-rw-r--r-- | .eslintignore | 2 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | tools/lint-md.mjs (renamed from tools/lint-md.js) | 66005 | ||||
-rw-r--r-- | tools/node-lint-md-cli-rollup/package-lock.json | 2922 | ||||
-rw-r--r-- | tools/node-lint-md-cli-rollup/package.json | 2 | ||||
-rw-r--r-- | tools/node-lint-md-cli-rollup/rollup.config.js | 22 | ||||
-rw-r--r-- | vcbuild.bat | 2 |
7 files changed, 30804 insertions, 38153 deletions
diff --git a/.eslintignore b/.eslintignore index 19e0fcee9e..e8b8c3f297 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,7 +4,7 @@ test/addons/??_* test/fixtures test/message/esm_display_syntax_error.mjs tools/icu -tools/lint-md.js +tools/lint-md.mjs tools/node-lint-md-cli-rollup/dist benchmark/tmp doc/**/*.js @@ -1235,7 +1235,7 @@ LINT_MD_TARGETS = doc src lib benchmark test tools/doc tools/icu $(wildcard *.md LINT_MD_FILES = $(shell $(FIND) $(LINT_MD_TARGETS) -type f \ ! -path '*node_modules*' ! -path 'test/fixtures/*' -name '*.md' \ $(LINT_MD_NEWER)) -run-lint-md = tools/lint-md.js -q -f --no-stdout $(LINT_MD_FILES) +run-lint-md = tools/lint-md.mjs -q -f --no-stdout $(LINT_MD_FILES) # Lint all changed markdown files maintained by us tools/.mdlintstamp: $(LINT_MD_FILES) $(info Running Markdown linter...) diff --git a/tools/lint-md.js b/tools/lint-md.mjs index 1f865ab809..b614ae37d8 100644 --- a/tools/lint-md.js +++ b/tools/lint-md.mjs @@ -1,50 +1,19 @@ -'use strict'; - -// Don't change this file manually, -// it is generated from tools/node-lint-md-cli-rollup - -var require$$0$a = require('stream'); -var require$$0$7 = require('path'); -var require$$0$5 = require('util'); -var require$$0$6 = require('os'); -var require$$1 = require('tty'); -var require$$0$8 = require('fs'); -var require$$1$1 = require('module'); -var require$$0$9 = require('events'); -var require$$5$2 = require('assert'); -var url = require('url'); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { - return e[k]; - } - }); - } - }); - } - n['default'] = e; - return Object.freeze(n); -} - -var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$a); -var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$7); -var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$5); -var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$6); -var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1); -var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$8); -var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1); -var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$9); -var require$$5__default = /*#__PURE__*/_interopDefaultLegacy(require$$5$2); +import path$b from 'path'; +import require$$0$3, { realpathSync as realpathSync$1, statSync, Stats } from 'fs'; +import { URL as URL$1, fileURLToPath, pathToFileURL } from 'url'; +import process$2 from 'node:process'; +import stream, { PassThrough } from 'node:stream'; +import require$$0$2 from 'os'; +import tty$1 from 'tty'; +import require$$0$5 from 'events'; +import require$$0$4, { format as format$2, inspect as inspect$1 } from 'util'; +import require$$1 from 'stream'; +import path$c from 'node:path'; +import { pathToFileURL as pathToFileURL$1 } from 'node:url'; +import assert$2 from 'assert'; +import fs$a from 'node:fs'; +import { EventEmitter as EventEmitter$1 } from 'node:events'; +import process$1 from 'process'; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; @@ -67,218 +36,8605 @@ function commonjsRequire (path) { throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } -var cliEntry = {}; +var ansiStyles$2 = {exports: {}}; -var vfileStatistics = statistics$2; +var colorName$1 = {
+ "aliceblue": [240, 248, 255],
+ "antiquewhite": [250, 235, 215],
+ "aqua": [0, 255, 255],
+ "aquamarine": [127, 255, 212],
+ "azure": [240, 255, 255],
+ "beige": [245, 245, 220],
+ "bisque": [255, 228, 196],
+ "black": [0, 0, 0],
+ "blanchedalmond": [255, 235, 205],
+ "blue": [0, 0, 255],
+ "blueviolet": [138, 43, 226],
+ "brown": [165, 42, 42],
+ "burlywood": [222, 184, 135],
+ "cadetblue": [95, 158, 160],
+ "chartreuse": [127, 255, 0],
+ "chocolate": [210, 105, 30],
+ "coral": [255, 127, 80],
+ "cornflowerblue": [100, 149, 237],
+ "cornsilk": [255, 248, 220],
+ "crimson": [220, 20, 60],
+ "cyan": [0, 255, 255],
+ "darkblue": [0, 0, 139],
+ "darkcyan": [0, 139, 139],
+ "darkgoldenrod": [184, 134, 11],
+ "darkgray": [169, 169, 169],
+ "darkgreen": [0, 100, 0],
+ "darkgrey": [169, 169, 169],
+ "darkkhaki": [189, 183, 107],
+ "darkmagenta": [139, 0, 139],
+ "darkolivegreen": [85, 107, 47],
+ "darkorange": [255, 140, 0],
+ "darkorchid": [153, 50, 204],
+ "darkred": [139, 0, 0],
+ "darksalmon": [233, 150, 122],
+ "darkseagreen": [143, 188, 143],
+ "darkslateblue": [72, 61, 139],
+ "darkslategray": [47, 79, 79],
+ "darkslategrey": [47, 79, 79],
+ "darkturquoise": [0, 206, 209],
+ "darkviolet": [148, 0, 211],
+ "deeppink": [255, 20, 147],
+ "deepskyblue": [0, 191, 255],
+ "dimgray": [105, 105, 105],
+ "dimgrey": [105, 105, 105],
+ "dodgerblue": [30, 144, 255],
+ "firebrick": [178, 34, 34],
+ "floralwhite": [255, 250, 240],
+ "forestgreen": [34, 139, 34],
+ "fuchsia": [255, 0, 255],
+ "gainsboro": [220, 220, 220],
+ "ghostwhite": [248, 248, 255],
+ "gold": [255, 215, 0],
+ "goldenrod": [218, 165, 32],
+ "gray": [128, 128, 128],
+ "green": [0, 128, 0],
+ "greenyellow": [173, 255, 47],
+ "grey": [128, 128, 128],
+ "honeydew": [240, 255, 240],
+ "hotpink": [255, 105, 180],
+ "indianred": [205, 92, 92],
+ "indigo": [75, 0, 130],
+ "ivory": [255, 255, 240],
+ "khaki": [240, 230, 140],
+ "lavender": [230, 230, 250],
+ "lavenderblush": [255, 240, 245],
+ "lawngreen": [124, 252, 0],
+ "lemonchiffon": [255, 250, 205],
+ "lightblue": [173, 216, 230],
+ "lightcoral": [240, 128, 128],
+ "lightcyan": [224, 255, 255],
+ "lightgoldenrodyellow": [250, 250, 210],
+ "lightgray": [211, 211, 211],
+ "lightgreen": [144, 238, 144],
+ "lightgrey": [211, 211, 211],
+ "lightpink": [255, 182, 193],
+ "lightsalmon": [255, 160, 122],
+ "lightseagreen": [32, 178, 170],
+ "lightskyblue": [135, 206, 250],
+ "lightslategray": [119, 136, 153],
+ "lightslategrey": [119, 136, 153],
+ "lightsteelblue": [176, 196, 222],
+ "lightyellow": [255, 255, 224],
+ "lime": [0, 255, 0],
+ "limegreen": [50, 205, 50],
+ "linen": [250, 240, 230],
+ "magenta": [255, 0, 255],
+ "maroon": [128, 0, 0],
+ "mediumaquamarine": [102, 205, 170],
+ "mediumblue": [0, 0, 205],
+ "mediumorchid": [186, 85, 211],
+ "mediumpurple": [147, 112, 219],
+ "mediumseagreen": [60, 179, 113],
+ "mediumslateblue": [123, 104, 238],
+ "mediumspringgreen": [0, 250, 154],
+ "mediumturquoise": [72, 209, 204],
+ "mediumvioletred": [199, 21, 133],
+ "midnightblue": [25, 25, 112],
+ "mintcream": [245, 255, 250],
+ "mistyrose": [255, 228, 225],
+ "moccasin": [255, 228, 181],
+ "navajowhite": [255, 222, 173],
+ "navy": [0, 0, 128],
+ "oldlace": [253, 245, 230],
+ "olive": [128, 128, 0],
+ "olivedrab": [107, 142, 35],
+ "orange": [255, 165, 0],
+ "orangered": [255, 69, 0],
+ "orchid": [218, 112, 214],
+ "palegoldenrod": [238, 232, 170],
+ "palegreen": [152, 251, 152],
+ "paleturquoise": [175, 238, 238],
+ "palevioletred": [219, 112, 147],
+ "papayawhip": [255, 239, 213],
+ "peachpuff": [255, 218, 185],
+ "peru": [205, 133, 63],
+ "pink": [255, 192, 203],
+ "plum": [221, 160, 221],
+ "powderblue": [176, 224, 230],
+ "purple": [128, 0, 128],
+ "rebeccapurple": [102, 51, 153],
+ "red": [255, 0, 0],
+ "rosybrown": [188, 143, 143],
+ "royalblue": [65, 105, 225],
+ "saddlebrown": [139, 69, 19],
+ "salmon": [250, 128, 114],
+ "sandybrown": [244, 164, 96],
+ "seagreen": [46, 139, 87],
+ "seashell": [255, 245, 238],
+ "sienna": [160, 82, 45],
+ "silver": [192, 192, 192],
+ "skyblue": [135, 206, 235],
+ "slateblue": [106, 90, 205],
+ "slategray": [112, 128, 144],
+ "slategrey": [112, 128, 144],
+ "snow": [255, 250, 250],
+ "springgreen": [0, 255, 127],
+ "steelblue": [70, 130, 180],
+ "tan": [210, 180, 140],
+ "teal": [0, 128, 128],
+ "thistle": [216, 191, 216],
+ "tomato": [255, 99, 71],
+ "turquoise": [64, 224, 208],
+ "violet": [238, 130, 238],
+ "wheat": [245, 222, 179],
+ "white": [255, 255, 255],
+ "whitesmoke": [245, 245, 245],
+ "yellow": [255, 255, 0],
+ "yellowgreen": [154, 205, 50]
+}; -// Get stats for a file, list of files, or list of messages. -function statistics$2(files) { - var result = {true: 0, false: 0, null: 0}; +/* MIT license */ + +/* eslint-disable no-mixed-operators */ +const cssKeywords$1 = colorName$1; - count(files); +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) - return { - fatal: result.true, - nonfatal: result.false + result.null, - warn: result.false, - info: result.null, - total: result.true + result.false + result.null +const reverseKeywords$1 = {}; +for (const key of Object.keys(cssKeywords$1)) { + reverseKeywords$1[cssKeywords$1[key]] = key; +} + +const convert$4 = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; + +var conversions$5 = convert$4; + +// Hide .channels and .labels properties +for (const model of Object.keys(convert$4)) { + if (!('channels' in convert$4[model])) { + throw new Error('missing channels property: ' + model); + } + + if (!('labels' in convert$4[model])) { + throw new Error('missing channel labels property: ' + model); + } + + if (convert$4[model].labels.length !== convert$4[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } + + const {channels, labels} = convert$4[model]; + delete convert$4[model].channels; + delete convert$4[model].labels; + Object.defineProperty(convert$4[model], 'channels', {value: channels}); + Object.defineProperty(convert$4[model], 'labels', {value: labels}); +} + +convert$4.rgb.hsl = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } + + h = Math.min(h * 60, 360); + + if (h < 0) { + h += 360; + } + + const l = (min + max) / 2; + + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } + + return [h, s * 100, l * 100]; +}; + +convert$4.rgb.hsv = function (rgb) { + let rdif; + let gdif; + let bdif; + let h; + let s; + + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + const diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; + + if (diff === 0) { + h = 0; + s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } + + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } + + return [ + h * 360, + s * 100, + v * 100 + ]; +}; + +convert$4.rgb.hwb = function (rgb) { + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert$4.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); + + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + + return [h, w * 100, b * 100]; +}; + +convert$4.rgb.cmyk = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; + + return [c * 100, m * 100, y * 100, k * 100]; +}; + +function comparativeDistance$1(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ + return ( + ((x[0] - y[0]) ** 2) + + ((x[1] - y[1]) ** 2) + + ((x[2] - y[2]) ** 2) + ); +} + +convert$4.rgb.keyword = function (rgb) { + const reversed = reverseKeywords$1[rgb]; + if (reversed) { + return reversed; + } + + let currentClosestDistance = Infinity; + let currentClosestKeyword; + + for (const keyword of Object.keys(cssKeywords$1)) { + const value = cssKeywords$1[keyword]; + + // Compute comparative distance + const distance = comparativeDistance$1(rgb, value); + + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + + return currentClosestKeyword; +}; + +convert$4.keyword.rgb = function (keyword) { + return cssKeywords$1[keyword]; +}; + +convert$4.rgb.xyz = function (rgb) { + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; + + // Assume sRGB + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); + + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + + return [x * 100, y * 100, z * 100]; +}; + +convert$4.rgb.lab = function (rgb) { + const xyz = convert$4.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + return [l, a, b]; +}; + +convert$4.hsl.rgb = function (hsl) { + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; + + if (s === 0) { + val = l * 255; + return [val, val, val]; + } + + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } + + const t1 = 2 * l - t2; + + const rgb = [0, 0, 0]; + for (let i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } + + if (t3 > 1) { + t3--; + } + + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } + + rgb[i] = val * 255; + } + + return rgb; +}; + +convert$4.hsl.hsv = function (hsl) { + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); + + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + const v = (l + s) / 2; + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); + + return [h, sv * 100, v * 100]; +}; + +convert$4.hsv.rgb = function (hsv) { + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; + + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - (s * f)); + const t = 255 * v * (1 - (s * (1 - f))); + v *= 255; + + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; + +convert$4.hsv.hsl = function (hsv) { + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; + + l = (2 - s) * v; + const lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; + + return [h, sl * 100, l * 100]; +}; + +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert$4.hwb.rgb = function (hwb) { + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; + + // Wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } + + const i = Math.floor(6 * h); + const v = 1 - bl; + f = 6 * h - i; + + if ((i & 0x01) !== 0) { + f = 1 - f; + } + + const n = wh + f * (v - wh); // Linear interpolation + + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } + /* eslint-enable max-statements-per-line,no-multi-spaces */ + + return [r * 255, g * 255, b * 255]; +}; + +convert$4.cmyk.rgb = function (cmyk) { + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; + + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); + + return [r * 255, g * 255, b * 255]; +}; + +convert$4.xyz.rgb = function (xyz) { + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; + + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); + + // Assume sRGB + r = r > 0.0031308 + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) + : r * 12.92; + + g = g > 0.0031308 + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) + : g * 12.92; + + b = b > 0.0031308 + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) + : b * 12.92; + + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + + return [r * 255, g * 255, b * 255]; +}; + +convert$4.xyz.lab = function (xyz) { + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + return [l, a, b]; +}; + +convert$4.lab.xyz = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; + + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; + + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; + + x *= 95.047; + y *= 100; + z *= 108.883; + + return [x, y, z]; +}; + +convert$4.lab.lch = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; + + const hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; + + if (h < 0) { + h += 360; + } + + const c = Math.sqrt(a * a + b * b); + + return [l, c, h]; +}; + +convert$4.lch.lab = function (lch) { + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; + + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); + + return [l, a, b]; +}; + +convert$4.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert$4.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization + + value = Math.round(value / 50); + + if (value === 0) { + return 30; + } + + let ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); + + if (value === 2) { + ansi += 60; + } + + return ansi; +}; + +convert$4.hsv.ansi16 = function (args) { + // Optimization here; we already know the value and don't need to get + // it converted for us. + return convert$4.rgb.ansi16(convert$4.hsv.rgb(args), args[2]); +}; + +convert$4.rgb.ansi256 = function (args) { + const r = args[0]; + const g = args[1]; + const b = args[2]; + + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } + + if (r > 248) { + return 231; + } + + return Math.round(((r - 8) / 247) * 24) + 232; + } + + const ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); + + return ansi; +}; + +convert$4.ansi16.rgb = function (args) { + let color = args % 10; + + // Handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } + + color = color / 10.5 * 255; + + return [color, color, color]; + } + + const mult = (~~(args > 50) + 1) * 0.5; + const r = ((color & 1) * mult) * 255; + const g = (((color >> 1) & 1) * mult) * 255; + const b = (((color >> 2) & 1) * mult) * 255; + + return [r, g, b]; +}; + +convert$4.ansi256.rgb = function (args) { + // Handle greyscale + if (args >= 232) { + const c = (args - 232) * 10 + 8; + return [c, c, c]; + } + + args -= 16; + + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = (rem % 6) / 5 * 255; + + return [r, g, b]; +}; + +convert$4.rgb.hex = function (args) { + const integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); + + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert$4.hex.rgb = function (args) { + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } + + let colorString = match[0]; + + if (match[0].length === 3) { + colorString = colorString.split('').map(char => { + return char + char; + }).join(''); + } + + const integer = parseInt(colorString, 16); + const r = (integer >> 16) & 0xFF; + const g = (integer >> 8) & 0xFF; + const b = integer & 0xFF; + + return [r, g, b]; +}; + +convert$4.rgb.hcg = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = (max - min); + let grayscale; + let hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma; + } + + hue /= 6; + hue %= 1; + + return [hue * 360, chroma * 100, grayscale * 100]; +}; + +convert$4.hsl.hcg = function (hsl) { + const s = hsl[1] / 100; + const l = hsl[2] / 100; + + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); + + let f = 0; + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } + + return [hsl[0], c * 100, f * 100]; +}; + +convert$4.hsv.hcg = function (hsv) { + const s = hsv[1] / 100; + const v = hsv[2] / 100; + + const c = s * v; + let f = 0; + + if (c < 1.0) { + f = (v - c) / (1 - c); + } + + return [hsv[0], c * 100, f * 100]; +}; + +convert$4.hcg.rgb = function (hcg) { + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } + + const pure = [0, 0, 0]; + const hi = (h % 1) * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; + + /* eslint-disable max-statements-per-line */ + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } + /* eslint-enable max-statements-per-line */ + + mg = (1.0 - c) * g; + + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; + +convert$4.hcg.hsv = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + const v = c + g * (1.0 - c); + let f = 0; + + if (v > 0.0) { + f = c / v; + } + + return [hcg[0], f * 100, v * 100]; +}; + +convert$4.hcg.hsl = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; + + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } + + return [hcg[0], s * 100, l * 100]; +}; + +convert$4.hcg.hwb = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; + +convert$4.hwb.hcg = function (hwb) { + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; + + if (c < 1) { + g = (v - c) / (1 - c); + } + + return [hwb[0], c * 100, g * 100]; +}; + +convert$4.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; + +convert$4.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; + +convert$4.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; + +convert$4.gray.hsl = function (args) { + return [0, 0, args[0]]; +}; + +convert$4.gray.hsv = convert$4.gray.hsl; + +convert$4.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; + +convert$4.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; + +convert$4.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; + +convert$4.gray.hex = function (gray) { + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; + + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert$4.rgb.gray = function (rgb) { + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; + +const conversions$4 = conversions$5; + +/* + This function routes a model to all other models. + + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). + + conversions that are not possible simply are not included. +*/ + +function buildGraph$1() { + const graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + const models = Object.keys(conversions$4); + + for (let len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } + + return graph; +} + +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS$1(fromModel) { + const graph = buildGraph$1(); + const queue = [fromModel]; // Unshift -> queue -> pop + + graph[fromModel].distance = 0; + + while (queue.length) { + const current = queue.pop(); + const adjacents = Object.keys(conversions$4[current]); + + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; + + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } + + return graph; +} + +function link$2(from, to) { + return function (args) { + return to(from(args)); + }; +} + +function wrapConversion$1(toModel, graph) { + const path = [graph[toModel].parent, toModel]; + let fn = conversions$4[graph[toModel].parent][toModel]; + + let cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link$2(conversions$4[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } + + fn.conversion = path; + return fn; +} + +var route$3 = function (fromModel) { + const graph = deriveBFS$1(fromModel); + const conversion = {}; + + const models = Object.keys(graph); + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; + + if (node.parent === null) { + // No possible conversion, or this node is the source model. + continue; + } + + conversion[toModel] = wrapConversion$1(toModel, graph); + } + + return conversion; +}; + +const conversions$3 = conversions$5; +const route$2 = route$3; + +const convert$3 = {}; + +const models$1 = Object.keys(conversions$3); + +function wrapRaw$1(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + return fn(args); + }; + + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +function wrapRounded$1(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + const result = fn(args); + + // We're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (let len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } + + return result; + }; + + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +models$1.forEach(fromModel => { + convert$3[fromModel] = {}; + + Object.defineProperty(convert$3[fromModel], 'channels', {value: conversions$3[fromModel].channels}); + Object.defineProperty(convert$3[fromModel], 'labels', {value: conversions$3[fromModel].labels}); + + const routes = route$2(fromModel); + const routeModels = Object.keys(routes); + + routeModels.forEach(toModel => { + const fn = routes[toModel]; + + convert$3[fromModel][toModel] = wrapRounded$1(fn); + convert$3[fromModel][toModel].raw = wrapRaw$1(fn); + }); +}); + +var colorConvert$1 = convert$3; + +(function (module) { + +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; + +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); +}; + +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = colorConvert$1; + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); +}(ansiStyles$2)); + +var hasFlag$4 = (flag, argv = process.argv) => { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +}; + +const os$2 = require$$0$2; +const tty = tty$1; +const hasFlag$3 = hasFlag$4; + +const {env: env$2} = process; + +let forceColor$1; +if (hasFlag$3('no-color') || + hasFlag$3('no-colors') || + hasFlag$3('color=false') || + hasFlag$3('color=never')) { + forceColor$1 = 0; +} else if (hasFlag$3('color') || + hasFlag$3('colors') || + hasFlag$3('color=true') || + hasFlag$3('color=always')) { + forceColor$1 = 1; +} + +if ('FORCE_COLOR' in env$2) { + if (env$2.FORCE_COLOR === 'true') { + forceColor$1 = 1; + } else if (env$2.FORCE_COLOR === 'false') { + forceColor$1 = 0; + } else { + forceColor$1 = env$2.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$2.FORCE_COLOR, 10), 3); + } +} + +function translateLevel$2(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor$2(haveStream, streamIsTTY) { + if (forceColor$1 === 0) { + return 0; + } + + if (hasFlag$3('color=16m') || + hasFlag$3('color=full') || + hasFlag$3('color=truecolor')) { + return 3; + } + + if (hasFlag$3('color=256')) { + return 2; + } + + if (haveStream && !streamIsTTY && forceColor$1 === undefined) { + return 0; + } + + const min = forceColor$1 || 0; + + if (env$2.TERM === 'dumb') { + return min; + } + + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os$2.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env$2) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env$2) || env$2.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env$2) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$2.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env$2.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env$2) { + const version = parseInt((env$2.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env$2.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env$2.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$2.TERM)) { + return 1; + } + + if ('COLORTERM' in env$2) { + return 1; + } + + return min; +} + +function getSupportLevel$1(stream) { + const level = supportsColor$2(stream, stream && stream.isTTY); + return translateLevel$2(level); +} + +var supportsColor_1$1 = { + supportsColor: getSupportLevel$1, + stdout: translateLevel$2(supportsColor$2(true, tty.isatty(1))), + stderr: translateLevel$2(supportsColor$2(true, tty.isatty(2))) +}; + +const stringReplaceAll$1 = (string, substring, replacer) => { + let index = string.indexOf(substring); + if (index === -1) { + return string; + } + + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + do { + returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => { + let endIndex = 0; + let returnValue = ''; + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +var util$4 = { + stringReplaceAll: stringReplaceAll$1, + stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1 +}; + +const TEMPLATE_REGEX$1 = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX$1 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX$1 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX$1 = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; + +const ESCAPES$1 = new Map([ + ['n', '\n'], + ['r', '\r'], + ['t', '\t'], + ['b', '\b'], + ['f', '\f'], + ['v', '\v'], + ['0', '\0'], + ['\\', '\\'], + ['e', '\u001B'], + ['a', '\u0007'] +]); + +function unescape$1(c) { + const u = c[0] === 'u'; + const bracket = c[1] === '{'; + + if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } + + if (u && bracket) { + return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); + } + + return ESCAPES$1.get(c) || c; +} + +function parseArguments$1(name, arguments_) { + const results = []; + const chunks = arguments_.trim().split(/\s*,\s*/g); + let matches; + + for (const chunk of chunks) { + const number = Number(chunk); + if (!Number.isNaN(number)) { + results.push(number); + } else if ((matches = chunk.match(STRING_REGEX$1))) { + results.push(matches[2].replace(ESCAPE_REGEX$1, (m, escape, character) => escape ? unescape$1(escape) : character)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } + + return results; +} + +function parseStyle$1(style) { + STYLE_REGEX$1.lastIndex = 0; + + const results = []; + let matches; + + while ((matches = STYLE_REGEX$1.exec(style)) !== null) { + const name = matches[1]; + + if (matches[2]) { + const args = parseArguments$1(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } + + return results; +} + +function buildStyle$1(chalk, styles) { + const enabled = {}; + + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } + + let current = chalk; + for (const [styleName, styles] of Object.entries(enabled)) { + if (!Array.isArray(styles)) { + continue; + } + + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; + } + + return current; +} + +var templates$1 = (chalk, temporary) => { + const styles = []; + const chunks = []; + let chunk = []; + + // eslint-disable-next-line max-params + temporary.replace(TEMPLATE_REGEX$1, (m, escapeCharacter, inverse, style, close, character) => { + if (escapeCharacter) { + chunk.push(unescape$1(escapeCharacter)); + } else if (style) { + const string = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? string : buildStyle$1(chalk, styles)(string)); + styles.push({inverse, styles: parseStyle$1(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } + + chunks.push(buildStyle$1(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(character); + } + }); + + chunks.push(chunk.join('')); + + if (styles.length > 0) { + const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMessage); + } + + return chunks.join(''); +}; + +const ansiStyles$1 = ansiStyles$2.exports; +const {stdout: stdoutColor, stderr: stderrColor} = supportsColor_1$1; +const { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +} = util$4; + +const {isArray: isArray$2} = Array; + +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = [ + 'ansi', + 'ansi', + 'ansi256', + 'ansi16m' +]; + +const styles = Object.create(null); + +const applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } + + // Detect level if not set manually + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; +}; + +class ChalkClass { + constructor(options) { + // eslint-disable-next-line no-constructor-return + return chalkFactory(options); + } +} + +const chalkFactory = options => { + const chalk = {}; + applyOptions(chalk, options); + + chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); + + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + + chalk.template.constructor = () => { + throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); + }; + + chalk.template.Instance = ChalkClass; + + return chalk.template; +}; + +function Chalk(options) { + return chalkFactory(options); +} + +for (const [styleName, style] of Object.entries(ansiStyles$1)) { + styles[styleName] = { + get() { + const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); + Object.defineProperty(this, styleName, {value: builder}); + return builder; + } + }; +} + +styles.visible = { + get() { + const builder = createBuilder(this, this._styler, true); + Object.defineProperty(this, 'visible', {value: builder}); + return builder; + } +}; + +const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; + +for (const model of usedModels) { + styles[model] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles$1.color[levelMapping[level]][model](...arguments_), ansiStyles$1.color.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} + +for (const model of usedModels) { + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles$1.bgColor[levelMapping[level]][model](...arguments_), ansiStyles$1.bgColor.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} + +const proto = Object.defineProperties(() => {}, { + ...styles, + level: { + enumerable: true, + get() { + return this._generator.level; + }, + set(level) { + this._generator.level = level; + } + } +}); + +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } + + return { + open, + close, + openAll, + closeAll, + parent + }; +}; + +const createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => { + if (isArray$2(arguments_[0]) && isArray$2(arguments_[0].raw)) { + // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` + return applyStyle(builder, chalkTag(builder, ...arguments_)); + } + + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); + }; + + // We alter the prototype because we must return a function, but there is + // no way to create a function with a different prototype + Object.setPrototypeOf(builder, proto); + + builder._generator = self; + builder._styler = _styler; + builder._isEmpty = _isEmpty; + + return builder; +}; + +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self._isEmpty ? '' : string; + } + + let styler = self._styler; + + if (styler === undefined) { + return string; + } + + const {openAll, closeAll} = styler; + if (string.indexOf('\u001B') !== -1) { + while (styler !== undefined) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + string = stringReplaceAll(string, styler.close, styler.open); + + styler = styler.parent; + } + } + + // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + const lfIndex = string.indexOf('\n'); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); + } + + return openAll + string + closeAll; +}; + +let template; +const chalkTag = (chalk, ...strings) => { + const [firstString] = strings; + + if (!isArray$2(firstString) || !isArray$2(firstString.raw)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return strings.join(' '); + } + + const arguments_ = strings.slice(1); + const parts = [firstString.raw[0]]; + + for (let i = 1; i < firstString.length; i++) { + parts.push( + String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), + String(firstString.raw[i]) + ); + } + + if (template === undefined) { + template = templates$1; + } + + return template(chalk, parts.join('')); +}; + +Object.defineProperties(Chalk.prototype, styles); + +const chalk$1 = Chalk(); // eslint-disable-line new-cap +chalk$1.supportsColor = stdoutColor; +chalk$1.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap +chalk$1.stderr.supportsColor = stderrColor; + +var source$1 = chalk$1; + +var chokidar = {}; + +var utils$7 = {}; + +const path$a = path$b; +const WIN_SLASH = '\\\\/'; +const WIN_NO_SLASH = `[^${WIN_SLASH}]`; + +/** + * Posix glob regex + */ + +const DOT_LITERAL = '\\.'; +const PLUS_LITERAL = '\\+'; +const QMARK_LITERAL = '\\?'; +const SLASH_LITERAL = '\\/'; +const ONE_CHAR = '(?=.)'; +const QMARK = '[^/]'; +const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; +const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; +const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; +const NO_DOT = `(?!${DOT_LITERAL})`; +const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; +const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; +const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; +const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; +const STAR$1 = `${QMARK}*?`; + +const POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR: STAR$1, + START_ANCHOR +}; + +/** + * Windows glob regex + */ + +const WINDOWS_CHARS = { + ...POSIX_CHARS, + + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)` +}; + +/** + * POSIX Bracket Regex + */ + +const POSIX_REGEX_SOURCE$1 = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; + +var constants$5 = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1, + + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + '***': '*', + '**/**': '**', + '**/**/**': '**' + }, + + // Digits + CHAR_0: 48, /* 0 */ + CHAR_9: 57, /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 65, /* A */ + CHAR_LOWERCASE_A: 97, /* a */ + CHAR_UPPERCASE_Z: 90, /* Z */ + CHAR_LOWERCASE_Z: 122, /* z */ + + CHAR_LEFT_PARENTHESES: 40, /* ( */ + CHAR_RIGHT_PARENTHESES: 41, /* ) */ + + CHAR_ASTERISK: 42, /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, /* & */ + CHAR_AT: 64, /* @ */ + CHAR_BACKWARD_SLASH: 92, /* \ */ + CHAR_CARRIAGE_RETURN: 13, /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ + CHAR_COLON: 58, /* : */ + CHAR_COMMA: 44, /* , */ + CHAR_DOT: 46, /* . */ + CHAR_DOUBLE_QUOTE: 34, /* " */ + CHAR_EQUAL: 61, /* = */ + CHAR_EXCLAMATION_MARK: 33, /* ! */ + CHAR_FORM_FEED: 12, /* \f */ + CHAR_FORWARD_SLASH: 47, /* / */ + CHAR_GRAVE_ACCENT: 96, /* ` */ + CHAR_HASH: 35, /* # */ + CHAR_HYPHEN_MINUS: 45, /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ + CHAR_LEFT_CURLY_BRACE: 123, /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ + CHAR_LINE_FEED: 10, /* \n */ + CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ + CHAR_PERCENT: 37, /* % */ + CHAR_PLUS: 43, /* + */ + CHAR_QUESTION_MARK: 63, /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ + CHAR_SEMICOLON: 59, /* ; */ + CHAR_SINGLE_QUOTE: 39, /* ' */ + CHAR_SPACE: 32, /* */ + CHAR_TAB: 9, /* \t */ + CHAR_UNDERSCORE: 95, /* _ */ + CHAR_VERTICAL_LINE: 124, /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ + + SEP: path$a.sep, + + /** + * Create EXTGLOB_CHARS + */ + + extglobChars(chars) { + return { + '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, + '?': { type: 'qmark', open: '(?:', close: ')?' }, + '+': { type: 'plus', open: '(?:', close: ')+' }, + '*': { type: 'star', open: '(?:', close: ')*' }, + '@': { type: 'at', open: '(?:', close: ')' } + }; + }, + + /** + * Create GLOB_CHARS + */ + + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; } +}; - function count(value) { - if (value) { - if (value[0] && value[0].messages) { - // Multiple vfiles - countInAll(value); +(function (exports) { + +const path = path$b; +const win32 = process.platform === 'win32'; +const { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL +} = constants$5; + +exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); +exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); +exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); +exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); +exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); + +exports.removeBackslashes = str => { + return str.replace(REGEX_REMOVE_BACKSLASH, match => { + return match === '\\' ? '' : match; + }); +}; + +exports.supportsLookbehinds = () => { + const segs = process.version.slice(1).split('.').map(Number); + if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { + return true; + } + return false; +}; + +exports.isWindows = options => { + if (options && typeof options.windows === 'boolean') { + return options.windows; + } + return win32 === true || path.sep === '\\'; +}; + +exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; +}; + +exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith('./')) { + output = output.slice(2); + state.prefix = './'; + } + return output; +}; + +exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? '' : '^'; + const append = options.contains ? '' : '$'; + + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + return output; +}; +}(utils$7)); + +const utils$6 = utils$7; +const { + CHAR_ASTERISK: CHAR_ASTERISK$1, /* * */ + CHAR_AT, /* @ */ + CHAR_BACKWARD_SLASH, /* \ */ + CHAR_COMMA: CHAR_COMMA$2, /* , */ + CHAR_DOT: CHAR_DOT$1, /* . */ + CHAR_EXCLAMATION_MARK, /* ! */ + CHAR_FORWARD_SLASH, /* / */ + CHAR_LEFT_CURLY_BRACE: CHAR_LEFT_CURLY_BRACE$1, /* { */ + CHAR_LEFT_PARENTHESES: CHAR_LEFT_PARENTHESES$1, /* ( */ + CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$2, /* [ */ + CHAR_PLUS, /* + */ + CHAR_QUESTION_MARK, /* ? */ + CHAR_RIGHT_CURLY_BRACE: CHAR_RIGHT_CURLY_BRACE$1, /* } */ + CHAR_RIGHT_PARENTHESES: CHAR_RIGHT_PARENTHESES$1, /* ) */ + CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$2 /* ] */ +} = constants$5; + +const isPathSeparator = code => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; +}; + +const depth = token => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; + } +}; + +/** + * Quickly scans a glob pattern and returns an object with a handful of + * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), + * `glob` (the actual pattern), and `negated` (true if the path starts with `!`). + * + * ```js + * const pm = require('picomatch'); + * console.log(pm.scan('foo/bar/*.js')); + * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {Object} Returns an object with tokens and regex source string. + * @api public + */ + +const scan$1 = (input, options) => { + const opts = options || {}; + + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { value: '', depth: 0, isGlob: false }; + + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + + while (index < length) { + code = advance(); + let next; + + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + + if (code === CHAR_LEFT_CURLY_BRACE$1) { + braceEscaped = true; + } + continue; + } + + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE$1) { + braces++; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_CURLY_BRACE$1) { + braces++; + continue; + } + + if (braceEscaped !== true && code === CHAR_DOT$1 && (code = advance()) === CHAR_DOT$1) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (braceEscaped !== true && code === CHAR_COMMA$2) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_RIGHT_CURLY_BRACE$1) { + braces--; + + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { value: '', depth: 0, isGlob: false }; + + if (finished === true) continue; + if (prev === CHAR_DOT$1 && index === (start + 1)) { + start += 2; + continue; + } + + lastIndex = index + 1; + continue; + } + + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS + || code === CHAR_AT + || code === CHAR_ASTERISK$1 + || code === CHAR_QUESTION_MARK + || code === CHAR_EXCLAMATION_MARK; + + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES$1) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES$1) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + continue; + } + break; + } + } + + if (code === CHAR_ASTERISK$1) { + if (prev === CHAR_ASTERISK$1) isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_LEFT_SQUARE_BRACKET$2) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET$2) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + } + } + + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES$1) { + isGlob = token.isGlob = true; + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES$1) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES$1) { + finished = true; + break; + } + } + continue; + } + break; + } + + if (isGlob === true) { + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } + + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + + let base = str; + let prefix = ''; + let glob = ''; + + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ''; + glob = str; + } else { + base = str; + } + + if (base && base !== '' && base !== '/' && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + + if (opts.unescape === true) { + if (glob) glob = utils$6.removeBackslashes(glob); + + if (base && backslashes === true) { + base = utils$6.removeBackslashes(base); + } + } + + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated + }; + + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } + + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + if (idx !== 0 || value !== '') { + parts.push(value); + } + prevIndex = i; + } + + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + + state.slashes = slashes; + state.parts = parts; + } + + return state; +}; + +var scan_1 = scan$1; + +const constants$4 = constants$5; +const utils$5 = utils$7; + +/** + * Constants + */ + +const { + MAX_LENGTH: MAX_LENGTH$4, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS +} = constants$4; + +/** + * Helpers + */ + +const expandRange = (args, options) => { + if (typeof options.expandRange === 'function') { + return options.expandRange(...args, options); + } + + args.sort(); + const value = `[${args.join('-')}]`; + + try { + /* eslint-disable-next-line no-new */ + new RegExp(value); + } catch (ex) { + return args.map(v => utils$5.escapeRegex(v)).join('..'); + } + + return value; +}; + +/** + * Create the message for a syntax error + */ + +const syntaxError$1 = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; +}; + +/** + * Parse the given input string. + * @param {String} input + * @param {Object} options + * @return {Object} + */ + +const parse$e = (input, options) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + input = REPLACEMENTS[input] || input; + + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$4, opts.maxLength) : MAX_LENGTH$4; + + let len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + const bos = { type: 'bos', value: '', output: opts.prepend || '' }; + const tokens = [bos]; + + const capture = opts.capture ? '' : '?:'; + const win32 = utils$5.isWindows(options); + + // create constants based on platform, for windows or posix + const PLATFORM_CHARS = constants$4.globChars(win32); + const EXTGLOB_CHARS = constants$4.extglobChars(PLATFORM_CHARS); + + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + + const globstar = (opts) => { + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const nodot = opts.dot ? '' : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + // minimatch options support + if (typeof opts.noext === 'boolean') { + opts.noextglob = opts.noext; + } + + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: '', + output: '', + prefix: '', + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + + input = utils$5.removePrefix(input, state); + len = input.length; + + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + + /** + * Tokenizing helpers + */ + + const eos = () => state.index === len - 1; + const peek = state.peek = (n = 1) => input[state.index + n]; + const advance = state.advance = () => input[++state.index]; + const remaining = () => input.slice(state.index + 1); + const consume = (value = '', num = 0) => { + state.consumed += value; + state.index += num; + }; + const append = token => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + + const negate = () => { + let count = 1; + + while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { + advance(); + state.start++; + count++; + } + + if (count % 2 === 0) { + return false; + } + + state.negated = true; + state.start++; + return true; + }; + + const increment = type => { + state[type]++; + stack.push(type); + }; + + const decrement = type => { + state[type]--; + stack.pop(); + }; + + /** + * Push tokens onto the tokens array. This helper speeds up + * tokenizing by 1) helping us avoid backtracking as much as possible, + * and 2) helping us avoid creating extra tokens when consecutive + * characters are plain text. This improves performance and simplifies + * lookbehinds. + */ + + const push = tok => { + if (prev.type === 'globstar') { + const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); + const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); + + if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = 'star'; + prev.value = '*'; + prev.output = star; + state.output += prev.output; + } + } + + if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { + extglobs[extglobs.length - 1].inner += tok.value; + } + + if (tok.value || tok.output) append(tok); + if (prev && prev.type === 'text' && tok.type === 'text') { + prev.value += tok.value; + prev.output = (prev.output || '') + tok.value; + return; + } + + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + + const extglobOpen = (type, value) => { + const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; + + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + const output = (opts.capture ? '(' : '') + token.open; + + increment('parens'); + push({ type, value, output: state.output ? '' : ONE_CHAR }); + push({ type: 'paren', extglob: true, value: advance(), output }); + extglobs.push(token); + }; + + const extglobClose = token => { + let output = token.close + (opts.capture ? ')' : ''); + + if (token.type === 'negate') { + let extglobStar = star; + + if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { + extglobStar = globstar(opts); + } + + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + + if (token.prev.type === 'bos' && eos()) { + state.negatedExtglob = true; + } + } + + push({ type: 'paren', extglob: true, value, output }); + decrement('parens'); + }; + + /** + * Fast paths + */ + + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { + if (first === '\\') { + backslashes = true; + return m; + } + + if (first === '?') { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ''); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); + } + return QMARK.repeat(chars.length); + } + + if (first === '.') { + return DOT_LITERAL.repeat(chars.length); + } + + if (first === '*') { + if (esc) { + return esc + first + (rest ? star : ''); + } + return star; + } + return esc ? m : `\\${m}`; + }); + + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ''); } else { - // One vfile / messages - countAll(value.messages || value); + output = output.replace(/\\+/g, m => { + return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); + }); } } + + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + + state.output = utils$5.wrapOutput(output, state, options); + return state; } - function countInAll(files) { - var length = files.length; - var index = -1; + /** + * Tokenize input until we reach end-of-string + */ + + while (!eos()) { + value = advance(); + + if (value === '\u0000') { + continue; + } + + /** + * Escaped characters + */ + + if (value === '\\') { + const next = peek(); + + if (next === '/' && opts.bash !== true) { + continue; + } + + if (next === '.' || next === ';') { + continue; + } + + if (!next) { + value += '\\'; + push({ type: 'text', value }); + continue; + } + + // collapse slashes to reduce potential for exploits + const match = /^\\+/.exec(remaining()); + let slashes = 0; + + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += '\\'; + } + } + + if (opts.unescape === true) { + value = advance() || ''; + } else { + value += advance() || ''; + } + + if (state.brackets === 0) { + push({ type: 'text', value }); + continue; + } + } + + /** + * If we're inside a regex character class, continue + * until we reach the closing bracket. + */ + + if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { + if (opts.posix !== false && value === ':') { + const inner = prev.value.slice(1); + if (inner.includes('[')) { + prev.posix = true; + + if (inner.includes(':')) { + const idx = prev.value.lastIndexOf('['); + const pre = prev.value.slice(0, idx); + const rest = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } + } + } + + if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { + value = `\\${value}`; + } + + if (value === ']' && (prev.value === '[' || prev.value === '[^')) { + value = `\\${value}`; + } - while (++index < length) { - count(files[index].messages); + if (opts.posix === true && value === '!' && prev.value === '[') { + value = '^'; + } + + prev.value += value; + append({ value }); + continue; + } + + /** + * If we're inside a quoted string, continue + * until we reach the closing double quote. + */ + + if (state.quotes === 1 && value !== '"') { + value = utils$5.escapeRegex(value); + prev.value += value; + append({ value }); + continue; + } + + /** + * Double quotes + */ + + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({ type: 'text', value }); + } + continue; + } + + /** + * Parentheses + */ + + if (value === '(') { + increment('parens'); + push({ type: 'paren', value }); + continue; + } + + if (value === ')') { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError$1('opening', '(')); + } + + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + + push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); + decrement('parens'); + continue; + } + + /** + * Square brackets + */ + + if (value === '[') { + if (opts.nobracket === true || !remaining().includes(']')) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError$1('closing', ']')); + } + + value = `\\${value}`; + } else { + increment('brackets'); + } + + push({ type: 'bracket', value }); + continue; } + + if (value === ']') { + if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError$1('opening', '[')); + } + + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + decrement('brackets'); + + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { + value = `/${value}`; + } + + prev.value += value; + append({ value }); + + // when literal brackets are explicitly disabled + // assume we should match with a regex character class + if (opts.literalBrackets === false || utils$5.hasRegexChars(prevValue)) { + continue; + } + + const escaped = utils$5.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + + // when literal brackets are explicitly enabled + // assume we should escape the brackets to match literal characters + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + + // when the user specifies nothing, try to match both + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; + } + + /** + * Braces + */ + + if (value === '{' && opts.nobrace !== true) { + increment('braces'); + + const open = { + type: 'brace', + value, + output: '(', + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + + braces.push(open); + push(open); + continue; + } + + if (value === '}') { + const brace = braces[braces.length - 1]; + + if (opts.nobrace === true || !brace) { + push({ type: 'text', value, output: value }); + continue; + } + + let output = ')'; + + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + if (arr[i].type === 'brace') { + break; + } + if (arr[i].type !== 'dots') { + range.unshift(arr[i].value); + } + } + + output = expandRange(range, opts); + state.backtrack = true; + } + + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = '\\{'; + value = output = '\\}'; + state.output = out; + for (const t of toks) { + state.output += (t.output || t.value); + } + } + + push({ type: 'brace', value, output }); + decrement('braces'); + braces.pop(); + continue; + } + + /** + * Pipes + */ + + if (value === '|') { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({ type: 'text', value }); + continue; + } + + /** + * Commas + */ + + if (value === ',') { + let output = value; + + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === 'braces') { + brace.comma = true; + output = '|'; + } + + push({ type: 'comma', value, output }); + continue; + } + + /** + * Slashes + */ + + if (value === '/') { + // if the beginning of the glob is "./", advance the start + // to the current index, and don't add the "./" characters + // to the state. This greatly simplifies lookbehinds when + // checking for BOS characters like "!" and "." (not "./") + if (prev.type === 'dot' && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ''; + state.output = ''; + tokens.pop(); + prev = bos; // reset "prev" to the first token + continue; + } + + push({ type: 'slash', value, output: SLASH_LITERAL }); + continue; + } + + /** + * Dots + */ + + if (value === '.') { + if (state.braces > 0 && prev.type === 'dot') { + if (prev.value === '.') prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = 'dots'; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + + if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { + push({ type: 'text', value, output: DOT_LITERAL }); + continue; + } + + push({ type: 'dot', value, output: DOT_LITERAL }); + continue; + } + + /** + * Question marks + */ + + if (value === '?') { + const isGroup = prev && prev.value === '('; + if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('qmark', value); + continue; + } + + if (prev && prev.type === 'paren') { + const next = peek(); + let output = value; + + if (next === '<' && !utils$5.supportsLookbehinds()) { + throw new Error('Node.js v10 or higher is required for regex lookbehinds'); + } + + if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { + output = `\\${value}`; + } + + push({ type: 'text', value, output }); + continue; + } + + if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { + push({ type: 'qmark', value, output: QMARK_NO_DOT }); + continue; + } + + push({ type: 'qmark', value, output: QMARK }); + continue; + } + + /** + * Exclamation + */ + + if (value === '!') { + if (opts.noextglob !== true && peek() === '(') { + if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { + extglobOpen('negate', value); + continue; + } + } + + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + + /** + * Plus + */ + + if (value === '+') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('plus', value); + continue; + } + + if ((prev && prev.value === '(') || opts.regex === false) { + push({ type: 'plus', value, output: PLUS_LITERAL }); + continue; + } + + if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { + push({ type: 'plus', value }); + continue; + } + + push({ type: 'plus', value: PLUS_LITERAL }); + continue; + } + + /** + * Plain text + */ + + if (value === '@') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + push({ type: 'at', extglob: true, value, output: '' }); + continue; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Plain text + */ + + if (value !== '*') { + if (value === '$' || value === '^') { + value = `\\${value}`; + } + + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Stars + */ + + if (prev && (prev.type === 'globstar' || prev.star === true)) { + prev.type = 'star'; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + + let rest = remaining(); + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen('star', value); + continue; + } + + if (prev.type === 'star') { + if (opts.noglobstar === true) { + consume(value); + continue; + } + + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === 'slash' || prior.type === 'bos'; + const afterStar = before && (before.type === 'star' || before.type === 'globstar'); + + if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { + push({ type: 'star', value, output: '' }); + continue; + } + + const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); + const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); + if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { + push({ type: 'star', value, output: '' }); + continue; + } + + // strip consecutive `/**/` + while (rest.slice(0, 3) === '/**') { + const after = input[state.index + 4]; + if (after && after !== '/') { + break; + } + rest = rest.slice(3); + consume('/**', 3); + } + + if (prior.type === 'bos' && eos()) { + prev.type = 'globstar'; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { + const end = rest[1] !== void 0 ? '|$' : ''; + + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + + state.output += prior.output + prev.output; + state.globstar = true; + + consume(value + advance()); + + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + if (prior.type === 'bos' && rest[0] === '/') { + prev.type = 'globstar'; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + // remove single star from output + state.output = state.output.slice(0, -prev.output.length); + + // reset previous token to globstar + prev.type = 'globstar'; + prev.output = globstar(opts); + prev.value += value; + + // reset output with globstar + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + + const token = { type: 'star', value, output: star }; + + if (opts.bash === true) { + token.output = '.*?'; + if (prev.type === 'bos' || prev.type === 'slash') { + token.output = nodot + token.output; + } + push(token); + continue; + } + + if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { + token.output = value; + push(token); + continue; + } + + if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { + if (prev.type === 'dot') { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + + } else { + state.output += nodot; + prev.output += nodot; + } + + if (peek() !== '*') { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + + push(token); } - function countAll(messages) { - var length = messages.length; - var index = -1; - var fatal; + while (state.brackets > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', ']')); + state.output = utils$5.escapeLast(state.output, '['); + decrement('brackets'); + } + + while (state.parens > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', ')')); + state.output = utils$5.escapeLast(state.output, '('); + decrement('parens'); + } + + while (state.braces > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', '}')); + state.output = utils$5.escapeLast(state.output, '{'); + decrement('braces'); + } + + if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { + push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); + } + + // rebuild the output if we had to backtrack at any point + if (state.backtrack === true) { + state.output = ''; + + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; - while (++index < length) { - fatal = messages[index].fatal; - result[fatal === null || fatal === undefined ? null : Boolean(fatal)]++; + if (token.suffix) { + state.output += token.suffix; + } } } -} -var slice$4 = [].slice; + return state; +}; -var wrap_1 = wrap$3; +/** + * Fast paths for creating regular expressions for common glob patterns. + * This can significantly speed up processing and has very little downside + * impact when none of the fast paths match. + */ -// Wrap `fn`. -// Can be sync or async; return a promise, receive a completion handler, return -// new values and errors. -function wrap$3(fn, callback) { - var invoked; +parse$e.fastpaths = (input, options) => { + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$4, opts.maxLength) : MAX_LENGTH$4; + const len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } - return wrapped + input = REPLACEMENTS[input] || input; + const win32 = utils$5.isWindows(options); + + // create constants based on platform, for windows or posix + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants$4.globChars(win32); + + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? '' : '?:'; + const state = { negated: false, prefix: '' }; + let star = opts.bash === true ? '.*?' : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + const globstar = (opts) => { + if (opts.noglobstar === true) return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const create = str => { + switch (str) { + case '*': + return `${nodot}${ONE_CHAR}${star}`; + + case '.*': + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*.*': + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*/*': + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + + case '**': + return nodot + globstar(opts); + + case '**/*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + + case '**/*.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '**/.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - function wrapped() { - var params = slice$4.call(arguments, 0); - var callback = fn.length > params.length; - var result; + default: { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) return; - if (callback) { - params.push(done); + const source = create(match[1]); + if (!source) return; + + return source + DOT_LITERAL + match[2]; + } } + }; + + const output = utils$5.removePrefix(input, state); + let source = create(output); + + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + + return source; +}; + +var parse_1$2 = parse$e; + +const path$9 = path$b; +const scan = scan_1; +const parse$d = parse_1$2; +const utils$4 = utils$7; +const constants$3 = constants$5; +const isObject$3 = val => val && typeof val === 'object' && !Array.isArray(val); + +/** + * Creates a matcher function from one or more glob patterns. The + * returned function takes a string to match as its first argument, + * and returns true if the string is a match. The returned matcher + * function also takes a boolean as the second argument that, when true, + * returns an object with additional information. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch(glob[, options]); + * + * const isMatch = picomatch('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @name picomatch + * @param {String|Array} `globs` One or more glob patterns. + * @param {Object=} `options` + * @return {Function=} Returns a matcher function. + * @api public + */ + +const picomatch$3 = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map(input => picomatch$3(input, options, returnState)); + const arrayMatcher = str => { + for (const isMatch of fns) { + const state = isMatch(str); + if (state) return state; + } + return false; + }; + return arrayMatcher; + } + + const isState = isObject$3(glob) && glob.tokens && glob.input; + + if (glob === '' || (typeof glob !== 'string' && !isState)) { + throw new TypeError('Expected pattern to be a non-empty string'); + } + + const opts = options || {}; + const posix = utils$4.isWindows(options); + const regex = isState + ? picomatch$3.compileRe(glob, options) + : picomatch$3.makeRe(glob, options, false, true); + + const state = regex.state; + delete regex.state; + + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch$3(opts.ignore, ignoreOpts, returnState); + } + + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch$3.test(input, regex, options, { glob, posix }); + const result = { glob, state, regex, posix, input, output, match, isMatch }; + + if (typeof opts.onResult === 'function') { + opts.onResult(result); + } + + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + + if (isIgnored(input)) { + if (typeof opts.onIgnore === 'function') { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + + if (typeof opts.onMatch === 'function') { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + + if (returnState) { + matcher.state = state; + } + + return matcher; +}; + +/** + * Test `input` with the given `regex`. This is used by the main + * `picomatch()` function to test the input string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.test(input, regex[, options]); + * + * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); + * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } + * ``` + * @param {String} `input` String to test. + * @param {RegExp} `regex` + * @return {Object} Returns an object with matching info. + * @api public + */ + +picomatch$3.test = (input, regex, options, { glob, posix } = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be a string'); + } + + if (input === '') { + return { isMatch: false, output: '' }; + } + + const opts = options || {}; + const format = opts.format || (posix ? utils$4.toPosixSlashes : null); + let match = input === glob; + let output = (match && format) ? format(input) : input; + + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch$3.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + + return { isMatch: Boolean(match), match, output }; +}; + +/** + * Match the basename of a filepath. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.matchBase(input, glob[, options]); + * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true + * ``` + * @param {String} `input` String to test. + * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). + * @return {Boolean} + * @api public + */ + +picomatch$3.matchBase = (input, glob, options, posix = utils$4.isWindows(options)) => { + const regex = glob instanceof RegExp ? glob : picomatch$3.makeRe(glob, options); + return regex.test(path$9.basename(input)); +}; + +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.isMatch(string, patterns[, options]); + * + * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String|Array} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +picomatch$3.isMatch = (str, patterns, options) => picomatch$3(patterns, options)(str); + +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const picomatch = require('picomatch'); + * const result = picomatch.parse(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as a regex source string. + * @api public + */ + +picomatch$3.parse = (pattern, options) => { + if (Array.isArray(pattern)) return pattern.map(p => picomatch$3.parse(p, options)); + return parse$d(pattern, { ...options, fastpaths: false }); +}; + +/** + * Scan a glob pattern to separate the pattern into segments. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.scan(input[, options]); + * + * const result = picomatch.scan('!./foo/*.js'); + * console.log(result); + * { prefix: '!./', + * input: '!./foo/*.js', + * start: 3, + * base: 'foo', + * glob: '*.js', + * isBrace: false, + * isBracket: false, + * isGlob: true, + * isExtglob: false, + * isGlobstar: false, + * negated: true } + * ``` + * @param {String} `input` Glob pattern to scan. + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + +picomatch$3.scan = (input, options) => scan(input, options); + +/** + * Create a regular expression from a parsed glob pattern. + * + * ```js + * const picomatch = require('picomatch'); + * const state = picomatch.parse('*.js'); + * // picomatch.compileRe(state[, options]); + * + * console.log(picomatch.compileRe(state)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `state` The object returned from the `.parse` method. + * @param {Object} `options` + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +picomatch$3.compileRe = (parsed, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return parsed.output; + } + + const opts = options || {}; + const prepend = opts.contains ? '' : '^'; + const append = opts.contains ? '' : '$'; + + let source = `${prepend}(?:${parsed.output})${append}`; + if (parsed && parsed.negated === true) { + source = `^(?!${source}).*$`; + } + + const regex = picomatch$3.toRegex(source, options); + if (returnState === true) { + regex.state = parsed; + } + + return regex; +}; + +picomatch$3.makeRe = (input, options, returnOutput = false, returnState = false) => { + if (!input || typeof input !== 'string') { + throw new TypeError('Expected a non-empty string'); + } + + const opts = options || {}; + let parsed = { negated: false, fastpaths: true }; + let prefix = ''; + let output; + + if (input.startsWith('./')) { + input = input.slice(2); + prefix = parsed.prefix = './'; + } + + if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { + output = parse$d.fastpaths(input, options); + } + + if (output === undefined) { + parsed = parse$d(input, options); + parsed.prefix = prefix + (parsed.prefix || ''); + } else { + parsed.output = output; + } + + return picomatch$3.compileRe(parsed, options, returnOutput, returnState); +}; + +/** + * Create a regular expression from the given regex source string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.toRegex(source[, options]); + * + * const { output } = picomatch.parse('*.js'); + * console.log(picomatch.toRegex(output)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `source` Regular expression source string. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +picomatch$3.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } +}; + +/** + * Picomatch constants. + * @return {Object} + */ + +picomatch$3.constants = constants$3; + +/** + * Expose "picomatch" + */ + +var picomatch_1 = picomatch$3; + +var picomatch$2 = picomatch_1; + +const fs$9 = require$$0$3; +const { Readable } = require$$1; +const sysPath$3 = path$b; +const { promisify: promisify$3 } = require$$0$4; +const picomatch$1 = picomatch$2; + +const readdir$1 = promisify$3(fs$9.readdir); +const stat$3 = promisify$3(fs$9.stat); +const lstat$2 = promisify$3(fs$9.lstat); +const realpath$2 = promisify$3(fs$9.realpath); + +/** + * @typedef {Object} EntryInfo + * @property {String} path + * @property {String} fullPath + * @property {fs.Stats=} stats + * @property {fs.Dirent=} dirent + * @property {String} basename + */ + +const BANG$2 = '!'; +const RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR'; +const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP', RECURSIVE_ERROR_CODE]); +const FILE_TYPE = 'files'; +const DIR_TYPE = 'directories'; +const FILE_DIR_TYPE = 'files_directories'; +const EVERYTHING_TYPE = 'all'; +const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE]; + +const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code); +const [maj, min] = process.versions.node.split('.').slice(0, 2).map(n => Number.parseInt(n, 10)); +const wantBigintFsStats = process.platform === 'win32' && (maj > 10 || (maj === 10 && min >= 5)); + +const normalizeFilter = filter => { + if (filter === undefined) return; + if (typeof filter === 'function') return filter; + + if (typeof filter === 'string') { + const glob = picomatch$1(filter.trim()); + return entry => glob(entry.basename); + } + + if (Array.isArray(filter)) { + const positive = []; + const negative = []; + for (const item of filter) { + const trimmed = item.trim(); + if (trimmed.charAt(0) === BANG$2) { + negative.push(picomatch$1(trimmed.slice(1))); + } else { + positive.push(picomatch$1(trimmed)); + } + } + + if (negative.length > 0) { + if (positive.length > 0) { + return entry => + positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename)); + } + return entry => !negative.some(f => f(entry.basename)); + } + return entry => positive.some(f => f(entry.basename)); + } +}; + +class ReaddirpStream extends Readable { + static get defaultOptions() { + return { + root: '.', + /* eslint-disable no-unused-vars */ + fileFilter: (path) => true, + directoryFilter: (path) => true, + /* eslint-enable no-unused-vars */ + type: FILE_TYPE, + lstat: false, + depth: 2147483648, + alwaysStat: false + }; + } + + constructor(options = {}) { + super({ + objectMode: true, + autoDestroy: true, + highWaterMark: options.highWaterMark || 4096 + }); + const opts = { ...ReaddirpStream.defaultOptions, ...options }; + const { root, type } = opts; + + this._fileFilter = normalizeFilter(opts.fileFilter); + this._directoryFilter = normalizeFilter(opts.directoryFilter); + + const statMethod = opts.lstat ? lstat$2 : stat$3; + // Use bigint stats if it's windows and stat() supports options (node 10+). + if (wantBigintFsStats) { + this._stat = path => statMethod(path, { bigint: true }); + } else { + this._stat = statMethod; + } + + this._maxDepth = opts.depth; + this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); + this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); + this._wantsEverything = type === EVERYTHING_TYPE; + this._root = sysPath$3.resolve(root); + this._isDirent = ('Dirent' in fs$9) && !opts.alwaysStat; + this._statsProp = this._isDirent ? 'dirent' : 'stats'; + this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent }; + + // Launch stream with one parent, the root dir. + this.parents = [this._exploreDir(root, 1)]; + this.reading = false; + this.parent = undefined; + } + + async _read(batch) { + if (this.reading) return; + this.reading = true; try { - result = fn.apply(null, params); + while (!this.destroyed && batch > 0) { + const { path, depth, files = [] } = this.parent || {}; + + if (files.length > 0) { + const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path)); + for (const entry of await Promise.all(slice)) { + if (this.destroyed) return; + + const entryType = await this._getEntryType(entry); + if (entryType === 'directory' && this._directoryFilter(entry)) { + if (depth <= this._maxDepth) { + this.parents.push(this._exploreDir(entry.fullPath, depth + 1)); + } + + if (this._wantsDir) { + this.push(entry); + batch--; + } + } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) { + if (this._wantsFile) { + this.push(entry); + batch--; + } + } + } + } else { + const parent = this.parents.pop(); + if (!parent) { + this.push(null); + break; + } + this.parent = await parent; + if (this.destroyed) return; + } + } } catch (error) { - // Well, this is quite the pickle. - // `fn` received a callback and invoked it (thus continuing the pipeline), - // but later also threw an error. - // We’re not about to restart the pipeline again, so the only thing left - // to do is to throw the thing instead. - if (callback && invoked) { - throw error + this.destroy(error); + } finally { + this.reading = false; + } + } + + async _exploreDir(path, depth) { + let files; + try { + files = await readdir$1(path, this._rdOptions); + } catch (error) { + this._onError(error); + } + return { files, depth, path }; + } + + async _formatEntry(dirent, path) { + let entry; + try { + const basename = this._isDirent ? dirent.name : dirent; + const fullPath = sysPath$3.resolve(sysPath$3.join(path, basename)); + entry = { path: sysPath$3.relative(this._root, fullPath), fullPath, basename }; + entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath); + } catch (err) { + this._onError(err); + } + return entry; + } + + _onError(err) { + if (isNormalFlowError(err) && !this.destroyed) { + this.emit('warn', err); + } else { + this.destroy(err); + } + } + + async _getEntryType(entry) { + // entry may be undefined, because a warning or an error were emitted + // and the statsProp is undefined + const stats = entry && entry[this._statsProp]; + if (!stats) { + return; + } + if (stats.isFile()) { + return 'file'; + } + if (stats.isDirectory()) { + return 'directory'; + } + if (stats && stats.isSymbolicLink()) { + const full = entry.fullPath; + try { + const entryRealPath = await realpath$2(full); + const entryRealPathStats = await lstat$2(entryRealPath); + if (entryRealPathStats.isFile()) { + return 'file'; + } + if (entryRealPathStats.isDirectory()) { + const len = entryRealPath.length; + if (full.startsWith(entryRealPath) && full.substr(len, 1) === sysPath$3.sep) { + const recursiveError = new Error( + `Circular symlink detected: "${full}" points to "${entryRealPath}"` + ); + recursiveError.code = RECURSIVE_ERROR_CODE; + return this._onError(recursiveError); + } + return 'directory'; + } + } catch (error) { + this._onError(error); } + } + } + + _includeAsFile(entry) { + const stats = entry && entry[this._statsProp]; + + return stats && this._wantsEverything && !stats.isDirectory(); + } +} + +/** + * @typedef {Object} ReaddirpArguments + * @property {Function=} fileFilter + * @property {Function=} directoryFilter + * @property {String=} type + * @property {Number=} depth + * @property {String=} root + * @property {Boolean=} lstat + * @property {Boolean=} bigint + */ + +/** + * Main function which ends up calling readdirRec and reads all files and directories in given root recursively. + * @param {String} root Root directory + * @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth + */ +const readdirp$1 = (root, options = {}) => { + let type = options.entryType || options.type; + if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility + if (type) options.type = type; + if (!root) { + throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)'); + } else if (typeof root !== 'string') { + throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)'); + } else if (type && !ALL_TYPES.includes(type)) { + throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`); + } - return done(error) + options.root = root; + return new ReaddirpStream(options); +}; + +const readdirpPromise = (root, options = {}) => { + return new Promise((resolve, reject) => { + const files = []; + readdirp$1(root, options) + .on('data', entry => files.push(entry)) + .on('end', () => resolve(files)) + .on('error', error => reject(error)); + }); +}; + +readdirp$1.promise = readdirpPromise; +readdirp$1.ReaddirpStream = ReaddirpStream; +readdirp$1.default = readdirp$1; + +var readdirp_1 = readdirp$1; + +var anymatch$2 = {exports: {}}; + +/*! + * normalize-path <https://github.com/jonschlinkert/normalize-path> + * + * Copyright (c) 2014-2018, Jon Schlinkert. + * Released under the MIT License. + */ + +var normalizePath$2 = function(path, stripTrailing) { + if (typeof path !== 'string') { + throw new TypeError('expected path to be a string'); + } + + if (path === '\\' || path === '/') return '/'; + + var len = path.length; + if (len <= 1) return path; + + // ensure that win32 namespaces has two leading slashes, so that the path is + // handled properly by the win32 version of path.parse() after being normalized + // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces + var prefix = ''; + if (len > 4 && path[3] === '\\') { + var ch = path[2]; + if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') { + path = path.slice(2); + prefix = '//'; } + } - if (!callback) { - if (result && typeof result.then === 'function') { - result.then(then, done); - } else if (result instanceof Error) { - done(result); + var segs = path.split(/[/\\]+/); + if (stripTrailing !== false && segs[segs.length - 1] === '') { + segs.pop(); + } + return prefix + segs.join('/'); +}; + +Object.defineProperty(anymatch$2.exports, "__esModule", { value: true }); + +const picomatch = picomatch$2; +const normalizePath$1 = normalizePath$2; + +/** + * @typedef {(testString: string) => boolean} AnymatchFn + * @typedef {string|RegExp|AnymatchFn} AnymatchPattern + * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher + */ +const BANG$1 = '!'; +const DEFAULT_OPTIONS = {returnIndex: false}; +const arrify$1 = (item) => Array.isArray(item) ? item : [item]; + +/** + * @param {AnymatchPattern} matcher + * @param {object} options + * @returns {AnymatchFn} + */ +const createPattern = (matcher, options) => { + if (typeof matcher === 'function') { + return matcher; + } + if (typeof matcher === 'string') { + const glob = picomatch(matcher, options); + return (string) => matcher === string || glob(string); + } + if (matcher instanceof RegExp) { + return (string) => matcher.test(string); + } + return (string) => false; +}; + +/** + * @param {Array<Function>} patterns + * @param {Array<Function>} negPatterns + * @param {String|Array} args + * @param {Boolean} returnIndex + * @returns {boolean|number} + */ +const matchPatterns = (patterns, negPatterns, args, returnIndex) => { + const isList = Array.isArray(args); + const _path = isList ? args[0] : args; + if (!isList && typeof _path !== 'string') { + throw new TypeError('anymatch: second argument must be a string: got ' + + Object.prototype.toString.call(_path)) + } + const path = normalizePath$1(_path); + + for (let index = 0; index < negPatterns.length; index++) { + const nglob = negPatterns[index]; + if (nglob(path)) { + return returnIndex ? -1 : false; + } + } + + const applied = isList && [path].concat(args.slice(1)); + for (let index = 0; index < patterns.length; index++) { + const pattern = patterns[index]; + if (isList ? pattern(...applied) : pattern(path)) { + return returnIndex ? index : true; + } + } + + return returnIndex ? -1 : false; +}; + +/** + * @param {AnymatchMatcher} matchers + * @param {Array|string} testString + * @param {object} options + * @returns {boolean|number|Function} + */ +const anymatch$1 = (matchers, testString, options = DEFAULT_OPTIONS) => { + if (matchers == null) { + throw new TypeError('anymatch: specify first argument'); + } + const opts = typeof options === 'boolean' ? {returnIndex: options} : options; + const returnIndex = opts.returnIndex || false; + + // Early cache for matchers. + const mtchers = arrify$1(matchers); + const negatedGlobs = mtchers + .filter(item => typeof item === 'string' && item.charAt(0) === BANG$1) + .map(item => item.slice(1)) + .map(item => picomatch(item, opts)); + const patterns = mtchers + .filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG$1)) + .map(matcher => createPattern(matcher, opts)); + + if (testString == null) { + return (testString, ri = false) => { + const returnIndex = typeof ri === 'boolean' ? ri : false; + return matchPatterns(patterns, negatedGlobs, testString, returnIndex); + } + } + + return matchPatterns(patterns, negatedGlobs, testString, returnIndex); +}; + +anymatch$1.default = anymatch$1; +anymatch$2.exports = anymatch$1; + +/*! + * is-extglob <https://github.com/jonschlinkert/is-extglob> + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +var isExtglob$1 = function isExtglob(str) { + if (typeof str !== 'string' || str === '') { + return false; + } + + var match; + while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { + if (match[2]) return true; + str = str.slice(match.index + match[0].length); + } + + return false; +}; + +/*! + * is-glob <https://github.com/jonschlinkert/is-glob> + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +var isExtglob = isExtglob$1; +var chars$1 = { '{': '}', '(': ')', '[': ']'}; +var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; +var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; + +var isGlob$2 = function isGlob(str, options) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) { + return true; + } + + var regex = strictRegex; + var match; + + // optionally relax regex + if (options && options.strict === false) { + regex = relaxedRegex; + } + + while ((match = regex.exec(str))) { + if (match[2]) return true; + var idx = match.index + match[0].length; + + // if an open bracket/brace/paren is escaped, + // set the index to the next closing character + var open = match[1]; + var close = open ? chars$1[open] : null; + if (open && close) { + var n = str.indexOf(close, idx); + if (n !== -1) { + idx = n + 1; + } + } + + str = str.slice(idx); + } + return false; +}; + +var isGlob$1 = isGlob$2; +var pathPosixDirname = path$b.posix.dirname; +var isWin32 = require$$0$2.platform() === 'win32'; + +var slash = '/'; +var backslash = /\\/g; +var enclosure = /[\{\[].*[\}\]]$/; +var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; +var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; + +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + * @returns {string} + */ +var globParent$1 = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + + // flip windows path separators + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } + + // special case for strings ending in enclosure containing path separator + if (enclosure.test(str)) { + str += slash; + } + + // preserves full path in case of trailing path separator + str += 'a'; + + // remove path parts that are globby + do { + str = pathPosixDirname(str); + } while (isGlob$1(str) || globby.test(str)); + + // remove escape chars and return result + return str.replace(escaped, '$1'); +}; + +var utils$3 = {}; + +(function (exports) { + +exports.isInteger = num => { + if (typeof num === 'number') { + return Number.isInteger(num); + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isInteger(Number(num)); + } + return false; +}; + +/** + * Find a node of the given type + */ + +exports.find = (node, type) => node.nodes.find(node => node.type === type); + +/** + * Find a node of the given type + */ + +exports.exceedsLimit = (min, max, step = 1, limit) => { + if (limit === false) return false; + if (!exports.isInteger(min) || !exports.isInteger(max)) return false; + return ((Number(max) - Number(min)) / Number(step)) >= limit; +}; + +/** + * Escape the given node with '\\' before node.value + */ + +exports.escapeNode = (block, n = 0, type) => { + let node = block.nodes[n]; + if (!node) return; + + if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { + if (node.escaped !== true) { + node.value = '\\' + node.value; + node.escaped = true; + } + } +}; + +/** + * Returns true if the given brace node should be enclosed in literal braces + */ + +exports.encloseBrace = node => { + if (node.type !== 'brace') return false; + if ((node.commas >> 0 + node.ranges >> 0) === 0) { + node.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a brace node is invalid. + */ + +exports.isInvalidBrace = block => { + if (block.type !== 'brace') return false; + if (block.invalid === true || block.dollar) return true; + if ((block.commas >> 0 + block.ranges >> 0) === 0) { + block.invalid = true; + return true; + } + if (block.open !== true || block.close !== true) { + block.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a node is an open or close node + */ + +exports.isOpenOrClose = node => { + if (node.type === 'open' || node.type === 'close') { + return true; + } + return node.open === true || node.close === true; +}; + +/** + * Reduce an array of text nodes. + */ + +exports.reduce = nodes => nodes.reduce((acc, node) => { + if (node.type === 'text') acc.push(node.value); + if (node.type === 'range') node.type = 'text'; + return acc; +}, []); + +/** + * Flatten an array + */ + +exports.flatten = (...args) => { + const result = []; + const flat = arr => { + for (let i = 0; i < arr.length; i++) { + let ele = arr[i]; + Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele); + } + return result; + }; + flat(args); + return result; +}; +}(utils$3)); + +const utils$2 = utils$3; + +var stringify$6 = (ast, options = {}) => { + let stringify = (node, parent = {}) => { + let invalidBlock = options.escapeInvalid && utils$2.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let output = ''; + + if (node.value) { + if ((invalidBlock || invalidNode) && utils$2.isOpenOrClose(node)) { + return '\\' + node.value; + } + return node.value; + } + + if (node.value) { + return node.value; + } + + if (node.nodes) { + for (let child of node.nodes) { + output += stringify(child); + } + } + return output; + }; + + return stringify(ast); +}; + +/*! + * is-number <https://github.com/jonschlinkert/is-number> + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ + +var isNumber$3 = function(num) { + if (typeof num === 'number') { + return num - num === 0; + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); + } + return false; +}; + +/*! + * to-regex-range <https://github.com/micromatch/to-regex-range> + * + * Copyright (c) 2015-present, Jon Schlinkert. + * Released under the MIT License. + */ + +const isNumber$2 = isNumber$3; + +const toRegexRange$1 = (min, max, options) => { + if (isNumber$2(min) === false) { + throw new TypeError('toRegexRange: expected the first argument to be a number'); + } + + if (max === void 0 || min === max) { + return String(min); + } + + if (isNumber$2(max) === false) { + throw new TypeError('toRegexRange: expected the second argument to be a number.'); + } + + let opts = { relaxZeros: true, ...options }; + if (typeof opts.strictZeros === 'boolean') { + opts.relaxZeros = opts.strictZeros === false; + } + + let relax = String(opts.relaxZeros); + let shorthand = String(opts.shorthand); + let capture = String(opts.capture); + let wrap = String(opts.wrap); + let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap; + + if (toRegexRange$1.cache.hasOwnProperty(cacheKey)) { + return toRegexRange$1.cache[cacheKey].result; + } + + let a = Math.min(min, max); + let b = Math.max(min, max); + + if (Math.abs(a - b) === 1) { + let result = min + '|' + max; + if (opts.capture) { + return `(${result})`; + } + if (opts.wrap === false) { + return result; + } + return `(?:${result})`; + } + + let isPadded = hasPadding(min) || hasPadding(max); + let state = { min, max, a, b }; + let positives = []; + let negatives = []; + + if (isPadded) { + state.isPadded = isPadded; + state.maxLen = String(state.max).length; + } + + if (a < 0) { + let newMin = b < 0 ? Math.abs(b) : 1; + negatives = splitToPatterns(newMin, Math.abs(a), state, opts); + a = state.a = 0; + } + + if (b >= 0) { + positives = splitToPatterns(a, b, state, opts); + } + + state.negatives = negatives; + state.positives = positives; + state.result = collatePatterns(negatives, positives); + + if (opts.capture === true) { + state.result = `(${state.result})`; + } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) { + state.result = `(?:${state.result})`; + } + + toRegexRange$1.cache[cacheKey] = state; + return state.result; +}; + +function collatePatterns(neg, pos, options) { + let onlyNegative = filterPatterns(neg, pos, '-', false) || []; + let onlyPositive = filterPatterns(pos, neg, '', false) || []; + let intersected = filterPatterns(neg, pos, '-?', true) || []; + let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); + return subpatterns.join('|'); +} + +function splitToRanges(min, max) { + let nines = 1; + let zeros = 1; + + let stop = countNines(min, nines); + let stops = new Set([max]); + + while (min <= stop && stop <= max) { + stops.add(stop); + nines += 1; + stop = countNines(min, nines); + } + + stop = countZeros(max + 1, zeros) - 1; + + while (min < stop && stop <= max) { + stops.add(stop); + zeros += 1; + stop = countZeros(max + 1, zeros) - 1; + } + + stops = [...stops]; + stops.sort(compare$c); + return stops; +} + +/** + * Convert a range to a regex pattern + * @param {Number} `start` + * @param {Number} `stop` + * @return {String} + */ + +function rangeToPattern(start, stop, options) { + if (start === stop) { + return { pattern: start, count: [], digits: 0 }; + } + + let zipped = zip(start, stop); + let digits = zipped.length; + let pattern = ''; + let count = 0; + + for (let i = 0; i < digits; i++) { + let [startDigit, stopDigit] = zipped[i]; + + if (startDigit === stopDigit) { + pattern += startDigit; + + } else if (startDigit !== '0' || stopDigit !== '9') { + pattern += toCharacterClass(startDigit, stopDigit); + + } else { + count++; + } + } + + if (count) { + pattern += options.shorthand === true ? '\\d' : '[0-9]'; + } + + return { pattern, count: [count], digits }; +} + +function splitToPatterns(min, max, tok, options) { + let ranges = splitToRanges(min, max); + let tokens = []; + let start = min; + let prev; + + for (let i = 0; i < ranges.length; i++) { + let max = ranges[i]; + let obj = rangeToPattern(String(start), String(max), options); + let zeros = ''; + + if (!tok.isPadded && prev && prev.pattern === obj.pattern) { + if (prev.count.length > 1) { + prev.count.pop(); + } + + prev.count.push(obj.count[0]); + prev.string = prev.pattern + toQuantifier(prev.count); + start = max + 1; + continue; + } + + if (tok.isPadded) { + zeros = padZeros(max, tok, options); + } + + obj.string = zeros + obj.pattern + toQuantifier(obj.count); + tokens.push(obj); + start = max + 1; + prev = obj; + } + + return tokens; +} + +function filterPatterns(arr, comparison, prefix, intersection, options) { + let result = []; + + for (let ele of arr) { + let { string } = ele; + + // only push if _both_ are negative... + if (!intersection && !contains(comparison, 'string', string)) { + result.push(prefix + string); + } + + // or _both_ are positive + if (intersection && contains(comparison, 'string', string)) { + result.push(prefix + string); + } + } + return result; +} + +/** + * Zip strings + */ + +function zip(a, b) { + let arr = []; + for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]); + return arr; +} + +function compare$c(a, b) { + return a > b ? 1 : b > a ? -1 : 0; +} + +function contains(arr, key, val) { + return arr.some(ele => ele[key] === val); +} + +function countNines(min, len) { + return Number(String(min).slice(0, -len) + '9'.repeat(len)); +} + +function countZeros(integer, zeros) { + return integer - (integer % Math.pow(10, zeros)); +} + +function toQuantifier(digits) { + let [start = 0, stop = ''] = digits; + if (stop || start > 1) { + return `{${start + (stop ? ',' + stop : '')}}`; + } + return ''; +} + +function toCharacterClass(a, b, options) { + return `[${a}${(b - a === 1) ? '' : '-'}${b}]`; +} + +function hasPadding(str) { + return /^-?(0+)\d/.test(str); +} + +function padZeros(value, tok, options) { + if (!tok.isPadded) { + return value; + } + + let diff = Math.abs(tok.maxLen - String(value).length); + let relax = options.relaxZeros !== false; + + switch (diff) { + case 0: + return ''; + case 1: + return relax ? '0?' : '0'; + case 2: + return relax ? '0{0,2}' : '00'; + default: { + return relax ? `0{0,${diff}}` : `0{${diff}}`; + } + } +} + +/** + * Cache + */ + +toRegexRange$1.cache = {}; +toRegexRange$1.clearCache = () => (toRegexRange$1.cache = {}); + +/** + * Expose `toRegexRange` + */ + +var toRegexRange_1 = toRegexRange$1; + +/*! + * fill-range <https://github.com/jonschlinkert/fill-range> + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + */ + +const util$3 = require$$0$4; +const toRegexRange = toRegexRange_1; + +const isObject$2 = val => val !== null && typeof val === 'object' && !Array.isArray(val); + +const transform$3 = toNumber => { + return value => toNumber === true ? Number(value) : String(value); +}; + +const isValidValue = value => { + return typeof value === 'number' || (typeof value === 'string' && value !== ''); +}; + +const isNumber$1 = num => Number.isInteger(+num); + +const zeros = input => { + let value = `${input}`; + let index = -1; + if (value[0] === '-') value = value.slice(1); + if (value === '0') return false; + while (value[++index] === '0'); + return index > 0; +}; + +const stringify$5 = (start, end, options) => { + if (typeof start === 'string' || typeof end === 'string') { + return true; + } + return options.stringify === true; +}; + +const pad = (input, maxLength, toNumber) => { + if (maxLength > 0) { + let dash = input[0] === '-' ? '-' : ''; + if (dash) input = input.slice(1); + input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); + } + if (toNumber === false) { + return String(input); + } + return input; +}; + +const toMaxLen = (input, maxLength) => { + let negative = input[0] === '-' ? '-' : ''; + if (negative) { + input = input.slice(1); + maxLength--; + } + while (input.length < maxLength) input = '0' + input; + return negative ? ('-' + input) : input; +}; + +const toSequence = (parts, options) => { + parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + + let prefix = options.capture ? '' : '?:'; + let positives = ''; + let negatives = ''; + let result; + + if (parts.positives.length) { + positives = parts.positives.join('|'); + } + + if (parts.negatives.length) { + negatives = `-(${prefix}${parts.negatives.join('|')})`; + } + + if (positives && negatives) { + result = `${positives}|${negatives}`; + } else { + result = positives || negatives; + } + + if (options.wrap) { + return `(${prefix}${result})`; + } + + return result; +}; + +const toRange = (a, b, isNumbers, options) => { + if (isNumbers) { + return toRegexRange(a, b, { wrap: false, ...options }); + } + + let start = String.fromCharCode(a); + if (a === b) return start; + + let stop = String.fromCharCode(b); + return `[${start}-${stop}]`; +}; + +const toRegex = (start, end, options) => { + if (Array.isArray(start)) { + let wrap = options.wrap === true; + let prefix = options.capture ? '' : '?:'; + return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); + } + return toRegexRange(start, end, options); +}; + +const rangeError = (...args) => { + return new RangeError('Invalid range arguments: ' + util$3.inspect(...args)); +}; + +const invalidRange = (start, end, options) => { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; +}; + +const invalidStep = (step, options) => { + if (options.strictRanges === true) { + throw new TypeError(`Expected step "${step}" to be a number`); + } + return []; +}; + +const fillNumbers = (start, end, step = 1, options = {}) => { + let a = Number(start); + let b = Number(end); + + if (!Number.isInteger(a) || !Number.isInteger(b)) { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; + } + + // fix negative zero + if (a === 0) a = 0; + if (b === 0) b = 0; + + let descending = a > b; + let startString = String(start); + let endString = String(end); + let stepString = String(step); + step = Math.max(Math.abs(step), 1); + + let padded = zeros(startString) || zeros(endString) || zeros(stepString); + let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; + let toNumber = padded === false && stringify$5(start, end, options) === false; + let format = options.transform || transform$3(toNumber); + + if (options.toRegex && step === 1) { + return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); + } + + let parts = { negatives: [], positives: [] }; + let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + if (options.toRegex === true && step > 1) { + push(a); + } else { + range.push(pad(format(a, index), maxLen, toNumber)); + } + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return step > 1 + ? toSequence(parts, options) + : toRegex(range, null, { wrap: false, ...options }); + } + + return range; +}; + +const fillLetters = (start, end, step = 1, options = {}) => { + if ((!isNumber$1(start) && start.length > 1) || (!isNumber$1(end) && end.length > 1)) { + return invalidRange(start, end, options); + } + + + let format = options.transform || (val => String.fromCharCode(val)); + let a = `${start}`.charCodeAt(0); + let b = `${end}`.charCodeAt(0); + + let descending = a > b; + let min = Math.min(a, b); + let max = Math.max(a, b); + + if (options.toRegex && step === 1) { + return toRange(min, max, false, options); + } + + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + range.push(format(a, index)); + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return toRegex(range, null, { wrap: false, options }); + } + + return range; +}; + +const fill$2 = (start, end, step, options = {}) => { + if (end == null && isValidValue(start)) { + return [start]; + } + + if (!isValidValue(start) || !isValidValue(end)) { + return invalidRange(start, end, options); + } + + if (typeof step === 'function') { + return fill$2(start, end, 1, { transform: step }); + } + + if (isObject$2(step)) { + return fill$2(start, end, 0, step); + } + + let opts = { ...options }; + if (opts.capture === true) opts.wrap = true; + step = step || opts.step || 1; + + if (!isNumber$1(step)) { + if (step != null && !isObject$2(step)) return invalidStep(step, opts); + return fill$2(start, end, 1, step); + } + + if (isNumber$1(start) && isNumber$1(end)) { + return fillNumbers(start, end, step, opts); + } + + return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); +}; + +var fillRange = fill$2; + +const fill$1 = fillRange; +const utils$1 = utils$3; + +const compile$1 = (ast, options = {}) => { + let walk = (node, parent = {}) => { + let invalidBlock = utils$1.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let invalid = invalidBlock === true || invalidNode === true; + let prefix = options.escapeInvalid === true ? '\\' : ''; + let output = ''; + + if (node.isOpen === true) { + return prefix + node.value; + } + if (node.isClose === true) { + return prefix + node.value; + } + + if (node.type === 'open') { + return invalid ? (prefix + node.value) : '('; + } + + if (node.type === 'close') { + return invalid ? (prefix + node.value) : ')'; + } + + if (node.type === 'comma') { + return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); + } + + if (node.value) { + return node.value; + } + + if (node.nodes && node.ranges > 0) { + let args = utils$1.reduce(node.nodes); + let range = fill$1(...args, { ...options, wrap: false, toRegex: true }); + + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } + + if (node.nodes) { + for (let child of node.nodes) { + output += walk(child, node); + } + } + return output; + }; + + return walk(ast); +}; + +var compile_1 = compile$1; + +const fill = fillRange; +const stringify$4 = stringify$6; +const utils = utils$3; + +const append = (queue = '', stash = '', enclose = false) => { + let result = []; + + queue = [].concat(queue); + stash = [].concat(stash); + + if (!stash.length) return queue; + if (!queue.length) { + return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; + } + + for (let item of queue) { + if (Array.isArray(item)) { + for (let value of item) { + result.push(append(value, stash, enclose)); + } + } else { + for (let ele of stash) { + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); + } + } + } + return utils.flatten(result); +}; + +const expand$4 = (ast, options = {}) => { + let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; + + let walk = (node, parent = {}) => { + node.queue = []; + + let p = parent; + let q = parent.queue; + + while (p.type !== 'brace' && p.type !== 'root' && p.parent) { + p = p.parent; + q = p.queue; + } + + if (node.invalid || node.dollar) { + q.push(append(q.pop(), stringify$4(node, options))); + return; + } + + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { + q.push(append(q.pop(), ['{}'])); + return; + } + + if (node.nodes && node.ranges > 0) { + let args = utils.reduce(node.nodes); + + if (utils.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } + + let range = fill(...args, options); + if (range.length === 0) { + range = stringify$4(node, options); + } + + q.push(append(q.pop(), range)); + node.nodes = []; + return; + } + + let enclose = utils.encloseBrace(node); + let queue = node.queue; + let block = node; + + while (block.type !== 'brace' && block.type !== 'root' && block.parent) { + block = block.parent; + queue = block.queue; + } + + for (let i = 0; i < node.nodes.length; i++) { + let child = node.nodes[i]; + + if (child.type === 'comma' && node.type === 'brace') { + if (i === 1) queue.push(''); + queue.push(''); + continue; + } + + if (child.type === 'close') { + q.push(append(q.pop(), queue, enclose)); + continue; + } + + if (child.value && child.type !== 'open') { + queue.push(append(queue.pop(), child.value)); + continue; + } + + if (child.nodes) { + walk(child, node); + } + } + + return queue; + }; + + return utils.flatten(walk(ast)); +}; + +var expand_1 = expand$4; + +var constants$2 = { + MAX_LENGTH: 1024 * 64, + + // Digits + CHAR_0: '0', /* 0 */ + CHAR_9: '9', /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 'A', /* A */ + CHAR_LOWERCASE_A: 'a', /* a */ + CHAR_UPPERCASE_Z: 'Z', /* Z */ + CHAR_LOWERCASE_Z: 'z', /* z */ + + CHAR_LEFT_PARENTHESES: '(', /* ( */ + CHAR_RIGHT_PARENTHESES: ')', /* ) */ + + CHAR_ASTERISK: '*', /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: '&', /* & */ + CHAR_AT: '@', /* @ */ + CHAR_BACKSLASH: '\\', /* \ */ + CHAR_BACKTICK: '`', /* ` */ + CHAR_CARRIAGE_RETURN: '\r', /* \r */ + CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ + CHAR_COLON: ':', /* : */ + CHAR_COMMA: ',', /* , */ + CHAR_DOLLAR: '$', /* . */ + CHAR_DOT: '.', /* . */ + CHAR_DOUBLE_QUOTE: '"', /* " */ + CHAR_EQUAL: '=', /* = */ + CHAR_EXCLAMATION_MARK: '!', /* ! */ + CHAR_FORM_FEED: '\f', /* \f */ + CHAR_FORWARD_SLASH: '/', /* / */ + CHAR_HASH: '#', /* # */ + CHAR_HYPHEN_MINUS: '-', /* - */ + CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ + CHAR_LEFT_CURLY_BRACE: '{', /* { */ + CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ + CHAR_LINE_FEED: '\n', /* \n */ + CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ + CHAR_PERCENT: '%', /* % */ + CHAR_PLUS: '+', /* + */ + CHAR_QUESTION_MARK: '?', /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ + CHAR_RIGHT_CURLY_BRACE: '}', /* } */ + CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ + CHAR_SEMICOLON: ';', /* ; */ + CHAR_SINGLE_QUOTE: '\'', /* ' */ + CHAR_SPACE: ' ', /* */ + CHAR_TAB: '\t', /* \t */ + CHAR_UNDERSCORE: '_', /* _ */ + CHAR_VERTICAL_LINE: '|', /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ +}; + +const stringify$3 = stringify$6; + +/** + * Constants + */ + +const { + MAX_LENGTH: MAX_LENGTH$3, + CHAR_BACKSLASH, /* \ */ + CHAR_BACKTICK, /* ` */ + CHAR_COMMA: CHAR_COMMA$1, /* , */ + CHAR_DOT, /* . */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$1, /* [ */ + CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$1, /* ] */ + CHAR_DOUBLE_QUOTE: CHAR_DOUBLE_QUOTE$1, /* " */ + CHAR_SINGLE_QUOTE: CHAR_SINGLE_QUOTE$1, /* ' */ + CHAR_NO_BREAK_SPACE, + CHAR_ZERO_WIDTH_NOBREAK_SPACE +} = constants$2; + +/** + * parse + */ + +const parse$c = (input, options = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + let opts = options || {}; + let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$3, opts.maxLength) : MAX_LENGTH$3; + if (input.length > max) { + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + } + + let ast = { type: 'root', input, nodes: [] }; + let stack = [ast]; + let block = ast; + let prev = ast; + let brackets = 0; + let length = input.length; + let index = 0; + let depth = 0; + let value; + + /** + * Helpers + */ + + const advance = () => input[index++]; + const push = node => { + if (node.type === 'text' && prev.type === 'dot') { + prev.type = 'text'; + } + + if (prev && prev.type === 'text' && node.type === 'text') { + prev.value += node.value; + return; + } + + block.nodes.push(node); + node.parent = block; + node.prev = prev; + prev = node; + return node; + }; + + push({ type: 'bos' }); + + while (index < length) { + block = stack[stack.length - 1]; + value = advance(); + + /** + * Invalid chars + */ + + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { + continue; + } + + /** + * Escaped chars + */ + + if (value === CHAR_BACKSLASH) { + push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); + continue; + } + + /** + * Right square bracket (literal): ']' + */ + + if (value === CHAR_RIGHT_SQUARE_BRACKET$1) { + push({ type: 'text', value: '\\' + value }); + continue; + } + + /** + * Left square bracket: '[' + */ + + if (value === CHAR_LEFT_SQUARE_BRACKET$1) { + brackets++; + let next; + + while (index < length && (next = advance())) { + value += next; + + if (next === CHAR_LEFT_SQUARE_BRACKET$1) { + brackets++; + continue; + } + + if (next === CHAR_BACKSLASH) { + value += advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET$1) { + brackets--; + + if (brackets === 0) { + break; + } + } + } + + push({ type: 'text', value }); + continue; + } + + /** + * Parentheses + */ + + if (value === CHAR_LEFT_PARENTHESES) { + block = push({ type: 'paren', nodes: [] }); + stack.push(block); + push({ type: 'text', value }); + continue; + } + + if (value === CHAR_RIGHT_PARENTHESES) { + if (block.type !== 'paren') { + push({ type: 'text', value }); + continue; + } + block = stack.pop(); + push({ type: 'text', value }); + block = stack[stack.length - 1]; + continue; + } + + /** + * Quotes: '|"|` + */ + + if (value === CHAR_DOUBLE_QUOTE$1 || value === CHAR_SINGLE_QUOTE$1 || value === CHAR_BACKTICK) { + let open = value; + let next; + + if (options.keepQuotes !== true) { + value = ''; + } + + while (index < length && (next = advance())) { + if (next === CHAR_BACKSLASH) { + value += next + advance(); + continue; + } + + if (next === open) { + if (options.keepQuotes === true) value += next; + break; + } + + value += next; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Left curly brace: '{' + */ + + if (value === CHAR_LEFT_CURLY_BRACE) { + depth++; + + let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; + let brace = { + type: 'brace', + open: true, + close: false, + dollar, + depth, + commas: 0, + ranges: 0, + nodes: [] + }; + + block = push(brace); + stack.push(block); + push({ type: 'open', value }); + continue; + } + + /** + * Right curly brace: '}' + */ + + if (value === CHAR_RIGHT_CURLY_BRACE) { + if (block.type !== 'brace') { + push({ type: 'text', value }); + continue; + } + + let type = 'close'; + block = stack.pop(); + block.close = true; + + push({ type, value }); + depth--; + + block = stack[stack.length - 1]; + continue; + } + + /** + * Comma: ',' + */ + + if (value === CHAR_COMMA$1 && depth > 0) { + if (block.ranges > 0) { + block.ranges = 0; + let open = block.nodes.shift(); + block.nodes = [open, { type: 'text', value: stringify$3(block) }]; + } + + push({ type: 'comma', value }); + block.commas++; + continue; + } + + /** + * Dot: '.' + */ + + if (value === CHAR_DOT && depth > 0 && block.commas === 0) { + let siblings = block.nodes; + + if (depth === 0 || siblings.length === 0) { + push({ type: 'text', value }); + continue; + } + + if (prev.type === 'dot') { + block.range = []; + prev.value += value; + prev.type = 'range'; + + if (block.nodes.length !== 3 && block.nodes.length !== 5) { + block.invalid = true; + block.ranges = 0; + prev.type = 'text'; + continue; + } + + block.ranges++; + block.args = []; + continue; + } + + if (prev.type === 'range') { + siblings.pop(); + + let before = siblings[siblings.length - 1]; + before.value += prev.value + value; + prev = before; + block.ranges--; + continue; + } + + push({ type: 'dot', value }); + continue; + } + + /** + * Text + */ + + push({ type: 'text', value }); + } + + // Mark imbalanced braces and brackets as invalid + do { + block = stack.pop(); + + if (block.type !== 'root') { + block.nodes.forEach(node => { + if (!node.nodes) { + if (node.type === 'open') node.isOpen = true; + if (node.type === 'close') node.isClose = true; + if (!node.nodes) node.type = 'text'; + node.invalid = true; + } + }); + + // get the location of the block on parent.nodes (block's siblings) + let parent = stack[stack.length - 1]; + let index = parent.nodes.indexOf(block); + // replace the (invalid) block with it's nodes + parent.nodes.splice(index, 1, ...block.nodes); + } + } while (stack.length > 0); + + push({ type: 'eos' }); + return ast; +}; + +var parse_1$1 = parse$c; + +const stringify$2 = stringify$6; +const compile = compile_1; +const expand$3 = expand_1; +const parse$b = parse_1$1; + +/** + * Expand the given pattern or create a regex-compatible string. + * + * ```js + * const braces = require('braces'); + * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] + * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + +const braces$1 = (input, options = {}) => { + let output = []; + + if (Array.isArray(input)) { + for (let pattern of input) { + let result = braces$1.create(pattern, options); + if (Array.isArray(result)) { + output.push(...result); } else { - then(result); + output.push(result); + } + } + } else { + output = [].concat(braces$1.create(input, options)); + } + + if (options && options.expand === true && options.nodupes === true) { + output = [...new Set(output)]; + } + return output; +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * // braces.parse(pattern, [, options]); + * const ast = braces.parse('a/{b,c}/d'); + * console.log(ast); + * ``` + * @param {String} pattern Brace pattern to parse + * @param {Object} options + * @return {Object} Returns an AST + * @api public + */ + +braces$1.parse = (input, options = {}) => parse$b(input, options); + +/** + * Creates a braces string from an AST, or an AST node. + * + * ```js + * const braces = require('braces'); + * let ast = braces.parse('foo/{a,b}/bar'); + * console.log(stringify(ast.nodes[2])); //=> '{a,b}' + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces$1.stringify = (input, options = {}) => { + if (typeof input === 'string') { + return stringify$2(braces$1.parse(input, options), options); + } + return stringify$2(input, options); +}; + +/** + * Compiles a brace pattern into a regex-compatible, optimized string. + * This method is called by the main [braces](#braces) function by default. + * + * ```js + * const braces = require('braces'); + * console.log(braces.compile('a/{b,c}/d')); + * //=> ['a/(b|c)/d'] + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces$1.compile = (input, options = {}) => { + if (typeof input === 'string') { + input = braces$1.parse(input, options); + } + return compile(input, options); +}; + +/** + * Expands a brace pattern into an array. This method is called by the + * main [braces](#braces) function when `options.expand` is true. Before + * using this method it's recommended that you read the [performance notes](#performance)) + * and advantages of using [.compile](#compile) instead. + * + * ```js + * const braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/b/d', 'a/c/d']; + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces$1.expand = (input, options = {}) => { + if (typeof input === 'string') { + input = braces$1.parse(input, options); + } + + let result = expand$3(input, options); + + // filter out empty strings if specified + if (options.noempty === true) { + result = result.filter(Boolean); + } + + // filter out duplicates if specified + if (options.nodupes === true) { + result = [...new Set(result)]; + } + + return result; +}; + +/** + * Processes a brace pattern and returns either an expanded array + * (if `options.expand` is true), a highly optimized regex-compatible string. + * This method is called by the main [braces](#braces) function. + * + * ```js + * const braces = require('braces'); + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces$1.create = (input, options = {}) => { + if (input === '' || input.length < 3) { + return [input]; + } + + return options.expand !== true + ? braces$1.compile(input, options) + : braces$1.expand(input, options); +}; + +/** + * Expose "braces" + */ + +var braces_1 = braces$1; + +var require$$0$1 = [ + "3dm", + "3ds", + "3g2", + "3gp", + "7z", + "a", + "aac", + "adp", + "ai", + "aif", + "aiff", + "alz", + "ape", + "apk", + "appimage", + "ar", + "arj", + "asf", + "au", + "avi", + "bak", + "baml", + "bh", + "bin", + "bk", + "bmp", + "btif", + "bz2", + "bzip2", + "cab", + "caf", + "cgm", + "class", + "cmx", + "cpio", + "cr2", + "cur", + "dat", + "dcm", + "deb", + "dex", + "djvu", + "dll", + "dmg", + "dng", + "doc", + "docm", + "docx", + "dot", + "dotm", + "dra", + "DS_Store", + "dsk", + "dts", + "dtshd", + "dvb", + "dwg", + "dxf", + "ecelp4800", + "ecelp7470", + "ecelp9600", + "egg", + "eol", + "eot", + "epub", + "exe", + "f4v", + "fbs", + "fh", + "fla", + "flac", + "flatpak", + "fli", + "flv", + "fpx", + "fst", + "fvt", + "g3", + "gh", + "gif", + "graffle", + "gz", + "gzip", + "h261", + "h263", + "h264", + "icns", + "ico", + "ief", + "img", + "ipa", + "iso", + "jar", + "jpeg", + "jpg", + "jpgv", + "jpm", + "jxr", + "key", + "ktx", + "lha", + "lib", + "lvp", + "lz", + "lzh", + "lzma", + "lzo", + "m3u", + "m4a", + "m4v", + "mar", + "mdi", + "mht", + "mid", + "midi", + "mj2", + "mka", + "mkv", + "mmr", + "mng", + "mobi", + "mov", + "movie", + "mp3", + "mp4", + "mp4a", + "mpeg", + "mpg", + "mpga", + "mxu", + "nef", + "npx", + "numbers", + "nupkg", + "o", + "odp", + "ods", + "odt", + "oga", + "ogg", + "ogv", + "otf", + "ott", + "pages", + "pbm", + "pcx", + "pdb", + "pdf", + "pea", + "pgm", + "pic", + "png", + "pnm", + "pot", + "potm", + "potx", + "ppa", + "ppam", + "ppm", + "pps", + "ppsm", + "ppsx", + "ppt", + "pptm", + "pptx", + "psd", + "pya", + "pyc", + "pyo", + "pyv", + "qt", + "rar", + "ras", + "raw", + "resources", + "rgb", + "rip", + "rlc", + "rmf", + "rmvb", + "rpm", + "rtf", + "rz", + "s3m", + "s7z", + "scpt", + "sgi", + "shar", + "snap", + "sil", + "sketch", + "slk", + "smv", + "snk", + "so", + "stl", + "suo", + "sub", + "swf", + "tar", + "tbz", + "tbz2", + "tga", + "tgz", + "thmx", + "tif", + "tiff", + "tlz", + "ttc", + "ttf", + "txz", + "udf", + "uvh", + "uvi", + "uvm", + "uvp", + "uvs", + "uvu", + "viv", + "vob", + "war", + "wav", + "wax", + "wbmp", + "wdp", + "weba", + "webm", + "webp", + "whl", + "wim", + "wm", + "wma", + "wmv", + "wmx", + "woff", + "woff2", + "wrm", + "wvx", + "xbm", + "xif", + "xla", + "xlam", + "xls", + "xlsb", + "xlsm", + "xlsx", + "xlt", + "xltm", + "xltx", + "xm", + "xmind", + "xpi", + "xpm", + "xwd", + "xz", + "z", + "zip", + "zipx" +]; + +var binaryExtensions$1 = require$$0$1; + +const path$8 = path$b; +const binaryExtensions = binaryExtensions$1; + +const extensions = new Set(binaryExtensions); + +var isBinaryPath$1 = filePath => extensions.has(path$8.extname(filePath).slice(1).toLowerCase()); + +var constants$1 = {}; + +(function (exports) { + +const {sep} = path$b; +const {platform} = process; +const os = require$$0$2; + +exports.EV_ALL = 'all'; +exports.EV_READY = 'ready'; +exports.EV_ADD = 'add'; +exports.EV_CHANGE = 'change'; +exports.EV_ADD_DIR = 'addDir'; +exports.EV_UNLINK = 'unlink'; +exports.EV_UNLINK_DIR = 'unlinkDir'; +exports.EV_RAW = 'raw'; +exports.EV_ERROR = 'error'; + +exports.STR_DATA = 'data'; +exports.STR_END = 'end'; +exports.STR_CLOSE = 'close'; + +exports.FSEVENT_CREATED = 'created'; +exports.FSEVENT_MODIFIED = 'modified'; +exports.FSEVENT_DELETED = 'deleted'; +exports.FSEVENT_MOVED = 'moved'; +exports.FSEVENT_CLONED = 'cloned'; +exports.FSEVENT_UNKNOWN = 'unknown'; +exports.FSEVENT_TYPE_FILE = 'file'; +exports.FSEVENT_TYPE_DIRECTORY = 'directory'; +exports.FSEVENT_TYPE_SYMLINK = 'symlink'; + +exports.KEY_LISTENERS = 'listeners'; +exports.KEY_ERR = 'errHandlers'; +exports.KEY_RAW = 'rawEmitters'; +exports.HANDLER_KEYS = [exports.KEY_LISTENERS, exports.KEY_ERR, exports.KEY_RAW]; + +exports.DOT_SLASH = `.${sep}`; + +exports.BACK_SLASH_RE = /\\/g; +exports.DOUBLE_SLASH_RE = /\/\//; +exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/; +exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/; +exports.REPLACER_RE = /^\.[/\\]/; + +exports.SLASH = '/'; +exports.SLASH_SLASH = '//'; +exports.BRACE_START = '{'; +exports.BANG = '!'; +exports.ONE_DOT = '.'; +exports.TWO_DOTS = '..'; +exports.STAR = '*'; +exports.GLOBSTAR = '**'; +exports.ROOT_GLOBSTAR = '/**/*'; +exports.SLASH_GLOBSTAR = '/**'; +exports.DIR_SUFFIX = 'Dir'; +exports.ANYMATCH_OPTS = {dot: true}; +exports.STRING_TYPE = 'string'; +exports.FUNCTION_TYPE = 'function'; +exports.EMPTY_STR = ''; +exports.EMPTY_FN = () => {}; +exports.IDENTITY_FN = val => val; + +exports.isWindows = platform === 'win32'; +exports.isMacos = platform === 'darwin'; +exports.isLinux = platform === 'linux'; +exports.isIBMi = os.type() === 'OS400'; +}(constants$1)); + +const fs$8 = require$$0$3; +const sysPath$2 = path$b; +const { promisify: promisify$2 } = require$$0$4; +const isBinaryPath = isBinaryPath$1; +const { + isWindows: isWindows$3, + isLinux, + EMPTY_FN: EMPTY_FN$2, + EMPTY_STR: EMPTY_STR$1, + KEY_LISTENERS, + KEY_ERR, + KEY_RAW, + HANDLER_KEYS, + EV_CHANGE: EV_CHANGE$2, + EV_ADD: EV_ADD$2, + EV_ADD_DIR: EV_ADD_DIR$2, + EV_ERROR: EV_ERROR$2, + STR_DATA: STR_DATA$1, + STR_END: STR_END$2, + BRACE_START: BRACE_START$1, + STAR +} = constants$1; + +const THROTTLE_MODE_WATCH = 'watch'; + +const open = promisify$2(fs$8.open); +const stat$2 = promisify$2(fs$8.stat); +const lstat$1 = promisify$2(fs$8.lstat); +const close = promisify$2(fs$8.close); +const fsrealpath = promisify$2(fs$8.realpath); + +const statMethods$1 = { lstat: lstat$1, stat: stat$2 }; + +// TODO: emit errors properly. Example: EMFILE on Macos. +const foreach = (val, fn) => { + if (val instanceof Set) { + val.forEach(fn); + } else { + fn(val); + } +}; + +const addAndConvert = (main, prop, item) => { + let container = main[prop]; + if (!(container instanceof Set)) { + main[prop] = container = new Set([container]); + } + container.add(item); +}; + +const clearItem = cont => key => { + const set = cont[key]; + if (set instanceof Set) { + set.clear(); + } else { + delete cont[key]; + } +}; + +const delFromSet = (main, prop, item) => { + const container = main[prop]; + if (container instanceof Set) { + container.delete(item); + } else if (container === item) { + delete main[prop]; + } +}; + +const isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val; + +/** + * @typedef {String} Path + */ + +// fs_watch helpers + +// object to hold per-process fs_watch instances +// (may be shared across chokidar FSWatcher instances) + +/** + * @typedef {Object} FsWatchContainer + * @property {Set} listeners + * @property {Set} errHandlers + * @property {Set} rawEmitters + * @property {fs.FSWatcher=} watcher + * @property {Boolean=} watcherUnusable + */ + +/** + * @type {Map<String,FsWatchContainer>} + */ +const FsWatchInstances = new Map(); + +/** + * Instantiates the fs_watch interface + * @param {String} path to be watched + * @param {Object} options to be passed to fs_watch + * @param {Function} listener main event handler + * @param {Function} errHandler emits info about errors + * @param {Function} emitRaw emits raw event data + * @returns {fs.FSWatcher} new fsevents instance + */ +function createFsWatchInstance(path, options, listener, errHandler, emitRaw) { + const handleEvent = (rawEvent, evPath) => { + listener(path); + emitRaw(rawEvent, evPath, {watchedPath: path}); + + // emit based on events occurring for files from a directory's watcher in + // case the file's watcher misses it (and rely on throttling to de-dupe) + if (evPath && path !== evPath) { + fsWatchBroadcast( + sysPath$2.resolve(path, evPath), KEY_LISTENERS, sysPath$2.join(path, evPath) + ); + } + }; + try { + return fs$8.watch(path, options, handleEvent); + } catch (error) { + errHandler(error); + } +} + +/** + * Helper for passing fs_watch event data to a collection of listeners + * @param {Path} fullPath absolute path bound to fs_watch instance + * @param {String} type listener type + * @param {*=} val1 arguments to be passed to listeners + * @param {*=} val2 + * @param {*=} val3 + */ +const fsWatchBroadcast = (fullPath, type, val1, val2, val3) => { + const cont = FsWatchInstances.get(fullPath); + if (!cont) return; + foreach(cont[type], (listener) => { + listener(val1, val2, val3); + }); +}; + +/** + * Instantiates the fs_watch interface or binds listeners + * to an existing one covering the same file system entry + * @param {String} path + * @param {String} fullPath absolute path + * @param {Object} options to be passed to fs_watch + * @param {Object} handlers container for event listener functions + */ +const setFsWatchListener = (path, fullPath, options, handlers) => { + const {listener, errHandler, rawEmitter} = handlers; + let cont = FsWatchInstances.get(fullPath); + + /** @type {fs.FSWatcher=} */ + let watcher; + if (!options.persistent) { + watcher = createFsWatchInstance( + path, options, listener, errHandler, rawEmitter + ); + return watcher.close.bind(watcher); + } + if (cont) { + addAndConvert(cont, KEY_LISTENERS, listener); + addAndConvert(cont, KEY_ERR, errHandler); + addAndConvert(cont, KEY_RAW, rawEmitter); + } else { + watcher = createFsWatchInstance( + path, + options, + fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), + errHandler, // no need to use broadcast here + fsWatchBroadcast.bind(null, fullPath, KEY_RAW) + ); + if (!watcher) return; + watcher.on(EV_ERROR$2, async (error) => { + const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR); + cont.watcherUnusable = true; // documented since Node 10.4.1 + // Workaround for https://github.com/joyent/node/issues/4337 + if (isWindows$3 && error.code === 'EPERM') { + try { + const fd = await open(path, 'r'); + await close(fd); + broadcastErr(error); + } catch (err) {} + } else { + broadcastErr(error); } + }); + cont = { + listeners: listener, + errHandlers: errHandler, + rawEmitters: rawEmitter, + watcher + }; + FsWatchInstances.set(fullPath, cont); + } + // const index = cont.listeners.indexOf(listener); + + // removes this instance's listeners and closes the underlying fs_watch + // instance if there are no more listeners left + return () => { + delFromSet(cont, KEY_LISTENERS, listener); + delFromSet(cont, KEY_ERR, errHandler); + delFromSet(cont, KEY_RAW, rawEmitter); + if (isEmptySet(cont.listeners)) { + // Check to protect against issue gh-730. + // if (cont.watcherUnusable) { + cont.watcher.close(); + // } + FsWatchInstances.delete(fullPath); + HANDLER_KEYS.forEach(clearItem(cont)); + cont.watcher = undefined; + Object.freeze(cont); } + }; +}; + +// fs_watchFile helpers + +// object to hold per-process fs_watchFile instances +// (may be shared across chokidar FSWatcher instances) +const FsWatchFileInstances = new Map(); + +/** + * Instantiates the fs_watchFile interface or binds listeners + * to an existing one covering the same file system entry + * @param {String} path to be watched + * @param {String} fullPath absolute path + * @param {Object} options options to be passed to fs_watchFile + * @param {Object} handlers container for event listener functions + * @returns {Function} closer + */ +const setFsWatchFileListener = (path, fullPath, options, handlers) => { + const {listener, rawEmitter} = handlers; + let cont = FsWatchFileInstances.get(fullPath); + + const copts = cont && cont.options; + if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) { + fs$8.unwatchFile(fullPath); + cont = undefined; } - // Invoke `next`, only once. - function done() { - if (!invoked) { - invoked = true; + /* eslint-enable no-unused-vars, prefer-destructuring */ + + if (cont) { + addAndConvert(cont, KEY_LISTENERS, listener); + addAndConvert(cont, KEY_RAW, rawEmitter); + } else { + // TODO + // listeners.add(listener); + // rawEmitters.add(rawEmitter); + cont = { + listeners: listener, + rawEmitters: rawEmitter, + options, + watcher: fs$8.watchFile(fullPath, options, (curr, prev) => { + foreach(cont.rawEmitters, (rawEmitter) => { + rawEmitter(EV_CHANGE$2, fullPath, {curr, prev}); + }); + const currmtime = curr.mtimeMs; + if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) { + foreach(cont.listeners, (listener) => listener(path, curr)); + } + }) + }; + FsWatchFileInstances.set(fullPath, cont); + } + // const index = cont.listeners.indexOf(listener); - callback.apply(null, arguments); + // Removes this instance's listeners and closes the underlying fs_watchFile + // instance if there are no more listeners left. + return () => { + delFromSet(cont, KEY_LISTENERS, listener); + delFromSet(cont, KEY_RAW, rawEmitter); + if (isEmptySet(cont.listeners)) { + FsWatchFileInstances.delete(fullPath); + fs$8.unwatchFile(fullPath); + cont.options = cont.watcher = undefined; + Object.freeze(cont); } + }; +}; + +/** + * @mixin + */ +class NodeFsHandler$1 { + +/** + * @param {import("../index").FSWatcher} fsW + */ +constructor(fsW) { + this.fsw = fsW; + this._boundHandleError = (error) => fsW._handleError(error); +} + +/** + * Watch file for changes with fs_watchFile or fs_watch. + * @param {String} path to file or dir + * @param {Function} listener on fs change + * @returns {Function} closer for the watcher instance + */ +_watchWithNodeFs(path, listener) { + const opts = this.fsw.options; + const directory = sysPath$2.dirname(path); + const basename = sysPath$2.basename(path); + const parent = this.fsw._getWatchedDir(directory); + parent.add(basename); + const absolutePath = sysPath$2.resolve(path); + const options = {persistent: opts.persistent}; + if (!listener) listener = EMPTY_FN$2; + + let closer; + if (opts.usePolling) { + options.interval = opts.enableBinaryInterval && isBinaryPath(basename) ? + opts.binaryInterval : opts.interval; + closer = setFsWatchFileListener(path, absolutePath, options, { + listener, + rawEmitter: this.fsw._emitRaw + }); + } else { + closer = setFsWatchListener(path, absolutePath, options, { + listener, + errHandler: this._boundHandleError, + rawEmitter: this.fsw._emitRaw + }); } + return closer; +} - // Invoke `done` with one value. - // Tracks if an error is passed, too. - function then(value) { - done(null, value); +/** + * Watch a file and emit add event if warranted. + * @param {Path} file Path + * @param {fs.Stats} stats result of fs_stat + * @param {Boolean} initialAdd was the file added at watch instantiation? + * @returns {Function} closer for the watcher instance + */ +_handleFile(file, stats, initialAdd) { + if (this.fsw.closed) { + return; } + const dirname = sysPath$2.dirname(file); + const basename = sysPath$2.basename(file); + const parent = this.fsw._getWatchedDir(dirname); + // stats is always present + let prevStats = stats; + + // if the file is already being watched, do nothing + if (parent.has(basename)) return; + + const listener = async (path, newStats) => { + if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return; + if (!newStats || newStats.mtimeMs === 0) { + try { + const newStats = await stat$2(file); + if (this.fsw.closed) return; + // Check that change event was not fired because of changed only accessTime. + const at = newStats.atimeMs; + const mt = newStats.mtimeMs; + if (!at || at <= mt || mt !== prevStats.mtimeMs) { + this.fsw._emit(EV_CHANGE$2, file, newStats); + } + if (isLinux && prevStats.ino !== newStats.ino) { + this.fsw._closeFile(path); + prevStats = newStats; + this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener)); + } else { + prevStats = newStats; + } + } catch (error) { + // Fix issues where mtime is null but file is still present + this.fsw._remove(dirname, basename); + } + // add is about to be emitted if file not already tracked in parent + } else if (parent.has(basename)) { + // Check that change event was not fired because of changed only accessTime. + const at = newStats.atimeMs; + const mt = newStats.mtimeMs; + if (!at || at <= mt || mt !== prevStats.mtimeMs) { + this.fsw._emit(EV_CHANGE$2, file, newStats); + } + prevStats = newStats; + } + }; + // kick off the watcher + const closer = this._watchWithNodeFs(file, listener); + + // emit an add event if we're supposed to + if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) { + if (!this.fsw._throttle(EV_ADD$2, file, 0)) return; + this.fsw._emit(EV_ADD$2, file, stats); + } + + return closer; } -var wrap$2 = wrap_1; +/** + * Handle symlinks encountered while reading a dir. + * @param {Object} entry returned by readdirp + * @param {String} directory path of dir being read + * @param {String} path of this item + * @param {String} item basename of this item + * @returns {Promise<Boolean>} true if no more processing is needed for this entry. + */ +async _handleSymlink(entry, directory, path, item) { + if (this.fsw.closed) { + return; + } + const full = entry.fullPath; + const dir = this.fsw._getWatchedDir(directory); -var trough_1 = trough$4; + if (!this.fsw.options.followSymlinks) { + // watch symlink directly (don't follow) and detect changes + this.fsw._incrReadyCount(); + const linkPath = await fsrealpath(path); + if (this.fsw.closed) return; + if (dir.has(item)) { + if (this.fsw._symlinkPaths.get(full) !== linkPath) { + this.fsw._symlinkPaths.set(full, linkPath); + this.fsw._emit(EV_CHANGE$2, path, entry.stats); + } + } else { + dir.add(item); + this.fsw._symlinkPaths.set(full, linkPath); + this.fsw._emit(EV_ADD$2, path, entry.stats); + } + this.fsw._emitReady(); + return true; + } + + // don't follow the same symlink more than once + if (this.fsw._symlinkPaths.has(full)) { + return true; + } + + this.fsw._symlinkPaths.set(full, true); +} -trough$4.wrap = wrap$2; +_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) { + // Normalize the directory name on Windows + directory = sysPath$2.join(directory, EMPTY_STR$1); -var slice$3 = [].slice; + if (!wh.hasGlob) { + throttler = this.fsw._throttle('readdir', directory, 1000); + if (!throttler) return; + } -// Create new middleware. -function trough$4() { - var fns = []; - var middleware = {}; + const previous = this.fsw._getWatchedDir(wh.path); + const current = new Set(); - middleware.run = run; - middleware.use = use; + let stream = this.fsw._readdirp(directory, { + fileFilter: entry => wh.filterPath(entry), + directoryFilter: entry => wh.filterDir(entry), + depth: 0 + }).on(STR_DATA$1, async (entry) => { + if (this.fsw.closed) { + stream = undefined; + return; + } + const item = entry.path; + let path = sysPath$2.join(directory, item); + current.add(item); - return middleware + if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) { + return; + } - // Run `fns`. Last argument must be a completion handler. - function run() { - var index = -1; - var input = slice$3.call(arguments, 0, -1); - var done = arguments[arguments.length - 1]; + if (this.fsw.closed) { + stream = undefined; + return; + } + // Files that present in current directory snapshot + // but absent in previous are added to watch list and + // emit `add` event. + if (item === target || !target && !previous.has(item)) { + this.fsw._incrReadyCount(); + + // ensure relativeness of path is preserved in case of watcher reuse + path = sysPath$2.join(dir, sysPath$2.relative(dir, path)); + + this._addToNodeFs(path, initialAdd, wh, depth + 1); + } + }).on(EV_ERROR$2, this._boundHandleError); + + return new Promise(resolve => + stream.once(STR_END$2, () => { + if (this.fsw.closed) { + stream = undefined; + return; + } + const wasThrottled = throttler ? throttler.clear() : false; + + resolve(); + + // Files that absent in current directory snapshot + // but present in previous emit `remove` event + // and are removed from @watched[directory]. + previous.getChildren().filter((item) => { + return item !== directory && + !current.has(item) && + // in case of intersecting globs; + // a path may have been filtered out of this readdir, but + // shouldn't be removed because it matches a different glob + (!wh.hasGlob || wh.filterPath({ + fullPath: sysPath$2.resolve(directory, item) + })); + }).forEach((item) => { + this.fsw._remove(directory, item); + }); + + stream = undefined; + + // one more time for any missed in case changes came in extremely quickly + if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler); + }) + ); +} + +/** + * Read directory to add / remove files from `@watched` list and re-read it on change. + * @param {String} dir fs path + * @param {fs.Stats} stats + * @param {Boolean} initialAdd + * @param {Number} depth relative to user-supplied path + * @param {String} target child path targeted for watch + * @param {Object} wh Common watch helpers for this path + * @param {String} realpath + * @returns {Promise<Function>} closer for the watcher instance. + */ +async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) { + const parentDir = this.fsw._getWatchedDir(sysPath$2.dirname(dir)); + const tracked = parentDir.has(sysPath$2.basename(dir)); + if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) { + if (!wh.hasGlob || wh.globFilter(dir)) this.fsw._emit(EV_ADD_DIR$2, dir, stats); + } + + // ensure dir is tracked (harmless if redundant) + parentDir.add(sysPath$2.basename(dir)); + this.fsw._getWatchedDir(dir); + let throttler; + let closer; + + const oDepth = this.fsw.options.depth; + if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) { + if (!target) { + await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler); + if (this.fsw.closed) return; + } + + closer = this._watchWithNodeFs(dir, (dirPath, stats) => { + // if current directory is removed, do nothing + if (stats && stats.mtimeMs === 0) return; + + this._handleRead(dirPath, false, wh, target, dir, depth, throttler); + }); + } + return closer; +} + +/** + * Handle added file, directory, or glob pattern. + * Delegates call to _handleFile / _handleDir after checks. + * @param {String} path to file or ir + * @param {Boolean} initialAdd was the file added at watch instantiation? + * @param {Object} priorWh depth relative to user-supplied path + * @param {Number} depth Child path actually targeted for watch + * @param {String=} target Child path actually targeted for watch + * @returns {Promise} + */ +async _addToNodeFs(path, initialAdd, priorWh, depth, target) { + const ready = this.fsw._emitReady; + if (this.fsw._isIgnored(path) || this.fsw.closed) { + ready(); + return false; + } + + const wh = this.fsw._getWatchHelpers(path, depth); + if (!wh.hasGlob && priorWh) { + wh.hasGlob = priorWh.hasGlob; + wh.globFilter = priorWh.globFilter; + wh.filterPath = entry => priorWh.filterPath(entry); + wh.filterDir = entry => priorWh.filterDir(entry); + } + + // evaluate what is at the path we're being asked to watch + try { + const stats = await statMethods$1[wh.statMethod](wh.watchPath); + if (this.fsw.closed) return; + if (this.fsw._isIgnored(wh.watchPath, stats)) { + ready(); + return false; + } + + const follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START$1); + let closer; + if (stats.isDirectory()) { + const absPath = sysPath$2.resolve(path); + const targetPath = follow ? await fsrealpath(path) : path; + if (this.fsw.closed) return; + closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath); + if (this.fsw.closed) return; + // preserve this symlink's target path + if (absPath !== targetPath && targetPath !== undefined) { + this.fsw._symlinkPaths.set(absPath, targetPath); + } + } else if (stats.isSymbolicLink()) { + const targetPath = follow ? await fsrealpath(path) : path; + if (this.fsw.closed) return; + const parent = sysPath$2.dirname(wh.watchPath); + this.fsw._getWatchedDir(parent).add(wh.watchPath); + this.fsw._emit(EV_ADD$2, wh.watchPath, stats); + closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath); + if (this.fsw.closed) return; + + // preserve this symlink's target path + if (targetPath !== undefined) { + this.fsw._symlinkPaths.set(sysPath$2.resolve(path), targetPath); + } + } else { + closer = this._handleFile(wh.watchPath, stats, initialAdd); + } + ready(); + + this.fsw._addPathCloser(path, closer); + return false; + + } catch (error) { + if (this.fsw._handleError(error)) { + ready(); + return path; + } + } +} + +} + +var nodefsHandler = NodeFsHandler$1; + +var fseventsHandler = {exports: {}}; + +const fs$7 = require$$0$3; +const sysPath$1 = path$b; +const { promisify: promisify$1 } = require$$0$4; + +let fsevents; +try { + fsevents = undefined; +} catch (error) { + if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error); +} + +if (fsevents) { + // TODO: real check + const mtch = process.version.match(/v(\d+)\.(\d+)/); + if (mtch && mtch[1] && mtch[2]) { + const maj = Number.parseInt(mtch[1], 10); + const min = Number.parseInt(mtch[2], 10); + if (maj === 8 && min < 16) { + fsevents = undefined; + } + } +} + +const { + EV_ADD: EV_ADD$1, + EV_CHANGE: EV_CHANGE$1, + EV_ADD_DIR: EV_ADD_DIR$1, + EV_UNLINK: EV_UNLINK$1, + EV_ERROR: EV_ERROR$1, + STR_DATA, + STR_END: STR_END$1, + FSEVENT_CREATED, + FSEVENT_MODIFIED, + FSEVENT_DELETED, + FSEVENT_MOVED, + // FSEVENT_CLONED, + FSEVENT_UNKNOWN, + FSEVENT_TYPE_FILE, + FSEVENT_TYPE_DIRECTORY, + FSEVENT_TYPE_SYMLINK, + + ROOT_GLOBSTAR, + DIR_SUFFIX, + DOT_SLASH, + FUNCTION_TYPE: FUNCTION_TYPE$1, + EMPTY_FN: EMPTY_FN$1, + IDENTITY_FN +} = constants$1; + +const Depth = (value) => isNaN(value) ? {} : {depth: value}; + +const stat$1 = promisify$1(fs$7.stat); +const lstat = promisify$1(fs$7.lstat); +const realpath$1 = promisify$1(fs$7.realpath); + +const statMethods = { stat: stat$1, lstat }; + +/** + * @typedef {String} Path + */ + +/** + * @typedef {Object} FsEventsWatchContainer + * @property {Set<Function>} listeners + * @property {Function} rawEmitter + * @property {{stop: Function}} watcher + */ + +// fsevents instance helper functions +/** + * Object to hold per-process fsevents instances (may be shared across chokidar FSWatcher instances) + * @type {Map<Path,FsEventsWatchContainer>} + */ +const FSEventsWatchers = new Map(); + +// Threshold of duplicate path prefixes at which to start +// consolidating going forward +const consolidateThreshhold = 10; + +const wrongEventFlags = new Set([ + 69888, 70400, 71424, 72704, 73472, 131328, 131840, 262912 +]); + +/** + * Instantiates the fsevents interface + * @param {Path} path path to be watched + * @param {Function} callback called when fsevents is bound and ready + * @returns {{stop: Function}} new fsevents instance + */ +const createFSEventsInstance = (path, callback) => { + const stop = fsevents.watch(path, callback); + return {stop}; +}; + +/** + * Instantiates the fsevents interface or binds listeners to an existing one covering + * the same file tree. + * @param {Path} path - to be watched + * @param {Path} realPath - real path for symlinks + * @param {Function} listener - called when fsevents emits events + * @param {Function} rawEmitter - passes data to listeners of the 'raw' event + * @returns {Function} closer + */ +function setFSEventsListener(path, realPath, listener, rawEmitter) { + let watchPath = sysPath$1.extname(realPath) ? sysPath$1.dirname(realPath) : realPath; + + const parentPath = sysPath$1.dirname(watchPath); + let cont = FSEventsWatchers.get(watchPath); + + // If we've accumulated a substantial number of paths that + // could have been consolidated by watching one directory + // above the current one, create a watcher on the parent + // path instead, so that we do consolidate going forward. + if (couldConsolidate(parentPath)) { + watchPath = parentPath; + } + + const resolvedPath = sysPath$1.resolve(path); + const hasSymlink = resolvedPath !== realPath; + + const filteredListener = (fullPath, flags, info) => { + if (hasSymlink) fullPath = fullPath.replace(realPath, resolvedPath); + if ( + fullPath === resolvedPath || + !fullPath.indexOf(resolvedPath + sysPath$1.sep) + ) listener(fullPath, flags, info); + }; + + // check if there is already a watcher on a parent path + // modifies `watchPath` to the parent path when it finds a match + let watchedParent = false; + for (const watchedPath of FSEventsWatchers.keys()) { + if (realPath.indexOf(sysPath$1.resolve(watchedPath) + sysPath$1.sep) === 0) { + watchPath = watchedPath; + cont = FSEventsWatchers.get(watchPath); + watchedParent = true; + break; + } + } + + if (cont || watchedParent) { + cont.listeners.add(filteredListener); + } else { + cont = { + listeners: new Set([filteredListener]), + rawEmitter, + watcher: createFSEventsInstance(watchPath, (fullPath, flags) => { + if (!cont.listeners.size) return; + const info = fsevents.getInfo(fullPath, flags); + cont.listeners.forEach(list => { + list(fullPath, flags, info); + }); + + cont.rawEmitter(info.event, fullPath, info); + }) + }; + FSEventsWatchers.set(watchPath, cont); + } + + // removes this instance's listeners and closes the underlying fsevents + // instance if there are no more listeners left + return () => { + const lst = cont.listeners; + + lst.delete(filteredListener); + if (!lst.size) { + FSEventsWatchers.delete(watchPath); + if (cont.watcher) return cont.watcher.stop().then(() => { + cont.rawEmitter = cont.watcher = undefined; + Object.freeze(cont); + }); + } + }; +} + +// Decide whether or not we should start a new higher-level +// parent watcher +const couldConsolidate = (path) => { + let count = 0; + for (const watchPath of FSEventsWatchers.keys()) { + if (watchPath.indexOf(path) === 0) { + count++; + if (count >= consolidateThreshhold) { + return true; + } + } + } + + return false; +}; + +// returns boolean indicating whether fsevents can be used +const canUse = () => fsevents && FSEventsWatchers.size < 128; + +// determines subdirectory traversal levels from root to path +const calcDepth = (path, root) => { + let i = 0; + while (!path.indexOf(root) && (path = sysPath$1.dirname(path)) !== root) i++; + return i; +}; + +// returns boolean indicating whether the fsevents' event info has the same type +// as the one returned by fs.stat +const sameTypes = (info, stats) => ( + info.type === FSEVENT_TYPE_DIRECTORY && stats.isDirectory() || + info.type === FSEVENT_TYPE_SYMLINK && stats.isSymbolicLink() || + info.type === FSEVENT_TYPE_FILE && stats.isFile() +); + +/** + * @mixin + */ +class FsEventsHandler$1 { + +/** + * @param {import('../index').FSWatcher} fsw + */ +constructor(fsw) { + this.fsw = fsw; +} +checkIgnored(path, stats) { + const ipaths = this.fsw._ignoredPaths; + if (this.fsw._isIgnored(path, stats)) { + ipaths.add(path); + if (stats && stats.isDirectory()) { + ipaths.add(path + ROOT_GLOBSTAR); + } + return true; + } + + ipaths.delete(path); + ipaths.delete(path + ROOT_GLOBSTAR); +} + +addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) { + const event = watchedDir.has(item) ? EV_CHANGE$1 : EV_ADD$1; + this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts); +} + +async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts) { + try { + const stats = await stat$1(path); + if (this.fsw.closed) return; + if (sameTypes(info, stats)) { + this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } else { + this.handleEvent(EV_UNLINK$1, path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } catch (error) { + if (error.code === 'EACCES') { + this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } else { + this.handleEvent(EV_UNLINK$1, path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } +} + +handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts) { + if (this.fsw.closed || this.checkIgnored(path)) return; + + if (event === EV_UNLINK$1) { + const isDirectory = info.type === FSEVENT_TYPE_DIRECTORY; + // suppress unlink events on never before seen files + if (isDirectory || watchedDir.has(item)) { + this.fsw._remove(parent, item, isDirectory); + } + } else { + if (event === EV_ADD$1) { + // track new directories + if (info.type === FSEVENT_TYPE_DIRECTORY) this.fsw._getWatchedDir(path); + + if (info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) { + // push symlinks back to the top of the stack to get handled + const curDepth = opts.depth === undefined ? + undefined : calcDepth(fullPath, realPath) + 1; + return this._addToFsEvents(path, false, true, curDepth); + } + + // track new paths + // (other than symlinks being followed, which will be tracked soon) + this.fsw._getWatchedDir(parent).add(item); + } + /** + * @type {'add'|'addDir'|'unlink'|'unlinkDir'} + */ + const eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event; + this.fsw._emit(eventName, path); + if (eventName === EV_ADD_DIR$1) this._addToFsEvents(path, false, true); + } +} + +/** + * Handle symlinks encountered during directory scan + * @param {String} watchPath - file/dir path to be watched with fsevents + * @param {String} realPath - real path (in case of symlinks) + * @param {Function} transform - path transformer + * @param {Function} globFilter - path filter in case a glob pattern was provided + * @returns {Function} closer for the watcher instance +*/ +_watchWithFsEvents(watchPath, realPath, transform, globFilter) { + if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return; + const opts = this.fsw.options; + const watchCallback = async (fullPath, flags, info) => { + if (this.fsw.closed) return; + if ( + opts.depth !== undefined && + calcDepth(fullPath, realPath) > opts.depth + ) return; + const path = transform(sysPath$1.join( + watchPath, sysPath$1.relative(watchPath, fullPath) + )); + if (globFilter && !globFilter(path)) return; + // ensure directories are tracked + const parent = sysPath$1.dirname(path); + const item = sysPath$1.basename(path); + const watchedDir = this.fsw._getWatchedDir( + info.type === FSEVENT_TYPE_DIRECTORY ? path : parent + ); + + // correct for wrong events emitted + if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) { + if (typeof opts.ignored === FUNCTION_TYPE$1) { + let stats; + try { + stats = await stat$1(path); + } catch (error) {} + if (this.fsw.closed) return; + if (this.checkIgnored(path, stats)) return; + if (sameTypes(info, stats)) { + this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } else { + this.handleEvent(EV_UNLINK$1, path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } else { + this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } else { + switch (info.event) { + case FSEVENT_CREATED: + case FSEVENT_MODIFIED: + return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + case FSEVENT_DELETED: + case FSEVENT_MOVED: + return this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } + }; + + const closer = setFSEventsListener( + watchPath, + realPath, + watchCallback, + this.fsw._emitRaw + ); + + this.fsw._emitReady(); + return closer; +} + +/** + * Handle symlinks encountered during directory scan + * @param {String} linkPath path to symlink + * @param {String} fullPath absolute path to the symlink + * @param {Function} transform pre-existing path transformer + * @param {Number} curDepth level of subdirectories traversed to where symlink is + * @returns {Promise<void>} + */ +async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) { + // don't follow the same symlink more than once + if (this.fsw.closed || this.fsw._symlinkPaths.has(fullPath)) return; + + this.fsw._symlinkPaths.set(fullPath, true); + this.fsw._incrReadyCount(); + + try { + const linkTarget = await realpath$1(linkPath); + if (this.fsw.closed) return; + if (this.fsw._isIgnored(linkTarget)) { + return this.fsw._emitReady(); + } + + this.fsw._incrReadyCount(); + + // add the linkTarget for watching with a wrapper for transform + // that causes emitted paths to incorporate the link's path + this._addToFsEvents(linkTarget || linkPath, (path) => { + let aliasedPath = linkPath; + if (linkTarget && linkTarget !== DOT_SLASH) { + aliasedPath = path.replace(linkTarget, linkPath); + } else if (path !== DOT_SLASH) { + aliasedPath = sysPath$1.join(linkPath, path); + } + return transform(aliasedPath); + }, false, curDepth); + } catch(error) { + if (this.fsw._handleError(error)) { + return this.fsw._emitReady(); + } + } +} + +/** + * + * @param {Path} newPath + * @param {fs.Stats} stats + */ +emitAdd(newPath, stats, processPath, opts, forceAdd) { + const pp = processPath(newPath); + const isDir = stats.isDirectory(); + const dirObj = this.fsw._getWatchedDir(sysPath$1.dirname(pp)); + const base = sysPath$1.basename(pp); + + // ensure empty dirs get tracked + if (isDir) this.fsw._getWatchedDir(pp); + if (dirObj.has(base)) return; + dirObj.add(base); + + if (!opts.ignoreInitial || forceAdd === true) { + this.fsw._emit(isDir ? EV_ADD_DIR$1 : EV_ADD$1, pp, stats); + } +} + +initWatch(realPath, path, wh, processPath) { + if (this.fsw.closed) return; + const closer = this._watchWithFsEvents( + wh.watchPath, + sysPath$1.resolve(realPath || wh.watchPath), + processPath, + wh.globFilter + ); + this.fsw._addPathCloser(path, closer); +} + +/** + * Handle added path with fsevents + * @param {String} path file/dir path or glob pattern + * @param {Function|Boolean=} transform converts working path to what the user expects + * @param {Boolean=} forceAdd ensure add is emitted + * @param {Number=} priorDepth Level of subdirectories already traversed. + * @returns {Promise<void>} + */ +async _addToFsEvents(path, transform, forceAdd, priorDepth) { + if (this.fsw.closed) { + return; + } + const opts = this.fsw.options; + const processPath = typeof transform === FUNCTION_TYPE$1 ? transform : IDENTITY_FN; + + const wh = this.fsw._getWatchHelpers(path); + + // evaluate what is at the path we're being asked to watch + try { + const stats = await statMethods[wh.statMethod](wh.watchPath); + if (this.fsw.closed) return; + if (this.fsw._isIgnored(wh.watchPath, stats)) { + throw null; + } + if (stats.isDirectory()) { + // emit addDir unless this is a glob parent + if (!wh.globFilter) this.emitAdd(processPath(path), stats, processPath, opts, forceAdd); + + // don't recurse further if it would exceed depth setting + if (priorDepth && priorDepth > opts.depth) return; + + // scan the contents of the dir + this.fsw._readdirp(wh.watchPath, { + fileFilter: entry => wh.filterPath(entry), + directoryFilter: entry => wh.filterDir(entry), + ...Depth(opts.depth - (priorDepth || 0)) + }).on(STR_DATA, (entry) => { + // need to check filterPath on dirs b/c filterDir is less restrictive + if (this.fsw.closed) { + return; + } + if (entry.stats.isDirectory() && !wh.filterPath(entry)) return; + + const joinedPath = sysPath$1.join(wh.watchPath, entry.path); + const {fullPath} = entry; + + if (wh.followSymlinks && entry.stats.isSymbolicLink()) { + // preserve the current depth here since it can't be derived from + // real paths past the symlink + const curDepth = opts.depth === undefined ? + undefined : calcDepth(joinedPath, sysPath$1.resolve(wh.watchPath)) + 1; + + this._handleFsEventsSymlink(joinedPath, fullPath, processPath, curDepth); + } else { + this.emitAdd(joinedPath, entry.stats, processPath, opts, forceAdd); + } + }).on(EV_ERROR$1, EMPTY_FN$1).on(STR_END$1, () => { + this.fsw._emitReady(); + }); + } else { + this.emitAdd(wh.watchPath, stats, processPath, opts, forceAdd); + this.fsw._emitReady(); + } + } catch (error) { + if (!error || this.fsw._handleError(error)) { + // TODO: Strange thing: "should not choke on an ignored watch path" will be failed without 2 ready calls -__- + this.fsw._emitReady(); + this.fsw._emitReady(); + } + } + + if (opts.persistent && forceAdd !== true) { + if (typeof transform === FUNCTION_TYPE$1) { + // realpath has already been resolved + this.initWatch(undefined, path, wh, processPath); + } else { + let realPath; + try { + realPath = await realpath$1(wh.watchPath); + } catch (e) {} + this.initWatch(realPath, path, wh, processPath); + } + } +} + +} + +fseventsHandler.exports = FsEventsHandler$1; +fseventsHandler.exports.canUse = canUse; + +const { EventEmitter } = require$$0$5; +const fs$6 = require$$0$3; +const sysPath = path$b; +const { promisify } = require$$0$4; +const readdirp = readdirp_1; +const anymatch = anymatch$2.exports.default; +const globParent = globParent$1; +const isGlob = isGlob$2; +const braces = braces_1; +const normalizePath = normalizePath$2; + +const NodeFsHandler = nodefsHandler; +const FsEventsHandler = fseventsHandler.exports; +const { + EV_ALL, + EV_READY, + EV_ADD, + EV_CHANGE, + EV_UNLINK, + EV_ADD_DIR, + EV_UNLINK_DIR, + EV_RAW, + EV_ERROR, + + STR_CLOSE, + STR_END, + + BACK_SLASH_RE, + DOUBLE_SLASH_RE, + SLASH_OR_BACK_SLASH_RE, + DOT_RE, + REPLACER_RE, + + SLASH: SLASH$1, + SLASH_SLASH, + BRACE_START, + BANG, + ONE_DOT, + TWO_DOTS, + GLOBSTAR: GLOBSTAR$1, + SLASH_GLOBSTAR, + ANYMATCH_OPTS, + STRING_TYPE, + FUNCTION_TYPE, + EMPTY_STR, + EMPTY_FN, + + isWindows: isWindows$2, + isMacos, + isIBMi +} = constants$1; + +const stat = promisify(fs$6.stat); +const readdir = promisify(fs$6.readdir); + +/** + * @typedef {String} Path + * @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName + * @typedef {'readdir'|'watch'|'add'|'remove'|'change'} ThrottleType + */ + +/** + * + * @typedef {Object} WatchHelpers + * @property {Boolean} followSymlinks + * @property {'stat'|'lstat'} statMethod + * @property {Path} path + * @property {Path} watchPath + * @property {Function} entryPath + * @property {Boolean} hasGlob + * @property {Object} globFilter + * @property {Function} filterPath + * @property {Function} filterDir + */ + +const arrify = (value = []) => Array.isArray(value) ? value : [value]; +const flatten$1 = (list, result = []) => { + list.forEach(item => { + if (Array.isArray(item)) { + flatten$1(item, result); + } else { + result.push(item); + } + }); + return result; +}; + +const unifyPaths = (paths_) => { + /** + * @type {Array<String>} + */ + const paths = flatten$1(arrify(paths_)); + if (!paths.every(p => typeof p === STRING_TYPE)) { + throw new TypeError(`Non-string provided as watch path: ${paths}`); + } + return paths.map(normalizePathToUnix); +}; + +// If SLASH_SLASH occurs at the beginning of path, it is not replaced +// because "//StoragePC/DrivePool/Movies" is a valid network path +const toUnix = (string) => { + let str = string.replace(BACK_SLASH_RE, SLASH$1); + let prepend = false; + if (str.startsWith(SLASH_SLASH)) { + prepend = true; + } + while (str.match(DOUBLE_SLASH_RE)) { + str = str.replace(DOUBLE_SLASH_RE, SLASH$1); + } + if (prepend) { + str = SLASH$1 + str; + } + return str; +}; + +// Our version of upath.normalize +// TODO: this is not equal to path-normalize module - investigate why +const normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path))); + +const normalizeIgnored = (cwd = EMPTY_STR) => (path) => { + if (typeof path !== STRING_TYPE) return path; + return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path)); +}; + +const getAbsolutePath = (path, cwd) => { + if (sysPath.isAbsolute(path)) { + return path; + } + if (path.startsWith(BANG)) { + return BANG + sysPath.join(cwd, path.slice(1)); + } + return sysPath.join(cwd, path); +}; + +const undef = (opts, key) => opts[key] === undefined; + +/** + * Directory entry. + * @property {Path} path + * @property {Set<Path>} items + */ +class DirEntry { + /** + * @param {Path} dir + * @param {Function} removeWatcher + */ + constructor(dir, removeWatcher) { + this.path = dir; + this._removeWatcher = removeWatcher; + /** @type {Set<Path>} */ + this.items = new Set(); + } + + add(item) { + const {items} = this; + if (!items) return; + if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item); + } + + async remove(item) { + const {items} = this; + if (!items) return; + items.delete(item); + if (items.size > 0) return; + + const dir = this.path; + try { + await readdir(dir); + } catch (err) { + if (this._removeWatcher) { + this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir)); + } + } + } + + has(item) { + const {items} = this; + if (!items) return; + return items.has(item); + } - if (typeof done !== 'function') { - throw new Error('Expected function as last argument, not ' + done) + /** + * @returns {Array<String>} + */ + getChildren() { + const {items} = this; + if (!items) return; + return [...items.values()]; + } + + dispose() { + this.items.clear(); + delete this.path; + delete this._removeWatcher; + delete this.items; + Object.freeze(this); + } +} + +const STAT_METHOD_F = 'stat'; +const STAT_METHOD_L = 'lstat'; +class WatchHelper { + constructor(path, watchPath, follow, fsw) { + this.fsw = fsw; + this.path = path = path.replace(REPLACER_RE, EMPTY_STR); + this.watchPath = watchPath; + this.fullWatchPath = sysPath.resolve(watchPath); + this.hasGlob = watchPath !== path; + /** @type {object|boolean} */ + if (path === EMPTY_STR) this.hasGlob = false; + this.globSymlink = this.hasGlob && follow ? undefined : false; + this.globFilter = this.hasGlob ? anymatch(path, undefined, ANYMATCH_OPTS) : false; + this.dirParts = this.getDirParts(path); + this.dirParts.forEach((parts) => { + if (parts.length > 1) parts.pop(); + }); + this.followSymlinks = follow; + this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L; + } + + checkGlobSymlink(entry) { + // only need to resolve once + // first entry should always have entry.parentDir === EMPTY_STR + if (this.globSymlink === undefined) { + this.globSymlink = entry.fullParentDir === this.fullWatchPath ? + false : {realPath: entry.fullParentDir, linkPath: this.fullWatchPath}; + } + + if (this.globSymlink) { + return entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath); + } + + return entry.fullPath; + } + + entryPath(entry) { + return sysPath.join(this.watchPath, + sysPath.relative(this.watchPath, this.checkGlobSymlink(entry)) + ); + } + + filterPath(entry) { + const {stats} = entry; + if (stats && stats.isSymbolicLink()) return this.filterDir(entry); + const resolvedPath = this.entryPath(entry); + const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ? + this.globFilter(resolvedPath) : true; + return matchesGlob && + this.fsw._isntIgnored(resolvedPath, stats) && + this.fsw._hasReadPermissions(stats); + } + + getDirParts(path) { + if (!this.hasGlob) return []; + const parts = []; + const expandedPath = path.includes(BRACE_START) ? braces.expand(path) : [path]; + expandedPath.forEach((path) => { + parts.push(sysPath.relative(this.watchPath, path).split(SLASH_OR_BACK_SLASH_RE)); + }); + return parts; + } + + filterDir(entry) { + if (this.hasGlob) { + const entryParts = this.getDirParts(this.checkGlobSymlink(entry)); + let globstar = false; + this.unmatchedGlob = !this.dirParts.some((parts) => { + return parts.every((part, i) => { + if (part === GLOBSTAR$1) globstar = true; + return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS); + }); + }); } + return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats); + } +} - next.apply(null, [null].concat(input)); +/** + * Watches files & directories for changes. Emitted events: + * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error` + * + * new FSWatcher() + * .add(directories) + * .on('add', path => log('File', path, 'was added')) + */ +class FSWatcher extends EventEmitter { +// Not indenting methods for history sake; for now. +constructor(_opts) { + super(); - // Run the next `fn`, if any. - function next(err) { - var fn = fns[++index]; - var params = slice$3.call(arguments, 0); - var values = params.slice(1); - var length = input.length; - var pos = -1; + const opts = {}; + if (_opts) Object.assign(opts, _opts); // for frozen objects + /** @type {Map<String, DirEntry>} */ + this._watched = new Map(); + /** @type {Map<String, Array>} */ + this._closers = new Map(); + /** @type {Set<String>} */ + this._ignoredPaths = new Set(); + + /** @type {Map<ThrottleType, Map>} */ + this._throttled = new Map(); + + /** @type {Map<Path, String|Boolean>} */ + this._symlinkPaths = new Map(); + + this._streams = new Set(); + this.closed = false; + + // Set up default options. + if (undef(opts, 'persistent')) opts.persistent = true; + if (undef(opts, 'ignoreInitial')) opts.ignoreInitial = false; + if (undef(opts, 'ignorePermissionErrors')) opts.ignorePermissionErrors = false; + if (undef(opts, 'interval')) opts.interval = 100; + if (undef(opts, 'binaryInterval')) opts.binaryInterval = 300; + if (undef(opts, 'disableGlobbing')) opts.disableGlobbing = false; + opts.enableBinaryInterval = opts.binaryInterval !== opts.interval; + + // Enable fsevents on OS X when polling isn't explicitly enabled. + if (undef(opts, 'useFsEvents')) opts.useFsEvents = !opts.usePolling; + + // If we can't use fsevents, ensure the options reflect it's disabled. + const canUseFsEvents = FsEventsHandler.canUse(); + if (!canUseFsEvents) opts.useFsEvents = false; + + // Use polling on Mac if not using fsevents. + // Other platforms use non-polling fs_watch. + if (undef(opts, 'usePolling') && !opts.useFsEvents) { + opts.usePolling = isMacos; + } + + // Always default to polling on IBM i because fs.watch() is not available on IBM i. + if(isIBMi) { + opts.usePolling = true; + } + + // Global override (useful for end-developers that need to force polling for all + // instances of chokidar, regardless of usage/dependency depth) + const envPoll = process.env.CHOKIDAR_USEPOLLING; + if (envPoll !== undefined) { + const envLower = envPoll.toLowerCase(); + + if (envLower === 'false' || envLower === '0') { + opts.usePolling = false; + } else if (envLower === 'true' || envLower === '1') { + opts.usePolling = true; + } else { + opts.usePolling = !!envLower; + } + } + const envInterval = process.env.CHOKIDAR_INTERVAL; + if (envInterval) { + opts.interval = Number.parseInt(envInterval, 10); + } + + // Editor atomic write normalization enabled by default with fs.watch + if (undef(opts, 'atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents; + if (opts.atomic) this._pendingUnlinks = new Map(); + + if (undef(opts, 'followSymlinks')) opts.followSymlinks = true; + + if (undef(opts, 'awaitWriteFinish')) opts.awaitWriteFinish = false; + if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {}; + const awf = opts.awaitWriteFinish; + if (awf) { + if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000; + if (!awf.pollInterval) awf.pollInterval = 100; + this._pendingWrites = new Map(); + } + if (opts.ignored) opts.ignored = arrify(opts.ignored); + + let readyCalls = 0; + this._emitReady = () => { + readyCalls++; + if (readyCalls >= this._readyCount) { + this._emitReady = EMPTY_FN; + this._readyEmitted = true; + // use process.nextTick to allow time for listener to be bound + process.nextTick(() => this.emit(EV_READY)); + } + }; + this._emitRaw = (...args) => this.emit(EV_RAW, ...args); + this._readyEmitted = false; + this.options = opts; + + // Initialize with proper watcher. + if (opts.useFsEvents) { + this._fsEventsHandler = new FsEventsHandler(this); + } else { + this._nodeFsHandler = new NodeFsHandler(this); + } + + // You’re frozen when your heart’s not open. + Object.freeze(opts); +} + +// Public methods + +/** + * Adds paths to be watched on an existing FSWatcher instance + * @param {Path|Array<Path>} paths_ + * @param {String=} _origAdd private; for handling non-existent paths to be watched + * @param {Boolean=} _internal private; indicates a non-user add + * @returns {FSWatcher} for chaining + */ +add(paths_, _origAdd, _internal) { + const {cwd, disableGlobbing} = this.options; + this.closed = false; + let paths = unifyPaths(paths_); + if (cwd) { + paths = paths.map((path) => { + const absPath = getAbsolutePath(path, cwd); + + // Check `path` instead of `absPath` because the cwd portion can't be a glob + if (disableGlobbing || !isGlob(path)) { + return absPath; + } + return normalizePath(absPath); + }); + } + + // set aside negated glob strings + paths = paths.filter((path) => { + if (path.startsWith(BANG)) { + this._ignoredPaths.add(path.slice(1)); + return false; + } + + // if a path is being added that was previously ignored, stop ignoring it + this._ignoredPaths.delete(path); + this._ignoredPaths.delete(path + SLASH_GLOBSTAR); + + // reset the cached userIgnored anymatch fn + // to make ignoredPaths changes effective + this._userIgnored = undefined; + + return true; + }); + + if (this.options.useFsEvents && this._fsEventsHandler) { + if (!this._readyCount) this._readyCount = paths.length; + if (this.options.persistent) this._readyCount *= 2; + paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path)); + } else { + if (!this._readyCount) this._readyCount = 0; + this._readyCount += paths.length; + Promise.all( + paths.map(async path => { + const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd); + if (res) this._emitReady(); + return res; + }) + ).then(results => { + if (this.closed) return; + results.filter(item => item).forEach(item => { + this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item)); + }); + }); + } + + return this; +} + +/** + * Close watchers or start ignoring events from specified paths. + * @param {Path|Array<Path>} paths_ - string or array of strings, file/directory paths and/or globs + * @returns {FSWatcher} for chaining +*/ +unwatch(paths_) { + if (this.closed) return this; + const paths = unifyPaths(paths_); + const {cwd} = this.options; + + paths.forEach((path) => { + // convert to absolute path unless relative path already matches + if (!sysPath.isAbsolute(path) && !this._closers.has(path)) { + if (cwd) path = sysPath.join(cwd, path); + path = sysPath.resolve(path); + } + + this._closePath(path); + + this._ignoredPaths.add(path); + if (this._watched.has(path)) { + this._ignoredPaths.add(path + SLASH_GLOBSTAR); + } + + // reset the cached userIgnored anymatch fn + // to make ignoredPaths changes effective + this._userIgnored = undefined; + }); + + return this; +} + +/** + * Close watchers and remove all listeners from watched paths. + * @returns {Promise<void>}. +*/ +close() { + if (this.closed) return this._closePromise; + this.closed = true; + + // Memory management. + this.removeAllListeners(); + const closers = []; + this._closers.forEach(closerList => closerList.forEach(closer => { + const promise = closer(); + if (promise instanceof Promise) closers.push(promise); + })); + this._streams.forEach(stream => stream.destroy()); + this._userIgnored = undefined; + this._readyCount = 0; + this._readyEmitted = false; + this._watched.forEach(dirent => dirent.dispose()); + ['closers', 'watched', 'streams', 'symlinkPaths', 'throttled'].forEach(key => { + this[`_${key}`].clear(); + }); + + this._closePromise = closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve(); + return this._closePromise; +} + +/** + * Expose list of watched paths + * @returns {Object} for chaining +*/ +getWatched() { + const watchList = {}; + this._watched.forEach((entry, dir) => { + const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir; + watchList[key || ONE_DOT] = entry.getChildren().sort(); + }); + return watchList; +} + +emitWithAll(event, args) { + this.emit(...args); + if (event !== EV_ERROR) this.emit(EV_ALL, ...args); +} + +// Common helpers +// -------------- + +/** + * Normalize and emit events. + * Calling _emit DOES NOT MEAN emit() would be called! + * @param {EventName} event Type of event + * @param {Path} path File or directory path + * @param {*=} val1 arguments to be passed with event + * @param {*=} val2 + * @param {*=} val3 + * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag + */ +async _emit(event, path, val1, val2, val3) { + if (this.closed) return; + + const opts = this.options; + if (isWindows$2) path = sysPath.normalize(path); + if (opts.cwd) path = sysPath.relative(opts.cwd, path); + /** @type Array<any> */ + const args = [event, path]; + if (val3 !== undefined) args.push(val1, val2, val3); + else if (val2 !== undefined) args.push(val1, val2); + else if (val1 !== undefined) args.push(val1); + + const awf = opts.awaitWriteFinish; + let pw; + if (awf && (pw = this._pendingWrites.get(path))) { + pw.lastChange = new Date(); + return this; + } + + if (opts.atomic) { + if (event === EV_UNLINK) { + this._pendingUnlinks.set(path, args); + setTimeout(() => { + this._pendingUnlinks.forEach((entry, path) => { + this.emit(...entry); + this.emit(EV_ALL, ...entry); + this._pendingUnlinks.delete(path); + }); + }, typeof opts.atomic === 'number' ? opts.atomic : 100); + return this; + } + if (event === EV_ADD && this._pendingUnlinks.has(path)) { + event = args[0] = EV_CHANGE; + this._pendingUnlinks.delete(path); + } + } + + if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) { + const awfEmit = (err, stats) => { if (err) { - done(err); + event = args[0] = EV_ERROR; + args[1] = err; + this.emitWithAll(event, args); + } else if (stats) { + // if stats doesn't exist the file must have been deleted + if (args.length > 2) { + args[2] = stats; + } else { + args.push(stats); + } + this.emitWithAll(event, args); + } + }; + + this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit); + return this; + } + + if (event === EV_CHANGE) { + const isThrottled = !this._throttle(EV_CHANGE, path, 50); + if (isThrottled) return this; + } + + if (opts.alwaysStat && val1 === undefined && + (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE) + ) { + const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path; + let stats; + try { + stats = await stat(fullPath); + } catch (err) {} + // Suppress event when fs_stat fails, to avoid sending undefined 'stat' + if (!stats || this.closed) return; + args.push(stats); + } + this.emitWithAll(event, args); + + return this; +} + +/** + * Common handler for errors + * @param {Error} error + * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag + */ +_handleError(error) { + const code = error && error.code; + if (error && code !== 'ENOENT' && code !== 'ENOTDIR' && + (!this.options.ignorePermissionErrors || (code !== 'EPERM' && code !== 'EACCES')) + ) { + this.emit(EV_ERROR, error); + } + return error || this.closed; +} + +/** + * Helper utility for throttling + * @param {ThrottleType} actionType type being throttled + * @param {Path} path being acted upon + * @param {Number} timeout duration of time to suppress duplicate actions + * @returns {Object|false} tracking object or false if action should be suppressed + */ +_throttle(actionType, path, timeout) { + if (!this._throttled.has(actionType)) { + this._throttled.set(actionType, new Map()); + } + + /** @type {Map<Path, Object>} */ + const action = this._throttled.get(actionType); + /** @type {Object} */ + const actionPath = action.get(path); + + if (actionPath) { + actionPath.count++; + return false; + } + + let timeoutObject; + const clear = () => { + const item = action.get(path); + const count = item ? item.count : 0; + action.delete(path); + clearTimeout(timeoutObject); + if (item) clearTimeout(item.timeoutObject); + return count; + }; + timeoutObject = setTimeout(clear, timeout); + const thr = {timeoutObject, clear, count: 0}; + action.set(path, thr); + return thr; +} + +_incrReadyCount() { + return this._readyCount++; +} + +/** + * Awaits write operation to finish. + * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback. + * @param {Path} path being acted upon + * @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished + * @param {EventName} event + * @param {Function} awfEmit Callback to be called when ready for event to be emitted. + */ +_awaitWriteFinish(path, threshold, event, awfEmit) { + let timeoutHandler; + + let fullPath = path; + if (this.options.cwd && !sysPath.isAbsolute(path)) { + fullPath = sysPath.join(this.options.cwd, path); + } + + const now = new Date(); + + const awaitWriteFinish = (prevStat) => { + fs$6.stat(fullPath, (err, curStat) => { + if (err || !this._pendingWrites.has(path)) { + if (err && err.code !== 'ENOENT') awfEmit(err); + return; + } + + const now = Number(new Date()); + + if (prevStat && curStat.size !== prevStat.size) { + this._pendingWrites.get(path).lastChange = now; + } + const pw = this._pendingWrites.get(path); + const df = now - pw.lastChange; + + if (df >= threshold) { + this._pendingWrites.delete(path); + awfEmit(undefined, curStat); + } else { + timeoutHandler = setTimeout( + awaitWriteFinish, + this.options.awaitWriteFinish.pollInterval, + curStat + ); + } + }); + }; + + if (!this._pendingWrites.has(path)) { + this._pendingWrites.set(path, { + lastChange: now, + cancelWait: () => { + this._pendingWrites.delete(path); + clearTimeout(timeoutHandler); + return event; + } + }); + timeoutHandler = setTimeout( + awaitWriteFinish, + this.options.awaitWriteFinish.pollInterval + ); + } +} + +_getGlobIgnored() { + return [...this._ignoredPaths.values()]; +} + +/** + * Determines whether user has asked to ignore this path. + * @param {Path} path filepath or dir + * @param {fs.Stats=} stats result of fs.stat + * @returns {Boolean} + */ +_isIgnored(path, stats) { + if (this.options.atomic && DOT_RE.test(path)) return true; + if (!this._userIgnored) { + const {cwd} = this.options; + const ign = this.options.ignored; + + const ignored = ign && ign.map(normalizeIgnored(cwd)); + const paths = arrify(ignored) + .filter((path) => typeof path === STRING_TYPE && !isGlob(path)) + .map((path) => path + SLASH_GLOBSTAR); + const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths); + this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS); + } + + return this._userIgnored([path, stats]); +} + +_isntIgnored(path, stat) { + return !this._isIgnored(path, stat); +} + +/** + * Provides a set of common helpers and properties relating to symlink and glob handling. + * @param {Path} path file, directory, or glob pattern being watched + * @param {Number=} depth at any depth > 0, this isn't a glob + * @returns {WatchHelper} object containing helpers for this path + */ +_getWatchHelpers(path, depth) { + const watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path); + const follow = this.options.followSymlinks; + + return new WatchHelper(path, watchPath, follow, this); +} + +// Directory helpers +// ----------------- + +/** + * Provides directory tracking objects + * @param {String} directory path of the directory + * @returns {DirEntry} the directory's tracking object + */ +_getWatchedDir(directory) { + if (!this._boundRemove) this._boundRemove = this._remove.bind(this); + const dir = sysPath.resolve(directory); + if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove)); + return this._watched.get(dir); +} + +// File helpers +// ------------ + +/** + * Check for read permissions. + * Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405 + * @param {fs.Stats} stats - object, result of fs_stat + * @returns {Boolean} indicates whether the file can be read +*/ +_hasReadPermissions(stats) { + if (this.options.ignorePermissionErrors) return true; + + // stats.mode may be bigint + const md = stats && Number.parseInt(stats.mode, 10); + const st = md & 0o777; + const it = Number.parseInt(st.toString(8)[0], 10); + return Boolean(4 & it); +} + +/** + * Handles emitting unlink events for + * files and directories, and via recursion, for + * files and directories within directories that are unlinked + * @param {String} directory within which the following item is located + * @param {String} item base path of item/directory + * @returns {void} +*/ +_remove(directory, item, isDirectory) { + // if what is being deleted is a directory, get that directory's paths + // for recursive deleting and cleaning of watched object + // if it is not a directory, nestedDirectoryChildren will be empty array + const path = sysPath.join(directory, item); + const fullPath = sysPath.resolve(path); + isDirectory = isDirectory != null + ? isDirectory + : this._watched.has(path) || this._watched.has(fullPath); + + // prevent duplicate handling in case of arriving here nearly simultaneously + // via multiple paths (such as _handleFile and _handleDir) + if (!this._throttle('remove', path, 100)) return; + + // if the only watched file is removed, watch for its return + if (!isDirectory && !this.options.useFsEvents && this._watched.size === 1) { + this.add(directory, item, true); + } + + // This will create a new entry in the watched object in either case + // so we got to do the directory check beforehand + const wp = this._getWatchedDir(path); + const nestedDirectoryChildren = wp.getChildren(); + + // Recursively remove children directories / files. + nestedDirectoryChildren.forEach(nested => this._remove(path, nested)); + + // Check if item was on the watched list and remove it + const parent = this._getWatchedDir(directory); + const wasTracked = parent.has(item); + parent.remove(item); + + // Fixes issue #1042 -> Relative paths were detected and added as symlinks + // (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612), + // but never removed from the map in case the path was deleted. + // This leads to an incorrect state if the path was recreated: + // https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553 + if (this._symlinkPaths.has(fullPath)) { + this._symlinkPaths.delete(fullPath); + } + + // If we wait for this file to be fully written, cancel the wait. + let relPath = path; + if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path); + if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) { + const event = this._pendingWrites.get(relPath).cancelWait(); + if (event === EV_ADD) return; + } + + // The Entry will either be a directory that just got removed + // or a bogus entry to a file, in either case we have to remove it + this._watched.delete(path); + this._watched.delete(fullPath); + const eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK; + if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path); + + // Avoid conflicts if we later create another file with the same name + if (!this.options.useFsEvents) { + this._closePath(path); + } +} + +/** + * Closes all watchers for a path + * @param {Path} path + */ +_closePath(path) { + this._closeFile(path); + const dir = sysPath.dirname(path); + this._getWatchedDir(dir).remove(sysPath.basename(path)); +} + +/** + * Closes only file-specific watchers + * @param {Path} path + */ +_closeFile(path) { + const closers = this._closers.get(path); + if (!closers) return; + closers.forEach(closer => closer()); + this._closers.delete(path); +} + +/** + * + * @param {Path} path + * @param {Function} closer + */ +_addPathCloser(path, closer) { + if (!closer) return; + let list = this._closers.get(path); + if (!list) { + list = []; + this._closers.set(path, list); + } + list.push(closer); +} + +_readdirp(root, opts) { + if (this.closed) return; + const options = {type: EV_ALL, alwaysStat: true, lstat: true, ...opts}; + let stream = readdirp(root, options); + this._streams.add(stream); + stream.once(STR_CLOSE, () => { + stream = undefined; + }); + stream.once(STR_END, () => { + if (stream) { + this._streams.delete(stream); + stream = undefined; + } + }); + return stream; +} + +} + +// Export FSWatcher class +chokidar.FSWatcher = FSWatcher; + +/** + * Instantiates watcher with paths to be tracked. + * @param {String|Array<String>} paths file/directory paths and/or globs + * @param {Object=} options chokidar opts + * @returns an instance of FSWatcher for chaining. + */ +const watch = (paths, options) => { + const watcher = new FSWatcher(options); + watcher.add(paths); + return watcher; +}; + +chokidar.watch = watch; + +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('vfile-message').VFileMessage} VFileMessage + * + * @typedef Statistics + * @property {number} fatal Fatal errors (`fatal: true`) + * @property {number} warn warning errors (`fatal: false`) + * @property {number} info informational messages (`fatal: null|undefined`) + * @property {number} nonfatal warning + info + * @property {number} total nonfatal + fatal + */ + +/** + * Get stats for a file, list of files, or list of messages. + * + * @param {Array.<VFile|VFileMessage>|VFile|VFileMessage} [value] + * @returns {Statistics} + */ +function statistics(value) { + var result = {true: 0, false: 0, null: 0}; + + if (value) { + if (Array.isArray(value)) { + list(value); + } else { + one(value); + } + } + + return { + fatal: result.true, + nonfatal: result.false + result.null, + warn: result.false, + info: result.null, + total: result.true + result.false + result.null + } + + /** + * @param {Array.<VFile|VFileMessage>} value + * @returns {void} + */ + function list(value) { + var index = -1; + + while (++index < value.length) { + one(value[index]); + } + } + + /** + * @param {VFile|VFileMessage} value + * @returns {void} + */ + function one(value) { + if ('messages' in value) return list(value.messages) + + result[ + value.fatal === undefined || value.fatal === null + ? null + : Boolean(value.fatal) + ]++; + } +} + +/** + * @typedef {(error?: Error|null|undefined, ...output: any[]) => void} Callback + * @typedef {(...input: any[]) => any} Middleware + * + * @typedef {(...input: any[]) => void} Run Call all middleware. + * @typedef {(fn: Middleware) => Pipeline} Use Add `fn` (middleware) to the list. + * @typedef {{run: Run, use: Use}} Pipeline + */ + +/** + * Create new middleware. + * + * @returns {Pipeline} + */ +function trough() { + /** @type {Middleware[]} */ + const fns = []; + /** @type {Pipeline} */ + const pipeline = {run, use}; + + return pipeline + + /** @type {Run} */ + function run(...values) { + let middlewareIndex = -1; + /** @type {Callback} */ + const callback = values.pop(); + + if (typeof callback !== 'function') { + throw new TypeError('Expected function as last argument, not ' + callback) + } + + next(null, ...values); + + /** + * Run the next `fn`, or we’re done. + * + * @param {Error|null|undefined} error + * @param {any[]} output + */ + function next(error, ...output) { + const fn = fns[++middlewareIndex]; + let index = -1; + + if (error) { + callback(error); return } - // Copy non-nully input into values. - while (++pos < length) { - if (values[pos] === null || values[pos] === undefined) { - values[pos] = input[pos]; + // Copy non-nullish input into values. + while (++index < values.length) { + if (output[index] === null || output[index] === undefined) { + output[index] = values[index]; } } - input = values; + // Save the newly created `output` for the next call. + values = output; // Next or done. if (fn) { - wrap$2(fn, next).apply(null, input); + wrap(fn, next)(...output); } else { - done.apply(null, [null].concat(input)); + callback(null, ...output); } } } - // Add `fn` to the list. - function use(fn) { - if (typeof fn !== 'function') { - throw new Error('Expected `fn` to be a function, not ' + fn) + /** @type {Use} */ + function use(middelware) { + if (typeof middelware !== 'function') { + throw new TypeError( + 'Expected `middelware` to be a function, not ' + middelware + ) } - fns.push(fn); - - return middleware + fns.push(middelware); + return pipeline } } -var jsYaml$2 = {}; +/** + * Wrap `middleware`. + * Can be sync or async; return a promise, receive a callback, or return new + * values and errors. + * + * @param {Middleware} middleware + * @param {Callback} callback + */ +function wrap(middleware, callback) { + /** @type {boolean} */ + let called; + + return wrapped + + /** + * Call `middleware`. + * @param {any[]} parameters + * @returns {void} + */ + function wrapped(...parameters) { + const fnExpectsCallback = middleware.length > parameters.length; + /** @type {any} */ + let result; -var loader$2 = {}; + if (fnExpectsCallback) { + parameters.push(done); + } -var common$b = {}; + try { + result = middleware(...parameters); + } catch (error) { + /** @type {Error} */ + const exception = error; -function isNothing$1(subject) { + // Well, this is quite the pickle. + // `middleware` received a callback and called it synchronously, but that + // threw an error. + // The only thing left to do is to throw the thing instead. + if (fnExpectsCallback && called) { + throw exception + } + + return done(exception) + } + + if (!fnExpectsCallback) { + if (result instanceof Promise) { + result.then(then, done); + } else if (result instanceof Error) { + done(result); + } else { + then(result); + } + } + } + + /** + * Call `callback`, only once. + * @type {Callback} + */ + function done(error, ...output) { + if (!called) { + called = true; + callback(error, ...output); + } + } + + /** + * Call `done` with one value. + * + * @param {any} [value] + */ + function then(value) { + done(null, value); + } +} + +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function isNothing(subject) { return (typeof subject === 'undefined') || (subject === null); } -function isObject$4(subject) { +function isObject$1(subject) { return (typeof subject === 'object') && (subject !== null); } -function toArray$1(sequence) { +function toArray(sequence) { if (Array.isArray(sequence)) return sequence; - else if (isNothing$1(sequence)) return []; + else if (isNothing(sequence)) return []; return [ sequence ]; } -function extend$4(target, source) { +function extend$2(target, source) { var index, length, key, sourceKeys; if (source) { @@ -294,7 +8650,7 @@ function extend$4(target, source) { } -function repeat$8(string, count) { +function repeat$1(string, count) { var result = '', cycle; for (cycle = 0; cycle < count; cycle += 1) { @@ -305,26 +8661,57 @@ function repeat$8(string, count) { } -function isNegativeZero$1(number) { +function isNegativeZero(number) { return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); } -common$b.isNothing = isNothing$1; -common$b.isObject = isObject$4; -common$b.toArray = toArray$1; -common$b.repeat = repeat$8; -common$b.isNegativeZero = isNegativeZero$1; -common$b.extend = extend$4; +var isNothing_1 = isNothing; +var isObject_1 = isObject$1; +var toArray_1 = toArray; +var repeat_1 = repeat$1; +var isNegativeZero_1 = isNegativeZero; +var extend_1 = extend$2; + +var common$4 = { + isNothing: isNothing_1, + isObject: isObject_1, + toArray: toArray_1, + repeat: repeat_1, + isNegativeZero: isNegativeZero_1, + extend: extend_1 +}; + +// YAML error class. http://stackoverflow.com/questions/8458984 + + +function formatError(exception, compact) { + var where = '', message = exception.reason || '(unknown reason)'; + + if (!exception.mark) return message; + + if (exception.mark.name) { + where += 'in "' + exception.mark.name + '" '; + } + + where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; + + if (!compact && exception.mark.snippet) { + where += '\n\n' + exception.mark.snippet; + } + + return message + ' ' + where; +} -function YAMLException$6(reason, mark) { + +function YAMLException$1(reason, mark) { // Super constructor Error.call(this); this.name = 'YAMLException'; this.reason = reason; this.mark = mark; - this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); + this.message = formatError(this, false); // Include stack trace in error object if (Error.captureStackTrace) { @@ -338,119 +8725,133 @@ function YAMLException$6(reason, mark) { // Inherit from Error -YAMLException$6.prototype = Object.create(Error.prototype); -YAMLException$6.prototype.constructor = YAMLException$6; +YAMLException$1.prototype = Object.create(Error.prototype); +YAMLException$1.prototype.constructor = YAMLException$1; -YAMLException$6.prototype.toString = function toString(compact) { - var result = this.name + ': '; +YAMLException$1.prototype.toString = function toString(compact) { + return this.name + ': ' + formatError(this, compact); +}; - result += this.reason || '(unknown reason)'; - if (!compact && this.mark) { - result += ' ' + this.mark.toString(); - } +var exception = YAMLException$1; - return result; -}; +// get snippet for a single line, respecting maxLength +function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { + var head = ''; + var tail = ''; + var maxHalfLength = Math.floor(maxLineLength / 2) - 1; + if (position - lineStart > maxHalfLength) { + head = ' ... '; + lineStart = position - maxHalfLength + head.length; + } -var exception$1 = YAMLException$6; + if (lineEnd - position > maxHalfLength) { + tail = ' ...'; + lineEnd = position + maxHalfLength - tail.length; + } -var common$a = common$b; + return { + str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, + pos: position - lineStart + head.length // relative position + }; +} -function Mark$1(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; +function padStart(string, max) { + return common$4.repeat(' ', max - string.length) + string; } -Mark$1.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; - - if (!this.buffer) return null; +function makeSnippet(mark, options) { + options = Object.create(options || null); - indent = indent || 4; - maxLength = maxLength || 75; + if (!mark.buffer) return null; - head = ''; - start = this.position; + if (!options.maxLength) options.maxLength = 79; + if (typeof options.indent !== 'number') options.indent = 1; + if (typeof options.linesBefore !== 'number') options.linesBefore = 3; + if (typeof options.linesAfter !== 'number') options.linesAfter = 2; - while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { - start -= 1; - if (this.position - start > (maxLength / 2 - 1)) { - head = ' ... '; - start += 5; - break; - } - } + var re = /\r?\n|\r|\0/g; + var lineStarts = [ 0 ]; + var lineEnds = []; + var match; + var foundLineNo = -1; - tail = ''; - end = this.position; + while ((match = re.exec(mark.buffer))) { + lineEnds.push(match.index); + lineStarts.push(match.index + match[0].length); - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - if (end - this.position > (maxLength / 2 - 1)) { - tail = ' ... '; - end -= 5; - break; + if (mark.position <= match.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; } } - snippet = this.buffer.slice(start, end); - - return common$a.repeat(' ', indent) + head + snippet + tail + '\n' + - common$a.repeat(' ', indent + this.position - start + head.length) + '^'; -}; - + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; -Mark$1.prototype.toString = function toString(compact) { - var snippet, where = ''; + var result = '', i, line; + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); - if (this.name) { - where += 'in "' + this.name + '" '; + for (i = 1; i <= options.linesBefore; i++) { + if (foundLineNo - i < 0) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo - i], + lineEnds[foundLineNo - i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), + maxLineLength + ); + result = common$4.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n' + result; } - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); - - if (!compact) { - snippet = this.getSnippet(); + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common$4.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + result += common$4.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; - if (snippet) { - where += ':\n' + snippet; - } + for (i = 1; i <= options.linesAfter; i++) { + if (foundLineNo + i >= lineEnds.length) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo + i], + lineEnds[foundLineNo + i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), + maxLineLength + ); + result += common$4.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; } - return where; -}; - + return result.replace(/\n$/, ''); +} -var mark$1 = Mark$1; -var YAMLException$5 = exception$1; +var snippet = makeSnippet; -var TYPE_CONSTRUCTOR_OPTIONS$1 = [ +var TYPE_CONSTRUCTOR_OPTIONS = [ 'kind', + 'multi', 'resolve', 'construct', 'instanceOf', 'predicate', 'represent', + 'representName', 'defaultStyle', 'styleAliases' ]; -var YAML_NODE_KINDS$1 = [ +var YAML_NODE_KINDS = [ 'scalar', 'sequence', 'mapping' ]; -function compileStyleAliases$1(map) { +function compileStyleAliases(map) { var result = {}; if (map !== null) { @@ -464,73 +8865,85 @@ function compileStyleAliases$1(map) { return result; } -function Type$j(tag, options) { +function Type$1(tag, options) { options = options || {}; Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS$1.indexOf(name) === -1) { - throw new YAMLException$5('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); } }); // TODO: Add tag format check. - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.styleAliases = compileStyleAliases$1(options['styleAliases'] || null); + this.options = options; // keep original options in case user wants to extend this type later + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.representName = options['representName'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.multi = options['multi'] || false; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - if (YAML_NODE_KINDS$1.indexOf(this.kind) === -1) { - throw new YAMLException$5('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); } } -var type$1 = Type$j; +var type$1 = Type$1; /*eslint-disable max-len*/ -var common$9 = common$b; -var YAMLException$4 = exception$1; -var Type$i = type$1; -function compileList$1(schema, name, result) { - var exclude = []; - schema.include.forEach(function (includedSchema) { - result = compileList$1(includedSchema, name, result); - }); + +function compileList(schema, name) { + var result = []; schema[name].forEach(function (currentType) { + var newIndex = result.length; + result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { - exclude.push(previousIndex); + if (previousType.tag === currentType.tag && + previousType.kind === currentType.kind && + previousType.multi === currentType.multi) { + + newIndex = previousIndex; } }); - result.push(currentType); + result[newIndex] = currentType; }); - return result.filter(function (type, index) { - return exclude.indexOf(index) === -1; - }); + return result; } -function compileMap$1(/* lists... */) { +function compileMap(/* lists... */) { var result = { scalar: {}, sequence: {}, mapping: {}, - fallback: {} + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } }, index, length; function collectType(type) { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; + if (type.multi) { + result.multi[type.kind].push(type); + result.multi['fallback'].push(type); + } else { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } } for (index = 0, length = arguments.length; index < length; index += 1) { @@ -540,99 +8953,92 @@ function compileMap$1(/* lists... */) { } -function Schema$7(definition) { - this.include = definition.include || []; - this.implicit = definition.implicit || []; - this.explicit = definition.explicit || []; - - this.implicit.forEach(function (type) { - if (type.loadKind && type.loadKind !== 'scalar') { - throw new YAMLException$4('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); - } - }); - - this.compiledImplicit = compileList$1(this, 'implicit', []); - this.compiledExplicit = compileList$1(this, 'explicit', []); - this.compiledTypeMap = compileMap$1(this.compiledImplicit, this.compiledExplicit); +function Schema$1(definition) { + return this.extend(definition); } -Schema$7.DEFAULT = null; - +Schema$1.prototype.extend = function extend(definition) { + var implicit = []; + var explicit = []; -Schema$7.create = function createSchema() { - var schemas, types; + if (definition instanceof type$1) { + // Schema.extend(type) + explicit.push(definition); - switch (arguments.length) { - case 1: - schemas = Schema$7.DEFAULT; - types = arguments[0]; - break; + } else if (Array.isArray(definition)) { + // Schema.extend([ type1, type2, ... ]) + explicit = explicit.concat(definition); - case 2: - schemas = arguments[0]; - types = arguments[1]; - break; + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) + if (definition.implicit) implicit = implicit.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); - default: - throw new YAMLException$4('Wrong number of arguments for Schema.create function'); + } else { + throw new exception('Schema.extend argument should be a Type, [ Type ], ' + + 'or a schema definition ({ implicit: [...], explicit: [...] })'); } - schemas = common$9.toArray(schemas); - types = common$9.toArray(types); + implicit.forEach(function (type$1$1) { + if (!(type$1$1 instanceof type$1)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } - if (!schemas.every(function (schema) { return schema instanceof Schema$7; })) { - throw new YAMLException$4('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); - } + if (type$1$1.loadKind && type$1$1.loadKind !== 'scalar') { + throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } - if (!types.every(function (type) { return type instanceof Type$i; })) { - throw new YAMLException$4('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } + if (type$1$1.multi) { + throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); + } + }); - return new Schema$7({ - include: schemas, - explicit: types + explicit.forEach(function (type$1$1) { + if (!(type$1$1 instanceof type$1)) { + throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } }); -}; + var result = Object.create(Schema$1.prototype); + + result.implicit = (this.implicit || []).concat(implicit); + result.explicit = (this.explicit || []).concat(explicit); + + result.compiledImplicit = compileList(result, 'implicit'); + result.compiledExplicit = compileList(result, 'explicit'); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); + + return result; +}; -var schema$2 = Schema$7; -var Type$h = type$1; +var schema$1 = Schema$1; -var str$1 = new Type$h('tag:yaml.org,2002:str', { +var str = new type$1('tag:yaml.org,2002:str', { kind: 'scalar', construct: function (data) { return data !== null ? data : ''; } }); -var Type$g = type$1; - -var seq$1 = new Type$g('tag:yaml.org,2002:seq', { +var seq = new type$1('tag:yaml.org,2002:seq', { kind: 'sequence', construct: function (data) { return data !== null ? data : []; } }); -var Type$f = type$1; - -var map$7 = new Type$f('tag:yaml.org,2002:map', { +var map$3 = new type$1('tag:yaml.org,2002:map', { kind: 'mapping', construct: function (data) { return data !== null ? data : {}; } }); -var Schema$6 = schema$2; - - -var failsafe$1 = new Schema$6({ +var failsafe = new schema$1({ explicit: [ - str$1, - seq$1, - map$7 + str, + seq, + map$3 ] }); -var Type$e = type$1; - -function resolveYamlNull$1(data) { +function resolveYamlNull(data) { if (data === null) return true; var max = data.length; @@ -641,31 +9047,30 @@ function resolveYamlNull$1(data) { (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); } -function constructYamlNull$1() { +function constructYamlNull() { return null; } -function isNull$1(object) { +function isNull(object) { return object === null; } -var _null$1 = new Type$e('tag:yaml.org,2002:null', { +var _null = new type$1('tag:yaml.org,2002:null', { kind: 'scalar', - resolve: resolveYamlNull$1, - construct: constructYamlNull$1, - predicate: isNull$1, + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, represent: { canonical: function () { return '~'; }, lowercase: function () { return 'null'; }, uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; } + camelcase: function () { return 'Null'; }, + empty: function () { return ''; } }, defaultStyle: 'lowercase' }); -var Type$d = type$1; - -function resolveYamlBoolean$1(data) { +function resolveYamlBoolean(data) { if (data === null) return false; var max = data.length; @@ -674,21 +9079,21 @@ function resolveYamlBoolean$1(data) { (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); } -function constructYamlBoolean$1(data) { +function constructYamlBoolean(data) { return data === 'true' || data === 'True' || data === 'TRUE'; } -function isBoolean$1(object) { +function isBoolean(object) { return Object.prototype.toString.call(object) === '[object Boolean]'; } -var bool$1 = new Type$d('tag:yaml.org,2002:bool', { +var bool = new type$1('tag:yaml.org,2002:bool', { kind: 'scalar', - resolve: resolveYamlBoolean$1, - construct: constructYamlBoolean$1, - predicate: isBoolean$1, + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, represent: { lowercase: function (object) { return object ? 'true' : 'false'; }, uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, @@ -697,24 +9102,21 @@ var bool$1 = new Type$d('tag:yaml.org,2002:bool', { defaultStyle: 'lowercase' }); -var common$8 = common$b; -var Type$c = type$1; - -function isHexCode$1(c) { +function isHexCode(c) { return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || ((0x61/* a */ <= c) && (c <= 0x66/* f */)); } -function isOctCode$1(c) { +function isOctCode(c) { return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); } -function isDecCode$1(c) { +function isDecCode(c) { return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); } -function resolveYamlInteger$1(data) { +function resolveYamlInteger(data) { if (data === null) return false; var max = data.length, @@ -759,23 +9161,28 @@ function resolveYamlInteger$1(data) { for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; - if (!isHexCode$1(data.charCodeAt(index))) return false; + if (!isHexCode(data.charCodeAt(index))) return false; hasDigits = true; } return hasDigits && ch !== '_'; } - // base 8 - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode$1(data.charCodeAt(index))) return false; - hasDigits = true; + + if (ch === 'o') { + // base 8 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; } - return hasDigits && ch !== '_'; } - // base 10 (except 0) or base 60 + // base 10 (except 0) // value should not start with `_`; if (ch === '_') return false; @@ -783,8 +9190,7 @@ function resolveYamlInteger$1(data) { for (; index < max; index++) { ch = data[index]; if (ch === '_') continue; - if (ch === ':') break; - if (!isDecCode$1(data.charCodeAt(index))) { + if (!isDecCode(data.charCodeAt(index))) { return false; } hasDigits = true; @@ -793,15 +9199,11 @@ function resolveYamlInteger$1(data) { // Should have digits and should not end with `_` if (!hasDigits || ch === '_') return false; - // if !base60 - done; - if (ch !== ':') return true; - - // base60 almost not used, no needs to optimize - return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); + return true; } -function constructYamlInteger$1(data) { - var value = data, sign = 1, ch, base, digits = []; +function constructYamlInteger(data) { + var value = data, sign = 1, ch; if (value.indexOf('_') !== -1) { value = value.replace(/_/g, ''); @@ -819,43 +9221,26 @@ function constructYamlInteger$1(data) { if (ch === '0') { if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value, 16); - return sign * parseInt(value, 8); - } - - if (value.indexOf(':') !== -1) { - value.split(':').forEach(function (v) { - digits.unshift(parseInt(v, 10)); - }); - - value = 0; - base = 1; - - digits.forEach(function (d) { - value += (d * base); - base *= 60; - }); - - return sign * value; - + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); } return sign * parseInt(value, 10); } -function isInteger$1(object) { +function isInteger(object) { return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common$8.isNegativeZero(object)); + (object % 1 === 0 && !common$4.isNegativeZero(object)); } -var int$4 = new Type$c('tag:yaml.org,2002:int', { +var int = new type$1('tag:yaml.org,2002:int', { kind: 'scalar', - resolve: resolveYamlInteger$1, - construct: constructYamlInteger$1, - predicate: isInteger$1, + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, represent: { binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, decimal: function (obj) { return obj.toString(10); }, /* eslint-disable max-len */ hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } @@ -869,26 +9254,21 @@ var int$4 = new Type$c('tag:yaml.org,2002:int', { } }); -var common$7 = common$b; -var Type$b = type$1; - -var YAML_FLOAT_PATTERN$1 = new RegExp( +var YAML_FLOAT_PATTERN = new RegExp( // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + // .2e4, .2 // special case, seems not from spec '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // 20:59 - '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + // .inf '|[-+]?\\.(?:inf|Inf|INF)' + // .nan '|\\.(?:nan|NaN|NAN))$'); -function resolveYamlFloat$1(data) { +function resolveYamlFloat(data) { if (data === null) return false; - if (!YAML_FLOAT_PATTERN$1.test(data) || + if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_` // Probably should update regexp & check speed data[data.length - 1] === '_') { @@ -898,12 +9278,11 @@ function resolveYamlFloat$1(data) { return true; } -function constructYamlFloat$1(data) { - var value, sign, base, digits; +function constructYamlFloat(data) { + var value, sign; value = data.replace(/_/g, '').toLowerCase(); sign = value[0] === '-' ? -1 : 1; - digits = []; if ('+-'.indexOf(value[0]) >= 0) { value = value.slice(1); @@ -914,30 +9293,14 @@ function constructYamlFloat$1(data) { } else if (value === '.nan') { return NaN; - - } else if (value.indexOf(':') >= 0) { - value.split(':').forEach(function (v) { - digits.unshift(parseFloat(v, 10)); - }); - - value = 0.0; - base = 1; - - digits.forEach(function (d) { - value += d * base; - base *= 60; - }); - - return sign * value; - } return sign * parseFloat(value, 10); } -var SCIENTIFIC_WITHOUT_DOT$1 = /^[-+]?[0-9]+e/; +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; -function representYamlFloat$1(object, style) { +function representYamlFloat(object, style) { var res; if (isNaN(object)) { @@ -958,7 +9321,7 @@ function representYamlFloat$1(object, style) { case 'uppercase': return '-.INF'; case 'camelcase': return '-.Inf'; } - } else if (common$7.isNegativeZero(object)) { + } else if (common$4.isNegativeZero(object)) { return '-0.0'; } @@ -967,55 +9330,40 @@ function representYamlFloat$1(object, style) { // JS stringifier can build scientific format without dots: 5e-100, // while YAML requres dot: 5.e-100. Fix it with simple hack - return SCIENTIFIC_WITHOUT_DOT$1.test(res) ? res.replace('e', '.e') : res; + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; } -function isFloat$1(object) { +function isFloat(object) { return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common$7.isNegativeZero(object)); + (object % 1 !== 0 || common$4.isNegativeZero(object)); } -var float$1 = new Type$b('tag:yaml.org,2002:float', { +var float = new type$1('tag:yaml.org,2002:float', { kind: 'scalar', - resolve: resolveYamlFloat$1, - construct: constructYamlFloat$1, - predicate: isFloat$1, - represent: representYamlFloat$1, + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, defaultStyle: 'lowercase' }); -var Schema$5 = schema$2; - - -var json$3 = new Schema$5({ - include: [ - failsafe$1 - ], +var json = failsafe.extend({ implicit: [ - _null$1, - bool$1, - int$4, - float$1 - ] -}); - -var Schema$4 = schema$2; - - -var core$4 = new Schema$4({ - include: [ - json$3 + _null, + bool, + int, + float ] }); -var Type$a = type$1; +var core = json; -var YAML_DATE_REGEXP$1 = new RegExp( +var YAML_DATE_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9])' + // [2] month '-([0-9][0-9])$'); // [3] day -var YAML_TIMESTAMP_REGEXP$1 = new RegExp( +var YAML_TIMESTAMP_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9]?)' + // [2] month '-([0-9][0-9]?)' + // [3] day @@ -1027,19 +9375,19 @@ var YAML_TIMESTAMP_REGEXP$1 = new RegExp( '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour '(?::([0-9][0-9]))?))?$'); // [11] tz_minute -function resolveYamlTimestamp$1(data) { +function resolveYamlTimestamp(data) { if (data === null) return false; - if (YAML_DATE_REGEXP$1.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP$1.exec(data) !== null) return true; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; return false; } -function constructYamlTimestamp$1(data) { +function constructYamlTimestamp(data) { var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date; - match = YAML_DATE_REGEXP$1.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP$1.exec(data); + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); if (match === null) throw new Error('Date resolve error'); @@ -1083,50 +9431,41 @@ function constructYamlTimestamp$1(data) { return date; } -function representYamlTimestamp$1(object /*, style*/) { +function representYamlTimestamp(object /*, style*/) { return object.toISOString(); } -var timestamp$1 = new Type$a('tag:yaml.org,2002:timestamp', { +var timestamp = new type$1('tag:yaml.org,2002:timestamp', { kind: 'scalar', - resolve: resolveYamlTimestamp$1, - construct: constructYamlTimestamp$1, + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, instanceOf: Date, - represent: representYamlTimestamp$1 + represent: representYamlTimestamp }); -var Type$9 = type$1; - -function resolveYamlMerge$1(data) { +function resolveYamlMerge(data) { return data === '<<' || data === null; } -var merge$2 = new Type$9('tag:yaml.org,2002:merge', { +var merge$1 = new type$1('tag:yaml.org,2002:merge', { kind: 'scalar', - resolve: resolveYamlMerge$1 + resolve: resolveYamlMerge }); /*eslint-disable no-bitwise*/ -var NodeBuffer; -try { - // A trick for browserified version, to not include `Buffer` shim - var _require$1 = commonjsRequire; - NodeBuffer = _require$1('buffer').Buffer; -} catch (__) {} -var Type$8 = type$1; // [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; -function resolveYamlBinary$1(data) { +function resolveYamlBinary(data) { if (data === null) return false; - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP$1; + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; // Convert one by one. for (idx = 0; idx < max; idx++) { @@ -1145,11 +9484,11 @@ function resolveYamlBinary$1(data) { return (bitlen % 8) === 0; } -function constructYamlBinary$1(data) { +function constructYamlBinary(data) { var idx, tailbits, input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan max = input.length, - map = BASE64_MAP$1, + map = BASE64_MAP, bits = 0, result = []; @@ -1180,19 +9519,13 @@ function constructYamlBinary$1(data) { result.push((bits >> 4) & 0xFF); } - // Wrap into Buffer for NodeJS and leave Array for browser - if (NodeBuffer) { - // Support node 6.+ Buffer API when available - return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); - } - - return result; + return new Uint8Array(result); } -function representYamlBinary$1(object /*, style*/) { +function representYamlBinary(object /*, style*/) { var result = '', bits = 0, idx, tail, max = object.length, - map = BASE64_MAP$1; + map = BASE64_MAP; // Convert every three bytes to 4 ASCII characters. @@ -1231,24 +9564,22 @@ function representYamlBinary$1(object /*, style*/) { return result; } -function isBinary$1(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); +function isBinary(obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]'; } -var binary$1 = new Type$8('tag:yaml.org,2002:binary', { +var binary = new type$1('tag:yaml.org,2002:binary', { kind: 'scalar', - resolve: resolveYamlBinary$1, - construct: constructYamlBinary$1, - predicate: isBinary$1, - represent: representYamlBinary$1 + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary }); -var Type$7 = type$1; - -var _hasOwnProperty$7 = Object.prototype.hasOwnProperty; -var _toString$5 = Object.prototype.toString; +var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; +var _toString$2 = Object.prototype.toString; -function resolveYamlOmap$1(data) { +function resolveYamlOmap(data) { if (data === null) return true; var objectKeys = [], index, length, pair, pairKey, pairHasKey, @@ -1258,10 +9589,10 @@ function resolveYamlOmap$1(data) { pair = object[index]; pairHasKey = false; - if (_toString$5.call(pair) !== '[object Object]') return false; + if (_toString$2.call(pair) !== '[object Object]') return false; for (pairKey in pair) { - if (_hasOwnProperty$7.call(pair, pairKey)) { + if (_hasOwnProperty$3.call(pair, pairKey)) { if (!pairHasKey) pairHasKey = true; else return false; } @@ -1276,21 +9607,19 @@ function resolveYamlOmap$1(data) { return true; } -function constructYamlOmap$1(data) { +function constructYamlOmap(data) { return data !== null ? data : []; } -var omap$1 = new Type$7('tag:yaml.org,2002:omap', { +var omap = new type$1('tag:yaml.org,2002:omap', { kind: 'sequence', - resolve: resolveYamlOmap$1, - construct: constructYamlOmap$1 + resolve: resolveYamlOmap, + construct: constructYamlOmap }); -var Type$6 = type$1; - -var _toString$4 = Object.prototype.toString; +var _toString$1 = Object.prototype.toString; -function resolveYamlPairs$1(data) { +function resolveYamlPairs(data) { if (data === null) return true; var index, length, pair, keys, result, @@ -1301,7 +9630,7 @@ function resolveYamlPairs$1(data) { for (index = 0, length = object.length; index < length; index += 1) { pair = object[index]; - if (_toString$4.call(pair) !== '[object Object]') return false; + if (_toString$1.call(pair) !== '[object Object]') return false; keys = Object.keys(pair); @@ -1313,7 +9642,7 @@ function resolveYamlPairs$1(data) { return true; } -function constructYamlPairs$1(data) { +function constructYamlPairs(data) { if (data === null) return []; var index, length, pair, keys, result, @@ -1332,23 +9661,21 @@ function constructYamlPairs$1(data) { return result; } -var pairs$1 = new Type$6('tag:yaml.org,2002:pairs', { +var pairs = new type$1('tag:yaml.org,2002:pairs', { kind: 'sequence', - resolve: resolveYamlPairs$1, - construct: constructYamlPairs$1 + resolve: resolveYamlPairs, + construct: constructYamlPairs }); -var Type$5 = type$1; - -var _hasOwnProperty$6 = Object.prototype.hasOwnProperty; +var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; -function resolveYamlSet$1(data) { +function resolveYamlSet(data) { if (data === null) return true; var key, object = data; for (key in object) { - if (_hasOwnProperty$6.call(object, key)) { + if (_hasOwnProperty$2.call(object, key)) { if (object[key] !== null) return false; } } @@ -1356,275 +9683,76 @@ function resolveYamlSet$1(data) { return true; } -function constructYamlSet$1(data) { +function constructYamlSet(data) { return data !== null ? data : {}; } -var set$1 = new Type$5('tag:yaml.org,2002:set', { +var set = new type$1('tag:yaml.org,2002:set', { kind: 'mapping', - resolve: resolveYamlSet$1, - construct: constructYamlSet$1 + resolve: resolveYamlSet, + construct: constructYamlSet }); -var Schema$3 = schema$2; - - -var default_safe = new Schema$3({ - include: [ - core$4 - ], +var _default$1 = core.extend({ implicit: [ - timestamp$1, - merge$2 + timestamp, + merge$1 ], explicit: [ - binary$1, - omap$1, - pairs$1, - set$1 + binary, + omap, + pairs, + set ] }); -var Type$4 = type$1; - -function resolveJavascriptUndefined() { - return true; -} - -function constructJavascriptUndefined() { - /*eslint-disable no-undefined*/ - return undefined; -} - -function representJavascriptUndefined() { - return ''; -} - -function isUndefined(object) { - return typeof object === 'undefined'; -} - -var _undefined = new Type$4('tag:yaml.org,2002:js/undefined', { - kind: 'scalar', - resolve: resolveJavascriptUndefined, - construct: constructJavascriptUndefined, - predicate: isUndefined, - represent: representJavascriptUndefined -}); - -var Type$3 = type$1; - -function resolveJavascriptRegExp(data) { - if (data === null) return false; - if (data.length === 0) return false; - - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // if regexp starts with '/' it can have modifiers and must be properly closed - // `/foo/gim` - modifiers tail can be maximum 3 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - - if (modifiers.length > 3) return false; - // if expression starts with /, is should be properly terminated - if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; - } - - return true; -} - -function constructJavascriptRegExp(data) { - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // `/foo/gim` - tail can be maximum 4 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - regexp = regexp.slice(1, regexp.length - modifiers.length - 1); - } - - return new RegExp(regexp, modifiers); -} - -function representJavascriptRegExp(object /*, style*/) { - var result = '/' + object.source + '/'; - - if (object.global) result += 'g'; - if (object.multiline) result += 'm'; - if (object.ignoreCase) result += 'i'; - - return result; -} - -function isRegExp(object) { - return Object.prototype.toString.call(object) === '[object RegExp]'; -} - -var regexp = new Type$3('tag:yaml.org,2002:js/regexp', { - kind: 'scalar', - resolve: resolveJavascriptRegExp, - construct: constructJavascriptRegExp, - predicate: isRegExp, - represent: representJavascriptRegExp -}); - -var esprima; - -// Browserified version does not have esprima -// -// 1. For node.js just require module as deps -// 2. For browser try to require mudule via external AMD system. -// If not found - try to fallback to window.esprima. If not -// found too - then fail to parse. -// -try { - // workaround to exclude package from browserify list. - var _require = commonjsRequire; - esprima = _require('esprima'); -} catch (_) { - /* eslint-disable no-redeclare */ - /* global window */ - if (typeof window !== 'undefined') esprima = window.esprima; -} - -var Type$2 = type$1; - -function resolveJavascriptFunction(data) { - if (data === null) return false; - - try { - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }); - - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - return false; - } - - return true; - } catch (err) { - return false; - } -} - -function constructJavascriptFunction(data) { - /*jslint evil:true*/ - - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }), - params = [], - body; - - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - throw new Error('Failed to resolve function'); - } - - ast.body[0].expression.params.forEach(function (param) { - params.push(param.name); - }); - - body = ast.body[0].expression.body.range; - - // Esprima's ranges include the first '{' and the last '}' characters on - // function expressions. So cut them out. - if (ast.body[0].expression.body.type === 'BlockStatement') { - /*eslint-disable no-new-func*/ - return new Function(params, source.slice(body[0] + 1, body[1] - 1)); - } - // ES6 arrow functions can omit the BlockStatement. In that case, just return - // the body. - /*eslint-disable no-new-func*/ - return new Function(params, 'return ' + source.slice(body[0], body[1])); -} - -function representJavascriptFunction(object /*, style*/) { - return object.toString(); -} - -function isFunction(object) { - return Object.prototype.toString.call(object) === '[object Function]'; -} - -var _function = new Type$2('tag:yaml.org,2002:js/function', { - kind: 'scalar', - resolve: resolveJavascriptFunction, - construct: constructJavascriptFunction, - predicate: isFunction, - represent: representJavascriptFunction -}); +/*eslint-disable max-len,no-use-before-define*/ -var Schema$2 = schema$2; -var default_full = Schema$2.DEFAULT = new Schema$2({ - include: [ - default_safe - ], - explicit: [ - _undefined, - regexp, - _function - ] -}); -/*eslint-disable max-len,no-use-before-define*/ -var common$6 = common$b; -var YAMLException$3 = exception$1; -var Mark = mark$1; -var DEFAULT_SAFE_SCHEMA$1 = default_safe; -var DEFAULT_FULL_SCHEMA$1 = default_full; -var _hasOwnProperty$5 = Object.prototype.hasOwnProperty; +var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; -var CONTEXT_FLOW_IN$1 = 1; -var CONTEXT_FLOW_OUT$1 = 2; -var CONTEXT_BLOCK_IN$1 = 3; -var CONTEXT_BLOCK_OUT$1 = 4; +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; -var CHOMPING_CLIP$1 = 1; -var CHOMPING_STRIP$1 = 2; -var CHOMPING_KEEP$1 = 3; +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; -var PATTERN_NON_PRINTABLE$1 = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS$1 = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS$1 = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE$1 = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI$1 = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; -function _class$1(obj) { return Object.prototype.toString.call(obj); } +function _class(obj) { return Object.prototype.toString.call(obj); } -function is_EOL$1(c) { +function is_EOL(c) { return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); } -function is_WHITE_SPACE$1(c) { +function is_WHITE_SPACE(c) { return (c === 0x09/* Tab */) || (c === 0x20/* Space */); } -function is_WS_OR_EOL$1(c) { +function is_WS_OR_EOL(c) { return (c === 0x09/* Tab */) || (c === 0x20/* Space */) || (c === 0x0A/* LF */) || (c === 0x0D/* CR */); } -function is_FLOW_INDICATOR$1(c) { +function is_FLOW_INDICATOR(c) { return c === 0x2C/* , */ || c === 0x5B/* [ */ || c === 0x5D/* ] */ || @@ -1632,7 +9760,7 @@ function is_FLOW_INDICATOR$1(c) { c === 0x7D/* } */; } -function fromHexCode$1(c) { +function fromHexCode(c) { var lc; if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { @@ -1649,14 +9777,14 @@ function fromHexCode$1(c) { return -1; } -function escapedHexLen$1(c) { +function escapedHexLen(c) { if (c === 0x78/* x */) { return 2; } if (c === 0x75/* u */) { return 4; } if (c === 0x55/* U */) { return 8; } return 0; } -function fromDecimalCode$1(c) { +function fromDecimalCode(c) { if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { return c - 0x30; } @@ -1664,7 +9792,7 @@ function fromDecimalCode$1(c) { return -1; } -function simpleEscapeSequence$1(c) { +function simpleEscapeSequence(c) { /* eslint-disable indent */ return (c === 0x30/* 0 */) ? '\x00' : (c === 0x61/* a */) ? '\x07' : @@ -1686,7 +9814,7 @@ function simpleEscapeSequence$1(c) { (c === 0x50/* P */) ? '\u2029' : ''; } -function charFromCodepoint$1(c) { +function charFromCodepoint(c) { if (c <= 0xFFFF) { return String.fromCharCode(c); } @@ -1698,21 +9826,24 @@ function charFromCodepoint$1(c) { ); } -var simpleEscapeCheck$1 = new Array(256); // integer, for fast access -var simpleEscapeMap$1 = new Array(256); -for (var i$1 = 0; i$1 < 256; i$1++) { - simpleEscapeCheck$1[i$1] = simpleEscapeSequence$1(i$1) ? 1 : 0; - simpleEscapeMap$1[i$1] = simpleEscapeSequence$1(i$1); +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); } -function State$3(input, options) { +function State$1(input, options) { this.input = input; this.filename = options['filename'] || null; - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA$1; + this.schema = options['schema'] || _default$1; this.onWarning = options['onWarning'] || null; + // (Hidden) Remove? makes the loader to expect YAML 1.1 documents + // if such documents have no explicit %YAML directive this.legacy = options['legacy'] || false; + this.json = options['json'] || false; this.listener = options['listener'] || null; @@ -1725,6 +9856,10 @@ function State$3(input, options) { this.lineStart = 0; this.lineIndent = 0; + // position of first leading tab in the current line, + // used to make sure there are no tabs in the indentation + this.firstTabInLine = -1; + this.documents = []; /* @@ -1740,55 +9875,63 @@ function State$3(input, options) { } -function generateError$1(state, message) { - return new YAMLException$3( - message, - new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +function generateError(state, message) { + var mark = { + name: state.filename, + buffer: state.input.slice(0, -1), // omit trailing \0 + position: state.position, + line: state.line, + column: state.position - state.lineStart + }; + + mark.snippet = snippet(mark); + + return new exception(message, mark); } -function throwError$2(state, message) { - throw generateError$1(state, message); +function throwError$1(state, message) { + throw generateError(state, message); } -function throwWarning$1(state, message) { +function throwWarning(state, message) { if (state.onWarning) { - state.onWarning.call(null, generateError$1(state, message)); + state.onWarning.call(null, generateError(state, message)); } } -var directiveHandlers$1 = { +var directiveHandlers = { YAML: function handleYamlDirective(state, name, args) { var match, major, minor; if (state.version !== null) { - throwError$2(state, 'duplication of %YAML directive'); + throwError$1(state, 'duplication of %YAML directive'); } if (args.length !== 1) { - throwError$2(state, 'YAML directive accepts exactly one argument'); + throwError$1(state, 'YAML directive accepts exactly one argument'); } match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); if (match === null) { - throwError$2(state, 'ill-formed argument of the YAML directive'); + throwError$1(state, 'ill-formed argument of the YAML directive'); } major = parseInt(match[1], 10); minor = parseInt(match[2], 10); if (major !== 1) { - throwError$2(state, 'unacceptable YAML version of the document'); + throwError$1(state, 'unacceptable YAML version of the document'); } state.version = args[0]; state.checkLineBreaks = (minor < 2); if (minor !== 1 && minor !== 2) { - throwWarning$1(state, 'unsupported YAML version of the document'); + throwWarning(state, 'unsupported YAML version of the document'); } }, @@ -1797,22 +9940,28 @@ var directiveHandlers$1 = { var handle, prefix; if (args.length !== 2) { - throwError$2(state, 'TAG directive accepts exactly two arguments'); + throwError$1(state, 'TAG directive accepts exactly two arguments'); } handle = args[0]; prefix = args[1]; - if (!PATTERN_TAG_HANDLE$1.test(handle)) { - throwError$2(state, 'ill-formed tag handle (first argument) of the TAG directive'); + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError$1(state, 'ill-formed tag handle (first argument) of the TAG directive'); } - if (_hasOwnProperty$5.call(state.tagMap, handle)) { - throwError$2(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + if (_hasOwnProperty$1.call(state.tagMap, handle)) { + throwError$1(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); } - if (!PATTERN_TAG_URI$1.test(prefix)) { - throwError$2(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + if (!PATTERN_TAG_URI.test(prefix)) { + throwError$1(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError$1(state, 'tag prefix is malformed: ' + prefix); } state.tagMap[handle] = prefix; @@ -1820,7 +9969,7 @@ var directiveHandlers$1 = { }; -function captureSegment$1(state, start, end, checkJson) { +function captureSegment(state, start, end, checkJson) { var _position, _length, _character, _result; if (start < end) { @@ -1831,22 +9980,22 @@ function captureSegment$1(state, start, end, checkJson) { _character = _result.charCodeAt(_position); if (!(_character === 0x09 || (0x20 <= _character && _character <= 0x10FFFF))) { - throwError$2(state, 'expected valid JSON character'); + throwError$1(state, 'expected valid JSON character'); } } - } else if (PATTERN_NON_PRINTABLE$1.test(_result)) { - throwError$2(state, 'the stream contains non-printable characters'); + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError$1(state, 'the stream contains non-printable characters'); } state.result += _result; } } -function mergeMappings$1(state, destination, source, overridableKeys) { +function mergeMappings(state, destination, source, overridableKeys) { var sourceKeys, key, index, quantity; - if (!common$6.isObject(source)) { - throwError$2(state, 'cannot merge mappings; the provided source object is unacceptable'); + if (!common$4.isObject(source)) { + throwError$1(state, 'cannot merge mappings; the provided source object is unacceptable'); } sourceKeys = Object.keys(source); @@ -1854,14 +10003,16 @@ function mergeMappings$1(state, destination, source, overridableKeys) { for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { key = sourceKeys[index]; - if (!_hasOwnProperty$5.call(destination, key)) { + if (!_hasOwnProperty$1.call(destination, key)) { destination[key] = source[key]; overridableKeys[key] = true; } } } -function storeMappingPair$1(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, + startLine, startLineStart, startPos) { + var index, quantity; // The output is a plain object here, so keys can only be strings. @@ -1872,10 +10023,10 @@ function storeMappingPair$1(state, _result, overridableKeys, keyTag, keyNode, va for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { if (Array.isArray(keyNode[index])) { - throwError$2(state, 'nested arrays are not supported inside keys'); + throwError$1(state, 'nested arrays are not supported inside keys'); } - if (typeof keyNode === 'object' && _class$1(keyNode[index]) === '[object Object]') { + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { keyNode[index] = '[object Object]'; } } @@ -1884,7 +10035,7 @@ function storeMappingPair$1(state, _result, overridableKeys, keyTag, keyNode, va // Avoid code execution in load() via toString property // (still use its own toString for arrays, timestamps, // and whatever user schema extensions happen to have @@toStringTag) - if (typeof keyNode === 'object' && _class$1(keyNode) === '[object Object]') { + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { keyNode = '[object Object]'; } @@ -1898,27 +10049,39 @@ function storeMappingPair$1(state, _result, overridableKeys, keyTag, keyNode, va if (keyTag === 'tag:yaml.org,2002:merge') { if (Array.isArray(valueNode)) { for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings$1(state, _result, valueNode[index], overridableKeys); + mergeMappings(state, _result, valueNode[index], overridableKeys); } } else { - mergeMappings$1(state, _result, valueNode, overridableKeys); + mergeMappings(state, _result, valueNode, overridableKeys); } } else { if (!state.json && - !_hasOwnProperty$5.call(overridableKeys, keyNode) && - _hasOwnProperty$5.call(_result, keyNode)) { + !_hasOwnProperty$1.call(overridableKeys, keyNode) && + _hasOwnProperty$1.call(_result, keyNode)) { state.line = startLine || state.line; + state.lineStart = startLineStart || state.lineStart; state.position = startPos || state.position; - throwError$2(state, 'duplicated mapping key'); + throwError$1(state, 'duplicated mapping key'); + } + + // used for this specific key only because Object.defineProperty is slow + if (keyNode === '__proto__') { + Object.defineProperty(_result, keyNode, { + configurable: true, + enumerable: true, + writable: true, + value: valueNode + }); + } else { + _result[keyNode] = valueNode; } - _result[keyNode] = valueNode; delete overridableKeys[keyNode]; } return _result; } -function readLineBreak$1(state) { +function readLineBreak(state) { var ch; ch = state.input.charCodeAt(state.position); @@ -1931,19 +10094,23 @@ function readLineBreak$1(state) { state.position++; } } else { - throwError$2(state, 'a line break is expected'); + throwError$1(state, 'a line break is expected'); } state.line += 1; state.lineStart = state.position; + state.firstTabInLine = -1; } -function skipSeparationSpace$1(state, allowComments, checkIndent) { +function skipSeparationSpace(state, allowComments, checkIndent) { var lineBreaks = 0, ch = state.input.charCodeAt(state.position); while (ch !== 0) { - while (is_WHITE_SPACE$1(ch)) { + while (is_WHITE_SPACE(ch)) { + if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { + state.firstTabInLine = state.position; + } ch = state.input.charCodeAt(++state.position); } @@ -1953,8 +10120,8 @@ function skipSeparationSpace$1(state, allowComments, checkIndent) { } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); } - if (is_EOL$1(ch)) { - readLineBreak$1(state); + if (is_EOL(ch)) { + readLineBreak(state); ch = state.input.charCodeAt(state.position); lineBreaks++; @@ -1970,13 +10137,13 @@ function skipSeparationSpace$1(state, allowComments, checkIndent) { } if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning$1(state, 'deficient indentation'); + throwWarning(state, 'deficient indentation'); } return lineBreaks; } -function testDocumentSeparator$1(state) { +function testDocumentSeparator(state) { var _position = state.position, ch; @@ -1992,7 +10159,7 @@ function testDocumentSeparator$1(state) { ch = state.input.charCodeAt(_position); - if (ch === 0 || is_WS_OR_EOL$1(ch)) { + if (ch === 0 || is_WS_OR_EOL(ch)) { return true; } } @@ -2000,16 +10167,16 @@ function testDocumentSeparator$1(state) { return false; } -function writeFoldedLines$1(state, count) { +function writeFoldedLines(state, count) { if (count === 1) { state.result += ' '; } else if (count > 1) { - state.result += common$6.repeat('\n', count - 1); + state.result += common$4.repeat('\n', count - 1); } } -function readPlainScalar$1(state, nodeIndent, withinFlowCollection) { +function readPlainScalar(state, nodeIndent, withinFlowCollection) { var preceding, following, captureStart, @@ -2024,8 +10191,8 @@ function readPlainScalar$1(state, nodeIndent, withinFlowCollection) { ch = state.input.charCodeAt(state.position); - if (is_WS_OR_EOL$1(ch) || - is_FLOW_INDICATOR$1(ch) || + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || ch === 0x23/* # */ || ch === 0x26/* & */ || ch === 0x2A/* * */ || @@ -2043,8 +10210,8 @@ function readPlainScalar$1(state, nodeIndent, withinFlowCollection) { if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { following = state.input.charCodeAt(state.position + 1); - if (is_WS_OR_EOL$1(following) || - withinFlowCollection && is_FLOW_INDICATOR$1(following)) { + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { return false; } } @@ -2058,27 +10225,27 @@ function readPlainScalar$1(state, nodeIndent, withinFlowCollection) { if (ch === 0x3A/* : */) { following = state.input.charCodeAt(state.position + 1); - if (is_WS_OR_EOL$1(following) || - withinFlowCollection && is_FLOW_INDICATOR$1(following)) { + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { break; } } else if (ch === 0x23/* # */) { preceding = state.input.charCodeAt(state.position - 1); - if (is_WS_OR_EOL$1(preceding)) { + if (is_WS_OR_EOL(preceding)) { break; } - } else if ((state.position === state.lineStart && testDocumentSeparator$1(state)) || - withinFlowCollection && is_FLOW_INDICATOR$1(ch)) { + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { break; - } else if (is_EOL$1(ch)) { + } else if (is_EOL(ch)) { _line = state.line; _lineStart = state.lineStart; _lineIndent = state.lineIndent; - skipSeparationSpace$1(state, false, -1); + skipSeparationSpace(state, false, -1); if (state.lineIndent >= nodeIndent) { hasPendingContent = true; @@ -2094,20 +10261,20 @@ function readPlainScalar$1(state, nodeIndent, withinFlowCollection) { } if (hasPendingContent) { - captureSegment$1(state, captureStart, captureEnd, false); - writeFoldedLines$1(state, state.line - _line); + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); captureStart = captureEnd = state.position; hasPendingContent = false; } - if (!is_WHITE_SPACE$1(ch)) { + if (!is_WHITE_SPACE(ch)) { captureEnd = state.position + 1; } ch = state.input.charCodeAt(++state.position); } - captureSegment$1(state, captureStart, captureEnd, false); + captureSegment(state, captureStart, captureEnd, false); if (state.result) { return true; @@ -2118,7 +10285,7 @@ function readPlainScalar$1(state, nodeIndent, withinFlowCollection) { return false; } -function readSingleQuotedScalar$1(state, nodeIndent) { +function readSingleQuotedScalar(state, nodeIndent) { var ch, captureStart, captureEnd; @@ -2135,7 +10302,7 @@ function readSingleQuotedScalar$1(state, nodeIndent) { while ((ch = state.input.charCodeAt(state.position)) !== 0) { if (ch === 0x27/* ' */) { - captureSegment$1(state, captureStart, state.position, true); + captureSegment(state, captureStart, state.position, true); ch = state.input.charCodeAt(++state.position); if (ch === 0x27/* ' */) { @@ -2146,13 +10313,13 @@ function readSingleQuotedScalar$1(state, nodeIndent) { return true; } - } else if (is_EOL$1(ch)) { - captureSegment$1(state, captureStart, captureEnd, true); - writeFoldedLines$1(state, skipSeparationSpace$1(state, false, nodeIndent)); + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); captureStart = captureEnd = state.position; - } else if (state.position === state.lineStart && testDocumentSeparator$1(state)) { - throwError$2(state, 'unexpected end of the document within a single quoted scalar'); + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError$1(state, 'unexpected end of the document within a single quoted scalar'); } else { state.position++; @@ -2160,10 +10327,10 @@ function readSingleQuotedScalar$1(state, nodeIndent) { } } - throwError$2(state, 'unexpected end of the stream within a single quoted scalar'); + throwError$1(state, 'unexpected end of the stream within a single quoted scalar'); } -function readDoubleQuotedScalar$1(state, nodeIndent) { +function readDoubleQuotedScalar(state, nodeIndent) { var captureStart, captureEnd, hexLength, @@ -2184,54 +10351,54 @@ function readDoubleQuotedScalar$1(state, nodeIndent) { while ((ch = state.input.charCodeAt(state.position)) !== 0) { if (ch === 0x22/* " */) { - captureSegment$1(state, captureStart, state.position, true); + captureSegment(state, captureStart, state.position, true); state.position++; return true; } else if (ch === 0x5C/* \ */) { - captureSegment$1(state, captureStart, state.position, true); + captureSegment(state, captureStart, state.position, true); ch = state.input.charCodeAt(++state.position); - if (is_EOL$1(ch)) { - skipSeparationSpace$1(state, false, nodeIndent); + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck$1[ch]) { - state.result += simpleEscapeMap$1[ch]; + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; state.position++; - } else if ((tmp = escapedHexLen$1(ch)) > 0) { + } else if ((tmp = escapedHexLen(ch)) > 0) { hexLength = tmp; hexResult = 0; for (; hexLength > 0; hexLength--) { ch = state.input.charCodeAt(++state.position); - if ((tmp = fromHexCode$1(ch)) >= 0) { + if ((tmp = fromHexCode(ch)) >= 0) { hexResult = (hexResult << 4) + tmp; } else { - throwError$2(state, 'expected hexadecimal character'); + throwError$1(state, 'expected hexadecimal character'); } } - state.result += charFromCodepoint$1(hexResult); + state.result += charFromCodepoint(hexResult); state.position++; } else { - throwError$2(state, 'unknown escape sequence'); + throwError$1(state, 'unknown escape sequence'); } captureStart = captureEnd = state.position; - } else if (is_EOL$1(ch)) { - captureSegment$1(state, captureStart, captureEnd, true); - writeFoldedLines$1(state, skipSeparationSpace$1(state, false, nodeIndent)); + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); captureStart = captureEnd = state.position; - } else if (state.position === state.lineStart && testDocumentSeparator$1(state)) { - throwError$2(state, 'unexpected end of the document within a double quoted scalar'); + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError$1(state, 'unexpected end of the document within a double quoted scalar'); } else { state.position++; @@ -2239,12 +10406,14 @@ function readDoubleQuotedScalar$1(state, nodeIndent) { } } - throwError$2(state, 'unexpected end of the stream within a double quoted scalar'); + throwError$1(state, 'unexpected end of the stream within a double quoted scalar'); } -function readFlowCollection$1(state, nodeIndent) { +function readFlowCollection(state, nodeIndent) { var readNext = true, _line, + _lineStart, + _pos, _tag = state.tag, _result, _anchor = state.anchor, @@ -2253,7 +10422,7 @@ function readFlowCollection$1(state, nodeIndent) { isPair, isExplicitPair, isMapping, - overridableKeys = {}, + overridableKeys = Object.create(null), keyNode, keyTag, valueNode, @@ -2280,7 +10449,7 @@ function readFlowCollection$1(state, nodeIndent) { ch = state.input.charCodeAt(++state.position); while (ch !== 0) { - skipSeparationSpace$1(state, true, nodeIndent); + skipSeparationSpace(state, true, nodeIndent); ch = state.input.charCodeAt(state.position); @@ -2292,7 +10461,10 @@ function readFlowCollection$1(state, nodeIndent) { state.result = _result; return true; } else if (!readNext) { - throwError$2(state, 'missed comma between flow collection entries'); + throwError$1(state, 'missed comma between flow collection entries'); + } else if (ch === 0x2C/* , */) { + // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 + throwError$1(state, "expected the node content, but found ','"); } keyTag = keyNode = valueNode = null; @@ -2301,38 +10473,40 @@ function readFlowCollection$1(state, nodeIndent) { if (ch === 0x3F/* ? */) { following = state.input.charCodeAt(state.position + 1); - if (is_WS_OR_EOL$1(following)) { + if (is_WS_OR_EOL(following)) { isPair = isExplicitPair = true; state.position++; - skipSeparationSpace$1(state, true, nodeIndent); + skipSeparationSpace(state, true, nodeIndent); } } - _line = state.line; - composeNode$1(state, nodeIndent, CONTEXT_FLOW_IN$1, false, true); + _line = state.line; // Save the current line. + _lineStart = state.lineStart; + _pos = state.position; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); keyTag = state.tag; keyNode = state.result; - skipSeparationSpace$1(state, true, nodeIndent); + skipSeparationSpace(state, true, nodeIndent); ch = state.input.charCodeAt(state.position); if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { isPair = true; ch = state.input.charCodeAt(++state.position); - skipSeparationSpace$1(state, true, nodeIndent); - composeNode$1(state, nodeIndent, CONTEXT_FLOW_IN$1, false, true); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); valueNode = state.result; } if (isMapping) { - storeMappingPair$1(state, _result, overridableKeys, keyTag, keyNode, valueNode); + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); } else if (isPair) { - _result.push(storeMappingPair$1(state, null, overridableKeys, keyTag, keyNode, valueNode)); + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); } else { _result.push(keyNode); } - skipSeparationSpace$1(state, true, nodeIndent); + skipSeparationSpace(state, true, nodeIndent); ch = state.input.charCodeAt(state.position); @@ -2344,13 +10518,13 @@ function readFlowCollection$1(state, nodeIndent) { } } - throwError$2(state, 'unexpected end of the stream within a flow collection'); + throwError$1(state, 'unexpected end of the stream within a flow collection'); } -function readBlockScalar$1(state, nodeIndent) { +function readBlockScalar(state, nodeIndent) { var captureStart, folding, - chomping = CHOMPING_CLIP$1, + chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, @@ -2376,20 +10550,20 @@ function readBlockScalar$1(state, nodeIndent) { ch = state.input.charCodeAt(++state.position); if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP$1 === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP$1 : CHOMPING_STRIP$1; + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; } else { - throwError$2(state, 'repeat of a chomping mode identifier'); + throwError$1(state, 'repeat of a chomping mode identifier'); } - } else if ((tmp = fromDecimalCode$1(ch)) >= 0) { + } else if ((tmp = fromDecimalCode(ch)) >= 0) { if (tmp === 0) { - throwError$2(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + throwError$1(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); } else if (!detectedIndent) { textIndent = nodeIndent + tmp - 1; detectedIndent = true; } else { - throwError$2(state, 'repeat of an indentation width identifier'); + throwError$1(state, 'repeat of an indentation width identifier'); } } else { @@ -2397,18 +10571,18 @@ function readBlockScalar$1(state, nodeIndent) { } } - if (is_WHITE_SPACE$1(ch)) { + if (is_WHITE_SPACE(ch)) { do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE$1(ch)); + while (is_WHITE_SPACE(ch)); if (ch === 0x23/* # */) { do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL$1(ch) && (ch !== 0)); + while (!is_EOL(ch) && (ch !== 0)); } } while (ch !== 0) { - readLineBreak$1(state); + readLineBreak(state); state.lineIndent = 0; ch = state.input.charCodeAt(state.position); @@ -2423,7 +10597,7 @@ function readBlockScalar$1(state, nodeIndent) { textIndent = state.lineIndent; } - if (is_EOL$1(ch)) { + if (is_EOL(ch)) { emptyLines++; continue; } @@ -2432,9 +10606,9 @@ function readBlockScalar$1(state, nodeIndent) { if (state.lineIndent < textIndent) { // Perform the chomping. - if (chomping === CHOMPING_KEEP$1) { - state.result += common$6.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP$1) { + if (chomping === CHOMPING_KEEP) { + state.result += common$4.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { if (didReadContent) { // i.e. only if the scalar is not empty. state.result += '\n'; } @@ -2448,15 +10622,15 @@ function readBlockScalar$1(state, nodeIndent) { if (folding) { // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE$1(ch)) { + if (is_WHITE_SPACE(ch)) { atMoreIndented = true; // except for the first content line (cf. Example 8.1) - state.result += common$6.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + state.result += common$4.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); // End of more-indented block. } else if (atMoreIndented) { atMoreIndented = false; - state.result += common$6.repeat('\n', emptyLines + 1); + state.result += common$4.repeat('\n', emptyLines + 1); // Just one line break - perceive as the same line. } else if (emptyLines === 0) { @@ -2466,13 +10640,13 @@ function readBlockScalar$1(state, nodeIndent) { // Several line breaks - perceive as different lines. } else { - state.result += common$6.repeat('\n', emptyLines); + state.result += common$4.repeat('\n', emptyLines); } // Literal style: just add exact number of line breaks between content lines. } else { // Keep all line breaks except the header line break. - state.result += common$6.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + state.result += common$4.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); } didReadContent = true; @@ -2480,17 +10654,17 @@ function readBlockScalar$1(state, nodeIndent) { emptyLines = 0; captureStart = state.position; - while (!is_EOL$1(ch) && (ch !== 0)) { + while (!is_EOL(ch) && (ch !== 0)) { ch = state.input.charCodeAt(++state.position); } - captureSegment$1(state, captureStart, state.position, false); + captureSegment(state, captureStart, state.position, false); } return true; } -function readBlockSequence$1(state, nodeIndent) { +function readBlockSequence(state, nodeIndent) { var _line, _tag = state.tag, _anchor = state.anchor, @@ -2499,6 +10673,10 @@ function readBlockSequence$1(state, nodeIndent) { detected = false, ch; + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + if (state.anchor !== null) { state.anchorMap[state.anchor] = _result; } @@ -2506,6 +10684,10 @@ function readBlockSequence$1(state, nodeIndent) { ch = state.input.charCodeAt(state.position); while (ch !== 0) { + if (state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError$1(state, 'tab characters must not be used in indentation'); + } if (ch !== 0x2D/* - */) { break; @@ -2513,14 +10695,14 @@ function readBlockSequence$1(state, nodeIndent) { following = state.input.charCodeAt(state.position + 1); - if (!is_WS_OR_EOL$1(following)) { + if (!is_WS_OR_EOL(following)) { break; } detected = true; state.position++; - if (skipSeparationSpace$1(state, true, -1)) { + if (skipSeparationSpace(state, true, -1)) { if (state.lineIndent <= nodeIndent) { _result.push(null); ch = state.input.charCodeAt(state.position); @@ -2529,14 +10711,14 @@ function readBlockSequence$1(state, nodeIndent) { } _line = state.line; - composeNode$1(state, nodeIndent, CONTEXT_BLOCK_IN$1, false, true); + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); _result.push(state.result); - skipSeparationSpace$1(state, true, -1); + skipSeparationSpace(state, true, -1); ch = state.input.charCodeAt(state.position); if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError$2(state, 'bad indentation of a sequence entry'); + throwError$1(state, 'bad indentation of a sequence entry'); } else if (state.lineIndent < nodeIndent) { break; } @@ -2552,15 +10734,17 @@ function readBlockSequence$1(state, nodeIndent) { return false; } -function readBlockMapping$1(state, nodeIndent, flowIndent) { +function readBlockMapping(state, nodeIndent, flowIndent) { var following, allowCompact, _line, - _pos, + _keyLine, + _keyLineStart, + _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, - overridableKeys = {}, + overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, @@ -2568,6 +10752,10 @@ function readBlockMapping$1(state, nodeIndent, flowIndent) { detected = false, ch; + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + if (state.anchor !== null) { state.anchorMap[state.anchor] = _result; } @@ -2575,19 +10763,23 @@ function readBlockMapping$1(state, nodeIndent, flowIndent) { ch = state.input.charCodeAt(state.position); while (ch !== 0) { + if (!atExplicitKey && state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError$1(state, 'tab characters must not be used in indentation'); + } + following = state.input.charCodeAt(state.position + 1); _line = state.line; // Save the current line. - _pos = state.position; // // Explicit notation case. There are two separate blocks: // first for the key (denoted by "?") and second for the value (denoted by ":") // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL$1(following)) { + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { if (ch === 0x3F/* ? */) { if (atExplicitKey) { - storeMappingPair$1(state, _result, overridableKeys, keyTag, keyNode, null); + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); keyTag = keyNode = valueNode = null; } @@ -2601,7 +10793,7 @@ function readBlockMapping$1(state, nodeIndent, flowIndent) { allowCompact = true; } else { - throwError$2(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + throwError$1(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); } state.position += 1; @@ -2610,24 +10802,33 @@ function readBlockMapping$1(state, nodeIndent, flowIndent) { // // Implicit notation case. Flow-style node as the key first, then ":", and the value. // - } else if (composeNode$1(state, flowIndent, CONTEXT_FLOW_OUT$1, false, true)) { + } else { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + + if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Neither implicit nor explicit notation. + // Reading is done. Go to the epilogue. + break; + } if (state.line === _line) { ch = state.input.charCodeAt(state.position); - while (is_WHITE_SPACE$1(ch)) { + while (is_WHITE_SPACE(ch)) { ch = state.input.charCodeAt(++state.position); } if (ch === 0x3A/* : */) { ch = state.input.charCodeAt(++state.position); - if (!is_WS_OR_EOL$1(ch)) { - throwError$2(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + if (!is_WS_OR_EOL(ch)) { + throwError$1(state, 'a whitespace character is expected after the key-value separator within a block mapping'); } if (atExplicitKey) { - storeMappingPair$1(state, _result, overridableKeys, keyTag, keyNode, null); + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); keyTag = keyNode = valueNode = null; } @@ -2638,7 +10839,7 @@ function readBlockMapping$1(state, nodeIndent, flowIndent) { keyNode = state.result; } else if (detected) { - throwError$2(state, 'can not read an implicit mapping pair; a colon is missed'); + throwError$1(state, 'can not read an implicit mapping pair; a colon is missed'); } else { state.tag = _tag; @@ -2647,23 +10848,26 @@ function readBlockMapping$1(state, nodeIndent, flowIndent) { } } else if (detected) { - throwError$2(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + throwError$1(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); } else { state.tag = _tag; state.anchor = _anchor; return true; // Keep the result of `composeNode`. } - - } else { - break; // Reading is done. Go to the epilogue. } // // Common reading code for both explicit and implicit notations. // if (state.line === _line || state.lineIndent > nodeIndent) { - if (composeNode$1(state, nodeIndent, CONTEXT_BLOCK_OUT$1, true, allowCompact)) { + if (atExplicitKey) { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + } + + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { if (atExplicitKey) { keyNode = state.result; } else { @@ -2672,16 +10876,16 @@ function readBlockMapping$1(state, nodeIndent, flowIndent) { } if (!atExplicitKey) { - storeMappingPair$1(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); keyTag = keyNode = valueNode = null; } - skipSeparationSpace$1(state, true, -1); + skipSeparationSpace(state, true, -1); ch = state.input.charCodeAt(state.position); } - if (state.lineIndent > nodeIndent && (ch !== 0)) { - throwError$2(state, 'bad indentation of a mapping entry'); + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError$1(state, 'bad indentation of a mapping entry'); } else if (state.lineIndent < nodeIndent) { break; } @@ -2693,7 +10897,7 @@ function readBlockMapping$1(state, nodeIndent, flowIndent) { // Special case: last mapping's node contains only the key in explicit notation. if (atExplicitKey) { - storeMappingPair$1(state, _result, overridableKeys, keyTag, keyNode, null); + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); } // Expose the resulting mapping. @@ -2707,7 +10911,7 @@ function readBlockMapping$1(state, nodeIndent, flowIndent) { return detected; } -function readTagProperty$1(state) { +function readTagProperty(state) { var _position, isVerbatim = false, isNamed = false, @@ -2720,7 +10924,7 @@ function readTagProperty$1(state) { if (ch !== 0x21/* ! */) return false; if (state.tag !== null) { - throwError$2(state, 'duplication of a tag property'); + throwError$1(state, 'duplication of a tag property'); } ch = state.input.charCodeAt(++state.position); @@ -2748,23 +10952,23 @@ function readTagProperty$1(state) { tagName = state.input.slice(_position, state.position); ch = state.input.charCodeAt(++state.position); } else { - throwError$2(state, 'unexpected end of the stream within a verbatim tag'); + throwError$1(state, 'unexpected end of the stream within a verbatim tag'); } } else { - while (ch !== 0 && !is_WS_OR_EOL$1(ch)) { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { if (ch === 0x21/* ! */) { if (!isNamed) { tagHandle = state.input.slice(_position - 1, state.position + 1); - if (!PATTERN_TAG_HANDLE$1.test(tagHandle)) { - throwError$2(state, 'named tag handle cannot contain such characters'); + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError$1(state, 'named tag handle cannot contain such characters'); } isNamed = true; _position = state.position + 1; } else { - throwError$2(state, 'tag suffix cannot contain exclamation marks'); + throwError$1(state, 'tag suffix cannot contain exclamation marks'); } } @@ -2773,19 +10977,25 @@ function readTagProperty$1(state) { tagName = state.input.slice(_position, state.position); - if (PATTERN_FLOW_INDICATORS$1.test(tagName)) { - throwError$2(state, 'tag suffix cannot contain flow indicator characters'); + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError$1(state, 'tag suffix cannot contain flow indicator characters'); } } - if (tagName && !PATTERN_TAG_URI$1.test(tagName)) { - throwError$2(state, 'tag name cannot contain such characters: ' + tagName); + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError$1(state, 'tag name cannot contain such characters: ' + tagName); + } + + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError$1(state, 'tag name is malformed: ' + tagName); } if (isVerbatim) { state.tag = tagName; - } else if (_hasOwnProperty$5.call(state.tagMap, tagHandle)) { + } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) { state.tag = state.tagMap[tagHandle] + tagName; } else if (tagHandle === '!') { @@ -2795,13 +11005,13 @@ function readTagProperty$1(state) { state.tag = 'tag:yaml.org,2002:' + tagName; } else { - throwError$2(state, 'undeclared tag handle "' + tagHandle + '"'); + throwError$1(state, 'undeclared tag handle "' + tagHandle + '"'); } return true; } -function readAnchorProperty$1(state) { +function readAnchorProperty(state) { var _position, ch; @@ -2810,25 +11020,25 @@ function readAnchorProperty$1(state) { if (ch !== 0x26/* & */) return false; if (state.anchor !== null) { - throwError$2(state, 'duplication of an anchor property'); + throwError$1(state, 'duplication of an anchor property'); } ch = state.input.charCodeAt(++state.position); _position = state.position; - while (ch !== 0 && !is_WS_OR_EOL$1(ch) && !is_FLOW_INDICATOR$1(ch)) { + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state.input.charCodeAt(++state.position); } if (state.position === _position) { - throwError$2(state, 'name of an anchor node must contain at least one character'); + throwError$1(state, 'name of an anchor node must contain at least one character'); } state.anchor = state.input.slice(_position, state.position); return true; } -function readAlias$1(state) { +function readAlias(state) { var _position, alias, ch; @@ -2839,26 +11049,26 @@ function readAlias$1(state) { ch = state.input.charCodeAt(++state.position); _position = state.position; - while (ch !== 0 && !is_WS_OR_EOL$1(ch) && !is_FLOW_INDICATOR$1(ch)) { + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state.input.charCodeAt(++state.position); } if (state.position === _position) { - throwError$2(state, 'name of an alias node must contain at least one character'); + throwError$1(state, 'name of an alias node must contain at least one character'); } alias = state.input.slice(_position, state.position); - if (!_hasOwnProperty$5.call(state.anchorMap, alias)) { - throwError$2(state, 'unidentified alias "' + alias + '"'); + if (!_hasOwnProperty$1.call(state.anchorMap, alias)) { + throwError$1(state, 'unidentified alias "' + alias + '"'); } state.result = state.anchorMap[alias]; - skipSeparationSpace$1(state, true, -1); + skipSeparationSpace(state, true, -1); return true; } -function composeNode$1(state, parentIndent, nodeContext, allowToSeek, allowCompact) { +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { var allowBlockStyles, allowBlockScalars, allowBlockCollections, @@ -2867,6 +11077,7 @@ function composeNode$1(state, parentIndent, nodeContext, allowToSeek, allowCompa hasContent = false, typeIndex, typeQuantity, + typeList, type, flowIndent, blockIndent; @@ -2881,11 +11092,11 @@ function composeNode$1(state, parentIndent, nodeContext, allowToSeek, allowCompa state.result = null; allowBlockStyles = allowBlockScalars = allowBlockCollections = - CONTEXT_BLOCK_OUT$1 === nodeContext || - CONTEXT_BLOCK_IN$1 === nodeContext; + CONTEXT_BLOCK_OUT === nodeContext || + CONTEXT_BLOCK_IN === nodeContext; if (allowToSeek) { - if (skipSeparationSpace$1(state, true, -1)) { + if (skipSeparationSpace(state, true, -1)) { atNewLine = true; if (state.lineIndent > parentIndent) { @@ -2899,8 +11110,8 @@ function composeNode$1(state, parentIndent, nodeContext, allowToSeek, allowCompa } if (indentStatus === 1) { - while (readTagProperty$1(state) || readAnchorProperty$1(state)) { - if (skipSeparationSpace$1(state, true, -1)) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { atNewLine = true; allowBlockCollections = allowBlockStyles; @@ -2921,8 +11132,8 @@ function composeNode$1(state, parentIndent, nodeContext, allowToSeek, allowCompa allowBlockCollections = atNewLine || allowCompact; } - if (indentStatus === 1 || CONTEXT_BLOCK_OUT$1 === nodeContext) { - if (CONTEXT_FLOW_IN$1 === nodeContext || CONTEXT_FLOW_OUT$1 === nodeContext) { + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { flowIndent = parentIndent; } else { flowIndent = parentIndent + 1; @@ -2932,24 +11143,24 @@ function composeNode$1(state, parentIndent, nodeContext, allowToSeek, allowCompa if (indentStatus === 1) { if (allowBlockCollections && - (readBlockSequence$1(state, blockIndent) || - readBlockMapping$1(state, blockIndent, flowIndent)) || - readFlowCollection$1(state, flowIndent)) { + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { hasContent = true; } else { - if ((allowBlockScalars && readBlockScalar$1(state, flowIndent)) || - readSingleQuotedScalar$1(state, flowIndent) || - readDoubleQuotedScalar$1(state, flowIndent)) { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { hasContent = true; - } else if (readAlias$1(state)) { + } else if (readAlias(state)) { hasContent = true; if (state.tag !== null || state.anchor !== null) { - throwError$2(state, 'alias node should not have any properties'); + throwError$1(state, 'alias node should not have any properties'); } - } else if (readPlainScalar$1(state, flowIndent, CONTEXT_FLOW_IN$1 === nodeContext)) { + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { hasContent = true; if (state.tag === null) { @@ -2964,51 +11175,69 @@ function composeNode$1(state, parentIndent, nodeContext, allowToSeek, allowCompa } else if (indentStatus === 0) { // Special case: block sequences are allowed to have same indentation level as the parent. // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence$1(state, blockIndent); + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); } } - if (state.tag !== null && state.tag !== '!') { - if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "!<?> [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError$2(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"'); - } - - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; + if (state.tag === null) { + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (_hasOwnProperty$5.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "!<?> [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError$1(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"'); + } - if (state.result !== null && type.kind !== state.kind) { - throwError$2(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; - if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched - throwError$2(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched state.result = type.construct(state.result); + state.tag = type.tag; if (state.anchor !== null) { state.anchorMap[state.anchor] = state.result; } + break; + } + } + } else if (state.tag !== '!') { + if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else { + // looking for multi type + type = null; + typeList = state.typeMap.multi[state.kind || 'fallback']; + + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type = typeList[typeIndex]; + break; + } } + } + + if (!type) { + throwError$1(state, 'unknown tag !<' + state.tag + '>'); + } + + if (state.result !== null && type.kind !== state.kind) { + throwError$1(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched + throwError$1(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); } else { - throwError$2(state, 'unknown tag !<' + state.tag + '>'); + state.result = type.construct(state.result, state.tag); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } } } @@ -3018,7 +11247,7 @@ function composeNode$1(state, parentIndent, nodeContext, allowToSeek, allowCompa return state.tag !== null || state.anchor !== null || hasContent; } -function readDocument$1(state) { +function readDocument(state) { var documentStart = state.position, _position, directiveName, @@ -3028,11 +11257,11 @@ function readDocument$1(state) { state.version = null; state.checkLineBreaks = state.legacy; - state.tagMap = {}; - state.anchorMap = {}; + state.tagMap = Object.create(null); + state.anchorMap = Object.create(null); while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace$1(state, true, -1); + skipSeparationSpace(state, true, -1); ch = state.input.charCodeAt(state.position); @@ -3044,7 +11273,7 @@ function readDocument$1(state) { ch = state.input.charCodeAt(++state.position); _position = state.position; - while (ch !== 0 && !is_WS_OR_EOL$1(ch)) { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { ch = state.input.charCodeAt(++state.position); } @@ -3052,81 +11281,81 @@ function readDocument$1(state) { directiveArgs = []; if (directiveName.length < 1) { - throwError$2(state, 'directive name must not be less than one character in length'); + throwError$1(state, 'directive name must not be less than one character in length'); } while (ch !== 0) { - while (is_WHITE_SPACE$1(ch)) { + while (is_WHITE_SPACE(ch)) { ch = state.input.charCodeAt(++state.position); } if (ch === 0x23/* # */) { do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL$1(ch)); + while (ch !== 0 && !is_EOL(ch)); break; } - if (is_EOL$1(ch)) break; + if (is_EOL(ch)) break; _position = state.position; - while (ch !== 0 && !is_WS_OR_EOL$1(ch)) { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { ch = state.input.charCodeAt(++state.position); } directiveArgs.push(state.input.slice(_position, state.position)); } - if (ch !== 0) readLineBreak$1(state); + if (ch !== 0) readLineBreak(state); - if (_hasOwnProperty$5.call(directiveHandlers$1, directiveName)) { - directiveHandlers$1[directiveName](state, directiveName, directiveArgs); + if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); } else { - throwWarning$1(state, 'unknown document directive "' + directiveName + '"'); + throwWarning(state, 'unknown document directive "' + directiveName + '"'); } } - skipSeparationSpace$1(state, true, -1); + skipSeparationSpace(state, true, -1); if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 0x2D/* - */ && state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { state.position += 3; - skipSeparationSpace$1(state, true, -1); + skipSeparationSpace(state, true, -1); } else if (hasDirectives) { - throwError$2(state, 'directives end mark is expected'); + throwError$1(state, 'directives end mark is expected'); } - composeNode$1(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT$1, false, true); - skipSeparationSpace$1(state, true, -1); + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS$1.test(state.input.slice(documentStart, state.position))) { - throwWarning$1(state, 'non-ASCII line breaks are interpreted as content'); + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); } state.documents.push(state.result); - if (state.position === state.lineStart && testDocumentSeparator$1(state)) { + if (state.position === state.lineStart && testDocumentSeparator(state)) { if (state.input.charCodeAt(state.position) === 0x2E/* . */) { state.position += 3; - skipSeparationSpace$1(state, true, -1); + skipSeparationSpace(state, true, -1); } return; } if (state.position < (state.length - 1)) { - throwError$2(state, 'end of the stream or a document separator is expected'); + throwError$1(state, 'end of the stream or a document separator is expected'); } else { return; } } -function loadDocuments$1(input, options) { +function loadDocuments(input, options) { input = String(input); options = options || {}; @@ -3144,13 +11373,13 @@ function loadDocuments$1(input, options) { } } - var state = new State$3(input, options); + var state = new State$1(input, options); var nullpos = input.indexOf('\0'); if (nullpos !== -1) { state.position = nullpos; - throwError$2(state, 'null byte is not allowed in input'); + throwError$1(state, 'null byte is not allowed in input'); } // Use 0 as string terminator. That significantly simplifies bounds check. @@ -3162,20 +11391,20 @@ function loadDocuments$1(input, options) { } while (state.position < (state.length - 1)) { - readDocument$1(state); + readDocument(state); } return state.documents; } -function loadAll$2(input, iterator, options) { +function loadAll$1(input, iterator, options) { if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { options = iterator; iterator = null; } - var documents = loadDocuments$1(input, options); + var documents = loadDocuments(input, options); if (typeof iterator !== 'function') { return documents; @@ -3187,8 +11416,8 @@ function loadAll$2(input, iterator, options) { } -function load$5(input, options) { - var documents = loadDocuments$1(input, options); +function load$1(input, options) { + var documents = loadDocuments(input, options); if (documents.length === 0) { /*eslint-disable no-undefined*/ @@ -3196,91 +11425,79 @@ function load$5(input, options) { } else if (documents.length === 1) { return documents[0]; } - throw new YAMLException$3('expected a single document in the stream, but found more'); + throw new exception('expected a single document in the stream, but found more'); } -function safeLoadAll$1(input, iterator, options) { - if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { - options = iterator; - iterator = null; - } +var loadAll_1 = loadAll$1; +var load_1 = load$1; - return loadAll$2(input, iterator, common$6.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options)); -} +var loader = { + loadAll: loadAll_1, + load: load_1 +}; +/*eslint-disable no-use-before-define*/ -function safeLoad$1(input, options) { - return load$5(input, common$6.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options)); -} -loader$2.loadAll = loadAll$2; -loader$2.load = load$5; -loader$2.safeLoadAll = safeLoadAll$1; -loader$2.safeLoad = safeLoad$1; -var dumper$2 = {}; -/*eslint-disable no-use-before-define*/ +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +var CHAR_BOM = 0xFEFF; +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_EQUALS = 0x3D; /* = */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; -var common$5 = common$b; -var YAMLException$2 = exception$1; -var DEFAULT_FULL_SCHEMA = default_full; -var DEFAULT_SAFE_SCHEMA = default_safe; - -var _toString$3 = Object.prototype.toString; -var _hasOwnProperty$4 = Object.prototype.hasOwnProperty; - -var CHAR_TAB$1 = 0x09; /* Tab */ -var CHAR_LINE_FEED$1 = 0x0A; /* LF */ -var CHAR_CARRIAGE_RETURN$1 = 0x0D; /* CR */ -var CHAR_SPACE$1 = 0x20; /* Space */ -var CHAR_EXCLAMATION$1 = 0x21; /* ! */ -var CHAR_DOUBLE_QUOTE$2 = 0x22; /* " */ -var CHAR_SHARP$1 = 0x23; /* # */ -var CHAR_PERCENT$1 = 0x25; /* % */ -var CHAR_AMPERSAND$1 = 0x26; /* & */ -var CHAR_SINGLE_QUOTE$2 = 0x27; /* ' */ -var CHAR_ASTERISK$2 = 0x2A; /* * */ -var CHAR_COMMA$3 = 0x2C; /* , */ -var CHAR_MINUS$1 = 0x2D; /* - */ -var CHAR_COLON$1 = 0x3A; /* : */ -var CHAR_EQUALS$1 = 0x3D; /* = */ -var CHAR_GREATER_THAN$1 = 0x3E; /* > */ -var CHAR_QUESTION$1 = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT$1 = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET$3 = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET$3 = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT$1 = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET$1 = 0x7B; /* { */ -var CHAR_VERTICAL_LINE$1 = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET$1 = 0x7D; /* } */ - -var ESCAPE_SEQUENCES$1 = {}; - -ESCAPE_SEQUENCES$1[0x00] = '\\0'; -ESCAPE_SEQUENCES$1[0x07] = '\\a'; -ESCAPE_SEQUENCES$1[0x08] = '\\b'; -ESCAPE_SEQUENCES$1[0x09] = '\\t'; -ESCAPE_SEQUENCES$1[0x0A] = '\\n'; -ESCAPE_SEQUENCES$1[0x0B] = '\\v'; -ESCAPE_SEQUENCES$1[0x0C] = '\\f'; -ESCAPE_SEQUENCES$1[0x0D] = '\\r'; -ESCAPE_SEQUENCES$1[0x1B] = '\\e'; -ESCAPE_SEQUENCES$1[0x22] = '\\"'; -ESCAPE_SEQUENCES$1[0x5C] = '\\\\'; -ESCAPE_SEQUENCES$1[0x85] = '\\N'; -ESCAPE_SEQUENCES$1[0xA0] = '\\_'; -ESCAPE_SEQUENCES$1[0x2028] = '\\L'; -ESCAPE_SEQUENCES$1[0x2029] = '\\P'; - -var DEPRECATED_BOOLEANS_SYNTAX$1 = [ +var DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' ]; -function compileStyleMap$1(schema, map) { +var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; + +function compileStyleMap(schema, map) { var result, keys, index, length, tag, style, type; if (map === null) return {}; @@ -3297,7 +11514,7 @@ function compileStyleMap$1(schema, map) { } type = schema.compiledTypeMap['fallback'][tag]; - if (type && _hasOwnProperty$4.call(type.styleAliases, style)) { + if (type && _hasOwnProperty.call(type.styleAliases, style)) { style = type.styleAliases[style]; } @@ -3307,7 +11524,7 @@ function compileStyleMap$1(schema, map) { return result; } -function encodeHex$1(character) { +function encodeHex(character) { var string, handle, length; string = character.toString(16).toUpperCase(); @@ -3322,24 +11539,31 @@ function encodeHex$1(character) { handle = 'U'; length = 8; } else { - throw new YAMLException$2('code point within a string may not be greater than 0xFFFFFFFF'); + throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); } - return '\\' + handle + common$5.repeat('0', length - string.length) + string; + return '\\' + handle + common$4.repeat('0', length - string.length) + string; } -function State$2(options) { - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + +var QUOTING_TYPE_SINGLE = 1, + QUOTING_TYPE_DOUBLE = 2; + +function State(options) { + this.schema = options['schema'] || _default$1; this.indent = Math.max(1, (options['indent'] || 2)); this.noArrayIndent = options['noArrayIndent'] || false; this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common$5.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap$1(this.schema, options['styles'] || null); + this.flowLevel = (common$4.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); this.sortKeys = options['sortKeys'] || false; this.lineWidth = options['lineWidth'] || 80; this.noRefs = options['noRefs'] || false; this.noCompatMode = options['noCompatMode'] || false; this.condenseFlow = options['condenseFlow'] || false; + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options['forceQuotes'] || false; + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; this.implicitTypes = this.schema.compiledImplicit; this.explicitTypes = this.schema.compiledExplicit; @@ -3352,8 +11576,8 @@ function State$2(options) { } // Indents every line in a string. Empty lines (\n only) are not indented. -function indentString$1(string, spaces) { - var ind = common$5.repeat(' ', spaces), +function indentString(string, spaces) { + var ind = common$4.repeat(' ', spaces), position = 0, next = -1, result = '', @@ -3378,11 +11602,11 @@ function indentString$1(string, spaces) { return result; } -function generateNextLine$1(state, level) { - return '\n' + common$5.repeat(' ', state.indent * level); +function generateNextLine(state, level) { + return '\n' + common$4.repeat(' ', state.indent * level); } -function testImplicitResolving$1(state, str) { +function testImplicitResolving(state, str) { var index, length, type; for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { @@ -3397,96 +11621,128 @@ function testImplicitResolving$1(state, str) { } // [33] s-white ::= s-space | s-tab -function isWhitespace$1(c) { - return c === CHAR_SPACE$1 || c === CHAR_TAB$1; +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; } // Returns true if the character can be printed without escaping. // From YAML 1.2: "any allowed characters known to be non-printable // should also be escaped. [However,] This isn’t mandatory" // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable$1(c) { +function isPrintable(c) { return (0x00020 <= c && c <= 0x00007E) || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) || (0x10000 <= c && c <= 0x10FFFF); } // [34] ns-char ::= nb-char - s-white // [27] nb-char ::= c-printable - b-char - c-byte-order-mark // [26] b-char ::= b-line-feed | b-carriage-return -// [24] b-line-feed ::= #xA /* LF */ -// [25] b-carriage-return ::= #xD /* CR */ -// [3] c-byte-order-mark ::= #xFEFF -function isNsChar(c) { - return isPrintable$1(c) && !isWhitespace$1(c) - // byte-order-mark - && c !== 0xFEFF - // b-char - && c !== CHAR_CARRIAGE_RETURN$1 - && c !== CHAR_LINE_FEED$1; -} - -// Simplified test for values allowed after the first character in plain style. -function isPlainSafe$1(c, prev) { - // Uses a subset of nb-char - c-flow-indicator - ":" - "#" - // where nb-char ::= c-printable - b-char - c-byte-order-mark. - return isPrintable$1(c) && c !== 0xFEFF - // - c-flow-indicator - && c !== CHAR_COMMA$3 - && c !== CHAR_LEFT_SQUARE_BRACKET$3 - && c !== CHAR_RIGHT_SQUARE_BRACKET$3 - && c !== CHAR_LEFT_CURLY_BRACKET$1 - && c !== CHAR_RIGHT_CURLY_BRACKET$1 - // - ":" - "#" - // /* An ns-char preceding */ "#" - && c !== CHAR_COLON$1 - && ((c !== CHAR_SHARP$1) || (prev && isNsChar(prev))); +// Including s-white (for some reason, examples doesn't match specs in this aspect) +// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark +function isNsCharOrWhitespace(c) { + return isPrintable(c) + && c !== CHAR_BOM + // - b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out +// c = flow-in ⇒ ns-plain-safe-in +// c = block-key ⇒ ns-plain-safe-out +// c = flow-key ⇒ ns-plain-safe-in +// [128] ns-plain-safe-out ::= ns-char +// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator +// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) +// | ( /* An ns-char preceding */ “#” ) +// | ( “:” /* Followed by an ns-plain-safe(c) */ ) +function isPlainSafe(c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); + return ( + // ns-plain-safe + inblock ? // c = flow-in + cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + ) + // ns-plain-char + && c !== CHAR_SHARP // false on '#' + && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' + || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' + || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' } // Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst$1(c) { +function isPlainSafeFirst(c) { // Uses a subset of ns-char - c-indicator // where ns-char = nb-char - s-white. - return isPrintable$1(c) && c !== 0xFEFF - && !isWhitespace$1(c) // - s-white + // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part + return isPrintable(c) && c !== CHAR_BOM + && !isWhitespace(c) // - s-white // - (c-indicator ::= // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS$1 - && c !== CHAR_QUESTION$1 - && c !== CHAR_COLON$1 - && c !== CHAR_COMMA$3 - && c !== CHAR_LEFT_SQUARE_BRACKET$3 - && c !== CHAR_RIGHT_SQUARE_BRACKET$3 - && c !== CHAR_LEFT_CURLY_BRACKET$1 - && c !== CHAR_RIGHT_CURLY_BRACKET$1 + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” - && c !== CHAR_SHARP$1 - && c !== CHAR_AMPERSAND$1 - && c !== CHAR_ASTERISK$2 - && c !== CHAR_EXCLAMATION$1 - && c !== CHAR_VERTICAL_LINE$1 - && c !== CHAR_EQUALS$1 - && c !== CHAR_GREATER_THAN$1 - && c !== CHAR_SINGLE_QUOTE$2 - && c !== CHAR_DOUBLE_QUOTE$2 + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE // | “%” | “@” | “`”) - && c !== CHAR_PERCENT$1 - && c !== CHAR_COMMERCIAL_AT$1 - && c !== CHAR_GRAVE_ACCENT$1; + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Simplified test for values allowed as the last character in plain style. +function isPlainSafeLast(c) { + // just not whitespace or colon, it will be checked to be plain character later + return !isWhitespace(c) && c !== CHAR_COLON; +} + +// Same as 'string'.codePointAt(pos), but works in older browsers. +function codePointAt(string, pos) { + var first = string.charCodeAt(pos), second; + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { + second = string.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; } // Determines whether block indentation indicator is required. -function needIndentIndicator$1(string) { +function needIndentIndicator(string) { var leadingSpaceRe = /^\n* /; return leadingSpaceRe.test(string); } -var STYLE_PLAIN$1 = 1, - STYLE_SINGLE$1 = 2, - STYLE_LITERAL$1 = 3, - STYLE_FOLDED$1 = 4, - STYLE_DOUBLE$1 = 5; +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; // Determines which scalar styles are possible and returns the preferred style. // lineWidth = -1 => no limit. @@ -3495,32 +11751,35 @@ var STYLE_PLAIN$1 = 1, // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle$1(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, + testAmbiguousType, quotingType, forceQuotes, inblock) { + var i; - var char, prev_char; + var char = 0; + var prevChar = null; var hasLineBreak = false; var hasFoldableLine = false; // only checked if shouldTrackWidth var shouldTrackWidth = lineWidth !== -1; var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst$1(string.charCodeAt(0)) - && !isWhitespace$1(string.charCodeAt(string.length - 1)); + var plain = isPlainSafeFirst(codePointAt(string, 0)) + && isPlainSafeLast(codePointAt(string, string.length - 1)); - if (singleLineOnly) { + if (singleLineOnly || forceQuotes) { // Case: no block styles. // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (!isPrintable$1(char)) { - return STYLE_DOUBLE$1; + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe$1(char, prev_char); + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; } } else { // Case: block styles permitted. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (char === CHAR_LINE_FEED$1) { + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (char === CHAR_LINE_FEED) { hasLineBreak = true; // Check if any line can be folded. if (shouldTrackWidth) { @@ -3530,11 +11789,11 @@ function chooseScalarStyle$1(string, singleLineOnly, indentPerLevel, lineWidth, string[previousLineBreak + 1] !== ' '); previousLineBreak = i; } - } else if (!isPrintable$1(char)) { - return STYLE_DOUBLE$1; + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe$1(char, prev_char); + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; } // in case the end is missing a \n hasFoldableLine = hasFoldableLine || (shouldTrackWidth && @@ -3547,16 +11806,21 @@ function chooseScalarStyle$1(string, singleLineOnly, indentPerLevel, lineWidth, if (!hasLineBreak && !hasFoldableLine) { // Strings interpretable as another type have to be quoted; // e.g. the string 'true' vs. the boolean true. - return plain && !testAmbiguousType(string) - ? STYLE_PLAIN$1 : STYLE_SINGLE$1; + if (plain && !forceQuotes && !testAmbiguousType(string)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; } // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator$1(string)) { - return STYLE_DOUBLE$1; + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; } // At this point we know block styles are valid. // Prefer literal style unless we want to fold. - return hasFoldableLine ? STYLE_FOLDED$1 : STYLE_LITERAL$1; + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; } // Note: line breaking/folding is implemented for only the folded style. @@ -3565,14 +11829,15 @@ function chooseScalarStyle$1(string, singleLineOnly, indentPerLevel, lineWidth, // • No ending newline => unaffected; already using strip "-" chomping. // • Ending newline => removed then restored. // Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar$1(state, string, level, iskey) { +function writeScalar(state, string, level, iskey, inblock) { state.dump = (function () { if (string.length === 0) { - return "''"; + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; } - if (!state.noCompatMode && - DEPRECATED_BOOLEANS_SYNTAX$1.indexOf(string) !== -1) { - return "'" + string + "'"; + if (!state.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + } } var indent = state.indent * Math.max(1, level); // no 0-indent scalars @@ -3591,31 +11856,33 @@ function writeScalar$1(state, string, level, iskey) { // No block styles in flow mode. || (state.flowLevel > -1 && level >= state.flowLevel); function testAmbiguity(string) { - return testImplicitResolving$1(state, string); + return testImplicitResolving(state, string); } - switch (chooseScalarStyle$1(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { - case STYLE_PLAIN$1: + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, + testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { + + case STYLE_PLAIN: return string; - case STYLE_SINGLE$1: + case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'"; - case STYLE_LITERAL$1: - return '|' + blockHeader$1(string, state.indent) - + dropEndingNewline$1(indentString$1(string, indent)); - case STYLE_FOLDED$1: - return '>' + blockHeader$1(string, state.indent) - + dropEndingNewline$1(indentString$1(foldString$1(string, lineWidth), indent)); - case STYLE_DOUBLE$1: - return '"' + escapeString$1(string) + '"'; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string) + '"'; default: - throw new YAMLException$2('impossible error: invalid scalar style'); + throw new exception('impossible error: invalid scalar style'); } }()); } // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader$1(string, indentPerLevel) { - var indentIndicator = needIndentIndicator$1(string) ? String(indentPerLevel) : ''; +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; // note the special case: the string '\n' counts as a "trailing" empty line. var clip = string[string.length - 1] === '\n'; @@ -3626,13 +11893,13 @@ function blockHeader$1(string, indentPerLevel) { } // (See the note for writeScalar.) -function dropEndingNewline$1(string) { +function dropEndingNewline(string) { return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; } // Note: a long line without a suitable break point will exceed the width limit. // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString$1(string, width) { +function foldString(string, width) { // In folded style, $k$ consecutive newlines output as $k+1$ newlines— // unless they're before or after a more-indented line, or at the very // beginning or end, in which case $k$ maps to $k$. @@ -3644,7 +11911,7 @@ function foldString$1(string, width) { var nextLF = string.indexOf('\n'); nextLF = nextLF !== -1 ? nextLF : string.length; lineRe.lastIndex = nextLF; - return foldLine$1(string.slice(0, nextLF), width); + return foldLine(string.slice(0, nextLF), width); }()); // If we haven't reached the first content line yet, don't add an extra \n. var prevMoreIndented = string[0] === '\n' || string[0] === ' '; @@ -3658,7 +11925,7 @@ function foldString$1(string, width) { result += prefix + (!prevMoreIndented && !moreIndented && line !== '' ? '\n' : '') - + foldLine$1(line, width); + + foldLine(line, width); prevMoreIndented = moreIndented; } @@ -3669,7 +11936,7 @@ function foldString$1(string, width) { // Picks the longest line under the limit each time, // otherwise settles for the shortest line over the limit. // NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine$1(line, width) { +function foldLine(line, width) { if (line === '' || line[0] === ' ') return line; // Since a more-indented line adds a \n, breaks can't be followed by a space. @@ -3709,42 +11976,46 @@ function foldLine$1(line, width) { } // Escapes a double-quoted string. -function escapeString$1(string) { +function escapeString(string) { var result = ''; - var char, nextChar; + var char = 0; var escapeSeq; - for (var i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). - if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { - nextChar = string.charCodeAt(i + 1); - if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { - // Combine the surrogate pair and store it escaped. - result += encodeHex$1((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); - // Advance index one extra since we already used that char here. - i++; continue; - } + for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + escapeSeq = ESCAPE_SEQUENCES[char]; + + if (!escapeSeq && isPrintable(char)) { + result += string[i]; + if (char >= 0x10000) result += string[i + 1]; + } else { + result += escapeSeq || encodeHex(char); } - escapeSeq = ESCAPE_SEQUENCES$1[char]; - result += !escapeSeq && isPrintable$1(char) - ? string[i] - : escapeSeq || encodeHex$1(char); } return result; } -function writeFlowSequence$1(state, level, object) { +function writeFlowSequence(state, level, object) { var _result = '', _tag = state.tag, index, - length; + length, + value; for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode$1(state, level, object[index], false, false)) { - if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level, value, false, false) || + (typeof value === 'undefined' && + writeNode(state, level, null, false, false))) { + + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); _result += state.dump; } } @@ -3753,20 +12024,30 @@ function writeFlowSequence$1(state, level, object) { state.dump = '[' + _result + ']'; } -function writeBlockSequence$1(state, level, object, compact) { +function writeBlockSequence(state, level, object, compact) { var _result = '', _tag = state.tag, index, - length; + length, + value; for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode$1(state, level + 1, object[index], true, true)) { - if (!compact || index !== 0) { - _result += generateNextLine$1(state, level); + value = object[index]; + + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level + 1, value, true, true, false, true) || + (typeof value === 'undefined' && + writeNode(state, level + 1, null, true, true, false, true))) { + + if (!compact || _result !== '') { + _result += generateNextLine(state, level); } - if (state.dump && CHAR_LINE_FEED$1 === state.dump.charCodeAt(0)) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { _result += '-'; } else { _result += '- '; @@ -3780,7 +12061,7 @@ function writeBlockSequence$1(state, level, object, compact) { state.dump = _result || '[]'; // Empty sequence if no valid values. } -function writeFlowMapping$1(state, level, object) { +function writeFlowMapping(state, level, object) { var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), @@ -3793,14 +12074,18 @@ function writeFlowMapping$1(state, level, object) { for (index = 0, length = objectKeyList.length; index < length; index += 1) { pairBuffer = ''; - if (index !== 0) pairBuffer += ', '; + if (_result !== '') pairBuffer += ', '; if (state.condenseFlow) pairBuffer += '"'; objectKey = objectKeyList[index]; objectValue = object[objectKey]; - if (!writeNode$1(state, level, objectKey, false, false)) { + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level, objectKey, false, false)) { continue; // Skip this pair because of invalid key; } @@ -3808,7 +12093,7 @@ function writeFlowMapping$1(state, level, object) { pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); - if (!writeNode$1(state, level, objectValue, false, false)) { + if (!writeNode(state, level, objectValue, false, false)) { continue; // Skip this pair because of invalid value. } @@ -3822,7 +12107,7 @@ function writeFlowMapping$1(state, level, object) { state.dump = '{' + _result + '}'; } -function writeBlockMapping$1(state, level, object, compact) { +function writeBlockMapping(state, level, object, compact) { var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), @@ -3842,20 +12127,24 @@ function writeBlockMapping$1(state, level, object, compact) { objectKeyList.sort(state.sortKeys); } else if (state.sortKeys) { // Something is wrong - throw new YAMLException$2('sortKeys must be a boolean or a function'); + throw new exception('sortKeys must be a boolean or a function'); } for (index = 0, length = objectKeyList.length; index < length; index += 1) { pairBuffer = ''; - if (!compact || index !== 0) { - pairBuffer += generateNextLine$1(state, level); + if (!compact || _result !== '') { + pairBuffer += generateNextLine(state, level); } objectKey = objectKeyList[index]; objectValue = object[objectKey]; - if (!writeNode$1(state, level + 1, objectKey, true, true, true)) { + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { continue; // Skip this pair because of invalid key. } @@ -3863,7 +12152,7 @@ function writeBlockMapping$1(state, level, object, compact) { (state.dump && state.dump.length > 1024); if (explicitPair) { - if (state.dump && CHAR_LINE_FEED$1 === state.dump.charCodeAt(0)) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { pairBuffer += '?'; } else { pairBuffer += '? '; @@ -3873,14 +12162,14 @@ function writeBlockMapping$1(state, level, object, compact) { pairBuffer += state.dump; if (explicitPair) { - pairBuffer += generateNextLine$1(state, level); + pairBuffer += generateNextLine(state, level); } - if (!writeNode$1(state, level + 1, objectValue, true, explicitPair)) { + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { continue; // Skip this pair because of invalid value. } - if (state.dump && CHAR_LINE_FEED$1 === state.dump.charCodeAt(0)) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { pairBuffer += ':'; } else { pairBuffer += ': '; @@ -3896,7 +12185,7 @@ function writeBlockMapping$1(state, level, object, compact) { state.dump = _result || '{}'; // Empty mapping if no valid pairs. } -function detectType$1(state, object, explicit) { +function detectType(state, object, explicit) { var _result, typeList, index, length, type, style; typeList = explicit ? state.explicitTypes : state.implicitTypes; @@ -3908,17 +12197,25 @@ function detectType$1(state, object, explicit) { (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && (!type.predicate || type.predicate(object))) { - state.tag = explicit ? type.tag : '?'; + if (explicit) { + if (type.multi && type.representName) { + state.tag = type.representName(object); + } else { + state.tag = type.tag; + } + } else { + state.tag = '?'; + } if (type.represent) { style = state.styleMap[type.tag] || type.defaultStyle; - if (_toString$3.call(type.represent) === '[object Function]') { + if (_toString.call(type.represent) === '[object Function]') { _result = type.represent(object, style); - } else if (_hasOwnProperty$4.call(type.represent, style)) { + } else if (_hasOwnProperty.call(type.represent, style)) { _result = type.represent[style](object, style); } else { - throw new YAMLException$2('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); } state.dump = _result; @@ -3934,15 +12231,17 @@ function detectType$1(state, object, explicit) { // Serializes `object` and writes it to global `result`. // Returns true on success, or false on invalid object. // -function writeNode$1(state, level, object, block, compact, iskey) { +function writeNode(state, level, object, block, compact, iskey, isblockseq) { state.tag = null; state.dump = object; - if (!detectType$1(state, object, false)) { - detectType$1(state, object, true); + if (!detectType(state, object, false)) { + detectType(state, object, true); } - var type = _toString$3.call(state.dump); + var type = _toString.call(state.dump); + var inblock = block; + var tagStr; if (block) { block = (state.flowLevel < 0 || state.flowLevel > level); @@ -3969,53 +12268,83 @@ function writeNode$1(state, level, object, block, compact, iskey) { } if (type === '[object Object]') { if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping$1(state, level, state.dump, compact); + writeBlockMapping(state, level, state.dump, compact); if (duplicate) { state.dump = '&ref_' + duplicateIndex + state.dump; } } else { - writeFlowMapping$1(state, level, state.dump); + writeFlowMapping(state, level, state.dump); if (duplicate) { state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; } } } else if (type === '[object Array]') { - var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; if (block && (state.dump.length !== 0)) { - writeBlockSequence$1(state, arrayLevel, state.dump, compact); + if (state.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state, level - 1, state.dump, compact); + } else { + writeBlockSequence(state, level, state.dump, compact); + } if (duplicate) { state.dump = '&ref_' + duplicateIndex + state.dump; } } else { - writeFlowSequence$1(state, arrayLevel, state.dump); + writeFlowSequence(state, level, state.dump); if (duplicate) { state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; } } } else if (type === '[object String]') { if (state.tag !== '?') { - writeScalar$1(state, state.dump, level, iskey); + writeScalar(state, state.dump, level, iskey, inblock); } + } else if (type === '[object Undefined]') { + return false; } else { if (state.skipInvalid) return false; - throw new YAMLException$2('unacceptable kind of an object to dump ' + type); + throw new exception('unacceptable kind of an object to dump ' + type); } if (state.tag !== null && state.tag !== '?') { - state.dump = '!<' + state.tag + '> ' + state.dump; + // Need to encode all characters except those allowed by the spec: + // + // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ + // [36] ns-hex-digit ::= ns-dec-digit + // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ + // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ + // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” + // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” + // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” + // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” + // + // Also need to encode '!' because it has special meaning (end of tag prefix). + // + tagStr = encodeURI( + state.tag[0] === '!' ? state.tag.slice(1) : state.tag + ).replace(/!/g, '%21'); + + if (state.tag[0] === '!') { + tagStr = '!' + tagStr; + } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { + tagStr = '!!' + tagStr.slice(18); + } else { + tagStr = '!<' + tagStr + '>'; + } + + state.dump = tagStr + ' ' + state.dump; } } return true; } -function getDuplicateReferences$1(object, state) { +function getDuplicateReferences(object, state) { var objects = [], duplicatesIndexes = [], index, length; - inspectNode$1(object, objects, duplicatesIndexes); + inspectNode(object, objects, duplicatesIndexes); for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { state.duplicates.push(objects[duplicatesIndexes[index]]); @@ -4023,7 +12352,7 @@ function getDuplicateReferences$1(object, state) { state.usedDuplicates = new Array(length); } -function inspectNode$1(object, objects, duplicatesIndexes) { +function inspectNode(object, objects, duplicatesIndexes) { var objectKeyList, index, length; @@ -4039,79 +12368,100 @@ function inspectNode$1(object, objects, duplicatesIndexes) { if (Array.isArray(object)) { for (index = 0, length = object.length; index < length; index += 1) { - inspectNode$1(object[index], objects, duplicatesIndexes); + inspectNode(object[index], objects, duplicatesIndexes); } } else { objectKeyList = Object.keys(object); for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode$1(object[objectKeyList[index]], objects, duplicatesIndexes); + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); } } } } } -function dump$2(input, options) { +function dump$1(input, options) { options = options || {}; - var state = new State$2(options); + var state = new State(options); - if (!state.noRefs) getDuplicateReferences$1(input, state); + if (!state.noRefs) getDuplicateReferences(input, state); - if (writeNode$1(state, 0, input, true, true)) return state.dump + '\n'; + var value = input; - return ''; -} + if (state.replacer) { + value = state.replacer.call({ '': value }, '', value); + } -function safeDump$1(input, options) { - return dump$2(input, common$5.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} + if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; -dumper$2.dump = dump$2; -dumper$2.safeDump = safeDump$1; + return ''; +} -var loader$1 = loader$2; -var dumper$1 = dumper$2; +var dump_1 = dump$1; +var dumper = { + dump: dump_1 +}; -function deprecated(name) { +function renamed(from, to) { return function () { - throw new Error('Function ' + name + ' is deprecated and cannot be used.'); + throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + + 'Use yaml.' + to + ' instead, which is now safe by default.'); }; } -jsYaml$2.Type = type$1; -jsYaml$2.Schema = schema$2; -jsYaml$2.FAILSAFE_SCHEMA = failsafe$1; -jsYaml$2.JSON_SCHEMA = json$3; -jsYaml$2.CORE_SCHEMA = core$4; -jsYaml$2.DEFAULT_SAFE_SCHEMA = default_safe; -jsYaml$2.DEFAULT_FULL_SCHEMA = default_full; -jsYaml$2.load = loader$1.load; -jsYaml$2.loadAll = loader$1.loadAll; -jsYaml$2.safeLoad = loader$1.safeLoad; -jsYaml$2.safeLoadAll = loader$1.safeLoadAll; -jsYaml$2.dump = dumper$1.dump; -jsYaml$2.safeDump = dumper$1.safeDump; -jsYaml$2.YAMLException = exception$1; - -// Deprecated schema names from JS-YAML 2.0.x -jsYaml$2.MINIMAL_SCHEMA = failsafe$1; -jsYaml$2.SAFE_SCHEMA = default_safe; -jsYaml$2.DEFAULT_SCHEMA = default_full; - -// Deprecated functions from JS-YAML 1.x.x -jsYaml$2.scan = deprecated('scan'); -jsYaml$2.parse = deprecated('parse'); -jsYaml$2.compose = deprecated('compose'); -jsYaml$2.addConstructor = deprecated('addConstructor'); +var Type = type$1; +var Schema = schema$1; +var FAILSAFE_SCHEMA = failsafe; +var JSON_SCHEMA = json; +var CORE_SCHEMA = core; +var DEFAULT_SCHEMA = _default$1; +var load = loader.load; +var loadAll = loader.loadAll; +var dump = dumper.dump; +var YAMLException = exception; -var yaml$1 = jsYaml$2; +// Re-export all types in case user wants to create custom schema +var types$1 = { + binary: binary, + float: float, + map: map$3, + null: _null, + pairs: pairs, + set: set, + timestamp: timestamp, + bool: bool, + int: int, + merge: merge$1, + omap: omap, + seq: seq, + str: str +}; +// Removed functions from JS-YAML 3.0.x +var safeLoad = renamed('safeLoad', 'load'); +var safeLoadAll = renamed('safeLoadAll', 'loadAll'); +var safeDump = renamed('safeDump', 'dump'); -var jsYaml$1 = yaml$1; +var jsYaml = { + Type: Type, + Schema: Schema, + FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, + JSON_SCHEMA: JSON_SCHEMA, + CORE_SCHEMA: CORE_SCHEMA, + DEFAULT_SCHEMA: DEFAULT_SCHEMA, + load: load, + loadAll: loadAll, + dump: dump, + YAMLException: YAMLException, + types: types$1, + safeLoad: safeLoad, + safeLoadAll: safeLoadAll, + safeDump: safeDump +}; var isArrayish$2 = function isArrayish(obj) { if (!obj) { @@ -4122,7 +12472,7 @@ var isArrayish$2 = function isArrayish(obj) { (obj.length >= 0 && obj.splice instanceof Function); }; -var util$4 = require$$0__default['default']; +var util$2 = require$$0$4; var isArrayish$1 = isArrayish$2; var errorEx$1 = function errorEx(name, properties) { @@ -4226,7 +12576,7 @@ var errorEx$1 = function errorEx(name, properties) { Object.setPrototypeOf(errorExError.prototype, Error.prototype); Object.setPrototypeOf(errorExError, Error); } else { - util$4.inherits(errorExError, Error); + util$2.inherits(errorExError, Error); } return errorExError; @@ -4438,16 +12788,16 @@ var LinesAndColumns$1 = (function () { return LinesAndColumns; }()); -var dist$2 = /*#__PURE__*/Object.freeze({ +var dist = /*#__PURE__*/Object.freeze({ __proto__: null, 'default': LinesAndColumns$1 }); -var require$$2 = /*@__PURE__*/getAugmentedNamespace(dist$2); +var require$$2 = /*@__PURE__*/getAugmentedNamespace(dist); -var lib$9 = {}; +var lib$4 = {}; -var lib$8 = {}; +var lib$3 = {}; var jsTokens = {}; @@ -4475,7 +12825,7 @@ jsTokens.matchToToken = function(match) { return token }; -var lib$7 = {}; +var lib$2 = {}; var identifier = {}; @@ -4658,13 +13008,13 @@ Object.defineProperty(exports, "isKeyword", { var _identifier = identifier; var _keyword = keyword; -}(lib$7)); +}(lib$2)); -var chalk$2 = {exports: {}}; +var chalk = {exports: {}}; var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; -var escapeStringRegexp$3 = function (str) { +var escapeStringRegexp$1 = function (str) { if (typeof str !== 'string') { throw new TypeError('Expected a string'); } @@ -4672,11 +13022,11 @@ var escapeStringRegexp$3 = function (str) { return str.replace(matchOperatorsRe, '\\$&'); }; -var ansiStyles$2 = {exports: {}}; +var ansiStyles = {exports: {}}; -var conversions$5 = {exports: {}}; +var conversions$2 = {exports: {}}; -var colorName$1 = {
+var colorName = {
"aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215],
"aqua": [0, 255, 255],
@@ -4829,20 +13179,20 @@ var colorName$1 = { /* MIT license */ -var cssKeywords$1 = colorName$1; +var cssKeywords = colorName; // NOTE: conversions should only return primitive values (i.e. arrays, or // values that give correct `typeof` results). // do not use box values types (i.e. Number(), String(), etc.) -var reverseKeywords$1 = {}; -for (var key$1 in cssKeywords$1) { - if (cssKeywords$1.hasOwnProperty(key$1)) { - reverseKeywords$1[cssKeywords$1[key$1]] = key$1; +var reverseKeywords = {}; +for (var key$1 in cssKeywords) { + if (cssKeywords.hasOwnProperty(key$1)) { + reverseKeywords[cssKeywords[key$1]] = key$1; } } -var convert$6 = conversions$5.exports = { +var convert$2 = conversions$2.exports = { rgb: {channels: 3, labels: 'rgb'}, hsl: {channels: 3, labels: 'hsl'}, hsv: {channels: 3, labels: 'hsv'}, @@ -4861,30 +13211,30 @@ var convert$6 = conversions$5.exports = { }; // hide .channels and .labels properties -for (var model in convert$6) { - if (convert$6.hasOwnProperty(model)) { - if (!('channels' in convert$6[model])) { +for (var model in convert$2) { + if (convert$2.hasOwnProperty(model)) { + if (!('channels' in convert$2[model])) { throw new Error('missing channels property: ' + model); } - if (!('labels' in convert$6[model])) { + if (!('labels' in convert$2[model])) { throw new Error('missing channel labels property: ' + model); } - if (convert$6[model].labels.length !== convert$6[model].channels) { + if (convert$2[model].labels.length !== convert$2[model].channels) { throw new Error('channel and label counts mismatch: ' + model); } - var channels = convert$6[model].channels; - var labels$1 = convert$6[model].labels; - delete convert$6[model].channels; - delete convert$6[model].labels; - Object.defineProperty(convert$6[model], 'channels', {value: channels}); - Object.defineProperty(convert$6[model], 'labels', {value: labels$1}); + var channels = convert$2[model].channels; + var labels$1 = convert$2[model].labels; + delete convert$2[model].channels; + delete convert$2[model].labels; + Object.defineProperty(convert$2[model], 'channels', {value: channels}); + Object.defineProperty(convert$2[model], 'labels', {value: labels$1}); } } -convert$6.rgb.hsl = function (rgb) { +convert$2.rgb.hsl = function (rgb) { var r = rgb[0] / 255; var g = rgb[1] / 255; var b = rgb[2] / 255; @@ -4924,7 +13274,7 @@ convert$6.rgb.hsl = function (rgb) { return [h, s * 100, l * 100]; }; -convert$6.rgb.hsv = function (rgb) { +convert$2.rgb.hsv = function (rgb) { var rdif; var gdif; var bdif; @@ -4969,11 +13319,11 @@ convert$6.rgb.hsv = function (rgb) { ]; }; -convert$6.rgb.hwb = function (rgb) { +convert$2.rgb.hwb = function (rgb) { var r = rgb[0]; var g = rgb[1]; var b = rgb[2]; - var h = convert$6.rgb.hsl(rgb)[0]; + var h = convert$2.rgb.hsl(rgb)[0]; var w = 1 / 255 * Math.min(r, Math.min(g, b)); b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); @@ -4981,7 +13331,7 @@ convert$6.rgb.hwb = function (rgb) { return [h, w * 100, b * 100]; }; -convert$6.rgb.cmyk = function (rgb) { +convert$2.rgb.cmyk = function (rgb) { var r = rgb[0] / 255; var g = rgb[1] / 255; var b = rgb[2] / 255; @@ -5001,7 +13351,7 @@ convert$6.rgb.cmyk = function (rgb) { /** * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance * */ -function comparativeDistance$1(x, y) { +function comparativeDistance(x, y) { return ( Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + @@ -5009,8 +13359,8 @@ function comparativeDistance$1(x, y) { ); } -convert$6.rgb.keyword = function (rgb) { - var reversed = reverseKeywords$1[rgb]; +convert$2.rgb.keyword = function (rgb) { + var reversed = reverseKeywords[rgb]; if (reversed) { return reversed; } @@ -5018,12 +13368,12 @@ convert$6.rgb.keyword = function (rgb) { var currentClosestDistance = Infinity; var currentClosestKeyword; - for (var keyword in cssKeywords$1) { - if (cssKeywords$1.hasOwnProperty(keyword)) { - var value = cssKeywords$1[keyword]; + for (var keyword in cssKeywords) { + if (cssKeywords.hasOwnProperty(keyword)) { + var value = cssKeywords[keyword]; // Compute comparative distance - var distance = comparativeDistance$1(rgb, value); + var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest if (distance < currentClosestDistance) { @@ -5036,11 +13386,11 @@ convert$6.rgb.keyword = function (rgb) { return currentClosestKeyword; }; -convert$6.keyword.rgb = function (keyword) { - return cssKeywords$1[keyword]; +convert$2.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; }; -convert$6.rgb.xyz = function (rgb) { +convert$2.rgb.xyz = function (rgb) { var r = rgb[0] / 255; var g = rgb[1] / 255; var b = rgb[2] / 255; @@ -5057,8 +13407,8 @@ convert$6.rgb.xyz = function (rgb) { return [x * 100, y * 100, z * 100]; }; -convert$6.rgb.lab = function (rgb) { - var xyz = convert$6.rgb.xyz(rgb); +convert$2.rgb.lab = function (rgb) { + var xyz = convert$2.rgb.xyz(rgb); var x = xyz[0]; var y = xyz[1]; var z = xyz[2]; @@ -5081,7 +13431,7 @@ convert$6.rgb.lab = function (rgb) { return [l, a, b]; }; -convert$6.hsl.rgb = function (hsl) { +convert$2.hsl.rgb = function (hsl) { var h = hsl[0] / 360; var s = hsl[1] / 100; var l = hsl[2] / 100; @@ -5130,7 +13480,7 @@ convert$6.hsl.rgb = function (hsl) { return rgb; }; -convert$6.hsl.hsv = function (hsl) { +convert$2.hsl.hsv = function (hsl) { var h = hsl[0]; var s = hsl[1] / 100; var l = hsl[2] / 100; @@ -5148,7 +13498,7 @@ convert$6.hsl.hsv = function (hsl) { return [h, sv * 100, v * 100]; }; -convert$6.hsv.rgb = function (hsv) { +convert$2.hsv.rgb = function (hsv) { var h = hsv[0] / 60; var s = hsv[1] / 100; var v = hsv[2] / 100; @@ -5176,7 +13526,7 @@ convert$6.hsv.rgb = function (hsv) { } }; -convert$6.hsv.hsl = function (hsv) { +convert$2.hsv.hsl = function (hsv) { var h = hsv[0]; var s = hsv[1] / 100; var v = hsv[2] / 100; @@ -5196,7 +13546,7 @@ convert$6.hsv.hsl = function (hsv) { }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb -convert$6.hwb.rgb = function (hwb) { +convert$2.hwb.rgb = function (hwb) { var h = hwb[0] / 360; var wh = hwb[1] / 100; var bl = hwb[2] / 100; @@ -5239,7 +13589,7 @@ convert$6.hwb.rgb = function (hwb) { return [r * 255, g * 255, b * 255]; }; -convert$6.cmyk.rgb = function (cmyk) { +convert$2.cmyk.rgb = function (cmyk) { var c = cmyk[0] / 100; var m = cmyk[1] / 100; var y = cmyk[2] / 100; @@ -5255,7 +13605,7 @@ convert$6.cmyk.rgb = function (cmyk) { return [r * 255, g * 255, b * 255]; }; -convert$6.xyz.rgb = function (xyz) { +convert$2.xyz.rgb = function (xyz) { var x = xyz[0] / 100; var y = xyz[1] / 100; var z = xyz[2] / 100; @@ -5287,7 +13637,7 @@ convert$6.xyz.rgb = function (xyz) { return [r * 255, g * 255, b * 255]; }; -convert$6.xyz.lab = function (xyz) { +convert$2.xyz.lab = function (xyz) { var x = xyz[0]; var y = xyz[1]; var z = xyz[2]; @@ -5310,7 +13660,7 @@ convert$6.xyz.lab = function (xyz) { return [l, a, b]; }; -convert$6.lab.xyz = function (lab) { +convert$2.lab.xyz = function (lab) { var l = lab[0]; var a = lab[1]; var b = lab[2]; @@ -5336,7 +13686,7 @@ convert$6.lab.xyz = function (lab) { return [x, y, z]; }; -convert$6.lab.lch = function (lab) { +convert$2.lab.lch = function (lab) { var l = lab[0]; var a = lab[1]; var b = lab[2]; @@ -5356,7 +13706,7 @@ convert$6.lab.lch = function (lab) { return [l, c, h]; }; -convert$6.lch.lab = function (lch) { +convert$2.lch.lab = function (lch) { var l = lch[0]; var c = lch[1]; var h = lch[2]; @@ -5371,11 +13721,11 @@ convert$6.lch.lab = function (lch) { return [l, a, b]; }; -convert$6.rgb.ansi16 = function (args) { +convert$2.rgb.ansi16 = function (args) { var r = args[0]; var g = args[1]; var b = args[2]; - var value = 1 in arguments ? arguments[1] : convert$6.rgb.hsv(args)[2]; // hsv -> ansi16 optimization + var value = 1 in arguments ? arguments[1] : convert$2.rgb.hsv(args)[2]; // hsv -> ansi16 optimization value = Math.round(value / 50); @@ -5395,13 +13745,13 @@ convert$6.rgb.ansi16 = function (args) { return ansi; }; -convert$6.hsv.ansi16 = function (args) { +convert$2.hsv.ansi16 = function (args) { // optimization here; we already know the value and don't need to get // it converted for us. - return convert$6.rgb.ansi16(convert$6.hsv.rgb(args), args[2]); + return convert$2.rgb.ansi16(convert$2.hsv.rgb(args), args[2]); }; -convert$6.rgb.ansi256 = function (args) { +convert$2.rgb.ansi256 = function (args) { var r = args[0]; var g = args[1]; var b = args[2]; @@ -5428,7 +13778,7 @@ convert$6.rgb.ansi256 = function (args) { return ansi; }; -convert$6.ansi16.rgb = function (args) { +convert$2.ansi16.rgb = function (args) { var color = args % 10; // handle greyscale @@ -5450,7 +13800,7 @@ convert$6.ansi16.rgb = function (args) { return [r, g, b]; }; -convert$6.ansi256.rgb = function (args) { +convert$2.ansi256.rgb = function (args) { // handle greyscale if (args >= 232) { var c = (args - 232) * 10 + 8; @@ -5467,7 +13817,7 @@ convert$6.ansi256.rgb = function (args) { return [r, g, b]; }; -convert$6.rgb.hex = function (args) { +convert$2.rgb.hex = function (args) { var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF); @@ -5476,7 +13826,7 @@ convert$6.rgb.hex = function (args) { return '000000'.substring(string.length) + string; }; -convert$6.hex.rgb = function (args) { +convert$2.hex.rgb = function (args) { var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); if (!match) { return [0, 0, 0]; @@ -5498,7 +13848,7 @@ convert$6.hex.rgb = function (args) { return [r, g, b]; }; -convert$6.rgb.hcg = function (rgb) { +convert$2.rgb.hcg = function (rgb) { var r = rgb[0] / 255; var g = rgb[1] / 255; var b = rgb[2] / 255; @@ -5532,7 +13882,7 @@ convert$6.rgb.hcg = function (rgb) { return [hue * 360, chroma * 100, grayscale * 100]; }; -convert$6.hsl.hcg = function (hsl) { +convert$2.hsl.hcg = function (hsl) { var s = hsl[1] / 100; var l = hsl[2] / 100; var c = 1; @@ -5551,7 +13901,7 @@ convert$6.hsl.hcg = function (hsl) { return [hsl[0], c * 100, f * 100]; }; -convert$6.hsv.hcg = function (hsv) { +convert$2.hsv.hcg = function (hsv) { var s = hsv[1] / 100; var v = hsv[2] / 100; @@ -5565,7 +13915,7 @@ convert$6.hsv.hcg = function (hsv) { return [hsv[0], c * 100, f * 100]; }; -convert$6.hcg.rgb = function (hcg) { +convert$2.hcg.rgb = function (hcg) { var h = hcg[0] / 360; var c = hcg[1] / 100; var g = hcg[2] / 100; @@ -5604,7 +13954,7 @@ convert$6.hcg.rgb = function (hcg) { ]; }; -convert$6.hcg.hsv = function (hcg) { +convert$2.hcg.hsv = function (hcg) { var c = hcg[1] / 100; var g = hcg[2] / 100; @@ -5618,7 +13968,7 @@ convert$6.hcg.hsv = function (hcg) { return [hcg[0], f * 100, v * 100]; }; -convert$6.hcg.hsl = function (hcg) { +convert$2.hcg.hsl = function (hcg) { var c = hcg[1] / 100; var g = hcg[2] / 100; @@ -5635,14 +13985,14 @@ convert$6.hcg.hsl = function (hcg) { return [hcg[0], s * 100, l * 100]; }; -convert$6.hcg.hwb = function (hcg) { +convert$2.hcg.hwb = function (hcg) { var c = hcg[1] / 100; var g = hcg[2] / 100; var v = c + g * (1.0 - c); return [hcg[0], (v - c) * 100, (1 - v) * 100]; }; -convert$6.hwb.hcg = function (hwb) { +convert$2.hwb.hcg = function (hwb) { var w = hwb[1] / 100; var b = hwb[2] / 100; var v = 1 - b; @@ -5656,35 +14006,35 @@ convert$6.hwb.hcg = function (hwb) { return [hwb[0], c * 100, g * 100]; }; -convert$6.apple.rgb = function (apple) { +convert$2.apple.rgb = function (apple) { return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; }; -convert$6.rgb.apple = function (rgb) { +convert$2.rgb.apple = function (rgb) { return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; }; -convert$6.gray.rgb = function (args) { +convert$2.gray.rgb = function (args) { return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; }; -convert$6.gray.hsl = convert$6.gray.hsv = function (args) { +convert$2.gray.hsl = convert$2.gray.hsv = function (args) { return [0, 0, args[0]]; }; -convert$6.gray.hwb = function (gray) { +convert$2.gray.hwb = function (gray) { return [0, 100, gray[0]]; }; -convert$6.gray.cmyk = function (gray) { +convert$2.gray.cmyk = function (gray) { return [0, 0, 0, gray[0]]; }; -convert$6.gray.lab = function (gray) { +convert$2.gray.lab = function (gray) { return [gray[0], 0, 0]; }; -convert$6.gray.hex = function (gray) { +convert$2.gray.hex = function (gray) { var val = Math.round(gray[0] / 100 * 255) & 0xFF; var integer = (val << 16) + (val << 8) + val; @@ -5692,12 +14042,12 @@ convert$6.gray.hex = function (gray) { return '000000'.substring(string.length) + string; }; -convert$6.rgb.gray = function (rgb) { +convert$2.rgb.gray = function (rgb) { var val = (rgb[0] + rgb[1] + rgb[2]) / 3; return [val / 255 * 100]; }; -var conversions$4 = conversions$5.exports; +var conversions$1 = conversions$2.exports; /* this function routes a model to all other models. @@ -5710,10 +14060,10 @@ var conversions$4 = conversions$5.exports; conversions that are not possible simply are not included. */ -function buildGraph$1() { +function buildGraph() { var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3 - var models = Object.keys(conversions$4); + var models = Object.keys(conversions$1); for (var len = models.length, i = 0; i < len; i++) { graph[models[i]] = { @@ -5728,15 +14078,15 @@ function buildGraph$1() { } // https://en.wikipedia.org/wiki/Breadth-first_search -function deriveBFS$1(fromModel) { - var graph = buildGraph$1(); +function deriveBFS(fromModel) { + var graph = buildGraph(); var queue = [fromModel]; // unshift -> queue -> pop graph[fromModel].distance = 0; while (queue.length) { var current = queue.pop(); - var adjacents = Object.keys(conversions$4[current]); + var adjacents = Object.keys(conversions$1[current]); for (var len = adjacents.length, i = 0; i < len; i++) { var adjacent = adjacents[i]; @@ -5753,20 +14103,20 @@ function deriveBFS$1(fromModel) { return graph; } -function link$2(from, to) { +function link$1(from, to) { return function (args) { return to(from(args)); }; } -function wrapConversion$1(toModel, graph) { +function wrapConversion(toModel, graph) { var path = [graph[toModel].parent, toModel]; - var fn = conversions$4[graph[toModel].parent][toModel]; + var fn = conversions$1[graph[toModel].parent][toModel]; var cur = graph[toModel].parent; while (graph[cur].parent) { path.unshift(graph[cur].parent); - fn = link$2(conversions$4[graph[cur].parent][cur], fn); + fn = link$1(conversions$1[graph[cur].parent][cur], fn); cur = graph[cur].parent; } @@ -5774,8 +14124,8 @@ function wrapConversion$1(toModel, graph) { return fn; } -var route$3 = function (fromModel) { - var graph = deriveBFS$1(fromModel); +var route$1 = function (fromModel) { + var graph = deriveBFS(fromModel); var conversion = {}; var models = Object.keys(graph); @@ -5788,20 +14138,20 @@ var route$3 = function (fromModel) { continue; } - conversion[toModel] = wrapConversion$1(toModel, graph); + conversion[toModel] = wrapConversion(toModel, graph); } return conversion; }; -var conversions$3 = conversions$5.exports; -var route$2 = route$3; +var conversions = conversions$2.exports; +var route = route$1; -var convert$5 = {}; +var convert$1 = {}; -var models$4 = Object.keys(conversions$3); +var models = Object.keys(conversions); -function wrapRaw$1(fn) { +function wrapRaw(fn) { var wrappedFn = function (args) { if (args === undefined || args === null) { return args; @@ -5822,7 +14172,7 @@ function wrapRaw$1(fn) { return wrappedFn; } -function wrapRounded$1(fn) { +function wrapRounded(fn) { var wrappedFn = function (args) { if (args === undefined || args === null) { return args; @@ -5854,40 +14204,40 @@ function wrapRounded$1(fn) { return wrappedFn; } -models$4.forEach(function (fromModel) { - convert$5[fromModel] = {}; +models.forEach(function (fromModel) { + convert$1[fromModel] = {}; - Object.defineProperty(convert$5[fromModel], 'channels', {value: conversions$3[fromModel].channels}); - Object.defineProperty(convert$5[fromModel], 'labels', {value: conversions$3[fromModel].labels}); + Object.defineProperty(convert$1[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert$1[fromModel], 'labels', {value: conversions[fromModel].labels}); - var routes = route$2(fromModel); + var routes = route(fromModel); var routeModels = Object.keys(routes); routeModels.forEach(function (toModel) { var fn = routes[toModel]; - convert$5[fromModel][toModel] = wrapRounded$1(fn); - convert$5[fromModel][toModel].raw = wrapRaw$1(fn); + convert$1[fromModel][toModel] = wrapRounded(fn); + convert$1[fromModel][toModel].raw = wrapRaw(fn); }); }); -var colorConvert$1 = convert$5; +var colorConvert = convert$1; (function (module) { -const colorConvert = colorConvert$1; +const colorConvert$1 = colorConvert; const wrapAnsi16 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); + const code = fn.apply(colorConvert$1, arguments); return `\u001B[${code + offset}m`; }; const wrapAnsi256 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); + const code = fn.apply(colorConvert$1, arguments); return `\u001B[${38 + offset};5;${code}m`; }; const wrapAnsi16m = (fn, offset) => function () { - const rgb = fn.apply(colorConvert, arguments); + const rgb = fn.apply(colorConvert$1, arguments); return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; }; @@ -6003,12 +14353,12 @@ function assembleStyles() { rgb: wrapAnsi16m(rgb2rgb, 10) }; - for (let key of Object.keys(colorConvert)) { - if (typeof colorConvert[key] !== 'object') { + for (let key of Object.keys(colorConvert$1)) { + if (typeof colorConvert$1[key] !== 'object') { continue; } - const suite = colorConvert[key]; + const suite = colorConvert$1[key]; if (key === 'ansi16') { key = 'ansi'; @@ -6038,9 +14388,9 @@ Object.defineProperty(module, 'exports', { enumerable: true, get: assembleStyles }); -}(ansiStyles$2)); +}(ansiStyles)); -var hasFlag$5 = (flag, argv) => { +var hasFlag$2 = (flag, argv) => { argv = argv || process.argv; const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); const pos = argv.indexOf(prefix + flag); @@ -6048,27 +14398,27 @@ var hasFlag$5 = (flag, argv) => { return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); }; -const os$3 = require$$0__default$1['default']; -const hasFlag$4 = hasFlag$5; +const os$1 = require$$0$2; +const hasFlag$1 = hasFlag$2; -const env$2 = process.env; +const env$1 = process.env; -let forceColor$2; -if (hasFlag$4('no-color') || - hasFlag$4('no-colors') || - hasFlag$4('color=false')) { - forceColor$2 = false; -} else if (hasFlag$4('color') || - hasFlag$4('colors') || - hasFlag$4('color=true') || - hasFlag$4('color=always')) { - forceColor$2 = true; +let forceColor; +if (hasFlag$1('no-color') || + hasFlag$1('no-colors') || + hasFlag$1('color=false')) { + forceColor = false; +} else if (hasFlag$1('color') || + hasFlag$1('colors') || + hasFlag$1('color=true') || + hasFlag$1('color=always')) { + forceColor = true; } -if ('FORCE_COLOR' in env$2) { - forceColor$2 = env$2.FORCE_COLOR.length === 0 || parseInt(env$2.FORCE_COLOR, 10) !== 0; +if ('FORCE_COLOR' in env$1) { + forceColor = env$1.FORCE_COLOR.length === 0 || parseInt(env$1.FORCE_COLOR, 10) !== 0; } -function translateLevel$2(level) { +function translateLevel$1(level) { if (level === 0) { return false; } @@ -6081,26 +14431,26 @@ function translateLevel$2(level) { }; } -function supportsColor$2(stream) { - if (forceColor$2 === false) { +function supportsColor$1(stream) { + if (forceColor === false) { return 0; } - if (hasFlag$4('color=16m') || - hasFlag$4('color=full') || - hasFlag$4('color=truecolor')) { + if (hasFlag$1('color=16m') || + hasFlag$1('color=full') || + hasFlag$1('color=truecolor')) { return 3; } - if (hasFlag$4('color=256')) { + if (hasFlag$1('color=256')) { return 2; } - if (stream && !stream.isTTY && forceColor$2 !== true) { + if (stream && !stream.isTTY && forceColor !== true) { return 0; } - const min = forceColor$2 ? 1 : 0; + const min = forceColor ? 1 : 0; if (process.platform === 'win32') { // Node.js 7.5.0 is the first version of Node.js to include a patch to @@ -6109,7 +14459,7 @@ function supportsColor$2(stream) { // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows // release that supports 256 colors. Windows 10 build 14931 is the first release // that supports 16m/TrueColor. - const osRelease = os$3.release().split('.'); + const osRelease = os$1.release().split('.'); if ( Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && @@ -6121,26 +14471,26 @@ function supportsColor$2(stream) { return 1; } - if ('CI' in env$2) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$2) || env$2.CI_NAME === 'codeship') { + if ('CI' in env$1) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') { return 1; } return min; } - if ('TEAMCITY_VERSION' in env$2) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$2.TEAMCITY_VERSION) ? 1 : 0; + if ('TEAMCITY_VERSION' in env$1) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0; } - if (env$2.COLORTERM === 'truecolor') { + if (env$1.COLORTERM === 'truecolor') { return 3; } - if ('TERM_PROGRAM' in env$2) { - const version = parseInt((env$2.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + if ('TERM_PROGRAM' in env$1) { + const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - switch (env$2.TERM_PROGRAM) { + switch (env$1.TERM_PROGRAM) { case 'iTerm.app': return version >= 3 ? 3 : 2; case 'Apple_Terminal': @@ -6149,42 +14499,42 @@ function supportsColor$2(stream) { } } - if (/-256(color)?$/i.test(env$2.TERM)) { + if (/-256(color)?$/i.test(env$1.TERM)) { return 2; } - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$2.TERM)) { + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) { return 1; } - if ('COLORTERM' in env$2) { + if ('COLORTERM' in env$1) { return 1; } - if (env$2.TERM === 'dumb') { + if (env$1.TERM === 'dumb') { return min; } return min; } -function getSupportLevel$2(stream) { - const level = supportsColor$2(stream); - return translateLevel$2(level); +function getSupportLevel(stream) { + const level = supportsColor$1(stream); + return translateLevel$1(level); } -var supportsColor_1$2 = { - supportsColor: getSupportLevel$2, - stdout: getSupportLevel$2(process.stdout), - stderr: getSupportLevel$2(process.stderr) +var supportsColor_1 = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr) }; -const TEMPLATE_REGEX$1 = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; -const STYLE_REGEX$1 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; -const STRING_REGEX$1 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX$1 = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; +const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; -const ESCAPES$1 = new Map([ +const ESCAPES = new Map([ ['n', '\n'], ['r', '\r'], ['t', '\t'], @@ -6197,15 +14547,15 @@ const ESCAPES$1 = new Map([ ['a', '\u0007'] ]); -function unescape$1(c) { +function unescape(c) { if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { return String.fromCharCode(parseInt(c.slice(1), 16)); } - return ESCAPES$1.get(c) || c; + return ESCAPES.get(c) || c; } -function parseArguments$1(name, args) { +function parseArguments(name, args) { const results = []; const chunks = args.trim().split(/\s*,\s*/g); let matches; @@ -6213,8 +14563,8 @@ function parseArguments$1(name, args) { for (const chunk of chunks) { if (!isNaN(chunk)) { results.push(Number(chunk)); - } else if ((matches = chunk.match(STRING_REGEX$1))) { - results.push(matches[2].replace(ESCAPE_REGEX$1, (m, escape, chr) => escape ? unescape$1(escape) : chr)); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); } else { throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); } @@ -6223,17 +14573,17 @@ function parseArguments$1(name, args) { return results; } -function parseStyle$1(style) { - STYLE_REGEX$1.lastIndex = 0; +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; const results = []; let matches; - while ((matches = STYLE_REGEX$1.exec(style)) !== null) { + while ((matches = STYLE_REGEX.exec(style)) !== null) { const name = matches[1]; if (matches[2]) { - const args = parseArguments$1(name, matches[2]); + const args = parseArguments(name, matches[2]); results.push([name].concat(args)); } else { results.push([name]); @@ -6243,7 +14593,7 @@ function parseStyle$1(style) { return results; } -function buildStyle$1(chalk, styles) { +function buildStyle(chalk, styles) { const enabled = {}; for (const layer of styles) { @@ -6270,26 +14620,26 @@ function buildStyle$1(chalk, styles) { return current; } -var templates$1 = (chalk, tmp) => { +var templates = (chalk, tmp) => { const styles = []; const chunks = []; let chunk = []; // eslint-disable-next-line max-params - tmp.replace(TEMPLATE_REGEX$1, (m, escapeChar, inverse, style, close, chr) => { + tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { if (escapeChar) { - chunk.push(unescape$1(escapeChar)); + chunk.push(unescape(escapeChar)); } else if (style) { const str = chunk.join(''); chunk = []; - chunks.push(styles.length === 0 ? str : buildStyle$1(chalk, styles)(str)); - styles.push({inverse, styles: parseStyle$1(style)}); + chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); + styles.push({inverse, styles: parseStyle(style)}); } else if (close) { if (styles.length === 0) { throw new Error('Found extraneous } in Chalk template literal'); } - chunks.push(buildStyle$1(chalk, styles)(chunk.join(''))); + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); chunk = []; styles.pop(); } else { @@ -6308,11 +14658,11 @@ var templates$1 = (chalk, tmp) => { }; (function (module) { -const escapeStringRegexp = escapeStringRegexp$3; -const ansiStyles = ansiStyles$2.exports; -const stdoutColor = supportsColor_1$2.stdout; +const escapeStringRegexp = escapeStringRegexp$1; +const ansiStyles$1 = ansiStyles.exports; +const stdoutColor = supportsColor_1.stdout; -const template = templates$1; +const template = templates; const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); @@ -6358,15 +14708,15 @@ function Chalk(options) { // Use bright blue on Windows as the normal blue color is illegible if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001B[94m'; + ansiStyles$1.blue.open = '\u001B[94m'; } -for (const key of Object.keys(ansiStyles)) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); +for (const key of Object.keys(ansiStyles$1)) { + ansiStyles$1[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles$1[key].close), 'g'); styles[key] = { get() { - const codes = ansiStyles[key]; + const codes = ansiStyles$1[key]; return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); } }; @@ -6378,8 +14728,8 @@ styles.visible = { } }; -ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); -for (const model of Object.keys(ansiStyles.color.ansi)) { +ansiStyles$1.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles$1.color.close), 'g'); +for (const model of Object.keys(ansiStyles$1.color.ansi)) { if (skipModels.has(model)) { continue; } @@ -6388,11 +14738,11 @@ for (const model of Object.keys(ansiStyles.color.ansi)) { get() { const level = this.level; return function () { - const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); + const open = ansiStyles$1.color[levelMapping[level]][model].apply(null, arguments); const codes = { open, - close: ansiStyles.color.close, - closeRe: ansiStyles.color.closeRe + close: ansiStyles$1.color.close, + closeRe: ansiStyles$1.color.closeRe }; return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); }; @@ -6400,8 +14750,8 @@ for (const model of Object.keys(ansiStyles.color.ansi)) { }; } -ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); -for (const model of Object.keys(ansiStyles.bgColor.ansi)) { +ansiStyles$1.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles$1.bgColor.close), 'g'); +for (const model of Object.keys(ansiStyles$1.bgColor.ansi)) { if (skipModels.has(model)) { continue; } @@ -6411,11 +14761,11 @@ for (const model of Object.keys(ansiStyles.bgColor.ansi)) { get() { const level = this.level; return function () { - const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); + const open = ansiStyles$1.bgColor[levelMapping[level]][model].apply(null, arguments); const codes = { open, - close: ansiStyles.bgColor.close, - closeRe: ansiStyles.bgColor.closeRe + close: ansiStyles$1.bgColor.close, + closeRe: ansiStyles$1.bgColor.closeRe }; return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); }; @@ -6489,9 +14839,9 @@ function applyStyle() { // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, // see https://github.com/chalk/chalk/issues/58 // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - const originalDim = ansiStyles.dim.open; + const originalDim = ansiStyles$1.dim.open; if (isSimpleWindowsTerm && this.hasGrey) { - ansiStyles.dim.open = ''; + ansiStyles$1.dim.open = ''; } for (const code of this._styles.slice().reverse()) { @@ -6507,7 +14857,7 @@ function applyStyle() { } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue - ansiStyles.dim.open = originalDim; + ansiStyles$1.dim.open = originalDim; return str; } @@ -6535,20 +14885,20 @@ Object.defineProperties(Chalk.prototype, styles); module.exports = Chalk(); // eslint-disable-line new-cap module.exports.supportsColor = stdoutColor; module.exports.default = module.exports; // For TypeScript -}(chalk$2)); +}(chalk)); -Object.defineProperty(lib$8, "__esModule", { +Object.defineProperty(lib$3, "__esModule", { value: true }); -lib$8.shouldHighlight = shouldHighlight; -lib$8.getChalk = getChalk; -lib$8.default = highlight; +lib$3.shouldHighlight = shouldHighlight; +lib$3.getChalk = getChalk; +lib$3.default = highlight; var _jsTokens = jsTokens; -var _helperValidatorIdentifier = lib$7; +var _helperValidatorIdentifier = lib$2; -var _chalk = chalk$2.exports; +var _chalk = chalk.exports; const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]); @@ -6568,7 +14918,7 @@ function getDefs$1(chalk) { const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/; const BRACKET = /^[()[\]{}]$/; -let tokenize$3; +let tokenize; { const JSX_TAG = /^[a-z][\w-]*$/i; @@ -6598,7 +14948,7 @@ let tokenize$3; return token.type; }; - tokenize$3 = function* (text) { + tokenize = function* (text) { let match; while (match = _jsTokens.default.exec(text)) { @@ -6618,7 +14968,7 @@ function highlightTokens(defs, text) { for (const { type, value - } of tokenize$3(text)) { + } of tokenize(text)) { const colorize = defs[type]; if (colorize) { @@ -6652,13 +15002,13 @@ function highlight(code, options = {}) { } } -Object.defineProperty(lib$9, "__esModule", { +Object.defineProperty(lib$4, "__esModule", { value: true }); -lib$9.codeFrameColumns = codeFrameColumns$1; -lib$9.default = _default$1; +lib$4.codeFrameColumns = codeFrameColumns$1; +lib$4.default = _default; -var _highlight = lib$8; +var _highlight = lib$3; let deprecationWarningShown = false; @@ -6790,7 +15140,7 @@ function codeFrameColumns$1(rawLines, loc, opts = {}) { } } -function _default$1(rawLines, lineNumber, colNumber, opts = {}) { +function _default(rawLines, lineNumber, colNumber, opts = {}) { if (!deprecationWarningShown) { deprecationWarningShown = true; const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`."; @@ -6817,7 +15167,7 @@ function _default$1(rawLines, lineNumber, colNumber, opts = {}) { const errorEx = errorEx_1; const fallback = jsonParseEvenBetterErrors; const {default: LinesAndColumns} = require$$2; -const {codeFrameColumns} = lib$9; +const {codeFrameColumns} = lib$4; const JSONError = errorEx('JSONError', { fileName: errorEx.append('in %s'), @@ -6901,7 +15251,7 @@ var ms = function(val, options) { options = options || {}; var type = typeof val; if (type === 'string' && val.length > 0) { - return parse$c(val); + return parse$a(val); } else if (type === 'number' && isFinite(val)) { return options.long ? fmtLong(val) : fmtShort(val); } @@ -6919,7 +15269,7 @@ var ms = function(val, options) { * @api private */ -function parse$c(str) { +function parse$a(str) { str = String(str); if (str.length > 100) { return; @@ -7307,7 +15657,7 @@ function setup(env) { return createDebug; } -var common$4 = setup; +var common$3 = setup; /* eslint-env browser */ @@ -7564,7 +15914,7 @@ function localstorage() { } } -module.exports = common$4(exports); +module.exports = common$3(exports); const {formatters} = module.exports; @@ -7583,155 +15933,13 @@ formatters.j = function (v) { var node = {exports: {}}; -var hasFlag$3 = (flag, argv = process.argv) => { - const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); - const position = argv.indexOf(prefix + flag); - const terminatorPosition = argv.indexOf('--'); - return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); -}; - -const os$2 = require$$0__default$1['default']; -const tty = require$$1__default['default']; -const hasFlag$2 = hasFlag$3; - -const {env: env$1} = process; - -let forceColor$1; -if (hasFlag$2('no-color') || - hasFlag$2('no-colors') || - hasFlag$2('color=false') || - hasFlag$2('color=never')) { - forceColor$1 = 0; -} else if (hasFlag$2('color') || - hasFlag$2('colors') || - hasFlag$2('color=true') || - hasFlag$2('color=always')) { - forceColor$1 = 1; -} - -if ('FORCE_COLOR' in env$1) { - if (env$1.FORCE_COLOR === 'true') { - forceColor$1 = 1; - } else if (env$1.FORCE_COLOR === 'false') { - forceColor$1 = 0; - } else { - forceColor$1 = env$1.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$1.FORCE_COLOR, 10), 3); - } -} - -function translateLevel$1(level) { - if (level === 0) { - return false; - } - - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -} - -function supportsColor$1(haveStream, streamIsTTY) { - if (forceColor$1 === 0) { - return 0; - } - - if (hasFlag$2('color=16m') || - hasFlag$2('color=full') || - hasFlag$2('color=truecolor')) { - return 3; - } - - if (hasFlag$2('color=256')) { - return 2; - } - - if (haveStream && !streamIsTTY && forceColor$1 === undefined) { - return 0; - } - - const min = forceColor$1 || 0; - - if (env$1.TERM === 'dumb') { - return min; - } - - if (process.platform === 'win32') { - // Windows 10 build 10586 is the first Windows release that supports 256 colors. - // Windows 10 build 14931 is the first release that supports 16m/TrueColor. - const osRelease = os$2.release().split('.'); - if ( - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } - - return 1; - } - - if ('CI' in env$1) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') { - return 1; - } - - return min; - } - - if ('TEAMCITY_VERSION' in env$1) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0; - } - - if (env$1.COLORTERM === 'truecolor') { - return 3; - } - - if ('TERM_PROGRAM' in env$1) { - const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - - switch (env$1.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } - - if (/-256(color)?$/i.test(env$1.TERM)) { - return 2; - } - - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) { - return 1; - } - - if ('COLORTERM' in env$1) { - return 1; - } - - return min; -} - -function getSupportLevel$1(stream) { - const level = supportsColor$1(stream, stream && stream.isTTY); - return translateLevel$1(level); -} - -var supportsColor_1$1 = { - supportsColor: getSupportLevel$1, - stdout: translateLevel$1(supportsColor$1(true, tty.isatty(1))), - stderr: translateLevel$1(supportsColor$1(true, tty.isatty(2))) -}; - /** * Module dependencies. */ (function (module, exports) { -const tty = require$$1__default['default']; -const util = require$$0__default['default']; +const tty = tty$1; +const util = require$$0$4; /** * This is the Node.js implementation of `debug()`. @@ -7965,7 +16173,7 @@ function init(debug) { } } -module.exports = common$4(exports); +module.exports = common$3(exports); const {formatters} = module.exports; @@ -8002,54 +16210,4296 @@ if (typeof process === 'undefined' || process.type === 'renderer' || process.bro src.exports = node.exports; } -var resolveFrom$1 = {exports: {}}; +var createDebug = src.exports; -const path$l = require$$0__default$2['default']; -const Module = require$$1__default$1['default']; -const fs$j = require$$0__default$3['default']; +var re$6 = {exports: {}}; -const resolveFrom = (fromDirectory, moduleId, silent) => { - if (typeof fromDirectory !== 'string') { - throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``); - } +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0'; - if (typeof moduleId !== 'string') { - throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); - } +const MAX_LENGTH$2 = 256; +const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991; - try { - fromDirectory = fs$j.realpathSync(fromDirectory); - } catch (error) { - if (error.code === 'ENOENT') { - fromDirectory = path$l.resolve(fromDirectory); - } else if (silent) { - return; - } else { - throw error; - } - } +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16; - const fromFile = path$l.join(fromDirectory, 'noop.js'); +var constants = { + SEMVER_SPEC_VERSION, + MAX_LENGTH: MAX_LENGTH$2, + MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1, + MAX_SAFE_COMPONENT_LENGTH +}; - const resolveFileName = () => Module._resolveFilename(moduleId, { - id: fromFile, - filename: fromFile, - paths: Module._nodeModulePaths(fromDirectory) - }); +const debug$f = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {}; - if (silent) { - try { - return resolveFileName(); - } catch (error) { - return; - } - } +var debug_1 = debug$f; + +(function (module, exports) { +const { MAX_SAFE_COMPONENT_LENGTH } = constants; +const debug = debug_1; +exports = module.exports = {}; + +// The actual regexps go on exports.re +const re = exports.re = []; +const src = exports.src = []; +const t = exports.t = {}; +let R = 0; + +const createToken = (name, value, isGlobal) => { + const index = R++; + debug(index, value); + t[name] = index; + src[index] = value; + re[index] = new RegExp(value, isGlobal ? 'g' : undefined); +}; + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*'); +createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+'); + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*'); + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`); + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`); + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`); + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`); + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+'); + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`); + +createToken('FULL', `^${src[t.FULLPLAIN]}$`); + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`); + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`); + +createToken('GTLT', '((?:<|>)?=?)'); + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`); + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`); + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCE', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:$|[^\\d])`); +createToken('COERCERTL', src[t.COERCE], true); + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)'); + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true); +exports.tildeTrimReplace = '$1~'; + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)'); + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true); +exports.caretTrimReplace = '$1^'; + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); +exports.comparatorTrimReplace = '$1$2$3'; + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`); + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`); + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*'); +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$'); +createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$'); +}(re$6, re$6.exports)); + +// parse out just the options we care about so we always get a consistent +// obj with keys in a consistent order. +const opts = ['includePrerelease', 'loose', 'rtl']; +const parseOptions$4 = options => + !options ? {} + : typeof options !== 'object' ? { loose: true } + : opts.filter(k => options[k]).reduce((options, k) => { + options[k] = true; + return options + }, {}); +var parseOptions_1 = parseOptions$4; + +const numeric$1 = /^[0-9]+$/; +const compareIdentifiers$1 = (a, b) => { + const anum = numeric$1.test(a); + const bnum = numeric$1.test(b); + + if (anum && bnum) { + a = +a; + b = +b; + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +}; + +const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a); + +var identifiers = { + compareIdentifiers: compareIdentifiers$1, + rcompareIdentifiers +}; + +const debug$e = debug_1; +const { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER } = constants; +const { re: re$5, t: t$4 } = re$6.exports; + +const parseOptions$3 = parseOptions_1; +const { compareIdentifiers } = identifiers; +class SemVer$e { + constructor (version, options) { + options = parseOptions$3(options); + + if (version instanceof SemVer$e) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version; + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid Version: ${version}`) + } + + if (version.length > MAX_LENGTH$1) { + throw new TypeError( + `version is longer than ${MAX_LENGTH$1} characters` + ) + } + + debug$e('SemVer', version, options); + this.options = options; + this.loose = !!options.loose; + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease; + + const m = version.trim().match(options.loose ? re$5[t$4.LOOSE] : re$5[t$4.FULL]); + + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } + + this.raw = version; + + // these are actually numbers + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = []; + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }); + } + + this.build = m[5] ? m[5].split('.') : []; + this.format(); + } + + format () { + this.version = `${this.major}.${this.minor}.${this.patch}`; + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}`; + } + return this.version + } + + toString () { + return this.version + } + + compare (other) { + debug$e('SemVer.compare', this.version, this.options, other); + if (!(other instanceof SemVer$e)) { + if (typeof other === 'string' && other === this.version) { + return 0 + } + other = new SemVer$e(other, this.options); + } + + if (other.version === this.version) { + return 0 + } + + return this.compareMain(other) || this.comparePre(other) + } + + compareMain (other) { + if (!(other instanceof SemVer$e)) { + other = new SemVer$e(other, this.options); + } + + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } + + comparePre (other) { + if (!(other instanceof SemVer$e)) { + other = new SemVer$e(other, this.options); + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + let i = 0; + do { + const a = this.prerelease[i]; + const b = other.prerelease[i]; + debug$e('prerelease compare', i, a, b); + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + compareBuild (other) { + if (!(other instanceof SemVer$e)) { + other = new SemVer$e(other, this.options); + } + + let i = 0; + do { + const a = this.build[i]; + const b = other.build[i]; + debug$e('prerelease compare', i, a, b); + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier); + break + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier); + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0; + this.inc('patch', identifier); + this.inc('pre', identifier); + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier); + } + this.inc('pre', identifier); + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++; + } + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + this.patch = 0; + this.prerelease = []; + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++; + } + this.prerelease = []; + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0]; + } else { + let i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0); + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0]; + } + } else { + this.prerelease = [identifier, 0]; + } + } + break + + default: + throw new Error(`invalid increment argument: ${release}`) + } + this.format(); + this.raw = this.version; + return this + } +} + +var semver$2 = SemVer$e; + +const {MAX_LENGTH} = constants; +const { re: re$4, t: t$3 } = re$6.exports; +const SemVer$d = semver$2; + +const parseOptions$2 = parseOptions_1; +const parse$9 = (version, options) => { + options = parseOptions$2(options); + + if (version instanceof SemVer$d) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + const r = options.loose ? re$4[t$3.LOOSE] : re$4[t$3.FULL]; + if (!r.test(version)) { + return null + } + + try { + return new SemVer$d(version, options) + } catch (er) { + return null + } +}; + +var parse_1 = parse$9; + +const parse$8 = parse_1; +const valid$1 = (version, options) => { + const v = parse$8(version, options); + return v ? v.version : null +}; +var valid_1 = valid$1; + +const parse$7 = parse_1; +const clean = (version, options) => { + const s = parse$7(version.trim().replace(/^[=v]+/, ''), options); + return s ? s.version : null +}; +var clean_1 = clean; + +const SemVer$c = semver$2; + +const inc = (version, release, options, identifier) => { + if (typeof (options) === 'string') { + identifier = options; + options = undefined; + } + + try { + return new SemVer$c(version, options).inc(release, identifier).version + } catch (er) { + return null + } +}; +var inc_1 = inc; + +const SemVer$b = semver$2; +const compare$b = (a, b, loose) => + new SemVer$b(a, loose).compare(new SemVer$b(b, loose)); + +var compare_1 = compare$b; + +const compare$a = compare_1; +const eq$2 = (a, b, loose) => compare$a(a, b, loose) === 0; +var eq_1 = eq$2; + +const parse$6 = parse_1; +const eq$1 = eq_1; + +const diff = (version1, version2) => { + if (eq$1(version1, version2)) { + return null + } else { + const v1 = parse$6(version1); + const v2 = parse$6(version2); + const hasPre = v1.prerelease.length || v2.prerelease.length; + const prefix = hasPre ? 'pre' : ''; + const defaultResult = hasPre ? 'prerelease' : ''; + for (const key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +}; +var diff_1 = diff; + +const SemVer$a = semver$2; +const major = (a, loose) => new SemVer$a(a, loose).major; +var major_1 = major; + +const SemVer$9 = semver$2; +const minor = (a, loose) => new SemVer$9(a, loose).minor; +var minor_1 = minor; + +const SemVer$8 = semver$2; +const patch = (a, loose) => new SemVer$8(a, loose).patch; +var patch_1 = patch; + +const parse$5 = parse_1; +const prerelease = (version, options) => { + const parsed = parse$5(version, options); + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +}; +var prerelease_1 = prerelease; + +const compare$9 = compare_1; +const rcompare = (a, b, loose) => compare$9(b, a, loose); +var rcompare_1 = rcompare; + +const compare$8 = compare_1; +const compareLoose = (a, b) => compare$8(a, b, true); +var compareLoose_1 = compareLoose; + +const SemVer$7 = semver$2; +const compareBuild$2 = (a, b, loose) => { + const versionA = new SemVer$7(a, loose); + const versionB = new SemVer$7(b, loose); + return versionA.compare(versionB) || versionA.compareBuild(versionB) +}; +var compareBuild_1 = compareBuild$2; + +const compareBuild$1 = compareBuild_1; +const sort$1 = (list, loose) => list.sort((a, b) => compareBuild$1(a, b, loose)); +var sort_1 = sort$1; + +const compareBuild = compareBuild_1; +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)); +var rsort_1 = rsort; + +const compare$7 = compare_1; +const gt$3 = (a, b, loose) => compare$7(a, b, loose) > 0; +var gt_1 = gt$3; + +const compare$6 = compare_1; +const lt$2 = (a, b, loose) => compare$6(a, b, loose) < 0; +var lt_1 = lt$2; + +const compare$5 = compare_1; +const neq$1 = (a, b, loose) => compare$5(a, b, loose) !== 0; +var neq_1 = neq$1; + +const compare$4 = compare_1; +const gte$3 = (a, b, loose) => compare$4(a, b, loose) >= 0; +var gte_1 = gte$3; + +const compare$3 = compare_1; +const lte$3 = (a, b, loose) => compare$3(a, b, loose) <= 0; +var lte_1 = lte$3; + +const eq = eq_1; +const neq = neq_1; +const gt$2 = gt_1; +const gte$2 = gte_1; +const lt$1 = lt_1; +const lte$2 = lte_1; + +const cmp$1 = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version; + if (typeof b === 'object') + b = b.version; + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version; + if (typeof b === 'object') + b = b.version; + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt$2(a, b, loose) + + case '>=': + return gte$2(a, b, loose) + + case '<': + return lt$1(a, b, loose) + + case '<=': + return lte$2(a, b, loose) + + default: + throw new TypeError(`Invalid operator: ${op}`) + } +}; +var cmp_1 = cmp$1; + +const SemVer$6 = semver$2; +const parse$4 = parse_1; +const {re: re$3, t: t$2} = re$6.exports; + +const coerce$I = (version, options) => { + if (version instanceof SemVer$6) { + return version + } + + if (typeof version === 'number') { + version = String(version); + } + + if (typeof version !== 'string') { + return null + } + + options = options || {}; + + let match = null; + if (!options.rtl) { + match = version.match(re$3[t$2.COERCE]); + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + let next; + while ((next = re$3[t$2.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next; + } + re$3[t$2.COERCERTL].lastIndex = next.index + next[1].length + next[2].length; + } + // leave it in a clean state + re$3[t$2.COERCERTL].lastIndex = -1; + } + + if (match === null) + return null + + return parse$4(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) +}; +var coerce_1 = coerce$I; + +var iterator = function (Yallist) { + Yallist.prototype[Symbol.iterator] = function* () { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value; + } + }; +}; + +var yallist = Yallist$1; + +Yallist$1.Node = Node; +Yallist$1.create = Yallist$1; + +function Yallist$1 (list) { + var self = this; + if (!(self instanceof Yallist$1)) { + self = new Yallist$1(); + } + + self.tail = null; + self.head = null; + self.length = 0; + + if (list && typeof list.forEach === 'function') { + list.forEach(function (item) { + self.push(item); + }); + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self.push(arguments[i]); + } + } + + return self +} + +Yallist$1.prototype.removeNode = function (node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list') + } + + var next = node.next; + var prev = node.prev; + + if (next) { + next.prev = prev; + } + + if (prev) { + prev.next = next; + } + + if (node === this.head) { + this.head = next; + } + if (node === this.tail) { + this.tail = prev; + } + + node.list.length--; + node.next = null; + node.prev = null; + node.list = null; + + return next +}; + +Yallist$1.prototype.unshiftNode = function (node) { + if (node === this.head) { + return + } + + if (node.list) { + node.list.removeNode(node); + } + + var head = this.head; + node.list = this; + node.next = head; + if (head) { + head.prev = node; + } + + this.head = node; + if (!this.tail) { + this.tail = node; + } + this.length++; +}; + +Yallist$1.prototype.pushNode = function (node) { + if (node === this.tail) { + return + } + + if (node.list) { + node.list.removeNode(node); + } + + var tail = this.tail; + node.list = this; + node.prev = tail; + if (tail) { + tail.next = node; + } + + this.tail = node; + if (!this.head) { + this.head = node; + } + this.length++; +}; + +Yallist$1.prototype.push = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + push$2(this, arguments[i]); + } + return this.length +}; + +Yallist$1.prototype.unshift = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]); + } + return this.length +}; + +Yallist$1.prototype.pop = function () { + if (!this.tail) { + return undefined + } + + var res = this.tail.value; + this.tail = this.tail.prev; + if (this.tail) { + this.tail.next = null; + } else { + this.head = null; + } + this.length--; + return res +}; + +Yallist$1.prototype.shift = function () { + if (!this.head) { + return undefined + } + + var res = this.head.value; + this.head = this.head.next; + if (this.head) { + this.head.prev = null; + } else { + this.tail = null; + } + this.length--; + return res +}; + +Yallist$1.prototype.forEach = function (fn, thisp) { + thisp = thisp || this; + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this); + walker = walker.next; + } +}; + +Yallist$1.prototype.forEachReverse = function (fn, thisp) { + thisp = thisp || this; + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this); + walker = walker.prev; + } +}; + +Yallist$1.prototype.get = function (n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.next; + } + if (i === n && walker !== null) { + return walker.value + } +}; + +Yallist$1.prototype.getReverse = function (n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev; + } + if (i === n && walker !== null) { + return walker.value + } +}; + +Yallist$1.prototype.map = function (fn, thisp) { + thisp = thisp || this; + var res = new Yallist$1(); + for (var walker = this.head; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.next; + } + return res +}; + +Yallist$1.prototype.mapReverse = function (fn, thisp) { + thisp = thisp || this; + var res = new Yallist$1(); + for (var walker = this.tail; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.prev; + } + return res +}; + +Yallist$1.prototype.reduce = function (fn, initial) { + var acc; + var walker = this.head; + if (arguments.length > 1) { + acc = initial; + } else if (this.head) { + walker = this.head.next; + acc = this.head.value; + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i); + walker = walker.next; + } + + return acc +}; + +Yallist$1.prototype.reduceReverse = function (fn, initial) { + var acc; + var walker = this.tail; + if (arguments.length > 1) { + acc = initial; + } else if (this.tail) { + walker = this.tail.prev; + acc = this.tail.value; + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i); + walker = walker.prev; + } + + return acc +}; + +Yallist$1.prototype.toArray = function () { + var arr = new Array(this.length); + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.next; + } + return arr +}; + +Yallist$1.prototype.toArrayReverse = function () { + var arr = new Array(this.length); + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.prev; + } + return arr +}; + +Yallist$1.prototype.slice = function (from, to) { + to = to || this.length; + if (to < 0) { + to += this.length; + } + from = from || 0; + if (from < 0) { + from += this.length; + } + var ret = new Yallist$1(); + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next; + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value); + } + return ret +}; + +Yallist$1.prototype.sliceReverse = function (from, to) { + to = to || this.length; + if (to < 0) { + to += this.length; + } + from = from || 0; + if (from < 0) { + from += this.length; + } + var ret = new Yallist$1(); + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev; + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value); + } + return ret +}; + +Yallist$1.prototype.splice = function (start, deleteCount, ...nodes) { + if (start > this.length) { + start = this.length - 1; + } + if (start < 0) { + start = this.length + start; + } + + for (var i = 0, walker = this.head; walker !== null && i < start; i++) { + walker = walker.next; + } + + var ret = []; + for (var i = 0; walker && i < deleteCount; i++) { + ret.push(walker.value); + walker = this.removeNode(walker); + } + if (walker === null) { + walker = this.tail; + } + + if (walker !== this.head && walker !== this.tail) { + walker = walker.prev; + } + + for (var i = 0; i < nodes.length; i++) { + walker = insert(this, walker, nodes[i]); + } + return ret; +}; + +Yallist$1.prototype.reverse = function () { + var head = this.head; + var tail = this.tail; + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev; + walker.prev = walker.next; + walker.next = p; + } + this.head = tail; + this.tail = head; + return this +}; + +function insert (self, node, value) { + var inserted = node === self.head ? + new Node(value, null, node, self) : + new Node(value, node, node.next, self); + + if (inserted.next === null) { + self.tail = inserted; + } + if (inserted.prev === null) { + self.head = inserted; + } + + self.length++; + + return inserted +} + +function push$2 (self, item) { + self.tail = new Node(item, self.tail, null, self); + if (!self.head) { + self.head = self.tail; + } + self.length++; +} + +function unshift (self, item) { + self.head = new Node(item, null, self.head, self); + if (!self.tail) { + self.tail = self.head; + } + self.length++; +} + +function Node (value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list) + } + + this.list = list; + this.value = value; + + if (prev) { + prev.next = this; + this.prev = prev; + } else { + this.prev = null; + } + + if (next) { + next.prev = this; + this.next = next; + } else { + this.next = null; + } +} + +try { + // add if support for Symbol.iterator is present + iterator(Yallist$1); +} catch (er) {} + +// A linked list to keep track of recently-used-ness +const Yallist = yallist; + +const MAX = Symbol('max'); +const LENGTH = Symbol('length'); +const LENGTH_CALCULATOR = Symbol('lengthCalculator'); +const ALLOW_STALE = Symbol('allowStale'); +const MAX_AGE = Symbol('maxAge'); +const DISPOSE = Symbol('dispose'); +const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet'); +const LRU_LIST = Symbol('lruList'); +const CACHE = Symbol('cache'); +const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet'); + +const naiveLength = () => 1; + +// lruList is a yallist where the head is the youngest +// item, and the tail is the oldest. the list contains the Hit +// objects as the entries. +// Each Hit object has a reference to its Yallist.Node. This +// never changes. +// +// cache is a Map (or PseudoMap) that matches the keys to +// the Yallist.Node object. +class LRUCache { + constructor (options) { + if (typeof options === 'number') + options = { max: options }; + + if (!options) + options = {}; + + if (options.max && (typeof options.max !== 'number' || options.max < 0)) + throw new TypeError('max must be a non-negative number') + // Kind of weird to have a default max of Infinity, but oh well. + this[MAX] = options.max || Infinity; + + const lc = options.length || naiveLength; + this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc; + this[ALLOW_STALE] = options.stale || false; + if (options.maxAge && typeof options.maxAge !== 'number') + throw new TypeError('maxAge must be a number') + this[MAX_AGE] = options.maxAge || 0; + this[DISPOSE] = options.dispose; + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false; + this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false; + this.reset(); + } + + // resize the cache when the max changes. + set max (mL) { + if (typeof mL !== 'number' || mL < 0) + throw new TypeError('max must be a non-negative number') + + this[MAX] = mL || Infinity; + trim(this); + } + get max () { + return this[MAX] + } + + set allowStale (allowStale) { + this[ALLOW_STALE] = !!allowStale; + } + get allowStale () { + return this[ALLOW_STALE] + } + + set maxAge (mA) { + if (typeof mA !== 'number') + throw new TypeError('maxAge must be a non-negative number') + + this[MAX_AGE] = mA; + trim(this); + } + get maxAge () { + return this[MAX_AGE] + } + + // resize the cache when the lengthCalculator changes. + set lengthCalculator (lC) { + if (typeof lC !== 'function') + lC = naiveLength; + + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC; + this[LENGTH] = 0; + this[LRU_LIST].forEach(hit => { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key); + this[LENGTH] += hit.length; + }); + } + trim(this); + } + get lengthCalculator () { return this[LENGTH_CALCULATOR] } + + get length () { return this[LENGTH] } + get itemCount () { return this[LRU_LIST].length } + + rforEach (fn, thisp) { + thisp = thisp || this; + for (let walker = this[LRU_LIST].tail; walker !== null;) { + const prev = walker.prev; + forEachStep(this, fn, walker, thisp); + walker = prev; + } + } + + forEach (fn, thisp) { + thisp = thisp || this; + for (let walker = this[LRU_LIST].head; walker !== null;) { + const next = walker.next; + forEachStep(this, fn, walker, thisp); + walker = next; + } + } + + keys () { + return this[LRU_LIST].toArray().map(k => k.key) + } + + values () { + return this[LRU_LIST].toArray().map(k => k.value) + } + + reset () { + if (this[DISPOSE] && + this[LRU_LIST] && + this[LRU_LIST].length) { + this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)); + } + + this[CACHE] = new Map(); // hash of items by key + this[LRU_LIST] = new Yallist(); // list of items in order of use recency + this[LENGTH] = 0; // length of items in the list + } + + dump () { + return this[LRU_LIST].map(hit => + isStale(this, hit) ? false : { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }).toArray().filter(h => h) + } + + dumpLru () { + return this[LRU_LIST] + } + + set (key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE]; + + if (maxAge && typeof maxAge !== 'number') + throw new TypeError('maxAge must be a number') + + const now = maxAge ? Date.now() : 0; + const len = this[LENGTH_CALCULATOR](value, key); + + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)); + return false + } + + const node = this[CACHE].get(key); + const item = node.value; + + // dispose of the old one before overwriting + // split out into 2 ifs for better coverage tracking + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) + this[DISPOSE](key, item.value); + } + + item.now = now; + item.maxAge = maxAge; + item.value = value; + this[LENGTH] += len - item.length; + item.length = len; + this.get(key); + trim(this); + return true + } + + const hit = new Entry(key, value, len, now, maxAge); + + // oversized objects fall out of cache automatically. + if (hit.length > this[MAX]) { + if (this[DISPOSE]) + this[DISPOSE](key, value); + + return false + } + + this[LENGTH] += hit.length; + this[LRU_LIST].unshift(hit); + this[CACHE].set(key, this[LRU_LIST].head); + trim(this); + return true + } + + has (key) { + if (!this[CACHE].has(key)) return false + const hit = this[CACHE].get(key).value; + return !isStale(this, hit) + } + + get (key) { + return get(this, key, true) + } + + peek (key) { + return get(this, key, false) + } + + pop () { + const node = this[LRU_LIST].tail; + if (!node) + return null + + del(this, node); + return node.value + } + + del (key) { + del(this, this[CACHE].get(key)); + } + + load (arr) { + // reset the cache + this.reset(); + + const now = Date.now(); + // A previous serialized cache has the most recent items first + for (let l = arr.length - 1; l >= 0; l--) { + const hit = arr[l]; + const expiresAt = hit.e || 0; + if (expiresAt === 0) + // the item was created without expiration in a non aged cache + this.set(hit.k, hit.v); + else { + const maxAge = expiresAt - now; + // dont add already expired items + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge); + } + } + } + } + + prune () { + this[CACHE].forEach((value, key) => get(this, key, false)); + } +} + +const get = (self, key, doUse) => { + const node = self[CACHE].get(key); + if (node) { + const hit = node.value; + if (isStale(self, hit)) { + del(self, node); + if (!self[ALLOW_STALE]) + return undefined + } else { + if (doUse) { + if (self[UPDATE_AGE_ON_GET]) + node.value.now = Date.now(); + self[LRU_LIST].unshiftNode(node); + } + } + return hit.value + } +}; + +const isStale = (self, hit) => { + if (!hit || (!hit.maxAge && !self[MAX_AGE])) + return false + + const diff = Date.now() - hit.now; + return hit.maxAge ? diff > hit.maxAge + : self[MAX_AGE] && (diff > self[MAX_AGE]) +}; + +const trim = self => { + if (self[LENGTH] > self[MAX]) { + for (let walker = self[LRU_LIST].tail; + self[LENGTH] > self[MAX] && walker !== null;) { + // We know that we're about to delete this one, and also + // what the next least recently used key will be, so just + // go ahead and set it now. + const prev = walker.prev; + del(self, walker); + walker = prev; + } + } +}; + +const del = (self, node) => { + if (node) { + const hit = node.value; + if (self[DISPOSE]) + self[DISPOSE](hit.key, hit.value); + + self[LENGTH] -= hit.length; + self[CACHE].delete(hit.key); + self[LRU_LIST].removeNode(node); + } +}; + +class Entry { + constructor (key, value, length, now, maxAge) { + this.key = key; + this.value = value; + this.length = length; + this.now = now; + this.maxAge = maxAge || 0; + } +} + +const forEachStep = (self, fn, node, thisp) => { + let hit = node.value; + if (isStale(self, hit)) { + del(self, node); + if (!self[ALLOW_STALE]) + hit = undefined; + } + if (hit) + fn.call(thisp, hit.value, hit.key, self); +}; + +var lruCache = LRUCache; + +// hoisted class for cyclic dependency +class Range$a { + constructor (range, options) { + options = parseOptions$1(options); + + if (range instanceof Range$a) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range$a(range.raw, options) + } + } + + if (range instanceof Comparator$2) { + // just put it in the set and return + this.raw = range.value; + this.set = [[range]]; + this.format(); + return this + } + + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + + // First, split based on boolean or || + this.raw = range; + this.set = range + .split(/\s*\|\|\s*/) + // map the range to a 2d array of comparators + .map(range => this.parseRange(range.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length); + + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${range}`) + } + + // if we have any that are not the null set, throw out null sets. + if (this.set.length > 1) { + // keep the first one, in case they're all null sets + const first = this.set[0]; + this.set = this.set.filter(c => !isNullSet(c[0])); + if (this.set.length === 0) + this.set = [first]; + else if (this.set.length > 1) { + // if we have any that are *, then the range is just * + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c]; + break + } + } + } + } + + this.format(); + } + + format () { + this.range = this.set + .map((comps) => { + return comps.join(' ').trim() + }) + .join('||') + .trim(); + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + range = range.trim(); + + // memoize range parsing for performance. + // this is a very hot path, and fully deterministic. + const memoOpts = Object.keys(this.options).join(','); + const memoKey = `parseRange:${memoOpts}:${range}`; + const cached = cache$1.get(memoKey); + if (cached) + return cached + + const loose = this.options.loose; + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re$2[t$1.HYPHENRANGELOOSE] : re$2[t$1.HYPHENRANGE]; + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)); + debug$d('hyphen replace', range); + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re$2[t$1.COMPARATORTRIM], comparatorTrimReplace); + debug$d('comparator trim', range, re$2[t$1.COMPARATORTRIM]); + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re$2[t$1.TILDETRIM], tildeTrimReplace); + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re$2[t$1.CARETTRIM], caretTrimReplace); + + // normalize spaces + range = range.split(/\s+/).join(' '); + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + const compRe = loose ? re$2[t$1.COMPARATORLOOSE] : re$2[t$1.COMPARATOR]; + const rangeList = range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + // >=0.0.0 is equivalent to * + .map(comp => replaceGTE0(comp, this.options)) + // in loose mode, throw out any that are not valid comparators + .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) + .map(comp => new Comparator$2(comp, this.options)); + + // if any comparators are the null set, then replace with JUST null set + // if more than one comparator, remove any * comparators + // also, don't include the same comparator more than once + rangeList.length; + const rangeMap = new Map(); + for (const comp of rangeList) { + if (isNullSet(comp)) + return [comp] + rangeMap.set(comp.value, comp); + } + if (rangeMap.size > 1 && rangeMap.has('')) + rangeMap.delete(''); + + const result = [...rangeMap.values()]; + cache$1.set(memoKey, result); + return result + } + + intersects (range, options) { + if (!(range instanceof Range$a)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) + } + + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer$5(version, this.options); + } catch (er) { + return false + } + } + + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false + } +} +var range$1 = Range$a; + +const LRU = lruCache; +const cache$1 = new LRU({ max: 1000 }); + +const parseOptions$1 = parseOptions_1; +const Comparator$2 = comparator$1; +const debug$d = debug_1; +const SemVer$5 = semver$2; +const { + re: re$2, + t: t$1, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace +} = re$6.exports; + +const isNullSet = c => c.value === '<0.0.0-0'; +const isAny = c => c.value === ''; + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true; + const remainingComparators = comparators.slice(); + let testComparator = remainingComparators.pop(); + + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }); + + testComparator = remainingComparators.pop(); + } + + return result +}; + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug$d('comp', comp, options); + comp = replaceCarets(comp, options); + debug$d('caret', comp); + comp = replaceTildes(comp, options); + debug$d('tildes', comp); + comp = replaceXRanges(comp, options); + debug$d('xrange', comp); + comp = replaceStars(comp, options); + debug$d('stars', comp); + return comp +}; + +const isX = id => !id || id.toLowerCase() === 'x' || id === '*'; + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +const replaceTildes = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceTilde(comp, options) + }).join(' '); + +const replaceTilde = (comp, options) => { + const r = options.loose ? re$2[t$1.TILDELOOSE] : re$2[t$1.TILDE]; + return comp.replace(r, (_, M, m, p, pr) => { + debug$d('tilde', comp, _, M, m, p, pr); + let ret; + + if (isX(M)) { + ret = ''; + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0`; + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`; + } else if (pr) { + debug$d('replaceTilde pr', pr); + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0`; + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0`; + } + + debug$d('tilde return', ret); + return ret + }) +}; + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +const replaceCarets = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceCaret(comp, options) + }).join(' '); + +const replaceCaret = (comp, options) => { + debug$d('caret', comp, options); + const r = options.loose ? re$2[t$1.CARETLOOSE] : re$2[t$1.CARET]; + const z = options.includePrerelease ? '-0' : ''; + return comp.replace(r, (_, M, m, p, pr) => { + debug$d('caret', comp, _, M, m, p, pr); + let ret; + + if (isX(M)) { + ret = ''; + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`; + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`; + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`; + } + } else if (pr) { + debug$d('replaceCaret pr', pr); + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0`; + } + } else { + debug$d('no pr'); + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0`; + } + } + + debug$d('caret return', ret); + return ret + }) +}; + +const replaceXRanges = (comp, options) => { + debug$d('replaceXRanges', comp, options); + return comp.split(/\s+/).map((comp) => { + return replaceXRange(comp, options) + }).join(' ') +}; + +const replaceXRange = (comp, options) => { + comp = comp.trim(); + const r = options.loose ? re$2[t$1.XRANGELOOSE] : re$2[t$1.XRANGE]; + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug$d('xRange', comp, ret, gtlt, M, m, p, pr); + const xM = isX(M); + const xm = xM || isX(m); + const xp = xm || isX(p); + const anyX = xp; + + if (gtlt === '=' && anyX) { + gtlt = ''; + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : ''; + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0'; + } else { + // nothing is forbidden + ret = '*'; + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0; + } + p = 0; + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>='; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else { + m = +m + 1; + p = 0; + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<'; + if (xm) { + M = +M + 1; + } else { + m = +m + 1; + } + } + + if (gtlt === '<') + pr = '-0'; + + ret = `${gtlt + M}.${m}.${p}${pr}`; + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`; + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0`; + } + + debug$d('xRange return', ret); + + return ret + }) +}; + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug$d('replaceStars', comp, options); + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re$2[t$1.STAR], '') +}; + +const replaceGTE0 = (comp, options) => { + debug$d('replaceGTE0', comp, options); + return comp.trim() + .replace(re$2[options.includePrerelease ? t$1.GTE0PRE : t$1.GTE0], '') +}; + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) => { + if (isX(fM)) { + from = ''; + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}`; + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`; + } else if (fpr) { + from = `>=${from}`; + } else { + from = `>=${from}${incPr ? '-0' : ''}`; + } + + if (isX(tM)) { + to = ''; + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0`; + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0`; + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}`; + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0`; + } else { + to = `<=${to}`; + } + + return (`${from} ${to}`).trim() +}; + +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug$d(set[i].semver); + if (set[i].semver === Comparator$2.ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver; + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +}; + +const ANY$2 = Symbol('SemVer ANY'); +// hoisted class for cyclic dependency +class Comparator$1 { + static get ANY () { + return ANY$2 + } + constructor (comp, options) { + options = parseOptions(options); + + if (comp instanceof Comparator$1) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value; + } + } + + debug$c('comparator', comp, options); + this.options = options; + this.loose = !!options.loose; + this.parse(comp); + + if (this.semver === ANY$2) { + this.value = ''; + } else { + this.value = this.operator + this.semver.version; + } + + debug$c('comp', this); + } + + parse (comp) { + const r = this.options.loose ? re$1[t.COMPARATORLOOSE] : re$1[t.COMPARATOR]; + const m = comp.match(r); + + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } + + this.operator = m[1] !== undefined ? m[1] : ''; + if (this.operator === '=') { + this.operator = ''; + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY$2; + } else { + this.semver = new SemVer$4(m[2], this.options.loose); + } + } + + toString () { + return this.value + } + + test (version) { + debug$c('Comparator.test', version, this.options.loose); + + if (this.semver === ANY$2 || version === ANY$2) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer$4(version, this.options); + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator$1)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } + + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range$9(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range$9(this.value, options).test(comp.semver) + } + + const sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>'); + const sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<'); + const sameSemVer = this.semver.version === comp.semver.version; + const differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<='); + const oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<'); + const oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>'); + + return ( + sameDirectionIncreasing || + sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || + oppositeDirectionsGreaterThan + ) + } +} + +var comparator$1 = Comparator$1; + +const parseOptions = parseOptions_1; +const {re: re$1, t} = re$6.exports; +const cmp = cmp_1; +const debug$c = debug_1; +const SemVer$4 = semver$2; +const Range$9 = range$1; + +const Range$8 = range$1; +const satisfies$3 = (version, range, options) => { + try { + range = new Range$8(range, options); + } catch (er) { + return false + } + return range.test(version) +}; +var satisfies_1 = satisfies$3; + +const Range$7 = range$1; + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range$7(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')); + +var toComparators_1 = toComparators; + +const SemVer$3 = semver$2; +const Range$6 = range$1; + +const maxSatisfying = (versions, range, options) => { + let max = null; + let maxSV = null; + let rangeObj = null; + try { + rangeObj = new Range$6(range, options); + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v; + maxSV = new SemVer$3(max, options); + } + } + }); + return max +}; +var maxSatisfying_1 = maxSatisfying; - return resolveFileName(); +const SemVer$2 = semver$2; +const Range$5 = range$1; +const minSatisfying = (versions, range, options) => { + let min = null; + let minSV = null; + let rangeObj = null; + try { + rangeObj = new Range$5(range, options); + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v; + minSV = new SemVer$2(min, options); + } + } + }); + return min }; +var minSatisfying_1 = minSatisfying; + +const SemVer$1 = semver$2; +const Range$4 = range$1; +const gt$1 = gt_1; + +const minVersion = (range, loose) => { + range = new Range$4(range, loose); + + let minver = new SemVer$1('0.0.0'); + if (range.test(minver)) { + return minver + } + + minver = new SemVer$1('0.0.0-0'); + if (range.test(minver)) { + return minver + } + + minver = null; + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i]; + + let setMin = null; + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer$1(comparator.semver.version); + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++; + } else { + compver.prerelease.push(0); + } + compver.raw = compver.format(); + /* fallthrough */ + case '': + case '>=': + if (!setMin || gt$1(compver, setMin)) { + setMin = compver; + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }); + if (setMin && (!minver || gt$1(minver, setMin))) + minver = setMin; + } + + if (minver && range.test(minver)) { + return minver + } + + return null +}; +var minVersion_1 = minVersion; + +const Range$3 = range$1; +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range$3(range, options).range || '*' + } catch (er) { + return null + } +}; +var valid = validRange; + +const SemVer = semver$2; +const Comparator = comparator$1; +const {ANY: ANY$1} = Comparator; +const Range$2 = range$1; +const satisfies$2 = satisfies_1; +const gt = gt_1; +const lt = lt_1; +const lte$1 = lte_1; +const gte$1 = gte_1; + +const outside$2 = (version, range, hilo, options) => { + version = new SemVer(version, options); + range = new Range$2(range, options); + + let gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte$1; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break + case '<': + gtfn = lt; + ltefn = gte$1; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisfies the range it is not outside + if (satisfies$2(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i]; + + let high = null; + let low = null; + + comparators.forEach((comparator) => { + if (comparator.semver === ANY$1) { + comparator = new Comparator('>=0.0.0'); + } + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator; + } + }); + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +}; + +var outside_1 = outside$2; + +// Determine if version is greater than all the versions possible in the range. +const outside$1 = outside_1; +const gtr = (version, range, options) => outside$1(version, range, '>', options); +var gtr_1 = gtr; + +const outside = outside_1; +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options); +var ltr_1 = ltr; + +const Range$1 = range$1; +const intersects = (r1, r2, options) => { + r1 = new Range$1(r1, options); + r2 = new Range$1(r2, options); + return r1.intersects(r2) +}; +var intersects_1 = intersects; + +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies$1 = satisfies_1; +const compare$2 = compare_1; +var simplify = (versions, range, options) => { + const set = []; + let min = null; + let prev = null; + const v = versions.sort((a, b) => compare$2(a, b, options)); + for (const version of v) { + const included = satisfies$1(version, range, options); + if (included) { + prev = version; + if (!min) + min = version; + } else { + if (prev) { + set.push([min, prev]); + } + prev = null; + min = null; + } + } + if (min) + set.push([min, null]); + + const ranges = []; + for (const [min, max] of set) { + if (min === max) + ranges.push(min); + else if (!max && min === v[0]) + ranges.push('*'); + else if (!max) + ranges.push(`>=${min}`); + else if (min === v[0]) + ranges.push(`<=${max}`); + else + ranges.push(`${min} - ${max}`); + } + const simplified = ranges.join(' || '); + const original = typeof range.raw === 'string' ? range.raw : String(range); + return simplified.length < original.length ? simplified : range +}; + +const Range = range$1; +const { ANY } = comparator$1; +const satisfies = satisfies_1; +const compare$1 = compare_1; + +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else return false +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT.semver is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If LT +// - If LT.semver is greater than any < or <= comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If any C is a = range, and GT or LT are set, return false +// - Else return true + +const subset = (sub, dom, options) => { + if (sub === dom) + return true + + sub = new Range(sub, options); + dom = new Range(dom, options); + let sawNonNull = false; + + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options); + sawNonNull = sawNonNull || isSub !== null; + if (isSub) + continue OUTER + } + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) + return false + } + return true +}; + +const simpleSubset = (sub, dom, options) => { + if (sub === dom) + return true + + if (sub.length === 1 && sub[0].semver === ANY) + return dom.length === 1 && dom[0].semver === ANY + + const eqSet = new Set(); + let gt, lt; + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') + gt = higherGT(gt, c, options); + else if (c.operator === '<' || c.operator === '<=') + lt = lowerLT(lt, c, options); + else + eqSet.add(c.semver); + } + + if (eqSet.size > 1) + return null + + let gtltComp; + if (gt && lt) { + gtltComp = compare$1(gt.semver, lt.semver, options); + if (gtltComp > 0) + return null + else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) + return null + } + + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) + return null + + if (lt && !satisfies(eq, String(lt), options)) + return null + + for (const c of dom) { + if (!satisfies(eq, String(c), options)) + return false + } + + return true + } + + let higher, lower; + let hasDomLT, hasDomGT; + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='; + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='; + if (gt) { + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options); + if (higher === c && higher !== gt) + return false + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) + return false + } + if (lt) { + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options); + if (lower === c && lower !== lt) + return false + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) + return false + } + if (!c.operator && (lt || gt) && gtltComp !== 0) + return false + } + + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) + return false + + if (lt && hasDomGT && !gt && gtltComp !== 0) + return false + + return true +}; + +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) + return b + const comp = compare$1(a.semver, b.semver, options); + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a +}; + +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) + return b + const comp = compare$1(a.semver, b.semver, options); + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a +}; + +var subset_1 = subset; + +// just pre-load all the stuff that index.js lazily exports +const internalRe = re$6.exports; +var semver$1 = { + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + SemVer: semver$2, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers, + parse: parse_1, + valid: valid_1, + clean: clean_1, + inc: inc_1, + diff: diff_1, + major: major_1, + minor: minor_1, + patch: patch_1, + prerelease: prerelease_1, + compare: compare_1, + rcompare: rcompare_1, + compareLoose: compareLoose_1, + compareBuild: compareBuild_1, + sort: sort_1, + rsort: rsort_1, + gt: gt_1, + lt: lt_1, + eq: eq_1, + neq: neq_1, + gte: gte_1, + lte: lte_1, + cmp: cmp_1, + coerce: coerce_1, + Comparator: comparator$1, + Range: range$1, + satisfies: satisfies_1, + toComparators: toComparators_1, + maxSatisfying: maxSatisfying_1, + minSatisfying: minSatisfying_1, + minVersion: minVersion_1, + validRange: valid, + outside: outside_1, + gtr: gtr_1, + ltr: ltr_1, + intersects: intersects_1, + simplifyRange: simplify, + subset: subset_1, +}; + +var semver = semver$1; + +var builtins = function ({ + version = process.version, + experimental = false +} = {}) { + var coreModules = [ + 'assert', + 'buffer', + 'child_process', + 'cluster', + 'console', + 'constants', + 'crypto', + 'dgram', + 'dns', + 'domain', + 'events', + 'fs', + 'http', + 'https', + 'module', + 'net', + 'os', + 'path', + 'punycode', + 'querystring', + 'readline', + 'repl', + 'stream', + 'string_decoder', + 'sys', + 'timers', + 'tls', + 'tty', + 'url', + 'util', + 'vm', + 'zlib' + ]; + + if (semver.lt(version, '6.0.0')) coreModules.push('freelist'); + if (semver.gte(version, '1.0.0')) coreModules.push('v8'); + if (semver.gte(version, '1.1.0')) coreModules.push('process'); + if (semver.gte(version, '8.0.0')) coreModules.push('inspector'); + if (semver.gte(version, '8.1.0')) coreModules.push('async_hooks'); + if (semver.gte(version, '8.4.0')) coreModules.push('http2'); + if (semver.gte(version, '8.5.0')) coreModules.push('perf_hooks'); + if (semver.gte(version, '10.0.0')) coreModules.push('trace_events'); + + if ( + semver.gte(version, '10.5.0') && + (experimental || semver.gte(version, '12.0.0')) + ) { + coreModules.push('worker_threads'); + } + if (semver.gte(version, '12.16.0') && experimental) { + coreModules.push('wasi'); + } + + return coreModules +}; + +// Manually “tree shaken” from: + +const reader = {read: read$3}; +var packageJsonReader = reader; + +/** + * @param {string} jsonPath + * @returns {{string: string}} + */ +function read$3(jsonPath) { + return find$1(path$b.dirname(jsonPath)) +} + +/** + * @param {string} dir + * @returns {{string: string}} + */ +function find$1(dir) { + try { + const string = require$$0$3.readFileSync( + path$b.toNamespacedPath(path$b.join(dir, 'package.json')), + 'utf8' + ); + return {string} + } catch (error) { + if (error.code === 'ENOENT') { + const parent = path$b.dirname(dir); + if (dir !== parent) return find$1(parent) + return {string: undefined} + // Throw all other errors. + /* c8 ignore next 4 */ + } + + throw error + } +} + +// Manually “tree shaken” from: + +const isWindows$1 = process.platform === 'win32'; + +const own$e = {}.hasOwnProperty; + +const codes = {}; + +/** + * @typedef {(...args: unknown[]) => string} MessageFunction + */ + +/** @type {Map<string, MessageFunction|string>} */ +const messages = new Map(); +const nodeInternalPrefix = '__node_internal_'; +/** @type {number} */ +let userStackTraceLimit; + +codes.ERR_INVALID_MODULE_SPECIFIER = createError( + 'ERR_INVALID_MODULE_SPECIFIER', + /** + * @param {string} request + * @param {string} reason + * @param {string} [base] + */ + (request, reason, base = undefined) => { + return `Invalid module "${request}" ${reason}${ + base ? ` imported from ${base}` : '' + }` + }, + TypeError +); + +codes.ERR_INVALID_PACKAGE_CONFIG = createError( + 'ERR_INVALID_PACKAGE_CONFIG', + /** + * @param {string} path + * @param {string} [base] + * @param {string} [message] + */ + (path, base, message) => { + return `Invalid package config ${path}${ + base ? ` while importing ${base}` : '' + }${message ? `. ${message}` : ''}` + }, + Error +); + +codes.ERR_INVALID_PACKAGE_TARGET = createError( + 'ERR_INVALID_PACKAGE_TARGET', + /** + * @param {string} pkgPath + * @param {string} key + * @param {unknown} target + * @param {boolean} [isImport=false] + * @param {string} [base] + */ + (pkgPath, key, target, isImport = false, base = undefined) => { + const relError = + typeof target === 'string' && + !isImport && + target.length > 0 && + !target.startsWith('./'); + if (key === '.') { + assert$2(isImport === false); + return ( + `Invalid "exports" main target ${JSON.stringify(target)} defined ` + + `in the package config ${pkgPath}package.json${ + base ? ` imported from ${base}` : '' + }${relError ? '; targets must start with "./"' : ''}` + ) + } + + return `Invalid "${ + isImport ? 'imports' : 'exports' + }" target ${JSON.stringify( + target + )} defined for '${key}' in the package config ${pkgPath}package.json${ + base ? ` imported from ${base}` : '' + }${relError ? '; targets must start with "./"' : ''}` + }, + Error +); + +codes.ERR_MODULE_NOT_FOUND = createError( + 'ERR_MODULE_NOT_FOUND', + /** + * @param {string} path + * @param {string} base + * @param {string} [type] + */ + (path, base, type = 'package') => { + return `Cannot find ${type} '${path}' imported from ${base}` + }, + Error +); + +codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError( + 'ERR_PACKAGE_IMPORT_NOT_DEFINED', + /** + * @param {string} specifier + * @param {string} packagePath + * @param {string} base + */ + (specifier, packagePath, base) => { + return `Package import specifier "${specifier}" is not defined${ + packagePath ? ` in package ${packagePath}package.json` : '' + } imported from ${base}` + }, + TypeError +); + +codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError( + 'ERR_PACKAGE_PATH_NOT_EXPORTED', + /** + * @param {string} pkgPath + * @param {string} subpath + * @param {string} [base] + */ + (pkgPath, subpath, base = undefined) => { + if (subpath === '.') + return `No "exports" main defined in ${pkgPath}package.json${ + base ? ` imported from ${base}` : '' + }` + return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${ + base ? ` imported from ${base}` : '' + }` + }, + Error +); + +codes.ERR_UNSUPPORTED_DIR_IMPORT = createError( + 'ERR_UNSUPPORTED_DIR_IMPORT', + "Directory import '%s' is not supported " + + 'resolving ES modules imported from %s', + Error +); + +codes.ERR_UNKNOWN_FILE_EXTENSION = createError( + 'ERR_UNKNOWN_FILE_EXTENSION', + 'Unknown file extension "%s" for %s', + TypeError +); + +codes.ERR_INVALID_ARG_VALUE = createError( + 'ERR_INVALID_ARG_VALUE', + /** + * @param {string} name + * @param {unknown} value + * @param {string} [reason='is invalid'] + */ + (name, value, reason = 'is invalid') => { + let inspected = inspect$1(value); + + if (inspected.length > 128) { + inspected = `${inspected.slice(0, 128)}...`; + } + + const type = name.includes('.') ? 'property' : 'argument'; + + return `The ${type} '${name}' ${reason}. Received ${inspected}` + }, + TypeError + // Note: extra classes have been shaken out. + // , RangeError +); + +codes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError( + 'ERR_UNSUPPORTED_ESM_URL_SCHEME', + /** + * @param {URL} url + */ + (url) => { + let message = + 'Only file and data URLs are supported by the default ESM loader'; + + if (isWindows$1 && url.protocol.length === 2) { + message += '. On Windows, absolute paths must be valid file:// URLs'; + } + + message += `. Received protocol '${url.protocol}'`; + return message + }, + Error +); + +/** + * Utility function for registering the error codes. Only used here. Exported + * *only* to allow for testing. + * @param {string} sym + * @param {MessageFunction|string} value + * @param {ErrorConstructor} def + * @returns {new (...args: unknown[]) => Error} + */ +function createError(sym, value, def) { + // Special case for SystemError that formats the error message differently + // The SystemErrors only have SystemError as their base classes. + messages.set(sym, value); + + return makeNodeErrorWithCode(def, sym) +} + +/** + * @param {ErrorConstructor} Base + * @param {string} key + * @returns {ErrorConstructor} + */ +function makeNodeErrorWithCode(Base, key) { + // @ts-expect-error It’s a Node error. + return NodeError + /** + * @param {unknown[]} args + */ + function NodeError(...args) { + const limit = Error.stackTraceLimit; + if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; + const error = new Base(); + // Reset the limit and setting the name property. + if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit; + const message = getMessage(key, args, error); + Object.defineProperty(error, 'message', { + value: message, + enumerable: false, + writable: true, + configurable: true + }); + Object.defineProperty(error, 'toString', { + /** @this {Error} */ + value() { + return `${this.name} [${key}]: ${this.message}` + }, + enumerable: false, + writable: true, + configurable: true + }); + addCodeToName(error, Base.name, key); + // @ts-expect-error It’s a Node error. + error.code = key; + return error + } +} + +const addCodeToName = hideStackFrames( + /** + * @param {Error} error + * @param {string} name + * @param {string} code + * @returns {void} + */ + function (error, name, code) { + // Set the stack + error = captureLargerStackTrace(error); + // Add the error code to the name to include it in the stack trace. + error.name = `${name} [${code}]`; + // Access the stack to generate the error message including the error code + // from the name. + error.stack; // eslint-disable-line no-unused-expressions + // Reset the name to the actual name. + if (name === 'SystemError') { + Object.defineProperty(error, 'name', { + value: name, + enumerable: false, + writable: true, + configurable: true + }); + } else { + delete error.name; + } + } +); + +/** + * @returns {boolean} + */ +function isErrorStackTraceLimitWritable() { + const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit'); + if (desc === undefined) { + return Object.isExtensible(Error) + } + + return own$e.call(desc, 'writable') ? desc.writable : desc.set !== undefined +} + +/** + * This function removes unnecessary frames from Node.js core errors. + * @template {(...args: unknown[]) => unknown} T + * @type {(fn: T) => T} + */ +function hideStackFrames(fn) { + // We rename the functions that will be hidden to cut off the stacktrace + // at the outermost one + const hidden = nodeInternalPrefix + fn.name; + Object.defineProperty(fn, 'name', {value: hidden}); + return fn +} + +const captureLargerStackTrace = hideStackFrames( + /** + * @param {Error} error + * @returns {Error} + */ + function (error) { + const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable(); + if (stackTraceLimitIsWritable) { + userStackTraceLimit = Error.stackTraceLimit; + Error.stackTraceLimit = Number.POSITIVE_INFINITY; + } + + Error.captureStackTrace(error); + + // Reset the limit + if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit; + + return error + } +); + +/** + * @param {string} key + * @param {unknown[]} args + * @param {Error} self + * @returns {string} + */ +function getMessage(key, args, self) { + const message = messages.get(key); + + if (typeof message === 'function') { + assert$2( + message.length <= args.length, // Default options do not count. + `Code: ${key}; The provided arguments length (${args.length}) does not ` + + `match the required ones (${message.length}).` + ); + return Reflect.apply(message, self, args) + } + + const expectedLength = (message.match(/%[dfijoOs]/g) || []).length; + assert$2( + expectedLength === args.length, + `Code: ${key}; The provided arguments length (${args.length}) does not ` + + `match the required ones (${expectedLength}).` + ); + if (args.length === 0) return message + + args.unshift(message); + return Reflect.apply(format$2, null, args) +} + +// Manually “tree shaken” from: + +const {ERR_UNKNOWN_FILE_EXTENSION} = codes; + +const extensionFormatMap = { + __proto__: null, + '.cjs': 'commonjs', + '.js': 'module', + '.mjs': 'module' +}; + +/** + * @param {string} url + * @returns {{format: string|null}} + */ +function defaultGetFormat(url) { + if (url.startsWith('node:')) { + return {format: 'builtin'} + } + + const parsed = new URL$1(url); + + if (parsed.protocol === 'data:') { + const {1: mime} = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec( + parsed.pathname + ) || [null, null]; + const format = mime === 'text/javascript' ? 'module' : null; + return {format} + } + + if (parsed.protocol === 'file:') { + const ext = path$b.extname(parsed.pathname); + /** @type {string} */ + let format; + if (ext === '.js') { + format = getPackageType(parsed.href) === 'module' ? 'module' : 'commonjs'; + } else { + format = extensionFormatMap[ext]; + } + + if (!format) { + throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url)) + } + + return {format: format || null} + } + + return {format: null} +} + +// Manually “tree shaken” from: + +const listOfBuiltins = builtins(); + +const { + ERR_INVALID_MODULE_SPECIFIER, + ERR_INVALID_PACKAGE_CONFIG, + ERR_INVALID_PACKAGE_TARGET, + ERR_MODULE_NOT_FOUND, + ERR_PACKAGE_IMPORT_NOT_DEFINED, + ERR_PACKAGE_PATH_NOT_EXPORTED, + ERR_UNSUPPORTED_DIR_IMPORT, + ERR_UNSUPPORTED_ESM_URL_SCHEME, + ERR_INVALID_ARG_VALUE +} = codes; + +const own$d = {}.hasOwnProperty; + +const DEFAULT_CONDITIONS = Object.freeze(['node', 'import']); +const DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS); + +const invalidSegmentRegEx = /(^|\\|\/)(\.\.?|node_modules)(\\|\/|$)/; +const patternRegEx = /\*/g; +const encodedSepRegEx = /%2f|%2c/i; +/** @type {Set<string>} */ +const emittedPackageWarnings = new Set(); +/** @type {Map<string, PackageConfig>} */ +const packageJsonCache = new Map(); + +/** + * @param {string} match + * @param {URL} pjsonUrl + * @param {boolean} isExports + * @param {URL} base + * @returns {void} + */ +function emitFolderMapDeprecation(match, pjsonUrl, isExports, base) { + const pjsonPath = fileURLToPath(pjsonUrl); + + if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return + emittedPackageWarnings.add(pjsonPath + '|' + match); + process.emitWarning( + `Use of deprecated folder mapping "${match}" in the ${ + isExports ? '"exports"' : '"imports"' + } field module resolution of the package at ${pjsonPath}${ + base ? ` imported from ${fileURLToPath(base)}` : '' + }.\n` + + `Update this package.json to use a subpath pattern like "${match}*".`, + 'DeprecationWarning', + 'DEP0148' + ); +} + +/** + * @param {URL} url + * @param {URL} packageJsonUrl + * @param {URL} base + * @param {unknown} [main] + * @returns {void} + */ +function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) { + const {format} = defaultGetFormat(url.href); + if (format !== 'module') return + const path = fileURLToPath(url.href); + const pkgPath = fileURLToPath(new URL$1('.', packageJsonUrl)); + const basePath = fileURLToPath(base); + if (main) + process.emitWarning( + `Package ${pkgPath} has a "main" field set to ${JSON.stringify(main)}, ` + + `excluding the full filename and extension to the resolved file at "${path.slice( + pkgPath.length + )}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is` + + 'deprecated for ES modules.', + 'DeprecationWarning', + 'DEP0151' + ); + else + process.emitWarning( + `No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${path.slice( + pkgPath.length + )}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, + 'DeprecationWarning', + 'DEP0151' + ); +} + +/** + * @param {string[]} [conditions] + * @returns {Set<string>} + */ +function getConditionsSet(conditions) { + if (conditions !== undefined && conditions !== DEFAULT_CONDITIONS) { + if (!Array.isArray(conditions)) { + throw new ERR_INVALID_ARG_VALUE( + 'conditions', + conditions, + 'expected an array' + ) + } + + return new Set(conditions) + } + + return DEFAULT_CONDITIONS_SET +} + +/** + * @param {string} path + * @returns {Stats} + */ +function tryStatSync(path) { + // Note: from Node 15 onwards we can use `throwIfNoEntry: false` instead. + try { + return statSync(path) + } catch { + return new Stats() + } +} + +/** + * @param {string} path + * @param {string|URL} specifier Note: `specifier` is actually optional, not base. + * @param {URL} [base] + * @returns {PackageConfig} + */ +function getPackageConfig(path, specifier, base) { + const existing = packageJsonCache.get(path); + if (existing !== undefined) { + return existing + } + + const source = packageJsonReader.read(path).string; + + if (source === undefined) { + /** @type {PackageConfig} */ + const packageConfig = { + pjsonPath: path, + exists: false, + main: undefined, + name: undefined, + type: 'none', + exports: undefined, + imports: undefined + }; + packageJsonCache.set(path, packageConfig); + return packageConfig + } + + /** @type {Object.<string, unknown>} */ + let packageJson; + try { + packageJson = JSON.parse(source); + } catch (error) { + throw new ERR_INVALID_PACKAGE_CONFIG( + path, + (base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier), + error.message + ) + } + + const {exports, imports, main, name, type} = packageJson; + + /** @type {PackageConfig} */ + const packageConfig = { + pjsonPath: path, + exists: true, + main: typeof main === 'string' ? main : undefined, + name: typeof name === 'string' ? name : undefined, + type: type === 'module' || type === 'commonjs' ? type : 'none', + // @ts-expect-error Assume `Object.<string, unknown>`. + exports, + // @ts-expect-error Assume `Object.<string, unknown>`. + imports: imports && typeof imports === 'object' ? imports : undefined + }; + packageJsonCache.set(path, packageConfig); + return packageConfig +} + +/** + * @param {URL|string} resolved + * @returns {PackageConfig} + */ +function getPackageScopeConfig(resolved) { + let packageJsonUrl = new URL$1('./package.json', resolved); + + while (true) { + const packageJsonPath = packageJsonUrl.pathname; + + if (packageJsonPath.endsWith('node_modules/package.json')) break + + const packageConfig = getPackageConfig( + fileURLToPath(packageJsonUrl), + resolved + ); + if (packageConfig.exists) return packageConfig + + const lastPackageJsonUrl = packageJsonUrl; + packageJsonUrl = new URL$1('../package.json', packageJsonUrl); + + // Terminates at root where ../package.json equals ../../package.json + // (can't just check "/package.json" for Windows support). + if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) break + } + + const packageJsonPath = fileURLToPath(packageJsonUrl); + /** @type {PackageConfig} */ + const packageConfig = { + pjsonPath: packageJsonPath, + exists: false, + main: undefined, + name: undefined, + type: 'none', + exports: undefined, + imports: undefined + }; + packageJsonCache.set(packageJsonPath, packageConfig); + return packageConfig +} + +/** + * Legacy CommonJS main resolution: + * 1. let M = pkg_url + (json main field) + * 2. TRY(M, M.js, M.json, M.node) + * 3. TRY(M/index.js, M/index.json, M/index.node) + * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node) + * 5. NOT_FOUND + * + * @param {URL} url + * @returns {boolean} + */ +function fileExists(url) { + return tryStatSync(fileURLToPath(url)).isFile() +} + +/** + * @param {URL} packageJsonUrl + * @param {PackageConfig} packageConfig + * @param {URL} base + * @returns {URL} + */ +function legacyMainResolve(packageJsonUrl, packageConfig, base) { + /** @type {URL} */ + let guess; + if (packageConfig.main !== undefined) { + guess = new URL$1(`./${packageConfig.main}`, packageJsonUrl); + // Note: fs check redundances will be handled by Descriptor cache here. + if (fileExists(guess)) return guess + + const tries = [ + `./${packageConfig.main}.js`, + `./${packageConfig.main}.json`, + `./${packageConfig.main}.node`, + `./${packageConfig.main}/index.js`, + `./${packageConfig.main}/index.json`, + `./${packageConfig.main}/index.node` + ]; + let i = -1; + + while (++i < tries.length) { + guess = new URL$1(tries[i], packageJsonUrl); + if (fileExists(guess)) break + guess = undefined; + } + + if (guess) { + emitLegacyIndexDeprecation( + guess, + packageJsonUrl, + base, + packageConfig.main + ); + return guess + } + // Fallthrough. + } + + const tries = ['./index.js', './index.json', './index.node']; + let i = -1; + + while (++i < tries.length) { + guess = new URL$1(tries[i], packageJsonUrl); + if (fileExists(guess)) break + guess = undefined; + } + + if (guess) { + emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main); + return guess + } + + // Not found. + throw new ERR_MODULE_NOT_FOUND( + fileURLToPath(new URL$1('.', packageJsonUrl)), + fileURLToPath(base) + ) +} + +/** + * @param {URL} resolved + * @param {URL} base + * @returns {URL} + */ +function finalizeResolution(resolved, base) { + if (encodedSepRegEx.test(resolved.pathname)) + throw new ERR_INVALID_MODULE_SPECIFIER( + resolved.pathname, + 'must not include encoded "/" or "\\" characters', + fileURLToPath(base) + ) + + const path = fileURLToPath(resolved); + + const stats = tryStatSync(path.endsWith('/') ? path.slice(-1) : path); + + if (stats.isDirectory()) { + const error = new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base)); + // @ts-expect-error Add this for `import.meta.resolve`. + error.url = String(resolved); + throw error + } + + if (!stats.isFile()) { + throw new ERR_MODULE_NOT_FOUND( + path || resolved.pathname, + base && fileURLToPath(base), + 'module' + ) + } + + return resolved +} + +/** + * @param {string} specifier + * @param {URL?} packageJsonUrl + * @param {URL} base + * @returns {never} + */ +function throwImportNotDefined(specifier, packageJsonUrl, base) { + throw new ERR_PACKAGE_IMPORT_NOT_DEFINED( + specifier, + packageJsonUrl && fileURLToPath(new URL$1('.', packageJsonUrl)), + fileURLToPath(base) + ) +} + +/** + * @param {string} subpath + * @param {URL} packageJsonUrl + * @param {URL} base + * @returns {never} + */ +function throwExportsNotFound(subpath, packageJsonUrl, base) { + throw new ERR_PACKAGE_PATH_NOT_EXPORTED( + fileURLToPath(new URL$1('.', packageJsonUrl)), + subpath, + base && fileURLToPath(base) + ) +} + +/** + * @param {string} subpath + * @param {URL} packageJsonUrl + * @param {boolean} internal + * @param {URL} [base] + * @returns {never} + */ +function throwInvalidSubpath(subpath, packageJsonUrl, internal, base) { + const reason = `request is not a valid subpath for the "${ + internal ? 'imports' : 'exports' + }" resolution of ${fileURLToPath(packageJsonUrl)}`; + + throw new ERR_INVALID_MODULE_SPECIFIER( + subpath, + reason, + base && fileURLToPath(base) + ) +} + +/** + * @param {string} subpath + * @param {unknown} target + * @param {URL} packageJsonUrl + * @param {boolean} internal + * @param {URL} [base] + * @returns {never} + */ +function throwInvalidPackageTarget( + subpath, + target, + packageJsonUrl, + internal, + base +) { + target = + typeof target === 'object' && target !== null + ? JSON.stringify(target, null, '') + : `${target}`; + + throw new ERR_INVALID_PACKAGE_TARGET( + fileURLToPath(new URL$1('.', packageJsonUrl)), + subpath, + target, + internal, + base && fileURLToPath(base) + ) +} + +/** + * @param {string} target + * @param {string} subpath + * @param {string} match + * @param {URL} packageJsonUrl + * @param {URL} base + * @param {boolean} pattern + * @param {boolean} internal + * @param {Set<string>} conditions + * @returns {URL} + */ +function resolvePackageTargetString( + target, + subpath, + match, + packageJsonUrl, + base, + pattern, + internal, + conditions +) { + if (subpath !== '' && !pattern && target[target.length - 1] !== '/') + throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); + + if (!target.startsWith('./')) { + if (internal && !target.startsWith('../') && !target.startsWith('/')) { + let isURL = false; + + try { + new URL$1(target); + isURL = true; + } catch {} + + if (!isURL) { + const exportTarget = pattern + ? target.replace(patternRegEx, subpath) + : target + subpath; + + return packageResolve(exportTarget, packageJsonUrl, conditions) + } + } + + throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); + } + + if (invalidSegmentRegEx.test(target.slice(2))) + throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); + + const resolved = new URL$1(target, packageJsonUrl); + const resolvedPath = resolved.pathname; + const packagePath = new URL$1('.', packageJsonUrl).pathname; + + if (!resolvedPath.startsWith(packagePath)) + throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); + + if (subpath === '') return resolved + + if (invalidSegmentRegEx.test(subpath)) + throwInvalidSubpath(match + subpath, packageJsonUrl, internal, base); + + if (pattern) return new URL$1(resolved.href.replace(patternRegEx, subpath)) + return new URL$1(subpath, resolved) +} + +/** + * @param {string} key + * @returns {boolean} + */ +function isArrayIndex(key) { + const keyNumber = Number(key); + if (`${keyNumber}` !== key) return false + return keyNumber >= 0 && keyNumber < 0xffff_ffff +} + +/** + * @param {URL} packageJsonUrl + * @param {unknown} target + * @param {string} subpath + * @param {string} packageSubpath + * @param {URL} base + * @param {boolean} pattern + * @param {boolean} internal + * @param {Set<string>} conditions + * @returns {URL} + */ +function resolvePackageTarget( + packageJsonUrl, + target, + subpath, + packageSubpath, + base, + pattern, + internal, + conditions +) { + if (typeof target === 'string') { + return resolvePackageTargetString( + target, + subpath, + packageSubpath, + packageJsonUrl, + base, + pattern, + internal, + conditions + ) + } + + if (Array.isArray(target)) { + /** @type {unknown[]} */ + const targetList = target; + if (targetList.length === 0) return null + + /** @type {Error} */ + let lastException; + let i = -1; + + while (++i < targetList.length) { + const targetItem = targetList[i]; + /** @type {URL} */ + let resolved; + try { + resolved = resolvePackageTarget( + packageJsonUrl, + targetItem, + subpath, + packageSubpath, + base, + pattern, + internal, + conditions + ); + } catch (error) { + lastException = error; + if (error.code === 'ERR_INVALID_PACKAGE_TARGET') continue + throw error + } + + if (resolved === undefined) continue + + if (resolved === null) { + lastException = null; + continue + } + + return resolved + } + + if (lastException === undefined || lastException === null) { + // @ts-expect-error The diff between `undefined` and `null` seems to be + // intentional + return lastException + } + + throw lastException + } + + if (typeof target === 'object' && target !== null) { + const keys = Object.getOwnPropertyNames(target); + let i = -1; + + while (++i < keys.length) { + const key = keys[i]; + if (isArrayIndex(key)) { + throw new ERR_INVALID_PACKAGE_CONFIG( + fileURLToPath(packageJsonUrl), + base, + '"exports" cannot contain numeric property keys.' + ) + } + } + + i = -1; + + while (++i < keys.length) { + const key = keys[i]; + if (key === 'default' || (conditions && conditions.has(key))) { + /** @type {unknown} */ + const conditionalTarget = target[key]; + const resolved = resolvePackageTarget( + packageJsonUrl, + conditionalTarget, + subpath, + packageSubpath, + base, + pattern, + internal, + conditions + ); + if (resolved === undefined) continue + return resolved + } + } + + return undefined + } + + if (target === null) { + return null + } + + throwInvalidPackageTarget( + packageSubpath, + target, + packageJsonUrl, + internal, + base + ); +} + +/** + * @param {unknown} exports + * @param {URL} packageJsonUrl + * @param {URL} base + * @returns {boolean} + */ +function isConditionalExportsMainSugar(exports, packageJsonUrl, base) { + if (typeof exports === 'string' || Array.isArray(exports)) return true + if (typeof exports !== 'object' || exports === null) return false + + const keys = Object.getOwnPropertyNames(exports); + let isConditionalSugar = false; + let i = 0; + let j = -1; + while (++j < keys.length) { + const key = keys[j]; + const curIsConditionalSugar = key === '' || key[0] !== '.'; + if (i++ === 0) { + isConditionalSugar = curIsConditionalSugar; + } else if (isConditionalSugar !== curIsConditionalSugar) { + throw new ERR_INVALID_PACKAGE_CONFIG( + fileURLToPath(packageJsonUrl), + base, + '"exports" cannot contain some keys starting with \'.\' and some not.' + + ' The exports object must either be an object of package subpath keys' + + ' or an object of main entry condition name keys only.' + ) + } + } + + return isConditionalSugar +} + +/** + * @param {URL} packageJsonUrl + * @param {string} packageSubpath + * @param {Object.<string, unknown>} packageConfig + * @param {URL} base + * @param {Set<string>} conditions + * @returns {ResolveObject} + */ +function packageExportsResolve( + packageJsonUrl, + packageSubpath, + packageConfig, + base, + conditions +) { + let exports = packageConfig.exports; + if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) + exports = {'.': exports}; + + if (own$d.call(exports, packageSubpath)) { + const target = exports[packageSubpath]; + const resolved = resolvePackageTarget( + packageJsonUrl, + target, + '', + packageSubpath, + base, + false, + false, + conditions + ); + if (resolved === null || resolved === undefined) + throwExportsNotFound(packageSubpath, packageJsonUrl, base); + return {resolved, exact: true} + } + + let bestMatch = ''; + const keys = Object.getOwnPropertyNames(exports); + let i = -1; + + while (++i < keys.length) { + const key = keys[i]; + if ( + key[key.length - 1] === '*' && + packageSubpath.startsWith(key.slice(0, -1)) && + packageSubpath.length >= key.length && + key.length > bestMatch.length + ) { + bestMatch = key; + } else if ( + key[key.length - 1] === '/' && + packageSubpath.startsWith(key) && + key.length > bestMatch.length + ) { + bestMatch = key; + } + } + + if (bestMatch) { + const target = exports[bestMatch]; + const pattern = bestMatch[bestMatch.length - 1] === '*'; + const subpath = packageSubpath.slice(bestMatch.length - (pattern ? 1 : 0)); + const resolved = resolvePackageTarget( + packageJsonUrl, + target, + subpath, + bestMatch, + base, + pattern, + false, + conditions + ); + if (resolved === null || resolved === undefined) + throwExportsNotFound(packageSubpath, packageJsonUrl, base); + if (!pattern) + emitFolderMapDeprecation(bestMatch, packageJsonUrl, true, base); + return {resolved, exact: pattern} + } + + throwExportsNotFound(packageSubpath, packageJsonUrl, base); +} -resolveFrom$1.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId); -resolveFrom$1.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true); +/** + * @param {string} name + * @param {URL} base + * @param {Set<string>} [conditions] + * @returns {ResolveObject} + */ +function packageImportsResolve(name, base, conditions) { + if (name === '#' || name.startsWith('#/')) { + const reason = 'is not a valid internal imports specifier name'; + throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base)) + } + + /** @type {URL} */ + let packageJsonUrl; + + const packageConfig = getPackageScopeConfig(base); + + if (packageConfig.exists) { + packageJsonUrl = pathToFileURL(packageConfig.pjsonPath); + const imports = packageConfig.imports; + if (imports) { + if (own$d.call(imports, name)) { + const resolved = resolvePackageTarget( + packageJsonUrl, + imports[name], + '', + name, + base, + false, + true, + conditions + ); + if (resolved !== null) return {resolved, exact: true} + } else { + let bestMatch = ''; + const keys = Object.getOwnPropertyNames(imports); + let i = -1; + + while (++i < keys.length) { + const key = keys[i]; + + if ( + key[key.length - 1] === '*' && + name.startsWith(key.slice(0, -1)) && + name.length >= key.length && + key.length > bestMatch.length + ) { + bestMatch = key; + } else if ( + key[key.length - 1] === '/' && + name.startsWith(key) && + key.length > bestMatch.length + ) { + bestMatch = key; + } + } + + if (bestMatch) { + const target = imports[bestMatch]; + const pattern = bestMatch[bestMatch.length - 1] === '*'; + const subpath = name.slice(bestMatch.length - (pattern ? 1 : 0)); + const resolved = resolvePackageTarget( + packageJsonUrl, + target, + subpath, + bestMatch, + base, + pattern, + true, + conditions + ); + if (resolved !== null) { + if (!pattern) + emitFolderMapDeprecation(bestMatch, packageJsonUrl, false, base); + return {resolved, exact: pattern} + } + } + } + } + } + + throwImportNotDefined(name, packageJsonUrl, base); +} + +/** + * @param {string} url + * @returns {PackageType} + */ +function getPackageType(url) { + const packageConfig = getPackageScopeConfig(url); + return packageConfig.type +} + +/** + * @param {string} specifier + * @param {URL} base + */ +function parsePackageName(specifier, base) { + let separatorIndex = specifier.indexOf('/'); + let validPackageName = true; + let isScoped = false; + if (specifier[0] === '@') { + isScoped = true; + if (separatorIndex === -1 || specifier.length === 0) { + validPackageName = false; + } else { + separatorIndex = specifier.indexOf('/', separatorIndex + 1); + } + } + + const packageName = + separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex); + + // Package name cannot have leading . and cannot have percent-encoding or + // separators. + let i = -1; + while (++i < packageName.length) { + if (packageName[i] === '%' || packageName[i] === '\\') { + validPackageName = false; + break + } + } + + if (!validPackageName) { + throw new ERR_INVALID_MODULE_SPECIFIER( + specifier, + 'is not a valid package name', + fileURLToPath(base) + ) + } + + const packageSubpath = + '.' + (separatorIndex === -1 ? '' : specifier.slice(separatorIndex)); + + return {packageName, packageSubpath, isScoped} +} + +/** + * @param {string} specifier + * @param {URL} base + * @param {Set<string>} conditions + * @returns {URL} + */ +function packageResolve(specifier, base, conditions) { + const {packageName, packageSubpath, isScoped} = parsePackageName( + specifier, + base + ); + + // ResolveSelf + const packageConfig = getPackageScopeConfig(base); + + // Can’t test. + /* c8 ignore next 16 */ + if (packageConfig.exists) { + const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath); + if ( + packageConfig.name === packageName && + packageConfig.exports !== undefined && + packageConfig.exports !== null + ) { + return packageExportsResolve( + packageJsonUrl, + packageSubpath, + packageConfig, + base, + conditions + ).resolved + } + } + + let packageJsonUrl = new URL$1( + './node_modules/' + packageName + '/package.json', + base + ); + let packageJsonPath = fileURLToPath(packageJsonUrl); + /** @type {string} */ + let lastPath; + do { + const stat = tryStatSync(packageJsonPath.slice(0, -13)); + if (!stat.isDirectory()) { + lastPath = packageJsonPath; + packageJsonUrl = new URL$1( + (isScoped ? '../../../../node_modules/' : '../../../node_modules/') + + packageName + + '/package.json', + packageJsonUrl + ); + packageJsonPath = fileURLToPath(packageJsonUrl); + continue + } + + // Package match. + const packageConfig = getPackageConfig(packageJsonPath, specifier, base); + if (packageConfig.exports !== undefined && packageConfig.exports !== null) + return packageExportsResolve( + packageJsonUrl, + packageSubpath, + packageConfig, + base, + conditions + ).resolved + if (packageSubpath === '.') + return legacyMainResolve(packageJsonUrl, packageConfig, base) + return new URL$1(packageSubpath, packageJsonUrl) + // Cross-platform root check. + } while (packageJsonPath.length !== lastPath.length) + + throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base)) +} + +/** + * @param {string} specifier + * @returns {boolean} + */ +function isRelativeSpecifier(specifier) { + if (specifier[0] === '.') { + if (specifier.length === 1 || specifier[1] === '/') return true + if ( + specifier[1] === '.' && + (specifier.length === 2 || specifier[2] === '/') + ) { + return true + } + } + + return false +} + +/** + * @param {string} specifier + * @returns {boolean} + */ +function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { + if (specifier === '') return false + if (specifier[0] === '/') return true + return isRelativeSpecifier(specifier) +} + +/** + * The “Resolver Algorithm Specification” as detailed in the Node docs (which is + * sync and slightly lower-level than `resolve`). + * + * + * + * @param {string} specifier + * @param {URL} base + * @param {Set<string>} [conditions] + * @returns {URL} + */ +function moduleResolve(specifier, base, conditions) { + // Order swapped from spec for minor perf gain. + // Ok since relative URLs cannot parse as URLs. + /** @type {URL} */ + let resolved; + + if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { + resolved = new URL$1(specifier, base); + } else if (specifier[0] === '#') { +({resolved} = packageImportsResolve(specifier, base, conditions)); + } else { + try { + resolved = new URL$1(specifier); + } catch { + resolved = packageResolve(specifier, base, conditions); + } + } + + return finalizeResolution(resolved, base) +} + +/** + * @param {string} specifier + * @param {{parentURL?: string, conditions?: string[]}} context + * @returns {{url: string}} + */ +function defaultResolve(specifier, context = {}) { + const {parentURL} = context; + /** @type {URL} */ + let parsed; + + try { + parsed = new URL$1(specifier); + if (parsed.protocol === 'data:') { + return {url: specifier} + } + } catch {} + + if (parsed && parsed.protocol === 'node:') return {url: specifier} + if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:') + throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed) + + if (listOfBuiltins.includes(specifier)) { + return {url: 'node:' + specifier} + } + + if (parentURL.startsWith('data:')) { + // This is gonna blow up, we want the error + new URL$1(specifier, parentURL); + } + + const conditions = getConditionsSet(context.conditions); + let url = moduleResolve(specifier, new URL$1(parentURL), conditions); + + const urlPath = fileURLToPath(url); + const real = realpathSync$1(urlPath); + const old = url; + url = pathToFileURL(real + (urlPath.endsWith(path$b.sep) ? '/' : '')); + url.search = old.search; + url.hash = old.hash; + + return {url: `${url}`} +} + +/** + * Provides a module-relative resolution function scoped to each module, + * returning the URL string. + * `import.meta.resolve` also accepts a second argument which is the parent + * module from which to resolve from. + * + * This function is asynchronous because the ES module resolver in Node.js is + * allowed to be asynchronous. + * + * @param {string} specifier The module specifier to resolve relative to parent. + * @param {string} parent The absolute parent module URL to resolve from. + * You should pass `import.meta.url` or something else + * @returns {Promise<string>} + */ +async function resolve(specifier, parent) { + if (!parent) { + throw new Error( + 'Please pass `parent`: `import-meta-resolve` cannot ponyfill that' + ) + } + + try { + return defaultResolve(specifier, {parentURL: parent}).url + } catch (error) { + return error.code === 'ERR_UNSUPPORTED_DIR_IMPORT' + ? error.url + : Promise.reject(error) + } +} var libnpmconfig = {}; @@ -8134,7 +20584,7 @@ class FiggyPudding { } } try { - const util = require$$0__default['default']; + const util = require$$0$4; FiggyPudding.prototype[util.inspect.custom] = function (depth, opts) { return ( this[Symbol.toStringTag] + ' ' @@ -8249,23 +20699,23 @@ function entries (obj) { return Object.keys(obj).map(k => [k, obj[k]]) } -var findUp$2 = {exports: {}}; +var findUp$1 = {exports: {}}; var locatePath$1 = {exports: {}}; var pathExists$1 = {exports: {}}; -const fs$i = require$$0__default$3['default']; +const fs$5 = require$$0$3; pathExists$1.exports = fp => new Promise(resolve => { - fs$i.access(fp, err => { + fs$5.access(fp, err => { resolve(!err); }); }); pathExists$1.exports.sync = fp => { try { - fs$i.accessSync(fp); + fs$5.accessSync(fp); return true; } catch (err) { return false; @@ -8375,7 +20825,7 @@ var pLocate$1 = (iterable, tester, opts) => { .catch(err => err instanceof EndError ? err.value : Promise.reject(err)); }; -const path$k = require$$0__default$2['default']; +const path$7 = path$b; const pathExists = pathExists$1.exports; const pLocate = pLocate$1; @@ -8384,7 +20834,7 @@ locatePath$1.exports = (iterable, options) => { cwd: process.cwd() }, options); - return pLocate(iterable, el => pathExists(path$k.resolve(options.cwd, el)), options); + return pLocate(iterable, el => pathExists(path$7.resolve(options.cwd, el)), options); }; locatePath$1.exports.sync = (iterable, options) => { @@ -8393,18 +20843,18 @@ locatePath$1.exports.sync = (iterable, options) => { }, options); for (const el of iterable) { - if (pathExists.sync(path$k.resolve(options.cwd, el))) { + if (pathExists.sync(path$7.resolve(options.cwd, el))) { return el; } } }; -const path$j = require$$0__default$2['default']; +const path$6 = path$b; const locatePath = locatePath$1.exports; -findUp$2.exports = (filename, opts = {}) => { - const startDir = path$j.resolve(opts.cwd || ''); - const {root} = path$j.parse(startDir); +findUp$1.exports = (filename, opts = {}) => { + const startDir = path$6.resolve(opts.cwd || ''); + const {root} = path$6.parse(startDir); const filenames = [].concat(filename); @@ -8412,20 +20862,20 @@ findUp$2.exports = (filename, opts = {}) => { (function find(dir) { locatePath(filenames, {cwd: dir}).then(file => { if (file) { - resolve(path$j.join(dir, file)); + resolve(path$6.join(dir, file)); } else if (dir === root) { resolve(null); } else { - find(path$j.dirname(dir)); + find(path$6.dirname(dir)); } }); })(startDir); }); }; -findUp$2.exports.sync = (filename, opts = {}) => { - let dir = path$j.resolve(opts.cwd || ''); - const {root} = path$j.parse(dir); +findUp$1.exports.sync = (filename, opts = {}) => { + let dir = path$6.resolve(opts.cwd || ''); + const {root} = path$6.parse(dir); const filenames = [].concat(filename); @@ -8434,27 +20884,27 @@ findUp$2.exports.sync = (filename, opts = {}) => { const file = locatePath.sync(filenames, {cwd: dir}); if (file) { - return path$j.join(dir, file); + return path$6.join(dir, file); } if (dir === root) { return null; } - dir = path$j.dirname(dir); + dir = path$6.dirname(dir); } }; var ini$1 = {}; -ini$1.parse = ini$1.decode = decode$2; +ini$1.parse = ini$1.decode = decode; ini$1.stringify = ini$1.encode = encode$1; -ini$1.safe = safe$8; +ini$1.safe = safe$1; ini$1.unsafe = unsafe$1; -var eol$2 = typeof process !== 'undefined' && +var eol$1 = typeof process !== 'undefined' && process.platform === 'win32' ? '\r\n' : '\n'; function encode$1 (obj, opt) { @@ -8477,16 +20927,16 @@ function encode$1 (obj, opt) { var val = obj[k]; if (val && Array.isArray(val)) { val.forEach(function (item) { - out += safe$8(k + '[]') + separator + safe$8(item) + '\n'; + out += safe$1(k + '[]') + separator + safe$1(item) + '\n'; }); } else if (val && typeof val === 'object') children.push(k); else - out += safe$8(k) + separator + safe$8(val) + eol$2; + out += safe$1(k) + separator + safe$1(val) + eol$1; }); if (opt.section && out.length) - out = '[' + safe$8(opt.section) + ']' + eol$2 + out; + out = '[' + safe$1(opt.section) + ']' + eol$1 + out; children.forEach(function (k, _, __) { var nk = dotSplit(k).join('\\.'); @@ -8496,7 +20946,7 @@ function encode$1 (obj, opt) { whitespace: opt.whitespace, }); if (out.length && child.length) - out += eol$2; + out += eol$1; out += child; }); @@ -8513,7 +20963,7 @@ function dotSplit (str) { }) } -function decode$2 (str) { +function decode (str) { var out = {}; var p = out; var section = null; @@ -8605,7 +21055,7 @@ function isQuoted (val) { (val.charAt(0) === "'" && val.slice(-1) === "'") } -function safe$8 (val) { +function safe$1 (val) { return (typeof val !== 'string' || val.match(/[=\r\n]/) || val.match(/^\[/) || @@ -8654,12 +21104,12 @@ function unsafe$1 (val, doUnesc) { return val } -const fs$h = require$$0__default$3['default']; +const fs$4 = require$$0$3; const figgyPudding = figgyPudding_1; -const findUp$1 = findUp$2.exports; +const findUp = findUp$1.exports; const ini = ini$1; -const os$1 = require$$0__default$1['default']; -const path$i = require$$0__default$2['default']; +const os = require$$0$2; +const path$5 = path$b; const NpmConfig = figgyPudding({}, { // Open up the pudding object. @@ -8667,14 +21117,14 @@ const NpmConfig = figgyPudding({}, { }); const ConfigOpts = figgyPudding({ - cache: { default: path$i.join(os$1.homedir(), '.npm') }, + cache: { default: path$5.join(os.homedir(), '.npm') }, configNames: { default: ['npmrc', '.npmrc'] }, envPrefix: { default: /^npm_config_/i }, cwd: { default: () => process.cwd() }, globalconfig: { - default: () => path$i.join(getGlobalPrefix(), 'etc', 'npmrc') + default: () => path$5.join(getGlobalPrefix(), 'etc', 'npmrc') }, - userconfig: { default: path$i.join(os$1.homedir(), '.npmrc') } + userconfig: { default: path$5.join(os.homedir(), '.npmrc') } }); libnpmconfig.read = getNpmConfig; @@ -8701,7 +21151,7 @@ function getNpmConfig (_opts, _builtin) { env.globalconfig ); const global = globalConfPath && maybeReadIni(globalConfPath); - const projConfPath = findUp$1.sync(builtin.configNames, { cwd: builtin.cwd }); + const projConfPath = findUp.sync(builtin.configNames, { cwd: builtin.cwd }); let proj = {}; if (projConfPath && projConfPath !== userConfPath) { proj = maybeReadIni(projConfPath); @@ -8709,17 +21159,17 @@ function getNpmConfig (_opts, _builtin) { const newOpts = NpmConfig(builtin, global, user, proj, env, cli); if (newOpts.cache) { return newOpts.concat({ - cache: path$i.resolve( + cache: path$5.resolve( ( (cli.cache || env.cache) ? builtin.cwd : proj.cache - ? path$i.dirname(projConfPath) + ? path$5.dirname(projConfPath) : user.cache - ? path$i.dirname(userConfPath) + ? path$5.dirname(userConfPath) : global.cache - ? path$i.dirname(globalConfPath) - : path$i.dirname(userConfPath) + ? path$5.dirname(globalConfPath) + : path$5.dirname(userConfPath) ), newOpts.cache ) @@ -8732,7 +21182,7 @@ function getNpmConfig (_opts, _builtin) { function maybeReadIni (f) { let txt; try { - txt = fs$h.readFileSync(f, 'utf8'); + txt = fs$4.readFileSync(f, 'utf8'); } catch (err) { if (err.code === 'ENOENT') { return '' @@ -8748,59 +21198,64 @@ function getGlobalPrefix () { return process.env.PREFIX } else if (process.platform === 'win32') { // c:\node\node.exe --> prefix=c:\node\ - return path$i.dirname(process.execPath) + return path$5.dirname(process.execPath) } else { // /usr/local/bin/node --> prefix=/usr/local - let pref = path$i.dirname(path$i.dirname(process.execPath)); + let pref = path$5.dirname(path$5.dirname(process.execPath)); // destdir only is respected on Unix if (process.env.DESTDIR) { - pref = path$i.join(process.env.DESTDIR, pref); + pref = path$5.join(process.env.DESTDIR, pref); } return pref } } -var fs$g = require$$0__default$3['default']; -var path$h = require$$0__default$2['default']; -var resolve = resolveFrom$1.exports.silent; -var readNpmConfig = libnpmconfig.read; - -var loadPlugin_1 = loadPlugin$1; -loadPlugin$1.resolve = resolvePlugin; +/** + * @typedef ResolveOptions + * @property {string} [prefix] + * @property {string|string[]} [cwd] + * @property {boolean} [global] + */ -var electron = process.versions.electron !== undefined; -var windows = process.platform === 'win32'; +const electron = process.versions.electron !== undefined; +const windows = process.platform === 'win32'; -var argv = process.argv[1] || /* istanbul ignore next */ ''; -var nvm = process.env.NVM_BIN; -var appData = process.env.APPDATA; +const argv = process.argv[1] || /* c8 ignore next */ ''; +const nvm = process.env.NVM_BIN; +const appData = process.env.APPDATA; -/* istanbul ignore next */ -var globalsLibrary = windows ? '' : 'lib'; +/* c8 ignore next */ +const globalsLibrary = windows ? '' : 'lib'; -var builtinNpmConfig; +/** @type {{prefix?: string}} */ +let builtinNpmConfig; // The prefix config defaults to the location where node is installed. // On Windows, this is in a place called `%AppData%`, which we have to // pass to `libnpmconfig` explicitly: -/* istanbul ignore next */ +/* c8 ignore next 4 */ if (windows && appData) { - builtinNpmConfig = {prefix: path$h.join(appData, 'npm')}; + builtinNpmConfig = {prefix: path$b.join(appData, 'npm')}; } -var npmPrefix = readNpmConfig(null, builtinNpmConfig).prefix; +/** + * Note: `libnpmconfig` uses `figgy-pudding` which is slated for archival. + * Either `libnpmconfig` will switch to an alternative or we’ll have to. + * @type {string} + */ +let npmPrefix = libnpmconfig.read(null, builtinNpmConfig).prefix; // If there is no prefix defined, use the defaults // See: <https://github.com/eush77/npm-prefix/blob/master/index.js> -/* istanbul ignore next */ +/* c8 ignore next 5 */ if (!npmPrefix) { npmPrefix = windows - ? path$h.dirname(process.execPath) - : path$h.resolve(process.execPath, '../..'); + ? path$b.dirname(process.execPath) + : path$b.resolve(process.execPath, '../..'); } -var globally = electron || argv.indexOf(npmPrefix) === 0; -var globals = path$h.resolve(npmPrefix, globalsLibrary, 'node_modules'); +const globalsDefault = electron || argv.indexOf(npmPrefix) === 0; +let globalDir = path$b.resolve(npmPrefix, globalsLibrary, 'node_modules'); // If we’re in Electron, we’re running in a modified Node that cannot really // install global node modules. @@ -8810,63 +21265,74 @@ var globals = path$h.resolve(npmPrefix, globalsLibrary, 'node_modules'); // versions of Node. // Luckily NVM leaks some environment variables that we can pick up on to try // and detect the actual modules. -/* istanbul ignore next */ -if (electron && nvm && !fs$g.existsSync(globals)) { - globals = path$h.resolve(nvm, '..', globalsLibrary, 'node_modules'); +/* c8 ignore next 3 */ +if (electron && nvm && !require$$0$3.existsSync(globalDir)) { + globalDir = path$b.resolve(nvm, '..', globalsLibrary, 'node_modules'); } -// Load the plugin found using `resolvePlugin`. -function loadPlugin$1(name, options) { - return commonjsRequire(resolvePlugin(name, options) || name) +/** + * Load the plugin found using `resolvePlugin`. + * + * @param {string} name The name to import. + * @param {LoadOptions} [options] + * @returns {Promise<unknown>} + */ +async function loadPlugin(name, options = {}) { + const {key = 'default', ...rest} = options; + const fp = await resolvePlugin(name, rest); + /** @type {Object.<string, unknown>} */ + // Bug with coverage on Node@12. + /* c8 ignore next 3 */ + const mod = await import(pathToFileURL(fp).href); + return key === false ? mod : mod[key] } -// Find a plugin. -// -// See also: -// <https://docs.npmjs.com/files/folders#node-modules> -// <https://github.com/sindresorhus/resolve-from> -// -// Uses the standard node module loading strategy to find $name in each given -// `cwd` (and optionally the global `node_modules` directory). -// -// If a prefix is given and $name is not a path, `$prefix-$name` is also -// searched (preferring these over non-prefixed modules). -function resolvePlugin(name, options) { - var settings = options || {}; - var prefix = settings.prefix; - var cwd = settings.cwd; - var global = settings.global; - var filePath; - var sources; - var length; - var index; - var plugin; - var slash; - var scope = ''; - - if (global === null || global === undefined) { - global = globally; - } - - if (cwd && typeof cwd === 'object') { - sources = cwd.concat(); - } else { - sources = [cwd || process.cwd()]; - } +/** + * Find a plugin. + * + * See also: + * * https://docs.npmjs.com/files/folders#node-modules + * * https://github.com/sindresorhus/resolve-from + * + * Uses the standard node module loading strategy to find `$name` in each given + * `cwd` (and optionally the global `node_modules` directory). + * + * If a prefix is given and `$name` is not a path, `$prefix-$name` is also + * searched (preferring these over non-prefixed modules). + * + * @param {string} name + * @param {ResolveOptions} [options] + * @returns {Promise.<string>} + */ +async function resolvePlugin(name, options = {}) { + const prefix = options.prefix + ? options.prefix + + (options.prefix.charAt(options.prefix.length - 1) === '-' ? '' : '-') + : undefined; + const cwd = options.cwd; + const globals = + options.global === undefined || options.global === null + ? globalsDefault + : options.global; + const sources = Array.isArray(cwd) ? cwd.concat() : [cwd || process.cwd()]; + /** @type {string} */ + let plugin; + /** @type {Error} */ + let lastError; // Non-path. if (name.charAt(0) !== '.') { - if (global) { - sources.push(globals); + if (globals) { + sources.push(globalDir); } + let scope = ''; + // Unprefix module. if (prefix) { - prefix = prefix.charAt(prefix.length - 1) === '-' ? prefix : prefix + '-'; - // Scope? if (name.charAt(0) === '@') { - slash = name.indexOf('/'); + const slash = name.indexOf('/'); // Let’s keep the algorithm simple. // No need to care if this is a “valid” scope (I think?). @@ -8885,29 +21351,51 @@ function resolvePlugin(name, options) { } } - length = sources.length; - index = -1; + let index = -1; + /** @type {string} */ + let fp; - while (++index < length) { - cwd = sources[index]; - filePath = (plugin && resolve(cwd, plugin)) || resolve(cwd, name); + while (++index < sources.length) { + fp = plugin && (await attempt(sources[index], plugin)); + if (fp) return fp - if (filePath) { - return filePath - } + fp = await attempt(sources[index], name); + if (fp) return fp } - return null + // There’s always an error. + // Bug with coverage on Node@12. + /* c8 ignore next 8 */ + throw lastError + + /** + * @param {string} base + * @param {string} name + * @returns {Promise<string>} + */ + async function attempt(base, name) { + try { + // `import-meta-resolve` resolves from files, whereas `load-plugin` works + // on folders, which is why we add a `/` at the end. + return fileURLToPath( + await resolve(name, pathToFileURL(base).href + '/') + ) + // Bug with coverage on Node@12. + /* c8 ignore next 1 */ + } catch (error) { + lastError = error; + } + } } -var isPlainObj = value => { +function isPlainObject$1(value) { if (Object.prototype.toString.call(value) !== '[object Object]') { return false; } const prototype = Object.getPrototypeOf(value); return prototype === null || prototype === Object.prototype; -}; +} var format$1 = {exports: {}}; @@ -9027,242 +21515,323 @@ var format$1 = {exports: {}}; var formatter = format$1.exports; -var fault$3 = create$2(Error); - -var fault_1 = fault$3; - -fault$3.eval = create$2(EvalError); -fault$3.range = create$2(RangeError); -fault$3.reference = create$2(ReferenceError); -fault$3.syntax = create$2(SyntaxError); -fault$3.type = create$2(TypeError); -fault$3.uri = create$2(URIError); +// @ts-ignore -fault$3.create = create$2; +var fault = Object.assign(create$1(Error), { + eval: create$1(EvalError), + range: create$1(RangeError), + reference: create$1(ReferenceError), + syntax: create$1(SyntaxError), + type: create$1(TypeError), + uri: create$1(URIError) +}); -// Create a new `EConstructor`, with the formatted `format` as a first argument. -function create$2(EConstructor) { - FormattedError.displayName = EConstructor.displayName || EConstructor.name; +/** + * Create a new `EConstructor`, with the formatted `format` as a first argument. + * + * @template {Error} Fault + * @template {new (reason: string) => Fault} Class + * @param {Class} Constructor + */ +function create$1(Constructor) { + /** @type {string} */ + // @ts-ignore + FormattedError.displayName = Constructor.displayName || Constructor.name; return FormattedError - function FormattedError(format) { - if (format) { - format = formatter.apply(null, arguments); - } - - return new EConstructor(format) + /** + * @param {string} [format] + * @param {...unknown} values + * @returns {Fault} + */ + function FormattedError(format, ...values) { + /** @type {string} */ + var reason = format ? formatter(format, ...values) : format; + return new Constructor(reason) } } -var fs$f = require$$0__default$3['default']; -var path$g = require$$0__default$2['default']; -var fault$2 = fault_1; -var debug$d = src.exports('unified-engine:find-up'); -var wrap$1 = wrap_1; - -var findUp = FindUp$2; +const debug$b = createDebug('unified-engine:find-up'); -FindUp$2.prototype.load = load$4; - -function FindUp$2(options) { - var self = this; - - self.cache = {}; - self.cwd = options.cwd; - self.detect = options.detect; - self.names = options.names; - self.create = options.create; - - if (options.filePath) { - self.givenFilePath = path$g.resolve(options.cwd, options.filePath); - } -} - -function load$4(filePath, callback) { - var self = this; - var givenFile = self.givenFile; - var parent; +/** + * @template Value + */ +class FindUp { + /** + * @callback Create + * @param {Buffer} buf + * @param {string} filePath + * @returns {Promise<Value|undefined>|Value|undefined} + */ - if (self.givenFilePath) { - if (givenFile) { - apply(callback, givenFile); - } else { - givenFile = [callback]; - self.givenFile = givenFile; - debug$d('Checking given file `%s`', self.givenFilePath); - fs$f.readFile(self.givenFilePath, loadGiven); - } + /** + * @callback Callback + * @param {Error|null} error + * @param {Value} [result] + * @returns {void} + */ - return - } + /** + * @typedef Options + * @property {string} cwd + * @property {string|undefined} filePath + * @property {boolean|undefined} [detect] + * @property {string[]} names + * @property {Create} create + */ - if (!self.detect) { - return callback() - } + /** + * @param {Options} options + */ + constructor(options) { + /** @type {Record<string, Callback[]|undefined|Error|Value>} */ + this.cache = {}; + /** @type {string} */ + this.cwd = options.cwd; + /** @type {boolean|undefined} */ + this.detect = options.detect; + /** @type {string[]} */ + this.names = options.names; + /** @type {Create} */ + this.create = options.create; - filePath = path$g.resolve(self.cwd, filePath); - parent = path$g.dirname(filePath); + /** @type {string|undefined} */ + this.givenFilePath = options.filePath + ? path$c.resolve(options.cwd, options.filePath) + : undefined; - if (parent in self.cache) { - apply(callback, self.cache[parent]); - } else { - self.cache[parent] = [callback]; - find(parent); + /* eslint-disable no-unused-expressions */ + /** @type {Error|Value|Callback[]|undefined} */ + this.givenFile; + /* eslint-enable no-unused-expressions */ } - function loadGiven(error, buf) { - var cbs = self.givenFile; - var result; - - if (error) { - result = fault$2( - 'Cannot read given file `%s`\n%s', - path$g.relative(self.cwd, self.givenFilePath), - error.stack - ); - result.code = 'ENOENT'; - result.path = error.path; - result.syscall = error.syscall; - loaded(result); - } else { - wrap$1(self.create, onparse)(buf, self.givenFilePath); - } - - function onparse(error, result) { - if (error) { - debug$d(error.message); - loaded( - fault$2( - 'Cannot parse given file `%s`\n%s', - path$g.relative(self.cwd, self.givenFilePath), - error.stack - ) - ); + /** + * @param {string} filePath + * @param {Callback} callback + */ + load(filePath, callback) { + const self = this; + const givenFile = this.givenFile; + const {givenFilePath} = this; + + if (givenFilePath) { + if (givenFile) { + apply(callback, givenFile); } else { - debug$d('Read given file `%s`', self.givenFilePath); - loaded(result); + const cbs = [callback]; + this.givenFile = cbs; + debug$b('Checking given file `%s`', givenFilePath); + fs$a.readFile(givenFilePath, (error, buf) => { + if (error) { + /** @type {NodeJS.ErrnoException} */ + const result = fault( + 'Cannot read given file `%s`\n%s', + path$c.relative(this.cwd, givenFilePath), + error.stack + ); + result.code = 'ENOENT'; + result.path = error.path; + result.syscall = error.syscall; + loaded(result); + } else { + wrap(this.create, (error, /** @type {Value} */ result) => { + if (error) { + debug$b(error.message); + loaded( + fault( + 'Cannot parse given file `%s`\n%s', + path$c.relative(this.cwd, givenFilePath), + error.stack + ) + ); + } else { + debug$b('Read given file `%s`', givenFilePath); + loaded(result); + } + })(buf, givenFilePath); + } + + /** @param {Error|Value} result */ + function loaded(result) { + self.givenFile = result; + applyAll(cbs, result); + } + }); } + + return } - function loaded(result) { - givenFile = result; - self.givenFile = result; - applyAll(cbs, result); + if (!this.detect) { + return callback(null) } - } - function find(directory) { - var index = -1; + filePath = path$c.resolve(this.cwd, filePath); + const parent = path$c.dirname(filePath); - next(); + if (parent in this.cache) { + apply(callback, this.cache[parent]); + } else { + this.cache[parent] = [callback]; + find(parent); + } - function next() { - var parent; + /** + * @param {string} directory + */ + function find(directory) { + let index = -1; - // Try to read the next file. - // We do not use `readdir` because on huge directories, that could be - // *very* slow. - if (++index < self.names.length) { - fs$f.readFile(path$g.join(directory, self.names[index]), done); - } else { - parent = path$g.dirname(directory); + next(); - if (directory === parent) { - debug$d('No files found for `%s`', filePath); - found(); - } else if (parent in self.cache) { - apply(found, self.cache[parent]); + function next() { + // Try to read the next file. + // We do not use `readdir` because on huge directories, that could be + // *very* slow. + if (++index < self.names.length) { + fs$a.readFile(path$c.join(directory, self.names[index]), done); } else { - self.cache[parent] = [found]; - find(parent); - } - } - } - - function done(error, buf) { - var fp = path$g.join(directory, self.names[index]); + const parent = path$c.dirname(directory); - /* istanbul ignore if - Hard to test. */ - if (error) { - if (error.code === 'ENOENT') { - return next() + if (directory === parent) { + debug$b('No files found for `%s`', filePath); + found(null); + } else if (parent in self.cache) { + apply(found, self.cache[parent]); + } else { + self.cache[parent] = [found]; + find(parent); + } } - - debug$d(error.message); - return found( - fault$2( - 'Cannot read file `%s`\n%s', - path$g.relative(self.cwd, fp), - error.message - ) - ) } - wrap$1(self.create, onparse)(buf, fp); + /** + * @param {NodeJS.ErrnoException|null} error + * @param {Buffer} [buf] + * @returns {void} + */ + function done(error, buf) { + const fp = path$c.join(directory, self.names[index]); - function onparse(error, result) { if (error) { - found( - fault$2( - 'Cannot parse file `%s`\n%s', - path$g.relative(self.cwd, fp), + // Hard to test. + /* c8 ignore next 13 */ + if (error.code === 'ENOENT') { + return next() + } + + debug$b(error.message); + return found( + fault( + 'Cannot read file `%s`\n%s', + path$c.relative(self.cwd, fp), error.message ) - ); - } else if (result) { - debug$d('Read file `%s`', fp); - found(null, result); - } else { - next(); + ) } + + wrap(self.create, (error, /** @type {Value} */ result) => { + if (error) { + found( + fault( + 'Cannot parse file `%s`\n%s', + path$c.relative(self.cwd, fp), + error.message + ) + ); + } else if (result) { + debug$b('Read file `%s`', fp); + found(null, result); + } else { + next(); + } + })(buf, fp); } - } - function found(error, result) { - var cbs = self.cache[directory]; - self.cache[directory] = error || result; - applyAll(cbs, error || result); + /** + * @param {Error|null} error + * @param {Value} [result] + * @returns {void} + */ + function found(error, result) { + /** @type {Callback[]} */ + // @ts-expect-error: always a list if found. + const cbs = self.cache[directory]; + self.cache[directory] = error || result; + applyAll(cbs, error || result); + } } - } - function applyAll(cbs, result) { - var index = cbs.length; + /** + * @param {Callback[]} cbs + * @param {Value|Error|undefined} result + */ + function applyAll(cbs, result) { + let index = cbs.length; - while (index--) { - apply(cbs[index], result); + while (index--) { + apply(cbs[index], result); + } } - } - function apply(cb, result) { - if ( - result !== null && - typeof result === 'object' && - typeof result[0] === 'function' - ) { - result.push(cb); - } else if (result instanceof Error) { - cb(result); - } else { - cb(null, result); + /** + * @param {Callback} cb + * @param {Value|Error|Callback[]|undefined} result + */ + function apply(cb, result) { + if (Array.isArray(result)) { + result.push(cb); + } else if (result instanceof Error) { + cb(result); + } else { + cb(null, result); + } } } } -var path$f = require$$0__default$2['default']; -var yaml = jsYaml$1; -var json$2 = parseJson_1; -var debug$c = src.exports('unified-engine:configuration'); -var loadPlugin = loadPlugin_1; -var plain$1 = isPlainObj; -var fault$1 = fault_1; -var FindUp$1 = findUp; +/** + * @typedef {import('unified').Plugin<unknown[]>} Plugin + * @typedef {import('unified').PluginTuple<unknown[]>} PluginTuple + * @typedef {import('unified').PluggableList} PluggableList + * + * @typedef {Record<string, unknown>} Settings + * + * @typedef {Record<string, Settings|null|undefined>} PluginIdObject + * @typedef {Array<string|[string, ...unknown[]]>} PluginIdList + * + * @typedef Preset + * @property {Settings} [settings] + * @property {PluggableList|PluginIdObject|PluginIdList|undefined} [plugins] + * + * @typedef Config + * @property {Settings} [settings] + * @property {Array<PluginTuple>} [plugins] + * + * @callback ConfigTransform + * @param {any} config + * @param {string} filePath + * @returns {Preset} + * + * @callback Loader + * @param {Buffer} buf + * @param {string} filePath + * @returns {Promise<Preset|undefined>} + * + * @callback Callback + * @param {Error|null} error + * @param {Config} [result] + * @returns {void} + */ -var configuration = Config; +const debug$a = createDebug('unified-engine:configuration'); -var own$f = {}.hasOwnProperty; +const own$c = {}.hasOwnProperty; -var loaders = { +/** @type {Record<string, Loader>} */ +const loaders = { '.json': loadJson, '.cjs': loadScriptOrModule, '.mjs': loadScriptOrModule, @@ -9271,142 +21840,211 @@ var loaders = { '.yml': loadYaml }; -var defaultLoader = loadJson; +const defaultLoader = loadJson; -Config.prototype.load = load$3; +/** + * @typedef Options + * @property {string} cwd + * @property {string} [packageField] + * @property {string} [pluginPrefix] + * @property {string} [rcName] + * @property {string} [rcPath] + * @property {boolean} [detectConfig] + * @property {ConfigTransform} [configTransform] + * @property {Preset} [defaultConfig] + * @property {Preset['settings']} [settings] + * @property {Preset['plugins']} [plugins] + */ + +class Configuration { + /** + * @param {Options} options + */ + constructor(options) { + /** @type {string[]} */ + const names = []; -function Config(options) { - var names = []; + /** @type {string} */ + this.cwd = options.cwd; + /** @type {string|undefined} */ + this.packageField = options.packageField; + /** @type {string|undefined} */ + this.pluginPrefix = options.pluginPrefix; + /** @type {ConfigTransform|undefined} */ + this.configTransform = options.configTransform; + /** @type {Preset|undefined} */ + this.defaultConfig = options.defaultConfig; + + if (options.rcName) { + names.push( + options.rcName, + options.rcName + '.js', + options.rcName + '.yml', + options.rcName + '.yaml' + ); + debug$a('Looking for `%s` configuration files', names); + } - this.cwd = options.cwd; - this.packageField = options.packageField; - this.pluginPrefix = options.pluginPrefix; - this.configTransform = options.configTransform; - this.defaultConfig = options.defaultConfig; + if (options.packageField) { + names.push('package.json'); + debug$a( + 'Looking for `%s` fields in `package.json` files', + options.packageField + ); + } - if (options.rcName) { - names.push( - options.rcName, - options.rcName + '.js', - options.rcName + '.yml', - options.rcName + '.yaml' - ); - debug$c('Looking for `%s` configuration files', names); - } + /** @type {Preset} */ + this.given = {settings: options.settings, plugins: options.plugins}; + this.create = this.create.bind(this); - if (options.packageField) { - names.push('package.json'); - debug$c( - 'Looking for `%s` fields in `package.json` files', - options.packageField - ); + /** @type {FindUp<Config>} */ + this.findUp = new FindUp({ + cwd: options.cwd, + filePath: options.rcPath, + detect: options.detectConfig, + names, + create: this.create + }); } - this.given = {settings: options.settings, plugins: options.plugins}; - this.create = create$1.bind(this); - - this.findUp = new FindUp$1({ - filePath: options.rcPath, - cwd: options.cwd, - detect: options.detectConfig, - names: names, - create: this.create - }); -} - -function load$3(filePath, callback) { - var self = this; - - self.findUp.load(filePath || path$f.resolve(this.cwd, 'stdin.js'), done); - - function done(error, file) { - if (error || file) { - return callback(error, file) - } + /** + * @param {string} filePath + * @param {Callback} callback + * @returns {void} + */ + load(filePath, callback) { + this.findUp.load( + filePath || path$c.resolve(this.cwd, 'stdin.js'), + (error, file) => { + if (error || file) { + return callback(error, file) + } - self.create().then(function (result) { - callback(null, result); - }, callback); + this.create(undefined, undefined).then((result) => { + callback(null, result); + }, callback); + } + ); } -} -async function create$1(buf, filePath) { - var self = this; - var fn = (filePath && loaders[path$f.extname(filePath)]) || defaultLoader; - var options = {prefix: self.pluginPrefix, cwd: self.cwd}; - var result = {settings: {}, plugins: []}; - var contents; + /** + * @param {Buffer|undefined} buf + * @param {string|undefined} filePath + * @returns {Promise<Config|undefined>} + */ + async create(buf, filePath) { + const options = {prefix: this.pluginPrefix, cwd: this.cwd}; + const result = {settings: {}, plugins: []}; + const extname = filePath ? path$c.extname(filePath) : undefined; + const loader = + extname && extname in loaders ? loaders[extname] : defaultLoader; + /** @type {Preset|undefined} */ + let value; - if (filePath) { - contents = await fn.apply(self, arguments); - } + if (filePath && buf) { + value = await loader.call(this, buf, filePath); - if (self.configTransform && contents !== undefined) { - contents = self.configTransform(contents, filePath); - } + if (this.configTransform && value !== undefined) { + value = this.configTransform(value, filePath); + } + } - // Exit if we did find a `package.json`, but it does not have configuration. - if ( - buf && - contents === undefined && - path$f.basename(filePath) === 'package.json' - ) { - return - } + // Exit if we did find a `package.json`, but it does not have configuration. + if ( + filePath && + value === undefined && + path$c.basename(filePath) === 'package.json' + ) { + return + } - if (contents === undefined) { - if (self.defaultConfig) { - await merge$1( + if (value === undefined) { + if (this.defaultConfig) { + await merge( + result, + this.defaultConfig, + Object.assign({}, options, {root: this.cwd}) + ); + } + } else { + await merge( result, - self.defaultConfig, - Object.assign({}, options, {root: self.cwd}) + value, + // @ts-expect-error: `value` can only exist if w/ `filePath`. + Object.assign({}, options, {root: path$c.dirname(filePath)}) ); } - } else { - await merge$1( + + await merge( result, - contents, - Object.assign({}, options, {root: path$f.dirname(filePath)}) + this.given, + Object.assign({}, options, {root: this.cwd}) ); - } - - await merge$1(result, self.given, Object.assign({}, options, {root: self.cwd})); - return result + // C8 bug on Node@12 + /* c8 ignore next 2 */ + return result + } } -function loadScriptOrModule(_, filePath) { +/** @type {Loader} */ +async function loadScriptOrModule(_, filePath) { + // C8 bug on Node@12 + /* c8 ignore next 4 */ + // @ts-expect-error: Assume it matches config. + // type-coverage:ignore-next-line return loadFromAbsolutePath(filePath, this.cwd) } -function loadYaml(buf, filePath) { - return yaml.safeLoad(buf, {filename: path$f.basename(filePath)}) +/** @type {Loader} */ +async function loadYaml(buf, filePath) { + // C8 bug on Node@12 + /* c8 ignore next 4 */ + // @ts-expect-error: Assume it matches config. + return jsYaml.load(String(buf), {filename: path$c.basename(filePath)}) } -function loadJson(buf, filePath) { - var result = json$2(buf, filePath); - - if (path$f.basename(filePath) === 'package.json') { - result = result[this.packageField]; - } +/** @type {Loader} */ +async function loadJson(buf, filePath) { + /** @type {Record<string, unknown>} */ + const result = parseJson_1(String(buf), filePath); - return result + // C8 bug on Node@12 + /* c8 ignore next 8 */ + // @ts-expect-error: Assume it matches config. + return path$c.basename(filePath) === 'package.json' + ? // @ts-expect-error: `this` is the configuration context, TS doesn’t like + // `this` on callbacks. + // type-coverage:ignore-next-line + result[this.packageField] + : result } -async function merge$1(target, raw, options) { +/** + * @param {Required<Config>} target + * @param {Preset} raw + * @param {{root: string, prefix: string|undefined}} options + * @returns {Promise<Config>} + */ +async function merge(target, raw, options) { if (typeof raw === 'object' && raw !== null) { await addPreset(raw); } else { throw new Error('Expected preset, not `' + raw + '`') } + // C8 bug on Node@12 + /* c8 ignore next 6 */ return target + /** + * @param {Preset} result + */ async function addPreset(result) { - var plugins = result.plugins; + const plugins = result.plugins; if (plugins === null || plugins === undefined) ; else if (typeof plugins === 'object' && plugins !== null) { - await ('length' in plugins ? addEach(plugins) : addIn(plugins)); + await (Array.isArray(plugins) ? addEach(plugins) : addIn(plugins)); } else { throw new Error( 'Expected a list or object of plugins, not `' + plugins + '`' @@ -9414,152 +22052,190 @@ async function merge$1(target, raw, options) { } target.settings = Object.assign({}, target.settings, result.settings); + // C8 bug on Node@12 + /* c8 ignore next 6 */ } + /** + * @param {PluginIdList|PluggableList} result + */ async function addEach(result) { - var index = -1; - var value; + let index = -1; while (++index < result.length) { - value = result[index]; + const value = result[index]; // Keep order sequential instead of parallel. - // eslint-disable-next-line no-await-in-loop - await (value !== null && typeof value === 'object' && 'length' in value - ? use.apply(null, value) - : use(value)); + /* eslint-disable no-await-in-loop */ + // @ts-expect-error: Spreading is fine. + // type-coverage:ignore-next-line + await (Array.isArray(value) ? use(...value) : use(value, undefined)); + /* eslint-enable no-await-in-loop */ } + // C8 bug on Node@12 + /* c8 ignore next 6 */ } + /** + * @param {PluginIdObject} result + */ async function addIn(result) { - var key; + /** @type {string} */ + let key; for (key in result) { - // Keep order sequential instead of parallel. - // eslint-disable-next-line no-await-in-loop - await use(key, result[key]); + if (own$c.call(result, key)) { + // Keep order sequential instead of parallel. + // eslint-disable-next-line no-await-in-loop + await use(key, result[key]); + } } + // C8 bug on Node@12 + /* c8 ignore next 7 */ } + /** + * @param {string|Plugin|Preset} usable + * @param {Settings|null|undefined} value + */ async function use(usable, value) { if (typeof usable === 'string') { await addModule(usable, value); } else if (typeof usable === 'function') { addPlugin(usable, value); } else { - await merge$1(target, usable, options); + await merge(target, usable, options); } + // C8 bug on Node@12 + /* c8 ignore next 7 */ } + /** + * @param {string} id + * @param {Settings|null|undefined} value + */ async function addModule(id, value) { - var fp = loadPlugin.resolve(id, {cwd: options.root, prefix: options.prefix}); - var result; + /** @type {string} */ + let fp; - if (fp) { - result = await loadFromAbsolutePath(fp, options.root); + try { + fp = await resolvePlugin(id, { + cwd: options.root, + prefix: options.prefix + }); + } catch (error) { + addPlugin(() => { + throw fault('Could not find module `%s`\n%s', id, error.stack) + }, value); + return + } - try { - if (typeof result === 'function') { - addPlugin(result, value); - } else { - await merge$1( - target, - result, - Object.assign({}, options, {root: path$f.dirname(fp)}) - ); - } - } catch (_) { - throw fault$1( - 'Error: Expected preset or plugin, not %s, at `%s`', + const result = await loadFromAbsolutePath(fp, options.root); + + try { + if (typeof result === 'function') { + addPlugin(result, value); + } else { + await merge( + target, result, - path$f.relative(options.root, fp) - ) + Object.assign({}, options, {root: path$c.dirname(fp)}) + ); } - } else { - fp = path$f.relative(options.cwd, path$f.resolve(options.root, id)); - addPlugin( - failingModule(fp, new Error('Could not find module `' + id + '`')), - value - ); + } catch { + throw fault( + 'Error: Expected preset or plugin, not %s, at `%s`', + result, + path$c.relative(options.root, fp) + ) } + // C8 bug on Node@12 + /* c8 ignore next 8 */ } - function addPlugin(result, value) { - var entry = find$2(target.plugins, result); + /** + * @param {Plugin} plugin + * @param {Settings|null|undefined} value + * @returns {void} + */ + function addPlugin(plugin, value) { + const entry = find(target.plugins, plugin); + + if (value === null) { + value = undefined; + } if (entry) { reconfigure(entry, value); } else { - target.plugins.push([result, value]); + target.plugins.push([plugin, value]); } } } +/** + * @param {PluginTuple} entry + * @param {Settings|undefined} value + * @returns {void} + */ function reconfigure(entry, value) { - if (plain$1(entry[1]) && plain$1(value)) { + if (isPlainObject$1(entry[1]) && isPlainObject$1(value)) { value = Object.assign({}, entry[1], value); } entry[1] = value; } -function find$2(entries, plugin) { - var index = -1; +/** + * @param {Array<PluginTuple>} entries + * @param {Plugin} plugin + * @returns {PluginTuple|undefined} + */ +function find(entries, plugin) { + let index = -1; while (++index < entries.length) { - if (entries[index][0] === plugin) { - return entries[index] + const entry = entries[index]; + if (entry[0] === plugin) { + return entry } } } -function failingModule(id, error) { - var cache = failingModule.cache || (failingModule.cache = {}); - var submodule = own$f.call(cache, id) ? cache[id] : (cache[id] = fail); - return submodule - function fail() { - throw error - } -} - +/** + * @param {string} fp + * @param {string} base + * @returns {Promise<Plugin|Preset>} + */ async function loadFromAbsolutePath(fp, base) { - var ext = path$f.extname(fp); - var result; - - /* istanbul ignore next - To do next major: Tests don’t run on Node 10 */ - if (ext !== '.mjs') { - try { - result = commonjsRequire(fp); - } catch (error) { - if (ext !== '.cjs' && error.code === 'ERR_REQUIRE_ESM') { - ext = '.mjs'; - } else { - throw fault$1( - 'Cannot parse script `%s`\n%s', - path$f.relative(base, fp), - error.stack - ) - } - } + try { + /** @type {{default?: unknown}} */ + const result = await import(pathToFileURL$1(fp).href); - if (result && typeof result === 'object' && result.__esModule) { - result = result.default; + if (!('default' in result)) { + throw new Error( + 'Expected a plugin or preset exported as the default export' + ) } - } - /* istanbul ignore next - To do next major: Tests don’t run on Node 10 */ - if (ext === '.mjs') { - result = (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(fp)); })).default; + // @ts-expect-error: assume plugin/preset. + return result.default + // C8 bug on Node@12 + /* c8 ignore next 4 */ + } catch (error) { + throw fault('Cannot import `%s`\n%s', path$c.relative(base, fp), error.stack) } - - return result } -var Configuration = configuration; - -var configure_1$2 = configure$6; +/** + * @typedef {import('./index.js').Settings} Settings + */ -function configure$6(context, settings) { +/** + * @param {Context} context + * @param {Settings} settings + */ +function configure$3(context, settings) { context.configuration = new Configuration(settings); } @@ -9584,7 +22260,7 @@ const REGEX_SPLITALL_CRLF = /\r?\n/g; // .. const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/; -const SLASH$1 = '/'; +const SLASH = '/'; const KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore') /* istanbul ignore next */ @@ -9927,7 +22603,7 @@ const createRule = (pattern, ignorecase) => { ) }; -const throwError$1 = (message, Ctor) => { +const throwError = (message, Ctor) => { throw new Ctor(message) }; @@ -9961,7 +22637,7 @@ const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path); checkPath.isNotRelative = isNotRelative; checkPath.convert = p => p; -class Ignore$2 { +class Ignore$1 { constructor ({ ignorecase = true } = {}) { @@ -10064,7 +22740,7 @@ class Ignore$2 { // Supports nullable path && checkPath.convert(originalPath); - checkPath(path, originalPath, throwError$1); + checkPath(path, originalPath, throwError); return this._t(path, cache, checkUnignored, slices) } @@ -10077,7 +22753,7 @@ class Ignore$2 { if (!slices) { // path/to/a.js // ['path', 'to', 'a.js'] - slices = path.split(SLASH$1); + slices = path.split(SLASH); } slices.pop(); @@ -10088,7 +22764,7 @@ class Ignore$2 { } const parent = this._t( - slices.join(SLASH$1) + SLASH$1, + slices.join(SLASH) + SLASH, cache, checkUnignored, slices @@ -10120,19 +22796,19 @@ class Ignore$2 { } } -const factory$5 = options => new Ignore$2(options); +const factory$1 = options => new Ignore$1(options); const returnFalse = () => false; const isPathValid = path => checkPath(path && checkPath.convert(path), path, returnFalse); -factory$5.isPathValid = isPathValid; +factory$1.isPathValid = isPathValid; // Fixes typescript -factory$5.default = factory$5; +factory$1.default = factory$1; -var ignore$2 = factory$5; +var ignore = factory$1; // Windows // -------------------------------------------------------------- @@ -10161,66 +22837,87 @@ if ( || isNotRelative(path); } -var path$e = require$$0__default$2['default']; -var gitignore$1 = ignore$2; -var FindUp = findUp; - -var ignore$1 = Ignore$1; - -Ignore$1.prototype.check = check$5; - -function Ignore$1(options) { - this.cwd = options.cwd; - this.ignorePathResolveFrom = options.ignorePathResolveFrom; - - this.findUp = new FindUp({ - filePath: options.ignorePath, - cwd: options.cwd, - detect: options.detectIgnore, - names: options.ignoreName ? [options.ignoreName] : [], - create: create - }); -} - -function check$5(filePath, callback) { - var self = this; - - self.findUp.load(filePath, done); +/** + * @typedef {import('ignore').Ignore & {filePath: string}} IgnoreConfig + * + * @typedef {'cwd'|'dir'} ResolveFrom + * + * @typedef Options + * @property {string} cwd + * @property {boolean|undefined} detectIgnore + * @property {string|undefined} ignoreName + * @property {string|undefined} ignorePath + * @property {ResolveFrom|undefined} ignorePathResolveFrom + * + * @callback Callback + * @param {Error|null} error + * @param {boolean|undefined} [result] + */ - function done(error, ignore) { - var normal; +class Ignore { + /** + * @param {Options} options + */ + constructor(options) { + /** @type {string} */ + this.cwd = options.cwd; + /** @type {ResolveFrom|undefined} */ + this.ignorePathResolveFrom = options.ignorePathResolveFrom; + + /** @type {FindUp<IgnoreConfig>} */ + this.findUp = new FindUp({ + cwd: options.cwd, + filePath: options.ignorePath, + detect: options.detectIgnore, + names: options.ignoreName ? [options.ignoreName] : [], + create + }); + } - if (error) { - callback(error); - } else if (ignore) { - normal = path$e.relative( - path$e.resolve( - self.cwd, - self.ignorePathResolveFrom === 'cwd' ? '.' : ignore.filePath - ), - path$e.resolve(self.cwd, filePath) - ); + /** + * @param {string} filePath + * @param {Callback} callback + */ + check(filePath, callback) { + this.findUp.load(filePath, (error, ignoreSet) => { + if (error) { + callback(error); + } else if (ignoreSet) { + const normal = path$c.relative( + path$c.resolve( + this.cwd, + this.ignorePathResolveFrom === 'cwd' ? '.' : ignoreSet.filePath + ), + path$c.resolve(this.cwd, filePath) + ); - if ( - normal === '' || - normal === '..' || - normal.charAt(0) === path$e.sep || - normal.slice(0, 3) === '..' + path$e.sep - ) { - callback(null, false); + if ( + normal === '' || + normal === '..' || + normal.charAt(0) === path$c.sep || + normal.slice(0, 3) === '..' + path$c.sep + ) { + callback(null, false); + } else { + callback(null, ignoreSet.ignores(normal)); + } } else { - callback(null, ignore.ignores(normal)); + callback(null, false); } - } else { - callback(null, false); - } + }); } } +/** + * @param {Buffer} buf + * @param {string} filePath + * @returns {IgnoreConfig} + */ function create(buf, filePath) { - var ignore = gitignore$1().add(String(buf)); - ignore.filePath = path$e.dirname(filePath); - return ignore + /** @type {IgnoreConfig} */ + return Object.assign(ignore().add(String(buf)), { + filePath: path$c.dirname(filePath) + }) } var old$1 = {}; @@ -10246,9 +22943,9 @@ var old$1 = {}; // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -var pathModule = require$$0__default$2['default']; -var isWindows$2 = process.platform === 'win32'; -var fs$e = require$$0__default$3['default']; +var pathModule = path$b; +var isWindows = process.platform === 'win32'; +var fs$3 = require$$0$3; // JavaScript implementation of realpath, ported from node pre-v6 @@ -10297,14 +22994,14 @@ pathModule.normalize; // Regexp that finds the next partion of a (partial) path // result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] -if (isWindows$2) { +if (isWindows) { var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; } else { var nextPartRe = /(.*?)(?:[\/]+|$)/g; } // Regex to find the device root, including trailing slash. E.g. 'c:\\'. -if (isWindows$2) { +if (isWindows) { var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; } else { var splitRootRe = /^[\/]*/; @@ -10342,8 +23039,8 @@ old$1.realpathSync = function realpathSync(p, cache) { previous = ''; // On windows, check that the root exists. On unix there is no need. - if (isWindows$2 && !knownHard[base]) { - fs$e.lstatSync(base); + if (isWindows && !knownHard[base]) { + fs$3.lstatSync(base); knownHard[base] = true; } } @@ -10370,7 +23067,7 @@ old$1.realpathSync = function realpathSync(p, cache) { // some known symbolic link. no need to stat again. resolvedLink = cache[base]; } else { - var stat = fs$e.lstatSync(base); + var stat = fs$3.lstatSync(base); if (!stat.isSymbolicLink()) { knownHard[base] = true; if (cache) cache[base] = base; @@ -10380,20 +23077,20 @@ old$1.realpathSync = function realpathSync(p, cache) { // read the link if it wasn't read before // dev/ino always return 0 on windows, so skip the check. var linkTarget = null; - if (!isWindows$2) { + if (!isWindows) { var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); if (seenLinks.hasOwnProperty(id)) { linkTarget = seenLinks[id]; } } if (linkTarget === null) { - fs$e.statSync(base); - linkTarget = fs$e.readlinkSync(base); + fs$3.statSync(base); + linkTarget = fs$3.readlinkSync(base); } resolvedLink = pathModule.resolve(previous, linkTarget); // track this, if given a cache. if (cache) cache[base] = resolvedLink; - if (!isWindows$2) seenLinks[id] = linkTarget; + if (!isWindows) seenLinks[id] = linkTarget; } // resolve the link, then start over @@ -10444,8 +23141,8 @@ old$1.realpath = function realpath(p, cache, cb) { previous = ''; // On windows, check that the root exists. On unix there is no need. - if (isWindows$2 && !knownHard[base]) { - fs$e.lstat(base, function(err) { + if (isWindows && !knownHard[base]) { + fs$3.lstat(base, function(err) { if (err) return cb(err); knownHard[base] = true; LOOP(); @@ -10482,7 +23179,7 @@ old$1.realpath = function realpath(p, cache, cb) { return gotResolvedLink(cache[base]); } - return fs$e.lstat(base, gotStat); + return fs$3.lstat(base, gotStat); } function gotStat(err, stat) { @@ -10498,17 +23195,17 @@ old$1.realpath = function realpath(p, cache, cb) { // stat & read the link if not read before // call gotTarget as soon as the link target is known // dev/ino always return 0 on windows, so skip the check. - if (!isWindows$2) { + if (!isWindows) { var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); if (seenLinks.hasOwnProperty(id)) { return gotTarget(null, seenLinks[id], base); } } - fs$e.stat(base, function(err) { + fs$3.stat(base, function(err) { if (err) return cb(err); - fs$e.readlink(base, function(err, target) { - if (!isWindows$2) seenLinks[id] = target; + fs$3.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; gotTarget(err, target); }); }); @@ -10529,19 +23226,19 @@ old$1.realpath = function realpath(p, cache, cb) { } }; -var fs_realpath = realpath$2; -realpath$2.realpath = realpath$2; -realpath$2.sync = realpathSync; -realpath$2.realpathSync = realpathSync; -realpath$2.monkeypatch = monkeypatch; -realpath$2.unmonkeypatch = unmonkeypatch; +var fs_realpath = realpath; +realpath.realpath = realpath; +realpath.sync = realpathSync; +realpath.realpathSync = realpathSync; +realpath.monkeypatch = monkeypatch; +realpath.unmonkeypatch = unmonkeypatch; -var fs$d = require$$0__default$3['default']; -var origRealpath = fs$d.realpath; -var origRealpathSync = fs$d.realpathSync; +var fs$2 = require$$0$3; +var origRealpath = fs$2.realpath; +var origRealpathSync = fs$2.realpathSync; var version$2 = process.version; -var ok$2 = /^v[0-5]\./.test(version$2); +var ok$1 = /^v[0-5]\./.test(version$2); var old = old$1; function newError (er) { @@ -10552,8 +23249,8 @@ function newError (er) { ) } -function realpath$2 (p, cache, cb) { - if (ok$2) { +function realpath (p, cache, cb) { + if (ok$1) { return origRealpath(p, cache, cb) } @@ -10571,7 +23268,7 @@ function realpath$2 (p, cache, cb) { } function realpathSync (p, cache) { - if (ok$2) { + if (ok$1) { return origRealpathSync(p, cache) } @@ -10587,13 +23284,13 @@ function realpathSync (p, cache) { } function monkeypatch () { - fs$d.realpath = realpath$2; - fs$d.realpathSync = realpathSync; + fs$2.realpath = realpath; + fs$2.realpathSync = realpathSync; } function unmonkeypatch () { - fs$d.realpath = origRealpath; - fs$d.realpathSync = origRealpathSync; + fs$2.realpath = origRealpath; + fs$2.realpathSync = origRealpathSync; } var concatMap$1 = function (xs, fn) { @@ -10615,7 +23312,7 @@ function balanced$1(a, b, str) { if (a instanceof RegExp) a = maybeMatch(a, str); if (b instanceof RegExp) b = maybeMatch(b, str); - var r = range$3(a, b, str); + var r = range(a, b, str); return r && { start: r[0], @@ -10631,17 +23328,14 @@ function maybeMatch(reg, str) { return m ? m[0] : null; } -balanced$1.range = range$3; -function range$3(a, b, str) { +balanced$1.range = range; +function range(a, b, str) { var begs, beg, left, right, result; var ai = str.indexOf(a); var bi = str.indexOf(b, ai + 1); var i = ai; if (ai >= 0 && bi > 0) { - if(a===b) { - return [ai, bi]; - } begs = []; left = str.length; @@ -10683,7 +23377,7 @@ var escClose = '\0CLOSE'+Math.random()+'\0'; var escComma = '\0COMMA'+Math.random()+'\0'; var escPeriod = '\0PERIOD'+Math.random()+'\0'; -function numeric$1(str) { +function numeric(str) { return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0); @@ -10750,7 +23444,7 @@ function expandTop(str) { str = '\\{\\}' + str.substr(2); } - return expand$4(escapeBraces(str), true).map(unescapeBraces); + return expand$2(escapeBraces(str), true).map(unescapeBraces); } function embrace(str) { @@ -10767,7 +23461,7 @@ function gte(i, y) { return i >= y; } -function expand$4(str, isTop) { +function expand$2(str, isTop) { var expansions = []; var m = balanced('{', '}', str); @@ -10781,7 +23475,7 @@ function expand$4(str, isTop) { // {a},b} if (m.post.match(/,.*\}/)) { str = m.pre + '{' + m.body + escClose + m.post; - return expand$4(str); + return expand$2(str); } return [str]; } @@ -10793,10 +23487,10 @@ function expand$4(str, isTop) { n = parseCommaParts(m.body); if (n.length === 1) { // x{{a,b}}y ==> x{a}y x{b}y - n = expand$4(n[0], false).map(embrace); + n = expand$2(n[0], false).map(embrace); if (n.length === 1) { var post = m.post.length - ? expand$4(m.post, false) + ? expand$2(m.post, false) : ['']; return post.map(function(p) { return m.pre + n[0] + p; @@ -10811,17 +23505,17 @@ function expand$4(str, isTop) { // no need to expand pre, since it is guaranteed to be free of brace-sets var pre = m.pre; var post = m.post.length - ? expand$4(m.post, false) + ? expand$2(m.post, false) : ['']; var N; if (isSequence) { - var x = numeric$1(n[0]); - var y = numeric$1(n[1]); + var x = numeric(n[0]); + var y = numeric(n[1]); var width = Math.max(n[0].length, n[1].length); var incr = n.length == 3 - ? Math.abs(numeric$1(n[2])) + ? Math.abs(numeric(n[2])) : 1; var test = lte; var reverse = y < x; @@ -10855,7 +23549,7 @@ function expand$4(str, isTop) { N.push(c); } } else { - N = concatMap(n, function(el) { return expand$4(el, false) }); + N = concatMap(n, function(el) { return expand$2(el, false) }); } for (var j = 0; j < N.length; j++) { @@ -10872,13 +23566,13 @@ function expand$4(str, isTop) { var minimatch_1 = minimatch$3; minimatch$3.Minimatch = Minimatch$1; -var path$d = { sep: '/' }; +var path$4 = { sep: '/' }; try { - path$d = require$$0__default$2['default']; + path$4 = path$b; } catch (er) {} -var GLOBSTAR$1 = minimatch$3.GLOBSTAR = Minimatch$1.GLOBSTAR = {}; -var expand$3 = braceExpansion; +var GLOBSTAR = minimatch$3.GLOBSTAR = Minimatch$1.GLOBSTAR = {}; +var expand$1 = braceExpansion; var plTypes = { '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, @@ -10893,7 +23587,7 @@ var plTypes = { var qmark = '[^/]'; // * => any number of characters -var star$3 = qmark + '*?'; +var star = qmark + '*?'; // ** when dots are allowed. Anything goes, except .. and . // not (^ or / followed by one or two dots followed by $ or /), @@ -10991,8 +23685,8 @@ function Minimatch$1 (pattern, options) { pattern = pattern.trim(); // windows support: need to use /, not \ - if (path$d.sep !== '/') { - pattern = pattern.split(path$d.sep).join('/'); + if (path$4.sep !== '/') { + pattern = pattern.split(path$4.sep).join('/'); } this.options = options; @@ -11123,7 +23817,7 @@ function braceExpand (pattern, options) { return [pattern] } - return expand$3(pattern) + return expand$1(pattern) } // parse a component of the expanded set. @@ -11137,9 +23831,9 @@ function braceExpand (pattern, options) { // when it is the *only* thing in a path portion. Otherwise, any series // of * is equivalent to a single *. Globstar behavior is enabled by // default, and can be disabled by setting options.noglobstar. -Minimatch$1.prototype.parse = parse$b; +Minimatch$1.prototype.parse = parse$3; var SUBPARSE = {}; -function parse$b (pattern, isSub) { +function parse$3 (pattern, isSub) { if (pattern.length > 1024 * 64) { throw new TypeError('pattern is too long') } @@ -11147,7 +23841,7 @@ function parse$b (pattern, isSub) { var options = this.options; // shortcuts - if (!options.noglobstar && pattern === '**') return GLOBSTAR$1 + if (!options.noglobstar && pattern === '**') return GLOBSTAR if (pattern === '') return '' var re = ''; @@ -11174,7 +23868,7 @@ function parse$b (pattern, isSub) { // that wasn't consumed by this pass. switch (stateChar) { case '*': - re += star$3; + re += star; hasMagic = true; break case '?': @@ -11408,7 +24102,7 @@ function parse$b (pattern, isSub) { }); this.debug('tail=%j\n %s', tail, tail, pl, re); - var t = pl.type === '*' ? star$3 + var t = pl.type === '*' ? star : pl.type === '?' ? qmark : '\\' + pl.type; @@ -11527,14 +24221,14 @@ function makeRe () { } var options = this.options; - var twoStar = options.noglobstar ? star$3 + var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot; var flags = options.nocase ? 'i' : ''; var re = set.map(function (pattern) { return pattern.map(function (p) { - return (p === GLOBSTAR$1) ? twoStar + return (p === GLOBSTAR) ? twoStar : (typeof p === 'string') ? regExpEscape(p) : p._src }).join('\\\/') @@ -11580,8 +24274,8 @@ function match (f, partial) { var options = this.options; // windows: need to use /, not \ - if (path$d.sep !== '/') { - f = f.split(path$d.sep).join('/'); + if (path$4.sep !== '/') { + f = f.split(path$4.sep).join('/'); } // treat the test path as a set of pathparts. @@ -11652,7 +24346,7 @@ Minimatch$1.prototype.matchOne = function (file, pattern, partial) { // some invalid regexp stuff in the set. if (p === false) return false - if (p === GLOBSTAR$1) { + if (p === GLOBSTAR) { this.debug('GLOBSTAR', [pattern, p, f]); // "**" @@ -11793,7 +24487,7 @@ function regExpEscape (s) { return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') } -var inherits$3 = {exports: {}}; +var inherits$2 = {exports: {}}; var inherits_browser = {exports: {}}; @@ -11826,13 +24520,13 @@ if (typeof Object.create === 'function') { } try { - var util$3 = require$$0__default['default']; + var util$1 = require$$0$4; /* istanbul ignore next */ - if (typeof util$3.inherits !== 'function') throw ''; - inherits$3.exports = util$3.inherits; + if (typeof util$1.inherits !== 'function') throw ''; + inherits$2.exports = util$1.inherits; } catch (e) { /* istanbul ignore next */ - inherits$3.exports = inherits_browser.exports; + inherits$2.exports = inherits_browser.exports; } var pathIsAbsolute = {exports: {}}; @@ -11856,27 +24550,33 @@ pathIsAbsolute.exports = process.platform === 'win32' ? win32 : posix; pathIsAbsolute.exports.posix = posix; pathIsAbsolute.exports.win32 = win32; -var common$3 = {}; +var common$2 = {}; -common$3.setopts = setopts$2; -common$3.ownProp = ownProp$2; -common$3.makeAbs = makeAbs; -common$3.finish = finish; -common$3.mark = mark; -common$3.isIgnored = isIgnored$2; -common$3.childrenIgnored = childrenIgnored$2; +common$2.alphasort = alphasort; +common$2.alphasorti = alphasorti; +common$2.setopts = setopts$2; +common$2.ownProp = ownProp$2; +common$2.makeAbs = makeAbs; +common$2.finish = finish; +common$2.mark = mark; +common$2.isIgnored = isIgnored$2; +common$2.childrenIgnored = childrenIgnored$2; function ownProp$2 (obj, field) { return Object.prototype.hasOwnProperty.call(obj, field) } -var path$c = require$$0__default$2['default']; +var path$3 = path$b; var minimatch$2 = minimatch_1; var isAbsolute$2 = pathIsAbsolute.exports; var Minimatch = minimatch$2.Minimatch; +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + function alphasort (a, b) { - return a.localeCompare(b, 'en') + return a.localeCompare(b) } function setupIgnores (self, options) { @@ -11948,12 +24648,12 @@ function setopts$2 (self, pattern, options) { if (!ownProp$2(options, "cwd")) self.cwd = cwd; else { - self.cwd = path$c.resolve(options.cwd); + self.cwd = path$3.resolve(options.cwd); self.changedCwd = self.cwd !== cwd; } - self.root = options.root || path$c.resolve(self.cwd, "/"); - self.root = path$c.resolve(self.root); + self.root = options.root || path$3.resolve(self.cwd, "/"); + self.root = path$3.resolve(self.root); if (process.platform === "win32") self.root = self.root.replace(/\\/g, "/"); @@ -12004,7 +24704,7 @@ function finish (self) { all = Object.keys(all); if (!self.nosort) - all = all.sort(alphasort); + all = all.sort(self.nocase ? alphasorti : alphasort); // at *some* point we statted all of these if (self.mark) { @@ -12057,13 +24757,13 @@ function mark (self, p) { function makeAbs (self, f) { var abs = f; if (f.charAt(0) === '/') { - abs = path$c.join(self.root, f); + abs = path$3.join(self.root, f); } else if (isAbsolute$2(f) || f === '') { abs = f; } else if (self.changedCwd) { - abs = path$c.resolve(self.cwd, f); + abs = path$3.resolve(self.cwd, f); } else { - abs = path$c.resolve(f); + abs = path$3.resolve(f); } if (process.platform === 'win32') @@ -12093,20 +24793,22 @@ function childrenIgnored$2 (self, path) { }) } -var sync$3 = globSync$1; +var sync$1 = globSync$1; globSync$1.GlobSync = GlobSync$1; -var fs$c = require$$0__default$3['default']; +var fs$1 = require$$0$3; var rp$1 = fs_realpath; var minimatch$1 = minimatch_1; -var path$b = require$$0__default$2['default']; -var assert$1 = require$$5__default['default']; +var path$2 = path$b; +var assert$1 = assert$2; var isAbsolute$1 = pathIsAbsolute.exports; -var common$2 = common$3; -var setopts$1 = common$2.setopts; -var ownProp$1 = common$2.ownProp; -var childrenIgnored$1 = common$2.childrenIgnored; -var isIgnored$1 = common$2.isIgnored; +var common$1 = common$2; +common$1.alphasort; +common$1.alphasorti; +var setopts$1 = common$1.setopts; +var ownProp$1 = common$1.ownProp; +var childrenIgnored$1 = common$1.childrenIgnored; +var isIgnored$1 = common$1.isIgnored; function globSync$1 (pattern, options) { if (typeof options === 'function' || arguments.length === 3) @@ -12160,7 +24862,7 @@ GlobSync$1.prototype._finish = function () { } }); } - common$2.finish(this); + common$1.finish(this); }; @@ -12276,7 +24978,7 @@ GlobSync$1.prototype._processReaddir = function (prefix, read, abs, remain, inde } if (e.charAt(0) === '/' && !this.nomount) { - e = path$b.join(this.root, e); + e = path$2.join(this.root, e); } this._emitMatch(index, e); } @@ -12337,7 +25039,7 @@ GlobSync$1.prototype._readdirInGlobStar = function (abs) { var entries; var lstat; try { - lstat = fs$c.lstatSync(abs); + lstat = fs$1.lstatSync(abs); } catch (er) { if (er.code === 'ENOENT') { // lstat failed, doesn't exist @@ -12373,7 +25075,7 @@ GlobSync$1.prototype._readdir = function (abs, inGlobStar) { } try { - return this._readdirEntries(abs, fs$c.readdirSync(abs)) + return this._readdirEntries(abs, fs$1.readdirSync(abs)) } catch (er) { this._readdirError(abs, er); return null @@ -12487,9 +25189,9 @@ GlobSync$1.prototype._processSimple = function (prefix, index) { if (prefix && isAbsolute$1(prefix) && !this.nomount) { var trail = /[\/\\]$/.test(prefix); if (prefix.charAt(0) === '/') { - prefix = path$b.join(this.root, prefix); + prefix = path$2.join(this.root, prefix); } else { - prefix = path$b.resolve(this.root, prefix); + prefix = path$2.resolve(this.root, prefix); if (trail) prefix += '/'; } @@ -12530,7 +25232,7 @@ GlobSync$1.prototype._stat = function (f) { if (!stat) { var lstat; try { - lstat = fs$c.lstatSync(abs); + lstat = fs$1.lstatSync(abs); } catch (er) { if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { this.statCache[abs] = false; @@ -12540,7 +25242,7 @@ GlobSync$1.prototype._stat = function (f) { if (lstat && lstat.isSymbolicLink()) { try { - stat = fs$c.statSync(abs); + stat = fs$1.statSync(abs); } catch (er) { stat = lstat; } @@ -12564,11 +25266,11 @@ GlobSync$1.prototype._stat = function (f) { }; GlobSync$1.prototype._mark = function (p) { - return common$2.mark(this, p) + return common$1.mark(this, p) }; GlobSync$1.prototype._makeAbs = function (f) { - return common$2.makeAbs(this, f) + return common$1.makeAbs(this, f) }; // Returns a wrapper function that returns a wrapped callback @@ -12670,7 +25372,7 @@ function makeres (key) { return once$1(function RES () { var cbs = reqs[key]; var len = cbs.length; - var args = slice$2(arguments); + var args = slice$1(arguments); // XXX It's somewhat ambiguous whether a new callback added in this // pass should be queued for later execution if something in the @@ -12697,7 +25399,7 @@ function makeres (key) { }) } -function slice$2 (args) { +function slice$1 (args) { var length = args.length; var array = []; @@ -12745,27 +25447,29 @@ function slice$2 (args) { // `true` for files, and [children,...] for directories, or `false` for // things that don't exist. -var glob_1 = glob$1; +var glob_1 = glob; -var fs$b = require$$0__default$3['default']; +var fs = require$$0$3; var rp = fs_realpath; var minimatch = minimatch_1; -var inherits$2 = inherits$3.exports; -var EE = require$$0__default$4['default'].EventEmitter; -var path$a = require$$0__default$2['default']; -var assert = require$$5__default['default']; +var inherits$1 = inherits$2.exports; +var EE = require$$0$5.EventEmitter; +var path$1 = path$b; +var assert = assert$2; var isAbsolute = pathIsAbsolute.exports; -var globSync = sync$3; -var common$1 = common$3; -var setopts = common$1.setopts; -var ownProp = common$1.ownProp; +var globSync = sync$1; +var common = common$2; +common.alphasort; +common.alphasorti; +var setopts = common.setopts; +var ownProp = common.ownProp; var inflight = inflight_1; -var childrenIgnored = common$1.childrenIgnored; -var isIgnored = common$1.isIgnored; +var childrenIgnored = common.childrenIgnored; +var isIgnored = common.isIgnored; var once = once$3.exports; -function glob$1 (pattern, options, cb) { +function glob (pattern, options, cb) { if (typeof options === 'function') cb = options, options = {}; if (!options) options = {}; @@ -12778,13 +25482,13 @@ function glob$1 (pattern, options, cb) { return new Glob(pattern, options, cb) } -glob$1.sync = globSync; -var GlobSync = glob$1.GlobSync = globSync.GlobSync; +glob.sync = globSync; +var GlobSync = glob.GlobSync = globSync.GlobSync; // old api surface -glob$1.glob = glob$1; +glob.glob = glob; -function extend$3 (origin, add) { +function extend$1 (origin, add) { if (add === null || typeof add !== 'object') { return origin } @@ -12797,8 +25501,8 @@ function extend$3 (origin, add) { return origin } -glob$1.hasMagic = function (pattern, options_) { - var options = extend$3({}, options_); +glob.hasMagic = function (pattern, options_) { + var options = extend$1({}, options_); options.noprocess = true; var g = new Glob(pattern, options); @@ -12818,8 +25522,8 @@ glob$1.hasMagic = function (pattern, options_) { return false }; -glob$1.Glob = Glob; -inherits$2(Glob, EE); +glob.Glob = Glob; +inherits$1(Glob, EE); function Glob (pattern, options, cb) { if (typeof options === 'function') { cb = options; @@ -12896,7 +25600,7 @@ Glob.prototype._finish = function () { if (this.realpath && !this._didRealpath) return this._realpath() - common$1.finish(this); + common.finish(this); this.emit('end', this.found); }; @@ -12955,11 +25659,11 @@ Glob.prototype._realpathSet = function (index, cb) { }; Glob.prototype._mark = function (p) { - return common$1.mark(this, p) + return common.mark(this, p) }; Glob.prototype._makeAbs = function (f) { - return common$1.makeAbs(this, f) + return common.makeAbs(this, f) }; Glob.prototype.abort = function () { @@ -13129,7 +25833,7 @@ Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, in } if (e.charAt(0) === '/' && !this.nomount) { - e = path$a.join(this.root, e); + e = path$1.join(this.root, e); } this._emitMatch(index, e); } @@ -13205,7 +25909,7 @@ Glob.prototype._readdirInGlobStar = function (abs, cb) { var lstatcb = inflight(lstatkey, lstatcb_); if (lstatcb) - fs$b.lstat(abs, lstatcb); + fs.lstat(abs, lstatcb); function lstatcb_ (er, lstat) { if (er && er.code === 'ENOENT') @@ -13244,7 +25948,7 @@ Glob.prototype._readdir = function (abs, inGlobStar, cb) { if (Array.isArray(c)) return cb(null, c) } - fs$b.readdir(abs, readdirCb(this, abs, cb)); + fs.readdir(abs, readdirCb(this, abs, cb)); }; function readdirCb (self, abs, cb) { @@ -13390,9 +26094,9 @@ Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { if (prefix && isAbsolute(prefix) && !this.nomount) { var trail = /[\/\\]$/.test(prefix); if (prefix.charAt(0) === '/') { - prefix = path$a.join(this.root, prefix); + prefix = path$1.join(this.root, prefix); } else { - prefix = path$a.resolve(this.root, prefix); + prefix = path$1.resolve(this.root, prefix); if (trail) prefix += '/'; } @@ -13446,13 +26150,13 @@ Glob.prototype._stat = function (f, cb) { var self = this; var statcb = inflight('stat\0' + abs, lstatcb_); if (statcb) - fs$b.lstat(abs, statcb); + fs.lstat(abs, statcb); function lstatcb_ (er, lstat) { if (lstat && lstat.isSymbolicLink()) { // If it's a symlink, then treat it as the target, unless // the target does not exist, then treat it as a file. - return fs$b.stat(abs, function (er, stat) { + return fs.stat(abs, function (er, stat) { if (er) self._stat2(f, abs, null, lstat, cb); else @@ -13499,597 +26203,915 @@ var isBuffer = function isBuffer (obj) { typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) }; -var own$e = {}.hasOwnProperty; +const proc$1 = process; -var unistUtilStringifyPosition = stringify$e; +var own$b = {}.hasOwnProperty; -function stringify$e(value) { +/** + * @typedef {import('unist').Node} Node + * @typedef {import('unist').Position} Position + * @typedef {import('unist').Point} Point + */ + +/** + * Stringify one point, a position (start and end points), or a node’s + * positional information. + * + * @param {Node|Position|Point} [value] + * @returns {string} + */ +function stringifyPosition$1(value) { // Nothing. if (!value || typeof value !== 'object') { return '' } // Node. - if (own$e.call(value, 'position') || own$e.call(value, 'type')) { - return position$4(value.position) + if (own$b.call(value, 'position') || own$b.call(value, 'type')) { + // @ts-ignore looks like a node. + return position(value.position) } // Position. - if (own$e.call(value, 'start') || own$e.call(value, 'end')) { - return position$4(value) + if (own$b.call(value, 'start') || own$b.call(value, 'end')) { + // @ts-ignore looks like a position. + return position(value) } // Point. - if (own$e.call(value, 'line') || own$e.call(value, 'column')) { - return point$3(value) + if (own$b.call(value, 'line') || own$b.call(value, 'column')) { + // @ts-ignore looks like a point. + return point$1(value) } // ? return '' } -function point$3(point) { - if (!point || typeof point !== 'object') { - point = {}; - } - - return index$2(point.line) + ':' + index$2(point.column) +/** + * @param {Point} point + * @returns {string} + */ +function point$1(point) { + return index$1(point && point.line) + ':' + index$1(point && point.column) } -function position$4(pos) { - if (!pos || typeof pos !== 'object') { - pos = {}; - } - - return point$3(pos.start) + '-' + point$3(pos.end) +/** + * @param {Position} pos + * @returns {string} + */ +function position(pos) { + return point$1(pos && pos.start) + '-' + point$1(pos && pos.end) } -function index$2(value) { +/** + * @param {number} value + * @returns {number} + */ +function index$1(value) { return value && typeof value === 'number' ? value : 1 } -var stringify$d = unistUtilStringifyPosition; +/** + * @typedef {import('unist').Node} Node + * @typedef {import('unist').Position} Position + * @typedef {import('unist').Point} Point + */ -var vfileMessage$1 = VMessage$3; +class VFileMessage extends Error { + /** + * Constructor of a message for `reason` at `place` from `origin`. + * When an error is passed in as `reason`, copies the `stack`. + * + * @param {string|Error} reason Reason for message (`string` or `Error`). Uses the stack and message of the error if given. + * @param {Node|Position|Point} [place] Place at which the message occurred in a file (`Node`, `Position`, or `Point`, optional). + * @param {string} [origin] Place in code the message originates from (`string`, optional). + */ + constructor(reason, place, origin) { + /** @type {[string?, string?]} */ + var parts = [null, null]; + /** @type {Position} */ + var position = { + start: {line: null, column: null}, + end: {line: null, column: null} + }; + /** @type {number} */ + var index; -// Inherit from `Error#`. -function VMessagePrototype$1() {} -VMessagePrototype$1.prototype = Error.prototype; -VMessage$3.prototype = new VMessagePrototype$1(); + super(); -// Message properties. -var proto$2 = VMessage$3.prototype; + if (typeof place === 'string') { + origin = place; + place = null; + } -proto$2.file = ''; -proto$2.name = ''; -proto$2.reason = ''; -proto$2.message = ''; -proto$2.stack = ''; -proto$2.fatal = null; -proto$2.column = null; -proto$2.line = null; + if (typeof origin === 'string') { + index = origin.indexOf(':'); -// Construct a new VMessage. -// -// Note: We cannot invoke `Error` on the created context, as that adds readonly -// `line` and `column` attributes on Safari 9, thus throwing and failing the -// data. -function VMessage$3(reason, position, origin) { - var parts; - var range; - var location; + if (index === -1) { + parts[1] = origin; + } else { + parts[0] = origin.slice(0, index); + parts[1] = origin.slice(index + 1); + } + } - if (typeof position === 'string') { - origin = position; - position = null; - } + if (place) { + // Node. + if ('type' in place || 'position' in place) { + if (place.position) { + position = place.position; + } + } + // Position. + else if ('start' in place || 'end' in place) { + // @ts-ignore Looks like a position. + position = place; + } + // Point. + else if ('line' in place || 'column' in place) { + // @ts-ignore Looks like a point. + position.start = place; + } + } - parts = parseOrigin$1(origin); - range = stringify$d(position) || '1:1'; + // Fields from `Error` + this.name = stringifyPosition$1(place) || '1:1'; + this.message = typeof reason === 'object' ? reason.message : reason; + this.stack = typeof reason === 'object' ? reason.stack : ''; - location = { - start: {line: null, column: null}, - end: {line: null, column: null} - }; + /** + * Reason for message. + * @type {string} + */ + this.reason = this.message; + /** + * Starting line of error. + * @type {number?} + */ + this.line = position.start.line; + /** + * Starting column of error. + * @type {number?} + */ + this.column = position.start.column; + /** + * Namespace of warning. + * @type {string?} + */ + this.source = parts[0]; + /** + * Category of message. + * @type {string?} + */ + this.ruleId = parts[1]; + /** + * Full range information, when available. + * Has start and end properties, both set to an object with line and column, set to number?. + * @type {Position?} + */ + this.position = position; - // Node. - if (position && position.position) { - position = position.position; - } + // The following fields are “well known”. + // Not standard. + // Feel free to add other non-standard fields to your messages. - if (position) { - // Position. - if (position.start) { - location = position; - position = position.start; - } else { - // Point. - location.start = position; - } + /* eslint-disable no-unused-expressions */ + /** + * You may add a file property with a path of a file (used throughout the VFile ecosystem). + * @type {string?} + */ + this.file; + /** + * If true, marks associated file as no longer processable. + * @type {boolean?} + */ + this.fatal; + /** + * You may add a url property with a link to documentation for the message. + * @type {string?} + */ + this.url; + /** + * You may add a note property with a long form description of the message (supported by vfile-reporter). + * @type {string?} + */ + this.note; + /* eslint-enable no-unused-expressions */ } +} - if (reason.stack) { - this.stack = reason.stack; - reason = reason.message; - } +VFileMessage.prototype.file = ''; +VFileMessage.prototype.name = ''; +VFileMessage.prototype.reason = ''; +VFileMessage.prototype.message = ''; +VFileMessage.prototype.stack = ''; +VFileMessage.prototype.fatal = null; +VFileMessage.prototype.column = null; +VFileMessage.prototype.line = null; +VFileMessage.prototype.source = null; +VFileMessage.prototype.ruleId = null; +VFileMessage.prototype.position = null; - this.message = reason; - this.name = range; - this.reason = reason; - this.line = position ? position.line : null; - this.column = position ? position.column : null; - this.location = location; - this.source = parts[0]; - this.ruleId = parts[1]; -} +/** + * @typedef {import('unist').Node} Node + * @typedef {import('unist').Position} Position + * @typedef {import('unist').Point} Point + * + * @typedef {'ascii'|'utf8'|'utf-8'|'utf16le'|'ucs2'|'ucs-2'|'base64'|'latin1'|'binary'|'hex'} BufferEncoding + * Encodings supported by the buffer class. + * This is a copy of the typing from Node, copied to prevent Node globals from + * being needed. + * Copied from: <https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a2bc1d8/types/node/globals.d.ts#L174> + * + * @typedef {string|Uint8Array} VFileValue Contents of the file. + * Can either be text, or a Buffer like structure. + * This does not directly use type `Buffer`, because it can also be used in a + * browser context. + * Instead this leverages `Uint8Array` which is the base type for `Buffer`, + * and a native JavaScript construct. + * + * @typedef {VFileValue|VFileOptions|VFile} VFileCompatible Things that can be + * passed to the constructor. + * + * @typedef VFileCoreOptions + * @property {VFileValue} [value] + * @property {string} [cwd] + * @property {Array.<string>} [history] + * @property {string} [path] + * @property {string} [basename] + * @property {string} [stem] + * @property {string} [extname] + * @property {string} [dirname] + * @property {Object.<string, unknown>} [data] + * + * @typedef {{[key: string]: unknown} & VFileCoreOptions} VFileOptions + * Configuration: a bunch of keys that will be shallow copied over to the new + * file. + * + * @typedef {Object.<string, unknown>} VFileReporterSettings + * @typedef {<T = VFileReporterSettings>(files: VFile[], options: T) => string} VFileReporter + */ -function parseOrigin$1(origin) { - var result = [null, null]; - var index; +// Order of setting (least specific to most), we need this because otherwise +// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a +// stem can be set. +var order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']; - if (typeof origin === 'string') { - index = origin.indexOf(':'); +class VFile { + /** + * Create a new virtual file. + * + * If `options` is `string` or `Buffer`, treats it as `{value: options}`. + * If `options` is a `VFile`, shallow copies its data over to the new file. + * All other given fields are set on the newly created `VFile`. + * + * Path related properties are set in the following order (least specific to + * most specific): `history`, `path`, `basename`, `stem`, `extname`, + * `dirname`. + * + * It’s not possible to set either `dirname` or `extname` without setting + * either `history`, `path`, `basename`, or `stem` as well. + * + * @param {VFileCompatible} [value] + */ + constructor(value) { + var index = -1; + /** @type {VFileOptions} */ + var options; + /** @type {string} */ + var prop; - if (index === -1) { - result[1] = origin; + if (!value) { + options = {}; + } else if (typeof value === 'string' || isBuffer(value)) { + // @ts-ignore Looks like a buffer. + options = {value}; } else { - result[0] = origin.slice(0, index); - result[1] = origin.slice(index + 1); + // @ts-ignore Looks like file or options. + options = value; } - } - - return result -} -var minpath$1 = require$$0__default$2['default']; + /** + * Place to store custom information. + * It’s OK to store custom data directly on the file, moving it to `data` + * gives a little more privacy. + * @type {Object.<string, unknown>} + */ + this.data = {}; -var minproc$1 = process; + /** + * List of messages associated with the file. + * @type {Array.<VFileMessage>} + */ + this.messages = []; -var p$1 = minpath$1; -var proc$2 = minproc$1; -var buffer$5 = isBuffer; + /** + * List of file paths the file moved between. + * @type {Array.<string>} + */ + this.history = []; -var core$3 = VFile$3; + /** + * Base of `path`. + * Defaults to `process.cwd()` (`/` in browsers). + * @type {string} + */ + this.cwd = proc$1.cwd(); -var own$d = {}.hasOwnProperty; + /* eslint-disable no-unused-expressions */ + /** + * Raw value. + * @type {VFileValue} + */ + this.value; -// Order of setting (least specific to most), we need this because otherwise -// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a -// stem can be set. -var order$4 = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']; + // The below are non-standard, they are “well-known”. + // As in, used in several tools. -VFile$3.prototype.toString = toString$9; + /** + * Whether a file was saved to disk. + * This is used by vfile reporters. + * @type {boolean} + */ + this.stored; -// Access full path (`~/index.min.js`). -Object.defineProperty(VFile$3.prototype, 'path', {get: getPath$1, set: setPath$1}); + /** + * Sometimes files have a non-string representation. + * This can be stored in the `result` field. + * One example is when turning markdown into React nodes. + * This is used by unified to store non-string results. + * @type {unknown} + */ + this.result; + /* eslint-enable no-unused-expressions */ -// Access parent path (`~`). -Object.defineProperty(VFile$3.prototype, 'dirname', { - get: getDirname$1, - set: setDirname$1 -}); + // Set path related properties in the correct order. + while (++index < order.length) { + prop = order[index]; -// Access basename (`index.min.js`). -Object.defineProperty(VFile$3.prototype, 'basename', { - get: getBasename$1, - set: setBasename$1 -}); + // Note: we specifically use `in` instead of `hasOwnProperty` to accept + // `vfile`s too. + if (prop in options && options[prop] !== undefined) { + this[prop] = prop === 'history' ? options[prop].concat() : options[prop]; + } + } -// Access extname (`.js`). -Object.defineProperty(VFile$3.prototype, 'extname', { - get: getExtname$1, - set: setExtname$1 -}); + // Set non-path related properties. + for (prop in options) { + if (!order.includes(prop)) { + this[prop] = options[prop]; + } + } + } -// Access stem (`index.min`). -Object.defineProperty(VFile$3.prototype, 'stem', {get: getStem$1, set: setStem$1}); + /** + * Access full path (`~/index.min.js`). + */ + get path() { + return this.history[this.history.length - 1] + } -// Construct a new file. -function VFile$3(options) { - var prop; - var index; + /** + * Set full path (`~/index.min.js`). + * Cannot be nullified. + */ + set path(path) { + assertNonEmpty(path, 'path'); - if (!options) { - options = {}; - } else if (typeof options === 'string' || buffer$5(options)) { - options = {contents: options}; - } else if ('message' in options && 'messages' in options) { - return options + if (this.path !== path) { + this.history.push(path); + } } - if (!(this instanceof VFile$3)) { - return new VFile$3(options) + /** + * Access parent path (`~`). + */ + get dirname() { + return typeof this.path === 'string' ? path$b.dirname(this.path) : undefined } - this.data = {}; - this.messages = []; - this.history = []; - this.cwd = proc$2.cwd(); + /** + * Set parent path (`~`). + * Cannot be set if there's no `path` yet. + */ + set dirname(dirname) { + assertPath(this.path, 'dirname'); + this.path = path$b.join(dirname || '', this.basename); + } - // Set path related properties in the correct order. - index = -1; + /** + * Access basename (including extname) (`index.min.js`). + */ + get basename() { + return typeof this.path === 'string' ? path$b.basename(this.path) : undefined + } - while (++index < order$4.length) { - prop = order$4[index]; + /** + * Set basename (`index.min.js`). + * Cannot contain path separators. + * Cannot be nullified either (use `file.path = file.dirname` instead). + */ + set basename(basename) { + assertNonEmpty(basename, 'basename'); + assertPart(basename, 'basename'); + this.path = path$b.join(this.dirname || '', basename); + } - if (own$d.call(options, prop)) { - this[prop] = options[prop]; - } + /** + * Access extname (including dot) (`.js`). + */ + get extname() { + return typeof this.path === 'string' ? path$b.extname(this.path) : undefined } - // Set non-path related properties. - for (prop in options) { - if (order$4.indexOf(prop) < 0) { - this[prop] = options[prop]; + /** + * Set extname (including dot) (`.js`). + * Cannot be set if there's no `path` yet and cannot contain path separators. + */ + set extname(extname) { + assertPart(extname, 'extname'); + assertPath(this.path, 'extname'); + + if (extname) { + if (extname.charCodeAt(0) !== 46 /* `.` */) { + throw new Error('`extname` must start with `.`') + } + + if (extname.includes('.', 1)) { + throw new Error('`extname` cannot contain multiple dots') + } } + + this.path = path$b.join(this.dirname, this.stem + (extname || '')); } -} -function getPath$1() { - return this.history[this.history.length - 1] -} + /** + * Access stem (w/o extname) (`index.min`). + */ + get stem() { + return typeof this.path === 'string' + ? path$b.basename(this.path, this.extname) + : undefined + } -function setPath$1(path) { - assertNonEmpty$1(path, 'path'); + /** + * Set stem (w/o extname) (`index.min`). + * Cannot be nullified, and cannot contain path separators. + */ + set stem(stem) { + assertNonEmpty(stem, 'stem'); + assertPart(stem, 'stem'); + this.path = path$b.join(this.dirname || '', stem + (this.extname || '')); + } - if (this.path !== path) { - this.history.push(path); + /** + * Serialize the file. + * + * @param {BufferEncoding} [encoding='utf8'] If `file.value` is a buffer, `encoding` is used to serialize buffers. + * @returns {string} + */ + toString(encoding) { + // @ts-ignore string’s don’t accept the parameter, but buffers do. + return (this.value || '').toString(encoding) } -} -function getDirname$1() { - return typeof this.path === 'string' ? p$1.dirname(this.path) : undefined -} + /** + * Create a message and associates it w/ the file. + * + * @param {string|Error} reason Reason for message (`string` or `Error`). Uses the stack and message of the error if given. + * @param {Node|Position|Point} [place] Place at which the message occurred in a file (`Node`, `Position`, or `Point`, optional). + * @param {string} [origin] Place in code the message originates from (`string`, optional). + * @returns {VFileMessage} + */ + message(reason, place, origin) { + var message = new VFileMessage(reason, place, origin); -function setDirname$1(dirname) { - assertPath$1(this.path, 'dirname'); - this.path = p$1.join(dirname || '', this.basename); -} + if (this.path) { + message.name = this.path + ':' + message.name; + message.file = this.path; + } -function getBasename$1() { - return typeof this.path === 'string' ? p$1.basename(this.path) : undefined -} + message.fatal = false; -function setBasename$1(basename) { - assertNonEmpty$1(basename, 'basename'); - assertPart$1(basename, 'basename'); - this.path = p$1.join(this.dirname || '', basename); -} + this.messages.push(message); -function getExtname$1() { - return typeof this.path === 'string' ? p$1.extname(this.path) : undefined -} + return message + } -function setExtname$1(extname) { - assertPart$1(extname, 'extname'); - assertPath$1(this.path, 'extname'); + /** + * Info: create a message, associate it with the file, and mark the fatality + * as `null`. + * Calls `message()` internally. + * + * @param {string|Error} reason Reason for message (`string` or `Error`). Uses the stack and message of the error if given. + * @param {Node|Position|Point} [place] Place at which the message occurred in a file (`Node`, `Position`, or `Point`, optional). + * @param {string} [origin] Place in code the message originates from (`string`, optional). + * @returns {VFileMessage} + */ + info(reason, place, origin) { + var message = this.message(reason, place, origin); - if (extname) { - if (extname.charCodeAt(0) !== 46 /* `.` */) { - throw new Error('`extname` must start with `.`') - } + message.fatal = null; - if (extname.indexOf('.', 1) > -1) { - throw new Error('`extname` cannot contain multiple dots') - } + return message } - this.path = p$1.join(this.dirname, this.stem + (extname || '')); -} - -function getStem$1() { - return typeof this.path === 'string' - ? p$1.basename(this.path, this.extname) - : undefined -} + /** + * Fail: create a message, associate it with the file, mark the fatality as + * `true`. + * Note: fatal errors mean a file is no longer processable. + * Calls `message()` internally. + * + * @param {string|Error} reason Reason for message (`string` or `Error`). Uses the stack and message of the error if given. + * @param {Node|Position|Point} [place] Place at which the message occurred in a file (`Node`, `Position`, or `Point`, optional). + * @param {string} [origin] Place in code the message originates from (`string`, optional). + * @returns {never} + */ + fail(reason, place, origin) { + var message = this.message(reason, place, origin); -function setStem$1(stem) { - assertNonEmpty$1(stem, 'stem'); - assertPart$1(stem, 'stem'); - this.path = p$1.join(this.dirname || '', stem + (this.extname || '')); -} + message.fatal = true; -// Get the value of the file. -function toString$9(encoding) { - return (this.contents || '').toString(encoding) + throw message + } } -// Assert that `part` is not a path (i.e., does not contain `p.sep`). -function assertPart$1(part, name) { - if (part && part.indexOf(p$1.sep) > -1) { +/** + * Assert that `part` is not a path (as in, does not contain `path.sep`). + * + * @param {string} part + * @param {string} name + * @returns {void} + */ +function assertPart(part, name) { + if (part && part.includes(path$b.sep)) { throw new Error( - '`' + name + '` cannot be a path: did not expect `' + p$1.sep + '`' + '`' + name + '` cannot be a path: did not expect `' + path$b.sep + '`' ) } } -// Assert that `part` is not empty. -function assertNonEmpty$1(part, name) { +/** + * Assert that `part` is not empty. + * + * @param {string} part + * @param {string} name + * @returns {void} + */ +function assertNonEmpty(part, name) { if (!part) { throw new Error('`' + name + '` cannot be empty') } } -// Assert `path` exists. -function assertPath$1(path, name) { +/** + * Assert `path` exists. + * + * @param {string} path + * @param {string} name + * @returns {void} + */ +function assertPath(path, name) { if (!path) { throw new Error('Setting `' + name + '` requires `path` to be set too') } } -var VMessage$2 = vfileMessage$1; -var VFile$2 = core$3; - -var lib$6 = VFile$2; - -VFile$2.prototype.message = message$1; -VFile$2.prototype.info = info$1; -VFile$2.prototype.fail = fail$2; - -// Create a message with `reason` at `position`. -// When an error is passed in as `reason`, copies the stack. -function message$1(reason, position, origin) { - var message = new VMessage$2(reason, position, origin); - - if (this.path) { - message.name = this.path + ':' + message.name; - message.file = this.path; - } - - message.fatal = false; - - this.messages.push(message); - - return message -} - -// Fail: creates a vmessage, associates it with the file, and throws it. -function fail$2() { - var message = this.message.apply(this, arguments); - - message.fatal = true; - - throw message -} - -// Info: creates a vmessage, associates it with the file, and marks the fatality -// as null. -function info$1() { - var message = this.message.apply(this, arguments); - - message.fatal = null; - - return message -} - -var vfile$9 = lib$6; - -var buffer$4 = isBuffer; -var vfile$8 = vfile$9; - -var core$2 = toVFile; +/** + * @typedef {import('vfile').VFileValue} Value + * @typedef {import('vfile').VFileOptions} Options + * @typedef {import('vfile').BufferEncoding} BufferEncoding + * + * @typedef {number|string} Mode + * @typedef {BufferEncoding|{encoding?: null|BufferEncoding, flag?: string}} ReadOptions + * @typedef {BufferEncoding|{encoding?: null|BufferEncoding, mode: Mode?, flag?: string}} WriteOptions + * + * @typedef {string|Uint8Array} Path Path of the file. + * @typedef {Path|URL|Options|VFile} Compatible Things that can be + * passed to the function. + */ -// Create a virtual file from a description. If `options` is a string or a -// buffer, it’s used as the path. In all other cases, the options are passed -// through to `vfile()`. +/** + * Create a virtual file from a description. + * If `options` is a string or a buffer, it’s used as the path. + * If it’s a VFile itself, it’s returned instead. + * In all other cases, the options are passed through to `vfile()`. + * + * @param {Compatible} [options] + * @returns {VFile} + */ function toVFile(options) { - if (typeof options === 'string' || buffer$4(options)) { + if (typeof options === 'string' || isBuffer(options)) { options = {path: String(options)}; + } else if (options instanceof URL$1) { + options = {path: fileURLToPath(options)}; } - return vfile$8(options) + return looksLikeAVFile$1(options) ? options : new VFile(options) } -var sync$2 = {}; - -var fs$a = require$$0__default$3['default']; -var path$9 = require$$0__default$2['default']; -var vfile$7 = core$2; - -sync$2.read = readSync; -sync$2.write = writeSync; - -// Create a virtual file and read it in, synchronously. +/** + * Create a virtual file and read it in, synchronously. + * + * @param {Compatible} description + * @param {ReadOptions} [options] + * @returns {VFile} + */ function readSync(description, options) { - var file = vfile$7(description); - file.contents = fs$a.readFileSync(path$9.resolve(file.cwd, file.path), options); + var file = toVFile(description); + file.value = require$$0$3.readFileSync(path$b.resolve(file.cwd, file.path), options); return file } -// Create a virtual file and write it out, synchronously. +/** + * Create a virtual file and write it in, synchronously. + * + * @param {Compatible} description + * @param {WriteOptions} [options] + * @returns {VFile} + */ function writeSync(description, options) { - var file = vfile$7(description); - fs$a.writeFileSync( - path$9.resolve(file.cwd, file.path), - file.contents || '', - options - ); + var file = toVFile(description); + require$$0$3.writeFileSync(path$b.resolve(file.cwd, file.path), file.value || '', options); return file } -var async$1 = {}; - -var fs$9 = require$$0__default$3['default']; -var path$8 = require$$0__default$2['default']; -var vfile$6 = core$2; - -async$1.read = read$3; -async$1.write = write; - -// Create a virtual file and read it in, asynchronously. -function read$3(description, options, callback) { - var file = vfile$6(description); +const read$2 = + /** + * @type {{ + * (description: Compatible, options: ReadOptions, callback: Callback): void + * (description: Compatible, callback: Callback): void + * (description: Compatible, options?: ReadOptions): Promise<VFile> + * }} + */ + ( + /** + * Create a virtual file and read it in, asynchronously. + * + * @param {Compatible} description + * @param {ReadOptions} [options] + * @param {Callback} [callback] + */ + function (description, options, callback) { + var file = toVFile(description); - if (!callback && typeof options === 'function') { - callback = options; - options = null; - } + if (!callback && typeof options === 'function') { + callback = options; + options = null; + } - if (!callback) { - return new Promise(executor) - } + if (!callback) { + return new Promise(executor) + } - executor(resolve, callback); + executor(resolve, callback); - function resolve(result) { - callback(null, result); - } + /** + * @param {VFile} result + */ + function resolve(result) { + callback(null, result); + } - function executor(resolve, reject) { - var fp; + /** + * @param {(x: VFile) => void} resolve + * @param {(x: Error, y?: VFile) => void} reject + */ + function executor(resolve, reject) { + /** @type {string} */ + var fp; - try { - fp = path$8.resolve(file.cwd, file.path); - } catch (error) { - return reject(error) - } + try { + fp = path$b.resolve(file.cwd, file.path); + } catch (error) { + return reject(error) + } - fs$9.readFile(fp, options, done); + require$$0$3.readFile(fp, options, done); - function done(error, res) { - if (error) { - reject(error); - } else { - file.contents = res; - resolve(file); + /** + * @param {Error} error + * @param {Value} result + */ + function done(error, result) { + if (error) { + reject(error); + } else { + file.value = result; + resolve(file); + } + } } } - } -} + ); -// Create a virtual file and write it out, asynchronously. -function write(description, options, callback) { - var file = vfile$6(description); +const write = + /** + * @type {{ + * (description: Compatible, options: WriteOptions, callback: Callback): void + * (description: Compatible, callback: Callback): void + * (description: Compatible, options?: WriteOptions): Promise<VFile> + * }} + */ + ( + /** + * Create a virtual file and write it in, asynchronously. + * + * @param {Compatible} description + * @param {WriteOptions} [options] + * @param {Callback} [callback] + */ + function (description, options, callback) { + var file = toVFile(description); - // Weird, right? Otherwise `fs` doesn’t accept it. - if (!callback && typeof options === 'function') { - callback = options; - options = undefined; - } + // Weird, right? Otherwise `fs` doesn’t accept it. + if (!callback && typeof options === 'function') { + callback = options; + options = undefined; + } - if (!callback) { - return new Promise(executor) - } + if (!callback) { + return new Promise(executor) + } - executor(resolve, callback); + executor(resolve, callback); - function resolve(result) { - callback(null, result); - } + /** + * @param {VFile} result + */ + function resolve(result) { + callback(null, result); + } - function executor(resolve, reject) { - var fp; + /** + * @param {(x: VFile) => void} resolve + * @param {(x: Error, y?: VFile) => void} reject + */ + function executor(resolve, reject) { + /** @type {string} */ + var fp; - try { - fp = path$8.resolve(file.cwd, file.path); - } catch (error) { - return reject(error) - } + try { + fp = path$b.resolve(file.cwd, file.path); + } catch (error) { + return reject(error) + } - fs$9.writeFile(fp, file.contents || '', options, done); + require$$0$3.writeFile(fp, file.value || '', options, done); - function done(error) { - if (error) { - reject(error); - } else { - resolve(file); + /** + * @param {Error} error + */ + function done(error) { + if (error) { + reject(error); + } else { + resolve(file); + } + } } } - } -} - -var vfile$5 = core$2; -var sync$1 = sync$2; -var async = async$1; - -var fs$8 = vfile$5; - -vfile$5.read = async.read; -vfile$5.readSync = sync$1.read; -vfile$5.write = async.write; -vfile$5.writeSync = sync$1.write; - -var toVfile = fs$8; + ); -var path$7 = require$$0__default$2['default']; -var fs$7 = require$$0__default$3['default']; -var gitignore = ignore$2; -var glob = glob_1; -var vfile$4 = toVfile; +/** + * @param {Compatible} value + * @returns {value is VFile} + */ +function looksLikeAVFile$1(value) { + return ( + value && + typeof value === 'object' && + 'message' in value && + 'messages' in value + ) +} -var finder = find$1; +toVFile.readSync = readSync; +toVFile.writeSync = writeSync; +toVFile.read = read$2; +toVFile.write = write; -// Search `patterns`, a mix of globs, paths, and files. -function find$1(input, options, callback) { - expand$2(input, options, done); +/** + * @typedef {import('fs').Stats} Stats + * @typedef {import('vfile').VFile} VFile + * @typedef {import('./ignore.js').Ignore} Ignore + * @typedef {import('ignore').Ignore} GitIgnore + * + * @typedef Options + * @property {string} cwd + * @property {Array.<string>} extensions + * @property {boolean|undefined} silentlyIgnore + * @property {Array.<string>} ignorePatterns + * @property {Ignore} ignore + * + * @typedef SearchResults + * @property {fs.Stats|undefined} stats + * @property {boolean|undefined} ignored + * + * @typedef Result + * @property {Array.<string|VFile>} input + * @property {VFile[]} output + * + * @typedef CleanResult + * @property {boolean} oneFileMode + * @property {VFile[]} files + * + * @callback Callback + * @param {Error|null} error + * @param {CleanResult} [result] + */ - function done(error, result) { - /* istanbul ignore if - glob errors are unusual. - * other errors are on the vfile results. */ - if (error) { +/** + * Search `patterns`, a mix of globs, paths, and files. + * + * @param {Array.<string|VFile>} input + * @param {Options} options + * @param {Callback} callback + */ +function finder(input, options, callback) { + expand(input, options, (error, result) => { + // Glob errors are unusual. + // other errors are on the vfile results. + /* c8 ignore next 2 */ + if (error || !result) { callback(error); } else { callback(null, {oneFileMode: oneFileMode(result), files: result.output}); } - } + }); } -// Expand the given glob patterns, search given and found directories, and map -// to vfiles. -function expand$2(input, options, next) { - var paths = []; - var actual = 0; - var expected = 0; - var failed; - - input.forEach(each); - - if (!expected) { - search$1(paths, options, done); - } +/** + * Expand the given glob patterns, search given and found directories, and map + * to vfiles. + * + * @param {Array.<string|VFile>} input + * @param {Options} options + * @param {(error: Error|null, result?: Result) => void} next + */ +function expand(input, options, next) { + /** @type {Array.<string|VFile>} */ + let paths = []; + let actual = 0; + let expected = 0; + let index = -1; + /** @type {boolean|undefined} */ + let failed; - function each(file) { + while (++index < input.length) { + let file = input[index]; if (typeof file === 'string') { - if (glob.hasMagic(file)) { + if (glob_1.hasMagic(file)) { expected++; - glob(file, {cwd: options.cwd}, one); + glob_1(file, {cwd: options.cwd}, (error, files) => { + // Glob errors are unusual. + /* c8 ignore next 3 */ + if (failed) { + return + } + + // Glob errors are unusual. + /* c8 ignore next 4 */ + if (error) { + failed = true; + done1(error); + } else { + actual++; + paths = paths.concat(files); + + if (actual === expected) { + search$1(paths, options, done1); + } + } + }); } else { // `relative` to make the paths canonical. file = - path$7.relative(options.cwd, path$7.resolve(options.cwd, file)) || '.'; + path$c.relative(options.cwd, path$c.resolve(options.cwd, file)) || '.'; paths.push(file); } } else { + const fp = file.path ? path$c.relative(options.cwd, file.path) : options.cwd; file.cwd = options.cwd; - file.path = path$7.relative(options.cwd, file.path); - file.history = [file.path]; + file.path = fp; + file.history = [fp]; paths.push(file); } } - function one(error, files) { - /* istanbul ignore if - Glob errors are unusual. */ - if (failed) { - return - } - - /* istanbul ignore if - Glob errors are unusual. */ - if (error) { - failed = true; - done(error); - } else { - actual++; - paths = paths.concat(files); - - if (actual === expected) { - search$1(paths, options, done); - } - } + if (!expected) { + search$1(paths, options, done1); } - function done(error, files) { - /* istanbul ignore if - `search` currently does not give errors. */ - if (error) { + /** + * @param {Error|null} error + * @param {Array<VFile>} [files] + */ + function done1(error, files) { + // `search` currently does not give errors. + /* c8 ignore next 2 */ + if (error || !files) { next(error); } else { next(null, {input: paths, output: files}); @@ -14097,31 +27119,41 @@ function expand$2(input, options, next) { } } -// Search `paths`. +/** + * Search `paths`. + * + * @param {Array.<string|VFile>} input + * @param {Options & {nested?: boolean}} options + * @param {(error: Error|null, files: Array.<VFile>) => void} next + */ function search$1(input, options, next) { - var extraIgnore = gitignore().add(options.ignorePatterns); - var files = []; - var expected = 0; - var actual = 0; + const extraIgnore = ignore().add(options.ignorePatterns); + let expected = 0; + let actual = 0; + let index = -1; + /** @type {Array.<VFile>} */ + let files = []; - input.forEach(each); + while (++index < input.length) { + each(input[index]); + } if (!expected) { next(null, files); } - return each - + /** + * @param {string|VFile} file + */ function each(file) { - var ext = typeof file === 'string' ? path$7.extname(file) : file.extname; - var part; + const ext = typeof file === 'string' ? path$c.extname(file) : file.extname; // Normalise globs. if (typeof file === 'string') { - file = file.split('/').join(path$7.sep); + file = file.split('/').join(path$c.sep); } - part = base(file); + const part = base$1(file); if (options.nested && (part.charAt(0) === '.' || part === 'node_modules')) { return @@ -14131,75 +27163,82 @@ function search$1(input, options, next) { statAndIgnore( file, - Object.assign({}, options, {extraIgnore: extraIgnore}), - handle - ); - - function handle(error, result) { - var ignored = result && result.ignored; - var dir = result && result.stats && result.stats.isDirectory(); - - if (ignored && (options.nested || options.silentlyIgnore)) { - return one(null, []) - } - - if (!ignored && dir) { - return fs$7.readdir(path$7.resolve(options.cwd, filePath(file)), directory) - } - - if ( - !dir && - options.nested && - options.extensions.length > 0 && - options.extensions.indexOf(ext) === -1 - ) { - return one(null, []) - } - - file = vfile$4(file); - file.cwd = options.cwd; - - if (ignored) { - try { - file.fail('Cannot process specified file: it’s ignored'); - } catch (_) {} - } - - if (error && error.code === 'ENOENT') { - try { - file.fail( - error.syscall === 'stat' ? 'No such file or directory' : error - ); - } catch (_) {} - } - - one(null, [file]); - } + Object.assign({}, options, {extraIgnore}), + (error, result) => { + const ignored = result && result.ignored; + const dir = result && result.stats && result.stats.isDirectory(); + + if (ignored && (options.nested || options.silentlyIgnore)) { + return one(null, []) + } + + if (!ignored && dir) { + return fs$a.readdir( + path$c.resolve(options.cwd, filePath(file)), + (error, basenames) => { + // Should not happen often: the directory is `stat`ed first, which was ok, + // but reading it is not. + /* c8 ignore next 9 */ + if (error) { + const otherFile = toVFile(filePath(file)); + otherFile.cwd = options.cwd; + + try { + otherFile.fail('Cannot read directory'); + } catch {} + + one(null, [otherFile]); + } else { + search$1( + basenames.map((name) => path$c.join(filePath(file), name)), + Object.assign({}, options, {nested: true}), + one + ); + } + } + ) + } - function directory(error, basenames) { - var file; + if ( + !dir && + options.nested && + options.extensions.length > 0 && + !options.extensions.includes(ext) + ) { + return one(null, []) + } - /* istanbul ignore if - Should not happen often: the directory is `stat`ed - * first, which was ok, but reading it is not. */ - if (error) { - file = vfile$4(filePath(file)); + file = toVFile(file); file.cwd = options.cwd; - try { - file.fail('Cannot read directory'); - } catch (_) {} + if (ignored) { + try { + file.fail('Cannot process specified file: it’s ignored'); + // C8 bug on Node@12 + /* c8 ignore next 1 */ + } catch {} + } + + if (error && error.code === 'ENOENT') { + try { + file.fail( + error.syscall === 'stat' ? 'No such file or directory' : error + ); + // C8 bug on Node@12 + /* c8 ignore next 1 */ + } catch {} + } one(null, [file]); - } else { - search$1( - basenames.map(concat), - Object.assign({}, options, {nested: true}), - one - ); } - } + ); - // Error is never given. Always given `results`. + /** + * Error is never given. Always given `results`. + * + * @param {Error|null} _ + * @param {Array.<VFile>} results + */ function one(_, results) { /* istanbul ignore else - Always given. */ if (results) { @@ -14212,39 +27251,41 @@ function search$1(input, options, next) { next(null, files); } } - - function concat(value) { - return path$7.join(filePath(file), value) - } } } +/** + * @param {VFile|string} file + * @param {Options & {extraIgnore: GitIgnore}} options + * @param {(error: NodeJS.ErrnoException|null, result?: SearchResults) => void} callback + */ function statAndIgnore(file, options, callback) { - var fp = path$7.resolve(options.cwd, filePath(file)); - var normal = path$7.relative(options.cwd, fp); - var expected = 1; - var actual = 0; - var stats; - var ignored; + const fp = path$c.resolve(options.cwd, filePath(file)); + const normal = path$c.relative(options.cwd, fp); + let expected = 1; + let actual = 0; + /** @type {Stats|undefined} */ + let stats; + /** @type {boolean|undefined} */ + let ignored; - if (!file.contents) { + if (typeof file === 'string' || !file.value) { expected++; - fs$7.stat(fp, handleStat); - } - - options.ignore.check(fp, handleIgnore); - - function handleStat(error, value) { - stats = value; - one(error); + fs$a.stat(fp, (error, value) => { + stats = value; + onStartOrCheck(error); + }); } - function handleIgnore(error, value) { + options.ignore.check(fp, (error, value) => { ignored = value; - one(error); - } + onStartOrCheck(error); + }); - function one(error) { + /** + * @param {Error|null} error + */ + function onStartOrCheck(error) { actual++; if (error) { @@ -14252,13 +27293,13 @@ function statAndIgnore(file, options, callback) { actual = -1; } else if (actual === expected) { callback(null, { - stats: stats, + stats, ignored: ignored || (normal === '' || normal === '..' || - normal.charAt(0) === path$7.sep || - normal.slice(0, 3) === '..' + path$7.sep + normal.charAt(0) === path$c.sep || + normal.slice(0, 3) === '..' + path$c.sep ? false : options.extraIgnore.ignores(normal)) }); @@ -14266,14 +27307,26 @@ function statAndIgnore(file, options, callback) { } } -function base(file) { - return typeof file === 'string' ? path$7.basename(file) : file.basename +/** + * @param {string|VFile} file + * @returns {string} + */ +function base$1(file) { + return typeof file === 'string' ? path$c.basename(file) : file.basename } +/** + * @param {string|VFile} file + * @returns {string} + */ function filePath(file) { return typeof file === 'string' ? file : file.path } +/** + * @param {Result} result + * @returns {boolean} + */ function oneFileMode(result) { return ( result.output.length === 1 && @@ -14282,17 +27335,23 @@ function oneFileMode(result) { ) } -var Ignore = ignore$1; -var find = finder; - -var fileSystem_1$1 = fileSystem$3; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Settings} Settings + * @typedef {import('./index.js').Configuration} Configuration + */ -// Find files from the file-system. -function fileSystem$3(context, settings, next) { +/** + * @param {Context} context + * @param {Settings} settings + * @param {Callback} next + */ +function fileSystem$1(context, settings, next) { if (context.files.length === 0) { next(); } else { - find( + finder( context.files, { cwd: settings.cwd, @@ -14307,37 +27366,46 @@ function fileSystem$3(context, settings, next) { ignorePathResolveFrom: settings.ignorePathResolveFrom }) }, - onfound - ); - } - - function onfound(error, result) { - var output = result.files; + (error, result) => { + // Glob errors typically don’t occur. + /* c8 ignore next 4 */ + if (!result) { + next(error); + return + } - // Sort alphabetically. - // Everything is unique so we do not care about cases where left and right - // are equal. - output.sort(sortAlphabetically); + const output = result.files; - // Mark as given. - // This allows outputting files, which can be pretty dangerous, so it’s - // “hidden”. - output.forEach(markAsGiven); + // Sort alphabetically. + // Everything is unique so we do not care about cases where left and right + // are equal. + output.sort(sortAlphabetically); - context.files = output; + // Mark as given. + // This allows outputting files, which can be pretty dangerous, so it’s + // “hidden”. + let index = -1; + while (++index < output.length) { + output[index].data.unifiedEngineGiven = true; + } - // If `out` was not set, detect it based on whether one file was given. - if (settings.out === null || settings.out === undefined) { - settings.out = result.oneFileMode; - } + context.files = output; - next(error); - } + // If `out` was not set, detect it based on whether one file was given. + if (settings.out === null || settings.out === undefined) { + settings.out = result.oneFileMode; + } - function markAsGiven(file) { - file.data.unifiedEngineGiven = true; + next(error); + } + ); } + /** + * @param {VFile} left + * @param {VFile} right + * @returns {number} + */ function sortAlphabetically(left, right) { return left.path < right.path ? -1 : 1 } @@ -14345,7 +27413,7 @@ function fileSystem$3(context, settings, next) { /* eslint-disable node/no-deprecated-api */ -var toString$8 = Object.prototype.toString; +var toString$2 = Object.prototype.toString; var isModern = ( typeof Buffer !== 'undefined' && @@ -14355,7 +27423,7 @@ var isModern = ( ); function isArrayBuffer (input) { - return toString$8.call(input).slice(8, -1) === 'ArrayBuffer' + return toString$2.call(input).slice(8, -1) === 'ArrayBuffer' } function fromArrayBuffer (obj, byteOffset, length) { @@ -15050,8 +28118,8 @@ function packF32(v) { return packIEEE754(v, 8, 23); } }()); }(typedarray)); -var Writable = require$$0__default$5['default'].Writable; -var inherits$1 = inherits$3.exports; +var Writable = require$$1.Writable; +var inherits = inherits$2.exports; var bufferFrom = bufferFrom_1; if (typeof Uint8Array === 'undefined') { @@ -15091,7 +28159,7 @@ function ConcatStream(opts, cb) { } var concatStream = ConcatStream; -inherits$1(ConcatStream, Writable); +inherits(ConcatStream, Writable); ConcatStream.prototype._write = function(chunk, enc, next) { this.body.push(chunk); @@ -15190,17 +28258,25 @@ function u8Concat (parts) { return u8 } -var debug$b = src.exports('unified-engine:file-set-pipeline:stdin'); -var vfile$3 = toVfile; -var concat = concatStream; - -var stdin_1 = stdin$1; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Settings} Settings + */ -function stdin$1(context, settings, next) { - var error; +const debug$9 = createDebug('unified-engine:file-set-pipeline:stdin'); +/** + * @param {Context} context + * @param {Settings} settings + * @param {Callback} next + */ +function stdin(context, settings, next) { if (settings.files && settings.files.length > 0) { - debug$b('Ignoring `streamIn`'); + debug$9('Ignoring `streamIn`'); + + /** @type {Error|undefined} */ + let error; if (settings.filePath) { error = new Error( @@ -15213,176 +28289,183 @@ function stdin$1(context, settings, next) { return } + // @ts-expect-error: does exist on `stdin`. if (settings.streamIn.isTTY) { - debug$b('Cannot read from `tty` stream'); + debug$9('Cannot read from `tty` stream'); next(new Error('No input')); return } - debug$b('Reading from `streamIn`'); - - settings.streamIn.pipe(concat({encoding: 'string'}, read)); - - function read(value) { - var file = vfile$3(settings.filePath || undefined); - - debug$b('Read from `streamIn`'); - - file.cwd = settings.cwd; - file.contents = value; - file.data.unifiedEngineGiven = true; - file.data.unifiedEngineStreamIn = true; - - context.files = [file]; - - // If `out` was not set, set `out`. - settings.out = - settings.out === null || settings.out === undefined ? true : settings.out; - - next(); - } -} - -var events = require$$0__default$4['default']; -var inherits = require$$0__default['default'].inherits; -var trough$3 = trough_1; -var vfile$2 = toVfile; + debug$9('Reading from `streamIn`'); -var fileSet = FileSet$1; - -// FileSet constructor. -function FileSet$1() { - var self = this; + settings.streamIn.pipe( + concatStream({encoding: 'string'}, (value) => { + const file = toVFile(settings.filePath); - self.files = []; - self.origins = []; + debug$9('Read from `streamIn`'); - self.expected = 0; - self.actual = 0; + file.cwd = settings.cwd; + file.value = value; + file.data.unifiedEngineGiven = true; + file.data.unifiedEngineStreamIn = true; - self.pipeline = trough$3(); - self.plugins = []; + context.files = [file]; - events.init.call(self); + // If `out` was not set, set `out`. + settings.out = + settings.out === null || settings.out === undefined + ? true + : settings.out; - self.on('one', one$1.bind(self)); + next(); + }) + ); } -// Events. -inherits(FileSet$1, events.EventEmitter); - -// Expose methods. -FileSet$1.prototype.valueOf = valueOf; -FileSet$1.prototype.use = use; -FileSet$1.prototype.add = add; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Pipeline} Pipeline + */ -// Create an array representation of `fileSet`. -function valueOf() { - return this.files -} +class FileSet extends EventEmitter$1 { + /** + * FileSet constructor. + * A FileSet is created to process multiple files through unified processors. + * This set, containing all files, is exposed to plugins as an argument to the + * attacher. + */ + constructor() { + super(); -// Attach middleware to the pipeline on `fileSet`. -function use(plugin) { - var self = this; - var pipeline = self.pipeline; - var duplicate = false; + /** @type {Array.<VFile>} */ + this.files = []; + /** @type {string[]} */ + this.origins = []; + /** @type {Completer[]} */ + this.plugins = []; + /** @type {number} */ + this.expected = 0; + /** @type {number} */ + this.actual = 0; + /** @type {Pipeline} */ + this.pipeline = trough(); - if (plugin && plugin.pluginId) { - duplicate = self.plugins.some(matches); - } + // Called when a single file has completed it’s pipeline, triggering `done` + // when all files are complete. + this.on('one', () => { + this.actual++; - if (!duplicate && self.plugins.indexOf(plugin) !== -1) { - duplicate = true; + if (this.actual >= this.expected) { + this.emit('done'); + } + }); } - if (!duplicate) { - self.plugins.push(plugin); - pipeline.use(plugin); + /** + * Access the files in a set. + */ + valueOf() { + return this.files } - return self + /** + * Attach middleware to the pipeline on `fileSet`. + * + * @param {Completer} plugin + */ + use(plugin) { + const pipeline = this.pipeline; + let duplicate = false; - function matches(fn) { - return fn.pluginId === plugin.pluginId - } -} + if (plugin && plugin.pluginId) { + duplicate = this.plugins.some((fn) => fn.pluginId === plugin.pluginId); + } -// Add a file to be processed. -// Ignores duplicate files (based on the `filePath` at time of addition). -// Only runs `file-pipeline` on files which have not `failed` before addition. -function add(file) { - var self = this; + if (!duplicate && this.plugins.includes(plugin)) { + duplicate = true; + } - if (typeof file === 'string') { - file = vfile$2(file); - } + if (!duplicate) { + this.plugins.push(plugin); + pipeline.use(plugin); + } - // Prevent files from being added multiple times. - if (self.origins.indexOf(file.history[0]) !== -1) { - return self + return this } - self.origins.push(file.history[0]); - - // Add. - self.valueOf().push(file); - self.expected++; - - // Force an asynchronous operation. - // This ensures that files which fall through the file pipeline immediately - // (such as, when already fatally failed) still queue up correctly. - setImmediate(add); + /** + * Add a file to be processed. + * The given file is processed like other files with a few differences: + * + * * Ignored when their file path is already added + * * Never written to the file system or streamOut + * * Not reported for + * + * @param {string|VFile} file + */ + add(file) { + if (typeof file === 'string') { + file = toVFile(file); + } - return self + // Prevent files from being added multiple times. + if (this.origins.includes(file.history[0])) { + return this + } - function add() { - self.emit('add', file); - } -} + this.origins.push(file.history[0]); -// Utility invoked when a single file has completed it's pipeline, triggering -// `done` when all files are complete. -function one$1() { - var self = this; + // Add. + this.valueOf().push(file); + this.expected++; - self.actual++; + // Force an asynchronous operation. + // This ensures that files which fall through the file pipeline immediately + // (such as, when already fatally failed) still queue up correctly. + setImmediate(() => { + this.emit('add', file); + }); - if (self.actual >= self.expected) { - self.emit('done'); + return this } } -var fs$6 = require$$0__default$3['default']; -var path$6 = require$$0__default$2['default']; -var debug$a = src.exports('unified-engine:file-pipeline:read'); -var stats$7 = vfileStatistics; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Context} Context + */ -var read_1 = read$2; +const debug$8 = createDebug('unified-engine:file-pipeline:read'); -// Fill a file with its contents when not already filled. -function read$2(context, file, fileSet, next) { - var filePath = file.path; +/** + * Fill a file with its value when not already filled. + * + * @param {Context} context + * @param {VFile} file + * @param {Callback} next + */ +function read$1(context, file, next) { + let filePath = file.path; - if (file.contents || file.data.unifiedEngineStreamIn) { - debug$a('Not reading file `%s` with contents', filePath); + if (file.value || file.data.unifiedEngineStreamIn) { + debug$8('Not reading file `%s` with `value`', filePath); next(); - } else if (stats$7(file).fatal) { - debug$a('Not reading failed file `%s`', filePath); + } else if (statistics(file).fatal) { + debug$8('Not reading failed file `%s`', filePath); next(); } else { - filePath = path$6.resolve(context.cwd, filePath); + filePath = path$c.resolve(context.settings.cwd, filePath); - debug$a('Reading `%s` in `%s`', filePath, 'utf8'); - fs$6.readFile(filePath, 'utf8', onread); - } - - function onread(error, contents) { - debug$a('Read `%s` (error: %s)', filePath, error); + debug$8('Reading `%s` in `%s`', filePath, 'utf8'); + fs$a.readFile(filePath, 'utf8', (error, value) => { + debug$8('Read `%s` (error: %s)', filePath, error); - file.contents = contents || ''; + file.value = value || ''; - next(error); + next(error); + }); } } @@ -15400,7 +28483,7 @@ var has = Object.prototype.hasOwnProperty; * @type {Function} */ -var toString$7 = Object.prototype.toString; +var toString$1 = Object.prototype.toString; /** * Test whether a value is "empty". @@ -15409,7 +28492,7 @@ var toString$7 = Object.prototype.toString; * @return {Boolean} */ -function isEmpty$1(val) { +function isEmpty(val) { // Null and Undefined... if (val == null) return true @@ -15432,7 +28515,7 @@ function isEmpty$1(val) { if (val instanceof Error) return val.message === '' // Objects... - if (val.toString == toString$7) { + if (val.toString == toString$1) { switch (val.toString()) { // Maps, Sets, Files and Errors... @@ -15463,89 +28546,107 @@ function isEmpty$1(val) { * @type {Function} */ -var lib$5 = isEmpty$1; +var lib$1 = isEmpty; -var debug$9 = src.exports('unified-engine:file-pipeline:configure'); -var stats$6 = vfileStatistics; -var empty$3 = lib$5; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Context} Context + */ -var configure_1$1 = configure$5; +const debug$7 = createDebug('unified-engine:file-pipeline:configure'); -// Collect configuration for a file based on the context. -function configure$5(context, file, fileSet, next) { - if (stats$6(file).fatal) { +/** + * Collect configuration for a file based on the context. + * + * @param {Context} context + * @param {VFile} file + * @param {Callback} next + */ +function configure$2(context, file, next) { + if (statistics(file).fatal) { return next() } - context.configuration.load(file.path, handleConfiguration); - - function handleConfiguration(error, configuration) { - var index = -1; - var plugin; - var options; + context.configuration.load(file.path, (error, configuration) => { + let index = -1; - if (error) { + if (!configuration) { return next(error) } + // Could be missing if a `configTransform` returns weird things. + /* c8 ignore next 1 */ + const plugins = configuration.plugins || []; + // Store configuration on the context object. - debug$9('Using settings `%j`', configuration.settings); + debug$7('Using settings `%j`', configuration.settings); context.processor.data('settings', configuration.settings); - debug$9('Using `%d` plugins', configuration.plugins.length); + debug$7('Using `%d` plugins', plugins.length); - while (++index < configuration.plugins.length) { - plugin = configuration.plugins[index][0]; - options = configuration.plugins[index][1]; + while (++index < plugins.length) { + const plugin = plugins[index][0]; + let options = plugins[index][1]; if (options === false) { continue } // Allow for default arguments in es2020. - if (options === null || (typeof options === 'object' && empty$3(options))) { + /* c8 ignore next 6 */ + if ( + options === null || + (typeof options === 'object' && lib$1(options)) + ) { options = undefined; } - debug$9( + debug$7( 'Using plugin `%s`, with options `%j`', + // @ts-expect-error: `displayName` sure can exist on functions. plugin.displayName || plugin.name || 'function', options ); try { - context.processor.use(plugin, options, fileSet); + context.processor.use(plugin, options, context.fileSet); + /* Should not happen anymore! */ + /* c8 ignore next 3 */ } catch (error_) { - /* istanbul ignore next - Should not happen anymore! */ return next(error_) } } next(); - } + }); } -var debug$8 = src.exports('unified-engine:file-pipeline:parse'); -var stats$5 = vfileStatistics; -var json$1 = parseJson_1; - -var parse_1$4 = parse$a; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('./index.js').Context} Context + */ -// Fill a file with a tree. -function parse$a(context, file) { - var message; +const debug$6 = createDebug('unified-engine:file-pipeline:parse'); - if (stats$5(file).fatal) { +/** + * Fill a file with a tree. + * + * @param {Context} context + * @param {VFile} file + */ +function parse$2(context, file) { + if (statistics(file).fatal) { return } - if (context.treeIn) { - debug$8('Not parsing already parsed document'); + if (context.settings.treeIn) { + debug$6('Not parsing already parsed document'); try { - context.tree = json$1(file.toString()); + context.tree = parseJson_1(file.toString()); } catch (error) { - message = file.message( + const message = file.message( new Error('Cannot read file as JSON\n' + error.message) ); message.fatal = true; @@ -15555,334 +28656,457 @@ function parse$a(context, file) { // correctly recognised. // Only add it if there is a path — not if the file is for example stdin. if (file.path) { - file.extname = context.extensions[0]; + file.extname = context.settings.extensions[0]; } - file.contents = ''; + file.value = ''; return } - debug$8('Parsing `%s`', file.path); + debug$6('Parsing `%s`', file.path); context.tree = context.processor.parse(file); - debug$8('Parsed document'); + debug$6('Parsed document'); } -var debug$7 = src.exports('unified-engine:file-pipeline:transform'); -var stats$4 = vfileStatistics; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Context} Context + */ -var transform_1$1 = transform$5; +const debug$5 = createDebug('unified-engine:file-pipeline:transform'); -// Transform the tree associated with a file with configured plugins. -function transform$5(context, file, fileSet, next) { - if (stats$4(file).fatal) { +/** + * Transform the tree associated with a file with configured plugins. + * + * @param {Context} context + * @param {VFile} file + * @param {Callback} next + */ +function transform$2(context, file, next) { + if (statistics(file).fatal) { next(); } else { - debug$7('Transforming document `%s`', file.path); - context.processor.run(context.tree, file, onrun); - } - - function onrun(error, node) { - debug$7('Transformed document (error: %s)', error); - context.tree = node; - next(error); + debug$5('Transforming document `%s`', file.path); + // @ts-expect-error: `tree` is defined at this point. + context.processor.run(context.tree, file, (error, node) => { + debug$5('Transformed document (error: %s)', error); + context.tree = node; + next(error); + }); } } -var debug$6 = src.exports('unified-engine:file-pipeline:queue'); -var stats$3 = vfileStatistics; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Context} Context + */ -var queue_1 = queue$1; +const debug$4 = createDebug('unified-engine:file-pipeline:queue'); -// Queue all files which came this far. -// When the last file gets here, run the file-set pipeline and flush the queue. -function queue$1(context, file, fileSet, next) { - var origin = file.history[0]; - var map = fileSet.complete; - var complete = true; +const own$a = {}.hasOwnProperty; + +/** + * Queue all files which came this far. + * When the last file gets here, run the file-set pipeline and flush the queue. + * + * @param {Context} context + * @param {VFile} file + * @param {Callback} next + */ +function queue(context, file, next) { + let origin = file.history[0]; + // @ts-expect-error: store a completion map on the `fileSet`. + let map = context.fileSet.complete; + let complete = true; if (!map) { map = {}; - fileSet.complete = map; + // @ts-expect-error: store a completion map on the `fileSet`. + context.fileSet.complete = map; } - debug$6('Queueing `%s`', origin); + debug$4('Queueing `%s`', origin); map[origin] = next; - fileSet.valueOf().forEach(each); + const files = context.fileSet.valueOf(); + let index = -1; + while (++index < files.length) { + each(files[index]); + } if (!complete) { - debug$6('Not flushing: some files cannot be flushed'); + debug$4('Not flushing: some files cannot be flushed'); return } - fileSet.complete = {}; - - fileSet.pipeline.run(fileSet, done); + // @ts-expect-error: Reset map. + context.fileSet.complete = {}; + context.fileSet.pipeline.run(context.fileSet, done); + /** + * @param {VFile} file + */ function each(file) { - var key = file.history[0]; + const key = file.history[0]; - if (stats$3(file).fatal) { + if (statistics(file).fatal) { return } if (typeof map[key] === 'function') { - debug$6('`%s` can be flushed', key); + debug$4('`%s` can be flushed', key); } else { - debug$6('Interupting flush: `%s` is not finished', key); + debug$4('Interupting flush: `%s` is not finished', key); complete = false; } } + /** + * @param {Error|Null} error + */ function done(error) { - debug$6('Flushing: all files can be flushed'); + debug$4('Flushing: all files can be flushed'); // Flush. for (origin in map) { - map[origin](error); + if (own$a.call(map, origin)) { + map[origin](error); + } } } } -var isEmpty = lib$5; - -// Detect color support. -var color$4 = true; - -try { - color$4 = 'inspect' in require$$0__default['default']; -} catch (_) { - /* istanbul ignore next - browser */ - color$4 = false; -} - -var unistUtilInspect = color$4 ? inspect$2 : /* istanbul ignore next */ noColor; - -inspect$2.color = inspect$2; -noColor.color = inspect$2; -inspect$2.noColor = noColor; -noColor.noColor = noColor; +var own$9 = {}.hasOwnProperty; +var bold = ansiColor(1, 22); var dim = ansiColor(2, 22); var yellow = ansiColor(33, 39); var green = ansiColor(32, 39); -// Define ANSII color removal functionality. -var colorExpression = new RegExp( - '(?:' + - '(?:\\u001b\\[)|' + - '\\u009b' + - ')' + - '(?:' + - '(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m]' + - ')|' + - '\\u001b[A-M]', - 'g' -); +// ANSI color regex. +/* eslint-disable-next-line no-control-regex */ +var colorExpression = /(?:(?:\u001B\[)|\u009B)(?:\d{1,3})?(?:(?:;\d{0,3})*)?[A-M|f-m]|\u001B[A-M]/g; -// Standard keys defined by unist: https://github.com/syntax-tree/unist. -// We don’t ignore `data` though. -var ignore = ['type', 'value', 'children', 'position']; - -// Inspects a node, without using color. -function noColor(node, pad) { - return stripColor(inspect$2(node, pad)) +/** + * Inspects a node, without using color. + * + * @param {unknown} node + * @param {InspectOptions} [options] + * @returns {string} + */ +function inspectNoColor(node, options) { + return inspectColor(node, options).replace(colorExpression, '') } -// Inspects a node. -function inspect$2(node, pad) { - var result; - var children; - var index; - var length; +/** + * Inspects a node, using color. + * + * @param {unknown} tree + * @param {InspectOptions} [options] + * @returns {string} + */ +function inspectColor(tree, options) { + var positions = + !options || + options.showPositions === null || + options.showPositions === undefined + ? true + : options.showPositions; - if (node && Boolean(node.length) && typeof node !== 'string') { - length = node.length; - index = -1; - result = []; + return inspectValue(tree) - while (++index < length) { - result[index] = inspect$2(node[index]); + /** + * @param {unknown} node + * @returns {string} + */ + function inspectValue(node) { + if (node && typeof node === 'object' && 'length' in node) { + // @ts-ignore looks like a list of nodes. + return inspectNodes(node) } - return result.join('\n') - } - - if (!node || !node.type) { - return String(node) - } - - result = [formatNode(node)]; - children = node.children; - length = children && children.length; - index = -1; + // @ts-ignore looks like a single node. + if (node && node.type) { + // @ts-ignore looks like a single node. + return inspectTree(node) + } - if (!length) { - return result[0] + return inspectNonTree(node) } - if (!pad || typeof pad === 'number') { - pad = ''; + /** + * @param {unknown} value + * @returns {string} + */ + function inspectNonTree(value) { + return JSON.stringify(value) } - while (++index < length) { - node = children[index]; + /** + * @param {Node[]} nodes + * @returns {string} + */ + function inspectNodes(nodes) { + /** @type {Array.<string>} */ + var result = []; + var index = -1; - if (index === length - 1) { - result.push(formatNesting(pad + '└─ ') + inspect$2(node, pad + ' ')); - } else { - result.push(formatNesting(pad + '├─ ') + inspect$2(node, pad + '│ ')); + while (++index < nodes.length) { + result.push( + dim((index < nodes.length - 1 ? '├' : '└') + '─' + index) + + ' ' + + indent( + inspectValue(nodes[index]), + (index < nodes.length - 1 ? dim('│') : ' ') + ' ', + true + ) + ); } - } - return result.join('\n') -} - -// Colored nesting formatter. -function formatNesting(value) { - return dim(value) -} - -// Compile a single position. -function compile$2(pos) { - var values = []; - - if (!pos) { - return null + return result.join('\n') } - values = [[pos.line || 1, pos.column || 1].join(':')]; + /** + * @param {Object.<string, unknown>} object + * @returns {string} + */ + function inspectFields(object) { + /** @type {Array.<string>} */ + var result = []; + /** @type {string} */ + var key; + /** @type {unknown} */ + var value; + /** @type {string} */ + var formatted; - if ('offset' in pos) { - values.push(String(pos.offset || 0)); - } + for (key in object) { + /* c8 ignore next 1 */ + if (!own$9.call(object, key)) continue - return values -} + value = object[key]; -// Compile a location. -function stringify$c(start, end) { - var values = []; - var positions = []; - var offsets = []; + if ( + value === undefined || + // Standard keys defined by unist that we format differently. + // <https://github.com/syntax-tree/unist> + key === 'type' || + key === 'value' || + key === 'children' || + key === 'position' || + // Ignore `name` (from xast) and `tagName` (from `hast`) when string. + (typeof value === 'string' && (key === 'name' || key === 'tagName')) + ) { + continue + } - add(start); - add(end); + // A single node. + if ( + value && + typeof value === 'object' && + // @ts-ignore looks like a node. + value.type && + key !== 'data' && + key !== 'attributes' && + key !== 'properties' + ) { + // @ts-ignore looks like a node. + formatted = inspectTree(value); + } + // A list of nodes. + else if ( + value && + typeof value === 'object' && + 'length' in value && + value[0] && + value[0].type + ) { + // @ts-ignore looks like a list of nodes. + formatted = '\n' + inspectNodes(value); + } else { + formatted = inspectNonTree(value); + } - if (positions.length !== 0) { - values.push(positions.join('-')); + result.push( + key + dim(':') + (/\s/.test(formatted.charAt(0)) ? '' : ' ') + formatted + ); + } + + return indent( + result.join('\n'), + // @ts-ignore looks like a parent node. + (object.children && object.children.length > 0 ? dim('│') : ' ') + ' ' + ) } - if (offsets.length !== 0) { - values.push(offsets.join('-')); + /** + * @param {Node} node + * @returns {string} + */ + function inspectTree(node) { + var result = [formatNode(node)]; + var fields = inspectFields(node); + // @ts-ignore looks like a parent. + var content = inspectNodes(node.children || []); + if (fields) result.push(fields); + if (content) result.push(content); + return result.join('\n') } - return values.join(', ') + /** + * Colored node formatter. + * + * @param {Node} node + * @returns {string} + */ + function formatNode(node) { + var result = [bold(node.type)]; + var kind = node.tagName || node.name; + var position = positions ? stringifyPosition(node.position) : ''; - // Add a position. - function add(position) { - var tuple = compile$2(position); + if (typeof kind === 'string') { + result.push('<', kind, '>'); + } - if (tuple) { - positions.push(tuple[0]); + if (node.children) { + // @ts-ignore looks like a parent. + result.push(dim('['), yellow(node.children.length), dim(']')); + } else if (typeof node.value === 'string') { + result.push(' ', green(inspectNonTree(node.value))); + } - if (tuple[1]) { - offsets.push(tuple[1]); - } + if (position) { + result.push(' ', dim('('), position, dim(')')); } + + return result.join('') } } -// Colored node formatter. -function formatNode(node) { - var log = node.type; - var location = node.position || {}; - var position = stringify$c(location.start, location.end); - var key; - var values = []; - var value; +/** + * @param {string} value + * @param {string} indentation + * @param {boolean} [ignoreFirst=false] + * @returns {string} + */ +function indent(value, indentation, ignoreFirst) { + var lines = value.split('\n'); + var index = ignoreFirst ? 0 : -1; - if (node.children) { - log += dim('[') + yellow(node.children.length) + dim(']'); - } else if (typeof node.value === 'string') { - log += dim(': ') + green(JSON.stringify(node.value)); - } + if (!value) return value - if (position) { - log += ' (' + position + ')'; + while (++index < lines.length) { + lines[index] = indentation + lines[index]; } - for (key in node) { - value = node[key]; + return lines.join('\n') +} - if ( - ignore.indexOf(key) !== -1 || - value === null || - value === undefined || - (typeof value === 'object' && isEmpty(value)) - ) { - continue - } +/** + * @param {Position} value + * @returns {string} + */ +function stringifyPosition(value) { + /** @type {Position} */ + // @ts-ignore + var position = value || {}; + /** @type {Array.<string>} */ + var result = []; + /** @type {Array.<string>} */ + var positions = []; + /** @type {Array.<string>} */ + var offsets = []; - values.push('[' + key + '=' + JSON.stringify(value) + ']'); - } + point(position.start); + point(position.end); - if (values.length !== 0) { - log += ' ' + values.join(''); - } + if (positions.length > 0) result.push(positions.join('-')); + if (offsets.length > 0) result.push(offsets.join('-')); - return log -} + return result.join(', ') -// Remove ANSI colour from `value`. -function stripColor(value) { - return value.replace(colorExpression, '') + /** + * @param {Point} value + */ + function point(value) { + if (value) { + positions.push((value.line || 1) + ':' + (value.column || 1)); + + if ('offset' in value) { + offsets.push(String(value.offset || 0)); + } + } + } } -// Factory to wrap values in ANSI colours. +/** + * Factory to wrap values in ANSI colours. + * + * @param {number} open + * @param {number} close + * @returns {function(string): string} + */ function ansiColor(open, close) { return color + /** + * @param {string} value + * @returns {string} + */ function color(value) { return '\u001B[' + open + 'm' + value + '\u001B[' + close + 'm' } } -var debug$5 = src.exports('unified-engine:file-pipeline:stringify'); -var buffer$3 = isBuffer; -var stats$2 = vfileStatistics; -var inspect$1 = unistUtilInspect; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('./index.js').Context} Context + */ -var stringify_1 = stringify$b; +const debug$3 = createDebug('unified-engine:file-pipeline:stringify'); -// Stringify a tree. -function stringify$b(context, file) { - var value; +/** + * Stringify a tree. + * + * @param {Context} context + * @param {VFile} file + */ +function stringify$1(context, file) { + /** @type {unknown} */ + let value; - if (stats$2(file).fatal) { - debug$5('Not compiling failed document'); + if (statistics(file).fatal) { + debug$3('Not compiling failed document'); return } - if (!context.output && !context.out && !context.alwaysStringify) { - debug$5('Not compiling document without output settings'); + if ( + !context.settings.output && + !context.settings.out && + !context.settings.alwaysStringify + ) { + debug$3('Not compiling document without output settings'); return } - debug$5('Compiling `%s`', file.path); + debug$3('Compiling `%s`', file.path); - if (context.inspect) { + if (context.settings.inspect) { // Add a `txt` extension if there is a path. if (file.path) { file.extname = '.txt'; } - value = inspect$1[context.color ? 'color' : 'noColor'](context.tree) + '\n'; - } else if (context.treeOut) { + value = + (context.settings.color ? inspectColor : inspectNoColor)(context.tree) + + '\n'; + } else if (context.settings.treeOut) { // Add a `json` extension to ensure the file is correctly seen as JSON. // Only add it if there is a path — not if the file is for example stdin. if (file.path) { @@ -15892,282 +29116,317 @@ function stringify$b(context, file) { // Add the line feed to create a valid UNIX file. value = JSON.stringify(context.tree, null, 2) + '\n'; } else { + // @ts-expect-error: `tree` is defined if we came this far. value = context.processor.stringify(context.tree, file); } - if (value === undefined || value === null) ; else if (typeof value === 'string' || buffer$3(value)) { - file.contents = value; + if (value === undefined || value === null) ; else if (typeof value === 'string' || isBuffer(value)) { + // @ts-expect-error: `isBuffer` checks buffer. + file.value = value; } else { file.result = value; } - debug$5('Serialized document'); + debug$3('Serialized document'); } -var fs$5 = require$$0__default$3['default']; -var path$5 = require$$0__default$2['default']; -var debug$4 = src.exports('unified-engine:file-pipeline:copy'); +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Context} Context + */ -var copy_1 = copy$4; +const debug$2 = createDebug('unified-engine:file-pipeline:copy'); -// Move a file. -function copy$4(context, file, fileSet, next) { - var output = context.output; - var outpath = output; - var currentPath = file.path; +/** + * Move a file. + * + * @param {Context} context + * @param {VFile} file + * @param {Callback} next + */ +function copy(context, file, next) { + const output = context.settings.output; + const currentPath = file.path; - if (typeof outpath !== 'string') { - debug$4('Not copying'); - return next() + if (typeof output !== 'string') { + debug$2('Not copying'); + next(); + return } - outpath = path$5.resolve(context.cwd, outpath); + const outpath = path$c.resolve(context.settings.cwd, output); - debug$4('Copying `%s`', currentPath); + debug$2('Copying `%s`', currentPath); - fs$5.stat(outpath, onstatfile); - - function onstatfile(error, stats) { + fs$a.stat(outpath, (error, stats) => { if (error) { if ( error.code !== 'ENOENT' || - output.charAt(output.length - 1) === path$5.sep + output.charAt(output.length - 1) === path$c.sep ) { return next( new Error('Cannot read output directory. Error:\n' + error.message) ) } - fs$5.stat(path$5.dirname(outpath), onstatparent); + // This is either given an error, or the parent exists which is a directory, + // but we should keep the basename of the given file. + fs$a.stat(path$c.dirname(outpath), (error) => { + if (error) { + next( + new Error('Cannot read parent directory. Error:\n' + error.message) + ); + } else { + done(false); + } + }); } else { done(stats.isDirectory()); } - } - - // This is either given an error, or the parent exists which is a directory, - // but we should keep the basename of the given file. - function onstatparent(error) { - if (error) { - next(new Error('Cannot read parent directory. Error:\n' + error.message)); - } else { - done(false); - } - } + }); + /** + * @param {boolean} directory + */ function done(directory) { - if (!directory && fileSet.expected > 1) { + if (!directory && context.fileSet.expected > 1) { return next( new Error('Cannot write multiple files to single output: ' + outpath) ) } - file[directory ? 'dirname' : 'path'] = path$5.relative(file.cwd, outpath); + file[directory ? 'dirname' : 'path'] = path$c.relative(file.cwd, outpath); - debug$4('Copying document from %s to %s', currentPath, file.path); + debug$2('Copying document from %s to %s', currentPath, file.path); next(); } } -var debug$3 = src.exports('unified-engine:file-pipeline:stdout'); -var stats$1 = vfileStatistics; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Context} Context + */ -var stdout_1 = stdout$1; +const debug$1 = createDebug('unified-engine:file-pipeline:stdout'); -// Write a virtual file to `streamOut`. -// Ignored when `output` is given, more than one file was processed, or `out` -// is false. -function stdout$1(context, file, fileSet, next) { +/** + * Write a virtual file to `streamOut`. + * Ignored when `output` is given, more than one file was processed, or `out` + * is false. + * + * @param {Context} context + * @param {VFile} file + * @param {Callback} next + */ +function stdout(context, file, next) { if (!file.data.unifiedEngineGiven) { - debug$3('Ignoring programmatically added file'); + debug$1('Ignoring programmatically added file'); next(); - } else if (stats$1(file).fatal || context.output || !context.out) { - debug$3('Ignoring writing to `streamOut`'); + } else if ( + statistics(file).fatal || + context.settings.output || + !context.settings.out + ) { + debug$1('Ignoring writing to `streamOut`'); next(); } else { - debug$3('Writing document to `streamOut`'); - context.streamOut.write(file.toString(), next); + debug$1('Writing document to `streamOut`'); + context.settings.streamOut.write(file.toString(), next); } } -var fs$4 = require$$0__default$3['default']; -var path$4 = require$$0__default$2['default']; -var debug$2 = src.exports('unified-engine:file-pipeline:file-system'); -var stats = vfileStatistics; - -var fileSystem_1 = fileSystem$2; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Context} Context + */ -// Write a virtual file to the file-system. -// Ignored when `output` is not given. -function fileSystem$2(context, file, fileSet, next) { - var destinationPath; +const debug = createDebug('unified-engine:file-pipeline:file-system'); - if (!context.output) { - debug$2('Ignoring writing to file-system'); +/** + * Write a virtual file to the file-system. + * Ignored when `output` is not given. + * + * @param {Context} context + * @param {VFile} file + * @param {Callback} next + */ +function fileSystem(context, file, next) { + if (!context.settings.output) { + debug('Ignoring writing to file-system'); return next() } if (!file.data.unifiedEngineGiven) { - debug$2('Ignoring programmatically added file'); + debug('Ignoring programmatically added file'); return next() } - destinationPath = file.path; + let destinationPath = file.path; if (!destinationPath) { - debug$2('Cannot write file without a `destinationPath`'); + debug('Cannot write file without a `destinationPath`'); return next(new Error('Cannot write file without an output path')) } - if (stats(file).fatal) { - debug$2('Cannot write file with a fatal error'); + if (statistics(file).fatal) { + debug('Cannot write file with a fatal error'); return next() } - destinationPath = path$4.resolve(context.cwd, destinationPath); - debug$2('Writing document to `%s`', destinationPath); + destinationPath = path$c.resolve(context.settings.cwd, destinationPath); + debug('Writing document to `%s`', destinationPath); file.stored = true; - - fs$4.writeFile(destinationPath, file.toString(), next); + fs$a.writeFile(destinationPath, file.toString(), next); } -var trough$2 = trough_1; -var read$1 = read_1; -var configure$4 = configure_1$1; -var parse$9 = parse_1$4; -var transform$4 = transform_1$1; -var queue = queue_1; -var stringify$a = stringify_1; -var copy$3 = copy_1; -var stdout = stdout_1; -var fileSystem$1 = fileSystem_1; +/** + * @typedef {import('trough').Pipeline} Pipeline + * @typedef {import('vfile').VFile} VFile + * @typedef {import('vfile-message').VFileMessage} VFileMessage + * @typedef {import('unist').Node} Node + * @typedef {import('unified').Processor} Processor + * @typedef {import('../file-set.js').FileSet} FileSet + * @typedef {import('../configuration.js').Configuration} Configuration + * @typedef {import('../index.js').Settings} Settings + */ // This pipeline ensures each of the pipes always runs: even if the read pipe // fails, queue and write run. -var filePipeline$1 = trough$2() - .use(chunk(trough$2().use(read$1).use(configure$4).use(parse$9).use(transform$4))) - .use(chunk(trough$2().use(queue))) - .use(chunk(trough$2().use(stringify$a).use(copy$3).use(stdout).use(fileSystem$1))); - -// Factory to run a pipe. -// Wraps a pipe to trigger an error on the `file` in `context`, but still call -// `next`. +const filePipeline = trough() + .use(chunk(trough().use(read$1).use(configure$2).use(parse$2).use(transform$2))) + .use(chunk(trough().use(queue))) + .use(chunk(trough().use(stringify$1).use(copy).use(stdout).use(fileSystem))); + +/** + * Factory to run a pipe. + * Wraps a pipe to trigger an error on the `file` in `context`, but still call + * `next`. + * + * @param {Pipeline} pipe + */ function chunk(pipe) { return run - // Run the bound bound pipe and handles any errors. - function run(context, file, fileSet, next) { - pipe.run(context, file, fileSet, one); - - function one(error) { - var messages = file.messages; - var index; + /** + * Run the bound pipe and handle any errors. + * + * @param {Context} context + * @param {VFile} file + * @param {() => void} next + */ + function run(context, file, next) { + pipe.run(context, file, (/** @type {VFileMessage|null} */ error) => { + const messages = file.messages; if (error) { - index = messages.indexOf(error); + const index = messages.indexOf(error); if (index === -1) { - error = file.message(error); - index = messages.length - 1; + Object.assign(file.message(error), {fatal: true}); + } else { + messages[index].fatal = true; } - - messages[index].fatal = true; } next(); - } + }); } } -var FileSet = fileSet; -var filePipeline = filePipeline$1; - -var transform_1 = transform$3; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('trough').Callback} Callback + * @typedef {import('./index.js').Settings} Settings + * @typedef {import('./index.js').Configuration} Configuration + */ -// Transform all files. -function transform$3(context, settings, next) { - var fileSet = new FileSet(); +/** + * Transform all files. + * + * @param {Context} context + * @param {Settings} settings + * @param {Callback} next + */ +function transform$1(context, settings, next) { + const fileSet = new FileSet(); context.fileSet = fileSet; - fileSet.on('add', add).on('done', next); - - if (context.files.length === 0) { - next(); - } else { - context.files.forEach(fileSet.add, fileSet); - } - - function add(file) { + fileSet.on('add', (/** @type {VFile} */ file) => { filePipeline.run( { configuration: context.configuration, + // Needed `any`s + // type-coverage:ignore-next-line processor: settings.processor(), - cwd: settings.cwd, - extensions: settings.extensions, - pluginPrefix: settings.pluginPrefix, - treeIn: settings.treeIn, - treeOut: settings.treeOut, - inspect: settings.inspect, - color: settings.color, - out: settings.out, - output: settings.output, - streamOut: settings.streamOut, - alwaysStringify: settings.alwaysStringify + fileSet, + settings }, file, - fileSet, - done - ); + (/** @type {Error|null} */ error) => { + // Does not occur as all failures in `filePipeLine` are failed on each + // file. + // Still, just to ensure things work in the future, we add an extra check. + /* c8 ignore next 4 */ + if (error) { + Object.assign(file.message(error), {fatal: true}); + } - function done(error) { - /* istanbul ignore next - Does not occur as all failures in `filePipeLine` - * are failed on each file. - * Still, just to ensure things work in the future, we add an extra - * check. */ - if (error) { - error = file.message(error); - error.fatal = true; + fileSet.emit('one', file); } + ); + }); + + fileSet.on('done', next); - fileSet.emit('one', file); + if (context.files.length === 0) { + next(); + } else { + let index = -1; + while (++index < context.files.length) { + fileSet.add(context.files[index]); } } } -var hasFlag$1 = (flag, argv) => { - argv = argv || process.argv; +function hasFlag(flag, argv = process$1.argv) { const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); - const pos = argv.indexOf(prefix + flag); - const terminatorPos = argv.indexOf('--'); - return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); -}; - -const os = require$$0__default$1['default']; -const hasFlag = hasFlag$1; + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +} -const {env} = process; +const {env} = process$1; -let forceColor; +let flagForceColor; if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) { - forceColor = 0; + flagForceColor = 0; } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) { - forceColor = 1; + flagForceColor = 1; } -if ('FORCE_COLOR' in env) { - if (env.FORCE_COLOR === true || env.FORCE_COLOR === 'true') { - forceColor = 1; - } else if (env.FORCE_COLOR === false || env.FORCE_COLOR === 'false') { - forceColor = 0; - } else { - forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); + +function envForceColor() { + if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + return 1; + } + + if (env.FORCE_COLOR === 'false') { + return 0; + } + + return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3); } } @@ -16184,22 +29443,31 @@ function translateLevel(level) { }; } -function supportsColor(stream) { +function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) { + const noFlagForceColor = envForceColor(); + if (noFlagForceColor !== undefined) { + flagForceColor = noFlagForceColor; + } + + const forceColor = sniffFlags ? flagForceColor : noFlagForceColor; + if (forceColor === 0) { return 0; } - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } + if (sniffFlags) { + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } - if (hasFlag('color=256')) { - return 2; + if (hasFlag('color=256')) { + return 2; + } } - if (stream && !stream.isTTY && forceColor === undefined) { + if (haveStream && !streamIsTTY && forceColor === undefined) { return 0; } @@ -16209,16 +29477,11 @@ function supportsColor(stream) { return min; } - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. Windows 10 build 14931 is the first release - // that supports 16m/TrueColor. - const osRelease = os.release().split('.'); + if (process$1.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = require$$0$2.release().split('.'); if ( - Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ) { @@ -16229,7 +29492,7 @@ function supportsColor(stream) { } if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { return 1; } @@ -16245,7 +29508,7 @@ function supportsColor(stream) { } if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); switch (env.TERM_PROGRAM) { case 'iTerm.app': @@ -16271,94 +29534,84 @@ function supportsColor(stream) { return min; } -function getSupportLevel(stream) { - const level = supportsColor(stream); +function createSupportsColor(stream, options = {}) { + const level = _supportsColor(stream, { + streamIsTTY: stream && stream.isTTY, + ...options + }); + return translateLevel(level); } -var supportsColor_1 = { - supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr) +const supportsColor = { + stdout: createSupportsColor({isTTY: tty$1.isatty(1)}), + stderr: createSupportsColor({isTTY: tty$1.isatty(2)}) }; -var stringWidth$1 = {exports: {}}; - -var ansiRegex$1 = ({onlyFirst = false} = {}) => { +function ansiRegex({onlyFirst = false} = {}) { const pattern = [ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' ].join('|'); return new RegExp(pattern, onlyFirst ? undefined : 'g'); -}; - -const ansiRegex = ansiRegex$1; +} -var stripAnsi$1 = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; +function stripAnsi(string) { + if (typeof string !== 'string') { + throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); + } -var isFullwidthCodePoint$2 = {exports: {}}; + return string.replace(ansiRegex(), ''); +} /* eslint-disable yoda */ -const isFullwidthCodePoint$1 = codePoint => { - if (Number.isNaN(codePoint)) { +function isFullwidthCodePoint(codePoint) { + if (!Number.isInteger(codePoint)) { return false; } // Code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if ( - codePoint >= 0x1100 && ( - codePoint <= 0x115F || // Hangul Jamo - codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET - codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= codePoint && codePoint <= 0x4DBF) || - // CJK Unified Ideographs .. Yi Radicals - (0x4E00 <= codePoint && codePoint <= 0xA4C6) || - // Hangul Jamo Extended-A - (0xA960 <= codePoint && codePoint <= 0xA97C) || - // Hangul Syllables - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - // CJK Compatibility Ideographs - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - // Vertical Forms - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - // CJK Compatibility Forms .. Small Form Variants - (0xFE30 <= codePoint && codePoint <= 0xFE6B) || - // Halfwidth and Fullwidth Forms - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || - // Kana Supplement - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - // Enclosed Ideographic Supplement - (0x1F200 <= codePoint && codePoint <= 0x1F251) || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= codePoint && codePoint <= 0x3FFFD) - ) - ) { - return true; - } - - return false; -}; - -isFullwidthCodePoint$2.exports = isFullwidthCodePoint$1; -isFullwidthCodePoint$2.exports.default = isFullwidthCodePoint$1; + // https://unicode.org/Public/UNIDATA/EastAsianWidth.txt + return codePoint >= 0x1100 && ( + codePoint <= 0x115F || // Hangul Jamo + codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET + codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + (0x3250 <= codePoint && codePoint <= 0x4DBF) || + // CJK Unified Ideographs .. Yi Radicals + (0x4E00 <= codePoint && codePoint <= 0xA4C6) || + // Hangul Jamo Extended-A + (0xA960 <= codePoint && codePoint <= 0xA97C) || + // Hangul Syllables + (0xAC00 <= codePoint && codePoint <= 0xD7A3) || + // CJK Compatibility Ideographs + (0xF900 <= codePoint && codePoint <= 0xFAFF) || + // Vertical Forms + (0xFE10 <= codePoint && codePoint <= 0xFE19) || + // CJK Compatibility Forms .. Small Form Variants + (0xFE30 <= codePoint && codePoint <= 0xFE6B) || + // Halfwidth and Fullwidth Forms + (0xFF01 <= codePoint && codePoint <= 0xFF60) || + (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || + // Kana Supplement + (0x1B000 <= codePoint && codePoint <= 0x1B001) || + // Enclosed Ideographic Supplement + (0x1F200 <= codePoint && codePoint <= 0x1F251) || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + (0x20000 <= codePoint && codePoint <= 0x3FFFD) + ); +} -var emojiRegex$1 = function () { +var emojiRegex = function () { // https://mths.be/emoji - return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; }; -const stripAnsi = stripAnsi$1; -const isFullwidthCodePoint = isFullwidthCodePoint$2.exports; -const emojiRegex = emojiRegex$1; - -const stringWidth = string => { +function stringWidth(string) { if (typeof string !== 'string' || string.length === 0) { return 0; } @@ -16373,33 +29626,29 @@ const stringWidth = string => { let width = 0; - for (let i = 0; i < string.length; i++) { - const code = string.codePointAt(i); + for (let index = 0; index < string.length; index++) { + const codePoint = string.codePointAt(index); // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { + if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) { continue; } // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { + if (codePoint >= 0x300 && codePoint <= 0x36F) { continue; } // Surrogates - if (code > 0xFFFF) { - i++; + if (codePoint > 0xFFFF) { + index++; } - width += isFullwidthCodePoint(code) ? 2 : 1; + width += isFullwidthCodePoint(codePoint) ? 2 : 1; } return width; -}; - -stringWidth$1.exports = stringWidth; -// TODO: remove this in the next major version -stringWidth$1.exports.default = stringWidth; +} /*! * repeat-string <https://github.com/jonschlinkert/repeat-string> @@ -16419,7 +29668,7 @@ var cache; * Expose `repeat` */ -var repeatString = repeat$7; +var repeatString = repeat; /** * Repeat the given `string` the specified `number` @@ -16439,7 +29688,7 @@ var repeatString = repeat$7; * @api public */ -function repeat$7(str, num) { +function repeat(str, num) { if (typeof str !== 'string') { throw new TypeError('expected a string'); } @@ -16470,68 +29719,115 @@ function repeat$7(str, num) { return res; } -var vfileSort = sort$1; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('vfile-message').VFileMessage} VFileMessage + */ -var severities = { - true: 2, - false: 1, - null: 0, - undefined: 0 -}; +var severities = {true: 2, false: 1, null: 0, undefined: 0}; -function sort$1(file) { +/** + * @template {VFile} F + * @param {F} file + * @returns {F} + */ +function sort(file) { file.messages.sort(comparator); return file } +/** + * @param {VFileMessage} a + * @param {VFileMessage} b + * @returns {number} + */ function comparator(a, b) { return ( - check$4(a, b, 'line') || - check$4(a, b, 'column') || + check$1(a, b, 'line') || + check$1(a, b, 'column') || severities[b.fatal] - severities[a.fatal] || - compare$3(a, b, 'source') || - compare$3(a, b, 'ruleId') || - compare$3(a, b, 'reason') || + compare(a, b, 'source') || + compare(a, b, 'ruleId') || + compare(a, b, 'reason') || 0 ) } -function check$4(a, b, property) { +/** + * @param {VFileMessage} a + * @param {VFileMessage} b + * @param {string} property + * @returns {number} + */ +function check$1(a, b, property) { return (a[property] || 0) - (b[property] || 0) } -function compare$3(a, b, property) { - return (a[property] || '').localeCompare(b[property] || '') +/** + * @param {VFileMessage} a + * @param {VFileMessage} b + * @param {string} property + * @returns {number} + */ +function compare(a, b, property) { + return String(a[property] || '').localeCompare(b[property] || '') } -var supported = supportsColor_1.stderr.hasBasic; -var width = stringWidth$1.exports; -var stringify$9 = unistUtilStringifyPosition; -var repeat$6 = repeatString; -var statistics$1 = vfileStatistics; -var sort = vfileSort; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('vfile-message').VFileMessage} VFileMessage + * @typedef {import('vfile-statistics').Statistics} Statistics + * + * @typedef Options + * @property {boolean} [color] + * @property {boolean} [silent=false] + * @property {boolean} [quiet=false] + * @property {boolean} [verbose=false] + * @property {string} [defaultName='<stdin>'] + * + * @typedef _Row + * @property {string} place + * @property {string} label + * @property {string} reason + * @property {string} ruleId + * @property {string} source + * + * @typedef _FileRow + * @property {'file'} type + * @property {VFile} file + * @property {Statistics} stats + * + * @typedef {{[x: string]: number}} _Sizes + * + * @typedef _Info + * @property {Array.<_FileRow|_Row>} rows + * @property {Statistics} stats + * @property {_Sizes} sizes + */ -var vfileReporter = reporter$1; +var own$8 = {}.hasOwnProperty; -var push$1 = [].push; +// @ts-ignore Types are incorrect. +var supported = supportsColor.stderr.hasBasic; -// `log-symbols` without chalk: -/* istanbul ignore next - Windows. */ -var chars$1 = +// `log-symbols` without chalk, ignored for Windows: +/* c8 ignore next 4 */ +var chars = process.platform === 'win32' ? {error: '×', warning: '‼'} : {error: '✖', warning: '⚠'}; -var labels = { - true: 'error', - false: 'warning', - null: 'info', - undefined: 'info' -}; +var labels = {true: 'error', false: 'warning', null: 'info', undefined: 'info'}; -// Report a file’s messages. -function reporter$1(files, options) { - var settings = options || {}; +/** + * Report a file’s messages. + * + * @param {Error|VFile|Array.<VFile>} [files] + * @param {Options} [options] + * @returns {string} + */ +function reporter$1(files, options = {}) { + /** @type {boolean} */ var one; if (!files) { @@ -16544,28 +29840,43 @@ function reporter$1(files, options) { } // One file. - if (!('length' in files)) { + if (!Array.isArray(files)) { one = true; files = [files]; } - return format(transform$2(files, settings), one, settings) + return format(transform(files, options), one, options) } -function transform$2(files, options) { +/** + * @param {Array.<VFile>} files + * @param {Options} options + * @returns {_Info} + */ +function transform(files, options) { var index = -1; + /** @type {Array.<_FileRow|_Row>} */ var rows = []; + /** @type {Array.<VFileMessage>} */ var all = []; + /** @type {number} */ + var offset; + /** @type {_Sizes} */ var sizes = {}; + /** @type {Array.<VFileMessage>} */ var messages; - var offset; + /** @type {VFileMessage} */ var message; - var messageRows; + /** @type {_Row} */ var row; + /** @type {Array.<_Row>} */ + var messageRows; + /** @type {string} */ var key; while (++index < files.length) { - messages = sort({messages: files[index].messages.concat()}).messages; + // @ts-ignore it works fine. + messages = sort({messages: [...files[index].messages]}).messages; messageRows = []; offset = -1; @@ -16576,10 +29887,10 @@ function transform$2(files, options) { all.push(message); row = { - location: stringify$9( - message.location.end.line && message.location.end.column - ? message.location - : message.location.start + place: stringifyPosition$1( + message.position.end.line && message.position.end.column + ? message.position + : message.position.start ), label: labels[message.fatal], reason: @@ -16590,37 +29901,57 @@ function transform$2(files, options) { }; for (key in row) { - sizes[key] = Math.max(size$1(row[key]), sizes[key] || 0); + if (own$8.call(row, key)) { + sizes[key] = Math.max(size$1(row[key]), sizes[key] || 0); + } } messageRows.push(row); } } - if ((!options.quiet && !options.silent) || messageRows.length) { - rows.push({type: 'file', file: files[index], stats: statistics$1(messages)}); - push$1.apply(rows, messageRows); + if ((!options.quiet && !options.silent) || messageRows.length > 0) { + rows.push( + {type: 'file', file: files[index], stats: statistics(messages)}, + ...messageRows + ); } } - return {rows: rows, stats: statistics$1(all), sizes: sizes} + return {rows, stats: statistics(all), sizes} } +/** + * @param {_Info} map + * @param {boolean} one + * @param {Options} options + */ function format(map, one, options) { - var enabled = options.color == null ? supported : options.color; + /** @type {boolean} */ + var enabled = + options.color === undefined || options.color === null + ? supported + : options.color; + /** @type {Array.<string>} */ var lines = []; var index = -1; + /** @type {Statistics} */ var stats; + /** @type {_FileRow|_Row} */ var row; + /** @type {string} */ var line; + /** @type {string} */ var reason; + /** @type {string} */ var rest; + /** @type {RegExpMatchArray} */ var match; while (++index < map.rows.length) { row = map.rows[index]; - if (row.type === 'file') { + if ('type' in row) { stats = row.stats; line = row.file.history[0] || options.defaultName || '<stdin>'; @@ -16628,14 +29959,14 @@ function format(map, one, options) { one && !options.defaultName && !row.file.history[0] ? '' : (enabled - ? '\x1b[4m' /* Underline. */ + + ? '\u001B[4m' /* Underline. */ + (stats.fatal - ? '\x1b[31m' /* Red. */ + ? '\u001B[31m' /* Red. */ : stats.total - ? '\x1b[33m' /* Yellow. */ - : '\x1b[32m') /* Green. */ + + ? '\u001B[33m' /* Yellow. */ + : '\u001B[32m') /* Green. */ + line + - '\x1b[39m\x1b[24m' + '\u001B[39m\u001B[24m' : line) + (row.file.stored && row.file.path !== row.file.history[0] ? ' > ' + row.file.path @@ -16646,13 +29977,13 @@ function format(map, one, options) { (line ? line + ': ' : '') + (row.file.stored ? enabled - ? '\x1b[33mwritten\x1b[39m' /* Yellow. */ + ? '\u001B[33mwritten\u001B[39m' /* Yellow. */ : 'written' : 'no issues found'); } if (line) { - if (index && map.rows[index - 1].type !== 'file') { + if (index && !('type' in map.rows[index - 1])) { lines.push(''); } @@ -16672,23 +30003,23 @@ function format(map, one, options) { lines.push( ( ' ' + - repeat$6(' ', map.sizes.location - size$1(row.location)) + - row.location + + repeatString(' ', map.sizes.place - size$1(row.place)) + + row.place + ' ' + (enabled ? (row.label === 'error' - ? '\x1b[31m' /* Red. */ - : '\x1b[33m') /* Yellow. */ + + ? '\u001B[31m' /* Red. */ + : '\u001B[33m') /* Yellow. */ + row.label + - '\x1b[39m' + '\u001B[39m' : row.label) + - repeat$6(' ', map.sizes.label - size$1(row.label)) + + repeatString(' ', map.sizes.label - size$1(row.label)) + ' ' + reason + - repeat$6(' ', map.sizes.reason - size$1(reason)) + + repeatString(' ', map.sizes.reason - size$1(reason)) + ' ' + row.ruleId + - repeat$6(' ', map.sizes.ruleId - size$1(row.ruleId)) + + repeatString(' ', map.sizes.ruleId - size$1(row.ruleId)) + ' ' + (row.source || '') ).replace(/ +$/, '') + rest @@ -16704,8 +30035,8 @@ function format(map, one, options) { if (stats.fatal) { line = (enabled - ? '\x1b[31m' /* Red. */ + chars$1.error + '\x1b[39m' - : chars$1.error) + + ? '\u001B[31m' /* Red. */ + chars.error + '\u001B[39m' + : chars.error) + ' ' + stats.fatal + ' ' + @@ -16716,8 +30047,8 @@ function format(map, one, options) { line = (line ? line + ', ' : '') + (enabled - ? '\x1b[33m' /* Yellow. */ + chars$1.warning + '\x1b[39m' - : chars$1.warning) + + ? '\u001B[33m' /* Yellow. */ + chars.warning + '\u001B[39m' + : chars.warning) + ' ' + stats.warn + ' ' + @@ -16734,32 +30065,54 @@ function format(map, one, options) { return lines.join('\n') } -// Get the length of `value`, ignoring ANSI sequences. +/** + * Get the length of `value`, ignoring ANSI sequences. + * + * @param {string} value + * @returns {number} + */ function size$1(value) { var match = /\r?\n|\r/.exec(value); - return width(match ? value.slice(0, match.index) : value) + return stringWidth(match ? value.slice(0, match.index) : value) } -var load$2 = loadPlugin_1; -var report = vfileReporter; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('../index.js').VFileReporter} VFileReporter + * @typedef {import('./index.js').Settings} Settings + * @typedef {import('./index.js').Configuration} Configuration + */ -var log_1 = log$1; +/** + * @typedef Context + * @property {Array.<VFile>} files + * @property {Configuration} [configuration] + */ -function log$1(context, settings, next) { - var reporter = settings.reporter || report; - var diagnostics; +/** + * @param {Context} context + * @param {Settings} settings + */ +async function log(context, settings) { + /** @type {VFileReporter} */ + let func = reporter$1; - if (typeof reporter === 'string') { + if (typeof settings.reporter === 'string') { try { - reporter = load$2(reporter, {cwd: settings.cwd, prefix: 'vfile-reporter'}); - } catch (_) { - next(new Error('Could not find reporter `' + reporter + '`')); - return + // @ts-expect-error: Assume loaded value is a vfile reporter. + func = await loadPlugin(settings.reporter, { + cwd: settings.cwd, + prefix: 'vfile-reporter' + }); + } catch { + throw new Error('Could not find reporter `' + settings.reporter + '`') } + } else if (settings.reporter) { + func = settings.reporter; } - diagnostics = reporter( - context.files.filter(given), + let diagnostics = func( + context.files.filter((file) => file.data.unifiedEngineGiven), Object.assign({}, settings.reporterOptions, { quiet: settings.quiet, silent: settings.silent, @@ -16772,80 +30125,247 @@ function log$1(context, settings, next) { diagnostics += '\n'; } - settings.streamError.write(diagnostics, next); - } else { - next(); + return new Promise((resolve) => { + settings.streamError.write(diagnostics, resolve); + }) } } -function given(file) { - return file.data.unifiedEngineGiven -} - -var trough$1 = trough_1; -var configure$3 = configure_1$2; -var fileSystem = fileSystem_1$1; -var stdin = stdin_1; -var transform$1 = transform_1; -var log = log_1; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('../configuration.js').Configuration} Configuration + * @typedef {import('../index.js').Settings} Settings + */ -var fileSetPipeline$1 = trough$1() +const fileSetPipeline = trough() .use(configure$3) - .use(fileSystem) + .use(fileSystem$1) .use(stdin) .use(transform$1) .use(log); -var PassThrough = require$$0__default$5['default'].PassThrough; -var statistics = vfileStatistics; -var fileSetPipeline = fileSetPipeline$1; - -var lib$4 = run; +/** + * @typedef {import('vfile').VFile} VFile + * @typedef {import('unified').Processor<any, any, any, any>} Processor + * @typedef {import('./file-set.js').FileSet} FileSet + * @typedef {import('./file-set.js').Completer} Completer + * @typedef {import('./ignore.js').ResolveFrom} ResolveFrom + * @typedef {import('./configuration.js').ConfigTransform} ConfigTransform + * @typedef {import('./configuration.js').Preset} Preset + * + * @typedef VFileReporterFields + * @property {boolean} [color] + * @property {boolean} [quiet] + * @property {boolean} [silent] + * + * @typedef {{[key: string]: unknown} & VFileReporterFields} VFileReporterOptions + * + * @callback VFileReporter + * @param {VFile[]} files + * @param {VFileReporterOptions} options + * @returns {string} + * + * @typedef Settings + * @property {Options['processor']} processor + * @property {Exclude<Options['cwd'], undefined>} cwd + * @property {Exclude<Options['files'], undefined>} files + * @property {Exclude<Options['extensions'], undefined>} extensions + * @property {Exclude<Options['streamIn'], undefined>} streamIn + * @property {Options['filePath']} filePath + * @property {Exclude<Options['streamOut'], undefined>} streamOut + * @property {Exclude<Options['streamError'], undefined>} streamError + * @property {Options['out']} out + * @property {Options['output']} output + * @property {Options['alwaysStringify']} alwaysStringify + * @property {Options['tree']} tree + * @property {Options['treeIn']} treeIn + * @property {Options['treeOut']} treeOut + * @property {Options['inspect']} inspect + * @property {Options['rcName']} rcName + * @property {Options['packageField']} packageField + * @property {Options['detectConfig']} detectConfig + * @property {Options['rcPath']} rcPath + * @property {Exclude<Options['settings'], undefined>} settings + * @property {Options['ignoreName']} ignoreName + * @property {Options['detectIgnore']} detectIgnore + * @property {Options['ignorePath']} ignorePath + * @property {Options['ignorePathResolveFrom']} ignorePathResolveFrom + * @property {Exclude<Options['ignorePatterns'], undefined>} ignorePatterns + * @property {Options['silentlyIgnore']} silentlyIgnore + * @property {Options['plugins']} plugins + * @property {Options['pluginPrefix']} pluginPrefix + * @property {Options['configTransform']} configTransform + * @property {Options['defaultConfig']} defaultConfig + * @property {Options['reporter']} reporter + * @property {Options['reporterOptions']} reporterOptions + * @property {Options['color']} color + * @property {Options['silent']} silent + * @property {Options['quiet']} quiet + * @property {Options['frail']} frail + * + * @typedef Options + * Options for unified engine + * @property {() => Processor} processor + * Unified processor to transform files + * @property {string} [cwd] + * Directory to search files in, load plugins from, and more. + * Defaults to `process.cwd()`. + * @property {Array<string|VFile>} [files] + * Paths or globs to files and directories, or virtual files, to process. + * @property {string[]} [extensions] + * If `files` matches directories, include `files` with `extensions` + * @property {NodeJS.ReadableStream} [streamIn] + * Stream to read from if no files are found or given. + * Defaults to `process.stdin`. + * @property {string} [filePath] + * File path to process the given file on `streamIn` as. + * @property {NodeJS.WritableStream} [streamOut] + * Stream to write processed files to. + * Defaults to `process.stdout`. + * @property {NodeJS.WritableStream} [streamError] + * Stream to write the report (if any) to. + * Defaults to `process.stderr`. + * @property {boolean} [out=false] + * Whether to write the processed file to `streamOut` + * @property {boolean|string} [output=false] + * Whether to write successfully processed files, and where to. + * + * * When `true`, overwrites the given files + * * When `false`, does not write to the file system + * * When pointing to an existing directory, files are written to that + * directory and keep their original basenames + * * When the parent directory of the given path exists and one file is + * processed, the file is written to the given path + * @property {boolean} [alwaysStringify=false] + * Whether to always serialize successfully processed files. + * @property {boolean} [tree=false] + * Whether to treat both input and output as a syntax tree. + * @property {boolean} [treeIn] + * Whether to treat input as a syntax tree. + * Defaults to `options.tree`. + * @property {boolean} [treeOut] + * Whether to treat output as a syntax tree. + * Defaults to `options.tree`. + * @property {boolean} [inspect=false] + * Whether to output a formatted syntax tree. + * @property {string} [rcName] + * Name of configuration files to load. + * @property {string} [packageField] + * Property at which configuration can be found in `package.json` files + * @property {boolean} [detectConfig] + * Whether to search for configuration files. + * Defaults to `true` if `rcName` or `packageField` are given + * @property {string} [rcPath] + * Filepath to a configuration file to load. + * @property {Preset['settings']} [settings] + * Configuration for the parser and compiler of the processor. + * @property {string} [ignoreName] + * Name of ignore files to load. + * @property {boolean} [detectIgnore] + * Whether to search for ignore files. + * Defaults to `true` if `ignoreName` is given. + * @property {string} [ignorePath] + * Filepath to an ignore file to load. + * @property {ResolveFrom} [ignorePathResolveFrom] + * Resolve patterns in `ignorePath` from the current working + * directory (`'cwd'`) or the ignore file’s directory (`'dir'`, default). + * @property {string[]} [ignorePatterns] + * Patterns to ignore in addition to ignore files + * @property {boolean} [silentlyIgnore=false] + * Skip given files if they are ignored. + * @property {Preset['plugins']} [plugins] + * Plugins to use. + * @property {string} [pluginPrefix] + * Prefix to use when searching for plugins + * @property {ConfigTransform} [configTransform] + * Transform config files from a different schema. + * @property {Preset} [defaultConfig] + * Default configuration to use if no config file is given or found. + * @property {VFileReporter|string} [reporter] + * Reporter to use + * Defaults to `vfile-reporter` + * @property {VFileReporterOptions} [reporterOptions] + * Config to pass to the used reporter. + * @property {VFileReporterOptions['color']} [color=false] + * Whether to report with ANSI color sequences. + * @property {VFileReporterOptions['silent']} [silent=false] + * Report only fatal errors + * @property {VFileReporterOptions['quiet']} [quiet=false] + * Do not report successful files + * @property {boolean} [frail=false] + * Call back with an unsuccessful (`1`) code on warnings as well as errors + * + * @typedef Context + * Processing context. + * @property {VFile[]} [files] + * Processed files. + * @property {FileSet} [fileSet] + * Internally used information + * + * @callback Callback + * Callback called when processing according to options is complete. + * Invoked with either a fatal error if processing went horribly wrong + * (probably due to incorrect configuration), or a status code and the + * processing context. + * @param {Error|null} error + * @param {0|1} [status] + * @param {Context} [context] + * @returns {void} + */ -// Run the file set pipeline once. -// `callback` is invoked with a fatal error, or with a status code (`0` on -// success, `1` on failure). -function run(options, callback) { - var settings = {}; - var stdin = new PassThrough(); - var tree; - var detectConfig; - var hasConfig; - var detectIgnore; - var hasIgnore; +/** + * Run the file set pipeline once. + * `callback` is called with a fatal error, or with a status code (`0` on + * success, `1` on failure). + * + * @param {Options} options + * @param {Callback} callback + */ +function engine(options, callback) { + /** @type {Settings} */ + const settings = {}; + /** @type {NodeJS.ReadStream} */ + // @ts-expect-error: `PassThrough` sure is readable. + let stdin = new PassThrough(); try { - stdin = process.stdin; - } catch (_) { + stdin = process$2.stdin; // Obscure bug in Node (seen on Windows). // See: <https://github.com/nodejs/node/blob/f856234/lib/internal/process/stdio.js#L82>, // <https://github.com/AtomLinter/linter-markdown/pull/85>. - } + /* c8 ignore next 1 */ + } catch {} if (!callback) { throw new Error('Missing `callback`') } + // Needed `any`s + // type-coverage:ignore-next-line if (!options || !options.processor) { return next(new Error('Missing `processor`')) } // Processor. + // Needed `any`s + // type-coverage:ignore-next-line settings.processor = options.processor; // Path to run as. - settings.cwd = options.cwd || process.cwd(); + settings.cwd = options.cwd || process$2.cwd(); // Input. settings.files = options.files || []; - settings.extensions = (options.extensions || []).map(extension$2); + settings.extensions = (options.extensions || []).map((ext) => + ext.charAt(0) === '.' ? ext : '.' + ext + ); - settings.filePath = options.filePath || null; + settings.filePath = options.filePath; settings.streamIn = options.streamIn || stdin; // Output. - settings.streamOut = options.streamOut || process.stdout; - settings.streamError = options.streamError || process.stderr; + settings.streamOut = options.streamOut || process$2.stdout; + settings.streamError = options.streamError || process$2.stderr; settings.alwaysStringify = options.alwaysStringify; settings.output = options.output; settings.out = options.out; @@ -16860,7 +30380,7 @@ function run(options, callback) { } // Process phase management. - tree = options.tree || false; + const tree = options.tree || false; settings.treeIn = options.treeIn; settings.treeOut = options.treeOut; @@ -16875,8 +30395,8 @@ function run(options, callback) { } // Configuration. - detectConfig = options.detectConfig; - hasConfig = Boolean(options.rcName || options.packageField); + const detectConfig = options.detectConfig; + const hasConfig = Boolean(options.rcName || options.packageField); if (detectConfig && !hasConfig) { return next( @@ -16888,23 +30408,23 @@ function run(options, callback) { detectConfig === null || detectConfig === undefined ? hasConfig : detectConfig; - settings.rcName = options.rcName || null; - settings.rcPath = options.rcPath || null; - settings.packageField = options.packageField || null; + settings.rcName = options.rcName; + settings.rcPath = options.rcPath; + settings.packageField = options.packageField; settings.settings = options.settings || {}; settings.configTransform = options.configTransform; settings.defaultConfig = options.defaultConfig; // Ignore. - detectIgnore = options.detectIgnore; - hasIgnore = Boolean(options.ignoreName); + const detectIgnore = options.detectIgnore; + const hasIgnore = Boolean(options.ignoreName); settings.detectIgnore = detectIgnore === null || detectIgnore === undefined ? hasIgnore : detectIgnore; - settings.ignoreName = options.ignoreName || null; - settings.ignorePath = options.ignorePath || null; + settings.ignoreName = options.ignoreName; + settings.ignorePath = options.ignorePath; settings.ignorePathResolveFrom = options.ignorePathResolveFrom || 'dir'; settings.ignorePatterns = options.ignorePatterns || []; settings.silentlyIgnore = Boolean(options.silentlyIgnore); @@ -16914,23 +30434,27 @@ function run(options, callback) { } // Plugins. - settings.pluginPrefix = options.pluginPrefix || null; - settings.plugins = options.plugins || {}; + settings.pluginPrefix = options.pluginPrefix; + settings.plugins = options.plugins || []; // Reporting. - settings.reporter = options.reporter || null; - settings.reporterOptions = options.reporterOptions || null; + settings.reporter = options.reporter; + settings.reporterOptions = options.reporterOptions; settings.color = options.color || false; - settings.silent = options.silent || false; - settings.quiet = options.quiet || false; - settings.frail = options.frail || false; + settings.silent = options.silent; + settings.quiet = options.quiet; + settings.frail = options.frail; // Process. fileSetPipeline.run({files: options.files || []}, settings, next); + /** + * @param {Error|null} error + * @param {Context} [context] + */ function next(error, context) { - var stats = statistics((context || {}).files); - var failed = Boolean( + const stats = statistics((context || {}).files); + const failed = Boolean( settings.frail ? stats.fatal || stats.warn : stats.fatal ); @@ -16942,8246 +30466,6 @@ function run(options, callback) { } } -function extension$2(ext) { - return ext.charAt(0) === '.' ? ext : '.' + ext -} - -var ansiStyles$1 = {exports: {}}; - -var colorName = {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategray": [47, 79, 79],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "grey": [128, 128, 128],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "rebeccapurple": [102, 51, 153],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50]
-}; - -/* MIT license */ - -/* eslint-disable no-mixed-operators */ -const cssKeywords = colorName; - -// NOTE: conversions should only return primitive values (i.e. arrays, or -// values that give correct `typeof` results). -// do not use box values types (i.e. Number(), String(), etc.) - -const reverseKeywords = {}; -for (const key of Object.keys(cssKeywords)) { - reverseKeywords[cssKeywords[key]] = key; -} - -const convert$4 = { - rgb: {channels: 3, labels: 'rgb'}, - hsl: {channels: 3, labels: 'hsl'}, - hsv: {channels: 3, labels: 'hsv'}, - hwb: {channels: 3, labels: 'hwb'}, - cmyk: {channels: 4, labels: 'cmyk'}, - xyz: {channels: 3, labels: 'xyz'}, - lab: {channels: 3, labels: 'lab'}, - lch: {channels: 3, labels: 'lch'}, - hex: {channels: 1, labels: ['hex']}, - keyword: {channels: 1, labels: ['keyword']}, - ansi16: {channels: 1, labels: ['ansi16']}, - ansi256: {channels: 1, labels: ['ansi256']}, - hcg: {channels: 3, labels: ['h', 'c', 'g']}, - apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, - gray: {channels: 1, labels: ['gray']} -}; - -var conversions$2 = convert$4; - -// Hide .channels and .labels properties -for (const model of Object.keys(convert$4)) { - if (!('channels' in convert$4[model])) { - throw new Error('missing channels property: ' + model); - } - - if (!('labels' in convert$4[model])) { - throw new Error('missing channel labels property: ' + model); - } - - if (convert$4[model].labels.length !== convert$4[model].channels) { - throw new Error('channel and label counts mismatch: ' + model); - } - - const {channels, labels} = convert$4[model]; - delete convert$4[model].channels; - delete convert$4[model].labels; - Object.defineProperty(convert$4[model], 'channels', {value: channels}); - Object.defineProperty(convert$4[model], 'labels', {value: labels}); -} - -convert$4.rgb.hsl = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const min = Math.min(r, g, b); - const max = Math.max(r, g, b); - const delta = max - min; - let h; - let s; - - if (max === min) { - h = 0; - } else if (r === max) { - h = (g - b) / delta; - } else if (g === max) { - h = 2 + (b - r) / delta; - } else if (b === max) { - h = 4 + (r - g) / delta; - } - - h = Math.min(h * 60, 360); - - if (h < 0) { - h += 360; - } - - const l = (min + max) / 2; - - if (max === min) { - s = 0; - } else if (l <= 0.5) { - s = delta / (max + min); - } else { - s = delta / (2 - max - min); - } - - return [h, s * 100, l * 100]; -}; - -convert$4.rgb.hsv = function (rgb) { - let rdif; - let gdif; - let bdif; - let h; - let s; - - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const v = Math.max(r, g, b); - const diff = v - Math.min(r, g, b); - const diffc = function (c) { - return (v - c) / 6 / diff + 1 / 2; - }; - - if (diff === 0) { - h = 0; - s = 0; - } else { - s = diff / v; - rdif = diffc(r); - gdif = diffc(g); - bdif = diffc(b); - - if (r === v) { - h = bdif - gdif; - } else if (g === v) { - h = (1 / 3) + rdif - bdif; - } else if (b === v) { - h = (2 / 3) + gdif - rdif; - } - - if (h < 0) { - h += 1; - } else if (h > 1) { - h -= 1; - } - } - - return [ - h * 360, - s * 100, - v * 100 - ]; -}; - -convert$4.rgb.hwb = function (rgb) { - const r = rgb[0]; - const g = rgb[1]; - let b = rgb[2]; - const h = convert$4.rgb.hsl(rgb)[0]; - const w = 1 / 255 * Math.min(r, Math.min(g, b)); - - b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); - - return [h, w * 100, b * 100]; -}; - -convert$4.rgb.cmyk = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - - const k = Math.min(1 - r, 1 - g, 1 - b); - const c = (1 - r - k) / (1 - k) || 0; - const m = (1 - g - k) / (1 - k) || 0; - const y = (1 - b - k) / (1 - k) || 0; - - return [c * 100, m * 100, y * 100, k * 100]; -}; - -function comparativeDistance(x, y) { - /* - See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance - */ - return ( - ((x[0] - y[0]) ** 2) + - ((x[1] - y[1]) ** 2) + - ((x[2] - y[2]) ** 2) - ); -} - -convert$4.rgb.keyword = function (rgb) { - const reversed = reverseKeywords[rgb]; - if (reversed) { - return reversed; - } - - let currentClosestDistance = Infinity; - let currentClosestKeyword; - - for (const keyword of Object.keys(cssKeywords)) { - const value = cssKeywords[keyword]; - - // Compute comparative distance - const distance = comparativeDistance(rgb, value); - - // Check if its less, if so set as closest - if (distance < currentClosestDistance) { - currentClosestDistance = distance; - currentClosestKeyword = keyword; - } - } - - return currentClosestKeyword; -}; - -convert$4.keyword.rgb = function (keyword) { - return cssKeywords[keyword]; -}; - -convert$4.rgb.xyz = function (rgb) { - let r = rgb[0] / 255; - let g = rgb[1] / 255; - let b = rgb[2] / 255; - - // Assume sRGB - r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); - g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); - b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); - - const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); - - return [x * 100, y * 100, z * 100]; -}; - -convert$4.rgb.lab = function (rgb) { - const xyz = convert$4.rgb.xyz(rgb); - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); - - return [l, a, b]; -}; - -convert$4.hsl.rgb = function (hsl) { - const h = hsl[0] / 360; - const s = hsl[1] / 100; - const l = hsl[2] / 100; - let t2; - let t3; - let val; - - if (s === 0) { - val = l * 255; - return [val, val, val]; - } - - if (l < 0.5) { - t2 = l * (1 + s); - } else { - t2 = l + s - l * s; - } - - const t1 = 2 * l - t2; - - const rgb = [0, 0, 0]; - for (let i = 0; i < 3; i++) { - t3 = h + 1 / 3 * -(i - 1); - if (t3 < 0) { - t3++; - } - - if (t3 > 1) { - t3--; - } - - if (6 * t3 < 1) { - val = t1 + (t2 - t1) * 6 * t3; - } else if (2 * t3 < 1) { - val = t2; - } else if (3 * t3 < 2) { - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - } else { - val = t1; - } - - rgb[i] = val * 255; - } - - return rgb; -}; - -convert$4.hsl.hsv = function (hsl) { - const h = hsl[0]; - let s = hsl[1] / 100; - let l = hsl[2] / 100; - let smin = s; - const lmin = Math.max(l, 0.01); - - l *= 2; - s *= (l <= 1) ? l : 2 - l; - smin *= lmin <= 1 ? lmin : 2 - lmin; - const v = (l + s) / 2; - const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); - - return [h, sv * 100, v * 100]; -}; - -convert$4.hsv.rgb = function (hsv) { - const h = hsv[0] / 60; - const s = hsv[1] / 100; - let v = hsv[2] / 100; - const hi = Math.floor(h) % 6; - - const f = h - Math.floor(h); - const p = 255 * v * (1 - s); - const q = 255 * v * (1 - (s * f)); - const t = 255 * v * (1 - (s * (1 - f))); - v *= 255; - - switch (hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } -}; - -convert$4.hsv.hsl = function (hsv) { - const h = hsv[0]; - const s = hsv[1] / 100; - const v = hsv[2] / 100; - const vmin = Math.max(v, 0.01); - let sl; - let l; - - l = (2 - s) * v; - const lmin = (2 - s) * vmin; - sl = s * vmin; - sl /= (lmin <= 1) ? lmin : 2 - lmin; - sl = sl || 0; - l /= 2; - - return [h, sl * 100, l * 100]; -}; - -// http://dev.w3.org/csswg/css-color/#hwb-to-rgb -convert$4.hwb.rgb = function (hwb) { - const h = hwb[0] / 360; - let wh = hwb[1] / 100; - let bl = hwb[2] / 100; - const ratio = wh + bl; - let f; - - // Wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } - - const i = Math.floor(6 * h); - const v = 1 - bl; - f = 6 * h - i; - - if ((i & 0x01) !== 0) { - f = 1 - f; - } - - const n = wh + f * (v - wh); // Linear interpolation - - let r; - let g; - let b; - /* eslint-disable max-statements-per-line,no-multi-spaces */ - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - /* eslint-enable max-statements-per-line,no-multi-spaces */ - - return [r * 255, g * 255, b * 255]; -}; - -convert$4.cmyk.rgb = function (cmyk) { - const c = cmyk[0] / 100; - const m = cmyk[1] / 100; - const y = cmyk[2] / 100; - const k = cmyk[3] / 100; - - const r = 1 - Math.min(1, c * (1 - k) + k); - const g = 1 - Math.min(1, m * (1 - k) + k); - const b = 1 - Math.min(1, y * (1 - k) + k); - - return [r * 255, g * 255, b * 255]; -}; - -convert$4.xyz.rgb = function (xyz) { - const x = xyz[0] / 100; - const y = xyz[1] / 100; - const z = xyz[2] / 100; - let r; - let g; - let b; - - r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); - g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); - b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - - // Assume sRGB - r = r > 0.0031308 - ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) - : r * 12.92; - - g = g > 0.0031308 - ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) - : g * 12.92; - - b = b > 0.0031308 - ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) - : b * 12.92; - - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); - - return [r * 255, g * 255, b * 255]; -}; - -convert$4.xyz.lab = function (xyz) { - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); - - return [l, a, b]; -}; - -convert$4.lab.xyz = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let x; - let y; - let z; - - y = (l + 16) / 116; - x = a / 500 + y; - z = y - b / 200; - - const y2 = y ** 3; - const x2 = x ** 3; - const z2 = z ** 3; - y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; - x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; - z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; - - x *= 95.047; - y *= 100; - z *= 108.883; - - return [x, y, z]; -}; - -convert$4.lab.lch = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let h; - - const hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; - - if (h < 0) { - h += 360; - } - - const c = Math.sqrt(a * a + b * b); - - return [l, c, h]; -}; - -convert$4.lch.lab = function (lch) { - const l = lch[0]; - const c = lch[1]; - const h = lch[2]; - - const hr = h / 360 * 2 * Math.PI; - const a = c * Math.cos(hr); - const b = c * Math.sin(hr); - - return [l, a, b]; -}; - -convert$4.rgb.ansi16 = function (args, saturation = null) { - const [r, g, b] = args; - let value = saturation === null ? convert$4.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization - - value = Math.round(value / 50); - - if (value === 0) { - return 30; - } - - let ansi = 30 - + ((Math.round(b / 255) << 2) - | (Math.round(g / 255) << 1) - | Math.round(r / 255)); - - if (value === 2) { - ansi += 60; - } - - return ansi; -}; - -convert$4.hsv.ansi16 = function (args) { - // Optimization here; we already know the value and don't need to get - // it converted for us. - return convert$4.rgb.ansi16(convert$4.hsv.rgb(args), args[2]); -}; - -convert$4.rgb.ansi256 = function (args) { - const r = args[0]; - const g = args[1]; - const b = args[2]; - - // We use the extended greyscale palette here, with the exception of - // black and white. normal palette only has 4 greyscale shades. - if (r === g && g === b) { - if (r < 8) { - return 16; - } - - if (r > 248) { - return 231; - } - - return Math.round(((r - 8) / 247) * 24) + 232; - } - - const ansi = 16 - + (36 * Math.round(r / 255 * 5)) - + (6 * Math.round(g / 255 * 5)) - + Math.round(b / 255 * 5); - - return ansi; -}; - -convert$4.ansi16.rgb = function (args) { - let color = args % 10; - - // Handle greyscale - if (color === 0 || color === 7) { - if (args > 50) { - color += 3.5; - } - - color = color / 10.5 * 255; - - return [color, color, color]; - } - - const mult = (~~(args > 50) + 1) * 0.5; - const r = ((color & 1) * mult) * 255; - const g = (((color >> 1) & 1) * mult) * 255; - const b = (((color >> 2) & 1) * mult) * 255; - - return [r, g, b]; -}; - -convert$4.ansi256.rgb = function (args) { - // Handle greyscale - if (args >= 232) { - const c = (args - 232) * 10 + 8; - return [c, c, c]; - } - - args -= 16; - - let rem; - const r = Math.floor(args / 36) / 5 * 255; - const g = Math.floor((rem = args % 36) / 6) / 5 * 255; - const b = (rem % 6) / 5 * 255; - - return [r, g, b]; -}; - -convert$4.rgb.hex = function (args) { - const integer = ((Math.round(args[0]) & 0xFF) << 16) - + ((Math.round(args[1]) & 0xFF) << 8) - + (Math.round(args[2]) & 0xFF); - - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; - -convert$4.hex.rgb = function (args) { - const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); - if (!match) { - return [0, 0, 0]; - } - - let colorString = match[0]; - - if (match[0].length === 3) { - colorString = colorString.split('').map(char => { - return char + char; - }).join(''); - } - - const integer = parseInt(colorString, 16); - const r = (integer >> 16) & 0xFF; - const g = (integer >> 8) & 0xFF; - const b = integer & 0xFF; - - return [r, g, b]; -}; - -convert$4.rgb.hcg = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const max = Math.max(Math.max(r, g), b); - const min = Math.min(Math.min(r, g), b); - const chroma = (max - min); - let grayscale; - let hue; - - if (chroma < 1) { - grayscale = min / (1 - chroma); - } else { - grayscale = 0; - } - - if (chroma <= 0) { - hue = 0; - } else - if (max === r) { - hue = ((g - b) / chroma) % 6; - } else - if (max === g) { - hue = 2 + (b - r) / chroma; - } else { - hue = 4 + (r - g) / chroma; - } - - hue /= 6; - hue %= 1; - - return [hue * 360, chroma * 100, grayscale * 100]; -}; - -convert$4.hsl.hcg = function (hsl) { - const s = hsl[1] / 100; - const l = hsl[2] / 100; - - const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); - - let f = 0; - if (c < 1.0) { - f = (l - 0.5 * c) / (1.0 - c); - } - - return [hsl[0], c * 100, f * 100]; -}; - -convert$4.hsv.hcg = function (hsv) { - const s = hsv[1] / 100; - const v = hsv[2] / 100; - - const c = s * v; - let f = 0; - - if (c < 1.0) { - f = (v - c) / (1 - c); - } - - return [hsv[0], c * 100, f * 100]; -}; - -convert$4.hcg.rgb = function (hcg) { - const h = hcg[0] / 360; - const c = hcg[1] / 100; - const g = hcg[2] / 100; - - if (c === 0.0) { - return [g * 255, g * 255, g * 255]; - } - - const pure = [0, 0, 0]; - const hi = (h % 1) * 6; - const v = hi % 1; - const w = 1 - v; - let mg = 0; - - /* eslint-disable max-statements-per-line */ - switch (Math.floor(hi)) { - case 0: - pure[0] = 1; pure[1] = v; pure[2] = 0; break; - case 1: - pure[0] = w; pure[1] = 1; pure[2] = 0; break; - case 2: - pure[0] = 0; pure[1] = 1; pure[2] = v; break; - case 3: - pure[0] = 0; pure[1] = w; pure[2] = 1; break; - case 4: - pure[0] = v; pure[1] = 0; pure[2] = 1; break; - default: - pure[0] = 1; pure[1] = 0; pure[2] = w; - } - /* eslint-enable max-statements-per-line */ - - mg = (1.0 - c) * g; - - return [ - (c * pure[0] + mg) * 255, - (c * pure[1] + mg) * 255, - (c * pure[2] + mg) * 255 - ]; -}; - -convert$4.hcg.hsv = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - - const v = c + g * (1.0 - c); - let f = 0; - - if (v > 0.0) { - f = c / v; - } - - return [hcg[0], f * 100, v * 100]; -}; - -convert$4.hcg.hsl = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - - const l = g * (1.0 - c) + 0.5 * c; - let s = 0; - - if (l > 0.0 && l < 0.5) { - s = c / (2 * l); - } else - if (l >= 0.5 && l < 1.0) { - s = c / (2 * (1 - l)); - } - - return [hcg[0], s * 100, l * 100]; -}; - -convert$4.hcg.hwb = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - const v = c + g * (1.0 - c); - return [hcg[0], (v - c) * 100, (1 - v) * 100]; -}; - -convert$4.hwb.hcg = function (hwb) { - const w = hwb[1] / 100; - const b = hwb[2] / 100; - const v = 1 - b; - const c = v - w; - let g = 0; - - if (c < 1) { - g = (v - c) / (1 - c); - } - - return [hwb[0], c * 100, g * 100]; -}; - -convert$4.apple.rgb = function (apple) { - return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; -}; - -convert$4.rgb.apple = function (rgb) { - return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; -}; - -convert$4.gray.rgb = function (args) { - return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; -}; - -convert$4.gray.hsl = function (args) { - return [0, 0, args[0]]; -}; - -convert$4.gray.hsv = convert$4.gray.hsl; - -convert$4.gray.hwb = function (gray) { - return [0, 100, gray[0]]; -}; - -convert$4.gray.cmyk = function (gray) { - return [0, 0, 0, gray[0]]; -}; - -convert$4.gray.lab = function (gray) { - return [gray[0], 0, 0]; -}; - -convert$4.gray.hex = function (gray) { - const val = Math.round(gray[0] / 100 * 255) & 0xFF; - const integer = (val << 16) + (val << 8) + val; - - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; - -convert$4.rgb.gray = function (rgb) { - const val = (rgb[0] + rgb[1] + rgb[2]) / 3; - return [val / 255 * 100]; -}; - -const conversions$1 = conversions$2; - -/* - This function routes a model to all other models. - - all functions that are routed have a property `.conversion` attached - to the returned synthetic function. This property is an array - of strings, each with the steps in between the 'from' and 'to' - color models (inclusive). - - conversions that are not possible simply are not included. -*/ - -function buildGraph() { - const graph = {}; - // https://jsperf.com/object-keys-vs-for-in-with-closure/3 - const models = Object.keys(conversions$1); - - for (let len = models.length, i = 0; i < len; i++) { - graph[models[i]] = { - // http://jsperf.com/1-vs-infinity - // micro-opt, but this is simple. - distance: -1, - parent: null - }; - } - - return graph; -} - -// https://en.wikipedia.org/wiki/Breadth-first_search -function deriveBFS(fromModel) { - const graph = buildGraph(); - const queue = [fromModel]; // Unshift -> queue -> pop - - graph[fromModel].distance = 0; - - while (queue.length) { - const current = queue.pop(); - const adjacents = Object.keys(conversions$1[current]); - - for (let len = adjacents.length, i = 0; i < len; i++) { - const adjacent = adjacents[i]; - const node = graph[adjacent]; - - if (node.distance === -1) { - node.distance = graph[current].distance + 1; - node.parent = current; - queue.unshift(adjacent); - } - } - } - - return graph; -} - -function link$1(from, to) { - return function (args) { - return to(from(args)); - }; -} - -function wrapConversion(toModel, graph) { - const path = [graph[toModel].parent, toModel]; - let fn = conversions$1[graph[toModel].parent][toModel]; - - let cur = graph[toModel].parent; - while (graph[cur].parent) { - path.unshift(graph[cur].parent); - fn = link$1(conversions$1[graph[cur].parent][cur], fn); - cur = graph[cur].parent; - } - - fn.conversion = path; - return fn; -} - -var route$1 = function (fromModel) { - const graph = deriveBFS(fromModel); - const conversion = {}; - - const models = Object.keys(graph); - for (let len = models.length, i = 0; i < len; i++) { - const toModel = models[i]; - const node = graph[toModel]; - - if (node.parent === null) { - // No possible conversion, or this node is the source model. - continue; - } - - conversion[toModel] = wrapConversion(toModel, graph); - } - - return conversion; -}; - -const conversions = conversions$2; -const route = route$1; - -const convert$3 = {}; - -const models$3 = Object.keys(conversions); - -function wrapRaw(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; - if (arg0 === undefined || arg0 === null) { - return arg0; - } - - if (arg0.length > 1) { - args = arg0; - } - - return fn(args); - }; - - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } - - return wrappedFn; -} - -function wrapRounded(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; - - if (arg0 === undefined || arg0 === null) { - return arg0; - } - - if (arg0.length > 1) { - args = arg0; - } - - const result = fn(args); - - // We're assuming the result is an array here. - // see notice in conversions.js; don't use box types - // in conversion functions. - if (typeof result === 'object') { - for (let len = result.length, i = 0; i < len; i++) { - result[i] = Math.round(result[i]); - } - } - - return result; - }; - - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } - - return wrappedFn; -} - -models$3.forEach(fromModel => { - convert$3[fromModel] = {}; - - Object.defineProperty(convert$3[fromModel], 'channels', {value: conversions[fromModel].channels}); - Object.defineProperty(convert$3[fromModel], 'labels', {value: conversions[fromModel].labels}); - - const routes = route(fromModel); - const routeModels = Object.keys(routes); - - routeModels.forEach(toModel => { - const fn = routes[toModel]; - - convert$3[fromModel][toModel] = wrapRounded(fn); - convert$3[fromModel][toModel].raw = wrapRaw(fn); - }); -}); - -var colorConvert = convert$3; - -(function (module) { - -const wrapAnsi16 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${code + offset}m`; -}; - -const wrapAnsi256 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${38 + offset};5;${code}m`; -}; - -const wrapAnsi16m = (fn, offset) => (...args) => { - const rgb = fn(...args); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; - -const ansi2ansi = n => n; -const rgb2rgb = (r, g, b) => [r, g, b]; - -const setLazyProperty = (object, property, get) => { - Object.defineProperty(object, property, { - get: () => { - const value = get(); - - Object.defineProperty(object, property, { - value, - enumerable: true, - configurable: true - }); - - return value; - }, - enumerable: true, - configurable: true - }); -}; - -/** @type {typeof import('color-convert')} */ -let colorConvert$1; -const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { - if (colorConvert$1 === undefined) { - colorConvert$1 = colorConvert; - } - - const offset = isBackground ? 10 : 0; - const styles = {}; - - for (const [sourceSpace, suite] of Object.entries(colorConvert$1)) { - const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; - if (sourceSpace === targetSpace) { - styles[name] = wrap(identity, offset); - } else if (typeof suite === 'object') { - styles[name] = wrap(suite[targetSpace], offset); - } - } - - return styles; -}; - -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - - // Bright color - blackBright: [90, 39], - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } - }; - - // Alias bright black as gray (and grey) - styles.color.gray = styles.color.blackBright; - styles.bgColor.bgGray = styles.bgColor.bgBlackBright; - styles.color.grey = styles.color.blackBright; - styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; - - for (const [groupName, group] of Object.entries(styles)) { - for (const [styleName, style] of Object.entries(group)) { - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; - - group[styleName] = styles[styleName]; - - codes.set(style[0], style[1]); - } - - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); - } - - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); - - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; - - setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); - setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); - - return styles; -} - -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); -}(ansiStyles$1)); - -const stringReplaceAll$1 = (string, substring, replacer) => { - let index = string.indexOf(substring); - if (index === -1) { - return string; - } - - const substringLength = substring.length; - let endIndex = 0; - let returnValue = ''; - do { - returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; - endIndex = index + substringLength; - index = string.indexOf(substring, endIndex); - } while (index !== -1); - - returnValue += string.substr(endIndex); - return returnValue; -}; - -const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => { - let endIndex = 0; - let returnValue = ''; - do { - const gotCR = string[index - 1] === '\r'; - returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; - endIndex = index + 1; - index = string.indexOf('\n', endIndex); - } while (index !== -1); - - returnValue += string.substr(endIndex); - return returnValue; -}; - -var util$2 = { - stringReplaceAll: stringReplaceAll$1, - stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1 -}; - -const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; -const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; -const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi; - -const ESCAPES = new Map([ - ['n', '\n'], - ['r', '\r'], - ['t', '\t'], - ['b', '\b'], - ['f', '\f'], - ['v', '\v'], - ['0', '\0'], - ['\\', '\\'], - ['e', '\u001B'], - ['a', '\u0007'] -]); - -function unescape(c) { - const u = c[0] === 'u'; - const bracket = c[1] === '{'; - - if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { - return String.fromCharCode(parseInt(c.slice(1), 16)); - } - - if (u && bracket) { - return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); - } - - return ESCAPES.get(c) || c; -} - -function parseArguments(name, arguments_) { - const results = []; - const chunks = arguments_.trim().split(/\s*,\s*/g); - let matches; - - for (const chunk of chunks) { - const number = Number(chunk); - if (!Number.isNaN(number)) { - results.push(number); - } else if ((matches = chunk.match(STRING_REGEX))) { - results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); - } else { - throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); - } - } - - return results; -} - -function parseStyle(style) { - STYLE_REGEX.lastIndex = 0; - - const results = []; - let matches; - - while ((matches = STYLE_REGEX.exec(style)) !== null) { - const name = matches[1]; - - if (matches[2]) { - const args = parseArguments(name, matches[2]); - results.push([name].concat(args)); - } else { - results.push([name]); - } - } - - return results; -} - -function buildStyle(chalk, styles) { - const enabled = {}; - - for (const layer of styles) { - for (const style of layer.styles) { - enabled[style[0]] = layer.inverse ? null : style.slice(1); - } - } - - let current = chalk; - for (const [styleName, styles] of Object.entries(enabled)) { - if (!Array.isArray(styles)) { - continue; - } - - if (!(styleName in current)) { - throw new Error(`Unknown Chalk style: ${styleName}`); - } - - current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; - } - - return current; -} - -var templates = (chalk, temporary) => { - const styles = []; - const chunks = []; - let chunk = []; - - // eslint-disable-next-line max-params - temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { - if (escapeCharacter) { - chunk.push(unescape(escapeCharacter)); - } else if (style) { - const string = chunk.join(''); - chunk = []; - chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); - styles.push({inverse, styles: parseStyle(style)}); - } else if (close) { - if (styles.length === 0) { - throw new Error('Found extraneous } in Chalk template literal'); - } - - chunks.push(buildStyle(chalk, styles)(chunk.join(''))); - chunk = []; - styles.pop(); - } else { - chunk.push(character); - } - }); - - chunks.push(chunk.join('')); - - if (styles.length > 0) { - const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; - throw new Error(errMsg); - } - - return chunks.join(''); -}; - -const ansiStyles = ansiStyles$1.exports; -const {stdout: stdoutColor, stderr: stderrColor} = supportsColor_1$1; -const { - stringReplaceAll, - stringEncaseCRLFWithFirstIndex -} = util$2; - -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = [ - 'ansi', - 'ansi', - 'ansi256', - 'ansi16m' -]; - -const styles = Object.create(null); - -const applyOptions = (object, options = {}) => { - if (options.level > 3 || options.level < 0) { - throw new Error('The `level` option should be an integer from 0 to 3'); - } - - // Detect level if not set manually - const colorLevel = stdoutColor ? stdoutColor.level : 0; - object.level = options.level === undefined ? colorLevel : options.level; -}; - -class ChalkClass { - constructor(options) { - return chalkFactory(options); - } -} - -const chalkFactory = options => { - const chalk = {}; - applyOptions(chalk, options); - - chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); - - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); - - chalk.template.constructor = () => { - throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); - }; - - chalk.template.Instance = ChalkClass; - - return chalk.template; -}; - -function Chalk(options) { - return chalkFactory(options); -} - -for (const [styleName, style] of Object.entries(ansiStyles)) { - styles[styleName] = { - get() { - const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); - Object.defineProperty(this, styleName, {value: builder}); - return builder; - } - }; -} - -styles.visible = { - get() { - const builder = createBuilder(this, this._styler, true); - Object.defineProperty(this, 'visible', {value: builder}); - return builder; - } -}; - -const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; - -for (const model of usedModels) { - styles[model] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } - }; -} - -for (const model of usedModels) { - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } - }; -} - -const proto$1 = Object.defineProperties(() => {}, { - ...styles, - level: { - enumerable: true, - get() { - return this._generator.level; - }, - set(level) { - this._generator.level = level; - } - } -}); - -const createStyler = (open, close, parent) => { - let openAll; - let closeAll; - if (parent === undefined) { - openAll = open; - closeAll = close; - } else { - openAll = parent.openAll + open; - closeAll = close + parent.closeAll; - } - - return { - open, - close, - openAll, - closeAll, - parent - }; -}; - -const createBuilder = (self, _styler, _isEmpty) => { - const builder = (...arguments_) => { - // Single argument is hot path, implicit coercion is faster than anything - // eslint-disable-next-line no-implicit-coercion - return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); - }; - - // `__proto__` is used because we must return a function, but there is - // no way to create a function with a different prototype - builder.__proto__ = proto$1; // eslint-disable-line no-proto - - builder._generator = self; - builder._styler = _styler; - builder._isEmpty = _isEmpty; - - return builder; -}; - -const applyStyle = (self, string) => { - if (self.level <= 0 || !string) { - return self._isEmpty ? '' : string; - } - - let styler = self._styler; - - if (styler === undefined) { - return string; - } - - const {openAll, closeAll} = styler; - if (string.indexOf('\u001B') !== -1) { - while (styler !== undefined) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - string = stringReplaceAll(string, styler.close, styler.open); - - styler = styler.parent; - } - } - - // We can move both next actions out of loop, because remaining actions in loop won't have - // any/visible effect on parts we add here. Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 - const lfIndex = string.indexOf('\n'); - if (lfIndex !== -1) { - string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); - } - - return openAll + string + closeAll; -}; - -let template; -const chalkTag = (chalk, ...strings) => { - const [firstString] = strings; - - if (!Array.isArray(firstString)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return strings.join(' '); - } - - const arguments_ = strings.slice(1); - const parts = [firstString.raw[0]]; - - for (let i = 1; i < firstString.length; i++) { - parts.push( - String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), - String(firstString.raw[i]) - ); - } - - if (template === undefined) { - template = templates; - } - - return template(chalk, parts.join('')); -}; - -Object.defineProperties(Chalk.prototype, styles); - -const chalk$1 = Chalk(); // eslint-disable-line new-cap -chalk$1.supportsColor = stdoutColor; -chalk$1.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap -chalk$1.stderr.supportsColor = stderrColor; - -// For TypeScript -chalk$1.Level = { - None: 0, - Basic: 1, - Ansi256: 2, - TrueColor: 3, - 0: 'None', - 1: 'Basic', - 2: 'Ansi256', - 3: 'TrueColor' -}; - -var source$1 = chalk$1; - -var chokidar$1 = {}; - -var utils$7 = {}; - -const path$3 = require$$0__default$2['default']; -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; - -/** - * Posix glob regex - */ - -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR$1 = `${QMARK}*?`; - -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR: STAR$1, - START_ANCHOR -}; - -/** - * Windows glob regex - */ - -const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)` -}; - -/** - * POSIX Bracket Regex - */ - -const POSIX_REGEX_SOURCE$1 = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -var constants$5 = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - - SEP: path$3.sep, - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; - -(function (exports) { - -const path = require$$0__default$2['default']; -const win32 = process.platform === 'win32'; -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = constants$5; - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); -}; - -exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { - return true; - } - return false; -}; - -exports.isWindows = options => { - if (options && typeof options.windows === 'boolean') { - return options.windows; - } - return win32 === true || path.sep === '\\'; -}; - -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; - -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; - } - return output; -}; - -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; -}; -}(utils$7)); - -const utils$6 = utils$7; -const { - CHAR_ASTERISK: CHAR_ASTERISK$1, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \ */ - CHAR_COMMA: CHAR_COMMA$2, /* , */ - CHAR_DOT: CHAR_DOT$1, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE: CHAR_LEFT_CURLY_BRACE$1, /* { */ - CHAR_LEFT_PARENTHESES: CHAR_LEFT_PARENTHESES$1, /* ( */ - CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$2, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE: CHAR_RIGHT_CURLY_BRACE$1, /* } */ - CHAR_RIGHT_PARENTHESES: CHAR_RIGHT_PARENTHESES$1, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$2 /* ] */ -} = constants$5; - -const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -}; - -const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } -}; - -/** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), - * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not - * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). - * - * ```js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - -const scan$1 = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let negatedExtglob = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE$1) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE$1) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE$1) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT$1 && (code = advance()) === CHAR_DOT$1) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA$2) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_RIGHT_CURLY_BRACE$1) { - braces--; - - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; - - if (finished === true) continue; - if (prev === CHAR_DOT$1 && index === (start + 1)) { - start += 2; - continue; - } - - lastIndex = index + 1; - continue; - } - - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK$1 - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; - - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES$1) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; - if (code === CHAR_EXCLAMATION_MARK && index === start) { - negatedExtglob = true; - } - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES$1) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } - - if (code === CHAR_ASTERISK$1) { - if (prev === CHAR_ASTERISK$1) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_LEFT_SQUARE_BRACKET$2) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET$2) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; - break; - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } - - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES$1) { - isGlob = token.isGlob = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES$1) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES$1) { - finished = true; - break; - } - } - continue; - } - break; - } - - if (isGlob === true) { - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - } - - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } - - let base = str; - let prefix = ''; - let glob = ''; - - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } - - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } - - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } - - if (opts.unescape === true) { - if (glob) glob = utils$6.removeBackslashes(glob); - - if (base && backslashes === true) { - base = utils$6.removeBackslashes(base); - } - } - - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated, - negatedExtglob - }; - - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; -}; - -var scan_1 = scan$1; - -const constants$4 = constants$5; -const utils$5 = utils$7; - -/** - * Constants - */ - -const { - MAX_LENGTH: MAX_LENGTH$4, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS -} = constants$4; - -/** - * Helpers - */ - -const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = `[${args.join('-')}]`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils$5.escapeRegex(v)).join('..'); - } - - return value; -}; - -/** - * Create the message for a syntax error - */ - -const syntaxError$1 = (type, char) => { - return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; -}; - -/** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - -const parse$8 = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$4, opts.maxLength) : MAX_LENGTH$4; - - let len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - const win32 = utils$5.isWindows(options); - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants$4.globChars(win32); - const EXTGLOB_CHARS = constants$4.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = opts => { - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } - - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils$5.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index] || ''; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren') { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - let rest; - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } - - if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { - output = token.close = `)$))${extglobStar}`; - } - - if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { - output = token.close = `)${rest})${extglobStar})`; - } - - if (token.prev.type === 'bos') { - state.negatedExtglob = true; - } - } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : `\\${m}`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\/g, ''); - } else { - output = output.replace(/\\+/g, m => { - return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils$5.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\'; - } - } - - if (opts.unescape === true) { - value = advance(); - } else { - value += advance(); - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } - } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = `\\${value}`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = `\\${value}`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils$5.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } - - /** - * Parentheses - */ - - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; - } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError$1('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); - decrement('parens'); - continue; - } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError$1('closing', ']')); - } - - value = `\\${value}`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError$1('opening', '[')); - } - - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = `/${value}`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils$5.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils$5.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = `(${capture}${escaped}|${prev.value})`; - state.output += prev.value; - continue; - } - - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; - - braces.push(open); - push(open); - continue; - } - - if (value === '}') { - const brace = braces[braces.length - 1]; - - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } - - let output = ')'; - - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; - - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } - - output = expandRange(range, opts); - state.backtrack = true; - } - - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\{'; - value = output = '\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } - - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } - - /** - * Pipes - */ - - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } - - /** - * Commas - */ - - if (value === ',') { - let output = value; - - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } - - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } - - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } - - /** - * Dots - */ - - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } - - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } - - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } - - /** - * Question marks - */ - - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } - - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; - - if (next === '<' && !utils$5.supportsLookbehinds()) { - throw new Error('Node.js v10 or higher is required for regex lookbehinds'); - } - - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { - output = `\\${value}`; - } - - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ - - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; - } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } - - /** - * Plus - */ - - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } - - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } - - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } - - push({ type: 'plus', value: PLUS_LITERAL }); - continue; - } - - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = `\\${value}`; - } - - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } - - let rest = remaining(); - if (opts.noextglob !== true && /^\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } - - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } - - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); - - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } - - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } - - // strip consecutive `/**/` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } - - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; - } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } - } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', ']')); - state.output = utils$5.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', ')')); - state.output = utils$5.escapeLast(state.output, '('); - decrement('parens'); - } - - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', '}')); - state.output = utils$5.escapeLast(state.output, '{'); - decrement('braces'); - } - - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); - } - - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; - - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; - - if (token.suffix) { - state.output += token.suffix; - } - } - } - - return state; -}; - -/** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ - -parse$8.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$4, opts.maxLength) : MAX_LENGTH$4; - const len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - input = REPLACEMENTS[input] || input; - const win32 = utils$5.isWindows(options); - - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants$4.globChars(win32); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - const globstar = opts => { - if (opts.noglobstar === true) return star; - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const create = str => { - switch (str) { - case '*': - return `${nodot}${ONE_CHAR}${star}`; - - case '.*': - return `${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*.*': - return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*/*': - return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; - - case '**': - return nodot + globstar(opts); - - case '**/*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; - - case '**/*.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '**/.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - - default: { - const match = /^(.*?)\.(\w+)$/.exec(str); - if (!match) return; - - const source = create(match[1]); - if (!source) return; - - return source + DOT_LITERAL + match[2]; - } - } - }; - - const output = utils$5.removePrefix(input, state); - let source = create(output); - - if (source && opts.strictSlashes !== true) { - source += `${SLASH_LITERAL}?`; - } - - return source; -}; - -var parse_1$3 = parse$8; - -const path$2 = require$$0__default$2['default']; -const scan = scan_1; -const parse$7 = parse_1$3; -const utils$4 = utils$7; -const constants$3 = constants$5; -const isObject$3 = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch$3 = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch$3(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject$3(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } - - const opts = options || {}; - const posix = utils$4.isWindows(options); - const regex = isState - ? picomatch$3.compileRe(glob, options) - : picomatch$3.makeRe(glob, options, false, true); - - const state = regex.state; - delete regex.state; - - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch$3(opts.ignore, ignoreOpts, returnState); - } - - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch$3.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; - - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } - - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } - - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } - - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; - - if (returnState) { - matcher.state = state; - } - - return matcher; -}; - -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ - -picomatch$3.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } - - if (input === '') { - return { isMatch: false, output: '' }; - } - - const opts = options || {}; - const format = opts.format || (posix ? utils$4.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; - - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } - - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch$3.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } - - return { isMatch: Boolean(match), match, output }; -}; - -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ - -picomatch$3.matchBase = (input, glob, options, posix = utils$4.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch$3.makeRe(glob, options); - return regex.test(path$2.basename(input)); -}; - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -picomatch$3.isMatch = (str, patterns, options) => picomatch$3(patterns, options)(str); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ - -picomatch$3.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch$3.parse(p, options)); - return parse$7(pattern, { ...options, fastpaths: false }); -}; - -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -picomatch$3.scan = (input, options) => scan(input, options); - -/** - * Compile a regular expression from the `state` object returned by the - * [parse()](#parse) method. - * - * @param {Object} `state` - * @param {Object} `options` - * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. - * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. - * @return {RegExp} - * @api public - */ - -picomatch$3.compileRe = (state, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return state.output; - } - - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; - - let source = `${prepend}(?:${state.output})${append}`; - if (state && state.negated === true) { - source = `^(?!${source}).*$`; - } - - const regex = picomatch$3.toRegex(source, options); - if (returnState === true) { - regex.state = state; - } - - return regex; -}; - -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. - * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch$3.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } - - let parsed = { negated: false, fastpaths: true }; - - if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - parsed.output = parse$7.fastpaths(input, options); - } - - if (!parsed.output) { - parsed = parse$7(input, options); - } - - return picomatch$3.compileRe(parsed, options, returnOutput, returnState); -}; - -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ - -picomatch$3.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; - -/** - * Picomatch constants. - * @return {Object} - */ - -picomatch$3.constants = constants$3; - -/** - * Expose "picomatch" - */ - -var picomatch_1 = picomatch$3; - -var picomatch$2 = picomatch_1; - -const fs$3 = require$$0__default$3['default']; -const { Readable } = require$$0__default$5['default']; -const sysPath$3 = require$$0__default$2['default']; -const { promisify: promisify$3 } = require$$0__default['default']; -const picomatch$1 = picomatch$2; - -const readdir$1 = promisify$3(fs$3.readdir); -const stat$3 = promisify$3(fs$3.stat); -const lstat$2 = promisify$3(fs$3.lstat); -const realpath$1 = promisify$3(fs$3.realpath); - -/** - * @typedef {Object} EntryInfo - * @property {String} path - * @property {String} fullPath - * @property {fs.Stats=} stats - * @property {fs.Dirent=} dirent - * @property {String} basename - */ - -const BANG$2 = '!'; -const RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR'; -const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP', RECURSIVE_ERROR_CODE]); -const FILE_TYPE = 'files'; -const DIR_TYPE = 'directories'; -const FILE_DIR_TYPE = 'files_directories'; -const EVERYTHING_TYPE = 'all'; -const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE]; - -const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code); -const [maj, min] = process.versions.node.split('.').slice(0, 2).map(n => Number.parseInt(n, 10)); -const wantBigintFsStats = process.platform === 'win32' && (maj > 10 || (maj === 10 && min >= 5)); - -const normalizeFilter = filter => { - if (filter === undefined) return; - if (typeof filter === 'function') return filter; - - if (typeof filter === 'string') { - const glob = picomatch$1(filter.trim()); - return entry => glob(entry.basename); - } - - if (Array.isArray(filter)) { - const positive = []; - const negative = []; - for (const item of filter) { - const trimmed = item.trim(); - if (trimmed.charAt(0) === BANG$2) { - negative.push(picomatch$1(trimmed.slice(1))); - } else { - positive.push(picomatch$1(trimmed)); - } - } - - if (negative.length > 0) { - if (positive.length > 0) { - return entry => - positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename)); - } - return entry => !negative.some(f => f(entry.basename)); - } - return entry => positive.some(f => f(entry.basename)); - } -}; - -class ReaddirpStream extends Readable { - static get defaultOptions() { - return { - root: '.', - /* eslint-disable no-unused-vars */ - fileFilter: (path) => true, - directoryFilter: (path) => true, - /* eslint-enable no-unused-vars */ - type: FILE_TYPE, - lstat: false, - depth: 2147483648, - alwaysStat: false - }; - } - - constructor(options = {}) { - super({ - objectMode: true, - autoDestroy: true, - highWaterMark: options.highWaterMark || 4096 - }); - const opts = { ...ReaddirpStream.defaultOptions, ...options }; - const { root, type } = opts; - - this._fileFilter = normalizeFilter(opts.fileFilter); - this._directoryFilter = normalizeFilter(opts.directoryFilter); - - const statMethod = opts.lstat ? lstat$2 : stat$3; - // Use bigint stats if it's windows and stat() supports options (node 10+). - if (wantBigintFsStats) { - this._stat = path => statMethod(path, { bigint: true }); - } else { - this._stat = statMethod; - } - - this._maxDepth = opts.depth; - this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); - this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); - this._wantsEverything = type === EVERYTHING_TYPE; - this._root = sysPath$3.resolve(root); - this._isDirent = ('Dirent' in fs$3) && !opts.alwaysStat; - this._statsProp = this._isDirent ? 'dirent' : 'stats'; - this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent }; - - // Launch stream with one parent, the root dir. - this.parents = [this._exploreDir(root, 1)]; - this.reading = false; - this.parent = undefined; - } - - async _read(batch) { - if (this.reading) return; - this.reading = true; - - try { - while (!this.destroyed && batch > 0) { - const { path, depth, files = [] } = this.parent || {}; - - if (files.length > 0) { - const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path)); - for (const entry of await Promise.all(slice)) { - if (this.destroyed) return; - - const entryType = await this._getEntryType(entry); - if (entryType === 'directory' && this._directoryFilter(entry)) { - if (depth <= this._maxDepth) { - this.parents.push(this._exploreDir(entry.fullPath, depth + 1)); - } - - if (this._wantsDir) { - this.push(entry); - batch--; - } - } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) { - if (this._wantsFile) { - this.push(entry); - batch--; - } - } - } - } else { - const parent = this.parents.pop(); - if (!parent) { - this.push(null); - break; - } - this.parent = await parent; - if (this.destroyed) return; - } - } - } catch (error) { - this.destroy(error); - } finally { - this.reading = false; - } - } - - async _exploreDir(path, depth) { - let files; - try { - files = await readdir$1(path, this._rdOptions); - } catch (error) { - this._onError(error); - } - return { files, depth, path }; - } - - async _formatEntry(dirent, path) { - let entry; - try { - const basename = this._isDirent ? dirent.name : dirent; - const fullPath = sysPath$3.resolve(sysPath$3.join(path, basename)); - entry = { path: sysPath$3.relative(this._root, fullPath), fullPath, basename }; - entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath); - } catch (err) { - this._onError(err); - } - return entry; - } - - _onError(err) { - if (isNormalFlowError(err) && !this.destroyed) { - this.emit('warn', err); - } else { - this.destroy(err); - } - } - - async _getEntryType(entry) { - // entry may be undefined, because a warning or an error were emitted - // and the statsProp is undefined - const stats = entry && entry[this._statsProp]; - if (!stats) { - return; - } - if (stats.isFile()) { - return 'file'; - } - if (stats.isDirectory()) { - return 'directory'; - } - if (stats && stats.isSymbolicLink()) { - const full = entry.fullPath; - try { - const entryRealPath = await realpath$1(full); - const entryRealPathStats = await lstat$2(entryRealPath); - if (entryRealPathStats.isFile()) { - return 'file'; - } - if (entryRealPathStats.isDirectory()) { - const len = entryRealPath.length; - if (full.startsWith(entryRealPath) && full.substr(len, 1) === sysPath$3.sep) { - const recursiveError = new Error( - `Circular symlink detected: "${full}" points to "${entryRealPath}"` - ); - recursiveError.code = RECURSIVE_ERROR_CODE; - return this._onError(recursiveError); - } - return 'directory'; - } - } catch (error) { - this._onError(error); - } - } - } - - _includeAsFile(entry) { - const stats = entry && entry[this._statsProp]; - - return stats && this._wantsEverything && !stats.isDirectory(); - } -} - -/** - * @typedef {Object} ReaddirpArguments - * @property {Function=} fileFilter - * @property {Function=} directoryFilter - * @property {String=} type - * @property {Number=} depth - * @property {String=} root - * @property {Boolean=} lstat - * @property {Boolean=} bigint - */ - -/** - * Main function which ends up calling readdirRec and reads all files and directories in given root recursively. - * @param {String} root Root directory - * @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth - */ -const readdirp$1 = (root, options = {}) => { - let type = options.entryType || options.type; - if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility - if (type) options.type = type; - if (!root) { - throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)'); - } else if (typeof root !== 'string') { - throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)'); - } else if (type && !ALL_TYPES.includes(type)) { - throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`); - } - - options.root = root; - return new ReaddirpStream(options); -}; - -const readdirpPromise = (root, options = {}) => { - return new Promise((resolve, reject) => { - const files = []; - readdirp$1(root, options) - .on('data', entry => files.push(entry)) - .on('end', () => resolve(files)) - .on('error', error => reject(error)); - }); -}; - -readdirp$1.promise = readdirpPromise; -readdirp$1.ReaddirpStream = ReaddirpStream; -readdirp$1.default = readdirp$1; - -var readdirp_1 = readdirp$1; - -var anymatch$2 = {exports: {}}; - -/*! - * normalize-path <https://github.com/jonschlinkert/normalize-path> - * - * Copyright (c) 2014-2018, Jon Schlinkert. - * Released under the MIT License. - */ - -var normalizePath$2 = function(path, stripTrailing) { - if (typeof path !== 'string') { - throw new TypeError('expected path to be a string'); - } - - if (path === '\\' || path === '/') return '/'; - - var len = path.length; - if (len <= 1) return path; - - // ensure that win32 namespaces has two leading slashes, so that the path is - // handled properly by the win32 version of path.parse() after being normalized - // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces - var prefix = ''; - if (len > 4 && path[3] === '\\') { - var ch = path[2]; - if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') { - path = path.slice(2); - prefix = '//'; - } - } - - var segs = path.split(/[/\\]+/); - if (stripTrailing !== false && segs[segs.length - 1] === '') { - segs.pop(); - } - return prefix + segs.join('/'); -}; - -Object.defineProperty(anymatch$2.exports, "__esModule", { value: true }); - -const picomatch = picomatch$2; -const normalizePath$1 = normalizePath$2; - -/** - * @typedef {(testString: string) => boolean} AnymatchFn - * @typedef {string|RegExp|AnymatchFn} AnymatchPattern - * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher - */ -const BANG$1 = '!'; -const DEFAULT_OPTIONS = {returnIndex: false}; -const arrify$1 = (item) => Array.isArray(item) ? item : [item]; - -/** - * @param {AnymatchPattern} matcher - * @param {object} options - * @returns {AnymatchFn} - */ -const createPattern = (matcher, options) => { - if (typeof matcher === 'function') { - return matcher; - } - if (typeof matcher === 'string') { - const glob = picomatch(matcher, options); - return (string) => matcher === string || glob(string); - } - if (matcher instanceof RegExp) { - return (string) => matcher.test(string); - } - return (string) => false; -}; - -/** - * @param {Array<Function>} patterns - * @param {Array<Function>} negPatterns - * @param {String|Array} args - * @param {Boolean} returnIndex - * @returns {boolean|number} - */ -const matchPatterns = (patterns, negPatterns, args, returnIndex) => { - const isList = Array.isArray(args); - const _path = isList ? args[0] : args; - if (!isList && typeof _path !== 'string') { - throw new TypeError('anymatch: second argument must be a string: got ' + - Object.prototype.toString.call(_path)) - } - const path = normalizePath$1(_path); - - for (let index = 0; index < negPatterns.length; index++) { - const nglob = negPatterns[index]; - if (nglob(path)) { - return returnIndex ? -1 : false; - } - } - - const applied = isList && [path].concat(args.slice(1)); - for (let index = 0; index < patterns.length; index++) { - const pattern = patterns[index]; - if (isList ? pattern(...applied) : pattern(path)) { - return returnIndex ? index : true; - } - } - - return returnIndex ? -1 : false; -}; - -/** - * @param {AnymatchMatcher} matchers - * @param {Array|string} testString - * @param {object} options - * @returns {boolean|number|Function} - */ -const anymatch$1 = (matchers, testString, options = DEFAULT_OPTIONS) => { - if (matchers == null) { - throw new TypeError('anymatch: specify first argument'); - } - const opts = typeof options === 'boolean' ? {returnIndex: options} : options; - const returnIndex = opts.returnIndex || false; - - // Early cache for matchers. - const mtchers = arrify$1(matchers); - const negatedGlobs = mtchers - .filter(item => typeof item === 'string' && item.charAt(0) === BANG$1) - .map(item => item.slice(1)) - .map(item => picomatch(item, opts)); - const patterns = mtchers - .filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG$1)) - .map(matcher => createPattern(matcher, opts)); - - if (testString == null) { - return (testString, ri = false) => { - const returnIndex = typeof ri === 'boolean' ? ri : false; - return matchPatterns(patterns, negatedGlobs, testString, returnIndex); - } - } - - return matchPatterns(patterns, negatedGlobs, testString, returnIndex); -}; - -anymatch$1.default = anymatch$1; -anymatch$2.exports = anymatch$1; - -/*! - * is-extglob <https://github.com/jonschlinkert/is-extglob> - * - * Copyright (c) 2014-2016, Jon Schlinkert. - * Licensed under the MIT License. - */ - -var isExtglob$1 = function isExtglob(str) { - if (typeof str !== 'string' || str === '') { - return false; - } - - var match; - while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { - if (match[2]) return true; - str = str.slice(match.index + match[0].length); - } - - return false; -}; - -/*! - * is-glob <https://github.com/jonschlinkert/is-glob> - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ - -var isExtglob = isExtglob$1; -var chars = { '{': '}', '(': ')', '[': ']'}; -var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; -var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; - -var isGlob$2 = function isGlob(str, options) { - if (typeof str !== 'string' || str === '') { - return false; - } - - if (isExtglob(str)) { - return true; - } - - var regex = strictRegex; - var match; - - // optionally relax regex - if (options && options.strict === false) { - regex = relaxedRegex; - } - - while ((match = regex.exec(str))) { - if (match[2]) return true; - var idx = match.index + match[0].length; - - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - var open = match[1]; - var close = open ? chars[open] : null; - if (open && close) { - var n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - - str = str.slice(idx); - } - return false; -}; - -var isGlob$1 = isGlob$2; -var pathPosixDirname = require$$0__default$2['default'].posix.dirname; -var isWin32 = require$$0__default$1['default'].platform() === 'win32'; - -var slash = '/'; -var backslash = /\\/g; -var enclosure = /[\{\[].*[\}\]]$/; -var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; -var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; - -/** - * @param {string} str - * @param {Object} opts - * @param {boolean} [opts.flipBackslashes=true] - * @returns {string} - */ -var globParent$1 = function globParent(str, opts) { - var options = Object.assign({ flipBackslashes: true }, opts); - - // flip windows path separators - if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { - str = str.replace(backslash, slash); - } - - // special case for strings ending in enclosure containing path separator - if (enclosure.test(str)) { - str += slash; - } - - // preserves full path in case of trailing path separator - str += 'a'; - - // remove path parts that are globby - do { - str = pathPosixDirname(str); - } while (isGlob$1(str) || globby.test(str)); - - // remove escape chars and return result - return str.replace(escaped, '$1'); -}; - -var utils$3 = {}; - -(function (exports) { - -exports.isInteger = num => { - if (typeof num === 'number') { - return Number.isInteger(num); - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isInteger(Number(num)); - } - return false; -}; - -/** - * Find a node of the given type - */ - -exports.find = (node, type) => node.nodes.find(node => node.type === type); - -/** - * Find a node of the given type - */ - -exports.exceedsLimit = (min, max, step = 1, limit) => { - if (limit === false) return false; - if (!exports.isInteger(min) || !exports.isInteger(max)) return false; - return ((Number(max) - Number(min)) / Number(step)) >= limit; -}; - -/** - * Escape the given node with '\\' before node.value - */ - -exports.escapeNode = (block, n = 0, type) => { - let node = block.nodes[n]; - if (!node) return; - - if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { - if (node.escaped !== true) { - node.value = '\\' + node.value; - node.escaped = true; - } - } -}; - -/** - * Returns true if the given brace node should be enclosed in literal braces - */ - -exports.encloseBrace = node => { - if (node.type !== 'brace') return false; - if ((node.commas >> 0 + node.ranges >> 0) === 0) { - node.invalid = true; - return true; - } - return false; -}; - -/** - * Returns true if a brace node is invalid. - */ - -exports.isInvalidBrace = block => { - if (block.type !== 'brace') return false; - if (block.invalid === true || block.dollar) return true; - if ((block.commas >> 0 + block.ranges >> 0) === 0) { - block.invalid = true; - return true; - } - if (block.open !== true || block.close !== true) { - block.invalid = true; - return true; - } - return false; -}; - -/** - * Returns true if a node is an open or close node - */ - -exports.isOpenOrClose = node => { - if (node.type === 'open' || node.type === 'close') { - return true; - } - return node.open === true || node.close === true; -}; - -/** - * Reduce an array of text nodes. - */ - -exports.reduce = nodes => nodes.reduce((acc, node) => { - if (node.type === 'text') acc.push(node.value); - if (node.type === 'range') node.type = 'text'; - return acc; -}, []); - -/** - * Flatten an array - */ - -exports.flatten = (...args) => { - const result = []; - const flat = arr => { - for (let i = 0; i < arr.length; i++) { - let ele = arr[i]; - Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele); - } - return result; - }; - flat(args); - return result; -}; -}(utils$3)); - -const utils$2 = utils$3; - -var stringify$8 = (ast, options = {}) => { - let stringify = (node, parent = {}) => { - let invalidBlock = options.escapeInvalid && utils$2.isInvalidBrace(parent); - let invalidNode = node.invalid === true && options.escapeInvalid === true; - let output = ''; - - if (node.value) { - if ((invalidBlock || invalidNode) && utils$2.isOpenOrClose(node)) { - return '\\' + node.value; - } - return node.value; - } - - if (node.value) { - return node.value; - } - - if (node.nodes) { - for (let child of node.nodes) { - output += stringify(child); - } - } - return output; - }; - - return stringify(ast); -}; - -/*! - * is-number <https://github.com/jonschlinkert/is-number> - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Released under the MIT License. - */ - -var isNumber$3 = function(num) { - if (typeof num === 'number') { - return num - num === 0; - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); - } - return false; -}; - -/*! - * to-regex-range <https://github.com/micromatch/to-regex-range> - * - * Copyright (c) 2015-present, Jon Schlinkert. - * Released under the MIT License. - */ - -const isNumber$2 = isNumber$3; - -const toRegexRange$1 = (min, max, options) => { - if (isNumber$2(min) === false) { - throw new TypeError('toRegexRange: expected the first argument to be a number'); - } - - if (max === void 0 || min === max) { - return String(min); - } - - if (isNumber$2(max) === false) { - throw new TypeError('toRegexRange: expected the second argument to be a number.'); - } - - let opts = { relaxZeros: true, ...options }; - if (typeof opts.strictZeros === 'boolean') { - opts.relaxZeros = opts.strictZeros === false; - } - - let relax = String(opts.relaxZeros); - let shorthand = String(opts.shorthand); - let capture = String(opts.capture); - let wrap = String(opts.wrap); - let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap; - - if (toRegexRange$1.cache.hasOwnProperty(cacheKey)) { - return toRegexRange$1.cache[cacheKey].result; - } - - let a = Math.min(min, max); - let b = Math.max(min, max); - - if (Math.abs(a - b) === 1) { - let result = min + '|' + max; - if (opts.capture) { - return `(${result})`; - } - if (opts.wrap === false) { - return result; - } - return `(?:${result})`; - } - - let isPadded = hasPadding(min) || hasPadding(max); - let state = { min, max, a, b }; - let positives = []; - let negatives = []; - - if (isPadded) { - state.isPadded = isPadded; - state.maxLen = String(state.max).length; - } - - if (a < 0) { - let newMin = b < 0 ? Math.abs(b) : 1; - negatives = splitToPatterns(newMin, Math.abs(a), state, opts); - a = state.a = 0; - } - - if (b >= 0) { - positives = splitToPatterns(a, b, state, opts); - } - - state.negatives = negatives; - state.positives = positives; - state.result = collatePatterns(negatives, positives); - - if (opts.capture === true) { - state.result = `(${state.result})`; - } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) { - state.result = `(?:${state.result})`; - } - - toRegexRange$1.cache[cacheKey] = state; - return state.result; -}; - -function collatePatterns(neg, pos, options) { - let onlyNegative = filterPatterns(neg, pos, '-', false) || []; - let onlyPositive = filterPatterns(pos, neg, '', false) || []; - let intersected = filterPatterns(neg, pos, '-?', true) || []; - let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); - return subpatterns.join('|'); -} - -function splitToRanges(min, max) { - let nines = 1; - let zeros = 1; - - let stop = countNines(min, nines); - let stops = new Set([max]); - - while (min <= stop && stop <= max) { - stops.add(stop); - nines += 1; - stop = countNines(min, nines); - } - - stop = countZeros(max + 1, zeros) - 1; - - while (min < stop && stop <= max) { - stops.add(stop); - zeros += 1; - stop = countZeros(max + 1, zeros) - 1; - } - - stops = [...stops]; - stops.sort(compare$2); - return stops; -} - -/** - * Convert a range to a regex pattern - * @param {Number} `start` - * @param {Number} `stop` - * @return {String} - */ - -function rangeToPattern(start, stop, options) { - if (start === stop) { - return { pattern: start, count: [], digits: 0 }; - } - - let zipped = zip(start, stop); - let digits = zipped.length; - let pattern = ''; - let count = 0; - - for (let i = 0; i < digits; i++) { - let [startDigit, stopDigit] = zipped[i]; - - if (startDigit === stopDigit) { - pattern += startDigit; - - } else if (startDigit !== '0' || stopDigit !== '9') { - pattern += toCharacterClass(startDigit, stopDigit); - - } else { - count++; - } - } - - if (count) { - pattern += options.shorthand === true ? '\\d' : '[0-9]'; - } - - return { pattern, count: [count], digits }; -} - -function splitToPatterns(min, max, tok, options) { - let ranges = splitToRanges(min, max); - let tokens = []; - let start = min; - let prev; - - for (let i = 0; i < ranges.length; i++) { - let max = ranges[i]; - let obj = rangeToPattern(String(start), String(max), options); - let zeros = ''; - - if (!tok.isPadded && prev && prev.pattern === obj.pattern) { - if (prev.count.length > 1) { - prev.count.pop(); - } - - prev.count.push(obj.count[0]); - prev.string = prev.pattern + toQuantifier(prev.count); - start = max + 1; - continue; - } - - if (tok.isPadded) { - zeros = padZeros(max, tok, options); - } - - obj.string = zeros + obj.pattern + toQuantifier(obj.count); - tokens.push(obj); - start = max + 1; - prev = obj; - } - - return tokens; -} - -function filterPatterns(arr, comparison, prefix, intersection, options) { - let result = []; - - for (let ele of arr) { - let { string } = ele; - - // only push if _both_ are negative... - if (!intersection && !contains(comparison, 'string', string)) { - result.push(prefix + string); - } - - // or _both_ are positive - if (intersection && contains(comparison, 'string', string)) { - result.push(prefix + string); - } - } - return result; -} - -/** - * Zip strings - */ - -function zip(a, b) { - let arr = []; - for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]); - return arr; -} - -function compare$2(a, b) { - return a > b ? 1 : b > a ? -1 : 0; -} - -function contains(arr, key, val) { - return arr.some(ele => ele[key] === val); -} - -function countNines(min, len) { - return Number(String(min).slice(0, -len) + '9'.repeat(len)); -} - -function countZeros(integer, zeros) { - return integer - (integer % Math.pow(10, zeros)); -} - -function toQuantifier(digits) { - let [start = 0, stop = ''] = digits; - if (stop || start > 1) { - return `{${start + (stop ? ',' + stop : '')}}`; - } - return ''; -} - -function toCharacterClass(a, b, options) { - return `[${a}${(b - a === 1) ? '' : '-'}${b}]`; -} - -function hasPadding(str) { - return /^-?(0+)\d/.test(str); -} - -function padZeros(value, tok, options) { - if (!tok.isPadded) { - return value; - } - - let diff = Math.abs(tok.maxLen - String(value).length); - let relax = options.relaxZeros !== false; - - switch (diff) { - case 0: - return ''; - case 1: - return relax ? '0?' : '0'; - case 2: - return relax ? '0{0,2}' : '00'; - default: { - return relax ? `0{0,${diff}}` : `0{${diff}}`; - } - } -} - -/** - * Cache - */ - -toRegexRange$1.cache = {}; -toRegexRange$1.clearCache = () => (toRegexRange$1.cache = {}); - -/** - * Expose `toRegexRange` - */ - -var toRegexRange_1 = toRegexRange$1; - -/*! - * fill-range <https://github.com/jonschlinkert/fill-range> - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Licensed under the MIT License. - */ - -const util$1 = require$$0__default['default']; -const toRegexRange = toRegexRange_1; - -const isObject$2 = val => val !== null && typeof val === 'object' && !Array.isArray(val); - -const transform = toNumber => { - return value => toNumber === true ? Number(value) : String(value); -}; - -const isValidValue = value => { - return typeof value === 'number' || (typeof value === 'string' && value !== ''); -}; - -const isNumber$1 = num => Number.isInteger(+num); - -const zeros = input => { - let value = `${input}`; - let index = -1; - if (value[0] === '-') value = value.slice(1); - if (value === '0') return false; - while (value[++index] === '0'); - return index > 0; -}; - -const stringify$7 = (start, end, options) => { - if (typeof start === 'string' || typeof end === 'string') { - return true; - } - return options.stringify === true; -}; - -const pad = (input, maxLength, toNumber) => { - if (maxLength > 0) { - let dash = input[0] === '-' ? '-' : ''; - if (dash) input = input.slice(1); - input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); - } - if (toNumber === false) { - return String(input); - } - return input; -}; - -const toMaxLen = (input, maxLength) => { - let negative = input[0] === '-' ? '-' : ''; - if (negative) { - input = input.slice(1); - maxLength--; - } - while (input.length < maxLength) input = '0' + input; - return negative ? ('-' + input) : input; -}; - -const toSequence = (parts, options) => { - parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); - parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); - - let prefix = options.capture ? '' : '?:'; - let positives = ''; - let negatives = ''; - let result; - - if (parts.positives.length) { - positives = parts.positives.join('|'); - } - - if (parts.negatives.length) { - negatives = `-(${prefix}${parts.negatives.join('|')})`; - } - - if (positives && negatives) { - result = `${positives}|${negatives}`; - } else { - result = positives || negatives; - } - - if (options.wrap) { - return `(${prefix}${result})`; - } - - return result; -}; - -const toRange = (a, b, isNumbers, options) => { - if (isNumbers) { - return toRegexRange(a, b, { wrap: false, ...options }); - } - - let start = String.fromCharCode(a); - if (a === b) return start; - - let stop = String.fromCharCode(b); - return `[${start}-${stop}]`; -}; - -const toRegex = (start, end, options) => { - if (Array.isArray(start)) { - let wrap = options.wrap === true; - let prefix = options.capture ? '' : '?:'; - return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); - } - return toRegexRange(start, end, options); -}; - -const rangeError = (...args) => { - return new RangeError('Invalid range arguments: ' + util$1.inspect(...args)); -}; - -const invalidRange = (start, end, options) => { - if (options.strictRanges === true) throw rangeError([start, end]); - return []; -}; - -const invalidStep = (step, options) => { - if (options.strictRanges === true) { - throw new TypeError(`Expected step "${step}" to be a number`); - } - return []; -}; - -const fillNumbers = (start, end, step = 1, options = {}) => { - let a = Number(start); - let b = Number(end); - - if (!Number.isInteger(a) || !Number.isInteger(b)) { - if (options.strictRanges === true) throw rangeError([start, end]); - return []; - } - - // fix negative zero - if (a === 0) a = 0; - if (b === 0) b = 0; - - let descending = a > b; - let startString = String(start); - let endString = String(end); - let stepString = String(step); - step = Math.max(Math.abs(step), 1); - - let padded = zeros(startString) || zeros(endString) || zeros(stepString); - let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; - let toNumber = padded === false && stringify$7(start, end, options) === false; - let format = options.transform || transform(toNumber); - - if (options.toRegex && step === 1) { - return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); - } - - let parts = { negatives: [], positives: [] }; - let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); - let range = []; - let index = 0; - - while (descending ? a >= b : a <= b) { - if (options.toRegex === true && step > 1) { - push(a); - } else { - range.push(pad(format(a, index), maxLen, toNumber)); - } - a = descending ? a - step : a + step; - index++; - } - - if (options.toRegex === true) { - return step > 1 - ? toSequence(parts, options) - : toRegex(range, null, { wrap: false, ...options }); - } - - return range; -}; - -const fillLetters = (start, end, step = 1, options = {}) => { - if ((!isNumber$1(start) && start.length > 1) || (!isNumber$1(end) && end.length > 1)) { - return invalidRange(start, end, options); - } - - - let format = options.transform || (val => String.fromCharCode(val)); - let a = `${start}`.charCodeAt(0); - let b = `${end}`.charCodeAt(0); - - let descending = a > b; - let min = Math.min(a, b); - let max = Math.max(a, b); - - if (options.toRegex && step === 1) { - return toRange(min, max, false, options); - } - - let range = []; - let index = 0; - - while (descending ? a >= b : a <= b) { - range.push(format(a, index)); - a = descending ? a - step : a + step; - index++; - } - - if (options.toRegex === true) { - return toRegex(range, null, { wrap: false, options }); - } - - return range; -}; - -const fill$2 = (start, end, step, options = {}) => { - if (end == null && isValidValue(start)) { - return [start]; - } - - if (!isValidValue(start) || !isValidValue(end)) { - return invalidRange(start, end, options); - } - - if (typeof step === 'function') { - return fill$2(start, end, 1, { transform: step }); - } - - if (isObject$2(step)) { - return fill$2(start, end, 0, step); - } - - let opts = { ...options }; - if (opts.capture === true) opts.wrap = true; - step = step || opts.step || 1; - - if (!isNumber$1(step)) { - if (step != null && !isObject$2(step)) return invalidStep(step, opts); - return fill$2(start, end, 1, step); - } - - if (isNumber$1(start) && isNumber$1(end)) { - return fillNumbers(start, end, step, opts); - } - - return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); -}; - -var fillRange = fill$2; - -const fill$1 = fillRange; -const utils$1 = utils$3; - -const compile$1 = (ast, options = {}) => { - let walk = (node, parent = {}) => { - let invalidBlock = utils$1.isInvalidBrace(parent); - let invalidNode = node.invalid === true && options.escapeInvalid === true; - let invalid = invalidBlock === true || invalidNode === true; - let prefix = options.escapeInvalid === true ? '\\' : ''; - let output = ''; - - if (node.isOpen === true) { - return prefix + node.value; - } - if (node.isClose === true) { - return prefix + node.value; - } - - if (node.type === 'open') { - return invalid ? (prefix + node.value) : '('; - } - - if (node.type === 'close') { - return invalid ? (prefix + node.value) : ')'; - } - - if (node.type === 'comma') { - return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); - } - - if (node.value) { - return node.value; - } - - if (node.nodes && node.ranges > 0) { - let args = utils$1.reduce(node.nodes); - let range = fill$1(...args, { ...options, wrap: false, toRegex: true }); - - if (range.length !== 0) { - return args.length > 1 && range.length > 1 ? `(${range})` : range; - } - } - - if (node.nodes) { - for (let child of node.nodes) { - output += walk(child, node); - } - } - return output; - }; - - return walk(ast); -}; - -var compile_1 = compile$1; - -const fill = fillRange; -const stringify$6 = stringify$8; -const utils = utils$3; - -const append = (queue = '', stash = '', enclose = false) => { - let result = []; - - queue = [].concat(queue); - stash = [].concat(stash); - - if (!stash.length) return queue; - if (!queue.length) { - return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; - } - - for (let item of queue) { - if (Array.isArray(item)) { - for (let value of item) { - result.push(append(value, stash, enclose)); - } - } else { - for (let ele of stash) { - if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; - result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); - } - } - } - return utils.flatten(result); -}; - -const expand$1 = (ast, options = {}) => { - let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; - - let walk = (node, parent = {}) => { - node.queue = []; - - let p = parent; - let q = parent.queue; - - while (p.type !== 'brace' && p.type !== 'root' && p.parent) { - p = p.parent; - q = p.queue; - } - - if (node.invalid || node.dollar) { - q.push(append(q.pop(), stringify$6(node, options))); - return; - } - - if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { - q.push(append(q.pop(), ['{}'])); - return; - } - - if (node.nodes && node.ranges > 0) { - let args = utils.reduce(node.nodes); - - if (utils.exceedsLimit(...args, options.step, rangeLimit)) { - throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); - } - - let range = fill(...args, options); - if (range.length === 0) { - range = stringify$6(node, options); - } - - q.push(append(q.pop(), range)); - node.nodes = []; - return; - } - - let enclose = utils.encloseBrace(node); - let queue = node.queue; - let block = node; - - while (block.type !== 'brace' && block.type !== 'root' && block.parent) { - block = block.parent; - queue = block.queue; - } - - for (let i = 0; i < node.nodes.length; i++) { - let child = node.nodes[i]; - - if (child.type === 'comma' && node.type === 'brace') { - if (i === 1) queue.push(''); - queue.push(''); - continue; - } - - if (child.type === 'close') { - q.push(append(q.pop(), queue, enclose)); - continue; - } - - if (child.value && child.type !== 'open') { - queue.push(append(queue.pop(), child.value)); - continue; - } - - if (child.nodes) { - walk(child, node); - } - } - - return queue; - }; - - return utils.flatten(walk(ast)); -}; - -var expand_1 = expand$1; - -var constants$2 = { - MAX_LENGTH: 1024 * 64, - - // Digits - CHAR_0: '0', /* 0 */ - CHAR_9: '9', /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 'A', /* A */ - CHAR_LOWERCASE_A: 'a', /* a */ - CHAR_UPPERCASE_Z: 'Z', /* Z */ - CHAR_LOWERCASE_Z: 'z', /* z */ - - CHAR_LEFT_PARENTHESES: '(', /* ( */ - CHAR_RIGHT_PARENTHESES: ')', /* ) */ - - CHAR_ASTERISK: '*', /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: '&', /* & */ - CHAR_AT: '@', /* @ */ - CHAR_BACKSLASH: '\\', /* \ */ - CHAR_BACKTICK: '`', /* ` */ - CHAR_CARRIAGE_RETURN: '\r', /* \r */ - CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ - CHAR_COLON: ':', /* : */ - CHAR_COMMA: ',', /* , */ - CHAR_DOLLAR: '$', /* . */ - CHAR_DOT: '.', /* . */ - CHAR_DOUBLE_QUOTE: '"', /* " */ - CHAR_EQUAL: '=', /* = */ - CHAR_EXCLAMATION_MARK: '!', /* ! */ - CHAR_FORM_FEED: '\f', /* \f */ - CHAR_FORWARD_SLASH: '/', /* / */ - CHAR_HASH: '#', /* # */ - CHAR_HYPHEN_MINUS: '-', /* - */ - CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ - CHAR_LEFT_CURLY_BRACE: '{', /* { */ - CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ - CHAR_LINE_FEED: '\n', /* \n */ - CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ - CHAR_PERCENT: '%', /* % */ - CHAR_PLUS: '+', /* + */ - CHAR_QUESTION_MARK: '?', /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ - CHAR_RIGHT_CURLY_BRACE: '}', /* } */ - CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ - CHAR_SEMICOLON: ';', /* ; */ - CHAR_SINGLE_QUOTE: '\'', /* ' */ - CHAR_SPACE: ' ', /* */ - CHAR_TAB: '\t', /* \t */ - CHAR_UNDERSCORE: '_', /* _ */ - CHAR_VERTICAL_LINE: '|', /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ -}; - -const stringify$5 = stringify$8; - -/** - * Constants - */ - -const { - MAX_LENGTH: MAX_LENGTH$3, - CHAR_BACKSLASH, /* \ */ - CHAR_BACKTICK, /* ` */ - CHAR_COMMA: CHAR_COMMA$1, /* , */ - CHAR_DOT, /* . */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$1, /* [ */ - CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$1, /* ] */ - CHAR_DOUBLE_QUOTE: CHAR_DOUBLE_QUOTE$1, /* " */ - CHAR_SINGLE_QUOTE: CHAR_SINGLE_QUOTE$1, /* ' */ - CHAR_NO_BREAK_SPACE, - CHAR_ZERO_WIDTH_NOBREAK_SPACE -} = constants$2; - -/** - * parse - */ - -const parse$6 = (input, options = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - let opts = options || {}; - let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$3, opts.maxLength) : MAX_LENGTH$3; - if (input.length > max) { - throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); - } - - let ast = { type: 'root', input, nodes: [] }; - let stack = [ast]; - let block = ast; - let prev = ast; - let brackets = 0; - let length = input.length; - let index = 0; - let depth = 0; - let value; - - /** - * Helpers - */ - - const advance = () => input[index++]; - const push = node => { - if (node.type === 'text' && prev.type === 'dot') { - prev.type = 'text'; - } - - if (prev && prev.type === 'text' && node.type === 'text') { - prev.value += node.value; - return; - } - - block.nodes.push(node); - node.parent = block; - node.prev = prev; - prev = node; - return node; - }; - - push({ type: 'bos' }); - - while (index < length) { - block = stack[stack.length - 1]; - value = advance(); - - /** - * Invalid chars - */ - - if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { - continue; - } - - /** - * Escaped chars - */ - - if (value === CHAR_BACKSLASH) { - push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); - continue; - } - - /** - * Right square bracket (literal): ']' - */ - - if (value === CHAR_RIGHT_SQUARE_BRACKET$1) { - push({ type: 'text', value: '\\' + value }); - continue; - } - - /** - * Left square bracket: '[' - */ - - if (value === CHAR_LEFT_SQUARE_BRACKET$1) { - brackets++; - let next; - - while (index < length && (next = advance())) { - value += next; - - if (next === CHAR_LEFT_SQUARE_BRACKET$1) { - brackets++; - continue; - } - - if (next === CHAR_BACKSLASH) { - value += advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET$1) { - brackets--; - - if (brackets === 0) { - break; - } - } - } - - push({ type: 'text', value }); - continue; - } - - /** - * Parentheses - */ - - if (value === CHAR_LEFT_PARENTHESES) { - block = push({ type: 'paren', nodes: [] }); - stack.push(block); - push({ type: 'text', value }); - continue; - } - - if (value === CHAR_RIGHT_PARENTHESES) { - if (block.type !== 'paren') { - push({ type: 'text', value }); - continue; - } - block = stack.pop(); - push({ type: 'text', value }); - block = stack[stack.length - 1]; - continue; - } - - /** - * Quotes: '|"|` - */ - - if (value === CHAR_DOUBLE_QUOTE$1 || value === CHAR_SINGLE_QUOTE$1 || value === CHAR_BACKTICK) { - let open = value; - let next; - - if (options.keepQuotes !== true) { - value = ''; - } - - while (index < length && (next = advance())) { - if (next === CHAR_BACKSLASH) { - value += next + advance(); - continue; - } - - if (next === open) { - if (options.keepQuotes === true) value += next; - break; - } - - value += next; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Left curly brace: '{' - */ - - if (value === CHAR_LEFT_CURLY_BRACE) { - depth++; - - let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; - let brace = { - type: 'brace', - open: true, - close: false, - dollar, - depth, - commas: 0, - ranges: 0, - nodes: [] - }; - - block = push(brace); - stack.push(block); - push({ type: 'open', value }); - continue; - } - - /** - * Right curly brace: '}' - */ - - if (value === CHAR_RIGHT_CURLY_BRACE) { - if (block.type !== 'brace') { - push({ type: 'text', value }); - continue; - } - - let type = 'close'; - block = stack.pop(); - block.close = true; - - push({ type, value }); - depth--; - - block = stack[stack.length - 1]; - continue; - } - - /** - * Comma: ',' - */ - - if (value === CHAR_COMMA$1 && depth > 0) { - if (block.ranges > 0) { - block.ranges = 0; - let open = block.nodes.shift(); - block.nodes = [open, { type: 'text', value: stringify$5(block) }]; - } - - push({ type: 'comma', value }); - block.commas++; - continue; - } - - /** - * Dot: '.' - */ - - if (value === CHAR_DOT && depth > 0 && block.commas === 0) { - let siblings = block.nodes; - - if (depth === 0 || siblings.length === 0) { - push({ type: 'text', value }); - continue; - } - - if (prev.type === 'dot') { - block.range = []; - prev.value += value; - prev.type = 'range'; - - if (block.nodes.length !== 3 && block.nodes.length !== 5) { - block.invalid = true; - block.ranges = 0; - prev.type = 'text'; - continue; - } - - block.ranges++; - block.args = []; - continue; - } - - if (prev.type === 'range') { - siblings.pop(); - - let before = siblings[siblings.length - 1]; - before.value += prev.value + value; - prev = before; - block.ranges--; - continue; - } - - push({ type: 'dot', value }); - continue; - } - - /** - * Text - */ - - push({ type: 'text', value }); - } - - // Mark imbalanced braces and brackets as invalid - do { - block = stack.pop(); - - if (block.type !== 'root') { - block.nodes.forEach(node => { - if (!node.nodes) { - if (node.type === 'open') node.isOpen = true; - if (node.type === 'close') node.isClose = true; - if (!node.nodes) node.type = 'text'; - node.invalid = true; - } - }); - - // get the location of the block on parent.nodes (block's siblings) - let parent = stack[stack.length - 1]; - let index = parent.nodes.indexOf(block); - // replace the (invalid) block with it's nodes - parent.nodes.splice(index, 1, ...block.nodes); - } - } while (stack.length > 0); - - push({ type: 'eos' }); - return ast; -}; - -var parse_1$2 = parse$6; - -const stringify$4 = stringify$8; -const compile = compile_1; -const expand = expand_1; -const parse$5 = parse_1$2; - -/** - * Expand the given pattern or create a regex-compatible string. - * - * ```js - * const braces = require('braces'); - * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] - * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {String} - * @api public - */ - -const braces$1 = (input, options = {}) => { - let output = []; - - if (Array.isArray(input)) { - for (let pattern of input) { - let result = braces$1.create(pattern, options); - if (Array.isArray(result)) { - output.push(...result); - } else { - output.push(result); - } - } - } else { - output = [].concat(braces$1.create(input, options)); - } - - if (options && options.expand === true && options.nodupes === true) { - output = [...new Set(output)]; - } - return output; -}; - -/** - * Parse the given `str` with the given `options`. - * - * ```js - * // braces.parse(pattern, [, options]); - * const ast = braces.parse('a/{b,c}/d'); - * console.log(ast); - * ``` - * @param {String} pattern Brace pattern to parse - * @param {Object} options - * @return {Object} Returns an AST - * @api public - */ - -braces$1.parse = (input, options = {}) => parse$5(input, options); - -/** - * Creates a braces string from an AST, or an AST node. - * - * ```js - * const braces = require('braces'); - * let ast = braces.parse('foo/{a,b}/bar'); - * console.log(stringify(ast.nodes[2])); //=> '{a,b}' - * ``` - * @param {String} `input` Brace pattern or AST. - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces$1.stringify = (input, options = {}) => { - if (typeof input === 'string') { - return stringify$4(braces$1.parse(input, options), options); - } - return stringify$4(input, options); -}; - -/** - * Compiles a brace pattern into a regex-compatible, optimized string. - * This method is called by the main [braces](#braces) function by default. - * - * ```js - * const braces = require('braces'); - * console.log(braces.compile('a/{b,c}/d')); - * //=> ['a/(b|c)/d'] - * ``` - * @param {String} `input` Brace pattern or AST. - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces$1.compile = (input, options = {}) => { - if (typeof input === 'string') { - input = braces$1.parse(input, options); - } - return compile(input, options); -}; - -/** - * Expands a brace pattern into an array. This method is called by the - * main [braces](#braces) function when `options.expand` is true. Before - * using this method it's recommended that you read the [performance notes](#performance)) - * and advantages of using [.compile](#compile) instead. - * - * ```js - * const braces = require('braces'); - * console.log(braces.expand('a/{b,c}/d')); - * //=> ['a/b/d', 'a/c/d']; - * ``` - * @param {String} `pattern` Brace pattern - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces$1.expand = (input, options = {}) => { - if (typeof input === 'string') { - input = braces$1.parse(input, options); - } - - let result = expand(input, options); - - // filter out empty strings if specified - if (options.noempty === true) { - result = result.filter(Boolean); - } - - // filter out duplicates if specified - if (options.nodupes === true) { - result = [...new Set(result)]; - } - - return result; -}; - -/** - * Processes a brace pattern and returns either an expanded array - * (if `options.expand` is true), a highly optimized regex-compatible string. - * This method is called by the main [braces](#braces) function. - * - * ```js - * const braces = require('braces'); - * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) - * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' - * ``` - * @param {String} `pattern` Brace pattern - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces$1.create = (input, options = {}) => { - if (input === '' || input.length < 3) { - return [input]; - } - - return options.expand !== true - ? braces$1.compile(input, options) - : braces$1.expand(input, options); -}; - -/** - * Expose "braces" - */ - -var braces_1 = braces$1; - -var require$$0$4 = [ - "3dm", - "3ds", - "3g2", - "3gp", - "7z", - "a", - "aac", - "adp", - "ai", - "aif", - "aiff", - "alz", - "ape", - "apk", - "appimage", - "ar", - "arj", - "asf", - "au", - "avi", - "bak", - "baml", - "bh", - "bin", - "bk", - "bmp", - "btif", - "bz2", - "bzip2", - "cab", - "caf", - "cgm", - "class", - "cmx", - "cpio", - "cr2", - "cur", - "dat", - "dcm", - "deb", - "dex", - "djvu", - "dll", - "dmg", - "dng", - "doc", - "docm", - "docx", - "dot", - "dotm", - "dra", - "DS_Store", - "dsk", - "dts", - "dtshd", - "dvb", - "dwg", - "dxf", - "ecelp4800", - "ecelp7470", - "ecelp9600", - "egg", - "eol", - "eot", - "epub", - "exe", - "f4v", - "fbs", - "fh", - "fla", - "flac", - "flatpak", - "fli", - "flv", - "fpx", - "fst", - "fvt", - "g3", - "gh", - "gif", - "graffle", - "gz", - "gzip", - "h261", - "h263", - "h264", - "icns", - "ico", - "ief", - "img", - "ipa", - "iso", - "jar", - "jpeg", - "jpg", - "jpgv", - "jpm", - "jxr", - "key", - "ktx", - "lha", - "lib", - "lvp", - "lz", - "lzh", - "lzma", - "lzo", - "m3u", - "m4a", - "m4v", - "mar", - "mdi", - "mht", - "mid", - "midi", - "mj2", - "mka", - "mkv", - "mmr", - "mng", - "mobi", - "mov", - "movie", - "mp3", - "mp4", - "mp4a", - "mpeg", - "mpg", - "mpga", - "mxu", - "nef", - "npx", - "numbers", - "nupkg", - "o", - "odp", - "ods", - "odt", - "oga", - "ogg", - "ogv", - "otf", - "ott", - "pages", - "pbm", - "pcx", - "pdb", - "pdf", - "pea", - "pgm", - "pic", - "png", - "pnm", - "pot", - "potm", - "potx", - "ppa", - "ppam", - "ppm", - "pps", - "ppsm", - "ppsx", - "ppt", - "pptm", - "pptx", - "psd", - "pya", - "pyc", - "pyo", - "pyv", - "qt", - "rar", - "ras", - "raw", - "resources", - "rgb", - "rip", - "rlc", - "rmf", - "rmvb", - "rpm", - "rtf", - "rz", - "s3m", - "s7z", - "scpt", - "sgi", - "shar", - "snap", - "sil", - "sketch", - "slk", - "smv", - "snk", - "so", - "stl", - "suo", - "sub", - "swf", - "tar", - "tbz", - "tbz2", - "tga", - "tgz", - "thmx", - "tif", - "tiff", - "tlz", - "ttc", - "ttf", - "txz", - "udf", - "uvh", - "uvi", - "uvm", - "uvp", - "uvs", - "uvu", - "viv", - "vob", - "war", - "wav", - "wax", - "wbmp", - "wdp", - "weba", - "webm", - "webp", - "whl", - "wim", - "wm", - "wma", - "wmv", - "wmx", - "woff", - "woff2", - "wrm", - "wvx", - "xbm", - "xif", - "xla", - "xlam", - "xls", - "xlsb", - "xlsm", - "xlsx", - "xlt", - "xltm", - "xltx", - "xm", - "xmind", - "xpi", - "xpm", - "xwd", - "xz", - "z", - "zip", - "zipx" -]; - -var binaryExtensions$1 = require$$0$4; - -const path$1 = require$$0__default$2['default']; -const binaryExtensions = binaryExtensions$1; - -const extensions$1 = new Set(binaryExtensions); - -var isBinaryPath$1 = filePath => extensions$1.has(path$1.extname(filePath).slice(1).toLowerCase()); - -var constants$1 = {}; - -(function (exports) { - -const {sep} = require$$0__default$2['default']; -const {platform} = process; -const os = require$$0__default$1['default']; - -exports.EV_ALL = 'all'; -exports.EV_READY = 'ready'; -exports.EV_ADD = 'add'; -exports.EV_CHANGE = 'change'; -exports.EV_ADD_DIR = 'addDir'; -exports.EV_UNLINK = 'unlink'; -exports.EV_UNLINK_DIR = 'unlinkDir'; -exports.EV_RAW = 'raw'; -exports.EV_ERROR = 'error'; - -exports.STR_DATA = 'data'; -exports.STR_END = 'end'; -exports.STR_CLOSE = 'close'; - -exports.FSEVENT_CREATED = 'created'; -exports.FSEVENT_MODIFIED = 'modified'; -exports.FSEVENT_DELETED = 'deleted'; -exports.FSEVENT_MOVED = 'moved'; -exports.FSEVENT_CLONED = 'cloned'; -exports.FSEVENT_UNKNOWN = 'unknown'; -exports.FSEVENT_TYPE_FILE = 'file'; -exports.FSEVENT_TYPE_DIRECTORY = 'directory'; -exports.FSEVENT_TYPE_SYMLINK = 'symlink'; - -exports.KEY_LISTENERS = 'listeners'; -exports.KEY_ERR = 'errHandlers'; -exports.KEY_RAW = 'rawEmitters'; -exports.HANDLER_KEYS = [exports.KEY_LISTENERS, exports.KEY_ERR, exports.KEY_RAW]; - -exports.DOT_SLASH = `.${sep}`; - -exports.BACK_SLASH_RE = /\\/g; -exports.DOUBLE_SLASH_RE = /\/\//; -exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/; -exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/; -exports.REPLACER_RE = /^\.[/\\]/; - -exports.SLASH = '/'; -exports.SLASH_SLASH = '//'; -exports.BRACE_START = '{'; -exports.BANG = '!'; -exports.ONE_DOT = '.'; -exports.TWO_DOTS = '..'; -exports.STAR = '*'; -exports.GLOBSTAR = '**'; -exports.ROOT_GLOBSTAR = '/**/*'; -exports.SLASH_GLOBSTAR = '/**'; -exports.DIR_SUFFIX = 'Dir'; -exports.ANYMATCH_OPTS = {dot: true}; -exports.STRING_TYPE = 'string'; -exports.FUNCTION_TYPE = 'function'; -exports.EMPTY_STR = ''; -exports.EMPTY_FN = () => {}; -exports.IDENTITY_FN = val => val; - -exports.isWindows = platform === 'win32'; -exports.isMacos = platform === 'darwin'; -exports.isLinux = platform === 'linux'; -exports.isIBMi = os.type() === 'OS400'; -}(constants$1)); - -const fs$2 = require$$0__default$3['default']; -const sysPath$2 = require$$0__default$2['default']; -const { promisify: promisify$2 } = require$$0__default['default']; -const isBinaryPath = isBinaryPath$1; -const { - isWindows: isWindows$1, - isLinux, - EMPTY_FN: EMPTY_FN$2, - EMPTY_STR: EMPTY_STR$1, - KEY_LISTENERS, - KEY_ERR, - KEY_RAW, - HANDLER_KEYS, - EV_CHANGE: EV_CHANGE$2, - EV_ADD: EV_ADD$2, - EV_ADD_DIR: EV_ADD_DIR$2, - EV_ERROR: EV_ERROR$2, - STR_DATA: STR_DATA$1, - STR_END: STR_END$2, - BRACE_START: BRACE_START$1, - STAR -} = constants$1; - -const THROTTLE_MODE_WATCH = 'watch'; - -const open = promisify$2(fs$2.open); -const stat$2 = promisify$2(fs$2.stat); -const lstat$1 = promisify$2(fs$2.lstat); -const close = promisify$2(fs$2.close); -const fsrealpath = promisify$2(fs$2.realpath); - -const statMethods$1 = { lstat: lstat$1, stat: stat$2 }; - -// TODO: emit errors properly. Example: EMFILE on Macos. -const foreach = (val, fn) => { - if (val instanceof Set) { - val.forEach(fn); - } else { - fn(val); - } -}; - -const addAndConvert = (main, prop, item) => { - let container = main[prop]; - if (!(container instanceof Set)) { - main[prop] = container = new Set([container]); - } - container.add(item); -}; - -const clearItem = cont => key => { - const set = cont[key]; - if (set instanceof Set) { - set.clear(); - } else { - delete cont[key]; - } -}; - -const delFromSet = (main, prop, item) => { - const container = main[prop]; - if (container instanceof Set) { - container.delete(item); - } else if (container === item) { - delete main[prop]; - } -}; - -const isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val; - -/** - * @typedef {String} Path - */ - -// fs_watch helpers - -// object to hold per-process fs_watch instances -// (may be shared across chokidar FSWatcher instances) - -/** - * @typedef {Object} FsWatchContainer - * @property {Set} listeners - * @property {Set} errHandlers - * @property {Set} rawEmitters - * @property {fs.FSWatcher=} watcher - * @property {Boolean=} watcherUnusable - */ - -/** - * @type {Map<String,FsWatchContainer>} - */ -const FsWatchInstances = new Map(); - -/** - * Instantiates the fs_watch interface - * @param {String} path to be watched - * @param {Object} options to be passed to fs_watch - * @param {Function} listener main event handler - * @param {Function} errHandler emits info about errors - * @param {Function} emitRaw emits raw event data - * @returns {fs.FSWatcher} new fsevents instance - */ -function createFsWatchInstance(path, options, listener, errHandler, emitRaw) { - const handleEvent = (rawEvent, evPath) => { - listener(path); - emitRaw(rawEvent, evPath, {watchedPath: path}); - - // emit based on events occurring for files from a directory's watcher in - // case the file's watcher misses it (and rely on throttling to de-dupe) - if (evPath && path !== evPath) { - fsWatchBroadcast( - sysPath$2.resolve(path, evPath), KEY_LISTENERS, sysPath$2.join(path, evPath) - ); - } - }; - try { - return fs$2.watch(path, options, handleEvent); - } catch (error) { - errHandler(error); - } -} - -/** - * Helper for passing fs_watch event data to a collection of listeners - * @param {Path} fullPath absolute path bound to fs_watch instance - * @param {String} type listener type - * @param {*=} val1 arguments to be passed to listeners - * @param {*=} val2 - * @param {*=} val3 - */ -const fsWatchBroadcast = (fullPath, type, val1, val2, val3) => { - const cont = FsWatchInstances.get(fullPath); - if (!cont) return; - foreach(cont[type], (listener) => { - listener(val1, val2, val3); - }); -}; - -/** - * Instantiates the fs_watch interface or binds listeners - * to an existing one covering the same file system entry - * @param {String} path - * @param {String} fullPath absolute path - * @param {Object} options to be passed to fs_watch - * @param {Object} handlers container for event listener functions - */ -const setFsWatchListener = (path, fullPath, options, handlers) => { - const {listener, errHandler, rawEmitter} = handlers; - let cont = FsWatchInstances.get(fullPath); - - /** @type {fs.FSWatcher=} */ - let watcher; - if (!options.persistent) { - watcher = createFsWatchInstance( - path, options, listener, errHandler, rawEmitter - ); - return watcher.close.bind(watcher); - } - if (cont) { - addAndConvert(cont, KEY_LISTENERS, listener); - addAndConvert(cont, KEY_ERR, errHandler); - addAndConvert(cont, KEY_RAW, rawEmitter); - } else { - watcher = createFsWatchInstance( - path, - options, - fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), - errHandler, // no need to use broadcast here - fsWatchBroadcast.bind(null, fullPath, KEY_RAW) - ); - if (!watcher) return; - watcher.on(EV_ERROR$2, async (error) => { - const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR); - cont.watcherUnusable = true; // documented since Node 10.4.1 - // Workaround for https://github.com/joyent/node/issues/4337 - if (isWindows$1 && error.code === 'EPERM') { - try { - const fd = await open(path, 'r'); - await close(fd); - broadcastErr(error); - } catch (err) {} - } else { - broadcastErr(error); - } - }); - cont = { - listeners: listener, - errHandlers: errHandler, - rawEmitters: rawEmitter, - watcher - }; - FsWatchInstances.set(fullPath, cont); - } - // const index = cont.listeners.indexOf(listener); - - // removes this instance's listeners and closes the underlying fs_watch - // instance if there are no more listeners left - return () => { - delFromSet(cont, KEY_LISTENERS, listener); - delFromSet(cont, KEY_ERR, errHandler); - delFromSet(cont, KEY_RAW, rawEmitter); - if (isEmptySet(cont.listeners)) { - // Check to protect against issue gh-730. - // if (cont.watcherUnusable) { - cont.watcher.close(); - // } - FsWatchInstances.delete(fullPath); - HANDLER_KEYS.forEach(clearItem(cont)); - cont.watcher = undefined; - Object.freeze(cont); - } - }; -}; - -// fs_watchFile helpers - -// object to hold per-process fs_watchFile instances -// (may be shared across chokidar FSWatcher instances) -const FsWatchFileInstances = new Map(); - -/** - * Instantiates the fs_watchFile interface or binds listeners - * to an existing one covering the same file system entry - * @param {String} path to be watched - * @param {String} fullPath absolute path - * @param {Object} options options to be passed to fs_watchFile - * @param {Object} handlers container for event listener functions - * @returns {Function} closer - */ -const setFsWatchFileListener = (path, fullPath, options, handlers) => { - const {listener, rawEmitter} = handlers; - let cont = FsWatchFileInstances.get(fullPath); - - const copts = cont && cont.options; - if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) { - fs$2.unwatchFile(fullPath); - cont = undefined; - } - - /* eslint-enable no-unused-vars, prefer-destructuring */ - - if (cont) { - addAndConvert(cont, KEY_LISTENERS, listener); - addAndConvert(cont, KEY_RAW, rawEmitter); - } else { - // TODO - // listeners.add(listener); - // rawEmitters.add(rawEmitter); - cont = { - listeners: listener, - rawEmitters: rawEmitter, - options, - watcher: fs$2.watchFile(fullPath, options, (curr, prev) => { - foreach(cont.rawEmitters, (rawEmitter) => { - rawEmitter(EV_CHANGE$2, fullPath, {curr, prev}); - }); - const currmtime = curr.mtimeMs; - if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) { - foreach(cont.listeners, (listener) => listener(path, curr)); - } - }) - }; - FsWatchFileInstances.set(fullPath, cont); - } - // const index = cont.listeners.indexOf(listener); - - // Removes this instance's listeners and closes the underlying fs_watchFile - // instance if there are no more listeners left. - return () => { - delFromSet(cont, KEY_LISTENERS, listener); - delFromSet(cont, KEY_RAW, rawEmitter); - if (isEmptySet(cont.listeners)) { - FsWatchFileInstances.delete(fullPath); - fs$2.unwatchFile(fullPath); - cont.options = cont.watcher = undefined; - Object.freeze(cont); - } - }; -}; - -/** - * @mixin - */ -class NodeFsHandler$1 { - -/** - * @param {import("../index").FSWatcher} fsW - */ -constructor(fsW) { - this.fsw = fsW; - this._boundHandleError = (error) => fsW._handleError(error); -} - -/** - * Watch file for changes with fs_watchFile or fs_watch. - * @param {String} path to file or dir - * @param {Function} listener on fs change - * @returns {Function} closer for the watcher instance - */ -_watchWithNodeFs(path, listener) { - const opts = this.fsw.options; - const directory = sysPath$2.dirname(path); - const basename = sysPath$2.basename(path); - const parent = this.fsw._getWatchedDir(directory); - parent.add(basename); - const absolutePath = sysPath$2.resolve(path); - const options = {persistent: opts.persistent}; - if (!listener) listener = EMPTY_FN$2; - - let closer; - if (opts.usePolling) { - options.interval = opts.enableBinaryInterval && isBinaryPath(basename) ? - opts.binaryInterval : opts.interval; - closer = setFsWatchFileListener(path, absolutePath, options, { - listener, - rawEmitter: this.fsw._emitRaw - }); - } else { - closer = setFsWatchListener(path, absolutePath, options, { - listener, - errHandler: this._boundHandleError, - rawEmitter: this.fsw._emitRaw - }); - } - return closer; -} - -/** - * Watch a file and emit add event if warranted. - * @param {Path} file Path - * @param {fs.Stats} stats result of fs_stat - * @param {Boolean} initialAdd was the file added at watch instantiation? - * @returns {Function} closer for the watcher instance - */ -_handleFile(file, stats, initialAdd) { - if (this.fsw.closed) { - return; - } - const dirname = sysPath$2.dirname(file); - const basename = sysPath$2.basename(file); - const parent = this.fsw._getWatchedDir(dirname); - // stats is always present - let prevStats = stats; - - // if the file is already being watched, do nothing - if (parent.has(basename)) return; - - const listener = async (path, newStats) => { - if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return; - if (!newStats || newStats.mtimeMs === 0) { - try { - const newStats = await stat$2(file); - if (this.fsw.closed) return; - // Check that change event was not fired because of changed only accessTime. - const at = newStats.atimeMs; - const mt = newStats.mtimeMs; - if (!at || at <= mt || mt !== prevStats.mtimeMs) { - this.fsw._emit(EV_CHANGE$2, file, newStats); - } - if (isLinux && prevStats.ino !== newStats.ino) { - this.fsw._closeFile(path); - prevStats = newStats; - this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener)); - } else { - prevStats = newStats; - } - } catch (error) { - // Fix issues where mtime is null but file is still present - this.fsw._remove(dirname, basename); - } - // add is about to be emitted if file not already tracked in parent - } else if (parent.has(basename)) { - // Check that change event was not fired because of changed only accessTime. - const at = newStats.atimeMs; - const mt = newStats.mtimeMs; - if (!at || at <= mt || mt !== prevStats.mtimeMs) { - this.fsw._emit(EV_CHANGE$2, file, newStats); - } - prevStats = newStats; - } - }; - // kick off the watcher - const closer = this._watchWithNodeFs(file, listener); - - // emit an add event if we're supposed to - if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) { - if (!this.fsw._throttle(EV_ADD$2, file, 0)) return; - this.fsw._emit(EV_ADD$2, file, stats); - } - - return closer; -} - -/** - * Handle symlinks encountered while reading a dir. - * @param {Object} entry returned by readdirp - * @param {String} directory path of dir being read - * @param {String} path of this item - * @param {String} item basename of this item - * @returns {Promise<Boolean>} true if no more processing is needed for this entry. - */ -async _handleSymlink(entry, directory, path, item) { - if (this.fsw.closed) { - return; - } - const full = entry.fullPath; - const dir = this.fsw._getWatchedDir(directory); - - if (!this.fsw.options.followSymlinks) { - // watch symlink directly (don't follow) and detect changes - this.fsw._incrReadyCount(); - const linkPath = await fsrealpath(path); - if (this.fsw.closed) return; - if (dir.has(item)) { - if (this.fsw._symlinkPaths.get(full) !== linkPath) { - this.fsw._symlinkPaths.set(full, linkPath); - this.fsw._emit(EV_CHANGE$2, path, entry.stats); - } - } else { - dir.add(item); - this.fsw._symlinkPaths.set(full, linkPath); - this.fsw._emit(EV_ADD$2, path, entry.stats); - } - this.fsw._emitReady(); - return true; - } - - // don't follow the same symlink more than once - if (this.fsw._symlinkPaths.has(full)) { - return true; - } - - this.fsw._symlinkPaths.set(full, true); -} - -_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) { - // Normalize the directory name on Windows - directory = sysPath$2.join(directory, EMPTY_STR$1); - - if (!wh.hasGlob) { - throttler = this.fsw._throttle('readdir', directory, 1000); - if (!throttler) return; - } - - const previous = this.fsw._getWatchedDir(wh.path); - const current = new Set(); - - let stream = this.fsw._readdirp(directory, { - fileFilter: entry => wh.filterPath(entry), - directoryFilter: entry => wh.filterDir(entry), - depth: 0 - }).on(STR_DATA$1, async (entry) => { - if (this.fsw.closed) { - stream = undefined; - return; - } - const item = entry.path; - let path = sysPath$2.join(directory, item); - current.add(item); - - if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) { - return; - } - - if (this.fsw.closed) { - stream = undefined; - return; - } - // Files that present in current directory snapshot - // but absent in previous are added to watch list and - // emit `add` event. - if (item === target || !target && !previous.has(item)) { - this.fsw._incrReadyCount(); - - // ensure relativeness of path is preserved in case of watcher reuse - path = sysPath$2.join(dir, sysPath$2.relative(dir, path)); - - this._addToNodeFs(path, initialAdd, wh, depth + 1); - } - }).on(EV_ERROR$2, this._boundHandleError); - - return new Promise(resolve => - stream.once(STR_END$2, () => { - if (this.fsw.closed) { - stream = undefined; - return; - } - const wasThrottled = throttler ? throttler.clear() : false; - - resolve(); - - // Files that absent in current directory snapshot - // but present in previous emit `remove` event - // and are removed from @watched[directory]. - previous.getChildren().filter((item) => { - return item !== directory && - !current.has(item) && - // in case of intersecting globs; - // a path may have been filtered out of this readdir, but - // shouldn't be removed because it matches a different glob - (!wh.hasGlob || wh.filterPath({ - fullPath: sysPath$2.resolve(directory, item) - })); - }).forEach((item) => { - this.fsw._remove(directory, item); - }); - - stream = undefined; - - // one more time for any missed in case changes came in extremely quickly - if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler); - }) - ); -} - -/** - * Read directory to add / remove files from `@watched` list and re-read it on change. - * @param {String} dir fs path - * @param {fs.Stats} stats - * @param {Boolean} initialAdd - * @param {Number} depth relative to user-supplied path - * @param {String} target child path targeted for watch - * @param {Object} wh Common watch helpers for this path - * @param {String} realpath - * @returns {Promise<Function>} closer for the watcher instance. - */ -async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) { - const parentDir = this.fsw._getWatchedDir(sysPath$2.dirname(dir)); - const tracked = parentDir.has(sysPath$2.basename(dir)); - if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) { - if (!wh.hasGlob || wh.globFilter(dir)) this.fsw._emit(EV_ADD_DIR$2, dir, stats); - } - - // ensure dir is tracked (harmless if redundant) - parentDir.add(sysPath$2.basename(dir)); - this.fsw._getWatchedDir(dir); - let throttler; - let closer; - - const oDepth = this.fsw.options.depth; - if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) { - if (!target) { - await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler); - if (this.fsw.closed) return; - } - - closer = this._watchWithNodeFs(dir, (dirPath, stats) => { - // if current directory is removed, do nothing - if (stats && stats.mtimeMs === 0) return; - - this._handleRead(dirPath, false, wh, target, dir, depth, throttler); - }); - } - return closer; -} - -/** - * Handle added file, directory, or glob pattern. - * Delegates call to _handleFile / _handleDir after checks. - * @param {String} path to file or ir - * @param {Boolean} initialAdd was the file added at watch instantiation? - * @param {Object} priorWh depth relative to user-supplied path - * @param {Number} depth Child path actually targeted for watch - * @param {String=} target Child path actually targeted for watch - * @returns {Promise} - */ -async _addToNodeFs(path, initialAdd, priorWh, depth, target) { - const ready = this.fsw._emitReady; - if (this.fsw._isIgnored(path) || this.fsw.closed) { - ready(); - return false; - } - - const wh = this.fsw._getWatchHelpers(path, depth); - if (!wh.hasGlob && priorWh) { - wh.hasGlob = priorWh.hasGlob; - wh.globFilter = priorWh.globFilter; - wh.filterPath = entry => priorWh.filterPath(entry); - wh.filterDir = entry => priorWh.filterDir(entry); - } - - // evaluate what is at the path we're being asked to watch - try { - const stats = await statMethods$1[wh.statMethod](wh.watchPath); - if (this.fsw.closed) return; - if (this.fsw._isIgnored(wh.watchPath, stats)) { - ready(); - return false; - } - - const follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START$1); - let closer; - if (stats.isDirectory()) { - const absPath = sysPath$2.resolve(path); - const targetPath = follow ? await fsrealpath(path) : path; - if (this.fsw.closed) return; - closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath); - if (this.fsw.closed) return; - // preserve this symlink's target path - if (absPath !== targetPath && targetPath !== undefined) { - this.fsw._symlinkPaths.set(absPath, targetPath); - } - } else if (stats.isSymbolicLink()) { - const targetPath = follow ? await fsrealpath(path) : path; - if (this.fsw.closed) return; - const parent = sysPath$2.dirname(wh.watchPath); - this.fsw._getWatchedDir(parent).add(wh.watchPath); - this.fsw._emit(EV_ADD$2, wh.watchPath, stats); - closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath); - if (this.fsw.closed) return; - - // preserve this symlink's target path - if (targetPath !== undefined) { - this.fsw._symlinkPaths.set(sysPath$2.resolve(path), targetPath); - } - } else { - closer = this._handleFile(wh.watchPath, stats, initialAdd); - } - ready(); - - this.fsw._addPathCloser(path, closer); - return false; - - } catch (error) { - if (this.fsw._handleError(error)) { - ready(); - return path; - } - } -} - -} - -var nodefsHandler = NodeFsHandler$1; - -var fseventsHandler = {exports: {}}; - -const fs$1 = require$$0__default$3['default']; -const sysPath$1 = require$$0__default$2['default']; -const { promisify: promisify$1 } = require$$0__default['default']; - -let fsevents; -try { - fsevents = undefined; -} catch (error) { - if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error); -} - -if (fsevents) { - // TODO: real check - const mtch = process.version.match(/v(\d+)\.(\d+)/); - if (mtch && mtch[1] && mtch[2]) { - const maj = Number.parseInt(mtch[1], 10); - const min = Number.parseInt(mtch[2], 10); - if (maj === 8 && min < 16) { - fsevents = undefined; - } - } -} - -const { - EV_ADD: EV_ADD$1, - EV_CHANGE: EV_CHANGE$1, - EV_ADD_DIR: EV_ADD_DIR$1, - EV_UNLINK: EV_UNLINK$1, - EV_ERROR: EV_ERROR$1, - STR_DATA, - STR_END: STR_END$1, - FSEVENT_CREATED, - FSEVENT_MODIFIED, - FSEVENT_DELETED, - FSEVENT_MOVED, - // FSEVENT_CLONED, - FSEVENT_UNKNOWN, - FSEVENT_TYPE_FILE, - FSEVENT_TYPE_DIRECTORY, - FSEVENT_TYPE_SYMLINK, - - ROOT_GLOBSTAR, - DIR_SUFFIX, - DOT_SLASH, - FUNCTION_TYPE: FUNCTION_TYPE$1, - EMPTY_FN: EMPTY_FN$1, - IDENTITY_FN -} = constants$1; - -const Depth = (value) => isNaN(value) ? {} : {depth: value}; - -const stat$1 = promisify$1(fs$1.stat); -const lstat = promisify$1(fs$1.lstat); -const realpath = promisify$1(fs$1.realpath); - -const statMethods = { stat: stat$1, lstat }; - -/** - * @typedef {String} Path - */ - -/** - * @typedef {Object} FsEventsWatchContainer - * @property {Set<Function>} listeners - * @property {Function} rawEmitter - * @property {{stop: Function}} watcher - */ - -// fsevents instance helper functions -/** - * Object to hold per-process fsevents instances (may be shared across chokidar FSWatcher instances) - * @type {Map<Path,FsEventsWatchContainer>} - */ -const FSEventsWatchers = new Map(); - -// Threshold of duplicate path prefixes at which to start -// consolidating going forward -const consolidateThreshhold = 10; - -const wrongEventFlags = new Set([ - 69888, 70400, 71424, 72704, 73472, 131328, 131840, 262912 -]); - -/** - * Instantiates the fsevents interface - * @param {Path} path path to be watched - * @param {Function} callback called when fsevents is bound and ready - * @returns {{stop: Function}} new fsevents instance - */ -const createFSEventsInstance = (path, callback) => { - const stop = fsevents.watch(path, callback); - return {stop}; -}; - -/** - * Instantiates the fsevents interface or binds listeners to an existing one covering - * the same file tree. - * @param {Path} path - to be watched - * @param {Path} realPath - real path for symlinks - * @param {Function} listener - called when fsevents emits events - * @param {Function} rawEmitter - passes data to listeners of the 'raw' event - * @returns {Function} closer - */ -function setFSEventsListener(path, realPath, listener, rawEmitter) { - let watchPath = sysPath$1.extname(realPath) ? sysPath$1.dirname(realPath) : realPath; - - const parentPath = sysPath$1.dirname(watchPath); - let cont = FSEventsWatchers.get(watchPath); - - // If we've accumulated a substantial number of paths that - // could have been consolidated by watching one directory - // above the current one, create a watcher on the parent - // path instead, so that we do consolidate going forward. - if (couldConsolidate(parentPath)) { - watchPath = parentPath; - } - - const resolvedPath = sysPath$1.resolve(path); - const hasSymlink = resolvedPath !== realPath; - - const filteredListener = (fullPath, flags, info) => { - if (hasSymlink) fullPath = fullPath.replace(realPath, resolvedPath); - if ( - fullPath === resolvedPath || - !fullPath.indexOf(resolvedPath + sysPath$1.sep) - ) listener(fullPath, flags, info); - }; - - // check if there is already a watcher on a parent path - // modifies `watchPath` to the parent path when it finds a match - let watchedParent = false; - for (const watchedPath of FSEventsWatchers.keys()) { - if (realPath.indexOf(sysPath$1.resolve(watchedPath) + sysPath$1.sep) === 0) { - watchPath = watchedPath; - cont = FSEventsWatchers.get(watchPath); - watchedParent = true; - break; - } - } - - if (cont || watchedParent) { - cont.listeners.add(filteredListener); - } else { - cont = { - listeners: new Set([filteredListener]), - rawEmitter, - watcher: createFSEventsInstance(watchPath, (fullPath, flags) => { - if (!cont.listeners.size) return; - const info = fsevents.getInfo(fullPath, flags); - cont.listeners.forEach(list => { - list(fullPath, flags, info); - }); - - cont.rawEmitter(info.event, fullPath, info); - }) - }; - FSEventsWatchers.set(watchPath, cont); - } - - // removes this instance's listeners and closes the underlying fsevents - // instance if there are no more listeners left - return () => { - const lst = cont.listeners; - - lst.delete(filteredListener); - if (!lst.size) { - FSEventsWatchers.delete(watchPath); - if (cont.watcher) return cont.watcher.stop().then(() => { - cont.rawEmitter = cont.watcher = undefined; - Object.freeze(cont); - }); - } - }; -} - -// Decide whether or not we should start a new higher-level -// parent watcher -const couldConsolidate = (path) => { - let count = 0; - for (const watchPath of FSEventsWatchers.keys()) { - if (watchPath.indexOf(path) === 0) { - count++; - if (count >= consolidateThreshhold) { - return true; - } - } - } - - return false; -}; - -// returns boolean indicating whether fsevents can be used -const canUse = () => fsevents && FSEventsWatchers.size < 128; - -// determines subdirectory traversal levels from root to path -const calcDepth = (path, root) => { - let i = 0; - while (!path.indexOf(root) && (path = sysPath$1.dirname(path)) !== root) i++; - return i; -}; - -// returns boolean indicating whether the fsevents' event info has the same type -// as the one returned by fs.stat -const sameTypes = (info, stats) => ( - info.type === FSEVENT_TYPE_DIRECTORY && stats.isDirectory() || - info.type === FSEVENT_TYPE_SYMLINK && stats.isSymbolicLink() || - info.type === FSEVENT_TYPE_FILE && stats.isFile() -); - -/** - * @mixin - */ -class FsEventsHandler$1 { - -/** - * @param {import('../index').FSWatcher} fsw - */ -constructor(fsw) { - this.fsw = fsw; -} -checkIgnored(path, stats) { - const ipaths = this.fsw._ignoredPaths; - if (this.fsw._isIgnored(path, stats)) { - ipaths.add(path); - if (stats && stats.isDirectory()) { - ipaths.add(path + ROOT_GLOBSTAR); - } - return true; - } - - ipaths.delete(path); - ipaths.delete(path + ROOT_GLOBSTAR); -} - -addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) { - const event = watchedDir.has(item) ? EV_CHANGE$1 : EV_ADD$1; - this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts); -} - -async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts) { - try { - const stats = await stat$1(path); - if (this.fsw.closed) return; - if (sameTypes(info, stats)) { - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } else { - this.handleEvent(EV_UNLINK$1, path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } catch (error) { - if (error.code === 'EACCES') { - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } else { - this.handleEvent(EV_UNLINK$1, path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } -} - -handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts) { - if (this.fsw.closed || this.checkIgnored(path)) return; - - if (event === EV_UNLINK$1) { - const isDirectory = info.type === FSEVENT_TYPE_DIRECTORY; - // suppress unlink events on never before seen files - if (isDirectory || watchedDir.has(item)) { - this.fsw._remove(parent, item, isDirectory); - } - } else { - if (event === EV_ADD$1) { - // track new directories - if (info.type === FSEVENT_TYPE_DIRECTORY) this.fsw._getWatchedDir(path); - - if (info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) { - // push symlinks back to the top of the stack to get handled - const curDepth = opts.depth === undefined ? - undefined : calcDepth(fullPath, realPath) + 1; - return this._addToFsEvents(path, false, true, curDepth); - } - - // track new paths - // (other than symlinks being followed, which will be tracked soon) - this.fsw._getWatchedDir(parent).add(item); - } - /** - * @type {'add'|'addDir'|'unlink'|'unlinkDir'} - */ - const eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event; - this.fsw._emit(eventName, path); - if (eventName === EV_ADD_DIR$1) this._addToFsEvents(path, false, true); - } -} - -/** - * Handle symlinks encountered during directory scan - * @param {String} watchPath - file/dir path to be watched with fsevents - * @param {String} realPath - real path (in case of symlinks) - * @param {Function} transform - path transformer - * @param {Function} globFilter - path filter in case a glob pattern was provided - * @returns {Function} closer for the watcher instance -*/ -_watchWithFsEvents(watchPath, realPath, transform, globFilter) { - if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return; - const opts = this.fsw.options; - const watchCallback = async (fullPath, flags, info) => { - if (this.fsw.closed) return; - if ( - opts.depth !== undefined && - calcDepth(fullPath, realPath) > opts.depth - ) return; - const path = transform(sysPath$1.join( - watchPath, sysPath$1.relative(watchPath, fullPath) - )); - if (globFilter && !globFilter(path)) return; - // ensure directories are tracked - const parent = sysPath$1.dirname(path); - const item = sysPath$1.basename(path); - const watchedDir = this.fsw._getWatchedDir( - info.type === FSEVENT_TYPE_DIRECTORY ? path : parent - ); - - // correct for wrong events emitted - if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) { - if (typeof opts.ignored === FUNCTION_TYPE$1) { - let stats; - try { - stats = await stat$1(path); - } catch (error) {} - if (this.fsw.closed) return; - if (this.checkIgnored(path, stats)) return; - if (sameTypes(info, stats)) { - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } else { - this.handleEvent(EV_UNLINK$1, path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } else { - this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } else { - switch (info.event) { - case FSEVENT_CREATED: - case FSEVENT_MODIFIED: - return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - case FSEVENT_DELETED: - case FSEVENT_MOVED: - return this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } - }; - - const closer = setFSEventsListener( - watchPath, - realPath, - watchCallback, - this.fsw._emitRaw - ); - - this.fsw._emitReady(); - return closer; -} - -/** - * Handle symlinks encountered during directory scan - * @param {String} linkPath path to symlink - * @param {String} fullPath absolute path to the symlink - * @param {Function} transform pre-existing path transformer - * @param {Number} curDepth level of subdirectories traversed to where symlink is - * @returns {Promise<void>} - */ -async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) { - // don't follow the same symlink more than once - if (this.fsw.closed || this.fsw._symlinkPaths.has(fullPath)) return; - - this.fsw._symlinkPaths.set(fullPath, true); - this.fsw._incrReadyCount(); - - try { - const linkTarget = await realpath(linkPath); - if (this.fsw.closed) return; - if (this.fsw._isIgnored(linkTarget)) { - return this.fsw._emitReady(); - } - - this.fsw._incrReadyCount(); - - // add the linkTarget for watching with a wrapper for transform - // that causes emitted paths to incorporate the link's path - this._addToFsEvents(linkTarget || linkPath, (path) => { - let aliasedPath = linkPath; - if (linkTarget && linkTarget !== DOT_SLASH) { - aliasedPath = path.replace(linkTarget, linkPath); - } else if (path !== DOT_SLASH) { - aliasedPath = sysPath$1.join(linkPath, path); - } - return transform(aliasedPath); - }, false, curDepth); - } catch(error) { - if (this.fsw._handleError(error)) { - return this.fsw._emitReady(); - } - } -} - -/** - * - * @param {Path} newPath - * @param {fs.Stats} stats - */ -emitAdd(newPath, stats, processPath, opts, forceAdd) { - const pp = processPath(newPath); - const isDir = stats.isDirectory(); - const dirObj = this.fsw._getWatchedDir(sysPath$1.dirname(pp)); - const base = sysPath$1.basename(pp); - - // ensure empty dirs get tracked - if (isDir) this.fsw._getWatchedDir(pp); - if (dirObj.has(base)) return; - dirObj.add(base); - - if (!opts.ignoreInitial || forceAdd === true) { - this.fsw._emit(isDir ? EV_ADD_DIR$1 : EV_ADD$1, pp, stats); - } -} - -initWatch(realPath, path, wh, processPath) { - if (this.fsw.closed) return; - const closer = this._watchWithFsEvents( - wh.watchPath, - sysPath$1.resolve(realPath || wh.watchPath), - processPath, - wh.globFilter - ); - this.fsw._addPathCloser(path, closer); -} - -/** - * Handle added path with fsevents - * @param {String} path file/dir path or glob pattern - * @param {Function|Boolean=} transform converts working path to what the user expects - * @param {Boolean=} forceAdd ensure add is emitted - * @param {Number=} priorDepth Level of subdirectories already traversed. - * @returns {Promise<void>} - */ -async _addToFsEvents(path, transform, forceAdd, priorDepth) { - if (this.fsw.closed) { - return; - } - const opts = this.fsw.options; - const processPath = typeof transform === FUNCTION_TYPE$1 ? transform : IDENTITY_FN; - - const wh = this.fsw._getWatchHelpers(path); - - // evaluate what is at the path we're being asked to watch - try { - const stats = await statMethods[wh.statMethod](wh.watchPath); - if (this.fsw.closed) return; - if (this.fsw._isIgnored(wh.watchPath, stats)) { - throw null; - } - if (stats.isDirectory()) { - // emit addDir unless this is a glob parent - if (!wh.globFilter) this.emitAdd(processPath(path), stats, processPath, opts, forceAdd); - - // don't recurse further if it would exceed depth setting - if (priorDepth && priorDepth > opts.depth) return; - - // scan the contents of the dir - this.fsw._readdirp(wh.watchPath, { - fileFilter: entry => wh.filterPath(entry), - directoryFilter: entry => wh.filterDir(entry), - ...Depth(opts.depth - (priorDepth || 0)) - }).on(STR_DATA, (entry) => { - // need to check filterPath on dirs b/c filterDir is less restrictive - if (this.fsw.closed) { - return; - } - if (entry.stats.isDirectory() && !wh.filterPath(entry)) return; - - const joinedPath = sysPath$1.join(wh.watchPath, entry.path); - const {fullPath} = entry; - - if (wh.followSymlinks && entry.stats.isSymbolicLink()) { - // preserve the current depth here since it can't be derived from - // real paths past the symlink - const curDepth = opts.depth === undefined ? - undefined : calcDepth(joinedPath, sysPath$1.resolve(wh.watchPath)) + 1; - - this._handleFsEventsSymlink(joinedPath, fullPath, processPath, curDepth); - } else { - this.emitAdd(joinedPath, entry.stats, processPath, opts, forceAdd); - } - }).on(EV_ERROR$1, EMPTY_FN$1).on(STR_END$1, () => { - this.fsw._emitReady(); - }); - } else { - this.emitAdd(wh.watchPath, stats, processPath, opts, forceAdd); - this.fsw._emitReady(); - } - } catch (error) { - if (!error || this.fsw._handleError(error)) { - // TODO: Strange thing: "should not choke on an ignored watch path" will be failed without 2 ready calls -__- - this.fsw._emitReady(); - this.fsw._emitReady(); - } - } - - if (opts.persistent && forceAdd !== true) { - if (typeof transform === FUNCTION_TYPE$1) { - // realpath has already been resolved - this.initWatch(undefined, path, wh, processPath); - } else { - let realPath; - try { - realPath = await realpath(wh.watchPath); - } catch (e) {} - this.initWatch(realPath, path, wh, processPath); - } - } -} - -} - -fseventsHandler.exports = FsEventsHandler$1; -fseventsHandler.exports.canUse = canUse; - -const { EventEmitter } = require$$0__default$4['default']; -const fs = require$$0__default$3['default']; -const sysPath = require$$0__default$2['default']; -const { promisify } = require$$0__default['default']; -const readdirp = readdirp_1; -const anymatch = anymatch$2.exports.default; -const globParent = globParent$1; -const isGlob = isGlob$2; -const braces = braces_1; -const normalizePath = normalizePath$2; - -const NodeFsHandler = nodefsHandler; -const FsEventsHandler = fseventsHandler.exports; -const { - EV_ALL, - EV_READY, - EV_ADD, - EV_CHANGE, - EV_UNLINK, - EV_ADD_DIR, - EV_UNLINK_DIR, - EV_RAW, - EV_ERROR, - - STR_CLOSE, - STR_END, - - BACK_SLASH_RE, - DOUBLE_SLASH_RE, - SLASH_OR_BACK_SLASH_RE, - DOT_RE, - REPLACER_RE, - - SLASH, - SLASH_SLASH, - BRACE_START, - BANG, - ONE_DOT, - TWO_DOTS, - GLOBSTAR, - SLASH_GLOBSTAR, - ANYMATCH_OPTS, - STRING_TYPE, - FUNCTION_TYPE, - EMPTY_STR, - EMPTY_FN, - - isWindows, - isMacos, - isIBMi -} = constants$1; - -const stat = promisify(fs.stat); -const readdir = promisify(fs.readdir); - -/** - * @typedef {String} Path - * @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName - * @typedef {'readdir'|'watch'|'add'|'remove'|'change'} ThrottleType - */ - -/** - * - * @typedef {Object} WatchHelpers - * @property {Boolean} followSymlinks - * @property {'stat'|'lstat'} statMethod - * @property {Path} path - * @property {Path} watchPath - * @property {Function} entryPath - * @property {Boolean} hasGlob - * @property {Object} globFilter - * @property {Function} filterPath - * @property {Function} filterDir - */ - -const arrify = (value = []) => Array.isArray(value) ? value : [value]; -const flatten$1 = (list, result = []) => { - list.forEach(item => { - if (Array.isArray(item)) { - flatten$1(item, result); - } else { - result.push(item); - } - }); - return result; -}; - -const unifyPaths = (paths_) => { - /** - * @type {Array<String>} - */ - const paths = flatten$1(arrify(paths_)); - if (!paths.every(p => typeof p === STRING_TYPE)) { - throw new TypeError(`Non-string provided as watch path: ${paths}`); - } - return paths.map(normalizePathToUnix); -}; - -// If SLASH_SLASH occurs at the beginning of path, it is not replaced -// because "//StoragePC/DrivePool/Movies" is a valid network path -const toUnix = (string) => { - let str = string.replace(BACK_SLASH_RE, SLASH); - let prepend = false; - if (str.startsWith(SLASH_SLASH)) { - prepend = true; - } - while (str.match(DOUBLE_SLASH_RE)) { - str = str.replace(DOUBLE_SLASH_RE, SLASH); - } - if (prepend) { - str = SLASH + str; - } - return str; -}; - -// Our version of upath.normalize -// TODO: this is not equal to path-normalize module - investigate why -const normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path))); - -const normalizeIgnored = (cwd = EMPTY_STR) => (path) => { - if (typeof path !== STRING_TYPE) return path; - return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path)); -}; - -const getAbsolutePath = (path, cwd) => { - if (sysPath.isAbsolute(path)) { - return path; - } - if (path.startsWith(BANG)) { - return BANG + sysPath.join(cwd, path.slice(1)); - } - return sysPath.join(cwd, path); -}; - -const undef = (opts, key) => opts[key] === undefined; - -/** - * Directory entry. - * @property {Path} path - * @property {Set<Path>} items - */ -class DirEntry { - /** - * @param {Path} dir - * @param {Function} removeWatcher - */ - constructor(dir, removeWatcher) { - this.path = dir; - this._removeWatcher = removeWatcher; - /** @type {Set<Path>} */ - this.items = new Set(); - } - - add(item) { - const {items} = this; - if (!items) return; - if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item); - } - - async remove(item) { - const {items} = this; - if (!items) return; - items.delete(item); - if (items.size > 0) return; - - const dir = this.path; - try { - await readdir(dir); - } catch (err) { - if (this._removeWatcher) { - this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir)); - } - } - } - - has(item) { - const {items} = this; - if (!items) return; - return items.has(item); - } - - /** - * @returns {Array<String>} - */ - getChildren() { - const {items} = this; - if (!items) return; - return [...items.values()]; - } - - dispose() { - this.items.clear(); - delete this.path; - delete this._removeWatcher; - delete this.items; - Object.freeze(this); - } -} - -const STAT_METHOD_F = 'stat'; -const STAT_METHOD_L = 'lstat'; -class WatchHelper { - constructor(path, watchPath, follow, fsw) { - this.fsw = fsw; - this.path = path = path.replace(REPLACER_RE, EMPTY_STR); - this.watchPath = watchPath; - this.fullWatchPath = sysPath.resolve(watchPath); - this.hasGlob = watchPath !== path; - /** @type {object|boolean} */ - if (path === EMPTY_STR) this.hasGlob = false; - this.globSymlink = this.hasGlob && follow ? undefined : false; - this.globFilter = this.hasGlob ? anymatch(path, undefined, ANYMATCH_OPTS) : false; - this.dirParts = this.getDirParts(path); - this.dirParts.forEach((parts) => { - if (parts.length > 1) parts.pop(); - }); - this.followSymlinks = follow; - this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L; - } - - checkGlobSymlink(entry) { - // only need to resolve once - // first entry should always have entry.parentDir === EMPTY_STR - if (this.globSymlink === undefined) { - this.globSymlink = entry.fullParentDir === this.fullWatchPath ? - false : {realPath: entry.fullParentDir, linkPath: this.fullWatchPath}; - } - - if (this.globSymlink) { - return entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath); - } - - return entry.fullPath; - } - - entryPath(entry) { - return sysPath.join(this.watchPath, - sysPath.relative(this.watchPath, this.checkGlobSymlink(entry)) - ); - } - - filterPath(entry) { - const {stats} = entry; - if (stats && stats.isSymbolicLink()) return this.filterDir(entry); - const resolvedPath = this.entryPath(entry); - const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ? - this.globFilter(resolvedPath) : true; - return matchesGlob && - this.fsw._isntIgnored(resolvedPath, stats) && - this.fsw._hasReadPermissions(stats); - } - - getDirParts(path) { - if (!this.hasGlob) return []; - const parts = []; - const expandedPath = path.includes(BRACE_START) ? braces.expand(path) : [path]; - expandedPath.forEach((path) => { - parts.push(sysPath.relative(this.watchPath, path).split(SLASH_OR_BACK_SLASH_RE)); - }); - return parts; - } - - filterDir(entry) { - if (this.hasGlob) { - const entryParts = this.getDirParts(this.checkGlobSymlink(entry)); - let globstar = false; - this.unmatchedGlob = !this.dirParts.some((parts) => { - return parts.every((part, i) => { - if (part === GLOBSTAR) globstar = true; - return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS); - }); - }); - } - return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats); - } -} - -/** - * Watches files & directories for changes. Emitted events: - * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error` - * - * new FSWatcher() - * .add(directories) - * .on('add', path => log('File', path, 'was added')) - */ -class FSWatcher extends EventEmitter { -// Not indenting methods for history sake; for now. -constructor(_opts) { - super(); - - const opts = {}; - if (_opts) Object.assign(opts, _opts); // for frozen objects - - /** @type {Map<String, DirEntry>} */ - this._watched = new Map(); - /** @type {Map<String, Array>} */ - this._closers = new Map(); - /** @type {Set<String>} */ - this._ignoredPaths = new Set(); - - /** @type {Map<ThrottleType, Map>} */ - this._throttled = new Map(); - - /** @type {Map<Path, String|Boolean>} */ - this._symlinkPaths = new Map(); - - this._streams = new Set(); - this.closed = false; - - // Set up default options. - if (undef(opts, 'persistent')) opts.persistent = true; - if (undef(opts, 'ignoreInitial')) opts.ignoreInitial = false; - if (undef(opts, 'ignorePermissionErrors')) opts.ignorePermissionErrors = false; - if (undef(opts, 'interval')) opts.interval = 100; - if (undef(opts, 'binaryInterval')) opts.binaryInterval = 300; - if (undef(opts, 'disableGlobbing')) opts.disableGlobbing = false; - opts.enableBinaryInterval = opts.binaryInterval !== opts.interval; - - // Enable fsevents on OS X when polling isn't explicitly enabled. - if (undef(opts, 'useFsEvents')) opts.useFsEvents = !opts.usePolling; - - // If we can't use fsevents, ensure the options reflect it's disabled. - const canUseFsEvents = FsEventsHandler.canUse(); - if (!canUseFsEvents) opts.useFsEvents = false; - - // Use polling on Mac if not using fsevents. - // Other platforms use non-polling fs_watch. - if (undef(opts, 'usePolling') && !opts.useFsEvents) { - opts.usePolling = isMacos; - } - - // Always default to polling on IBM i because fs.watch() is not available on IBM i. - if(isIBMi) { - opts.usePolling = true; - } - - // Global override (useful for end-developers that need to force polling for all - // instances of chokidar, regardless of usage/dependency depth) - const envPoll = process.env.CHOKIDAR_USEPOLLING; - if (envPoll !== undefined) { - const envLower = envPoll.toLowerCase(); - - if (envLower === 'false' || envLower === '0') { - opts.usePolling = false; - } else if (envLower === 'true' || envLower === '1') { - opts.usePolling = true; - } else { - opts.usePolling = !!envLower; - } - } - const envInterval = process.env.CHOKIDAR_INTERVAL; - if (envInterval) { - opts.interval = Number.parseInt(envInterval, 10); - } - - // Editor atomic write normalization enabled by default with fs.watch - if (undef(opts, 'atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents; - if (opts.atomic) this._pendingUnlinks = new Map(); - - if (undef(opts, 'followSymlinks')) opts.followSymlinks = true; - - if (undef(opts, 'awaitWriteFinish')) opts.awaitWriteFinish = false; - if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {}; - const awf = opts.awaitWriteFinish; - if (awf) { - if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000; - if (!awf.pollInterval) awf.pollInterval = 100; - this._pendingWrites = new Map(); - } - if (opts.ignored) opts.ignored = arrify(opts.ignored); - - let readyCalls = 0; - this._emitReady = () => { - readyCalls++; - if (readyCalls >= this._readyCount) { - this._emitReady = EMPTY_FN; - this._readyEmitted = true; - // use process.nextTick to allow time for listener to be bound - process.nextTick(() => this.emit(EV_READY)); - } - }; - this._emitRaw = (...args) => this.emit(EV_RAW, ...args); - this._readyEmitted = false; - this.options = opts; - - // Initialize with proper watcher. - if (opts.useFsEvents) { - this._fsEventsHandler = new FsEventsHandler(this); - } else { - this._nodeFsHandler = new NodeFsHandler(this); - } - - // You’re frozen when your heart’s not open. - Object.freeze(opts); -} - -// Public methods - -/** - * Adds paths to be watched on an existing FSWatcher instance - * @param {Path|Array<Path>} paths_ - * @param {String=} _origAdd private; for handling non-existent paths to be watched - * @param {Boolean=} _internal private; indicates a non-user add - * @returns {FSWatcher} for chaining - */ -add(paths_, _origAdd, _internal) { - const {cwd, disableGlobbing} = this.options; - this.closed = false; - let paths = unifyPaths(paths_); - if (cwd) { - paths = paths.map((path) => { - const absPath = getAbsolutePath(path, cwd); - - // Check `path` instead of `absPath` because the cwd portion can't be a glob - if (disableGlobbing || !isGlob(path)) { - return absPath; - } - return normalizePath(absPath); - }); - } - - // set aside negated glob strings - paths = paths.filter((path) => { - if (path.startsWith(BANG)) { - this._ignoredPaths.add(path.slice(1)); - return false; - } - - // if a path is being added that was previously ignored, stop ignoring it - this._ignoredPaths.delete(path); - this._ignoredPaths.delete(path + SLASH_GLOBSTAR); - - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = undefined; - - return true; - }); - - if (this.options.useFsEvents && this._fsEventsHandler) { - if (!this._readyCount) this._readyCount = paths.length; - if (this.options.persistent) this._readyCount *= 2; - paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path)); - } else { - if (!this._readyCount) this._readyCount = 0; - this._readyCount += paths.length; - Promise.all( - paths.map(async path => { - const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd); - if (res) this._emitReady(); - return res; - }) - ).then(results => { - if (this.closed) return; - results.filter(item => item).forEach(item => { - this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item)); - }); - }); - } - - return this; -} - -/** - * Close watchers or start ignoring events from specified paths. - * @param {Path|Array<Path>} paths_ - string or array of strings, file/directory paths and/or globs - * @returns {FSWatcher} for chaining -*/ -unwatch(paths_) { - if (this.closed) return this; - const paths = unifyPaths(paths_); - const {cwd} = this.options; - - paths.forEach((path) => { - // convert to absolute path unless relative path already matches - if (!sysPath.isAbsolute(path) && !this._closers.has(path)) { - if (cwd) path = sysPath.join(cwd, path); - path = sysPath.resolve(path); - } - - this._closePath(path); - - this._ignoredPaths.add(path); - if (this._watched.has(path)) { - this._ignoredPaths.add(path + SLASH_GLOBSTAR); - } - - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = undefined; - }); - - return this; -} - -/** - * Close watchers and remove all listeners from watched paths. - * @returns {Promise<void>}. -*/ -close() { - if (this.closed) return this._closePromise; - this.closed = true; - - // Memory management. - this.removeAllListeners(); - const closers = []; - this._closers.forEach(closerList => closerList.forEach(closer => { - const promise = closer(); - if (promise instanceof Promise) closers.push(promise); - })); - this._streams.forEach(stream => stream.destroy()); - this._userIgnored = undefined; - this._readyCount = 0; - this._readyEmitted = false; - this._watched.forEach(dirent => dirent.dispose()); - ['closers', 'watched', 'streams', 'symlinkPaths', 'throttled'].forEach(key => { - this[`_${key}`].clear(); - }); - - this._closePromise = closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve(); - return this._closePromise; -} - -/** - * Expose list of watched paths - * @returns {Object} for chaining -*/ -getWatched() { - const watchList = {}; - this._watched.forEach((entry, dir) => { - const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir; - watchList[key || ONE_DOT] = entry.getChildren().sort(); - }); - return watchList; -} - -emitWithAll(event, args) { - this.emit(...args); - if (event !== EV_ERROR) this.emit(EV_ALL, ...args); -} - -// Common helpers -// -------------- - -/** - * Normalize and emit events. - * Calling _emit DOES NOT MEAN emit() would be called! - * @param {EventName} event Type of event - * @param {Path} path File or directory path - * @param {*=} val1 arguments to be passed with event - * @param {*=} val2 - * @param {*=} val3 - * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag - */ -async _emit(event, path, val1, val2, val3) { - if (this.closed) return; - - const opts = this.options; - if (isWindows) path = sysPath.normalize(path); - if (opts.cwd) path = sysPath.relative(opts.cwd, path); - /** @type Array<any> */ - const args = [event, path]; - if (val3 !== undefined) args.push(val1, val2, val3); - else if (val2 !== undefined) args.push(val1, val2); - else if (val1 !== undefined) args.push(val1); - - const awf = opts.awaitWriteFinish; - let pw; - if (awf && (pw = this._pendingWrites.get(path))) { - pw.lastChange = new Date(); - return this; - } - - if (opts.atomic) { - if (event === EV_UNLINK) { - this._pendingUnlinks.set(path, args); - setTimeout(() => { - this._pendingUnlinks.forEach((entry, path) => { - this.emit(...entry); - this.emit(EV_ALL, ...entry); - this._pendingUnlinks.delete(path); - }); - }, typeof opts.atomic === 'number' ? opts.atomic : 100); - return this; - } - if (event === EV_ADD && this._pendingUnlinks.has(path)) { - event = args[0] = EV_CHANGE; - this._pendingUnlinks.delete(path); - } - } - - if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) { - const awfEmit = (err, stats) => { - if (err) { - event = args[0] = EV_ERROR; - args[1] = err; - this.emitWithAll(event, args); - } else if (stats) { - // if stats doesn't exist the file must have been deleted - if (args.length > 2) { - args[2] = stats; - } else { - args.push(stats); - } - this.emitWithAll(event, args); - } - }; - - this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit); - return this; - } - - if (event === EV_CHANGE) { - const isThrottled = !this._throttle(EV_CHANGE, path, 50); - if (isThrottled) return this; - } - - if (opts.alwaysStat && val1 === undefined && - (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE) - ) { - const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path; - let stats; - try { - stats = await stat(fullPath); - } catch (err) {} - // Suppress event when fs_stat fails, to avoid sending undefined 'stat' - if (!stats || this.closed) return; - args.push(stats); - } - this.emitWithAll(event, args); - - return this; -} - -/** - * Common handler for errors - * @param {Error} error - * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag - */ -_handleError(error) { - const code = error && error.code; - if (error && code !== 'ENOENT' && code !== 'ENOTDIR' && - (!this.options.ignorePermissionErrors || (code !== 'EPERM' && code !== 'EACCES')) - ) { - this.emit(EV_ERROR, error); - } - return error || this.closed; -} - -/** - * Helper utility for throttling - * @param {ThrottleType} actionType type being throttled - * @param {Path} path being acted upon - * @param {Number} timeout duration of time to suppress duplicate actions - * @returns {Object|false} tracking object or false if action should be suppressed - */ -_throttle(actionType, path, timeout) { - if (!this._throttled.has(actionType)) { - this._throttled.set(actionType, new Map()); - } - - /** @type {Map<Path, Object>} */ - const action = this._throttled.get(actionType); - /** @type {Object} */ - const actionPath = action.get(path); - - if (actionPath) { - actionPath.count++; - return false; - } - - let timeoutObject; - const clear = () => { - const item = action.get(path); - const count = item ? item.count : 0; - action.delete(path); - clearTimeout(timeoutObject); - if (item) clearTimeout(item.timeoutObject); - return count; - }; - timeoutObject = setTimeout(clear, timeout); - const thr = {timeoutObject, clear, count: 0}; - action.set(path, thr); - return thr; -} - -_incrReadyCount() { - return this._readyCount++; -} - -/** - * Awaits write operation to finish. - * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback. - * @param {Path} path being acted upon - * @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished - * @param {EventName} event - * @param {Function} awfEmit Callback to be called when ready for event to be emitted. - */ -_awaitWriteFinish(path, threshold, event, awfEmit) { - let timeoutHandler; - - let fullPath = path; - if (this.options.cwd && !sysPath.isAbsolute(path)) { - fullPath = sysPath.join(this.options.cwd, path); - } - - const now = new Date(); - - const awaitWriteFinish = (prevStat) => { - fs.stat(fullPath, (err, curStat) => { - if (err || !this._pendingWrites.has(path)) { - if (err && err.code !== 'ENOENT') awfEmit(err); - return; - } - - const now = Number(new Date()); - - if (prevStat && curStat.size !== prevStat.size) { - this._pendingWrites.get(path).lastChange = now; - } - const pw = this._pendingWrites.get(path); - const df = now - pw.lastChange; - - if (df >= threshold) { - this._pendingWrites.delete(path); - awfEmit(undefined, curStat); - } else { - timeoutHandler = setTimeout( - awaitWriteFinish, - this.options.awaitWriteFinish.pollInterval, - curStat - ); - } - }); - }; - - if (!this._pendingWrites.has(path)) { - this._pendingWrites.set(path, { - lastChange: now, - cancelWait: () => { - this._pendingWrites.delete(path); - clearTimeout(timeoutHandler); - return event; - } - }); - timeoutHandler = setTimeout( - awaitWriteFinish, - this.options.awaitWriteFinish.pollInterval - ); - } -} - -_getGlobIgnored() { - return [...this._ignoredPaths.values()]; -} - -/** - * Determines whether user has asked to ignore this path. - * @param {Path} path filepath or dir - * @param {fs.Stats=} stats result of fs.stat - * @returns {Boolean} - */ -_isIgnored(path, stats) { - if (this.options.atomic && DOT_RE.test(path)) return true; - if (!this._userIgnored) { - const {cwd} = this.options; - const ign = this.options.ignored; - - const ignored = ign && ign.map(normalizeIgnored(cwd)); - const paths = arrify(ignored) - .filter((path) => typeof path === STRING_TYPE && !isGlob(path)) - .map((path) => path + SLASH_GLOBSTAR); - const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths); - this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS); - } - - return this._userIgnored([path, stats]); -} - -_isntIgnored(path, stat) { - return !this._isIgnored(path, stat); -} - -/** - * Provides a set of common helpers and properties relating to symlink and glob handling. - * @param {Path} path file, directory, or glob pattern being watched - * @param {Number=} depth at any depth > 0, this isn't a glob - * @returns {WatchHelper} object containing helpers for this path - */ -_getWatchHelpers(path, depth) { - const watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path); - const follow = this.options.followSymlinks; - - return new WatchHelper(path, watchPath, follow, this); -} - -// Directory helpers -// ----------------- - -/** - * Provides directory tracking objects - * @param {String} directory path of the directory - * @returns {DirEntry} the directory's tracking object - */ -_getWatchedDir(directory) { - if (!this._boundRemove) this._boundRemove = this._remove.bind(this); - const dir = sysPath.resolve(directory); - if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove)); - return this._watched.get(dir); -} - -// File helpers -// ------------ - -/** - * Check for read permissions. - * Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405 - * @param {fs.Stats} stats - object, result of fs_stat - * @returns {Boolean} indicates whether the file can be read -*/ -_hasReadPermissions(stats) { - if (this.options.ignorePermissionErrors) return true; - - // stats.mode may be bigint - const md = stats && Number.parseInt(stats.mode, 10); - const st = md & 0o777; - const it = Number.parseInt(st.toString(8)[0], 10); - return Boolean(4 & it); -} - -/** - * Handles emitting unlink events for - * files and directories, and via recursion, for - * files and directories within directories that are unlinked - * @param {String} directory within which the following item is located - * @param {String} item base path of item/directory - * @returns {void} -*/ -_remove(directory, item, isDirectory) { - // if what is being deleted is a directory, get that directory's paths - // for recursive deleting and cleaning of watched object - // if it is not a directory, nestedDirectoryChildren will be empty array - const path = sysPath.join(directory, item); - const fullPath = sysPath.resolve(path); - isDirectory = isDirectory != null - ? isDirectory - : this._watched.has(path) || this._watched.has(fullPath); - - // prevent duplicate handling in case of arriving here nearly simultaneously - // via multiple paths (such as _handleFile and _handleDir) - if (!this._throttle('remove', path, 100)) return; - - // if the only watched file is removed, watch for its return - if (!isDirectory && !this.options.useFsEvents && this._watched.size === 1) { - this.add(directory, item, true); - } - - // This will create a new entry in the watched object in either case - // so we got to do the directory check beforehand - const wp = this._getWatchedDir(path); - const nestedDirectoryChildren = wp.getChildren(); - - // Recursively remove children directories / files. - nestedDirectoryChildren.forEach(nested => this._remove(path, nested)); - - // Check if item was on the watched list and remove it - const parent = this._getWatchedDir(directory); - const wasTracked = parent.has(item); - parent.remove(item); - - // Fixes issue #1042 -> Relative paths were detected and added as symlinks - // (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612), - // but never removed from the map in case the path was deleted. - // This leads to an incorrect state if the path was recreated: - // https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553 - if (this._symlinkPaths.has(fullPath)) { - this._symlinkPaths.delete(fullPath); - } - - // If we wait for this file to be fully written, cancel the wait. - let relPath = path; - if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path); - if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) { - const event = this._pendingWrites.get(relPath).cancelWait(); - if (event === EV_ADD) return; - } - - // The Entry will either be a directory that just got removed - // or a bogus entry to a file, in either case we have to remove it - this._watched.delete(path); - this._watched.delete(fullPath); - const eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK; - if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path); - - // Avoid conflicts if we later create another file with the same name - if (!this.options.useFsEvents) { - this._closePath(path); - } -} - -/** - * Closes all watchers for a path - * @param {Path} path - */ -_closePath(path) { - this._closeFile(path); - const dir = sysPath.dirname(path); - this._getWatchedDir(dir).remove(sysPath.basename(path)); -} - -/** - * Closes only file-specific watchers - * @param {Path} path - */ -_closeFile(path) { - const closers = this._closers.get(path); - if (!closers) return; - closers.forEach(closer => closer()); - this._closers.delete(path); -} - -/** - * - * @param {Path} path - * @param {Function} closer - */ -_addPathCloser(path, closer) { - if (!closer) return; - let list = this._closers.get(path); - if (!list) { - list = []; - this._closers.set(path, list); - } - list.push(closer); -} - -_readdirp(root, opts) { - if (this.closed) return; - const options = {type: EV_ALL, alwaysStat: true, lstat: true, ...opts}; - let stream = readdirp(root, options); - this._streams.add(stream); - stream.once(STR_CLOSE, () => { - stream = undefined; - }); - stream.once(STR_END, () => { - if (stream) { - this._streams.delete(stream); - stream = undefined; - } - }); - return stream; -} - -} - -// Export FSWatcher class -chokidar$1.FSWatcher = FSWatcher; - -/** - * Instantiates watcher with paths to be tracked. - * @param {String|Array<String>} paths file/directory paths and/or globs - * @param {Object=} options chokidar opts - * @returns an instance of FSWatcher for chaining. - */ -const watch = (paths, options) => { - const watcher = new FSWatcher(options); - watcher.add(paths); - return watcher; -}; - -chokidar$1.watch = watch; - var textTable = function (rows_, opts) { if (!opts) opts = {}; var hsep = opts.hsep === undefined ? ' ' : opts.hsep; @@ -25198,8 +30482,8 @@ var textTable = function (rows_, opts) { return acc; }, []); - var rows = map$6(rows_, function (row) { - return map$6(row, function (c_, ix) { + var rows = map$2(rows_, function (row) { + return map$2(row, function (c_, ix) { var c = String(c_); if (align[ix] === '.') { var index = dotindex(c); @@ -25220,8 +30504,8 @@ var textTable = function (rows_, opts) { return acc; }, []); - return map$6(rows, function (row) { - return map$6(row, function (c, ix) { + return map$2(rows, function (row) { + return map$2(row, function (c, ix) { var n = (sizes[ix] - stringLength(c)) || 0; var s = Array(Math.max(n + 1, 1)).join(' '); if (align[ix] === 'r' || align[ix] === '.') { @@ -25260,7 +30544,7 @@ function forEach (xs, f) { } } -function map$6 (xs, f) { +function map$2 (xs, f) { if (xs.map) return xs.map(f); var res = []; for (var i = 0; i < xs.length; i++) { @@ -25271,7 +30555,7 @@ function map$6 (xs, f) { var camelcase$1 = {exports: {}}; -const preserveCamelCase = string => { +const preserveCamelCase = (string, locale) => { let isLastCharLower = false; let isLastCharUpper = false; let isLastLastCharUpper = false; @@ -25279,37 +30563,46 @@ const preserveCamelCase = string => { for (let i = 0; i < string.length; i++) { const character = string[i]; - if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) { + if (isLastCharLower && /[\p{Lu}]/u.test(character)) { string = string.slice(0, i) + '-' + string.slice(i); isLastCharLower = false; isLastLastCharUpper = isLastCharUpper; isLastCharUpper = true; i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) { + } else if (isLastCharUpper && isLastLastCharUpper && /[\p{Ll}]/u.test(character)) { string = string.slice(0, i - 1) + '-' + string.slice(i - 1); isLastLastCharUpper = isLastCharUpper; isLastCharUpper = false; isLastCharLower = true; } else { - isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character; + isLastCharLower = character.toLocaleLowerCase(locale) === character && character.toLocaleUpperCase(locale) !== character; isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character; + isLastCharUpper = character.toLocaleUpperCase(locale) === character && character.toLocaleLowerCase(locale) !== character; } } return string; }; +const preserveConsecutiveUppercase = input => { + return input.replace(/^[\p{Lu}](?![\p{Lu}])/gu, m1 => m1.toLowerCase()); +}; + +const postProcess = (input, options) => { + return input.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toLocaleUpperCase(options.locale)) + .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toLocaleUpperCase(options.locale)); +}; + const camelCase = (input, options) => { if (!(typeof input === 'string' || Array.isArray(input))) { throw new TypeError('Expected the input to be `string | string[]`'); } - options = Object.assign({ - pascalCase: false - }, options); - - const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; + options = { + pascalCase: false, + preserveConsecutiveUppercase: false, + ...options + }; if (Array.isArray(input)) { input = input.map(x => x.trim()) @@ -25324,29 +30617,37 @@ const camelCase = (input, options) => { } if (input.length === 1) { - return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); + return options.pascalCase ? input.toLocaleUpperCase(options.locale) : input.toLocaleLowerCase(options.locale); } - const hasUpperCase = input !== input.toLowerCase(); + const hasUpperCase = input !== input.toLocaleLowerCase(options.locale); if (hasUpperCase) { - input = preserveCamelCase(input); + input = preserveCamelCase(input, options.locale); } - input = input - .replace(/^[_.\- ]+/, '') - .toLowerCase() - .replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase()) - .replace(/\d+(\w|$)/g, m => m.toUpperCase()); + input = input.replace(/^[_.\- ]+/, ''); + + if (options.preserveConsecutiveUppercase) { + input = preserveConsecutiveUppercase(input); + } else { + input = input.toLocaleLowerCase(); + } + + if (options.pascalCase) { + input = input.charAt(0).toLocaleUpperCase(options.locale) + input.slice(1); + } - return postProcess(input); + return postProcess(input, options); }; camelcase$1.exports = camelCase; // TODO: Remove this for the next major release camelcase$1.exports.default = camelCase; -var minimist$1 = function (args, opts) { +var camelcase = camelcase$1.exports; + +var minimist = function (args, opts) { if (!opts) opts = {}; var flags = { bools : {}, strings : {}, unknownFn: null }; @@ -25646,7 +30947,7 @@ let token; let key; let root$1; -var parse$4 = function parse (text, reviver) { +var parse$1 = function parse (text, reviver) { source = String(text); parseState = 'start'; stack = []; @@ -25692,14 +30993,14 @@ function internalize (holder, name, reviver) { } let lexState; -let buffer$2; +let buffer; let doubleQuote; let sign; let c; function lex () { lexState = 'default'; - buffer$2 = ''; + buffer = ''; doubleQuote = false; sign = 1; @@ -25880,12 +31181,12 @@ const lexStates = { return case '.': - buffer$2 = read(); + buffer = read(); lexState = 'decimalPointLeading'; return case '0': - buffer$2 = read(); + buffer = read(); lexState = 'zero'; return @@ -25898,7 +31199,7 @@ const lexStates = { case '7': case '8': case '9': - buffer$2 = read(); + buffer = read(); lexState = 'decimalInteger'; return @@ -25915,7 +31216,7 @@ const lexStates = { case '"': case "'": doubleQuote = (read() === '"'); - buffer$2 = ''; + buffer = ''; lexState = 'string'; return } @@ -25943,7 +31244,7 @@ const lexStates = { break } - buffer$2 += u; + buffer += u; lexState = 'identifierName'; }, @@ -25953,7 +31254,7 @@ const lexStates = { case '_': case '\u200C': case '\u200D': - buffer$2 += read(); + buffer += read(); return case '\\': @@ -25963,11 +31264,11 @@ const lexStates = { } if (util.isIdContinueChar(c)) { - buffer$2 += read(); + buffer += read(); return } - return newToken('identifier', buffer$2) + return newToken('identifier', buffer) }, identifierNameEscape () { @@ -25992,19 +31293,19 @@ const lexStates = { break } - buffer$2 += u; + buffer += u; lexState = 'identifierName'; }, sign () { switch (c) { case '.': - buffer$2 = read(); + buffer = read(); lexState = 'decimalPointLeading'; return case '0': - buffer$2 = read(); + buffer = read(); lexState = 'zero'; return @@ -26017,7 +31318,7 @@ const lexStates = { case '7': case '8': case '9': - buffer$2 = read(); + buffer = read(); lexState = 'decimalInteger'; return @@ -26038,19 +31339,19 @@ const lexStates = { zero () { switch (c) { case '.': - buffer$2 += read(); + buffer += read(); lexState = 'decimalPoint'; return case 'e': case 'E': - buffer$2 += read(); + buffer += read(); lexState = 'decimalExponent'; return case 'x': case 'X': - buffer$2 += read(); + buffer += read(); lexState = 'hexadecimal'; return } @@ -26061,28 +31362,28 @@ const lexStates = { decimalInteger () { switch (c) { case '.': - buffer$2 += read(); + buffer += read(); lexState = 'decimalPoint'; return case 'e': case 'E': - buffer$2 += read(); + buffer += read(); lexState = 'decimalExponent'; return } if (util.isDigit(c)) { - buffer$2 += read(); + buffer += read(); return } - return newToken('numeric', sign * Number(buffer$2)) + return newToken('numeric', sign * Number(buffer)) }, decimalPointLeading () { if (util.isDigit(c)) { - buffer$2 += read(); + buffer += read(); lexState = 'decimalFraction'; return } @@ -26094,48 +31395,48 @@ const lexStates = { switch (c) { case 'e': case 'E': - buffer$2 += read(); + buffer += read(); lexState = 'decimalExponent'; return } if (util.isDigit(c)) { - buffer$2 += read(); + buffer += read(); lexState = 'decimalFraction'; return } - return newToken('numeric', sign * Number(buffer$2)) + return newToken('numeric', sign * Number(buffer)) }, decimalFraction () { switch (c) { case 'e': case 'E': - buffer$2 += read(); + buffer += read(); lexState = 'decimalExponent'; return } if (util.isDigit(c)) { - buffer$2 += read(); + buffer += read(); return } - return newToken('numeric', sign * Number(buffer$2)) + return newToken('numeric', sign * Number(buffer)) }, decimalExponent () { switch (c) { case '+': case '-': - buffer$2 += read(); + buffer += read(); lexState = 'decimalExponentSign'; return } if (util.isDigit(c)) { - buffer$2 += read(); + buffer += read(); lexState = 'decimalExponentInteger'; return } @@ -26145,7 +31446,7 @@ const lexStates = { decimalExponentSign () { if (util.isDigit(c)) { - buffer$2 += read(); + buffer += read(); lexState = 'decimalExponentInteger'; return } @@ -26155,16 +31456,16 @@ const lexStates = { decimalExponentInteger () { if (util.isDigit(c)) { - buffer$2 += read(); + buffer += read(); return } - return newToken('numeric', sign * Number(buffer$2)) + return newToken('numeric', sign * Number(buffer)) }, hexadecimal () { if (util.isHexDigit(c)) { - buffer$2 += read(); + buffer += read(); lexState = 'hexadecimalInteger'; return } @@ -26174,36 +31475,36 @@ const lexStates = { hexadecimalInteger () { if (util.isHexDigit(c)) { - buffer$2 += read(); + buffer += read(); return } - return newToken('numeric', sign * Number(buffer$2)) + return newToken('numeric', sign * Number(buffer)) }, string () { switch (c) { case '\\': read(); - buffer$2 += escape(); + buffer += escape(); return case '"': if (doubleQuote) { read(); - return newToken('string', buffer$2) + return newToken('string', buffer) } - buffer$2 += read(); + buffer += read(); return case "'": if (!doubleQuote) { read(); - return newToken('string', buffer$2) + return newToken('string', buffer) } - buffer$2 += read(); + buffer += read(); return case '\n': @@ -26219,7 +31520,7 @@ const lexStates = { throw invalidChar(read()) } - buffer$2 += read(); + buffer += read(); }, start () { @@ -26240,7 +31541,7 @@ const lexStates = { switch (c) { case '$': case '_': - buffer$2 = read(); + buffer = read(); lexState = 'identifierName'; return @@ -26260,7 +31561,7 @@ const lexStates = { } if (util.isIdStartChar(c)) { - buffer$2 += read(); + buffer += read(); lexState = 'identifierName'; return } @@ -26457,7 +31758,7 @@ const parseStates = { throw invalidEOF() } - push(); + push$1(); }, beforePropertyName () { @@ -26503,7 +31804,7 @@ const parseStates = { throw invalidEOF() } - push(); + push$1(); }, beforeArrayValue () { @@ -26516,7 +31817,7 @@ const parseStates = { return } - push(); + push$1(); }, afterPropertyValue () { @@ -26573,7 +31874,7 @@ const parseStates = { }, }; -function push () { +function push$1 () { let value; switch (token.type) { @@ -26722,7 +32023,7 @@ function syntaxError (message) { return err } -var stringify$3 = function stringify (value, replacer, space) { +var stringify = function stringify (value, replacer, space) { const stack = []; let indent = ''; let propertyList; @@ -26983,221 +32284,258 @@ var stringify$3 = function stringify (value, replacer, space) { }; const JSON5 = { - parse: parse$4, - stringify: stringify$3, + parse: parse$1, + stringify, }; -var lib$3 = JSON5; +var lib = JSON5; -var dist$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - 'default': lib$3 -}); +/** + * @typedef Option + * @property {'boolean'|'string'} [type='string'] + * @property {string} long + * @property {string} description + * @property {string} [value] + * @property {string} [short] + * @property {boolean|string} [default=''] + * @property {boolean} [truelike=false] + */ -var require$$3$1 = /*@__PURE__*/getAugmentedNamespace(dist$1); - -var require$$5$1 = [ - { - long: "help", - description: "output usage information", - short: "h", - type: "boolean", - "default": false - }, - { - long: "version", - description: "output version number", - short: "v", - type: "boolean", - "default": false - }, - { - long: "output", - description: "specify output location", - short: "o", - value: "[path]" - }, - { - long: "rc-path", - description: "specify configuration file", - short: "r", - type: "string", - value: "<path>" - }, - { - long: "ignore-path", - description: "specify ignore file", - short: "i", - type: "string", - value: "<path>" - }, - { - long: "setting", - description: "specify settings", - short: "s", - type: "string", - value: "<settings>" - }, - { - long: "ext", - description: "specify extensions", - short: "e", - type: "string", - value: "<extensions>" - }, - { - long: "use", - description: "use plugins", - short: "u", - type: "string", - value: "<plugins>" - }, - { - long: "watch", - description: "watch for changes and reprocess", - short: "w", - type: "boolean", - "default": false - }, - { - long: "quiet", - description: "output only warnings and errors", - short: "q", - type: "boolean", - "default": false - }, - { - long: "silent", - description: "output only errors", - short: "S", - type: "boolean", - "default": false - }, - { - long: "frail", - description: "exit with 1 on warnings", - short: "f", - type: "boolean", - "default": false - }, - { - long: "tree", - description: "specify input and output as syntax tree", - short: "t", - type: "boolean", - "default": false - }, - { - long: "report", - description: "specify reporter", - type: "string", - value: "<reporter>" - }, - { - long: "file-path", - description: "specify path to process as", - type: "string", - value: "<path>" - }, - { - long: "ignore-path-resolve-from", - description: "resolve patterns in `ignore-path` from its directory or cwd", - type: "string", - value: "dir|cwd", - "default": "dir" - }, - { - long: "ignore-pattern", - description: "specify ignore patterns", - type: "string", - value: "<globs>" - }, - { - long: "silently-ignore", - description: "do not fail when given ignored files", - type: "boolean" - }, - { - long: "tree-in", - description: "specify input as syntax tree", - type: "boolean" - }, - { - long: "tree-out", - description: "output syntax tree", - type: "boolean" - }, - { - long: "inspect", - description: "output formatted syntax tree", - type: "boolean" - }, - { - long: "stdout", - description: "specify writing to stdout", - type: "boolean", - truelike: true - }, - { - long: "color", - description: "specify color in report", - type: "boolean", - "default": true - }, - { - long: "config", - description: "search for configuration files", - type: "boolean", - "default": true - }, - { - long: "ignore", - description: "search for ignore files", - type: "boolean", - "default": true - } +/** @type {Option[]} */ +const schema = [ + { + long: 'help', + description: 'output usage information', + short: 'h', + type: 'boolean', + default: false + }, + { + long: 'version', + description: 'output version number', + short: 'v', + type: 'boolean', + default: false + }, + { + long: 'output', + description: 'specify output location', + short: 'o', + value: '[path]' + }, + { + long: 'rc-path', + description: 'specify configuration file', + short: 'r', + type: 'string', + value: '<path>' + }, + { + long: 'ignore-path', + description: 'specify ignore file', + short: 'i', + type: 'string', + value: '<path>' + }, + { + long: 'setting', + description: 'specify settings', + short: 's', + type: 'string', + value: '<settings>' + }, + { + long: 'ext', + description: 'specify extensions', + short: 'e', + type: 'string', + value: '<extensions>' + }, + { + long: 'use', + description: 'use plugins', + short: 'u', + type: 'string', + value: '<plugins>' + }, + { + long: 'watch', + description: 'watch for changes and reprocess', + short: 'w', + type: 'boolean', + default: false + }, + { + long: 'quiet', + description: 'output only warnings and errors', + short: 'q', + type: 'boolean', + default: false + }, + { + long: 'silent', + description: 'output only errors', + short: 'S', + type: 'boolean', + default: false + }, + { + long: 'frail', + description: 'exit with 1 on warnings', + short: 'f', + type: 'boolean', + default: false + }, + { + long: 'tree', + description: 'specify input and output as syntax tree', + short: 't', + type: 'boolean', + default: false + }, + { + long: 'report', + description: 'specify reporter', + type: 'string', + value: '<reporter>' + }, + { + long: 'file-path', + description: 'specify path to process as', + type: 'string', + value: '<path>' + }, + { + long: 'ignore-path-resolve-from', + description: 'resolve patterns in `ignore-path` from its directory or cwd', + type: 'string', + value: 'dir|cwd', + default: 'dir' + }, + { + long: 'ignore-pattern', + description: 'specify ignore patterns', + type: 'string', + value: '<globs>' + }, + { + long: 'silently-ignore', + description: 'do not fail when given ignored files', + type: 'boolean' + }, + { + long: 'tree-in', + description: 'specify input as syntax tree', + type: 'boolean' + }, + { + long: 'tree-out', + description: 'output syntax tree', + type: 'boolean' + }, + { + long: 'inspect', + description: 'output formatted syntax tree', + type: 'boolean' + }, + { + long: 'stdout', + description: 'specify writing to stdout', + type: 'boolean', + truelike: true + }, + { + long: 'color', + description: 'specify color in report', + type: 'boolean', + default: true + }, + { + long: 'config', + description: 'search for configuration files', + type: 'boolean', + default: true + }, + { + long: 'ignore', + description: 'search for ignore files', + type: 'boolean', + default: true + } ]; -var table = textTable; -var camelcase = camelcase$1.exports; -var minimist = minimist$1; -var json5 = require$$3$1; -var fault = fault_1; -var schema$1 = require$$5$1; +/** + * @typedef {import('unified-engine').Options} EngineOptions + * @typedef {import('./schema.js').Option} Option + * + * @typedef {Required< + * Pick< + * EngineOptions, + * | 'extensions' + * | 'ignoreName' + * | 'packageField' + * | 'pluginPrefix' + * | 'processor' + * | 'rcName' + * > + * >} RequiredEngineOptions + * + * @typedef ArgsOptionsFields + * @property {string} name + * Name of executable + * @property {string} description + * Description of executable + * @property {string} version + * Version (semver) of executable + * + * @typedef {RequiredEngineOptions & Pick<EngineOptions, 'cwd'> & ArgsOptionsFields} Options + */ -var options_1 = options$1; +const own$7 = {}.hasOwnProperty; -// Schema for `minimist`. -var minischema = { +/** + * Schema for `minimist`. + */ +const minischema = { unknown: handleUnknownArgument, + /** @type {Record<string, string|boolean|null>} */ default: {}, + /** @type {Record<string, string>} */ alias: {}, + /** @type {string[]} */ string: [], + /** @type {string[]} */ boolean: [] }; -schema$1.forEach(addEach); +let index = -1; +while (++index < schema.length) { + addEach(schema[index]); +} -// Parse CLI options. -function options$1(flags, configuration) { - var extension = configuration.extensions[0]; - var name = configuration.name; - var config = toCamelCase(minimist(flags, minischema)); - var help; - var ext; - var report; +/** + * Parse CLI options. + * + * @param {string[]} flags + * @param {Options} configuration + */ +function options(flags, configuration) { + const extension = configuration.extensions[0]; + const name = configuration.name; + const config = toCamelCase(minimist(flags, minischema)); + let index = -1; - schema$1.forEach(function (option) { + while (++index < schema.length) { + const option = schema[index]; if (option.type === 'string' && config[option.long] === '') { throw fault('Missing value:%s', inspect(option).join(' ')) } - }); - - ext = commaSeparated(config.ext); - report = reporter(config.report); + } - help = [ - inspectAll(schema$1), + const ext = commaSeparated(/** @type {string} */ (config.ext)); + const report = reporter(/** @type {string} */ (config.report)); + const help = [ + inspectAll(schema), '', 'Examples:', '', @@ -27213,7 +32551,6 @@ function options$1(flags, configuration) { return { helpMessage: help, - // “hidden” feature, makes testing easier. cwd: configuration.cwd, processor: configuration.processor, help: config.help, @@ -27232,15 +32569,19 @@ function options$1(flags, configuration) { packageField: configuration.packageField, rcPath: config.rcPath, detectConfig: config.config, - settings: settings(config.setting), + settings: /** @type {Record<string, unknown>} */ ( + settings(/** @type {string} */ (config.setting)) + ), ignoreName: configuration.ignoreName, ignorePath: config.ignorePath, ignorePathResolveFrom: config.ignorePathResolveFrom, - ignorePatterns: commaSeparated(config.ignorePattern), + ignorePatterns: commaSeparated( + /** @type {string} */ (config.ignorePattern) + ), silentlyIgnore: config.silentlyIgnore, detectIgnore: config.ignore, pluginPrefix: configuration.pluginPrefix, - plugins: plugins(config.use), + plugins: plugins$2(/** @type {string} */ (config.use)), reporter: report[0], reporterOptions: report[1], color: config.color, @@ -27250,12 +32591,15 @@ function options$1(flags, configuration) { } } +/** + * @param {Option} option + */ function addEach(option) { - var value = option.default; + const value = option.default; minischema.default[option.long] = value === undefined ? null : value; - if (option.type in minischema) { + if (option.type && option.type in minischema) { minischema[option.type].push(option.long); } @@ -27264,116 +32608,165 @@ function addEach(option) { } } -// Parse `extensions`. +/** + * Parse `extensions`. + * + * @param {string[]|string|null|undefined} value + * @returns {string[]} + */ function commaSeparated(value) { - return flatten(normalize(value).map(splitList)) + return flatten(normalize(value).map((d) => splitList(d))) } -// Parse `plugins`. -function plugins(value) { - var result = {}; +/** + * Parse `plugins`. + * + * @param {string[]|string|null|undefined} value + * @returns {Record<string, Record<string, unknown>|undefined>} + */ +function plugins$2(value) { + const normalized = normalize(value).map((d) => splitOptions(d)); + let index = -1; + /** @type {Record<string, Record<string, unknown>|undefined>} */ + const result = {}; - normalize(value) - .map(splitOptions) - .forEach(function (value) { - result[value[0]] = value[1] ? parseConfig(value[1], {}) : null; - }); + while (++index < normalized.length) { + const value = normalized[index]; + result[value[0]] = value[1] ? parseConfig(value[1], {}) : undefined; + } return result } -// Parse `reporter`: only one is accepted. +/** + * Parse `reporter`: only one is accepted. + * + * @param {string[]|string|null|undefined} value + * @returns {[string|undefined, Record<string, unknown>|undefined]} + */ function reporter(value) { - var all = normalize(value) - .map(splitOptions) - .map(function (value) { - return [value[0], value[1] ? parseConfig(value[1], {}) : null] - }); + const all = normalize(value) + .map((d) => splitOptions(d)) + .map( + /** + * @returns {[string, Record<string, unknown>|undefined]} + */ + (value) => [value[0], value[1] ? parseConfig(value[1], {}) : undefined] + ); return all[all.length - 1] || [] } -// Parse `settings`. +/** + * Parse `settings`. + * + * @param {string[]|string|null|undefined} value + * @returns {Record<string, unknown>} + */ function settings(value) { - var cache = {}; + const normalized = normalize(value); + let index = -1; + /** @type {Record<string, unknown>} */ + const cache = {}; - normalize(value).forEach(function (value) { - parseConfig(value, cache); - }); + while (++index < normalized.length) { + parseConfig(normalized[index], cache); + } return cache } -// Parse configuration. -function parseConfig(flags, cache) { - var flag; - var message; +/** + * Parse configuration. + * + * @param {string} value + * @param {Record<string, unknown>} cache + * @returns {Record<string, unknown>} + */ +function parseConfig(value, cache) { + /** @type {Record<string, unknown>} */ + let flags; + /** @type {string} */ + let flag; try { - flags = toCamelCase(parseJSON(flags)); + flags = toCamelCase(parseJSON(value)); } catch (error) { - // Fix position - message = error.message.replace(/at(?= position)/, 'around'); - - throw fault('Cannot parse `%s` as JSON: %s', flags, message) + throw fault( + 'Cannot parse `%s` as JSON: %s', + value, + // Fix position + error.message.replace(/at(?= position)/, 'around') + ) } for (flag in flags) { - cache[flag] = flags[flag]; + if (own$7.call(flags, flag)) { + cache[flag] = flags[flag]; + } } return cache } -// Handle an unknown flag. +/** + * Handle an unknown flag. + * + * @param {string} flag + * @returns {boolean} + */ function handleUnknownArgument(flag) { - // Glob. - if (flag.charAt(0) !== '-') { - return - } - - // Long options, always unknown. - if (flag.charAt(1) === '-') { - throw fault('Unknown option `%s`, expected:\n%s', flag, inspectAll(schema$1)) - } - - // Short options, can be grouped. - flag.slice(1).split('').forEach(each); - - function each(key) { - var length = schema$1.length; - var index = -1; - var option; + // Not a glob. + if (flag.charAt(0) === '-') { + // Long options, always unknown. + if (flag.charAt(1) === '-') { + throw fault( + 'Unknown option `%s`, expected:\n%s', + flag, + inspectAll(schema) + ) + } - while (++index < length) { - option = schema$1[index]; + // Short options, can be grouped. + const found = flag.slice(1).split(''); + const known = schema.filter((d) => d.short); + const knownKeys = new Set(known.map((d) => d.short)); + let index = -1; - if (option.short === key) { - return + while (++index < found.length) { + const key = found[index]; + if (!knownKeys.has(key)) { + throw fault( + 'Unknown short option `-%s`, expected:\n%s', + key, + inspectAll(known) + ) } } - - throw fault( - 'Unknown short option `-%s`, expected:\n%s', - key, - inspectAll(schema$1.filter(short)) - ) } - function short(option) { - return option.short - } + return true } -// Inspect all `options`. +/** + * Inspect all `options`. + * + * @param {Option[]} options + * @returns {string} + */ function inspectAll(options) { - return table(options.map(inspect)) + return textTable(options.map((d) => inspect(d))) } -// Inspect one `option`. +/** + * Inspect one `option`. + * + * @param {Option} option + * @returns {string[]} + */ function inspect(option) { - var description = option.description; - var long = option.long; + let description = option.description; + let long = option.long; if (option.default === true || option.truelike) { description += ' (on by default)'; @@ -27388,7 +32781,12 @@ function inspect(option) { ] } -// Normalize `value`. +/** + * Normalize `value`. + * + * @param {string[]|string|null|undefined} value + * @returns {string[]} + */ function normalize(value) { if (!value) { return [] @@ -27398,82 +32796,114 @@ function normalize(value) { return [value] } - return flatten(value.map(normalize)) + return flatten(value.map((d) => normalize(d))) } -// Flatten `values`. +/** + * Flatten `values`. + * + * @param {string|string[]|string[][]} values + * @returns {string[]} + */ function flatten(values) { - return [].concat.apply([], values) + // @ts-expect-error: TS is wrong. + return values.flat() } +/** + * @param {string} value + * @returns {string[]} + */ function splitOptions(value) { return value.split('=') } +/** + * @param {string} value + * @returns {string[]} + */ function splitList(value) { return value.split(',') } -// Transform the keys on an object to camel-case, recursivly. +/** + * Transform the keys on an object to camel-case, recursivly. + * + * @param {Record<string, unknown>} object + * @returns {Record<string, unknown>} + */ function toCamelCase(object) { - var result = {}; - var value; - var key; + /** @type {Record<string, unknown>} */ + const result = {}; + /** @type {string} */ + let key; for (key in object) { - value = object[key]; + if (own$7.call(object, key)) { + let value = object[key]; - if (value && typeof value === 'object' && !('length' in value)) { - value = toCamelCase(value); - } + if (value && typeof value === 'object' && !Array.isArray(value)) { + // @ts-expect-error: looks like an object. + value = toCamelCase(value); + } - result[camelcase(key)] = value; + result[camelcase(key)] = value; + } } return result } -// Parse a (lazy?) JSON config. +/** + * Parse a (lazy?) JSON config. + * + * @param {string} value + * @returns {Record<string, unknown>} + */ function parseJSON(value) { - return json5.parse('{' + value + '}') + return lib.parse('{' + value + '}') } -var stream = require$$0__default$5['default']; -var engine = lib$4; -var chalk = source$1; -var chokidar = chokidar$1; -var options = options_1; - -var lib$2 = start$3; - -var noop$2 = Function.prototype; +/** + * @typedef {import('unified-engine').Options} EngineOptions + * @typedef {import('unified-engine').Context} EngineContext + * @typedef {import('unified-engine').Callback} EngineCallback + * @typedef {import('./options.js').Options} Options + */ // Fake TTY stream. -var ttyStream = new stream.Readable(); -ttyStream.isTTY = true; +const ttyStream = Object.assign(new stream.Readable(), {isTTY: true}); // Exit, lazily, with the correct exit status code. -var exitStatus = 0; +let exitStatus = 0; -process.on('exit', onexit); +process$2.on('exit', onexit); // Handle uncaught errors, such as from unexpected async behaviour. -process.on('uncaughtException', fail$1); +process$2.on('uncaughtException', fail); -// Start the CLI. -function start$3(cliConfig) { - var config; - var output; - var watcher; +/** + * Start the CLI. + * + * @param {Options} cliConfig + */ +function args(cliConfig) { + /** @type {EngineOptions & {help: boolean, helpMessage: string, watch: boolean, version: boolean}} */ + let config; + /** @type {chokidar.FSWatcher|undefined} */ + let watcher; + /** @type {boolean|string|undefined} */ + let output; try { - config = options(process.argv.slice(2), cliConfig); + // @ts-expect-error: Close enough. + config = options(process$2.argv.slice(2), cliConfig); } catch (error) { - return fail$1(error, true) + return fail(error, true) } if (config.help) { - process.stdout.write( + process$2.stdout.write( [ 'Usage: ' + cliConfig.name + ' [options] [path | glob ...]', '', @@ -27484,14 +32914,14 @@ function start$3(cliConfig) { config.helpMessage, '' ].join('\n'), - noop$2 + noop$1 ); return } if (config.version) { - process.stdout.write(cliConfig.version + '\n', noop$2); + process$2.stdout.write(cliConfig.version + '\n', noop$1); return } @@ -27506,18 +32936,18 @@ function start$3(cliConfig) { // Do not write to stdout(4). config.out = false; - process.stderr.write( - chalk.bold('Watching...') + ' (press CTRL+C to exit)\n', - noop$2 + process$2.stderr.write( + source$1.bold('Watching...') + ' (press CTRL+C to exit)\n', + noop$1 ); // Prevent infinite loop if set to regeneration. if (output === true) { config.output = false; - process.stderr.write( - chalk.yellow('Note') + ': Ignoring `--output` until exit.\n', - noop$2 + process$2.stderr.write( + source$1.yellow('Note') + ': Ignoring `--output` until exit.\n', + noop$1 ); } } @@ -27525,15 +32955,19 @@ function start$3(cliConfig) { // Initial run. engine(config, done); - // Handle complete run. - function done(err, code, context) { - if (err) { + /** + * Handle complete run. + * + * @type {EngineCallback} + */ + function done(error, code, context) { + if (error) { clean(); - fail$1(err); + fail(error); } else { - exitStatus = code; + exitStatus = code || 0; - if (config.watch && !watcher) { + if (config.watch && !watcher && context) { subscribe(context); } } @@ -27543,28 +32977,33 @@ function start$3(cliConfig) { function clean() { if (watcher) { watcher.close(); - watcher = null; + watcher = undefined; } } - // Subscribe a chokidar watcher to all processed files. + /** + * Subscribe a chokidar watcher to all processed files. + * + * @param {EngineContext} context + */ function subscribe(context) { watcher = chokidar + // @ts-expect-error: `fileSet` is available. .watch(context.fileSet.origins, {cwd: config.cwd, ignoreInitial: true}) .on('error', done) - .on('change', onchange); - - process.on('SIGINT', onsigint); - - function onchange(filePath) { - config.files = [filePath]; + .on('change', (filePath) => { + config.files = [filePath]; + engine(config, done); + }); - engine(config, done); - } + process$2.on('SIGINT', onsigint); + /** + * Handle a SIGINT. + */ function onsigint() { // Hide the `^C` in terminal. - process.stderr.write('\n', noop$2); + process$2.stderr.write('\n', noop$1); clean(); @@ -27578,26 +33017,31 @@ function start$3(cliConfig) { } } -// Print an error, optionally with stack. -function fail$1(err, pretty) { - var message = - (pretty ? String(err).trim() : err.stack) || - /* istanbul ignore next - Old versions of Node */ err; +/** + * Print an error, optionally with stack. + * + * @param {Error} error + * @param {boolean} [pretty=false] + */ +function fail(error, pretty) { + // Old versions of Node + /* c8 ignore next 1 */ + const message = String((pretty ? error : error.stack) || error); exitStatus = 1; - process.stderr.write(message.trim() + '\n', noop$2); + process$2.stderr.write(message.trim() + '\n', noop$1); } function onexit() { /* eslint-disable unicorn/no-process-exit */ - process.exit(exitStatus); + process$2.exit(exitStatus); /* eslint-enable unicorn/no-process-exit */ } -var unifiedArgs = lib$2; +function noop$1() {} -var require$$0$3 = [ +var require$$0 = [ "md", "markdown", "mdown", @@ -27608,13 +33052,16 @@ var require$$0$3 = [ "ron" ]; -var markdownExtensions = require$$0$3; - -var bail_1 = bail$1; +var markdownExtensions = require$$0; -function bail$1(err) { - if (err) { - throw err +/** + * Throw a given error. + * + * @param {Error | null | undefined} [error] + */ +function bail(error) { + if (error) { + throw error } } @@ -27680,7 +33127,7 @@ var getProperty = function getProperty(obj, name) { return obj[name]; }; -var extend$2 = function extend() { +var extend = function extend() { var options, name, src, copy, copyIsArray, clone; var target = arguments[0]; var i = 1; @@ -27734,396 +33181,66 @@ var extend$2 = function extend() { return target; }; -var stringify$2 = unistUtilStringifyPosition; - -var vfileMessage = VMessage$1; - -// Inherit from `Error#`. -function VMessagePrototype() {} -VMessagePrototype.prototype = Error.prototype; -VMessage$1.prototype = new VMessagePrototype(); - -// Message properties. -var proto = VMessage$1.prototype; - -proto.file = ''; -proto.name = ''; -proto.reason = ''; -proto.message = ''; -proto.stack = ''; -proto.fatal = null; -proto.column = null; -proto.line = null; - -// Construct a new VMessage. -// -// Note: We cannot invoke `Error` on the created context, as that adds readonly -// `line` and `column` attributes on Safari 9, thus throwing and failing the -// data. -function VMessage$1(reason, position, origin) { - var parts; - var range; - var location; - - if (typeof position === 'string') { - origin = position; - position = null; - } - - parts = parseOrigin(origin); - range = stringify$2(position) || '1:1'; - - location = { - start: {line: null, column: null}, - end: {line: null, column: null} - }; - - // Node. - if (position && position.position) { - position = position.position; - } - - if (position) { - // Position. - if (position.start) { - location = position; - position = position.start; - } else { - // Point. - location.start = position; - } - } - - if (reason.stack) { - this.stack = reason.stack; - reason = reason.message; - } - - this.message = reason; - this.name = range; - this.reason = reason; - this.line = position ? position.line : null; - this.column = position ? position.column : null; - this.location = location; - this.source = parts[0]; - this.ruleId = parts[1]; -} - -function parseOrigin(origin) { - var result = [null, null]; - var index; - - if (typeof origin === 'string') { - index = origin.indexOf(':'); - - if (index === -1) { - result[1] = origin; - } else { - result[0] = origin.slice(0, index); - result[1] = origin.slice(index + 1); - } - } - - return result -} - -var minpath = require$$0__default$2['default']; - -var minproc = process; - -var p = minpath; -var proc$1 = minproc; -var buffer$1 = isBuffer; - -var core$1 = VFile$1; - -var own$c = {}.hasOwnProperty; - -// Order of setting (least specific to most), we need this because otherwise -// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a -// stem can be set. -var order$3 = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']; - -VFile$1.prototype.toString = toString$6; - -// Access full path (`~/index.min.js`). -Object.defineProperty(VFile$1.prototype, 'path', {get: getPath, set: setPath}); - -// Access parent path (`~`). -Object.defineProperty(VFile$1.prototype, 'dirname', { - get: getDirname, - set: setDirname -}); - -// Access basename (`index.min.js`). -Object.defineProperty(VFile$1.prototype, 'basename', { - get: getBasename, - set: setBasename -}); - -// Access extname (`.js`). -Object.defineProperty(VFile$1.prototype, 'extname', { - get: getExtname, - set: setExtname -}); - -// Access stem (`index.min`). -Object.defineProperty(VFile$1.prototype, 'stem', {get: getStem, set: setStem}); - -// Construct a new file. -function VFile$1(options) { - var prop; - var index; - - if (!options) { - options = {}; - } else if (typeof options === 'string' || buffer$1(options)) { - options = {contents: options}; - } else if ('message' in options && 'messages' in options) { - return options - } - - if (!(this instanceof VFile$1)) { - return new VFile$1(options) - } - - this.data = {}; - this.messages = []; - this.history = []; - this.cwd = proc$1.cwd(); - - // Set path related properties in the correct order. - index = -1; - - while (++index < order$3.length) { - prop = order$3[index]; - - if (own$c.call(options, prop)) { - this[prop] = options[prop]; - } - } - - // Set non-path related properties. - for (prop in options) { - if (order$3.indexOf(prop) < 0) { - this[prop] = options[prop]; - } - } -} - -function getPath() { - return this.history[this.history.length - 1] -} - -function setPath(path) { - assertNonEmpty(path, 'path'); - - if (this.path !== path) { - this.history.push(path); - } -} - -function getDirname() { - return typeof this.path === 'string' ? p.dirname(this.path) : undefined -} - -function setDirname(dirname) { - assertPath(this.path, 'dirname'); - this.path = p.join(dirname || '', this.basename); -} - -function getBasename() { - return typeof this.path === 'string' ? p.basename(this.path) : undefined -} - -function setBasename(basename) { - assertNonEmpty(basename, 'basename'); - assertPart(basename, 'basename'); - this.path = p.join(this.dirname || '', basename); -} - -function getExtname() { - return typeof this.path === 'string' ? p.extname(this.path) : undefined -} - -function setExtname(extname) { - assertPart(extname, 'extname'); - assertPath(this.path, 'extname'); - - if (extname) { - if (extname.charCodeAt(0) !== 46 /* `.` */) { - throw new Error('`extname` must start with `.`') - } - - if (extname.indexOf('.', 1) > -1) { - throw new Error('`extname` cannot contain multiple dots') - } - } - - this.path = p.join(this.dirname, this.stem + (extname || '')); -} - -function getStem() { - return typeof this.path === 'string' - ? p.basename(this.path, this.extname) - : undefined -} - -function setStem(stem) { - assertNonEmpty(stem, 'stem'); - assertPart(stem, 'stem'); - this.path = p.join(this.dirname || '', stem + (this.extname || '')); -} - -// Get the value of the file. -function toString$6(encoding) { - return (this.contents || '').toString(encoding) -} - -// Assert that `part` is not a path (i.e., does not contain `p.sep`). -function assertPart(part, name) { - if (part && part.indexOf(p.sep) > -1) { - throw new Error( - '`' + name + '` cannot be a path: did not expect `' + p.sep + '`' - ) - } -} - -// Assert that `part` is not empty. -function assertNonEmpty(part, name) { - if (!part) { - throw new Error('`' + name + '` cannot be empty') - } -} - -// Assert `path` exists. -function assertPath(path, name) { - if (!path) { - throw new Error('Setting `' + name + '` requires `path` to be set too') - } -} - -var VMessage = vfileMessage; -var VFile = core$1; - -var lib$1 = VFile; - -VFile.prototype.message = message; -VFile.prototype.info = info; -VFile.prototype.fail = fail; - -// Create a message with `reason` at `position`. -// When an error is passed in as `reason`, copies the stack. -function message(reason, position, origin) { - var message = new VMessage(reason, position, origin); - - if (this.path) { - message.name = this.path + ':' + message.name; - message.file = this.path; - } - - message.fatal = false; - - this.messages.push(message); - - return message -} - -// Fail: creates a vmessage, associates it with the file, and throws it. -function fail() { - var message = this.message.apply(this, arguments); - - message.fatal = true; - - throw message -} - -// Info: creates a vmessage, associates it with the file, and marks the fatality -// as null. -function info() { - var message = this.message.apply(this, arguments); - - message.fatal = null; - - return message -} - -var vfile$1 = lib$1; - -var bail = bail_1; -var buffer = isBuffer; -var extend$1 = extend$2; -var plain = isPlainObj; -var trough = trough_1; -var vfile = vfile$1; +/** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFileCompatible} VFileCompatible + * @typedef {import('vfile').VFileValue} VFileValue + * @typedef {import('..').Processor} Processor + * @typedef {import('..').Plugin} Plugin + * @typedef {import('..').Preset} Preset + * @typedef {import('..').Pluggable} Pluggable + * @typedef {import('..').PluggableList} PluggableList + * @typedef {import('..').Transformer} Transformer + * @typedef {import('..').Parser} Parser + * @typedef {import('..').Compiler} Compiler + * @typedef {import('..').RunCallback} RunCallback + * @typedef {import('..').ProcessCallback} ProcessCallback + * + * @typedef Context + * @property {Node} tree + * @property {VFile} file + */ // Expose a frozen processor. -var unified_1 = unified$1().freeze(); - -var slice$1 = [].slice; -var own$b = {}.hasOwnProperty; - -// Process pipeline. -var pipeline = trough() - .use(pipelineParse) - .use(pipelineRun) - .use(pipelineStringify); +const unified = base().freeze(); -function pipelineParse(p, ctx) { - ctx.tree = p.parse(ctx.file); -} - -function pipelineRun(p, ctx, next) { - p.run(ctx.tree, ctx.file, done); - - function done(error, tree, file) { - if (error) { - next(error); - } else { - ctx.tree = tree; - ctx.file = file; - next(); - } - } -} - -function pipelineStringify(p, ctx) { - var result = p.stringify(ctx.tree, ctx.file); - - if (result === undefined || result === null) ; else if (typeof result === 'string' || buffer(result)) { - if ('value' in ctx.file) { - ctx.file.value = result; - } - - ctx.file.contents = result; - } else { - ctx.file.result = result; - } -} +const own$6 = {}.hasOwnProperty; // Function to create the first processor. -function unified$1() { - var attachers = []; - var transformers = trough(); - var namespace = {}; - var freezeIndex = -1; - var frozen; +/** + * @returns {Processor} + */ +function base() { + const transformers = trough(); + /** @type {Processor['attachers']} */ + const attachers = []; + /** @type {Record<string, unknown>} */ + let namespace = {}; + /** @type {boolean|undefined} */ + let frozen; + let freezeIndex = -1; // Data management. + // @ts-expect-error: overloads are handled. processor.data = data; + processor.Parser = undefined; + processor.Compiler = undefined; // Lock. processor.freeze = freeze; // Plugins. processor.attachers = attachers; + // @ts-expect-error: overloads are handled. processor.use = use; // API. processor.parse = parse; processor.stringify = stringify; + // @ts-expect-error: overloads are handled. processor.run = run; processor.runSync = runSync; + // @ts-expect-error: overloads are handled. processor.process = process; processor.processSync = processSync; @@ -28131,60 +33248,25 @@ function unified$1() { return processor // Create a new processor based on the processor in the current scope. + /** @type {Processor} */ function processor() { - var destination = unified$1(); - var index = -1; + const destination = base(); + let index = -1; while (++index < attachers.length) { - destination.use.apply(null, attachers[index]); + destination.use(...attachers[index]); } - destination.data(extend$1(true, {}, namespace)); + destination.data(extend(true, {}, namespace)); return destination } - // Freeze: used to signal a processor that has finished configuration. - // - // For example, take unified itself: it’s frozen. - // Plugins should not be added to it. - // Rather, it should be extended, by invoking it, before modifying it. - // - // In essence, always invoke this when exporting a processor. - function freeze() { - var values; - var transformer; - - if (frozen) { - return processor - } - - while (++freezeIndex < attachers.length) { - values = attachers[freezeIndex]; - - if (values[1] === false) { - continue - } - - if (values[1] === true) { - values[1] = undefined; - } - - transformer = values[0].apply(processor, values.slice(1)); - - if (typeof transformer === 'function') { - transformers.use(transformer); - } - } - - frozen = true; - freezeIndex = Infinity; - - return processor - } - - // Data management. - // Getter / setter for processor-specific informtion. + /** + * @param {string|Record<string, unknown>} [key] + * @param {unknown} [value] + * @returns {unknown} + */ function data(key, value) { if (typeof key === 'string') { // Set `key`. @@ -28195,7 +33277,7 @@ function unified$1() { } // Get `key`. - return (own$b.call(namespace, key) && namespace[key]) || null + return (own$6.call(namespace, key) && namespace[key]) || null } // Set space. @@ -28209,132 +33291,213 @@ function unified$1() { return namespace } - // Plugin management. - // - // Pass it: - // * an attacher and options, - // * a preset, - // * a list of presets, attachers, and arguments (list of attachers and - // options). - function use(value) { - var settings; + /** @type {Processor['freeze']} */ + function freeze() { + if (frozen) { + return processor + } + + while (++freezeIndex < attachers.length) { + const [attacher, ...options] = attachers[freezeIndex]; + + if (options[0] === false) { + continue + } + + if (options[0] === true) { + options[1] = undefined; + } + + /** @type {Transformer|void} */ + const transformer = attacher.call(processor, ...options); + + if (typeof transformer === 'function') { + transformers.use(transformer); + } + } + + frozen = true; + freezeIndex = Number.POSITIVE_INFINITY; + + return processor + } + + /** + * @param {Pluggable|null|undefined} [value] + * @param {...unknown} options + * @returns {Processor} + */ + function use(value, ...options) { + /** @type {Record<string, unknown>|undefined} */ + let settings; assertUnfrozen('use', frozen); if (value === null || value === undefined) ; else if (typeof value === 'function') { - addPlugin.apply(null, arguments); + addPlugin(value, ...options); } else if (typeof value === 'object') { - if ('length' in value) { + if (Array.isArray(value)) { addList(value); } else { addPreset(value); } } else { - throw new Error('Expected usable value, not `' + value + '`') + throw new TypeError('Expected usable value, not `' + value + '`') } if (settings) { - namespace.settings = extend$1(namespace.settings || {}, settings); + namespace.settings = Object.assign(namespace.settings || {}, settings); } return processor - function addPreset(result) { - addList(result.plugins); - - if (result.settings) { - settings = extend$1(settings || {}, result.settings); - } - } - + /** + * @param {import('..').Pluggable<unknown[]>} value + * @returns {void} + */ function add(value) { if (typeof value === 'function') { addPlugin(value); } else if (typeof value === 'object') { - if ('length' in value) { - addPlugin.apply(null, value); + if (Array.isArray(value)) { + const [plugin, ...options] = value; + addPlugin(plugin, ...options); } else { addPreset(value); } } else { - throw new Error('Expected usable value, not `' + value + '`') + throw new TypeError('Expected usable value, not `' + value + '`') } } + /** + * @param {Preset} result + * @returns {void} + */ + function addPreset(result) { + addList(result.plugins); + + if (result.settings) { + settings = Object.assign(settings || {}, result.settings); + } + } + + /** + * @param {PluggableList|null|undefined} [plugins] + * @returns {void} + */ function addList(plugins) { - var index = -1; + let index = -1; - if (plugins === null || plugins === undefined) ; else if (typeof plugins === 'object' && 'length' in plugins) { + if (plugins === null || plugins === undefined) ; else if (Array.isArray(plugins)) { while (++index < plugins.length) { - add(plugins[index]); + const thing = plugins[index]; + add(thing); } } else { - throw new Error('Expected a list of plugins, not `' + plugins + '`') + throw new TypeError('Expected a list of plugins, not `' + plugins + '`') } } + /** + * @param {Plugin} plugin + * @param {...unknown} [value] + * @returns {void} + */ function addPlugin(plugin, value) { - var entry = find(plugin); + let index = -1; + /** @type {Processor['attachers'][number]|undefined} */ + let entry; + + while (++index < attachers.length) { + if (attachers[index][0] === plugin) { + entry = attachers[index]; + break + } + } if (entry) { - if (plain(entry[1]) && plain(value)) { - value = extend$1(true, entry[1], value); + if (isPlainObject$1(entry[1]) && isPlainObject$1(value)) { + value = extend(true, entry[1], value); } entry[1] = value; } else { - attachers.push(slice$1.call(arguments)); - } - } - } - - function find(plugin) { - var index = -1; - - while (++index < attachers.length) { - if (attachers[index][0] === plugin) { - return attachers[index] + // @ts-expect-error: fine. + attachers.push([...arguments]); } } } - // Parse a file (in string or vfile representation) into a unist node using - // the `Parser` on the processor. + /** @type {Processor['parse']} */ function parse(doc) { - var file = vfile(doc); - var Parser; - - freeze(); - Parser = processor.Parser; + processor.freeze(); + const file = vfile(doc); + const Parser = processor.Parser; assertParser('parse', Parser); if (newable(Parser, 'parse')) { + // @ts-expect-error: `newable` checks this. return new Parser(String(file), file).parse() } + // @ts-expect-error: `newable` checks this. return Parser(String(file), file) // eslint-disable-line new-cap } - // Run transforms on a unist node representation of a file (in string or - // vfile representation), async. - function run(node, file, cb) { + /** @type {Processor['stringify']} */ + function stringify(node, doc) { + processor.freeze(); + const file = vfile(doc); + const Compiler = processor.Compiler; + assertCompiler('stringify', Compiler); + assertNode(node); + + if (newable(Compiler, 'compile')) { + // @ts-expect-error: `newable` checks this. + return new Compiler(node, file).compile() + } + + // @ts-expect-error: `newable` checks this. + return Compiler(node, file) // eslint-disable-line new-cap + } + + /** + * @param {Node} node + * @param {VFileCompatible|RunCallback} [doc] + * @param {RunCallback} [callback] + * @returns {Promise<Node>|void} + */ + function run(node, doc, callback) { assertNode(node); - freeze(); + processor.freeze(); - if (!cb && typeof file === 'function') { - cb = file; - file = null; + if (!callback && typeof doc === 'function') { + callback = doc; + doc = undefined; } - if (!cb) { + if (!callback) { return new Promise(executor) } - executor(null, cb); + executor(null, callback); + /** + * @param {null|((node: Node) => void)} resolve + * @param {(error: Error) => void} reject + * @returns {void} + */ function executor(resolve, reject) { - transformers.run(node, vfile(file), done); + // @ts-expect-error: `doc` can’t be a callback anymore, we checked. + transformers.run(node, vfile(doc), done); + /** + * @param {Error|null} error + * @param {Node} tree + * @param {VFile} file + * @returns {void} + */ function done(error, tree, file) { tree = tree || node; if (error) { @@ -28342,97 +33505,119 @@ function unified$1() { } else if (resolve) { resolve(tree); } else { - cb(null, tree, file); + // @ts-expect-error: `callback` is defined if `resolve` is not. + callback(null, tree, file); } } } } - // Run transforms on a unist node representation of a file (in string or - // vfile representation), sync. + /** @type {Processor['runSync']} */ function runSync(node, file) { - var result; - var complete; + /** @type {Node|undefined} */ + let result; + /** @type {boolean|undefined} */ + let complete; - run(node, file, done); + processor.run(node, file, done); assertDone('runSync', 'run', complete); + // @ts-expect-error: we either bailed on an error or have a tree. return result + /** + * @param {Error|null} [error] + * @param {Node} [tree] + * @returns {void} + */ function done(error, tree) { - complete = true; - result = tree; bail(error); + result = tree; + complete = true; } } - // Stringify a unist node representation of a file (in string or vfile - // representation) into a string using the `Compiler` on the processor. - function stringify(node, doc) { - var file = vfile(doc); - var Compiler; - - freeze(); - Compiler = processor.Compiler; - assertCompiler('stringify', Compiler); - assertNode(node); - - if (newable(Compiler, 'compile')) { - return new Compiler(node, file).compile() - } - - return Compiler(node, file) // eslint-disable-line new-cap - } - - // Parse a file (in string or vfile representation) into a unist node using - // the `Parser` on the processor, then run transforms on that node, and - // compile the resulting node using the `Compiler` on the processor, and - // store that result on the vfile. - function process(doc, cb) { - freeze(); + /** + * @param {VFileCompatible} doc + * @param {ProcessCallback} [callback] + * @returns {Promise<VFile>|undefined} + */ + function process(doc, callback) { + processor.freeze(); assertParser('process', processor.Parser); assertCompiler('process', processor.Compiler); - if (!cb) { + if (!callback) { return new Promise(executor) } - executor(null, cb); + executor(null, callback); + /** + * @param {null|((file: VFile) => void)} resolve + * @param {(error?: Error|null|undefined) => void} reject + * @returns {void} + */ function executor(resolve, reject) { - var file = vfile(doc); + const file = vfile(doc); - pipeline.run(processor, {file: file}, done); + processor.run(processor.parse(file), file, (error, tree, file) => { + if (error || !tree || !file) { + done(error); + } else { + /** @type {unknown} */ + const result = processor.stringify(tree, file); - function done(error) { - if (error) { + if (result === undefined || result === null) ; else if (looksLikeAVFileValue(result)) { + file.value = result; + } else { + file.result = result; + } + + done(error, file); + } + }); + + /** + * @param {Error|null|undefined} [error] + * @param {VFile|undefined} [file] + * @returns {void} + */ + function done(error, file) { + if (error || !file) { reject(error); } else if (resolve) { resolve(file); } else { - cb(null, file); + // @ts-expect-error: `callback` is defined if `resolve` is not. + callback(null, file); } } } } - // Process the given document (in string or vfile representation), sync. + /** @type {Processor['processSync']} */ function processSync(doc) { - var file; - var complete; + /** @type {boolean|undefined} */ + let complete; - freeze(); + processor.freeze(); assertParser('processSync', processor.Parser); assertCompiler('processSync', processor.Compiler); - file = vfile(doc); - process(file, done); + const file = vfile(doc); + + processor.process(file, done); assertDone('processSync', 'process', complete); return file + /** + * @param {Error|null|undefined} [error] + * @returns {void} + */ function done(error) { complete = true; bail(error); @@ -28440,61 +33625,112 @@ function unified$1() { } } -// Check if `value` is a constructor. +/** + * Check if `value` is a constructor. + * + * @param {unknown} value + * @param {string} name + * @returns {boolean} + */ function newable(value, name) { return ( typeof value === 'function' && + // Prototypes do exist. + // type-coverage:ignore-next-line value.prototype && // A function with keys in its prototype is probably a constructor. // Classes’ prototype methods are not enumerable, so we check if some value // exists in the prototype. + // type-coverage:ignore-next-line (keys(value.prototype) || name in value.prototype) ) } -// Check if `value` is an object with keys. +/** + * Check if `value` is an object with keys. + * + * @param {Record<string, unknown>} value + * @returns {boolean} + */ function keys(value) { - var key; + /** @type {string} */ + let key; + for (key in value) { - return true + if (own$6.call(value, key)) { + return true + } } return false } -// Assert a parser is available. -function assertParser(name, Parser) { - if (typeof Parser !== 'function') { - throw new Error('Cannot `' + name + '` without `Parser`') +/** + * Assert a parser is available. + * + * @param {string} name + * @param {unknown} value + * @returns {asserts value is Parser} + */ +function assertParser(name, value) { + if (typeof value !== 'function') { + throw new TypeError('Cannot `' + name + '` without `Parser`') } } -// Assert a compiler is available. -function assertCompiler(name, Compiler) { - if (typeof Compiler !== 'function') { - throw new Error('Cannot `' + name + '` without `Compiler`') +/** + * Assert a compiler is available. + * + * @param {string} name + * @param {unknown} value + * @returns {asserts value is Compiler} + */ +function assertCompiler(name, value) { + if (typeof value !== 'function') { + throw new TypeError('Cannot `' + name + '` without `Compiler`') } } -// Assert the processor is not frozen. +/** + * Assert the processor is not frozen. + * + * @param {string} name + * @param {unknown} frozen + * @returns {asserts frozen is false} + */ function assertUnfrozen(name, frozen) { if (frozen) { throw new Error( - 'Cannot invoke `' + + 'Cannot call `' + name + - '` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.' + '` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.' ) } } -// Assert `node` is a unist node. +/** + * Assert `node` is a unist node. + * + * @param {unknown} node + * @returns {asserts node is Node} + */ function assertNode(node) { - if (!node || typeof node.type !== 'string') { - throw new Error('Expected node, got `' + node + '`') + // `isPlainObj` unfortunately uses `any` instead of `unknown`. + // type-coverage:ignore-next-line + if (!isPlainObject$1(node) || typeof node.type !== 'string') { + throw new TypeError('Expected node, got `' + node + '`') + // Fine. } } -// Assert that `complete` is `true`. +/** + * Assert that `complete` is `true`. + * + * @param {string} name + * @param {string} asyncName + * @param {unknown} complete + * @returns {asserts complete is true} + */ function assertDone(name, asyncName, complete) { if (!complete) { throw new Error( @@ -28503,120 +33739,516 @@ function assertDone(name, asyncName, complete) { } } -var mdastUtilToString$1 = toString$5; +/** + * @param {VFileCompatible} [value] + * @returns {VFile} + */ +function vfile(value) { + return looksLikeAVFile(value) ? value : new VFile(value) +} + +/** + * @param {VFileCompatible} [value] + * @returns {value is VFile} + */ +function looksLikeAVFile(value) { + return Boolean( + value && + typeof value === 'object' && + 'message' in value && + 'messages' in value + ) +} + +/** + * @param {unknown} [value] + * @returns {value is VFileValue} + */ +function looksLikeAVFileValue(value) { + return typeof value === 'string' || isBuffer(value) +} + +/** + * @typedef Options + * @property {boolean} [includeImageAlt=true] + */ -// Get the text content of a node. -// Prefer the node’s plain-text fields, otherwise serialize its children, -// and if the given value is an array, serialize the nodes in it. -function toString$5(node) { +/** + * Get the text content of a node. + * Prefer the node’s plain-text fields, otherwise serialize its children, + * and if the given value is an array, serialize the nodes in it. + * + * @param {unknown} node + * @param {Options} [options] + * @returns {string} + */ +function toString(node, options) { + var {includeImageAlt = true} = options || {}; + return one(node, includeImageAlt) +} + +/** + * @param {unknown} node + * @param {boolean} includeImageAlt + * @returns {string} + */ +function one(node, includeImageAlt) { return ( (node && + typeof node === 'object' && + // @ts-ignore looks like a literal. (node.value || - node.alt || - node.title || - ('children' in node && all$2(node.children)) || - ('length' in node && all$2(node)))) || + // @ts-ignore looks like an image. + (includeImageAlt ? node.alt : '') || + // @ts-ignore looks like a parent. + ('children' in node && all(node.children, includeImageAlt)) || + (Array.isArray(node) && all(node, includeImageAlt)))) || '' ) } -function all$2(values) { +/** + * @param {Array.<unknown>} values + * @param {boolean} includeImageAlt + * @returns {string} + */ +function all(values, includeImageAlt) { + /** @type {Array.<string>} */ var result = []; var index = -1; while (++index < values.length) { - result[index] = toString$5(values[index]); + result[index] = one(values[index], includeImageAlt); } return result.join('') } -var assign$5 = Object.assign; +/** + * Like `Array#splice`, but smarter for giant arrays. + * + * `Array#splice` takes all items to be inserted as individual argument which + * causes a stack overflow in V8 when trying to insert 100k items for instance. + * + * Otherwise, this does not return the removed items, and takes `items` as an + * array instead of rest parameters. + * + * @template {unknown} T + * @param {T[]} list + * @param {number} start + * @param {number} remove + * @param {T[]} items + * @returns {void} + */ +function splice(list, start, remove, items) { + const end = list.length; + let chunkStart = 0; + /** @type {unknown[]} */ -var assign_1 = assign$5; + let parameters; // Make start between zero and `end` (included). -var own$a = {}.hasOwnProperty; + if (start < 0) { + start = -start > end ? 0 : end + start; + } else { + start = start > end ? end : start; + } -var hasOwnProperty$2 = own$a; + remove = remove > 0 ? remove : 0; // No need to chunk the items if there’s only a couple (10k) items. -function normalizeIdentifier$4(value) { - return ( - value // Collapse Markdown whitespace. - .replace(/[\t\n\r ]+/g, ' ') // Trim. - .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase - // counterpart is uppercased will result in a different uppercase - // character. - // Hence, to get that form, we perform both lower- and uppercase. - // Upper case makes sure keys will not interact with default prototypal - // methods: no object method is uppercase. - .toLowerCase() - .toUpperCase() - ) + if (items.length < 10000) { + parameters = Array.from(items); + parameters.unshift(start, remove) // @ts-expect-error Hush, it’s fine. + ;[].splice.apply(list, parameters); + } else { + // Delete `remove` items starting from `start` + if (remove) [].splice.apply(list, [start, remove]); // Insert the items in chunks to not cause stack overflows. + + while (chunkStart < items.length) { + parameters = items.slice(chunkStart, chunkStart + 10000); + parameters.unshift(start, 0) // @ts-expect-error Hush, it’s fine. + ;[].splice.apply(list, parameters); + chunkStart += 10000; + start += 10000; + } + } } +/** + * Append `items` (an array) at the end of `list` (another array). + * When `list` was empty, returns `items` instead. + * + * This prevents a potentially expensive operation when `list` is empty, + * and adds items in batches to prevent V8 from hanging. + * + * @template {unknown} T + * @param {T[]} list + * @param {T[]} items + * @returns {T[]} + */ -var normalizeIdentifier_1 = normalizeIdentifier$4; +function push(list, items) { + if (list.length > 0) { + splice(list, list.length, 0, items); + return list + } -var fromCharCode$4 = String.fromCharCode; + return items +} -var fromCharCode_1 = fromCharCode$4; +/** + * @typedef {import('micromark-util-types').NormalizedExtension} NormalizedExtension + * @typedef {import('micromark-util-types').Extension} Extension + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension + */ -var fromCharCode$3 = fromCharCode_1; +const hasOwnProperty = {}.hasOwnProperty; -function safeFromInt$1(value, base) { - var code = parseInt(value, base); +/** + * Combine several syntax extensions into one. + * + * @param {Extension[]} extensions List of syntax extensions. + * @returns {NormalizedExtension} A single combined extension. + */ +function combineExtensions(extensions) { + /** @type {NormalizedExtension} */ + const all = {}; + let index = -1; - if ( - // C0 except for HT, LF, FF, CR, space - code < 9 || - code === 11 || - (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. - (code > 126 && code < 160) || // Lone high surrogates and low surrogates. - (code > 55295 && code < 57344) || // Noncharacters. - (code > 64975 && code < 65008) || - (code & 65535) === 65535 || - (code & 65535) === 65534 || // Out of range - code > 1114111 - ) { - return '\uFFFD' + while (++index < extensions.length) { + syntaxExtension(all, extensions[index]); } - return fromCharCode$3(code) + return all } -var safeFromInt_1 = safeFromInt$1; +/** + * Merge `extension` into `all`. + * + * @param {NormalizedExtension} all Extension to merge into. + * @param {Extension} extension Extension to merge. + * @returns {void} + */ +function syntaxExtension(all, extension) { + /** @type {string} */ + let hook; -var content$3 = {}; + for (hook in extension) { + const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined; + const left = maybe || (all[hook] = {}); + const right = extension[hook]; + /** @type {string} */ + let code; -function markdownLineEnding$k(code) { - return code < -2 + for (code in right) { + if (!hasOwnProperty.call(left, code)) left[code] = []; + const value = right[code]; + constructs( + // @ts-expect-error Looks like a list. + left[code], + Array.isArray(value) ? value : value ? [value] : [] + ); + } + } } -var markdownLineEnding_1 = markdownLineEnding$k; +/** + * Merge `list` into `existing` (both lists of constructs). + * Mutates `existing`. + * + * @param {unknown[]} existing + * @param {unknown[]} list + * @returns {void} + */ +function constructs(existing, list) { + let index = -1; + /** @type {unknown[]} */ + const before = []; + + while (++index < list.length) { +(list[index].add === 'after' ? existing : before).push(list[index]); + } + + splice(existing, 0, 0, before); +} + +/** + * Combine several HTML extensions into one. + * + * @param {HtmlExtension[]} htmlExtensions List of HTML extensions. + * @returns {HtmlExtension} A single combined extension. + */ +function combineHtmlExtensions(htmlExtensions) { + /** @type {HtmlExtension} */ + const handlers = {}; + let index = -1; -function markdownSpace$a(code) { + while (++index < htmlExtensions.length) { + htmlExtension(handlers, htmlExtensions[index]); + } + + return handlers +} + +/** + * Merge `extension` into `all`. + * + * @param {HtmlExtension} all Extension to merge into. + * @param {HtmlExtension} extension Extension to merge. + * @returns {void} + */ +function htmlExtension(all, extension) { + /** @type {string} */ + let hook; + + for (hook in extension) { + const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined; + const left = maybe || (all[hook] = {}); + const right = extension[hook]; + /** @type {string} */ + let type; + + if (right) { + for (type in right) { + left[type] = right[type]; + } + } + } +} + +// This module is generated by `script/`. +// +// CommonMark handles attention (emphasis, strong) markers based on what comes +// before or after them. +// One such difference is if those characters are Unicode punctuation. +// This script is generated from the Unicode data. +const unicodePunctuationRegex = + /[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; + +/** + * @typedef {import('micromark-util-types').Code} Code + */ +/** + * Check whether the character code represents an ASCII alpha (`a` through `z`, + * case insensitive). + * + * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + * + * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) + * to U+005A (`Z`). + * + * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) + * to U+007A (`z`). + */ + +const asciiAlpha = regexCheck(/[A-Za-z]/); +/** + * Check whether the character code represents an ASCII digit (`0` through `9`). + * + * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to + * U+0039 (`9`). + */ + +const asciiDigit = regexCheck(/\d/); +/** + * Check whether the character code represents an ASCII hex digit (`a` through + * `f`, case insensitive, or `0` through `9`). + * + * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex + * digit, or an ASCII lower hex digit. + * + * An **ASCII upper hex digit** is a character in the inclusive range U+0041 + * (`A`) to U+0046 (`F`). + * + * An **ASCII lower hex digit** is a character in the inclusive range U+0061 + * (`a`) to U+0066 (`f`). + */ + +const asciiHexDigit = regexCheck(/[\dA-Fa-f]/); +/** + * Check whether the character code represents an ASCII alphanumeric (`a` + * through `z`, case insensitive, or `0` through `9`). + * + * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha + * (see `asciiAlpha`). + */ + +const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); +/** + * Check whether the character code represents ASCII punctuation. + * + * An **ASCII punctuation** is a character in the inclusive ranges U+0021 + * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT + * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT + * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + */ + +const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); +/** + * Check whether the character code represents an ASCII atext. + * + * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in + * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), + * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F + * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E + * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE + * (`{`) to U+007E TILDE (`~`). + * + * See: + * **\[RFC5322]**: + * [Internet Message Format](https://tools.ietf.org/html/rfc5322). + * P. Resnick. + * IETF. + */ + +const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); +/** + * Check whether a character code is an ASCII control character. + * + * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) + * to U+001F (US), or U+007F (DEL). + * + * @param {Code} code + * @returns {code is number} + */ + +function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code !== null && (code < 32 || code === 127) + ) +} +/** + * Check whether a character code is a markdown line ending (see + * `markdownLineEnding`) or markdown space (see `markdownSpace`). + * + * @param {Code} code + * @returns {code is number} + */ + +function markdownLineEndingOrSpace(code) { + return code !== null && (code < 0 || code === 32) +} +/** + * Check whether a character code is a markdown line ending. + * + * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN + * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + * + * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE + * RETURN (CR) are replaced by these virtual characters depending on whether + * they occurred together. + * + * @param {Code} code + * @returns {code is number} + */ + +function markdownLineEnding(code) { + return code !== null && code < -2 +} +/** + * Check whether a character code is a markdown space. + * + * A **markdown space** is the concrete character U+0020 SPACE (SP) and the + * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + * + * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is + * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL + * SPACE (VS) characters, depending on the column at which the tab occurred. + * + * @param {Code} code + * @returns {code is number} + */ + +function markdownSpace(code) { return code === -2 || code === -1 || code === 32 } +/** + * Check whether the character code represents Unicode whitespace. + * + * Note that this does handle micromark specific markdown whitespace characters. + * See `markdownLineEndingOrSpace` to check that. + * + * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, + * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), + * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + */ -var markdownSpace_1 = markdownSpace$a; +const unicodeWhitespace = regexCheck(/\s/); +/** + * Check whether the character code represents Unicode punctuation. + * + * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, + * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` + * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` + * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII + * punctuation (see `asciiPunctuation`). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + */ +// Size note: removing ASCII from the regex and using `asciiPunctuation` here +// In fact adds to the bundle size. -var markdownSpace$9 = markdownSpace_1; +const unicodePunctuation = regexCheck(unicodePunctuationRegex); +/** + * Create a code check from a regex. + * + * @param {RegExp} regex + * @returns {(code: Code) => code is number} + */ + +function regexCheck(regex) { + return check + /** + * Check whether a code matches the bound regex. + * + * @param {Code} code Character code + * @returns {code is number} Whether the character code matches the bound regex + */ -function spaceFactory(effects, ok, type, max) { - var limit = max ? max - 1 : Infinity; - var size = 0; + function check(code) { + return code !== null && regex.test(String.fromCharCode(code)) + } +} + +/** + * @typedef {import('micromark-util-types').Effects} Effects + * @typedef {import('micromark-util-types').State} State + */ +/** + * @param {Effects} effects + * @param {State} ok + * @param {string} type + * @param {number} [max=Infinity] + * @returns {State} + */ + +function factorySpace(effects, ok, type, max) { + const limit = max ? max - 1 : Number.POSITIVE_INFINITY; + let size = 0; return start + /** @type {State} */ function start(code) { - if (markdownSpace$9(code)) { + if (markdownSpace(code)) { effects.enter(type); return prefix(code) } return ok(code) } + /** @type {State} */ function prefix(code) { - if (markdownSpace$9(code) && size++ < limit) { + if (markdownSpace(code) && size++ < limit) { effects.consume(code); return prefix } @@ -28626,23 +34258,30 @@ function spaceFactory(effects, ok, type, max) { } } -var factorySpace$i = spaceFactory; - -Object.defineProperty(content$3, '__esModule', {value: true}); - -var markdownLineEnding$j = markdownLineEnding_1; -var factorySpace$h = factorySpace$i; +/** + * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct + * @typedef {import('micromark-util-types').Initializer} Initializer + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').State} State + */ -var tokenize$2 = initializeContent; +/** @type {InitialConstruct} */ +const content$1 = { + tokenize: initializeContent +}; +/** @type {Initializer} */ function initializeContent(effects) { - var contentStart = effects.attempt( + const contentStart = effects.attempt( this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial ); - var previous; + /** @type {Token} */ + + let previous; return contentStart + /** @type {State} */ function afterContentStartConstruct(code) { if (code === null) { @@ -28653,18 +34292,20 @@ function initializeContent(effects) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); - return factorySpace$h(effects, contentStart, 'linePrefix') + return factorySpace(effects, contentStart, 'linePrefix') } + /** @type {State} */ function paragraphInitial(code) { effects.enter('paragraph'); return lineStart(code) } + /** @type {State} */ function lineStart(code) { - var token = effects.enter('chunkText', { + const token = effects.enter('chunkText', { contentType: 'text', - previous: previous + previous }); if (previous) { @@ -28674,6 +34315,7 @@ function initializeContent(effects) { previous = token; return data(code) } + /** @type {State} */ function data(code) { if (code === null) { @@ -28683,7 +34325,7 @@ function initializeContent(effects) { return } - if (markdownLineEnding$j(code)) { + if (markdownLineEnding(code)) { effects.consume(code); effects.exit('chunkText'); return lineStart @@ -28694,84 +34336,128 @@ function initializeContent(effects) { } } -content$3.tokenize = tokenize$2; - -var document$3 = {}; - -var markdownLineEnding$i = markdownLineEnding_1; -var factorySpace$g = factorySpace$i; +/** + * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct + * @typedef {import('micromark-util-types').Initializer} Initializer + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Point} Point + */ +/** @type {InitialConstruct} */ -var partialBlankLine$4 = { - tokenize: tokenizePartialBlankLine, - partial: true +const document$2 = { + tokenize: initializeDocument }; +/** @type {Construct} */ -function tokenizePartialBlankLine(effects, ok, nok) { - return factorySpace$g(effects, afterWhitespace, 'linePrefix') - - function afterWhitespace(code) { - return code === null || markdownLineEnding$i(code) ? ok(code) : nok(code) - } -} +const containerConstruct = { + tokenize: tokenizeContainer +}; +/** @type {Initializer} */ -var partialBlankLine_1 = partialBlankLine$4; +function initializeDocument(effects) { + const self = this; + /** @type {StackItem[]} */ -Object.defineProperty(document$3, '__esModule', {value: true}); + const stack = []; + let continued = 0; + /** @type {TokenizeContext|undefined} */ -var markdownLineEnding$h = markdownLineEnding_1; -var factorySpace$f = factorySpace$i; -var partialBlankLine$3 = partialBlankLine_1; + let childFlow; + /** @type {Token|undefined} */ -var tokenize$1 = initializeDocument; -var containerConstruct = { - tokenize: tokenizeContainer -}; -var lazyFlowConstruct = { - tokenize: tokenizeLazyFlow -}; + let childToken; + /** @type {number} */ -function initializeDocument(effects) { - var self = this; - var stack = []; - var continued = 0; - var inspectConstruct = { - tokenize: tokenizeInspect, - partial: true - }; - var inspectResult; - var childFlow; - var childToken; + let lineStartOffset; return start + /** @type {State} */ function start(code) { + // First we iterate through the open blocks, starting with the root + // document, and descending through last children down to the last open + // block. + // Each block imposes a condition that the line must satisfy if the block is + // to remain open. + // For example, a block quote requires a `>` character. + // A paragraph requires a non-blank line. + // In this phase we may match all or just some of the open blocks. + // But we cannot close unmatched blocks yet, because we may have a lazy + // continuation line. if (continued < stack.length) { - self.containerState = stack[continued][1]; + const item = stack[continued]; + self.containerState = item[1]; return effects.attempt( - stack[continued][0].continuation, + item[0].continuation, documentContinue, - documentContinued + checkNewContainers )(code) - } + } // Done. - return documentContinued(code) + return checkNewContainers(code) } + /** @type {State} */ function documentContinue(code) { + if (self.containerState._closeFlow) closeFlow(); continued++; return start(code) } + /** @type {State} */ - function documentContinued(code) { - // If we’re in a concrete construct (such as when expecting another line of - // HTML, or we resulted in lazy content), we can immediately start flow. - if (inspectResult && inspectResult.flowContinue) { - return flowStart(code) - } + function checkNewContainers(code) { + // Next, after consuming the continuation markers for existing blocks, we + // look for new block starts (e.g. `>` for a block quote). + // If we encounter a new block start, we close any blocks unmatched in + // step 1 before creating the new block as a child of the last matched + // block. + if (continued === stack.length) { + // No need to `check` whether there’s a container, of `exitContainers` + // would be moot. + // We can instead immediately `attempt` to parse one. + if (!childFlow) { + return documentContinued(code) + } // If we have concrete content, such as block HTML or fenced code, + // we can’t have containers “pierce” into them, so we can immediately + // start. + + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { + return flowStart(code) + } // If we do have flow, it could still be a blank line, + // but we’d be interrupting it w/ a new container if there’s a current + // construct. + + self.interrupt = Boolean(childFlow.currentConstruct); + } // Check if there is a new container. + + self.containerState = {}; + return effects.check( + containerConstruct, + thereIsANewContainer, + thereIsNoNewContainer + )(code) + } + /** @type {State} */ - self.interrupt = - childFlow && - childFlow.currentConstruct && - childFlow.currentConstruct.interruptible; + function thereIsANewContainer(code) { + if (childFlow) closeFlow(); + exitContainers(continued); + return documentContinued(code) + } + /** @type {State} */ + + function thereIsNoNewContainer(code) { + self.parser.lazy[self.now().line] = continued !== stack.length; + lineStartOffset = self.now().offset; + return flowStart(code) + } + /** @type {State} */ + + function documentContinued(code) { + // Try new containers. self.containerState = {}; return effects.attempt( containerConstruct, @@ -28779,16 +34465,20 @@ function initializeDocument(effects) { flowStart )(code) } + /** @type {State} */ function containerContinue(code) { - stack.push([self.currentConstruct, self.containerState]); - self.containerState = undefined; + continued++; + stack.push([self.currentConstruct, self.containerState]); // Try another. + return documentContinued(code) } + /** @type {State} */ function flowStart(code) { if (code === null) { - exitContainers(0, true); + if (childFlow) closeFlow(); + exitContainers(0); effects.consume(code); return } @@ -28801,870 +34491,221 @@ function initializeDocument(effects) { }); return flowContinue(code) } + /** @type {State} */ function flowContinue(code) { if (code === null) { - continueFlow(effects.exit('chunkFlow')); - return flowStart(code) + writeToChild(effects.exit('chunkFlow'), true); + exitContainers(0); + effects.consume(code); + return } - if (markdownLineEnding$h(code)) { + if (markdownLineEnding(code)) { effects.consume(code); - continueFlow(effects.exit('chunkFlow')); - return effects.check(inspectConstruct, documentAfterPeek) + writeToChild(effects.exit('chunkFlow')); // Get ready for the next line. + + continued = 0; + self.interrupt = undefined; + return start } effects.consume(code); return flowContinue } + /** + * @param {Token} token + * @param {boolean} [eof] + * @returns {void} + */ - function documentAfterPeek(code) { - exitContainers( - inspectResult.continued, - inspectResult && inspectResult.flowEnd - ); - continued = 0; - return start(code) - } - - function continueFlow(token) { + function writeToChild(token, eof) { + const stream = self.sliceStream(token); + if (eof) stream.push(null); + token.previous = childToken; if (childToken) childToken.next = token; childToken = token; - childFlow.lazy = inspectResult && inspectResult.lazy; childFlow.defineSkip(token.start); - childFlow.write(self.sliceStream(token)); - } - - function exitContainers(size, end) { - var index = stack.length; // Close the flow. - - if (childFlow && end) { - childFlow.write([null]); - childToken = childFlow = undefined; - } // Exit open containers. - - while (index-- > size) { - self.containerState = stack[index][1]; - stack[index][0].exit.call(self, effects); - } - - stack.length = size; - } - - function tokenizeInspect(effects, ok) { - var subcontinued = 0; - inspectResult = {}; - return inspectStart - - function inspectStart(code) { - if (subcontinued < stack.length) { - self.containerState = stack[subcontinued][1]; - return effects.attempt( - stack[subcontinued][0].continuation, - inspectContinue, - inspectLess - )(code) - } // If we’re continued but in a concrete flow, we can’t have more - // containers. - - if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { - inspectResult.flowContinue = true; - return inspectDone(code) - } - - self.interrupt = - childFlow.currentConstruct && childFlow.currentConstruct.interruptible; - self.containerState = {}; - return effects.attempt( - containerConstruct, - inspectFlowEnd, - inspectDone - )(code) - } - - function inspectContinue(code) { - subcontinued++; - return self.containerState._closeFlow - ? inspectFlowEnd(code) - : inspectStart(code) - } - - function inspectLess(code) { - if (childFlow.currentConstruct && childFlow.currentConstruct.lazy) { - // Maybe another container? - self.containerState = {}; - return effects.attempt( - containerConstruct, - inspectFlowEnd, // Maybe flow, or a blank line? - effects.attempt( - lazyFlowConstruct, - inspectFlowEnd, - effects.check(partialBlankLine$3, inspectFlowEnd, inspectLazy) - ) - )(code) - } // Otherwise we’re interrupting. - - return inspectFlowEnd(code) - } - - function inspectLazy(code) { - // Act as if all containers are continued. - subcontinued = stack.length; - inspectResult.lazy = true; - inspectResult.flowContinue = true; - return inspectDone(code) - } // We’re done with flow if we have more containers, or an interruption. - - function inspectFlowEnd(code) { - inspectResult.flowEnd = true; - return inspectDone(code) - } - - function inspectDone(code) { - inspectResult.continued = subcontinued; - self.interrupt = self.containerState = undefined; - return ok(code) - } - } -} - -function tokenizeContainer(effects, ok, nok) { - return factorySpace$f( - effects, - effects.attempt(this.parser.constructs.document, ok, nok), - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ) -} - -function tokenizeLazyFlow(effects, ok, nok) { - return factorySpace$f( - effects, - effects.lazy(this.parser.constructs.flow, ok, nok), - 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 - ) -} - -document$3.tokenize = tokenize$1; - -var flow$7 = {}; - -// Counts tabs based on their expanded size, and CR+LF as one character. - -function sizeChunks$2(chunks) { - var index = -1; - var size = 0; - - while (++index < chunks.length) { - size += typeof chunks[index] === 'string' ? chunks[index].length : 1; - } - - return size -} - -var sizeChunks_1 = sizeChunks$2; - -var sizeChunks$1 = sizeChunks_1; - -function prefixSize$4(events, type) { - var tail = events[events.length - 1]; - if (!tail || tail[1].type !== type) return 0 - return sizeChunks$1(tail[2].sliceStream(tail[1])) -} - -var prefixSize_1 = prefixSize$4; - -var splice$2 = [].splice; - -var splice_1 = splice$2; - -var splice$1 = splice_1; - -// causes a stack overflow in V8 when trying to insert 100k items for instance. - -function chunkedSplice$8(list, start, remove, items) { - var end = list.length; - var chunkStart = 0; - var parameters; // Make start between zero and `end` (included). - - if (start < 0) { - start = -start > end ? 0 : end + start; - } else { - start = start > end ? end : start; - } - - remove = remove > 0 ? remove : 0; // No need to chunk the items if there’s only a couple (10k) items. - - if (items.length < 10000) { - parameters = Array.from(items); - parameters.unshift(start, remove); - splice$1.apply(list, parameters); - } else { - // Delete `remove` items starting from `start` - if (remove) splice$1.apply(list, [start, remove]); // Insert the items in chunks to not cause stack overflows. - - while (chunkStart < items.length) { - parameters = items.slice(chunkStart, chunkStart + 10000); - parameters.unshift(start, 0); - splice$1.apply(list, parameters); - chunkStart += 10000; - start += 10000; - } - } -} - -var chunkedSplice_1 = chunkedSplice$8; - -var assign$4 = assign_1; - -function shallow$6(object) { - return assign$4({}, object) -} - -var shallow_1 = shallow$6; - -var assign$3 = assign_1; -var chunkedSplice$7 = chunkedSplice_1; -var shallow$5 = shallow_1; - -function subtokenize$2(events) { - var jumps = {}; - var index = -1; - var event; - var lineIndex; - var otherIndex; - var otherEvent; - var parameters; - var subevents; - var more; - - while (++index < events.length) { - while (index in jumps) { - index = jumps[index]; - } - - event = events[index]; // Add a hook for the GFM tasklist extension, which needs to know if text - // is in the first content of a list item. - - if ( - index && - event[1].type === 'chunkFlow' && - events[index - 1][1].type === 'listItemPrefix' - ) { - subevents = event[1]._tokenizer.events; - otherIndex = 0; - - if ( - otherIndex < subevents.length && - subevents[otherIndex][1].type === 'lineEndingBlank' - ) { - otherIndex += 2; - } - - if ( - otherIndex < subevents.length && - subevents[otherIndex][1].type === 'content' - ) { - while (++otherIndex < subevents.length) { - if (subevents[otherIndex][1].type === 'content') { - break - } - - if (subevents[otherIndex][1].type === 'chunkText') { - subevents[otherIndex][1].isInFirstContentOfListItem = true; - otherIndex++; - } - } - } - } // Enter. - - if (event[0] === 'enter') { - if (event[1].contentType) { - assign$3(jumps, subcontent(events, index)); - index = jumps[index]; - more = true; - } - } // Exit. - else if (event[1]._container || event[1]._movePreviousLineEndings) { - otherIndex = index; - lineIndex = undefined; + childFlow.write(stream); // Alright, so we just added a lazy line: + // + // ```markdown + // > a + // b. + // + // Or: + // + // > ~~~c + // d + // + // Or: + // + // > | e | + // f + // ``` + // + // The construct in the second example (fenced code) does not accept lazy + // lines, so it marked itself as done at the end of its first line, and + // then the content construct parses `d`. + // Most constructs in markdown match on the first line: if the first line + // forms a construct, a non-lazy line can’t “unmake” it. + // + // The construct in the third example is potentially a GFM table, and + // those are *weird*. + // It *could* be a table, from the first line, if the following line + // matches a condition. + // In this case, that second line is lazy, which “unmakes” the first line + // and turns the whole into one content block. + // + // We’ve now parsed the non-lazy and the lazy line, and can figure out + // whether the lazy line started a new flow block. + // If it did, we exit the current containers between the two flow blocks. - while (otherIndex--) { - otherEvent = events[otherIndex]; + if (self.parser.lazy[token.start.line]) { + let index = childFlow.events.length; + while (index--) { if ( - otherEvent[1].type === 'lineEnding' || - otherEvent[1].type === 'lineEndingBlank' + // The token starts before the line ending… + childFlow.events[index][1].start.offset < lineStartOffset && + (!childFlow.events[index][1].end || // …or ends after it. + childFlow.events[index][1].end.offset > lineStartOffset) ) { - if (otherEvent[0] === 'enter') { - if (lineIndex) { - events[lineIndex][1].type = 'lineEndingBlank'; - } - - otherEvent[1].type = 'lineEnding'; - lineIndex = otherIndex; - } - } else { - break + // Exit: there’s still something open, which means it’s a lazy line + // part of something. + return } } - if (lineIndex) { - // Fix position. - event[1].end = shallow$5(events[lineIndex][1].start); // Switch container exit w/ line endings. - - parameters = events.slice(lineIndex, index); - parameters.unshift(event); - chunkedSplice$7(events, lineIndex, index - lineIndex + 1, parameters); - } - } - } - - return !more -} - -function subcontent(events, eventIndex) { - var token = events[eventIndex][1]; - var context = events[eventIndex][2]; - var startPosition = eventIndex - 1; - var startPositions = []; - var tokenizer = - token._tokenizer || context.parser[token.contentType](token.start); - var childEvents = tokenizer.events; - var jumps = []; - var gaps = {}; - var stream; - var previous; - var index; - var entered; - var end; - var adjust; // Loop forward through the linked tokens to pass them in order to the - // subtokenizer. - - while (token) { - // Find the position of the event for this token. - while (events[++startPosition][1] !== token) { - // Empty. - } - - startPositions.push(startPosition); + const indexBeforeExits = self.events.length; + let indexBeforeFlow = indexBeforeExits; + /** @type {boolean|undefined} */ - if (!token._tokenizer) { - stream = context.sliceStream(token); + let seen; + /** @type {Point|undefined} */ - if (!token.next) { - stream.push(null); - } - - if (previous) { - tokenizer.defineSkip(token.start); - } + let point; // Find the previous chunk (the one before the lazy line). - if (token.isInFirstContentOfListItem) { - tokenizer._gfmTasklistFirstContentOfListItem = true; - } - - tokenizer.write(stream); - - if (token.isInFirstContentOfListItem) { - tokenizer._gfmTasklistFirstContentOfListItem = undefined; - } - } // Unravel the next token. - - previous = token; - token = token.next; - } // Now, loop back through all events (and linked tokens), to figure out which - // parts belong where. - - token = previous; - index = childEvents.length; - - while (index--) { - // Make sure we’ve at least seen something (final eol is part of the last - // token). - if (childEvents[index][0] === 'enter') { - entered = true; - } else if ( - // Find a void token that includes a break. - entered && - childEvents[index][1].type === childEvents[index - 1][1].type && - childEvents[index][1].start.line !== childEvents[index][1].end.line - ) { - add(childEvents.slice(index + 1, end)); - // Help GC. - token._tokenizer = token.next = undefined; - token = token.previous; - end = index + 1; - } - } - - // Help GC. - tokenizer.events = token._tokenizer = token.next = undefined; // Do head: - - add(childEvents.slice(0, end)); - index = -1; - adjust = 0; - - while (++index < jumps.length) { - gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; - adjust += jumps[index][1] - jumps[index][0] - 1; - } - - return gaps - - function add(slice) { - var start = startPositions.pop(); - jumps.unshift([start, start + slice.length - 1]); - chunkedSplice$7(events, start, 2, slice); - } -} - -var subtokenize_1 = subtokenize$2; - -var markdownLineEnding$g = markdownLineEnding_1; -var prefixSize$3 = prefixSize_1; -var subtokenize$1 = subtokenize_1; -var factorySpace$e = factorySpace$i; - -// No name because it must not be turned off. -var content$2 = { - tokenize: tokenizeContent, - resolve: resolveContent, - interruptible: true, - lazy: true -}; -var continuationConstruct = { - tokenize: tokenizeContinuation, - partial: true -}; // Content is transparent: it’s parsed right now. That way, definitions are also -// parsed right now: before text in paragraphs (specifically, media) are parsed. - -function resolveContent(events) { - subtokenize$1(events); - return events -} - -function tokenizeContent(effects, ok) { - var previous; - return start - - function start(code) { - effects.enter('content'); - previous = effects.enter('chunkContent', { - contentType: 'content' - }); - return data(code) - } - - function data(code) { - if (code === null) { - return contentEnd(code) - } - - if (markdownLineEnding$g(code)) { - return effects.check( - continuationConstruct, - contentContinue, - contentEnd - )(code) - } // Data. - - effects.consume(code); - return data - } - - function contentEnd(code) { - effects.exit('chunkContent'); - effects.exit('content'); - return ok(code) - } - - function contentContinue(code) { - effects.consume(code); - effects.exit('chunkContent'); - previous = previous.next = effects.enter('chunkContent', { - contentType: 'content', - previous: previous - }); - return data - } -} - -function tokenizeContinuation(effects, ok, nok) { - var self = this; - return startLookahead - - function startLookahead(code) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace$e(effects, prefixed, 'linePrefix') - } - - function prefixed(code) { - if (code === null || markdownLineEnding$g(code)) { - return nok(code) - } - - if ( - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 || - prefixSize$3(self.events, 'linePrefix') < 4 - ) { - return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) - } - - return ok(code) - } -} - -var content_1 = content$2; - -Object.defineProperty(flow$7, '__esModule', {value: true}); - -var content$1 = content_1; -var factorySpace$d = factorySpace$i; -var partialBlankLine$2 = partialBlankLine_1; - -var tokenize = initializeFlow; - -function initializeFlow(effects) { - var self = this; - var initial = effects.attempt( - // Try to parse a blank line. - partialBlankLine$2, - atBlankEnding, // Try to parse initial flow (essentially, only code). - effects.attempt( - this.parser.constructs.flowInitial, - afterConstruct, - factorySpace$d( - effects, - effects.attempt( - this.parser.constructs.flow, - afterConstruct, - effects.attempt(content$1, afterConstruct) - ), - 'linePrefix' - ) - ) - ); - return initial - - function atBlankEnding(code) { - if (code === null) { - effects.consume(code); - return - } - - effects.enter('lineEndingBlank'); - effects.consume(code); - effects.exit('lineEndingBlank'); - self.currentConstruct = undefined; - return initial - } - - function afterConstruct(code) { - if (code === null) { - effects.consume(code); - return - } - - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - self.currentConstruct = undefined; - return initial - } -} - -flow$7.tokenize = tokenize; - -var text$5 = {}; - -Object.defineProperty(text$5, '__esModule', {value: true}); - -var assign$2 = assign_1; -var shallow$4 = shallow_1; - -var text$4 = initializeFactory('text'); -var string$1 = initializeFactory('string'); -var resolver = { - resolveAll: createResolver() -}; - -function initializeFactory(field) { - return { - tokenize: initializeText, - resolveAll: createResolver( - field === 'text' ? resolveAllLineSuffixes : undefined - ) - } - - function initializeText(effects) { - var self = this; - var constructs = this.parser.constructs[field]; - var text = effects.attempt(constructs, start, notText); - return start - - function start(code) { - return atBreak(code) ? text(code) : notText(code) - } - - function notText(code) { - if (code === null) { - effects.consume(code); - return - } - - effects.enter('data'); - effects.consume(code); - return data - } - - function data(code) { - if (atBreak(code)) { - effects.exit('data'); - return text(code) - } // Data. - - effects.consume(code); - return data - } - - function atBreak(code) { - var list = constructs[code]; - var index = -1; - - if (code === null) { - return true - } - - if (list) { - while (++index < list.length) { - if ( - !list[index].previous || - list[index].previous.call(self, self.previous) - ) { - return true + while (indexBeforeFlow--) { + if ( + self.events[indexBeforeFlow][0] === 'exit' && + self.events[indexBeforeFlow][1].type === 'chunkFlow' + ) { + if (seen) { + point = self.events[indexBeforeFlow][1].end; + break } - } - } - } - } -} -function createResolver(extraResolver) { - return resolveAllText - - function resolveAllText(events, context) { - var index = -1; - var enter; // A rather boring computation (to merge adjacent `data` events) which - // improves mm performance by 29%. - - while (++index <= events.length) { - if (enter === undefined) { - if (events[index] && events[index][1].type === 'data') { - enter = index; - index++; + seen = true; } - } else if (!events[index] || events[index][1].type !== 'data') { - // Don’t do anything if there is one data token. - if (index !== enter + 2) { - events[enter][1].end = events[index - 1][1].end; - events.splice(enter + 2, index - enter - 2); - index = enter + 2; - } - - enter = undefined; } - } - return extraResolver ? extraResolver(events, context) : events - } -} // A rather ugly set of instructions which again looks at chunks in the input -// stream. -// The reason to do this here is that it is *much* faster to parse in reverse. -// And that we can’t hook into `null` to split the line suffix before an EOF. -// To do: figure out if we can make this into a clean utility, or even in core. -// As it will be useful for GFMs literal autolink extension (and maybe even -// tables?) - -function resolveAllLineSuffixes(events, context) { - var eventIndex = -1; - var chunks; - var data; - var chunk; - var index; - var bufferIndex; - var size; - var tabs; - var token; - - while (++eventIndex <= events.length) { - if ( - (eventIndex === events.length || - events[eventIndex][1].type === 'lineEnding') && - events[eventIndex - 1][1].type === 'data' - ) { - data = events[eventIndex - 1][1]; - chunks = context.sliceStream(data); - index = chunks.length; - bufferIndex = -1; - size = 0; - tabs = undefined; - - while (index--) { - chunk = chunks[index]; - - if (typeof chunk === 'string') { - bufferIndex = chunk.length; + exitContainers(continued); // Fix positions. - while (chunk.charCodeAt(bufferIndex - 1) === 32) { - size++; - bufferIndex--; - } - - if (bufferIndex) break - bufferIndex = -1; - } // Number - else if (chunk === -2) { - tabs = true; - size++; - } else if (chunk === -1); - else { - // Replacement character, exit. - index++; - break - } - } + index = indexBeforeExits; - if (size) { - token = { - type: - eventIndex === events.length || tabs || size < 2 - ? 'lineSuffix' - : 'hardBreakTrailing', - start: { - line: data.end.line, - column: data.end.column - size, - offset: data.end.offset - size, - _index: data.start._index + index, - _bufferIndex: index - ? bufferIndex - : data.start._bufferIndex + bufferIndex - }, - end: shallow$4(data.end) - }; - data.end = shallow$4(token.start); + while (index < self.events.length) { + self.events[index][1].end = Object.assign({}, point); + index++; + } // Inject the exits earlier (they’re still also at the end). - if (data.start.offset === data.end.offset) { - assign$2(data, token); - } else { - events.splice( - eventIndex, - 0, - ['enter', token, context], - ['exit', token, context] - ); - eventIndex += 2; - } - } + splice( + self.events, + indexBeforeFlow + 1, + 0, + self.events.slice(indexBeforeExits) + ); // Discard the duplicate exits. - eventIndex++; + self.events.length = index; } } + /** + * @param {number} size + * @returns {void} + */ - return events -} - -text$5.resolver = resolver; -text$5.string = string$1; -text$5.text = text$4; - -function miniflat$3(value) { - return value === null || value === undefined - ? [] - : 'length' in value - ? value - : [value] -} - -var miniflat_1 = miniflat$3; - -var hasOwnProperty$1 = hasOwnProperty$2; -var chunkedSplice$6 = chunkedSplice_1; -var miniflat$2 = miniflat_1; + function exitContainers(size) { + let index = stack.length; // Exit open containers. -function combineExtensions$2(extensions) { - var all = {}; - var index = -1; + while (index-- > size) { + const entry = stack[index]; + self.containerState = entry[1]; + entry[0].exit.call(self, effects); + } - while (++index < extensions.length) { - extension$1(all, extensions[index]); + stack.length = size; } - return all -} - -function extension$1(all, extension) { - var hook; - var left; - var right; - var code; - - for (hook in extension) { - left = hasOwnProperty$1.call(all, hook) ? all[hook] : (all[hook] = {}); - right = extension[hook]; - - for (code in right) { - left[code] = constructs$3( - miniflat$2(right[code]), - hasOwnProperty$1.call(left, code) ? left[code] : [] - ); - } + function closeFlow() { + childFlow.write([null]); + childToken = undefined; + childFlow = undefined; + self.containerState._closeFlow = undefined; } } +/** @type {Tokenizer} */ -function constructs$3(list, existing) { - var index = -1; - var before = []; - - while (++index < list.length) { -(list[index].add === 'after' ? existing : before).push(list[index]); - } - - chunkedSplice$6(existing, 0, 0, before); - return existing +function tokenizeContainer(effects, ok, nok) { + return factorySpace( + effects, + effects.attempt(this.parser.constructs.document, ok, nok), + 'linePrefix', + this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + ) } -var combineExtensions_1 = combineExtensions$2; - -var chunkedSplice$5 = chunkedSplice_1; +/** + * @typedef {import('micromark-util-types').Code} Code + */ -function chunkedPush$3(list, items) { - if (list.length) { - chunkedSplice$5(list, list.length, 0, items); - return list +/** + * Classify whether a character code represents whitespace, punctuation, or + * something else. + * + * Used for attention (emphasis, strong), whose sequences can open or close + * based on the class of surrounding characters. + * + * Note that eof (`null`) is seen as whitespace. + * + * @param {Code} code + * @returns {number|undefined} + */ +function classifyCharacter(code) { + if ( + code === null || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return 1 } - return items + if (unicodePunctuation(code)) { + return 2 + } } -var chunkedPush_1 = chunkedPush$3; +/** + * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext + * @typedef {import('micromark-util-types').Event} Event + * @typedef {import('micromark-util-types').Resolver} Resolver + */ -function resolveAll$4(constructs, events, context) { - var called = []; - var index = -1; - var resolve; +/** + * Call all `resolveAll`s. + * + * @param {{resolveAll?: Resolver}[]} constructs + * @param {Event[]} events + * @param {TokenizeContext} context + * @returns {Event[]} + */ +function resolveAll(constructs, events, context) { + /** @type {Resolver[]} */ + const called = []; + let index = -1; while (++index < constructs.length) { - resolve = constructs[index].resolveAll; + const resolve = constructs[index].resolveAll; - if (resolve && called.indexOf(resolve) < 0) { + if (resolve && !called.includes(resolve)) { events = resolve(events, context); called.push(resolve); } @@ -29673,491 +34714,55 @@ function resolveAll$4(constructs, events, context) { return events } -var resolveAll_1 = resolveAll$4; - -var fromCharCode$2 = fromCharCode_1; - -function serializeChunks$1(chunks) { - var index = -1; - var result = []; - var chunk; - var value; - var atTab; - - while (++index < chunks.length) { - chunk = chunks[index]; - - if (typeof chunk === 'string') { - value = chunk; - } else if (chunk === -5) { - value = '\r'; - } else if (chunk === -4) { - value = '\n'; - } else if (chunk === -3) { - value = '\r' + '\n'; - } else if (chunk === -2) { - value = '\t'; - } else if (chunk === -1) { - if (atTab) continue - value = ' '; - } else { - // Currently only replacement character. - value = fromCharCode$2(chunk); - } - - atTab = chunk === -2; - result.push(value); - } - - return result.join('') -} - -var serializeChunks_1 = serializeChunks$1; - -function sliceChunks$1(chunks, token) { - var startIndex = token.start._index; - var startBufferIndex = token.start._bufferIndex; - var endIndex = token.end._index; - var endBufferIndex = token.end._bufferIndex; - var view; - - if (startIndex === endIndex) { - view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; - } else { - view = chunks.slice(startIndex, endIndex); - - if (startBufferIndex > -1) { - view[0] = view[0].slice(startBufferIndex); - } - - if (endBufferIndex > 0) { - view.push(chunks[endIndex].slice(0, endBufferIndex)); - } - } - - return view -} - -var sliceChunks_1 = sliceChunks$1; - -var assign$1 = assign_1; -var markdownLineEnding$f = markdownLineEnding_1; -var chunkedPush$2 = chunkedPush_1; -var chunkedSplice$4 = chunkedSplice_1; -var miniflat$1 = miniflat_1; -var resolveAll$3 = resolveAll_1; -var serializeChunks = serializeChunks_1; -var shallow$3 = shallow_1; -var sliceChunks = sliceChunks_1; - -// Create a tokenizer. -// Tokenizers deal with one type of data (e.g., containers, flow, text). -// The parser is the object dealing with it all. -// `initialize` works like other constructs, except that only its `tokenize` -// function is used, in which case it doesn’t receive an `ok` or `nok`. -// `from` can be given to set the point before the first character, although -// when further lines are indented, they must be set with `defineSkip`. -function createTokenizer$1(parser, initialize, from) { - var point = from - ? shallow$3(from) - : { - line: 1, - column: 1, - offset: 0 - }; - var columnStart = {}; - var resolveAllConstructs = []; - var chunks = []; - var stack = []; - - var effects = { - consume: consume, - enter: enter, - exit: exit, - attempt: constructFactory(onsuccessfulconstruct), - check: constructFactory(onsuccessfulcheck), - interrupt: constructFactory(onsuccessfulcheck, { - interrupt: true - }), - lazy: constructFactory(onsuccessfulcheck, { - lazy: true - }) - }; // State and tools for resolving and serializing. - - var context = { - previous: null, - events: [], - parser: parser, - sliceStream: sliceStream, - sliceSerialize: sliceSerialize, - now: now, - defineSkip: skip, - write: write - }; // The state function. - - var state = initialize.tokenize.call(context, effects); // Track which character we expect to be consumed, to catch bugs. - - if (initialize.resolveAll) { - resolveAllConstructs.push(initialize); - } // Store where we are in the input stream. - - point._index = 0; - point._bufferIndex = -1; - return context - - function write(slice) { - chunks = chunkedPush$2(chunks, slice); - main(); // Exit if we’re not done, resolve might change stuff. - - if (chunks[chunks.length - 1] !== null) { - return [] - } - - addResult(initialize, 0); // Otherwise, resolve, and exit. - - context.events = resolveAll$3(resolveAllConstructs, context.events, context); - return context.events - } // - // Tools. - // - - function sliceSerialize(token) { - return serializeChunks(sliceStream(token)) - } - - function sliceStream(token) { - return sliceChunks(chunks, token) - } - - function now() { - return shallow$3(point) - } - - function skip(value) { - columnStart[value.line] = value.column; - accountForPotentialSkip(); - } // - // State management. - // - // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by - // `consume`). - // Here is where we walk through the chunks, which either include strings of - // several characters, or numerical character codes. - // The reason to do this in a loop instead of a call is so the stack can - // drain. - - function main() { - var chunkIndex; - var chunk; - - while (point._index < chunks.length) { - chunk = chunks[point._index]; // If we’re in a buffer chunk, loop through it. - - if (typeof chunk === 'string') { - chunkIndex = point._index; - - if (point._bufferIndex < 0) { - point._bufferIndex = 0; - } - - while ( - point._index === chunkIndex && - point._bufferIndex < chunk.length - ) { - go(chunk.charCodeAt(point._bufferIndex)); - } - } else { - go(chunk); - } - } - } // Deal with one code. - - function go(code) { - state = state(code); - } // Move a character forward. - - function consume(code) { - if (markdownLineEnding$f(code)) { - point.line++; - point.column = 1; - point.offset += code === -3 ? 2 : 1; - accountForPotentialSkip(); - } else if (code !== -1) { - point.column++; - point.offset++; - } // Not in a string chunk. - - if (point._bufferIndex < 0) { - point._index++; - } else { - point._bufferIndex++; // At end of string chunk. - - if (point._bufferIndex === chunks[point._index].length) { - point._bufferIndex = -1; - point._index++; - } - } // Expose the previous character. - - context.previous = code; // Mark as consumed. - } // Start a token. - - function enter(type, fields) { - var token = fields || {}; - token.type = type; - token.start = now(); - context.events.push(['enter', token, context]); - stack.push(token); - return token - } // Stop a token. - - function exit(type) { - var token = stack.pop(); - token.end = now(); - context.events.push(['exit', token, context]); - return token - } // Use results. - - function onsuccessfulconstruct(construct, info) { - addResult(construct, info.from); - } // Discard results. - - function onsuccessfulcheck(construct, info) { - info.restore(); - } // Factory to attempt/check/interrupt. - - function constructFactory(onreturn, fields) { - return hook // Handle either an object mapping codes to constructs, a list of - // constructs, or a single construct. - - function hook(constructs, returnState, bogusState) { - var listOfConstructs; - var constructIndex; - var currentConstruct; - var info; - return constructs.tokenize || 'length' in constructs - ? handleListOfConstructs(miniflat$1(constructs)) - : handleMapOfConstructs - - function handleMapOfConstructs(code) { - if (code in constructs || null in constructs) { - return handleListOfConstructs( - constructs.null - ? /* c8 ignore next */ - miniflat$1(constructs[code]).concat(miniflat$1(constructs.null)) - : constructs[code] - )(code) - } - - return bogusState(code) - } - - function handleListOfConstructs(list) { - listOfConstructs = list; - constructIndex = 0; - return handleConstruct(list[constructIndex]) - } - - function handleConstruct(construct) { - return start - - function start(code) { - // To do: not nede to store if there is no bogus state, probably? - // Currently doesn’t work because `inspect` in document does a check - // w/o a bogus, which doesn’t make sense. But it does seem to help perf - // by not storing. - info = store(); - currentConstruct = construct; - - if (!construct.partial) { - context.currentConstruct = construct; - } - - if ( - construct.name && - context.parser.constructs.disable.null.indexOf(construct.name) > -1 - ) { - return nok() - } - - return construct.tokenize.call( - fields ? assign$1({}, context, fields) : context, - effects, - ok, - nok - )(code) - } - } - - function ok(code) { - onreturn(currentConstruct, info); - return returnState - } - - function nok(code) { - info.restore(); - - if (++constructIndex < listOfConstructs.length) { - return handleConstruct(listOfConstructs[constructIndex]) - } - - return bogusState - } - } - } - - function addResult(construct, from) { - if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) { - resolveAllConstructs.push(construct); - } - - if (construct.resolve) { - chunkedSplice$4( - context.events, - from, - context.events.length - from, - construct.resolve(context.events.slice(from), context) - ); - } - - if (construct.resolveTo) { - context.events = construct.resolveTo(context.events, context); - } - } - - function store() { - var startPoint = now(); - var startPrevious = context.previous; - var startCurrentConstruct = context.currentConstruct; - var startEventsIndex = context.events.length; - var startStack = Array.from(stack); - return { - restore: restore, - from: startEventsIndex - } - - function restore() { - point = startPoint; - context.previous = startPrevious; - context.currentConstruct = startCurrentConstruct; - context.events.length = startEventsIndex; - stack = startStack; - accountForPotentialSkip(); - } - } - - function accountForPotentialSkip() { - if (point.line in columnStart && point.column < 2) { - point.column = columnStart[point.line]; - point.offset += columnStart[point.line] - 1; - } - } -} - -var createTokenizer_1 = createTokenizer$1; - -var constructs$2 = {}; - -function markdownLineEndingOrSpace$9(code) { - return code < 0 || code === 32 -} - -var markdownLineEndingOrSpace_1 = markdownLineEndingOrSpace$9; - -// This module is generated by `script/`. -// -// CommonMark handles attention (emphasis, strong) markers based on what comes -// before or after them. -// One such difference is if those characters are Unicode punctuation. -// This script is generated from the Unicode data. -var unicodePunctuation$3 = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; - -var unicodePunctuationRegex$2 = unicodePunctuation$3; - -var fromCharCode$1 = fromCharCode_1; - -function regexCheck$9(regex) { - return check - - function check(code) { - return regex.test(fromCharCode$1(code)) - } -} - -var regexCheck_1 = regexCheck$9; - -var unicodePunctuationRegex$1 = unicodePunctuationRegex$2; -var regexCheck$8 = regexCheck_1; - -// In fact adds to the bundle size. - -var unicodePunctuation$2 = regexCheck$8(unicodePunctuationRegex$1); - -var unicodePunctuation_1 = unicodePunctuation$2; - -var regexCheck$7 = regexCheck_1; - -var unicodeWhitespace$2 = regexCheck$7(/\s/); - -var unicodeWhitespace_1 = unicodeWhitespace$2; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').Resolver} Resolver + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').Event} Event + * @typedef {import('micromark-util-types').Code} Code + * @typedef {import('micromark-util-types').Point} Point + */ -var markdownLineEndingOrSpace$8 = markdownLineEndingOrSpace_1; -var unicodePunctuation$1 = unicodePunctuation_1; -var unicodeWhitespace$1 = unicodeWhitespace_1; +/** @type {Construct} */ +const attention = { + name: 'attention', + tokenize: tokenizeAttention, + resolveAll: resolveAllAttention +}; +/** + * Take all events and resolve attention to emphasis or strong. + * + * @type {Resolver} + */ -// Classify whether a character is unicode whitespace, unicode punctuation, or -// anything else. -// Used for attention (emphasis, strong), whose sequences can open or close -// based on the class of surrounding characters. -function classifyCharacter$2(code) { - if ( - code === null || - markdownLineEndingOrSpace$8(code) || - unicodeWhitespace$1(code) - ) { - return 1 - } +function resolveAllAttention(events, context) { + let index = -1; + /** @type {number} */ - if (unicodePunctuation$1(code)) { - return 2 - } -} + let open; + /** @type {Token} */ -var classifyCharacter_1 = classifyCharacter$2; + let group; + /** @type {Token} */ -// chunks (replacement characters, tabs, or line endings). + let text; + /** @type {Token} */ -function movePoint$1(point, offset) { - point.column += offset; - point.offset += offset; - point._bufferIndex += offset; - return point -} + let openingSequence; + /** @type {Token} */ -var movePoint_1 = movePoint$1; + let closingSequence; + /** @type {number} */ -var chunkedPush$1 = chunkedPush_1; -var chunkedSplice$3 = chunkedSplice_1; -var classifyCharacter$1 = classifyCharacter_1; -var movePoint = movePoint_1; -var resolveAll$2 = resolveAll_1; -var shallow$2 = shallow_1; + let use; + /** @type {Event[]} */ -var attention$1 = { - name: 'attention', - tokenize: tokenizeAttention, - resolveAll: resolveAllAttention -}; + let nextEvents; + /** @type {number} */ -function resolveAllAttention(events, context) { - var index = -1; - var open; - var group; - var text; - var openingSequence; - var closingSequence; - var use; - var nextEvents; - var offset; // Walk through all events. + let offset; // Walk through all events. // // Note: performance of this is fine on an mb of normal markdown, but it’s // a bottleneck for malicious stuff. @@ -30203,54 +34808,58 @@ function resolveAllAttention(events, context) { events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1; + const start = Object.assign({}, events[open][1].end); + const end = Object.assign({}, events[index][1].start); + movePoint(start, -use); + movePoint(end, use); openingSequence = { type: use > 1 ? 'strongSequence' : 'emphasisSequence', - start: movePoint(shallow$2(events[open][1].end), -use), - end: shallow$2(events[open][1].end) + start, + end: Object.assign({}, events[open][1].end) }; closingSequence = { type: use > 1 ? 'strongSequence' : 'emphasisSequence', - start: shallow$2(events[index][1].start), - end: movePoint(shallow$2(events[index][1].start), use) + start: Object.assign({}, events[index][1].start), + end }; text = { type: use > 1 ? 'strongText' : 'emphasisText', - start: shallow$2(events[open][1].end), - end: shallow$2(events[index][1].start) + start: Object.assign({}, events[open][1].end), + end: Object.assign({}, events[index][1].start) }; group = { type: use > 1 ? 'strong' : 'emphasis', - start: shallow$2(openingSequence.start), - end: shallow$2(closingSequence.end) + start: Object.assign({}, openingSequence.start), + end: Object.assign({}, closingSequence.end) }; - events[open][1].end = shallow$2(openingSequence.start); - events[index][1].start = shallow$2(closingSequence.end); + events[open][1].end = Object.assign({}, openingSequence.start); + events[index][1].start = Object.assign({}, closingSequence.end); nextEvents = []; // If there are more markers in the opening, add them before. if (events[open][1].end.offset - events[open][1].start.offset) { - nextEvents = chunkedPush$1(nextEvents, [ + nextEvents = push(nextEvents, [ ['enter', events[open][1], context], ['exit', events[open][1], context] ]); } // Opening. - nextEvents = chunkedPush$1(nextEvents, [ + nextEvents = push(nextEvents, [ ['enter', group, context], ['enter', openingSequence, context], ['exit', openingSequence, context], ['enter', text, context] ]); // Between. - nextEvents = chunkedPush$1( + nextEvents = push( nextEvents, - resolveAll$2( + resolveAll( context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context ) ); // Closing. - nextEvents = chunkedPush$1(nextEvents, [ + nextEvents = push(nextEvents, [ ['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], @@ -30259,7 +34868,7 @@ function resolveAllAttention(events, context) { if (events[index][1].end.offset - events[index][1].start.offset) { offset = 2; - nextEvents = chunkedPush$1(nextEvents, [ + nextEvents = push(nextEvents, [ ['enter', events[index][1], context], ['exit', events[index][1], context] ]); @@ -30267,7 +34876,7 @@ function resolveAllAttention(events, context) { offset = 0; } - chunkedSplice$3(events, open - 1, index - open + 3, nextEvents); + splice(events, open - 1, index - open + 3, nextEvents); index = open + nextEvents.length - offset - 2; break } @@ -30285,83 +34894,72 @@ function resolveAllAttention(events, context) { return events } +/** @type {Tokenizer} */ function tokenizeAttention(effects, ok) { - var before = classifyCharacter$1(this.previous); - var marker; + const before = classifyCharacter(this.previous); + /** @type {NonNullable<Code>} */ + + let marker; return start + /** @type {State} */ function start(code) { effects.enter('attentionSequence'); marker = code; return sequence(code) } + /** @type {State} */ function sequence(code) { - var token; - var after; - var open; - var close; - if (code === marker) { effects.consume(code); return sequence } - token = effects.exit('attentionSequence'); - after = classifyCharacter$1(code); - open = !after || (after === 2 && before); - close = !before || (before === 2 && after); - token._open = marker === 42 ? open : open && (before || !close); - token._close = marker === 42 ? close : close && (after || !open); + const token = effects.exit('attentionSequence'); + const after = classifyCharacter(code); + const open = !after || (after === 2 && before); + const close = !before || (before === 2 && after); + token._open = Boolean(marker === 42 ? open : open && (before || !close)); + token._close = Boolean(marker === 42 ? close : close && (after || !open)); return ok(code) } } +/** + * Move a point a bit. + * + * Note: `move` only works inside lines! It’s not possible to move past other + * chunks (replacement characters, tabs, or line endings). + * + * @param {Point} point + * @param {number} offset + * @returns {void} + */ -var attention_1 = attention$1; - -var regexCheck$6 = regexCheck_1; - -var asciiAlpha$4 = regexCheck$6(/[A-Za-z]/); - -var asciiAlpha_1 = asciiAlpha$4; - -var regexCheck$5 = regexCheck_1; - -var asciiAlphanumeric$5 = regexCheck$5(/[\dA-Za-z]/); - -var asciiAlphanumeric_1 = asciiAlphanumeric$5; - -var regexCheck$4 = regexCheck_1; - -var asciiAtext$1 = regexCheck$4(/[#-'*+\--9=?A-Z^-~]/); - -var asciiAtext_1 = asciiAtext$1; - -// Note: EOF is seen as ASCII control here, because `null < 32 == true`. -function asciiControl$3(code) { - return ( - // Special whitespace codes (which have negative values), C0 and Control - // character DEL - code < 32 || code === 127 - ) +function movePoint(point, offset) { + point.column += offset; + point.offset += offset; + point._bufferIndex += offset; } -var asciiControl_1 = asciiControl$3; - -var asciiAlpha$3 = asciiAlpha_1; -var asciiAlphanumeric$4 = asciiAlphanumeric_1; -var asciiAtext = asciiAtext_1; -var asciiControl$2 = asciiControl_1; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + */ -var autolink$1 = { +/** @type {Construct} */ +const autolink = { name: 'autolink', tokenize: tokenizeAutolink }; +/** @type {Tokenizer} */ function tokenizeAutolink(effects, ok, nok) { - var size = 1; + let size = 1; return start + /** @type {State} */ function start(code) { effects.enter('autolink'); @@ -30371,21 +34969,24 @@ function tokenizeAutolink(effects, ok, nok) { effects.enter('autolinkProtocol'); return open } + /** @type {State} */ function open(code) { - if (asciiAlpha$3(code)) { + if (asciiAlpha(code)) { effects.consume(code); return schemeOrEmailAtext } return asciiAtext(code) ? emailAtext(code) : nok(code) } + /** @type {State} */ function schemeOrEmailAtext(code) { - return code === 43 || code === 45 || code === 46 || asciiAlphanumeric$4(code) + return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code) ? schemeInsideOrEmailAtext(code) : emailAtext(code) } + /** @type {State} */ function schemeInsideOrEmailAtext(code) { if (code === 58) { @@ -30394,7 +34995,7 @@ function tokenizeAutolink(effects, ok, nok) { } if ( - (code === 43 || code === 45 || code === 46 || asciiAlphanumeric$4(code)) && + (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32 ) { effects.consume(code); @@ -30403,6 +35004,7 @@ function tokenizeAutolink(effects, ok, nok) { return emailAtext(code) } + /** @type {State} */ function urlInside(code) { if (code === 62) { @@ -30410,13 +35012,14 @@ function tokenizeAutolink(effects, ok, nok) { return end(code) } - if (code === 32 || code === 60 || asciiControl$2(code)) { + if (code === null || code === 32 || code === 60 || asciiControl(code)) { return nok(code) } effects.consume(code); return urlInside } + /** @type {State} */ function emailAtext(code) { if (code === 64) { @@ -30432,10 +35035,12 @@ function tokenizeAutolink(effects, ok, nok) { return nok(code) } + /** @type {State} */ function emailAtSignOrDot(code) { - return asciiAlphanumeric$4(code) ? emailLabel(code) : nok(code) + return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) } + /** @type {State} */ function emailLabel(code) { if (code === 46) { @@ -30452,15 +35057,17 @@ function tokenizeAutolink(effects, ok, nok) { return emailValue(code) } + /** @type {State} */ function emailValue(code) { - if ((code === 45 || asciiAlphanumeric$4(code)) && size++ < 63) { + if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { effects.consume(code); return code === 45 ? emailValue : emailLabel } return nok(code) } + /** @type {State} */ function end(code) { effects.enter('autolinkMarker'); @@ -30471,12 +35078,37 @@ function tokenizeAutolink(effects, ok, nok) { } } -var autolink_1 = autolink$1; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + */ + +/** @type {Construct} */ +const blankLine = { + tokenize: tokenizeBlankLine, + partial: true +}; +/** @type {Tokenizer} */ -var markdownSpace$8 = markdownSpace_1; -var factorySpace$c = factorySpace$i; +function tokenizeBlankLine(effects, ok, nok) { + return factorySpace(effects, afterWhitespace, 'linePrefix') + /** @type {State} */ + + function afterWhitespace(code) { + return code === null || markdownLineEnding(code) ? ok(code) : nok(code) + } +} -var blockQuote$1 = { +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').Exiter} Exiter + * @typedef {import('micromark-util-types').State} State + */ + +/** @type {Construct} */ +const blockQuote = { name: 'blockQuote', tokenize: tokenizeBlockQuoteStart, continuation: { @@ -30484,18 +35116,22 @@ var blockQuote$1 = { }, exit: exit$1 }; +/** @type {Tokenizer} */ function tokenizeBlockQuoteStart(effects, ok, nok) { - var self = this; + const self = this; return start + /** @type {State} */ function start(code) { if (code === 62) { - if (!self.containerState.open) { + const state = self.containerState; + + if (!state.open) { effects.enter('blockQuote', { _container: true }); - self.containerState.open = true; + state.open = true; } effects.enter('blockQuotePrefix'); @@ -30507,9 +35143,10 @@ function tokenizeBlockQuoteStart(effects, ok, nok) { return nok(code) } + /** @type {State} */ function after(code) { - if (markdownSpace$8(code)) { + if (markdownSpace(code)) { effects.enter('blockQuotePrefixWhitespace'); effects.consume(code); effects.exit('blockQuotePrefixWhitespace'); @@ -30521,39 +35158,38 @@ function tokenizeBlockQuoteStart(effects, ok, nok) { return ok(code) } } +/** @type {Tokenizer} */ function tokenizeBlockQuoteContinuation(effects, ok, nok) { - return factorySpace$c( + return factorySpace( effects, - effects.attempt(blockQuote$1, ok, nok), + effects.attempt(blockQuote, ok, nok), 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 - ? undefined - : 4 + this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 ) } +/** @type {Exiter} */ function exit$1(effects) { effects.exit('blockQuote'); } -var blockQuote_1 = blockQuote$1; - -var regexCheck$3 = regexCheck_1; - -var asciiPunctuation$1 = regexCheck$3(/[!-/:-@[-`{-~]/); - -var asciiPunctuation_1 = asciiPunctuation$1; - -var asciiPunctuation = asciiPunctuation_1; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + */ -var characterEscape$2 = { +/** @type {Construct} */ +const characterEscape$1 = { name: 'characterEscape', tokenize: tokenizeCharacterEscape }; +/** @type {Tokenizer} */ function tokenizeCharacterEscape(effects, ok, nok) { return start + /** @type {State} */ function start(code) { effects.enter('characterEscape'); @@ -30562,6 +35198,7 @@ function tokenizeCharacterEscape(effects, ok, nok) { effects.exit('escapeMarker'); return open } + /** @type {State} */ function open(code) { if (asciiPunctuation(code)) { @@ -30576,4499 +35213,2269 @@ function tokenizeCharacterEscape(effects, ok, nok) { } } -var characterEscape_1 = characterEscape$2; - -const AEli$2 = "Æ"; -const AElig$2 = "Æ"; -const AM$2 = "&"; -const AMP$2 = "&"; -const Aacut$2 = "Á"; -const Aacute$2 = "Á"; -const Abreve$2 = "Ă"; -const Acir$2 = "Â"; -const Acirc$2 = "Â"; -const Acy$2 = "А"; -const Afr$2 = "𝔄"; -const Agrav$2 = "À"; -const Agrave$2 = "À"; -const Alpha$2 = "Α"; -const Amacr$2 = "Ā"; -const And$2 = "⩓"; -const Aogon$2 = "Ą"; -const Aopf$2 = "𝔸"; -const ApplyFunction$2 = ""; -const Arin$2 = "Å"; -const Aring$2 = "Å"; -const Ascr$2 = "𝒜"; -const Assign$2 = "≔"; -const Atild$2 = "Ã"; -const Atilde$2 = "Ã"; -const Aum$2 = "Ä"; -const Auml$2 = "Ä"; -const Backslash$2 = "∖"; -const Barv$2 = "⫧"; -const Barwed$2 = "⌆"; -const Bcy$2 = "Б"; -const Because$2 = "∵"; -const Bernoullis$2 = "ℬ"; -const Beta$2 = "Β"; -const Bfr$2 = "𝔅"; -const Bopf$2 = "𝔹"; -const Breve$2 = "˘"; -const Bscr$2 = "ℬ"; -const Bumpeq$2 = "≎"; -const CHcy$2 = "Ч"; -const COP$2 = "©"; -const COPY$2 = "©"; -const Cacute$2 = "Ć"; -const Cap$2 = "⋒"; -const CapitalDifferentialD$2 = "ⅅ"; -const Cayleys$2 = "ℭ"; -const Ccaron$2 = "Č"; -const Ccedi$2 = "Ç"; -const Ccedil$2 = "Ç"; -const Ccirc$2 = "Ĉ"; -const Cconint$2 = "∰"; -const Cdot$2 = "Ċ"; -const Cedilla$2 = "¸"; -const CenterDot$2 = "·"; -const Cfr$2 = "ℭ"; -const Chi$2 = "Χ"; -const CircleDot$2 = "⊙"; -const CircleMinus$2 = "⊖"; -const CirclePlus$2 = "⊕"; -const CircleTimes$2 = "⊗"; -const ClockwiseContourIntegral$2 = "∲"; -const CloseCurlyDoubleQuote$2 = "”"; -const CloseCurlyQuote$2 = "’"; -const Colon$2 = "∷"; -const Colone$2 = "⩴"; -const Congruent$2 = "≡"; -const Conint$2 = "∯"; -const ContourIntegral$2 = "∮"; -const Copf$2 = "ℂ"; -const Coproduct$2 = "∐"; -const CounterClockwiseContourIntegral$2 = "∳"; -const Cross$2 = "⨯"; -const Cscr$2 = "𝒞"; -const Cup$2 = "⋓"; -const CupCap$2 = "≍"; -const DD$2 = "ⅅ"; -const DDotrahd$2 = "⤑"; -const DJcy$2 = "Ђ"; -const DScy$2 = "Ѕ"; -const DZcy$2 = "Џ"; -const Dagger$2 = "‡"; -const Darr$2 = "↡"; -const Dashv$2 = "⫤"; -const Dcaron$2 = "Ď"; -const Dcy$2 = "Д"; -const Del$2 = "∇"; -const Delta$2 = "Δ"; -const Dfr$2 = "𝔇"; -const DiacriticalAcute$2 = "´"; -const DiacriticalDot$2 = "˙"; -const DiacriticalDoubleAcute$2 = "˝"; -const DiacriticalGrave$2 = "`"; -const DiacriticalTilde$2 = "˜"; -const Diamond$2 = "⋄"; -const DifferentialD$2 = "ⅆ"; -const Dopf$2 = "𝔻"; -const Dot$2 = "¨"; -const DotDot$2 = "⃜"; -const DotEqual$2 = "≐"; -const DoubleContourIntegral$2 = "∯"; -const DoubleDot$2 = "¨"; -const DoubleDownArrow$2 = "⇓"; -const DoubleLeftArrow$2 = "⇐"; -const DoubleLeftRightArrow$2 = "⇔"; -const DoubleLeftTee$2 = "⫤"; -const DoubleLongLeftArrow$2 = "⟸"; -const DoubleLongLeftRightArrow$2 = "⟺"; -const DoubleLongRightArrow$2 = "⟹"; -const DoubleRightArrow$2 = "⇒"; -const DoubleRightTee$2 = "⊨"; -const DoubleUpArrow$2 = "⇑"; -const DoubleUpDownArrow$2 = "⇕"; -const DoubleVerticalBar$2 = "∥"; -const DownArrow$2 = "↓"; -const DownArrowBar$2 = "⤓"; -const DownArrowUpArrow$2 = "⇵"; -const DownBreve$2 = "̑"; -const DownLeftRightVector$2 = "⥐"; -const DownLeftTeeVector$2 = "⥞"; -const DownLeftVector$2 = "↽"; -const DownLeftVectorBar$2 = "⥖"; -const DownRightTeeVector$2 = "⥟"; -const DownRightVector$2 = "⇁"; -const DownRightVectorBar$2 = "⥗"; -const DownTee$2 = "⊤"; -const DownTeeArrow$2 = "↧"; -const Downarrow$2 = "⇓"; -const Dscr$2 = "𝒟"; -const Dstrok$2 = "Đ"; -const ENG$2 = "Ŋ"; -const ET$2 = "Ð"; -const ETH$2 = "Ð"; -const Eacut$2 = "É"; -const Eacute$2 = "É"; -const Ecaron$2 = "Ě"; -const Ecir$2 = "Ê"; -const Ecirc$2 = "Ê"; -const Ecy$2 = "Э"; -const Edot$2 = "Ė"; -const Efr$2 = "𝔈"; -const Egrav$2 = "È"; -const Egrave$2 = "È"; -const Element$2 = "∈"; -const Emacr$2 = "Ē"; -const EmptySmallSquare$2 = "◻"; -const EmptyVerySmallSquare$2 = "▫"; -const Eogon$2 = "Ę"; -const Eopf$2 = "𝔼"; -const Epsilon$2 = "Ε"; -const Equal$2 = "⩵"; -const EqualTilde$2 = "≂"; -const Equilibrium$2 = "⇌"; -const Escr$2 = "ℰ"; -const Esim$2 = "⩳"; -const Eta$2 = "Η"; -const Eum$2 = "Ë"; -const Euml$2 = "Ë"; -const Exists$2 = "∃"; -const ExponentialE$2 = "ⅇ"; -const Fcy$2 = "Ф"; -const Ffr$2 = "𝔉"; -const FilledSmallSquare$2 = "◼"; -const FilledVerySmallSquare$2 = "▪"; -const Fopf$2 = "𝔽"; -const ForAll$2 = "∀"; -const Fouriertrf$2 = "ℱ"; -const Fscr$2 = "ℱ"; -const GJcy$2 = "Ѓ"; -const G$2 = ">"; -const GT$2 = ">"; -const Gamma$2 = "Γ"; -const Gammad$2 = "Ϝ"; -const Gbreve$2 = "Ğ"; -const Gcedil$2 = "Ģ"; -const Gcirc$2 = "Ĝ"; -const Gcy$2 = "Г"; -const Gdot$2 = "Ġ"; -const Gfr$2 = "𝔊"; -const Gg$2 = "⋙"; -const Gopf$2 = "𝔾"; -const GreaterEqual$2 = "≥"; -const GreaterEqualLess$2 = "⋛"; -const GreaterFullEqual$2 = "≧"; -const GreaterGreater$2 = "⪢"; -const GreaterLess$2 = "≷"; -const GreaterSlantEqual$2 = "⩾"; -const GreaterTilde$2 = "≳"; -const Gscr$2 = "𝒢"; -const Gt$2 = "≫"; -const HARDcy$2 = "Ъ"; -const Hacek$2 = "ˇ"; -const Hat$2 = "^"; -const Hcirc$2 = "Ĥ"; -const Hfr$2 = "ℌ"; -const HilbertSpace$2 = "ℋ"; -const Hopf$2 = "ℍ"; -const HorizontalLine$2 = "─"; -const Hscr$2 = "ℋ"; -const Hstrok$2 = "Ħ"; -const HumpDownHump$2 = "≎"; -const HumpEqual$2 = "≏"; -const IEcy$2 = "Е"; -const IJlig$2 = "IJ"; -const IOcy$2 = "Ё"; -const Iacut$2 = "Í"; -const Iacute$2 = "Í"; -const Icir$2 = "Î"; -const Icirc$2 = "Î"; -const Icy$2 = "И"; -const Idot$2 = "İ"; -const Ifr$2 = "ℑ"; -const Igrav$2 = "Ì"; -const Igrave$2 = "Ì"; -const Im$2 = "ℑ"; -const Imacr$2 = "Ī"; -const ImaginaryI$2 = "ⅈ"; -const Implies$2 = "⇒"; -const Int$2 = "∬"; -const Integral$2 = "∫"; -const Intersection$2 = "⋂"; -const InvisibleComma$2 = ""; -const InvisibleTimes$2 = ""; -const Iogon$2 = "Į"; -const Iopf$2 = "𝕀"; -const Iota$2 = "Ι"; -const Iscr$2 = "ℐ"; -const Itilde$2 = "Ĩ"; -const Iukcy$2 = "І"; -const Ium$2 = "Ï"; -const Iuml$2 = "Ï"; -const Jcirc$2 = "Ĵ"; -const Jcy$2 = "Й"; -const Jfr$2 = "𝔍"; -const Jopf$2 = "𝕁"; -const Jscr$2 = "𝒥"; -const Jsercy$2 = "Ј"; -const Jukcy$2 = "Є"; -const KHcy$2 = "Х"; -const KJcy$2 = "Ќ"; -const Kappa$2 = "Κ"; -const Kcedil$2 = "Ķ"; -const Kcy$2 = "К"; -const Kfr$2 = "𝔎"; -const Kopf$2 = "𝕂"; -const Kscr$2 = "𝒦"; -const LJcy$2 = "Љ"; -const L$2 = "<"; -const LT$2 = "<"; -const Lacute$2 = "Ĺ"; -const Lambda$2 = "Λ"; -const Lang$2 = "⟪"; -const Laplacetrf$2 = "ℒ"; -const Larr$2 = "↞"; -const Lcaron$2 = "Ľ"; -const Lcedil$2 = "Ļ"; -const Lcy$2 = "Л"; -const LeftAngleBracket$2 = "⟨"; -const LeftArrow$2 = "←"; -const LeftArrowBar$2 = "⇤"; -const LeftArrowRightArrow$2 = "⇆"; -const LeftCeiling$2 = "⌈"; -const LeftDoubleBracket$2 = "⟦"; -const LeftDownTeeVector$2 = "⥡"; -const LeftDownVector$2 = "⇃"; -const LeftDownVectorBar$2 = "⥙"; -const LeftFloor$2 = "⌊"; -const LeftRightArrow$2 = "↔"; -const LeftRightVector$2 = "⥎"; -const LeftTee$2 = "⊣"; -const LeftTeeArrow$2 = "↤"; -const LeftTeeVector$2 = "⥚"; -const LeftTriangle$2 = "⊲"; -const LeftTriangleBar$2 = "⧏"; -const LeftTriangleEqual$2 = "⊴"; -const LeftUpDownVector$2 = "⥑"; -const LeftUpTeeVector$2 = "⥠"; -const LeftUpVector$2 = "↿"; -const LeftUpVectorBar$2 = "⥘"; -const LeftVector$2 = "↼"; -const LeftVectorBar$2 = "⥒"; -const Leftarrow$2 = "⇐"; -const Leftrightarrow$2 = "⇔"; -const LessEqualGreater$2 = "⋚"; -const LessFullEqual$2 = "≦"; -const LessGreater$2 = "≶"; -const LessLess$2 = "⪡"; -const LessSlantEqual$2 = "⩽"; -const LessTilde$2 = "≲"; -const Lfr$2 = "𝔏"; -const Ll$2 = "⋘"; -const Lleftarrow$2 = "⇚"; -const Lmidot$2 = "Ŀ"; -const LongLeftArrow$2 = "⟵"; -const LongLeftRightArrow$2 = "⟷"; -const LongRightArrow$2 = "⟶"; -const Longleftarrow$2 = "⟸"; -const Longleftrightarrow$2 = "⟺"; -const Longrightarrow$2 = "⟹"; -const Lopf$2 = "𝕃"; -const LowerLeftArrow$2 = "↙"; -const LowerRightArrow$2 = "↘"; -const Lscr$2 = "ℒ"; -const Lsh$2 = "↰"; -const Lstrok$2 = "Ł"; -const Lt$2 = "≪"; -const Mcy$2 = "М"; -const MediumSpace$2 = " "; -const Mellintrf$2 = "ℳ"; -const Mfr$2 = "𝔐"; -const MinusPlus$2 = "∓"; -const Mopf$2 = "𝕄"; -const Mscr$2 = "ℳ"; -const Mu$2 = "Μ"; -const NJcy$2 = "Њ"; -const Nacute$2 = "Ń"; -const Ncaron$2 = "Ň"; -const Ncedil$2 = "Ņ"; -const Ncy$2 = "Н"; -const NegativeMediumSpace$2 = ""; -const NegativeThickSpace$2 = ""; -const NegativeThinSpace$2 = ""; -const NegativeVeryThinSpace$2 = ""; -const NestedGreaterGreater$2 = "≫"; -const NestedLessLess$2 = "≪"; -const NewLine$2 = "\n"; -const Nfr$2 = "𝔑"; -const NoBreak$2 = ""; -const NonBreakingSpace$2 = " "; -const Nopf$2 = "ℕ"; -const Not$2 = "⫬"; -const NotCongruent$2 = "≢"; -const NotCupCap$2 = "≭"; -const NotDoubleVerticalBar$2 = "∦"; -const NotElement$2 = "∉"; -const NotEqual$2 = "≠"; -const NotEqualTilde$2 = "≂̸"; -const NotExists$2 = "∄"; -const NotGreater$2 = "≯"; -const NotGreaterEqual$2 = "≱"; -const NotGreaterFullEqual$2 = "≧̸"; -const NotGreaterGreater$2 = "≫̸"; -const NotGreaterLess$2 = "≹"; -const NotGreaterSlantEqual$2 = "⩾̸"; -const NotGreaterTilde$2 = "≵"; -const NotHumpDownHump$2 = "≎̸"; -const NotHumpEqual$2 = "≏̸"; -const NotLeftTriangle$2 = "⋪"; -const NotLeftTriangleBar$2 = "⧏̸"; -const NotLeftTriangleEqual$2 = "⋬"; -const NotLess$2 = "≮"; -const NotLessEqual$2 = "≰"; -const NotLessGreater$2 = "≸"; -const NotLessLess$2 = "≪̸"; -const NotLessSlantEqual$2 = "⩽̸"; -const NotLessTilde$2 = "≴"; -const NotNestedGreaterGreater$2 = "⪢̸"; -const NotNestedLessLess$2 = "⪡̸"; -const NotPrecedes$2 = "⊀"; -const NotPrecedesEqual$2 = "⪯̸"; -const NotPrecedesSlantEqual$2 = "⋠"; -const NotReverseElement$2 = "∌"; -const NotRightTriangle$2 = "⋫"; -const NotRightTriangleBar$2 = "⧐̸"; -const NotRightTriangleEqual$2 = "⋭"; -const NotSquareSubset$2 = "⊏̸"; -const NotSquareSubsetEqual$2 = "⋢"; -const NotSquareSuperset$2 = "⊐̸"; -const NotSquareSupersetEqual$2 = "⋣"; -const NotSubset$2 = "⊂⃒"; -const NotSubsetEqual$2 = "⊈"; -const NotSucceeds$2 = "⊁"; -const NotSucceedsEqual$2 = "⪰̸"; -const NotSucceedsSlantEqual$2 = "⋡"; -const NotSucceedsTilde$2 = "≿̸"; -const NotSuperset$2 = "⊃⃒"; -const NotSupersetEqual$2 = "⊉"; -const NotTilde$2 = "≁"; -const NotTildeEqual$2 = "≄"; -const NotTildeFullEqual$2 = "≇"; -const NotTildeTilde$2 = "≉"; -const NotVerticalBar$2 = "∤"; -const Nscr$2 = "𝒩"; -const Ntild$2 = "Ñ"; -const Ntilde$2 = "Ñ"; -const Nu$2 = "Ν"; -const OElig$2 = "Œ"; -const Oacut$2 = "Ó"; -const Oacute$2 = "Ó"; -const Ocir$2 = "Ô"; -const Ocirc$2 = "Ô"; -const Ocy$2 = "О"; -const Odblac$2 = "Ő"; -const Ofr$2 = "𝔒"; -const Ograv$2 = "Ò"; -const Ograve$2 = "Ò"; -const Omacr$2 = "Ō"; -const Omega$2 = "Ω"; -const Omicron$2 = "Ο"; -const Oopf$2 = "𝕆"; -const OpenCurlyDoubleQuote$2 = "“"; -const OpenCurlyQuote$2 = "‘"; -const Or$2 = "⩔"; -const Oscr$2 = "𝒪"; -const Oslas$2 = "Ø"; -const Oslash$2 = "Ø"; -const Otild$2 = "Õ"; -const Otilde$2 = "Õ"; -const Otimes$2 = "⨷"; -const Oum$2 = "Ö"; -const Ouml$2 = "Ö"; -const OverBar$2 = "‾"; -const OverBrace$2 = "⏞"; -const OverBracket$2 = "⎴"; -const OverParenthesis$2 = "⏜"; -const PartialD$2 = "∂"; -const Pcy$2 = "П"; -const Pfr$2 = "𝔓"; -const Phi$2 = "Φ"; -const Pi$2 = "Π"; -const PlusMinus$2 = "±"; -const Poincareplane$2 = "ℌ"; -const Popf$2 = "ℙ"; -const Pr$2 = "⪻"; -const Precedes$2 = "≺"; -const PrecedesEqual$2 = "⪯"; -const PrecedesSlantEqual$2 = "≼"; -const PrecedesTilde$2 = "≾"; -const Prime$2 = "″"; -const Product$2 = "∏"; -const Proportion$2 = "∷"; -const Proportional$2 = "∝"; -const Pscr$2 = "𝒫"; -const Psi$2 = "Ψ"; -const QUO$2 = "\""; -const QUOT$2 = "\""; -const Qfr$2 = "𝔔"; -const Qopf$2 = "ℚ"; -const Qscr$2 = "𝒬"; -const RBarr$2 = "⤐"; -const RE$2 = "®"; -const REG$2 = "®"; -const Racute$2 = "Ŕ"; -const Rang$2 = "⟫"; -const Rarr$2 = "↠"; -const Rarrtl$2 = "⤖"; -const Rcaron$2 = "Ř"; -const Rcedil$2 = "Ŗ"; -const Rcy$2 = "Р"; -const Re$2 = "ℜ"; -const ReverseElement$2 = "∋"; -const ReverseEquilibrium$2 = "⇋"; -const ReverseUpEquilibrium$2 = "⥯"; -const Rfr$2 = "ℜ"; -const Rho$2 = "Ρ"; -const RightAngleBracket$2 = "⟩"; -const RightArrow$2 = "→"; -const RightArrowBar$2 = "⇥"; -const RightArrowLeftArrow$2 = "⇄"; -const RightCeiling$2 = "⌉"; -const RightDoubleBracket$2 = "⟧"; -const RightDownTeeVector$2 = "⥝"; -const RightDownVector$2 = "⇂"; -const RightDownVectorBar$2 = "⥕"; -const RightFloor$2 = "⌋"; -const RightTee$2 = "⊢"; -const RightTeeArrow$2 = "↦"; -const RightTeeVector$2 = "⥛"; -const RightTriangle$2 = "⊳"; -const RightTriangleBar$2 = "⧐"; -const RightTriangleEqual$2 = "⊵"; -const RightUpDownVector$2 = "⥏"; -const RightUpTeeVector$2 = "⥜"; -const RightUpVector$2 = "↾"; -const RightUpVectorBar$2 = "⥔"; -const RightVector$2 = "⇀"; -const RightVectorBar$2 = "⥓"; -const Rightarrow$2 = "⇒"; -const Ropf$2 = "ℝ"; -const RoundImplies$2 = "⥰"; -const Rrightarrow$2 = "⇛"; -const Rscr$2 = "ℛ"; -const Rsh$2 = "↱"; -const RuleDelayed$2 = "⧴"; -const SHCHcy$2 = "Щ"; -const SHcy$2 = "Ш"; -const SOFTcy$2 = "Ь"; -const Sacute$2 = "Ś"; -const Sc$2 = "⪼"; -const Scaron$2 = "Š"; -const Scedil$2 = "Ş"; -const Scirc$2 = "Ŝ"; -const Scy$2 = "С"; -const Sfr$2 = "𝔖"; -const ShortDownArrow$2 = "↓"; -const ShortLeftArrow$2 = "←"; -const ShortRightArrow$2 = "→"; -const ShortUpArrow$2 = "↑"; -const Sigma$2 = "Σ"; -const SmallCircle$2 = "∘"; -const Sopf$2 = "𝕊"; -const Sqrt$2 = "√"; -const Square$2 = "□"; -const SquareIntersection$2 = "⊓"; -const SquareSubset$2 = "⊏"; -const SquareSubsetEqual$2 = "⊑"; -const SquareSuperset$2 = "⊐"; -const SquareSupersetEqual$2 = "⊒"; -const SquareUnion$2 = "⊔"; -const Sscr$2 = "𝒮"; -const Star$2 = "⋆"; -const Sub$2 = "⋐"; -const Subset$2 = "⋐"; -const SubsetEqual$2 = "⊆"; -const Succeeds$2 = "≻"; -const SucceedsEqual$2 = "⪰"; -const SucceedsSlantEqual$2 = "≽"; -const SucceedsTilde$2 = "≿"; -const SuchThat$2 = "∋"; -const Sum$2 = "∑"; -const Sup$2 = "⋑"; -const Superset$2 = "⊃"; -const SupersetEqual$2 = "⊇"; -const Supset$2 = "⋑"; -const THOR$2 = "Þ"; -const THORN$2 = "Þ"; -const TRADE$2 = "™"; -const TSHcy$2 = "Ћ"; -const TScy$2 = "Ц"; -const Tab$2 = "\t"; -const Tau$2 = "Τ"; -const Tcaron$2 = "Ť"; -const Tcedil$2 = "Ţ"; -const Tcy$2 = "Т"; -const Tfr$2 = "𝔗"; -const Therefore$2 = "∴"; -const Theta$2 = "Θ"; -const ThickSpace$2 = " "; -const ThinSpace$2 = " "; -const Tilde$2 = "∼"; -const TildeEqual$2 = "≃"; -const TildeFullEqual$2 = "≅"; -const TildeTilde$2 = "≈"; -const Topf$2 = "𝕋"; -const TripleDot$2 = "⃛"; -const Tscr$2 = "𝒯"; -const Tstrok$2 = "Ŧ"; -const Uacut$2 = "Ú"; -const Uacute$2 = "Ú"; -const Uarr$2 = "↟"; -const Uarrocir$2 = "⥉"; -const Ubrcy$2 = "Ў"; -const Ubreve$2 = "Ŭ"; -const Ucir$2 = "Û"; -const Ucirc$2 = "Û"; -const Ucy$2 = "У"; -const Udblac$2 = "Ű"; -const Ufr$2 = "𝔘"; -const Ugrav$2 = "Ù"; -const Ugrave$2 = "Ù"; -const Umacr$2 = "Ū"; -const UnderBar$2 = "_"; -const UnderBrace$2 = "⏟"; -const UnderBracket$2 = "⎵"; -const UnderParenthesis$2 = "⏝"; -const Union$2 = "⋃"; -const UnionPlus$2 = "⊎"; -const Uogon$2 = "Ų"; -const Uopf$2 = "𝕌"; -const UpArrow$2 = "↑"; -const UpArrowBar$2 = "⤒"; -const UpArrowDownArrow$2 = "⇅"; -const UpDownArrow$2 = "↕"; -const UpEquilibrium$2 = "⥮"; -const UpTee$2 = "⊥"; -const UpTeeArrow$2 = "↥"; -const Uparrow$2 = "⇑"; -const Updownarrow$2 = "⇕"; -const UpperLeftArrow$2 = "↖"; -const UpperRightArrow$2 = "↗"; -const Upsi$2 = "ϒ"; -const Upsilon$2 = "Υ"; -const Uring$2 = "Ů"; -const Uscr$2 = "𝒰"; -const Utilde$2 = "Ũ"; -const Uum$2 = "Ü"; -const Uuml$2 = "Ü"; -const VDash$2 = "⊫"; -const Vbar$2 = "⫫"; -const Vcy$2 = "В"; -const Vdash$2 = "⊩"; -const Vdashl$2 = "⫦"; -const Vee$2 = "⋁"; -const Verbar$2 = "‖"; -const Vert$2 = "‖"; -const VerticalBar$2 = "∣"; -const VerticalLine$2 = "|"; -const VerticalSeparator$2 = "❘"; -const VerticalTilde$2 = "≀"; -const VeryThinSpace$2 = " "; -const Vfr$2 = "𝔙"; -const Vopf$2 = "𝕍"; -const Vscr$2 = "𝒱"; -const Vvdash$2 = "⊪"; -const Wcirc$2 = "Ŵ"; -const Wedge$2 = "⋀"; -const Wfr$2 = "𝔚"; -const Wopf$2 = "𝕎"; -const Wscr$2 = "𝒲"; -const Xfr$2 = "𝔛"; -const Xi$2 = "Ξ"; -const Xopf$2 = "𝕏"; -const Xscr$2 = "𝒳"; -const YAcy$2 = "Я"; -const YIcy$2 = "Ї"; -const YUcy$2 = "Ю"; -const Yacut$2 = "Ý"; -const Yacute$2 = "Ý"; -const Ycirc$2 = "Ŷ"; -const Ycy$2 = "Ы"; -const Yfr$2 = "𝔜"; -const Yopf$2 = "𝕐"; -const Yscr$2 = "𝒴"; -const Yuml$2 = "Ÿ"; -const ZHcy$2 = "Ж"; -const Zacute$2 = "Ź"; -const Zcaron$2 = "Ž"; -const Zcy$2 = "З"; -const Zdot$2 = "Ż"; -const ZeroWidthSpace$2 = ""; -const Zeta$2 = "Ζ"; -const Zfr$2 = "ℨ"; -const Zopf$2 = "ℤ"; -const Zscr$2 = "𝒵"; -const aacut$2 = "á"; -const aacute$2 = "á"; -const abreve$2 = "ă"; -const ac$2 = "∾"; -const acE$2 = "∾̳"; -const acd$2 = "∿"; -const acir$2 = "â"; -const acirc$2 = "â"; -const acut$2 = "´"; -const acute$2 = "´"; -const acy$2 = "а"; -const aeli$2 = "æ"; -const aelig$2 = "æ"; -const af$2 = ""; -const afr$2 = "𝔞"; -const agrav$2 = "à"; -const agrave$2 = "à"; -const alefsym$2 = "ℵ"; -const aleph$2 = "ℵ"; -const alpha$2 = "α"; -const amacr$2 = "ā"; -const amalg$2 = "⨿"; -const am$2 = "&"; -const amp$2 = "&"; -const and$2 = "∧"; -const andand$2 = "⩕"; -const andd$2 = "⩜"; -const andslope$2 = "⩘"; -const andv$2 = "⩚"; -const ang$2 = "∠"; -const ange$2 = "⦤"; -const angle$2 = "∠"; -const angmsd$2 = "∡"; -const angmsdaa$2 = "⦨"; -const angmsdab$2 = "⦩"; -const angmsdac$2 = "⦪"; -const angmsdad$2 = "⦫"; -const angmsdae$2 = "⦬"; -const angmsdaf$2 = "⦭"; -const angmsdag$2 = "⦮"; -const angmsdah$2 = "⦯"; -const angrt$2 = "∟"; -const angrtvb$2 = "⊾"; -const angrtvbd$2 = "⦝"; -const angsph$2 = "∢"; -const angst$2 = "Å"; -const angzarr$2 = "⍼"; -const aogon$2 = "ą"; -const aopf$2 = "𝕒"; -const ap$2 = "≈"; -const apE$2 = "⩰"; -const apacir$2 = "⩯"; -const ape$2 = "≊"; -const apid$2 = "≋"; -const apos$2 = "'"; -const approx$2 = "≈"; -const approxeq$2 = "≊"; -const arin$2 = "å"; -const aring$2 = "å"; -const ascr$2 = "𝒶"; -const ast$2 = "*"; -const asymp$2 = "≈"; -const asympeq$2 = "≍"; -const atild$2 = "ã"; -const atilde$2 = "ã"; -const aum$2 = "ä"; -const auml$2 = "ä"; -const awconint$2 = "∳"; -const awint$2 = "⨑"; -const bNot$2 = "⫭"; -const backcong$2 = "≌"; -const backepsilon$2 = "϶"; -const backprime$2 = "‵"; -const backsim$2 = "∽"; -const backsimeq$2 = "⋍"; -const barvee$2 = "⊽"; -const barwed$2 = "⌅"; -const barwedge$2 = "⌅"; -const bbrk$2 = "⎵"; -const bbrktbrk$2 = "⎶"; -const bcong$2 = "≌"; -const bcy$2 = "б"; -const bdquo$2 = "„"; -const becaus$2 = "∵"; -const because$2 = "∵"; -const bemptyv$2 = "⦰"; -const bepsi$2 = "϶"; -const bernou$2 = "ℬ"; -const beta$2 = "β"; -const beth$2 = "ℶ"; -const between$2 = "≬"; -const bfr$2 = "𝔟"; -const bigcap$2 = "⋂"; -const bigcirc$2 = "◯"; -const bigcup$2 = "⋃"; -const bigodot$2 = "⨀"; -const bigoplus$2 = "⨁"; -const bigotimes$2 = "⨂"; -const bigsqcup$2 = "⨆"; -const bigstar$2 = "★"; -const bigtriangledown$2 = "▽"; -const bigtriangleup$2 = "△"; -const biguplus$2 = "⨄"; -const bigvee$2 = "⋁"; -const bigwedge$2 = "⋀"; -const bkarow$2 = "⤍"; -const blacklozenge$2 = "⧫"; -const blacksquare$2 = "▪"; -const blacktriangle$2 = "▴"; -const blacktriangledown$2 = "▾"; -const blacktriangleleft$2 = "◂"; -const blacktriangleright$2 = "▸"; -const blank$2 = "␣"; -const blk12$2 = "▒"; -const blk14$2 = "░"; -const blk34$2 = "▓"; -const block$2 = "█"; -const bne$2 = "=⃥"; -const bnequiv$2 = "≡⃥"; -const bnot$2 = "⌐"; -const bopf$2 = "𝕓"; -const bot$2 = "⊥"; -const bottom$2 = "⊥"; -const bowtie$2 = "⋈"; -const boxDL$2 = "╗"; -const boxDR$2 = "╔"; -const boxDl$2 = "╖"; -const boxDr$2 = "╓"; -const boxH$2 = "═"; -const boxHD$2 = "╦"; -const boxHU$2 = "╩"; -const boxHd$2 = "╤"; -const boxHu$2 = "╧"; -const boxUL$2 = "╝"; -const boxUR$2 = "╚"; -const boxUl$2 = "╜"; -const boxUr$2 = "╙"; -const boxV$2 = "║"; -const boxVH$2 = "╬"; -const boxVL$2 = "╣"; -const boxVR$2 = "╠"; -const boxVh$2 = "╫"; -const boxVl$2 = "╢"; -const boxVr$2 = "╟"; -const boxbox$2 = "⧉"; -const boxdL$2 = "╕"; -const boxdR$2 = "╒"; -const boxdl$2 = "┐"; -const boxdr$2 = "┌"; -const boxh$2 = "─"; -const boxhD$2 = "╥"; -const boxhU$2 = "╨"; -const boxhd$2 = "┬"; -const boxhu$2 = "┴"; -const boxminus$2 = "⊟"; -const boxplus$2 = "⊞"; -const boxtimes$2 = "⊠"; -const boxuL$2 = "╛"; -const boxuR$2 = "╘"; -const boxul$2 = "┘"; -const boxur$2 = "└"; -const boxv$2 = "│"; -const boxvH$2 = "╪"; -const boxvL$2 = "╡"; -const boxvR$2 = "╞"; -const boxvh$2 = "┼"; -const boxvl$2 = "┤"; -const boxvr$2 = "├"; -const bprime$2 = "‵"; -const breve$2 = "˘"; -const brvba$2 = "¦"; -const brvbar$2 = "¦"; -const bscr$2 = "𝒷"; -const bsemi$2 = "⁏"; -const bsim$2 = "∽"; -const bsime$2 = "⋍"; -const bsol$2 = "\\"; -const bsolb$2 = "⧅"; -const bsolhsub$2 = "⟈"; -const bull$2 = "•"; -const bullet$2 = "•"; -const bump$2 = "≎"; -const bumpE$2 = "⪮"; -const bumpe$2 = "≏"; -const bumpeq$2 = "≏"; -const cacute$2 = "ć"; -const cap$2 = "∩"; -const capand$2 = "⩄"; -const capbrcup$2 = "⩉"; -const capcap$2 = "⩋"; -const capcup$2 = "⩇"; -const capdot$2 = "⩀"; -const caps$2 = "∩︀"; -const caret$2 = "⁁"; -const caron$2 = "ˇ"; -const ccaps$2 = "⩍"; -const ccaron$2 = "č"; -const ccedi$2 = "ç"; -const ccedil$2 = "ç"; -const ccirc$2 = "ĉ"; -const ccups$2 = "⩌"; -const ccupssm$2 = "⩐"; -const cdot$2 = "ċ"; -const cedi$2 = "¸"; -const cedil$2 = "¸"; -const cemptyv$2 = "⦲"; -const cen$2 = "¢"; -const cent$2 = "¢"; -const centerdot$2 = "·"; -const cfr$2 = "𝔠"; -const chcy$2 = "ч"; -const check$3 = "✓"; -const checkmark$2 = "✓"; -const chi$2 = "χ"; -const cir$2 = "○"; -const cirE$2 = "⧃"; -const circ$2 = "ˆ"; -const circeq$2 = "≗"; -const circlearrowleft$2 = "↺"; -const circlearrowright$2 = "↻"; -const circledR$2 = "®"; -const circledS$2 = "Ⓢ"; -const circledast$2 = "⊛"; -const circledcirc$2 = "⊚"; -const circleddash$2 = "⊝"; -const cire$2 = "≗"; -const cirfnint$2 = "⨐"; -const cirmid$2 = "⫯"; -const cirscir$2 = "⧂"; -const clubs$2 = "♣"; -const clubsuit$2 = "♣"; -const colon$2 = ":"; -const colone$2 = "≔"; -const coloneq$2 = "≔"; -const comma$2 = ","; -const commat$2 = "@"; -const comp$2 = "∁"; -const compfn$2 = "∘"; -const complement$2 = "∁"; -const complexes$2 = "ℂ"; -const cong$2 = "≅"; -const congdot$2 = "⩭"; -const conint$2 = "∮"; -const copf$2 = "𝕔"; -const coprod$2 = "∐"; -const cop$2 = "©"; -const copy$2 = "©"; -const copysr$2 = "℗"; -const crarr$2 = "↵"; -const cross$2 = "✗"; -const cscr$2 = "𝒸"; -const csub$2 = "⫏"; -const csube$2 = "⫑"; -const csup$2 = "⫐"; -const csupe$2 = "⫒"; -const ctdot$2 = "⋯"; -const cudarrl$2 = "⤸"; -const cudarrr$2 = "⤵"; -const cuepr$2 = "⋞"; -const cuesc$2 = "⋟"; -const cularr$2 = "↶"; -const cularrp$2 = "⤽"; -const cup$2 = "∪"; -const cupbrcap$2 = "⩈"; -const cupcap$2 = "⩆"; -const cupcup$2 = "⩊"; -const cupdot$2 = "⊍"; -const cupor$2 = "⩅"; -const cups$2 = "∪︀"; -const curarr$2 = "↷"; -const curarrm$2 = "⤼"; -const curlyeqprec$2 = "⋞"; -const curlyeqsucc$2 = "⋟"; -const curlyvee$2 = "⋎"; -const curlywedge$2 = "⋏"; -const curre$2 = "¤"; -const curren$2 = "¤"; -const curvearrowleft$2 = "↶"; -const curvearrowright$2 = "↷"; -const cuvee$2 = "⋎"; -const cuwed$2 = "⋏"; -const cwconint$2 = "∲"; -const cwint$2 = "∱"; -const cylcty$2 = "⌭"; -const dArr$2 = "⇓"; -const dHar$2 = "⥥"; -const dagger$2 = "†"; -const daleth$2 = "ℸ"; -const darr$2 = "↓"; -const dash$2 = "‐"; -const dashv$2 = "⊣"; -const dbkarow$2 = "⤏"; -const dblac$2 = "˝"; -const dcaron$2 = "ď"; -const dcy$2 = "д"; -const dd$2 = "ⅆ"; -const ddagger$2 = "‡"; -const ddarr$2 = "⇊"; -const ddotseq$2 = "⩷"; -const de$2 = "°"; -const deg$2 = "°"; -const delta$2 = "δ"; -const demptyv$2 = "⦱"; -const dfisht$2 = "⥿"; -const dfr$2 = "𝔡"; -const dharl$2 = "⇃"; -const dharr$2 = "⇂"; -const diam$2 = "⋄"; -const diamond$2 = "⋄"; -const diamondsuit$2 = "♦"; -const diams$2 = "♦"; -const die$2 = "¨"; -const digamma$2 = "ϝ"; -const disin$2 = "⋲"; -const div$2 = "÷"; -const divid$2 = "÷"; -const divide$2 = "÷"; -const divideontimes$2 = "⋇"; -const divonx$2 = "⋇"; -const djcy$2 = "ђ"; -const dlcorn$2 = "⌞"; -const dlcrop$2 = "⌍"; -const dollar$2 = "$"; -const dopf$2 = "𝕕"; -const dot$2 = "˙"; -const doteq$2 = "≐"; -const doteqdot$2 = "≑"; -const dotminus$2 = "∸"; -const dotplus$2 = "∔"; -const dotsquare$2 = "⊡"; -const doublebarwedge$2 = "⌆"; -const downarrow$2 = "↓"; -const downdownarrows$2 = "⇊"; -const downharpoonleft$2 = "⇃"; -const downharpoonright$2 = "⇂"; -const drbkarow$2 = "⤐"; -const drcorn$2 = "⌟"; -const drcrop$2 = "⌌"; -const dscr$2 = "𝒹"; -const dscy$2 = "ѕ"; -const dsol$2 = "⧶"; -const dstrok$2 = "đ"; -const dtdot$2 = "⋱"; -const dtri$2 = "▿"; -const dtrif$2 = "▾"; -const duarr$2 = "⇵"; -const duhar$2 = "⥯"; -const dwangle$2 = "⦦"; -const dzcy$2 = "џ"; -const dzigrarr$2 = "⟿"; -const eDDot$2 = "⩷"; -const eDot$2 = "≑"; -const eacut$2 = "é"; -const eacute$2 = "é"; -const easter$2 = "⩮"; -const ecaron$2 = "ě"; -const ecir$2 = "ê"; -const ecirc$2 = "ê"; -const ecolon$2 = "≕"; -const ecy$2 = "э"; -const edot$2 = "ė"; -const ee$2 = "ⅇ"; -const efDot$2 = "≒"; -const efr$2 = "𝔢"; -const eg$2 = "⪚"; -const egrav$2 = "è"; -const egrave$2 = "è"; -const egs$2 = "⪖"; -const egsdot$2 = "⪘"; -const el$2 = "⪙"; -const elinters$2 = "⏧"; -const ell$2 = "ℓ"; -const els$2 = "⪕"; -const elsdot$2 = "⪗"; -const emacr$2 = "ē"; -const empty$2 = "∅"; -const emptyset$2 = "∅"; -const emptyv$2 = "∅"; -const emsp13$2 = " "; -const emsp14$2 = " "; -const emsp$2 = " "; -const eng$2 = "ŋ"; -const ensp$2 = " "; -const eogon$2 = "ę"; -const eopf$2 = "𝕖"; -const epar$2 = "⋕"; -const eparsl$2 = "⧣"; -const eplus$2 = "⩱"; -const epsi$2 = "ε"; -const epsilon$2 = "ε"; -const epsiv$2 = "ϵ"; -const eqcirc$2 = "≖"; -const eqcolon$2 = "≕"; -const eqsim$2 = "≂"; -const eqslantgtr$2 = "⪖"; -const eqslantless$2 = "⪕"; -const equals$2 = "="; -const equest$2 = "≟"; -const equiv$2 = "≡"; -const equivDD$2 = "⩸"; -const eqvparsl$2 = "⧥"; -const erDot$2 = "≓"; -const erarr$2 = "⥱"; -const escr$2 = "ℯ"; -const esdot$2 = "≐"; -const esim$2 = "≂"; -const eta$2 = "η"; -const et$2 = "ð"; -const eth$2 = "ð"; -const eum$2 = "ë"; -const euml$2 = "ë"; -const euro$2 = "€"; -const excl$2 = "!"; -const exist$2 = "∃"; -const expectation$2 = "ℰ"; -const exponentiale$2 = "ⅇ"; -const fallingdotseq$2 = "≒"; -const fcy$2 = "ф"; -const female$2 = "♀"; -const ffilig$2 = "ffi"; -const fflig$2 = "ff"; -const ffllig$2 = "ffl"; -const ffr$2 = "𝔣"; -const filig$2 = "fi"; -const fjlig$2 = "fj"; -const flat$2 = "♭"; -const fllig$2 = "fl"; -const fltns$2 = "▱"; -const fnof$2 = "ƒ"; -const fopf$2 = "𝕗"; -const forall$2 = "∀"; -const fork$2 = "⋔"; -const forkv$2 = "⫙"; -const fpartint$2 = "⨍"; -const frac1$2 = "¼"; -const frac12$2 = "½"; -const frac13$2 = "⅓"; -const frac14$2 = "¼"; -const frac15$2 = "⅕"; -const frac16$2 = "⅙"; -const frac18$2 = "⅛"; -const frac23$2 = "⅔"; -const frac25$2 = "⅖"; -const frac3$2 = "¾"; -const frac34$2 = "¾"; -const frac35$2 = "⅗"; -const frac38$2 = "⅜"; -const frac45$2 = "⅘"; -const frac56$2 = "⅚"; -const frac58$2 = "⅝"; -const frac78$2 = "⅞"; -const frasl$2 = "⁄"; -const frown$2 = "⌢"; -const fscr$2 = "𝒻"; -const gE$2 = "≧"; -const gEl$2 = "⪌"; -const gacute$2 = "ǵ"; -const gamma$2 = "γ"; -const gammad$2 = "ϝ"; -const gap$2 = "⪆"; -const gbreve$2 = "ğ"; -const gcirc$2 = "ĝ"; -const gcy$2 = "г"; -const gdot$2 = "ġ"; -const ge$2 = "≥"; -const gel$2 = "⋛"; -const geq$2 = "≥"; -const geqq$2 = "≧"; -const geqslant$2 = "⩾"; -const ges$2 = "⩾"; -const gescc$2 = "⪩"; -const gesdot$2 = "⪀"; -const gesdoto$2 = "⪂"; -const gesdotol$2 = "⪄"; -const gesl$2 = "⋛︀"; -const gesles$2 = "⪔"; -const gfr$2 = "𝔤"; -const gg$2 = "≫"; -const ggg$2 = "⋙"; -const gimel$2 = "ℷ"; -const gjcy$2 = "ѓ"; -const gl$2 = "≷"; -const glE$2 = "⪒"; -const gla$2 = "⪥"; -const glj$2 = "⪤"; -const gnE$2 = "≩"; -const gnap$2 = "⪊"; -const gnapprox$2 = "⪊"; -const gne$2 = "⪈"; -const gneq$2 = "⪈"; -const gneqq$2 = "≩"; -const gnsim$2 = "⋧"; -const gopf$2 = "𝕘"; -const grave$2 = "`"; -const gscr$2 = "ℊ"; -const gsim$2 = "≳"; -const gsime$2 = "⪎"; -const gsiml$2 = "⪐"; -const g$2 = ">"; -const gt$2 = ">"; -const gtcc$2 = "⪧"; -const gtcir$2 = "⩺"; -const gtdot$2 = "⋗"; -const gtlPar$2 = "⦕"; -const gtquest$2 = "⩼"; -const gtrapprox$2 = "⪆"; -const gtrarr$2 = "⥸"; -const gtrdot$2 = "⋗"; -const gtreqless$2 = "⋛"; -const gtreqqless$2 = "⪌"; -const gtrless$2 = "≷"; -const gtrsim$2 = "≳"; -const gvertneqq$2 = "≩︀"; -const gvnE$2 = "≩︀"; -const hArr$2 = "⇔"; -const hairsp$2 = " "; -const half$2 = "½"; -const hamilt$2 = "ℋ"; -const hardcy$2 = "ъ"; -const harr$2 = "↔"; -const harrcir$2 = "⥈"; -const harrw$2 = "↭"; -const hbar$2 = "ℏ"; -const hcirc$2 = "ĥ"; -const hearts$2 = "♥"; -const heartsuit$2 = "♥"; -const hellip$2 = "…"; -const hercon$2 = "⊹"; -const hfr$2 = "𝔥"; -const hksearow$2 = "⤥"; -const hkswarow$2 = "⤦"; -const hoarr$2 = "⇿"; -const homtht$2 = "∻"; -const hookleftarrow$2 = "↩"; -const hookrightarrow$2 = "↪"; -const hopf$2 = "𝕙"; -const horbar$2 = "―"; -const hscr$2 = "𝒽"; -const hslash$2 = "ℏ"; -const hstrok$2 = "ħ"; -const hybull$2 = "⁃"; -const hyphen$2 = "‐"; -const iacut$2 = "í"; -const iacute$2 = "í"; -const ic$2 = ""; -const icir$2 = "î"; -const icirc$2 = "î"; -const icy$2 = "и"; -const iecy$2 = "е"; -const iexc$2 = "¡"; -const iexcl$2 = "¡"; -const iff$2 = "⇔"; -const ifr$2 = "𝔦"; -const igrav$2 = "ì"; -const igrave$2 = "ì"; -const ii$2 = "ⅈ"; -const iiiint$2 = "⨌"; -const iiint$2 = "∭"; -const iinfin$2 = "⧜"; -const iiota$2 = "℩"; -const ijlig$2 = "ij"; -const imacr$2 = "ī"; -const image$3 = "ℑ"; -const imagline$2 = "ℐ"; -const imagpart$2 = "ℑ"; -const imath$2 = "ı"; -const imof$2 = "⊷"; -const imped$2 = "Ƶ"; -const incare$2 = "℅"; -const infin$2 = "∞"; -const infintie$2 = "⧝"; -const inodot$2 = "ı"; -const int$3 = "∫"; -const intcal$2 = "⊺"; -const integers$2 = "ℤ"; -const intercal$2 = "⊺"; -const intlarhk$2 = "⨗"; -const intprod$2 = "⨼"; -const iocy$2 = "ё"; -const iogon$2 = "į"; -const iopf$2 = "𝕚"; -const iota$2 = "ι"; -const iprod$2 = "⨼"; -const iques$2 = "¿"; -const iquest$2 = "¿"; -const iscr$2 = "𝒾"; -const isin$2 = "∈"; -const isinE$2 = "⋹"; -const isindot$2 = "⋵"; -const isins$2 = "⋴"; -const isinsv$2 = "⋳"; -const isinv$2 = "∈"; -const it$2 = ""; -const itilde$2 = "ĩ"; -const iukcy$2 = "і"; -const ium$2 = "ï"; -const iuml$2 = "ï"; -const jcirc$2 = "ĵ"; -const jcy$2 = "й"; -const jfr$2 = "𝔧"; -const jmath$2 = "ȷ"; -const jopf$2 = "𝕛"; -const jscr$2 = "𝒿"; -const jsercy$2 = "ј"; -const jukcy$2 = "є"; -const kappa$2 = "κ"; -const kappav$2 = "ϰ"; -const kcedil$2 = "ķ"; -const kcy$2 = "к"; -const kfr$2 = "𝔨"; -const kgreen$2 = "ĸ"; -const khcy$2 = "х"; -const kjcy$2 = "ќ"; -const kopf$2 = "𝕜"; -const kscr$2 = "𝓀"; -const lAarr$2 = "⇚"; -const lArr$2 = "⇐"; -const lAtail$2 = "⤛"; -const lBarr$2 = "⤎"; -const lE$2 = "≦"; -const lEg$2 = "⪋"; -const lHar$2 = "⥢"; -const lacute$2 = "ĺ"; -const laemptyv$2 = "⦴"; -const lagran$2 = "ℒ"; -const lambda$2 = "λ"; -const lang$2 = "⟨"; -const langd$2 = "⦑"; -const langle$2 = "⟨"; -const lap$2 = "⪅"; -const laqu$2 = "«"; -const laquo$2 = "«"; -const larr$2 = "←"; -const larrb$2 = "⇤"; -const larrbfs$2 = "⤟"; -const larrfs$2 = "⤝"; -const larrhk$2 = "↩"; -const larrlp$2 = "↫"; -const larrpl$2 = "⤹"; -const larrsim$2 = "⥳"; -const larrtl$2 = "↢"; -const lat$2 = "⪫"; -const latail$2 = "⤙"; -const late$2 = "⪭"; -const lates$2 = "⪭︀"; -const lbarr$2 = "⤌"; -const lbbrk$2 = "❲"; -const lbrace$2 = "{"; -const lbrack$2 = "["; -const lbrke$2 = "⦋"; -const lbrksld$2 = "⦏"; -const lbrkslu$2 = "⦍"; -const lcaron$2 = "ľ"; -const lcedil$2 = "ļ"; -const lceil$2 = "⌈"; -const lcub$2 = "{"; -const lcy$2 = "л"; -const ldca$2 = "⤶"; -const ldquo$2 = "“"; -const ldquor$2 = "„"; -const ldrdhar$2 = "⥧"; -const ldrushar$2 = "⥋"; -const ldsh$2 = "↲"; -const le$2 = "≤"; -const leftarrow$2 = "←"; -const leftarrowtail$2 = "↢"; -const leftharpoondown$2 = "↽"; -const leftharpoonup$2 = "↼"; -const leftleftarrows$2 = "⇇"; -const leftrightarrow$2 = "↔"; -const leftrightarrows$2 = "⇆"; -const leftrightharpoons$2 = "⇋"; -const leftrightsquigarrow$2 = "↭"; -const leftthreetimes$2 = "⋋"; -const leg$2 = "⋚"; -const leq$2 = "≤"; -const leqq$2 = "≦"; -const leqslant$2 = "⩽"; -const les$2 = "⩽"; -const lescc$2 = "⪨"; -const lesdot$2 = "⩿"; -const lesdoto$2 = "⪁"; -const lesdotor$2 = "⪃"; -const lesg$2 = "⋚︀"; -const lesges$2 = "⪓"; -const lessapprox$2 = "⪅"; -const lessdot$2 = "⋖"; -const lesseqgtr$2 = "⋚"; -const lesseqqgtr$2 = "⪋"; -const lessgtr$2 = "≶"; -const lesssim$2 = "≲"; -const lfisht$2 = "⥼"; -const lfloor$2 = "⌊"; -const lfr$2 = "𝔩"; -const lg$2 = "≶"; -const lgE$2 = "⪑"; -const lhard$2 = "↽"; -const lharu$2 = "↼"; -const lharul$2 = "⥪"; -const lhblk$2 = "▄"; -const ljcy$2 = "љ"; -const ll$2 = "≪"; -const llarr$2 = "⇇"; -const llcorner$2 = "⌞"; -const llhard$2 = "⥫"; -const lltri$2 = "◺"; -const lmidot$2 = "ŀ"; -const lmoust$2 = "⎰"; -const lmoustache$2 = "⎰"; -const lnE$2 = "≨"; -const lnap$2 = "⪉"; -const lnapprox$2 = "⪉"; -const lne$2 = "⪇"; -const lneq$2 = "⪇"; -const lneqq$2 = "≨"; -const lnsim$2 = "⋦"; -const loang$2 = "⟬"; -const loarr$2 = "⇽"; -const lobrk$2 = "⟦"; -const longleftarrow$2 = "⟵"; -const longleftrightarrow$2 = "⟷"; -const longmapsto$2 = "⟼"; -const longrightarrow$2 = "⟶"; -const looparrowleft$2 = "↫"; -const looparrowright$2 = "↬"; -const lopar$2 = "⦅"; -const lopf$2 = "𝕝"; -const loplus$2 = "⨭"; -const lotimes$2 = "⨴"; -const lowast$2 = "∗"; -const lowbar$2 = "_"; -const loz$2 = "◊"; -const lozenge$2 = "◊"; -const lozf$2 = "⧫"; -const lpar$2 = "("; -const lparlt$2 = "⦓"; -const lrarr$2 = "⇆"; -const lrcorner$2 = "⌟"; -const lrhar$2 = "⇋"; -const lrhard$2 = "⥭"; -const lrm$2 = ""; -const lrtri$2 = "⊿"; -const lsaquo$2 = "‹"; -const lscr$2 = "𝓁"; -const lsh$2 = "↰"; -const lsim$2 = "≲"; -const lsime$2 = "⪍"; -const lsimg$2 = "⪏"; -const lsqb$2 = "["; -const lsquo$2 = "‘"; -const lsquor$2 = "‚"; -const lstrok$2 = "ł"; -const l$2 = "<"; -const lt$3 = "<"; -const ltcc$2 = "⪦"; -const ltcir$2 = "⩹"; -const ltdot$2 = "⋖"; -const lthree$2 = "⋋"; -const ltimes$2 = "⋉"; -const ltlarr$2 = "⥶"; -const ltquest$2 = "⩻"; -const ltrPar$2 = "⦖"; -const ltri$2 = "◃"; -const ltrie$2 = "⊴"; -const ltrif$2 = "◂"; -const lurdshar$2 = "⥊"; -const luruhar$2 = "⥦"; -const lvertneqq$2 = "≨︀"; -const lvnE$2 = "≨︀"; -const mDDot$2 = "∺"; -const mac$2 = "¯"; -const macr$2 = "¯"; -const male$2 = "♂"; -const malt$2 = "✠"; -const maltese$2 = "✠"; -const map$5 = "↦"; -const mapsto$2 = "↦"; -const mapstodown$2 = "↧"; -const mapstoleft$2 = "↤"; -const mapstoup$2 = "↥"; -const marker$2 = "▮"; -const mcomma$2 = "⨩"; -const mcy$2 = "м"; -const mdash$2 = "—"; -const measuredangle$2 = "∡"; -const mfr$2 = "𝔪"; -const mho$2 = "℧"; -const micr$2 = "µ"; -const micro$2 = "µ"; -const mid$2 = "∣"; -const midast$2 = "*"; -const midcir$2 = "⫰"; -const middo$2 = "·"; -const middot$2 = "·"; -const minus$2 = "−"; -const minusb$2 = "⊟"; -const minusd$2 = "∸"; -const minusdu$2 = "⨪"; -const mlcp$2 = "⫛"; -const mldr$2 = "…"; -const mnplus$2 = "∓"; -const models$2 = "⊧"; -const mopf$2 = "𝕞"; -const mp$2 = "∓"; -const mscr$2 = "𝓂"; -const mstpos$2 = "∾"; -const mu$2 = "μ"; -const multimap$2 = "⊸"; -const mumap$2 = "⊸"; -const nGg$2 = "⋙̸"; -const nGt$2 = "≫⃒"; -const nGtv$2 = "≫̸"; -const nLeftarrow$2 = "⇍"; -const nLeftrightarrow$2 = "⇎"; -const nLl$2 = "⋘̸"; -const nLt$2 = "≪⃒"; -const nLtv$2 = "≪̸"; -const nRightarrow$2 = "⇏"; -const nVDash$2 = "⊯"; -const nVdash$2 = "⊮"; -const nabla$2 = "∇"; -const nacute$2 = "ń"; -const nang$2 = "∠⃒"; -const nap$2 = "≉"; -const napE$2 = "⩰̸"; -const napid$2 = "≋̸"; -const napos$2 = "ʼn"; -const napprox$2 = "≉"; -const natur$2 = "♮"; -const natural$2 = "♮"; -const naturals$2 = "ℕ"; -const nbs$2 = " "; -const nbsp$2 = " "; -const nbump$2 = "≎̸"; -const nbumpe$2 = "≏̸"; -const ncap$2 = "⩃"; -const ncaron$2 = "ň"; -const ncedil$2 = "ņ"; -const ncong$2 = "≇"; -const ncongdot$2 = "⩭̸"; -const ncup$2 = "⩂"; -const ncy$2 = "н"; -const ndash$2 = "–"; -const ne$2 = "≠"; -const neArr$2 = "⇗"; -const nearhk$2 = "⤤"; -const nearr$2 = "↗"; -const nearrow$2 = "↗"; -const nedot$2 = "≐̸"; -const nequiv$2 = "≢"; -const nesear$2 = "⤨"; -const nesim$2 = "≂̸"; -const nexist$2 = "∄"; -const nexists$2 = "∄"; -const nfr$2 = "𝔫"; -const ngE$2 = "≧̸"; -const nge$2 = "≱"; -const ngeq$2 = "≱"; -const ngeqq$2 = "≧̸"; -const ngeqslant$2 = "⩾̸"; -const nges$2 = "⩾̸"; -const ngsim$2 = "≵"; -const ngt$2 = "≯"; -const ngtr$2 = "≯"; -const nhArr$2 = "⇎"; -const nharr$2 = "↮"; -const nhpar$2 = "⫲"; -const ni$2 = "∋"; -const nis$2 = "⋼"; -const nisd$2 = "⋺"; -const niv$2 = "∋"; -const njcy$2 = "њ"; -const nlArr$2 = "⇍"; -const nlE$2 = "≦̸"; -const nlarr$2 = "↚"; -const nldr$2 = "‥"; -const nle$2 = "≰"; -const nleftarrow$2 = "↚"; -const nleftrightarrow$2 = "↮"; -const nleq$2 = "≰"; -const nleqq$2 = "≦̸"; -const nleqslant$2 = "⩽̸"; -const nles$2 = "⩽̸"; -const nless$2 = "≮"; -const nlsim$2 = "≴"; -const nlt$2 = "≮"; -const nltri$2 = "⋪"; -const nltrie$2 = "⋬"; -const nmid$2 = "∤"; -const nopf$2 = "𝕟"; -const no$2 = "¬"; -const not$2 = "¬"; -const notin$2 = "∉"; -const notinE$2 = "⋹̸"; -const notindot$2 = "⋵̸"; -const notinva$2 = "∉"; -const notinvb$2 = "⋷"; -const notinvc$2 = "⋶"; -const notni$2 = "∌"; -const notniva$2 = "∌"; -const notnivb$2 = "⋾"; -const notnivc$2 = "⋽"; -const npar$2 = "∦"; -const nparallel$2 = "∦"; -const nparsl$2 = "⫽⃥"; -const npart$2 = "∂̸"; -const npolint$2 = "⨔"; -const npr$2 = "⊀"; -const nprcue$2 = "⋠"; -const npre$2 = "⪯̸"; -const nprec$2 = "⊀"; -const npreceq$2 = "⪯̸"; -const nrArr$2 = "⇏"; -const nrarr$2 = "↛"; -const nrarrc$2 = "⤳̸"; -const nrarrw$2 = "↝̸"; -const nrightarrow$2 = "↛"; -const nrtri$2 = "⋫"; -const nrtrie$2 = "⋭"; -const nsc$2 = "⊁"; -const nsccue$2 = "⋡"; -const nsce$2 = "⪰̸"; -const nscr$2 = "𝓃"; -const nshortmid$2 = "∤"; -const nshortparallel$2 = "∦"; -const nsim$2 = "≁"; -const nsime$2 = "≄"; -const nsimeq$2 = "≄"; -const nsmid$2 = "∤"; -const nspar$2 = "∦"; -const nsqsube$2 = "⋢"; -const nsqsupe$2 = "⋣"; -const nsub$2 = "⊄"; -const nsubE$2 = "⫅̸"; -const nsube$2 = "⊈"; -const nsubset$2 = "⊂⃒"; -const nsubseteq$2 = "⊈"; -const nsubseteqq$2 = "⫅̸"; -const nsucc$2 = "⊁"; -const nsucceq$2 = "⪰̸"; -const nsup$2 = "⊅"; -const nsupE$2 = "⫆̸"; -const nsupe$2 = "⊉"; -const nsupset$2 = "⊃⃒"; -const nsupseteq$2 = "⊉"; -const nsupseteqq$2 = "⫆̸"; -const ntgl$2 = "≹"; -const ntild$2 = "ñ"; -const ntilde$2 = "ñ"; -const ntlg$2 = "≸"; -const ntriangleleft$2 = "⋪"; -const ntrianglelefteq$2 = "⋬"; -const ntriangleright$2 = "⋫"; -const ntrianglerighteq$2 = "⋭"; -const nu$2 = "ν"; -const num$2 = "#"; -const numero$2 = "№"; -const numsp$2 = " "; -const nvDash$2 = "⊭"; -const nvHarr$2 = "⤄"; -const nvap$2 = "≍⃒"; -const nvdash$2 = "⊬"; -const nvge$2 = "≥⃒"; -const nvgt$2 = ">⃒"; -const nvinfin$2 = "⧞"; -const nvlArr$2 = "⤂"; -const nvle$2 = "≤⃒"; -const nvlt$2 = "<⃒"; -const nvltrie$2 = "⊴⃒"; -const nvrArr$2 = "⤃"; -const nvrtrie$2 = "⊵⃒"; -const nvsim$2 = "∼⃒"; -const nwArr$2 = "⇖"; -const nwarhk$2 = "⤣"; -const nwarr$2 = "↖"; -const nwarrow$2 = "↖"; -const nwnear$2 = "⤧"; -const oS$2 = "Ⓢ"; -const oacut$2 = "ó"; -const oacute$2 = "ó"; -const oast$2 = "⊛"; -const ocir$2 = "ô"; -const ocirc$2 = "ô"; -const ocy$2 = "о"; -const odash$2 = "⊝"; -const odblac$2 = "ő"; -const odiv$2 = "⨸"; -const odot$2 = "⊙"; -const odsold$2 = "⦼"; -const oelig$2 = "œ"; -const ofcir$2 = "⦿"; -const ofr$2 = "𝔬"; -const ogon$2 = "˛"; -const ograv$2 = "ò"; -const ograve$2 = "ò"; -const ogt$2 = "⧁"; -const ohbar$2 = "⦵"; -const ohm$2 = "Ω"; -const oint$2 = "∮"; -const olarr$2 = "↺"; -const olcir$2 = "⦾"; -const olcross$2 = "⦻"; -const oline$2 = "‾"; -const olt$2 = "⧀"; -const omacr$2 = "ō"; -const omega$2 = "ω"; -const omicron$2 = "ο"; -const omid$2 = "⦶"; -const ominus$2 = "⊖"; -const oopf$2 = "𝕠"; -const opar$2 = "⦷"; -const operp$2 = "⦹"; -const oplus$2 = "⊕"; -const or$2 = "∨"; -const orarr$2 = "↻"; -const ord$2 = "º"; -const order$2 = "ℴ"; -const orderof$2 = "ℴ"; -const ordf$2 = "ª"; -const ordm$2 = "º"; -const origof$2 = "⊶"; -const oror$2 = "⩖"; -const orslope$2 = "⩗"; -const orv$2 = "⩛"; -const oscr$2 = "ℴ"; -const oslas$2 = "ø"; -const oslash$2 = "ø"; -const osol$2 = "⊘"; -const otild$2 = "õ"; -const otilde$2 = "õ"; -const otimes$2 = "⊗"; -const otimesas$2 = "⨶"; -const oum$2 = "ö"; -const ouml$2 = "ö"; -const ovbar$2 = "⌽"; -const par$2 = "¶"; -const para$2 = "¶"; -const parallel$2 = "∥"; -const parsim$2 = "⫳"; -const parsl$2 = "⫽"; -const part$2 = "∂"; -const pcy$2 = "п"; -const percnt$2 = "%"; -const period$2 = "."; -const permil$2 = "‰"; -const perp$2 = "⊥"; -const pertenk$2 = "‱"; -const pfr$2 = "𝔭"; -const phi$2 = "φ"; -const phiv$2 = "ϕ"; -const phmmat$2 = "ℳ"; -const phone$2 = "☎"; -const pi$2 = "π"; -const pitchfork$2 = "⋔"; -const piv$2 = "ϖ"; -const planck$2 = "ℏ"; -const planckh$2 = "ℎ"; -const plankv$2 = "ℏ"; -const plus$2 = "+"; -const plusacir$2 = "⨣"; -const plusb$2 = "⊞"; -const pluscir$2 = "⨢"; -const plusdo$2 = "∔"; -const plusdu$2 = "⨥"; -const pluse$2 = "⩲"; -const plusm$2 = "±"; -const plusmn$2 = "±"; -const plussim$2 = "⨦"; -const plustwo$2 = "⨧"; -const pm$2 = "±"; -const pointint$2 = "⨕"; -const popf$2 = "𝕡"; -const poun$2 = "£"; -const pound$2 = "£"; -const pr$2 = "≺"; -const prE$2 = "⪳"; -const prap$2 = "⪷"; -const prcue$2 = "≼"; -const pre$2 = "⪯"; -const prec$2 = "≺"; -const precapprox$2 = "⪷"; -const preccurlyeq$2 = "≼"; -const preceq$2 = "⪯"; -const precnapprox$2 = "⪹"; -const precneqq$2 = "⪵"; -const precnsim$2 = "⋨"; -const precsim$2 = "≾"; -const prime$2 = "′"; -const primes$2 = "ℙ"; -const prnE$2 = "⪵"; -const prnap$2 = "⪹"; -const prnsim$2 = "⋨"; -const prod$2 = "∏"; -const profalar$2 = "⌮"; -const profline$2 = "⌒"; -const profsurf$2 = "⌓"; -const prop$2 = "∝"; -const propto$2 = "∝"; -const prsim$2 = "≾"; -const prurel$2 = "⊰"; -const pscr$2 = "𝓅"; -const psi$2 = "ψ"; -const puncsp$2 = " "; -const qfr$2 = "𝔮"; -const qint$2 = "⨌"; -const qopf$2 = "𝕢"; -const qprime$2 = "⁗"; -const qscr$2 = "𝓆"; -const quaternions$2 = "ℍ"; -const quatint$2 = "⨖"; -const quest$2 = "?"; -const questeq$2 = "≟"; -const quo$2 = "\""; -const quot$2 = "\""; -const rAarr$2 = "⇛"; -const rArr$2 = "⇒"; -const rAtail$2 = "⤜"; -const rBarr$2 = "⤏"; -const rHar$2 = "⥤"; -const race$2 = "∽̱"; -const racute$2 = "ŕ"; -const radic$2 = "√"; -const raemptyv$2 = "⦳"; -const rang$2 = "⟩"; -const rangd$2 = "⦒"; -const range$2 = "⦥"; -const rangle$2 = "⟩"; -const raqu$2 = "»"; -const raquo$2 = "»"; -const rarr$2 = "→"; -const rarrap$2 = "⥵"; -const rarrb$2 = "⇥"; -const rarrbfs$2 = "⤠"; -const rarrc$2 = "⤳"; -const rarrfs$2 = "⤞"; -const rarrhk$2 = "↪"; -const rarrlp$2 = "↬"; -const rarrpl$2 = "⥅"; -const rarrsim$2 = "⥴"; -const rarrtl$2 = "↣"; -const rarrw$2 = "↝"; -const ratail$2 = "⤚"; -const ratio$2 = "∶"; -const rationals$2 = "ℚ"; -const rbarr$2 = "⤍"; -const rbbrk$2 = "❳"; -const rbrace$2 = "}"; -const rbrack$2 = "]"; -const rbrke$2 = "⦌"; -const rbrksld$2 = "⦎"; -const rbrkslu$2 = "⦐"; -const rcaron$2 = "ř"; -const rcedil$2 = "ŗ"; -const rceil$2 = "⌉"; -const rcub$2 = "}"; -const rcy$2 = "р"; -const rdca$2 = "⤷"; -const rdldhar$2 = "⥩"; -const rdquo$2 = "”"; -const rdquor$2 = "”"; -const rdsh$2 = "↳"; -const real$2 = "ℜ"; -const realine$2 = "ℛ"; -const realpart$2 = "ℜ"; -const reals$2 = "ℝ"; -const rect$2 = "▭"; -const re$6 = "®"; -const reg$2 = "®"; -const rfisht$2 = "⥽"; -const rfloor$2 = "⌋"; -const rfr$2 = "𝔯"; -const rhard$2 = "⇁"; -const rharu$2 = "⇀"; -const rharul$2 = "⥬"; -const rho$2 = "ρ"; -const rhov$2 = "ϱ"; -const rightarrow$2 = "→"; -const rightarrowtail$2 = "↣"; -const rightharpoondown$2 = "⇁"; -const rightharpoonup$2 = "⇀"; -const rightleftarrows$2 = "⇄"; -const rightleftharpoons$2 = "⇌"; -const rightrightarrows$2 = "⇉"; -const rightsquigarrow$2 = "↝"; -const rightthreetimes$2 = "⋌"; -const ring$2 = "˚"; -const risingdotseq$2 = "≓"; -const rlarr$2 = "⇄"; -const rlhar$2 = "⇌"; -const rlm$2 = ""; -const rmoust$2 = "⎱"; -const rmoustache$2 = "⎱"; -const rnmid$2 = "⫮"; -const roang$2 = "⟭"; -const roarr$2 = "⇾"; -const robrk$2 = "⟧"; -const ropar$2 = "⦆"; -const ropf$2 = "𝕣"; -const roplus$2 = "⨮"; -const rotimes$2 = "⨵"; -const rpar$2 = ")"; -const rpargt$2 = "⦔"; -const rppolint$2 = "⨒"; -const rrarr$2 = "⇉"; -const rsaquo$2 = "›"; -const rscr$2 = "𝓇"; -const rsh$2 = "↱"; -const rsqb$2 = "]"; -const rsquo$2 = "’"; -const rsquor$2 = "’"; -const rthree$2 = "⋌"; -const rtimes$2 = "⋊"; -const rtri$2 = "▹"; -const rtrie$2 = "⊵"; -const rtrif$2 = "▸"; -const rtriltri$2 = "⧎"; -const ruluhar$2 = "⥨"; -const rx$2 = "℞"; -const sacute$2 = "ś"; -const sbquo$2 = "‚"; -const sc$2 = "≻"; -const scE$2 = "⪴"; -const scap$2 = "⪸"; -const scaron$2 = "š"; -const sccue$2 = "≽"; -const sce$2 = "⪰"; -const scedil$2 = "ş"; -const scirc$2 = "ŝ"; -const scnE$2 = "⪶"; -const scnap$2 = "⪺"; -const scnsim$2 = "⋩"; -const scpolint$2 = "⨓"; -const scsim$2 = "≿"; -const scy$2 = "с"; -const sdot$2 = "⋅"; -const sdotb$2 = "⊡"; -const sdote$2 = "⩦"; -const seArr$2 = "⇘"; -const searhk$2 = "⤥"; -const searr$2 = "↘"; -const searrow$2 = "↘"; -const sec$2 = "§"; -const sect$2 = "§"; -const semi$2 = ";"; -const seswar$2 = "⤩"; -const setminus$2 = "∖"; -const setmn$2 = "∖"; -const sext$2 = "✶"; -const sfr$2 = "𝔰"; -const sfrown$2 = "⌢"; -const sharp$2 = "♯"; -const shchcy$2 = "щ"; -const shcy$2 = "ш"; -const shortmid$2 = "∣"; -const shortparallel$2 = "∥"; -const sh$2 = ""; -const shy$2 = ""; -const sigma$2 = "σ"; -const sigmaf$2 = "ς"; -const sigmav$2 = "ς"; -const sim$2 = "∼"; -const simdot$2 = "⩪"; -const sime$2 = "≃"; -const simeq$2 = "≃"; -const simg$2 = "⪞"; -const simgE$2 = "⪠"; -const siml$2 = "⪝"; -const simlE$2 = "⪟"; -const simne$2 = "≆"; -const simplus$2 = "⨤"; -const simrarr$2 = "⥲"; -const slarr$2 = "←"; -const smallsetminus$2 = "∖"; -const smashp$2 = "⨳"; -const smeparsl$2 = "⧤"; -const smid$2 = "∣"; -const smile$2 = "⌣"; -const smt$2 = "⪪"; -const smte$2 = "⪬"; -const smtes$2 = "⪬︀"; -const softcy$2 = "ь"; -const sol$2 = "/"; -const solb$2 = "⧄"; -const solbar$2 = "⌿"; -const sopf$2 = "𝕤"; -const spades$2 = "♠"; -const spadesuit$2 = "♠"; -const spar$2 = "∥"; -const sqcap$2 = "⊓"; -const sqcaps$2 = "⊓︀"; -const sqcup$2 = "⊔"; -const sqcups$2 = "⊔︀"; -const sqsub$2 = "⊏"; -const sqsube$2 = "⊑"; -const sqsubset$2 = "⊏"; -const sqsubseteq$2 = "⊑"; -const sqsup$2 = "⊐"; -const sqsupe$2 = "⊒"; -const sqsupset$2 = "⊐"; -const sqsupseteq$2 = "⊒"; -const squ$2 = "□"; -const square$2 = "□"; -const squarf$2 = "▪"; -const squf$2 = "▪"; -const srarr$2 = "→"; -const sscr$2 = "𝓈"; -const ssetmn$2 = "∖"; -const ssmile$2 = "⌣"; -const sstarf$2 = "⋆"; -const star$2 = "☆"; -const starf$2 = "★"; -const straightepsilon$2 = "ϵ"; -const straightphi$2 = "ϕ"; -const strns$2 = "¯"; -const sub$2 = "⊂"; -const subE$2 = "⫅"; -const subdot$2 = "⪽"; -const sube$2 = "⊆"; -const subedot$2 = "⫃"; -const submult$2 = "⫁"; -const subnE$2 = "⫋"; -const subne$2 = "⊊"; -const subplus$2 = "⪿"; -const subrarr$2 = "⥹"; -const subset$2 = "⊂"; -const subseteq$2 = "⊆"; -const subseteqq$2 = "⫅"; -const subsetneq$2 = "⊊"; -const subsetneqq$2 = "⫋"; -const subsim$2 = "⫇"; -const subsub$2 = "⫕"; -const subsup$2 = "⫓"; -const succ$2 = "≻"; -const succapprox$2 = "⪸"; -const succcurlyeq$2 = "≽"; -const succeq$2 = "⪰"; -const succnapprox$2 = "⪺"; -const succneqq$2 = "⪶"; -const succnsim$2 = "⋩"; -const succsim$2 = "≿"; -const sum$2 = "∑"; -const sung$2 = "♪"; -const sup$2 = "⊃"; -const sup1$2 = "¹"; -const sup2$2 = "²"; -const sup3$2 = "³"; -const supE$2 = "⫆"; -const supdot$2 = "⪾"; -const supdsub$2 = "⫘"; -const supe$2 = "⊇"; -const supedot$2 = "⫄"; -const suphsol$2 = "⟉"; -const suphsub$2 = "⫗"; -const suplarr$2 = "⥻"; -const supmult$2 = "⫂"; -const supnE$2 = "⫌"; -const supne$2 = "⊋"; -const supplus$2 = "⫀"; -const supset$2 = "⊃"; -const supseteq$2 = "⊇"; -const supseteqq$2 = "⫆"; -const supsetneq$2 = "⊋"; -const supsetneqq$2 = "⫌"; -const supsim$2 = "⫈"; -const supsub$2 = "⫔"; -const supsup$2 = "⫖"; -const swArr$2 = "⇙"; -const swarhk$2 = "⤦"; -const swarr$2 = "↙"; -const swarrow$2 = "↙"; -const swnwar$2 = "⤪"; -const szli$2 = "ß"; -const szlig$2 = "ß"; -const target$2 = "⌖"; -const tau$2 = "τ"; -const tbrk$2 = "⎴"; -const tcaron$2 = "ť"; -const tcedil$2 = "ţ"; -const tcy$2 = "т"; -const tdot$2 = "⃛"; -const telrec$2 = "⌕"; -const tfr$2 = "𝔱"; -const there4$2 = "∴"; -const therefore$2 = "∴"; -const theta$2 = "θ"; -const thetasym$2 = "ϑ"; -const thetav$2 = "ϑ"; -const thickapprox$2 = "≈"; -const thicksim$2 = "∼"; -const thinsp$2 = " "; -const thkap$2 = "≈"; -const thksim$2 = "∼"; -const thor$2 = "þ"; -const thorn$2 = "þ"; -const tilde$2 = "˜"; -const time$2 = "×"; -const times$2 = "×"; -const timesb$2 = "⊠"; -const timesbar$2 = "⨱"; -const timesd$2 = "⨰"; -const tint$2 = "∭"; -const toea$2 = "⤨"; -const top$2 = "⊤"; -const topbot$2 = "⌶"; -const topcir$2 = "⫱"; -const topf$2 = "𝕥"; -const topfork$2 = "⫚"; -const tosa$2 = "⤩"; -const tprime$2 = "‴"; -const trade$2 = "™"; -const triangle$2 = "▵"; -const triangledown$2 = "▿"; -const triangleleft$2 = "◃"; -const trianglelefteq$2 = "⊴"; -const triangleq$2 = "≜"; -const triangleright$2 = "▹"; -const trianglerighteq$2 = "⊵"; -const tridot$2 = "◬"; -const trie$2 = "≜"; -const triminus$2 = "⨺"; -const triplus$2 = "⨹"; -const trisb$2 = "⧍"; -const tritime$2 = "⨻"; -const trpezium$2 = "⏢"; -const tscr$2 = "𝓉"; -const tscy$2 = "ц"; -const tshcy$2 = "ћ"; -const tstrok$2 = "ŧ"; -const twixt$2 = "≬"; -const twoheadleftarrow$2 = "↞"; -const twoheadrightarrow$2 = "↠"; -const uArr$2 = "⇑"; -const uHar$2 = "⥣"; -const uacut$2 = "ú"; -const uacute$2 = "ú"; -const uarr$2 = "↑"; -const ubrcy$2 = "ў"; -const ubreve$2 = "ŭ"; -const ucir$2 = "û"; -const ucirc$2 = "û"; -const ucy$2 = "у"; -const udarr$2 = "⇅"; -const udblac$2 = "ű"; -const udhar$2 = "⥮"; -const ufisht$2 = "⥾"; -const ufr$2 = "𝔲"; -const ugrav$2 = "ù"; -const ugrave$2 = "ù"; -const uharl$2 = "↿"; -const uharr$2 = "↾"; -const uhblk$2 = "▀"; -const ulcorn$2 = "⌜"; -const ulcorner$2 = "⌜"; -const ulcrop$2 = "⌏"; -const ultri$2 = "◸"; -const umacr$2 = "ū"; -const um$2 = "¨"; -const uml$2 = "¨"; -const uogon$2 = "ų"; -const uopf$2 = "𝕦"; -const uparrow$2 = "↑"; -const updownarrow$2 = "↕"; -const upharpoonleft$2 = "↿"; -const upharpoonright$2 = "↾"; -const uplus$2 = "⊎"; -const upsi$2 = "υ"; -const upsih$2 = "ϒ"; -const upsilon$2 = "υ"; -const upuparrows$2 = "⇈"; -const urcorn$2 = "⌝"; -const urcorner$2 = "⌝"; -const urcrop$2 = "⌎"; -const uring$2 = "ů"; -const urtri$2 = "◹"; -const uscr$2 = "𝓊"; -const utdot$2 = "⋰"; -const utilde$2 = "ũ"; -const utri$2 = "▵"; -const utrif$2 = "▴"; -const uuarr$2 = "⇈"; -const uum$2 = "ü"; -const uuml$2 = "ü"; -const uwangle$2 = "⦧"; -const vArr$2 = "⇕"; -const vBar$2 = "⫨"; -const vBarv$2 = "⫩"; -const vDash$2 = "⊨"; -const vangrt$2 = "⦜"; -const varepsilon$2 = "ϵ"; -const varkappa$2 = "ϰ"; -const varnothing$2 = "∅"; -const varphi$2 = "ϕ"; -const varpi$2 = "ϖ"; -const varpropto$2 = "∝"; -const varr$2 = "↕"; -const varrho$2 = "ϱ"; -const varsigma$2 = "ς"; -const varsubsetneq$2 = "⊊︀"; -const varsubsetneqq$2 = "⫋︀"; -const varsupsetneq$2 = "⊋︀"; -const varsupsetneqq$2 = "⫌︀"; -const vartheta$2 = "ϑ"; -const vartriangleleft$2 = "⊲"; -const vartriangleright$2 = "⊳"; -const vcy$2 = "в"; -const vdash$2 = "⊢"; -const vee$2 = "∨"; -const veebar$2 = "⊻"; -const veeeq$2 = "≚"; -const vellip$2 = "⋮"; -const verbar$2 = "|"; -const vert$2 = "|"; -const vfr$2 = "𝔳"; -const vltri$2 = "⊲"; -const vnsub$2 = "⊂⃒"; -const vnsup$2 = "⊃⃒"; -const vopf$2 = "𝕧"; -const vprop$2 = "∝"; -const vrtri$2 = "⊳"; -const vscr$2 = "𝓋"; -const vsubnE$2 = "⫋︀"; -const vsubne$2 = "⊊︀"; -const vsupnE$2 = "⫌︀"; -const vsupne$2 = "⊋︀"; -const vzigzag$2 = "⦚"; -const wcirc$2 = "ŵ"; -const wedbar$2 = "⩟"; -const wedge$2 = "∧"; -const wedgeq$2 = "≙"; -const weierp$2 = "℘"; -const wfr$2 = "𝔴"; -const wopf$2 = "𝕨"; -const wp$2 = "℘"; -const wr$2 = "≀"; -const wreath$2 = "≀"; -const wscr$2 = "𝓌"; -const xcap$2 = "⋂"; -const xcirc$2 = "◯"; -const xcup$2 = "⋃"; -const xdtri$2 = "▽"; -const xfr$2 = "𝔵"; -const xhArr$2 = "⟺"; -const xharr$2 = "⟷"; -const xi$2 = "ξ"; -const xlArr$2 = "⟸"; -const xlarr$2 = "⟵"; -const xmap$2 = "⟼"; -const xnis$2 = "⋻"; -const xodot$2 = "⨀"; -const xopf$2 = "𝕩"; -const xoplus$2 = "⨁"; -const xotime$2 = "⨂"; -const xrArr$2 = "⟹"; -const xrarr$2 = "⟶"; -const xscr$2 = "𝓍"; -const xsqcup$2 = "⨆"; -const xuplus$2 = "⨄"; -const xutri$2 = "△"; -const xvee$2 = "⋁"; -const xwedge$2 = "⋀"; -const yacut$2 = "ý"; -const yacute$2 = "ý"; -const yacy$2 = "я"; -const ycirc$2 = "ŷ"; -const ycy$2 = "ы"; -const ye$2 = "¥"; -const yen$2 = "¥"; -const yfr$2 = "𝔶"; -const yicy$2 = "ї"; -const yopf$2 = "𝕪"; -const yscr$2 = "𝓎"; -const yucy$2 = "ю"; -const yum$2 = "ÿ"; -const yuml$2 = "ÿ"; -const zacute$2 = "ź"; -const zcaron$2 = "ž"; -const zcy$2 = "з"; -const zdot$2 = "ż"; -const zeetrf$2 = "ℨ"; -const zeta$2 = "ζ"; -const zfr$2 = "𝔷"; -const zhcy$2 = "ж"; -const zigrarr$2 = "⇝"; -const zopf$2 = "𝕫"; -const zscr$2 = "𝓏"; -const zwj$2 = ""; -const zwnj$2 = ""; -var require$$0$2 = { - AEli: AEli$2, - AElig: AElig$2, - AM: AM$2, - AMP: AMP$2, - Aacut: Aacut$2, - Aacute: Aacute$2, - Abreve: Abreve$2, - Acir: Acir$2, - Acirc: Acirc$2, - Acy: Acy$2, - Afr: Afr$2, - Agrav: Agrav$2, - Agrave: Agrave$2, - Alpha: Alpha$2, - Amacr: Amacr$2, - And: And$2, - Aogon: Aogon$2, - Aopf: Aopf$2, - ApplyFunction: ApplyFunction$2, - Arin: Arin$2, - Aring: Aring$2, - Ascr: Ascr$2, - Assign: Assign$2, - Atild: Atild$2, - Atilde: Atilde$2, - Aum: Aum$2, - Auml: Auml$2, - Backslash: Backslash$2, - Barv: Barv$2, - Barwed: Barwed$2, - Bcy: Bcy$2, - Because: Because$2, - Bernoullis: Bernoullis$2, - Beta: Beta$2, - Bfr: Bfr$2, - Bopf: Bopf$2, - Breve: Breve$2, - Bscr: Bscr$2, - Bumpeq: Bumpeq$2, - CHcy: CHcy$2, - COP: COP$2, - COPY: COPY$2, - Cacute: Cacute$2, - Cap: Cap$2, - CapitalDifferentialD: CapitalDifferentialD$2, - Cayleys: Cayleys$2, - Ccaron: Ccaron$2, - Ccedi: Ccedi$2, - Ccedil: Ccedil$2, - Ccirc: Ccirc$2, - Cconint: Cconint$2, - Cdot: Cdot$2, - Cedilla: Cedilla$2, - CenterDot: CenterDot$2, - Cfr: Cfr$2, - Chi: Chi$2, - CircleDot: CircleDot$2, - CircleMinus: CircleMinus$2, - CirclePlus: CirclePlus$2, - CircleTimes: CircleTimes$2, - ClockwiseContourIntegral: ClockwiseContourIntegral$2, - CloseCurlyDoubleQuote: CloseCurlyDoubleQuote$2, - CloseCurlyQuote: CloseCurlyQuote$2, - Colon: Colon$2, - Colone: Colone$2, - Congruent: Congruent$2, - Conint: Conint$2, - ContourIntegral: ContourIntegral$2, - Copf: Copf$2, - Coproduct: Coproduct$2, - CounterClockwiseContourIntegral: CounterClockwiseContourIntegral$2, - Cross: Cross$2, - Cscr: Cscr$2, - Cup: Cup$2, - CupCap: CupCap$2, - DD: DD$2, - DDotrahd: DDotrahd$2, - DJcy: DJcy$2, - DScy: DScy$2, - DZcy: DZcy$2, - Dagger: Dagger$2, - Darr: Darr$2, - Dashv: Dashv$2, - Dcaron: Dcaron$2, - Dcy: Dcy$2, - Del: Del$2, - Delta: Delta$2, - Dfr: Dfr$2, - DiacriticalAcute: DiacriticalAcute$2, - DiacriticalDot: DiacriticalDot$2, - DiacriticalDoubleAcute: DiacriticalDoubleAcute$2, - DiacriticalGrave: DiacriticalGrave$2, - DiacriticalTilde: DiacriticalTilde$2, - Diamond: Diamond$2, - DifferentialD: DifferentialD$2, - Dopf: Dopf$2, - Dot: Dot$2, - DotDot: DotDot$2, - DotEqual: DotEqual$2, - DoubleContourIntegral: DoubleContourIntegral$2, - DoubleDot: DoubleDot$2, - DoubleDownArrow: DoubleDownArrow$2, - DoubleLeftArrow: DoubleLeftArrow$2, - DoubleLeftRightArrow: DoubleLeftRightArrow$2, - DoubleLeftTee: DoubleLeftTee$2, - DoubleLongLeftArrow: DoubleLongLeftArrow$2, - DoubleLongLeftRightArrow: DoubleLongLeftRightArrow$2, - DoubleLongRightArrow: DoubleLongRightArrow$2, - DoubleRightArrow: DoubleRightArrow$2, - DoubleRightTee: DoubleRightTee$2, - DoubleUpArrow: DoubleUpArrow$2, - DoubleUpDownArrow: DoubleUpDownArrow$2, - DoubleVerticalBar: DoubleVerticalBar$2, - DownArrow: DownArrow$2, - DownArrowBar: DownArrowBar$2, - DownArrowUpArrow: DownArrowUpArrow$2, - DownBreve: DownBreve$2, - DownLeftRightVector: DownLeftRightVector$2, - DownLeftTeeVector: DownLeftTeeVector$2, - DownLeftVector: DownLeftVector$2, - DownLeftVectorBar: DownLeftVectorBar$2, - DownRightTeeVector: DownRightTeeVector$2, - DownRightVector: DownRightVector$2, - DownRightVectorBar: DownRightVectorBar$2, - DownTee: DownTee$2, - DownTeeArrow: DownTeeArrow$2, - Downarrow: Downarrow$2, - Dscr: Dscr$2, - Dstrok: Dstrok$2, - ENG: ENG$2, - ET: ET$2, - ETH: ETH$2, - Eacut: Eacut$2, - Eacute: Eacute$2, - Ecaron: Ecaron$2, - Ecir: Ecir$2, - Ecirc: Ecirc$2, - Ecy: Ecy$2, - Edot: Edot$2, - Efr: Efr$2, - Egrav: Egrav$2, - Egrave: Egrave$2, - Element: Element$2, - Emacr: Emacr$2, - EmptySmallSquare: EmptySmallSquare$2, - EmptyVerySmallSquare: EmptyVerySmallSquare$2, - Eogon: Eogon$2, - Eopf: Eopf$2, - Epsilon: Epsilon$2, - Equal: Equal$2, - EqualTilde: EqualTilde$2, - Equilibrium: Equilibrium$2, - Escr: Escr$2, - Esim: Esim$2, - Eta: Eta$2, - Eum: Eum$2, - Euml: Euml$2, - Exists: Exists$2, - ExponentialE: ExponentialE$2, - Fcy: Fcy$2, - Ffr: Ffr$2, - FilledSmallSquare: FilledSmallSquare$2, - FilledVerySmallSquare: FilledVerySmallSquare$2, - Fopf: Fopf$2, - ForAll: ForAll$2, - Fouriertrf: Fouriertrf$2, - Fscr: Fscr$2, - GJcy: GJcy$2, - G: G$2, - GT: GT$2, - Gamma: Gamma$2, - Gammad: Gammad$2, - Gbreve: Gbreve$2, - Gcedil: Gcedil$2, - Gcirc: Gcirc$2, - Gcy: Gcy$2, - Gdot: Gdot$2, - Gfr: Gfr$2, - Gg: Gg$2, - Gopf: Gopf$2, - GreaterEqual: GreaterEqual$2, - GreaterEqualLess: GreaterEqualLess$2, - GreaterFullEqual: GreaterFullEqual$2, - GreaterGreater: GreaterGreater$2, - GreaterLess: GreaterLess$2, - GreaterSlantEqual: GreaterSlantEqual$2, - GreaterTilde: GreaterTilde$2, - Gscr: Gscr$2, - Gt: Gt$2, - HARDcy: HARDcy$2, - Hacek: Hacek$2, - Hat: Hat$2, - Hcirc: Hcirc$2, - Hfr: Hfr$2, - HilbertSpace: HilbertSpace$2, - Hopf: Hopf$2, - HorizontalLine: HorizontalLine$2, - Hscr: Hscr$2, - Hstrok: Hstrok$2, - HumpDownHump: HumpDownHump$2, - HumpEqual: HumpEqual$2, - IEcy: IEcy$2, - IJlig: IJlig$2, - IOcy: IOcy$2, - Iacut: Iacut$2, - Iacute: Iacute$2, - Icir: Icir$2, - Icirc: Icirc$2, - Icy: Icy$2, - Idot: Idot$2, - Ifr: Ifr$2, - Igrav: Igrav$2, - Igrave: Igrave$2, - Im: Im$2, - Imacr: Imacr$2, - ImaginaryI: ImaginaryI$2, - Implies: Implies$2, - Int: Int$2, - Integral: Integral$2, - Intersection: Intersection$2, - InvisibleComma: InvisibleComma$2, - InvisibleTimes: InvisibleTimes$2, - Iogon: Iogon$2, - Iopf: Iopf$2, - Iota: Iota$2, - Iscr: Iscr$2, - Itilde: Itilde$2, - Iukcy: Iukcy$2, - Ium: Ium$2, - Iuml: Iuml$2, - Jcirc: Jcirc$2, - Jcy: Jcy$2, - Jfr: Jfr$2, - Jopf: Jopf$2, - Jscr: Jscr$2, - Jsercy: Jsercy$2, - Jukcy: Jukcy$2, - KHcy: KHcy$2, - KJcy: KJcy$2, - Kappa: Kappa$2, - Kcedil: Kcedil$2, - Kcy: Kcy$2, - Kfr: Kfr$2, - Kopf: Kopf$2, - Kscr: Kscr$2, - LJcy: LJcy$2, - L: L$2, - LT: LT$2, - Lacute: Lacute$2, - Lambda: Lambda$2, - Lang: Lang$2, - Laplacetrf: Laplacetrf$2, - Larr: Larr$2, - Lcaron: Lcaron$2, - Lcedil: Lcedil$2, - Lcy: Lcy$2, - LeftAngleBracket: LeftAngleBracket$2, - LeftArrow: LeftArrow$2, - LeftArrowBar: LeftArrowBar$2, - LeftArrowRightArrow: LeftArrowRightArrow$2, - LeftCeiling: LeftCeiling$2, - LeftDoubleBracket: LeftDoubleBracket$2, - LeftDownTeeVector: LeftDownTeeVector$2, - LeftDownVector: LeftDownVector$2, - LeftDownVectorBar: LeftDownVectorBar$2, - LeftFloor: LeftFloor$2, - LeftRightArrow: LeftRightArrow$2, - LeftRightVector: LeftRightVector$2, - LeftTee: LeftTee$2, - LeftTeeArrow: LeftTeeArrow$2, - LeftTeeVector: LeftTeeVector$2, - LeftTriangle: LeftTriangle$2, - LeftTriangleBar: LeftTriangleBar$2, - LeftTriangleEqual: LeftTriangleEqual$2, - LeftUpDownVector: LeftUpDownVector$2, - LeftUpTeeVector: LeftUpTeeVector$2, - LeftUpVector: LeftUpVector$2, - LeftUpVectorBar: LeftUpVectorBar$2, - LeftVector: LeftVector$2, - LeftVectorBar: LeftVectorBar$2, - Leftarrow: Leftarrow$2, - Leftrightarrow: Leftrightarrow$2, - LessEqualGreater: LessEqualGreater$2, - LessFullEqual: LessFullEqual$2, - LessGreater: LessGreater$2, - LessLess: LessLess$2, - LessSlantEqual: LessSlantEqual$2, - LessTilde: LessTilde$2, - Lfr: Lfr$2, - Ll: Ll$2, - Lleftarrow: Lleftarrow$2, - Lmidot: Lmidot$2, - LongLeftArrow: LongLeftArrow$2, - LongLeftRightArrow: LongLeftRightArrow$2, - LongRightArrow: LongRightArrow$2, - Longleftarrow: Longleftarrow$2, - Longleftrightarrow: Longleftrightarrow$2, - Longrightarrow: Longrightarrow$2, - Lopf: Lopf$2, - LowerLeftArrow: LowerLeftArrow$2, - LowerRightArrow: LowerRightArrow$2, - Lscr: Lscr$2, - Lsh: Lsh$2, - Lstrok: Lstrok$2, - Lt: Lt$2, - "Map": "⤅", - Mcy: Mcy$2, - MediumSpace: MediumSpace$2, - Mellintrf: Mellintrf$2, - Mfr: Mfr$2, - MinusPlus: MinusPlus$2, - Mopf: Mopf$2, - Mscr: Mscr$2, - Mu: Mu$2, - NJcy: NJcy$2, - Nacute: Nacute$2, - Ncaron: Ncaron$2, - Ncedil: Ncedil$2, - Ncy: Ncy$2, - NegativeMediumSpace: NegativeMediumSpace$2, - NegativeThickSpace: NegativeThickSpace$2, - NegativeThinSpace: NegativeThinSpace$2, - NegativeVeryThinSpace: NegativeVeryThinSpace$2, - NestedGreaterGreater: NestedGreaterGreater$2, - NestedLessLess: NestedLessLess$2, - NewLine: NewLine$2, - Nfr: Nfr$2, - NoBreak: NoBreak$2, - NonBreakingSpace: NonBreakingSpace$2, - Nopf: Nopf$2, - Not: Not$2, - NotCongruent: NotCongruent$2, - NotCupCap: NotCupCap$2, - NotDoubleVerticalBar: NotDoubleVerticalBar$2, - NotElement: NotElement$2, - NotEqual: NotEqual$2, - NotEqualTilde: NotEqualTilde$2, - NotExists: NotExists$2, - NotGreater: NotGreater$2, - NotGreaterEqual: NotGreaterEqual$2, - NotGreaterFullEqual: NotGreaterFullEqual$2, - NotGreaterGreater: NotGreaterGreater$2, - NotGreaterLess: NotGreaterLess$2, - NotGreaterSlantEqual: NotGreaterSlantEqual$2, - NotGreaterTilde: NotGreaterTilde$2, - NotHumpDownHump: NotHumpDownHump$2, - NotHumpEqual: NotHumpEqual$2, - NotLeftTriangle: NotLeftTriangle$2, - NotLeftTriangleBar: NotLeftTriangleBar$2, - NotLeftTriangleEqual: NotLeftTriangleEqual$2, - NotLess: NotLess$2, - NotLessEqual: NotLessEqual$2, - NotLessGreater: NotLessGreater$2, - NotLessLess: NotLessLess$2, - NotLessSlantEqual: NotLessSlantEqual$2, - NotLessTilde: NotLessTilde$2, - NotNestedGreaterGreater: NotNestedGreaterGreater$2, - NotNestedLessLess: NotNestedLessLess$2, - NotPrecedes: NotPrecedes$2, - NotPrecedesEqual: NotPrecedesEqual$2, - NotPrecedesSlantEqual: NotPrecedesSlantEqual$2, - NotReverseElement: NotReverseElement$2, - NotRightTriangle: NotRightTriangle$2, - NotRightTriangleBar: NotRightTriangleBar$2, - NotRightTriangleEqual: NotRightTriangleEqual$2, - NotSquareSubset: NotSquareSubset$2, - NotSquareSubsetEqual: NotSquareSubsetEqual$2, - NotSquareSuperset: NotSquareSuperset$2, - NotSquareSupersetEqual: NotSquareSupersetEqual$2, - NotSubset: NotSubset$2, - NotSubsetEqual: NotSubsetEqual$2, - NotSucceeds: NotSucceeds$2, - NotSucceedsEqual: NotSucceedsEqual$2, - NotSucceedsSlantEqual: NotSucceedsSlantEqual$2, - NotSucceedsTilde: NotSucceedsTilde$2, - NotSuperset: NotSuperset$2, - NotSupersetEqual: NotSupersetEqual$2, - NotTilde: NotTilde$2, - NotTildeEqual: NotTildeEqual$2, - NotTildeFullEqual: NotTildeFullEqual$2, - NotTildeTilde: NotTildeTilde$2, - NotVerticalBar: NotVerticalBar$2, - Nscr: Nscr$2, - Ntild: Ntild$2, - Ntilde: Ntilde$2, - Nu: Nu$2, - OElig: OElig$2, - Oacut: Oacut$2, - Oacute: Oacute$2, - Ocir: Ocir$2, - Ocirc: Ocirc$2, - Ocy: Ocy$2, - Odblac: Odblac$2, - Ofr: Ofr$2, - Ograv: Ograv$2, - Ograve: Ograve$2, - Omacr: Omacr$2, - Omega: Omega$2, - Omicron: Omicron$2, - Oopf: Oopf$2, - OpenCurlyDoubleQuote: OpenCurlyDoubleQuote$2, - OpenCurlyQuote: OpenCurlyQuote$2, - Or: Or$2, - Oscr: Oscr$2, - Oslas: Oslas$2, - Oslash: Oslash$2, - Otild: Otild$2, - Otilde: Otilde$2, - Otimes: Otimes$2, - Oum: Oum$2, - Ouml: Ouml$2, - OverBar: OverBar$2, - OverBrace: OverBrace$2, - OverBracket: OverBracket$2, - OverParenthesis: OverParenthesis$2, - PartialD: PartialD$2, - Pcy: Pcy$2, - Pfr: Pfr$2, - Phi: Phi$2, - Pi: Pi$2, - PlusMinus: PlusMinus$2, - Poincareplane: Poincareplane$2, - Popf: Popf$2, - Pr: Pr$2, - Precedes: Precedes$2, - PrecedesEqual: PrecedesEqual$2, - PrecedesSlantEqual: PrecedesSlantEqual$2, - PrecedesTilde: PrecedesTilde$2, - Prime: Prime$2, - Product: Product$2, - Proportion: Proportion$2, - Proportional: Proportional$2, - Pscr: Pscr$2, - Psi: Psi$2, - QUO: QUO$2, - QUOT: QUOT$2, - Qfr: Qfr$2, - Qopf: Qopf$2, - Qscr: Qscr$2, - RBarr: RBarr$2, - RE: RE$2, - REG: REG$2, - Racute: Racute$2, - Rang: Rang$2, - Rarr: Rarr$2, - Rarrtl: Rarrtl$2, - Rcaron: Rcaron$2, - Rcedil: Rcedil$2, - Rcy: Rcy$2, - Re: Re$2, - ReverseElement: ReverseElement$2, - ReverseEquilibrium: ReverseEquilibrium$2, - ReverseUpEquilibrium: ReverseUpEquilibrium$2, - Rfr: Rfr$2, - Rho: Rho$2, - RightAngleBracket: RightAngleBracket$2, - RightArrow: RightArrow$2, - RightArrowBar: RightArrowBar$2, - RightArrowLeftArrow: RightArrowLeftArrow$2, - RightCeiling: RightCeiling$2, - RightDoubleBracket: RightDoubleBracket$2, - RightDownTeeVector: RightDownTeeVector$2, - RightDownVector: RightDownVector$2, - RightDownVectorBar: RightDownVectorBar$2, - RightFloor: RightFloor$2, - RightTee: RightTee$2, - RightTeeArrow: RightTeeArrow$2, - RightTeeVector: RightTeeVector$2, - RightTriangle: RightTriangle$2, - RightTriangleBar: RightTriangleBar$2, - RightTriangleEqual: RightTriangleEqual$2, - RightUpDownVector: RightUpDownVector$2, - RightUpTeeVector: RightUpTeeVector$2, - RightUpVector: RightUpVector$2, - RightUpVectorBar: RightUpVectorBar$2, - RightVector: RightVector$2, - RightVectorBar: RightVectorBar$2, - Rightarrow: Rightarrow$2, - Ropf: Ropf$2, - RoundImplies: RoundImplies$2, - Rrightarrow: Rrightarrow$2, - Rscr: Rscr$2, - Rsh: Rsh$2, - RuleDelayed: RuleDelayed$2, - SHCHcy: SHCHcy$2, - SHcy: SHcy$2, - SOFTcy: SOFTcy$2, - Sacute: Sacute$2, - Sc: Sc$2, - Scaron: Scaron$2, - Scedil: Scedil$2, - Scirc: Scirc$2, - Scy: Scy$2, - Sfr: Sfr$2, - ShortDownArrow: ShortDownArrow$2, - ShortLeftArrow: ShortLeftArrow$2, - ShortRightArrow: ShortRightArrow$2, - ShortUpArrow: ShortUpArrow$2, - Sigma: Sigma$2, - SmallCircle: SmallCircle$2, - Sopf: Sopf$2, - Sqrt: Sqrt$2, - Square: Square$2, - SquareIntersection: SquareIntersection$2, - SquareSubset: SquareSubset$2, - SquareSubsetEqual: SquareSubsetEqual$2, - SquareSuperset: SquareSuperset$2, - SquareSupersetEqual: SquareSupersetEqual$2, - SquareUnion: SquareUnion$2, - Sscr: Sscr$2, - Star: Star$2, - Sub: Sub$2, - Subset: Subset$2, - SubsetEqual: SubsetEqual$2, - Succeeds: Succeeds$2, - SucceedsEqual: SucceedsEqual$2, - SucceedsSlantEqual: SucceedsSlantEqual$2, - SucceedsTilde: SucceedsTilde$2, - SuchThat: SuchThat$2, - Sum: Sum$2, - Sup: Sup$2, - Superset: Superset$2, - SupersetEqual: SupersetEqual$2, - Supset: Supset$2, - THOR: THOR$2, - THORN: THORN$2, - TRADE: TRADE$2, - TSHcy: TSHcy$2, - TScy: TScy$2, - Tab: Tab$2, - Tau: Tau$2, - Tcaron: Tcaron$2, - Tcedil: Tcedil$2, - Tcy: Tcy$2, - Tfr: Tfr$2, - Therefore: Therefore$2, - Theta: Theta$2, - ThickSpace: ThickSpace$2, - ThinSpace: ThinSpace$2, - Tilde: Tilde$2, - TildeEqual: TildeEqual$2, - TildeFullEqual: TildeFullEqual$2, - TildeTilde: TildeTilde$2, - Topf: Topf$2, - TripleDot: TripleDot$2, - Tscr: Tscr$2, - Tstrok: Tstrok$2, - Uacut: Uacut$2, - Uacute: Uacute$2, - Uarr: Uarr$2, - Uarrocir: Uarrocir$2, - Ubrcy: Ubrcy$2, - Ubreve: Ubreve$2, - Ucir: Ucir$2, - Ucirc: Ucirc$2, - Ucy: Ucy$2, - Udblac: Udblac$2, - Ufr: Ufr$2, - Ugrav: Ugrav$2, - Ugrave: Ugrave$2, - Umacr: Umacr$2, - UnderBar: UnderBar$2, - UnderBrace: UnderBrace$2, - UnderBracket: UnderBracket$2, - UnderParenthesis: UnderParenthesis$2, - Union: Union$2, - UnionPlus: UnionPlus$2, - Uogon: Uogon$2, - Uopf: Uopf$2, - UpArrow: UpArrow$2, - UpArrowBar: UpArrowBar$2, - UpArrowDownArrow: UpArrowDownArrow$2, - UpDownArrow: UpDownArrow$2, - UpEquilibrium: UpEquilibrium$2, - UpTee: UpTee$2, - UpTeeArrow: UpTeeArrow$2, - Uparrow: Uparrow$2, - Updownarrow: Updownarrow$2, - UpperLeftArrow: UpperLeftArrow$2, - UpperRightArrow: UpperRightArrow$2, - Upsi: Upsi$2, - Upsilon: Upsilon$2, - Uring: Uring$2, - Uscr: Uscr$2, - Utilde: Utilde$2, - Uum: Uum$2, - Uuml: Uuml$2, - VDash: VDash$2, - Vbar: Vbar$2, - Vcy: Vcy$2, - Vdash: Vdash$2, - Vdashl: Vdashl$2, - Vee: Vee$2, - Verbar: Verbar$2, - Vert: Vert$2, - VerticalBar: VerticalBar$2, - VerticalLine: VerticalLine$2, - VerticalSeparator: VerticalSeparator$2, - VerticalTilde: VerticalTilde$2, - VeryThinSpace: VeryThinSpace$2, - Vfr: Vfr$2, - Vopf: Vopf$2, - Vscr: Vscr$2, - Vvdash: Vvdash$2, - Wcirc: Wcirc$2, - Wedge: Wedge$2, - Wfr: Wfr$2, - Wopf: Wopf$2, - Wscr: Wscr$2, - Xfr: Xfr$2, - Xi: Xi$2, - Xopf: Xopf$2, - Xscr: Xscr$2, - YAcy: YAcy$2, - YIcy: YIcy$2, - YUcy: YUcy$2, - Yacut: Yacut$2, - Yacute: Yacute$2, - Ycirc: Ycirc$2, - Ycy: Ycy$2, - Yfr: Yfr$2, - Yopf: Yopf$2, - Yscr: Yscr$2, - Yuml: Yuml$2, - ZHcy: ZHcy$2, - Zacute: Zacute$2, - Zcaron: Zcaron$2, - Zcy: Zcy$2, - Zdot: Zdot$2, - ZeroWidthSpace: ZeroWidthSpace$2, - Zeta: Zeta$2, - Zfr: Zfr$2, - Zopf: Zopf$2, - Zscr: Zscr$2, - aacut: aacut$2, - aacute: aacute$2, - abreve: abreve$2, - ac: ac$2, - acE: acE$2, - acd: acd$2, - acir: acir$2, - acirc: acirc$2, - acut: acut$2, - acute: acute$2, - acy: acy$2, - aeli: aeli$2, - aelig: aelig$2, - af: af$2, - afr: afr$2, - agrav: agrav$2, - agrave: agrave$2, - alefsym: alefsym$2, - aleph: aleph$2, - alpha: alpha$2, - amacr: amacr$2, - amalg: amalg$2, - am: am$2, - amp: amp$2, - and: and$2, - andand: andand$2, - andd: andd$2, - andslope: andslope$2, - andv: andv$2, - ang: ang$2, - ange: ange$2, - angle: angle$2, - angmsd: angmsd$2, - angmsdaa: angmsdaa$2, - angmsdab: angmsdab$2, - angmsdac: angmsdac$2, - angmsdad: angmsdad$2, - angmsdae: angmsdae$2, - angmsdaf: angmsdaf$2, - angmsdag: angmsdag$2, - angmsdah: angmsdah$2, - angrt: angrt$2, - angrtvb: angrtvb$2, - angrtvbd: angrtvbd$2, - angsph: angsph$2, - angst: angst$2, - angzarr: angzarr$2, - aogon: aogon$2, - aopf: aopf$2, - ap: ap$2, - apE: apE$2, - apacir: apacir$2, - ape: ape$2, - apid: apid$2, - apos: apos$2, - approx: approx$2, - approxeq: approxeq$2, - arin: arin$2, - aring: aring$2, - ascr: ascr$2, - ast: ast$2, - asymp: asymp$2, - asympeq: asympeq$2, - atild: atild$2, - atilde: atilde$2, - aum: aum$2, - auml: auml$2, - awconint: awconint$2, - awint: awint$2, - bNot: bNot$2, - backcong: backcong$2, - backepsilon: backepsilon$2, - backprime: backprime$2, - backsim: backsim$2, - backsimeq: backsimeq$2, - barvee: barvee$2, - barwed: barwed$2, - barwedge: barwedge$2, - bbrk: bbrk$2, - bbrktbrk: bbrktbrk$2, - bcong: bcong$2, - bcy: bcy$2, - bdquo: bdquo$2, - becaus: becaus$2, - because: because$2, - bemptyv: bemptyv$2, - bepsi: bepsi$2, - bernou: bernou$2, - beta: beta$2, - beth: beth$2, - between: between$2, - bfr: bfr$2, - bigcap: bigcap$2, - bigcirc: bigcirc$2, - bigcup: bigcup$2, - bigodot: bigodot$2, - bigoplus: bigoplus$2, - bigotimes: bigotimes$2, - bigsqcup: bigsqcup$2, - bigstar: bigstar$2, - bigtriangledown: bigtriangledown$2, - bigtriangleup: bigtriangleup$2, - biguplus: biguplus$2, - bigvee: bigvee$2, - bigwedge: bigwedge$2, - bkarow: bkarow$2, - blacklozenge: blacklozenge$2, - blacksquare: blacksquare$2, - blacktriangle: blacktriangle$2, - blacktriangledown: blacktriangledown$2, - blacktriangleleft: blacktriangleleft$2, - blacktriangleright: blacktriangleright$2, - blank: blank$2, - blk12: blk12$2, - blk14: blk14$2, - blk34: blk34$2, - block: block$2, - bne: bne$2, - bnequiv: bnequiv$2, - bnot: bnot$2, - bopf: bopf$2, - bot: bot$2, - bottom: bottom$2, - bowtie: bowtie$2, - boxDL: boxDL$2, - boxDR: boxDR$2, - boxDl: boxDl$2, - boxDr: boxDr$2, - boxH: boxH$2, - boxHD: boxHD$2, - boxHU: boxHU$2, - boxHd: boxHd$2, - boxHu: boxHu$2, - boxUL: boxUL$2, - boxUR: boxUR$2, - boxUl: boxUl$2, - boxUr: boxUr$2, - boxV: boxV$2, - boxVH: boxVH$2, - boxVL: boxVL$2, - boxVR: boxVR$2, - boxVh: boxVh$2, - boxVl: boxVl$2, - boxVr: boxVr$2, - boxbox: boxbox$2, - boxdL: boxdL$2, - boxdR: boxdR$2, - boxdl: boxdl$2, - boxdr: boxdr$2, - boxh: boxh$2, - boxhD: boxhD$2, - boxhU: boxhU$2, - boxhd: boxhd$2, - boxhu: boxhu$2, - boxminus: boxminus$2, - boxplus: boxplus$2, - boxtimes: boxtimes$2, - boxuL: boxuL$2, - boxuR: boxuR$2, - boxul: boxul$2, - boxur: boxur$2, - boxv: boxv$2, - boxvH: boxvH$2, - boxvL: boxvL$2, - boxvR: boxvR$2, - boxvh: boxvh$2, - boxvl: boxvl$2, - boxvr: boxvr$2, - bprime: bprime$2, - breve: breve$2, - brvba: brvba$2, - brvbar: brvbar$2, - bscr: bscr$2, - bsemi: bsemi$2, - bsim: bsim$2, - bsime: bsime$2, - bsol: bsol$2, - bsolb: bsolb$2, - bsolhsub: bsolhsub$2, - bull: bull$2, - bullet: bullet$2, - bump: bump$2, - bumpE: bumpE$2, - bumpe: bumpe$2, - bumpeq: bumpeq$2, - cacute: cacute$2, - cap: cap$2, - capand: capand$2, - capbrcup: capbrcup$2, - capcap: capcap$2, - capcup: capcup$2, - capdot: capdot$2, - caps: caps$2, - caret: caret$2, - caron: caron$2, - ccaps: ccaps$2, - ccaron: ccaron$2, - ccedi: ccedi$2, - ccedil: ccedil$2, - ccirc: ccirc$2, - ccups: ccups$2, - ccupssm: ccupssm$2, - cdot: cdot$2, - cedi: cedi$2, - cedil: cedil$2, - cemptyv: cemptyv$2, - cen: cen$2, - cent: cent$2, - centerdot: centerdot$2, - cfr: cfr$2, - chcy: chcy$2, - check: check$3, - checkmark: checkmark$2, - chi: chi$2, - cir: cir$2, - cirE: cirE$2, - circ: circ$2, - circeq: circeq$2, - circlearrowleft: circlearrowleft$2, - circlearrowright: circlearrowright$2, - circledR: circledR$2, - circledS: circledS$2, - circledast: circledast$2, - circledcirc: circledcirc$2, - circleddash: circleddash$2, - cire: cire$2, - cirfnint: cirfnint$2, - cirmid: cirmid$2, - cirscir: cirscir$2, - clubs: clubs$2, - clubsuit: clubsuit$2, - colon: colon$2, - colone: colone$2, - coloneq: coloneq$2, - comma: comma$2, - commat: commat$2, - comp: comp$2, - compfn: compfn$2, - complement: complement$2, - complexes: complexes$2, - cong: cong$2, - congdot: congdot$2, - conint: conint$2, - copf: copf$2, - coprod: coprod$2, - cop: cop$2, - copy: copy$2, - copysr: copysr$2, - crarr: crarr$2, - cross: cross$2, - cscr: cscr$2, - csub: csub$2, - csube: csube$2, - csup: csup$2, - csupe: csupe$2, - ctdot: ctdot$2, - cudarrl: cudarrl$2, - cudarrr: cudarrr$2, - cuepr: cuepr$2, - cuesc: cuesc$2, - cularr: cularr$2, - cularrp: cularrp$2, - cup: cup$2, - cupbrcap: cupbrcap$2, - cupcap: cupcap$2, - cupcup: cupcup$2, - cupdot: cupdot$2, - cupor: cupor$2, - cups: cups$2, - curarr: curarr$2, - curarrm: curarrm$2, - curlyeqprec: curlyeqprec$2, - curlyeqsucc: curlyeqsucc$2, - curlyvee: curlyvee$2, - curlywedge: curlywedge$2, - curre: curre$2, - curren: curren$2, - curvearrowleft: curvearrowleft$2, - curvearrowright: curvearrowright$2, - cuvee: cuvee$2, - cuwed: cuwed$2, - cwconint: cwconint$2, - cwint: cwint$2, - cylcty: cylcty$2, - dArr: dArr$2, - dHar: dHar$2, - dagger: dagger$2, - daleth: daleth$2, - darr: darr$2, - dash: dash$2, - dashv: dashv$2, - dbkarow: dbkarow$2, - dblac: dblac$2, - dcaron: dcaron$2, - dcy: dcy$2, - dd: dd$2, - ddagger: ddagger$2, - ddarr: ddarr$2, - ddotseq: ddotseq$2, - de: de$2, - deg: deg$2, - delta: delta$2, - demptyv: demptyv$2, - dfisht: dfisht$2, - dfr: dfr$2, - dharl: dharl$2, - dharr: dharr$2, - diam: diam$2, - diamond: diamond$2, - diamondsuit: diamondsuit$2, - diams: diams$2, - die: die$2, - digamma: digamma$2, - disin: disin$2, - div: div$2, - divid: divid$2, - divide: divide$2, - divideontimes: divideontimes$2, - divonx: divonx$2, - djcy: djcy$2, - dlcorn: dlcorn$2, - dlcrop: dlcrop$2, - dollar: dollar$2, - dopf: dopf$2, - dot: dot$2, - doteq: doteq$2, - doteqdot: doteqdot$2, - dotminus: dotminus$2, - dotplus: dotplus$2, - dotsquare: dotsquare$2, - doublebarwedge: doublebarwedge$2, - downarrow: downarrow$2, - downdownarrows: downdownarrows$2, - downharpoonleft: downharpoonleft$2, - downharpoonright: downharpoonright$2, - drbkarow: drbkarow$2, - drcorn: drcorn$2, - drcrop: drcrop$2, - dscr: dscr$2, - dscy: dscy$2, - dsol: dsol$2, - dstrok: dstrok$2, - dtdot: dtdot$2, - dtri: dtri$2, - dtrif: dtrif$2, - duarr: duarr$2, - duhar: duhar$2, - dwangle: dwangle$2, - dzcy: dzcy$2, - dzigrarr: dzigrarr$2, - eDDot: eDDot$2, - eDot: eDot$2, - eacut: eacut$2, - eacute: eacute$2, - easter: easter$2, - ecaron: ecaron$2, - ecir: ecir$2, - ecirc: ecirc$2, - ecolon: ecolon$2, - ecy: ecy$2, - edot: edot$2, - ee: ee$2, - efDot: efDot$2, - efr: efr$2, - eg: eg$2, - egrav: egrav$2, - egrave: egrave$2, - egs: egs$2, - egsdot: egsdot$2, - el: el$2, - elinters: elinters$2, - ell: ell$2, - els: els$2, - elsdot: elsdot$2, - emacr: emacr$2, - empty: empty$2, - emptyset: emptyset$2, - emptyv: emptyv$2, - emsp13: emsp13$2, - emsp14: emsp14$2, - emsp: emsp$2, - eng: eng$2, - ensp: ensp$2, - eogon: eogon$2, - eopf: eopf$2, - epar: epar$2, - eparsl: eparsl$2, - eplus: eplus$2, - epsi: epsi$2, - epsilon: epsilon$2, - epsiv: epsiv$2, - eqcirc: eqcirc$2, - eqcolon: eqcolon$2, - eqsim: eqsim$2, - eqslantgtr: eqslantgtr$2, - eqslantless: eqslantless$2, - equals: equals$2, - equest: equest$2, - equiv: equiv$2, - equivDD: equivDD$2, - eqvparsl: eqvparsl$2, - erDot: erDot$2, - erarr: erarr$2, - escr: escr$2, - esdot: esdot$2, - esim: esim$2, - eta: eta$2, - et: et$2, - eth: eth$2, - eum: eum$2, - euml: euml$2, - euro: euro$2, - excl: excl$2, - exist: exist$2, - expectation: expectation$2, - exponentiale: exponentiale$2, - fallingdotseq: fallingdotseq$2, - fcy: fcy$2, - female: female$2, - ffilig: ffilig$2, - fflig: fflig$2, - ffllig: ffllig$2, - ffr: ffr$2, - filig: filig$2, - fjlig: fjlig$2, - flat: flat$2, - fllig: fllig$2, - fltns: fltns$2, - fnof: fnof$2, - fopf: fopf$2, - forall: forall$2, - fork: fork$2, - forkv: forkv$2, - fpartint: fpartint$2, - frac1: frac1$2, - frac12: frac12$2, - frac13: frac13$2, - frac14: frac14$2, - frac15: frac15$2, - frac16: frac16$2, - frac18: frac18$2, - frac23: frac23$2, - frac25: frac25$2, - frac3: frac3$2, - frac34: frac34$2, - frac35: frac35$2, - frac38: frac38$2, - frac45: frac45$2, - frac56: frac56$2, - frac58: frac58$2, - frac78: frac78$2, - frasl: frasl$2, - frown: frown$2, - fscr: fscr$2, - gE: gE$2, - gEl: gEl$2, - gacute: gacute$2, - gamma: gamma$2, - gammad: gammad$2, - gap: gap$2, - gbreve: gbreve$2, - gcirc: gcirc$2, - gcy: gcy$2, - gdot: gdot$2, - ge: ge$2, - gel: gel$2, - geq: geq$2, - geqq: geqq$2, - geqslant: geqslant$2, - ges: ges$2, - gescc: gescc$2, - gesdot: gesdot$2, - gesdoto: gesdoto$2, - gesdotol: gesdotol$2, - gesl: gesl$2, - gesles: gesles$2, - gfr: gfr$2, - gg: gg$2, - ggg: ggg$2, - gimel: gimel$2, - gjcy: gjcy$2, - gl: gl$2, - glE: glE$2, - gla: gla$2, - glj: glj$2, - gnE: gnE$2, - gnap: gnap$2, - gnapprox: gnapprox$2, - gne: gne$2, - gneq: gneq$2, - gneqq: gneqq$2, - gnsim: gnsim$2, - gopf: gopf$2, - grave: grave$2, - gscr: gscr$2, - gsim: gsim$2, - gsime: gsime$2, - gsiml: gsiml$2, - g: g$2, - gt: gt$2, - gtcc: gtcc$2, - gtcir: gtcir$2, - gtdot: gtdot$2, - gtlPar: gtlPar$2, - gtquest: gtquest$2, - gtrapprox: gtrapprox$2, - gtrarr: gtrarr$2, - gtrdot: gtrdot$2, - gtreqless: gtreqless$2, - gtreqqless: gtreqqless$2, - gtrless: gtrless$2, - gtrsim: gtrsim$2, - gvertneqq: gvertneqq$2, - gvnE: gvnE$2, - hArr: hArr$2, - hairsp: hairsp$2, - half: half$2, - hamilt: hamilt$2, - hardcy: hardcy$2, - harr: harr$2, - harrcir: harrcir$2, - harrw: harrw$2, - hbar: hbar$2, - hcirc: hcirc$2, - hearts: hearts$2, - heartsuit: heartsuit$2, - hellip: hellip$2, - hercon: hercon$2, - hfr: hfr$2, - hksearow: hksearow$2, - hkswarow: hkswarow$2, - hoarr: hoarr$2, - homtht: homtht$2, - hookleftarrow: hookleftarrow$2, - hookrightarrow: hookrightarrow$2, - hopf: hopf$2, - horbar: horbar$2, - hscr: hscr$2, - hslash: hslash$2, - hstrok: hstrok$2, - hybull: hybull$2, - hyphen: hyphen$2, - iacut: iacut$2, - iacute: iacute$2, - ic: ic$2, - icir: icir$2, - icirc: icirc$2, - icy: icy$2, - iecy: iecy$2, - iexc: iexc$2, - iexcl: iexcl$2, - iff: iff$2, - ifr: ifr$2, - igrav: igrav$2, - igrave: igrave$2, - ii: ii$2, - iiiint: iiiint$2, - iiint: iiint$2, - iinfin: iinfin$2, - iiota: iiota$2, - ijlig: ijlig$2, - imacr: imacr$2, - image: image$3, - imagline: imagline$2, - imagpart: imagpart$2, - imath: imath$2, - imof: imof$2, - imped: imped$2, - "in": "∈", - incare: incare$2, - infin: infin$2, - infintie: infintie$2, - inodot: inodot$2, - int: int$3, - intcal: intcal$2, - integers: integers$2, - intercal: intercal$2, - intlarhk: intlarhk$2, - intprod: intprod$2, - iocy: iocy$2, - iogon: iogon$2, - iopf: iopf$2, - iota: iota$2, - iprod: iprod$2, - iques: iques$2, - iquest: iquest$2, - iscr: iscr$2, - isin: isin$2, - isinE: isinE$2, - isindot: isindot$2, - isins: isins$2, - isinsv: isinsv$2, - isinv: isinv$2, - it: it$2, - itilde: itilde$2, - iukcy: iukcy$2, - ium: ium$2, - iuml: iuml$2, - jcirc: jcirc$2, - jcy: jcy$2, - jfr: jfr$2, - jmath: jmath$2, - jopf: jopf$2, - jscr: jscr$2, - jsercy: jsercy$2, - jukcy: jukcy$2, - kappa: kappa$2, - kappav: kappav$2, - kcedil: kcedil$2, - kcy: kcy$2, - kfr: kfr$2, - kgreen: kgreen$2, - khcy: khcy$2, - kjcy: kjcy$2, - kopf: kopf$2, - kscr: kscr$2, - lAarr: lAarr$2, - lArr: lArr$2, - lAtail: lAtail$2, - lBarr: lBarr$2, - lE: lE$2, - lEg: lEg$2, - lHar: lHar$2, - lacute: lacute$2, - laemptyv: laemptyv$2, - lagran: lagran$2, - lambda: lambda$2, - lang: lang$2, - langd: langd$2, - langle: langle$2, - lap: lap$2, - laqu: laqu$2, - laquo: laquo$2, - larr: larr$2, - larrb: larrb$2, - larrbfs: larrbfs$2, - larrfs: larrfs$2, - larrhk: larrhk$2, - larrlp: larrlp$2, - larrpl: larrpl$2, - larrsim: larrsim$2, - larrtl: larrtl$2, - lat: lat$2, - latail: latail$2, - late: late$2, - lates: lates$2, - lbarr: lbarr$2, - lbbrk: lbbrk$2, - lbrace: lbrace$2, - lbrack: lbrack$2, - lbrke: lbrke$2, - lbrksld: lbrksld$2, - lbrkslu: lbrkslu$2, - lcaron: lcaron$2, - lcedil: lcedil$2, - lceil: lceil$2, - lcub: lcub$2, - lcy: lcy$2, - ldca: ldca$2, - ldquo: ldquo$2, - ldquor: ldquor$2, - ldrdhar: ldrdhar$2, - ldrushar: ldrushar$2, - ldsh: ldsh$2, - le: le$2, - leftarrow: leftarrow$2, - leftarrowtail: leftarrowtail$2, - leftharpoondown: leftharpoondown$2, - leftharpoonup: leftharpoonup$2, - leftleftarrows: leftleftarrows$2, - leftrightarrow: leftrightarrow$2, - leftrightarrows: leftrightarrows$2, - leftrightharpoons: leftrightharpoons$2, - leftrightsquigarrow: leftrightsquigarrow$2, - leftthreetimes: leftthreetimes$2, - leg: leg$2, - leq: leq$2, - leqq: leqq$2, - leqslant: leqslant$2, - les: les$2, - lescc: lescc$2, - lesdot: lesdot$2, - lesdoto: lesdoto$2, - lesdotor: lesdotor$2, - lesg: lesg$2, - lesges: lesges$2, - lessapprox: lessapprox$2, - lessdot: lessdot$2, - lesseqgtr: lesseqgtr$2, - lesseqqgtr: lesseqqgtr$2, - lessgtr: lessgtr$2, - lesssim: lesssim$2, - lfisht: lfisht$2, - lfloor: lfloor$2, - lfr: lfr$2, - lg: lg$2, - lgE: lgE$2, - lhard: lhard$2, - lharu: lharu$2, - lharul: lharul$2, - lhblk: lhblk$2, - ljcy: ljcy$2, - ll: ll$2, - llarr: llarr$2, - llcorner: llcorner$2, - llhard: llhard$2, - lltri: lltri$2, - lmidot: lmidot$2, - lmoust: lmoust$2, - lmoustache: lmoustache$2, - lnE: lnE$2, - lnap: lnap$2, - lnapprox: lnapprox$2, - lne: lne$2, - lneq: lneq$2, - lneqq: lneqq$2, - lnsim: lnsim$2, - loang: loang$2, - loarr: loarr$2, - lobrk: lobrk$2, - longleftarrow: longleftarrow$2, - longleftrightarrow: longleftrightarrow$2, - longmapsto: longmapsto$2, - longrightarrow: longrightarrow$2, - looparrowleft: looparrowleft$2, - looparrowright: looparrowright$2, - lopar: lopar$2, - lopf: lopf$2, - loplus: loplus$2, - lotimes: lotimes$2, - lowast: lowast$2, - lowbar: lowbar$2, - loz: loz$2, - lozenge: lozenge$2, - lozf: lozf$2, - lpar: lpar$2, - lparlt: lparlt$2, - lrarr: lrarr$2, - lrcorner: lrcorner$2, - lrhar: lrhar$2, - lrhard: lrhard$2, - lrm: lrm$2, - lrtri: lrtri$2, - lsaquo: lsaquo$2, - lscr: lscr$2, - lsh: lsh$2, - lsim: lsim$2, - lsime: lsime$2, - lsimg: lsimg$2, - lsqb: lsqb$2, - lsquo: lsquo$2, - lsquor: lsquor$2, - lstrok: lstrok$2, - l: l$2, - lt: lt$3, - ltcc: ltcc$2, - ltcir: ltcir$2, - ltdot: ltdot$2, - lthree: lthree$2, - ltimes: ltimes$2, - ltlarr: ltlarr$2, - ltquest: ltquest$2, - ltrPar: ltrPar$2, - ltri: ltri$2, - ltrie: ltrie$2, - ltrif: ltrif$2, - lurdshar: lurdshar$2, - luruhar: luruhar$2, - lvertneqq: lvertneqq$2, - lvnE: lvnE$2, - mDDot: mDDot$2, - mac: mac$2, - macr: macr$2, - male: male$2, - malt: malt$2, - maltese: maltese$2, - map: map$5, - mapsto: mapsto$2, - mapstodown: mapstodown$2, - mapstoleft: mapstoleft$2, - mapstoup: mapstoup$2, - marker: marker$2, - mcomma: mcomma$2, - mcy: mcy$2, - mdash: mdash$2, - measuredangle: measuredangle$2, - mfr: mfr$2, - mho: mho$2, - micr: micr$2, - micro: micro$2, - mid: mid$2, - midast: midast$2, - midcir: midcir$2, - middo: middo$2, - middot: middot$2, - minus: minus$2, - minusb: minusb$2, - minusd: minusd$2, - minusdu: minusdu$2, - mlcp: mlcp$2, - mldr: mldr$2, - mnplus: mnplus$2, - models: models$2, - mopf: mopf$2, - mp: mp$2, - mscr: mscr$2, - mstpos: mstpos$2, - mu: mu$2, - multimap: multimap$2, - mumap: mumap$2, - nGg: nGg$2, - nGt: nGt$2, - nGtv: nGtv$2, - nLeftarrow: nLeftarrow$2, - nLeftrightarrow: nLeftrightarrow$2, - nLl: nLl$2, - nLt: nLt$2, - nLtv: nLtv$2, - nRightarrow: nRightarrow$2, - nVDash: nVDash$2, - nVdash: nVdash$2, - nabla: nabla$2, - nacute: nacute$2, - nang: nang$2, - nap: nap$2, - napE: napE$2, - napid: napid$2, - napos: napos$2, - napprox: napprox$2, - natur: natur$2, - natural: natural$2, - naturals: naturals$2, - nbs: nbs$2, - nbsp: nbsp$2, - nbump: nbump$2, - nbumpe: nbumpe$2, - ncap: ncap$2, - ncaron: ncaron$2, - ncedil: ncedil$2, - ncong: ncong$2, - ncongdot: ncongdot$2, - ncup: ncup$2, - ncy: ncy$2, - ndash: ndash$2, - ne: ne$2, - neArr: neArr$2, - nearhk: nearhk$2, - nearr: nearr$2, - nearrow: nearrow$2, - nedot: nedot$2, - nequiv: nequiv$2, - nesear: nesear$2, - nesim: nesim$2, - nexist: nexist$2, - nexists: nexists$2, - nfr: nfr$2, - ngE: ngE$2, - nge: nge$2, - ngeq: ngeq$2, - ngeqq: ngeqq$2, - ngeqslant: ngeqslant$2, - nges: nges$2, - ngsim: ngsim$2, - ngt: ngt$2, - ngtr: ngtr$2, - nhArr: nhArr$2, - nharr: nharr$2, - nhpar: nhpar$2, - ni: ni$2, - nis: nis$2, - nisd: nisd$2, - niv: niv$2, - njcy: njcy$2, - nlArr: nlArr$2, - nlE: nlE$2, - nlarr: nlarr$2, - nldr: nldr$2, - nle: nle$2, - nleftarrow: nleftarrow$2, - nleftrightarrow: nleftrightarrow$2, - nleq: nleq$2, - nleqq: nleqq$2, - nleqslant: nleqslant$2, - nles: nles$2, - nless: nless$2, - nlsim: nlsim$2, - nlt: nlt$2, - nltri: nltri$2, - nltrie: nltrie$2, - nmid: nmid$2, - nopf: nopf$2, - no: no$2, - not: not$2, - notin: notin$2, - notinE: notinE$2, - notindot: notindot$2, - notinva: notinva$2, - notinvb: notinvb$2, - notinvc: notinvc$2, - notni: notni$2, - notniva: notniva$2, - notnivb: notnivb$2, - notnivc: notnivc$2, - npar: npar$2, - nparallel: nparallel$2, - nparsl: nparsl$2, - npart: npart$2, - npolint: npolint$2, - npr: npr$2, - nprcue: nprcue$2, - npre: npre$2, - nprec: nprec$2, - npreceq: npreceq$2, - nrArr: nrArr$2, - nrarr: nrarr$2, - nrarrc: nrarrc$2, - nrarrw: nrarrw$2, - nrightarrow: nrightarrow$2, - nrtri: nrtri$2, - nrtrie: nrtrie$2, - nsc: nsc$2, - nsccue: nsccue$2, - nsce: nsce$2, - nscr: nscr$2, - nshortmid: nshortmid$2, - nshortparallel: nshortparallel$2, - nsim: nsim$2, - nsime: nsime$2, - nsimeq: nsimeq$2, - nsmid: nsmid$2, - nspar: nspar$2, - nsqsube: nsqsube$2, - nsqsupe: nsqsupe$2, - nsub: nsub$2, - nsubE: nsubE$2, - nsube: nsube$2, - nsubset: nsubset$2, - nsubseteq: nsubseteq$2, - nsubseteqq: nsubseteqq$2, - nsucc: nsucc$2, - nsucceq: nsucceq$2, - nsup: nsup$2, - nsupE: nsupE$2, - nsupe: nsupe$2, - nsupset: nsupset$2, - nsupseteq: nsupseteq$2, - nsupseteqq: nsupseteqq$2, - ntgl: ntgl$2, - ntild: ntild$2, - ntilde: ntilde$2, - ntlg: ntlg$2, - ntriangleleft: ntriangleleft$2, - ntrianglelefteq: ntrianglelefteq$2, - ntriangleright: ntriangleright$2, - ntrianglerighteq: ntrianglerighteq$2, - nu: nu$2, - num: num$2, - numero: numero$2, - numsp: numsp$2, - nvDash: nvDash$2, - nvHarr: nvHarr$2, - nvap: nvap$2, - nvdash: nvdash$2, - nvge: nvge$2, - nvgt: nvgt$2, - nvinfin: nvinfin$2, - nvlArr: nvlArr$2, - nvle: nvle$2, - nvlt: nvlt$2, - nvltrie: nvltrie$2, - nvrArr: nvrArr$2, - nvrtrie: nvrtrie$2, - nvsim: nvsim$2, - nwArr: nwArr$2, - nwarhk: nwarhk$2, - nwarr: nwarr$2, - nwarrow: nwarrow$2, - nwnear: nwnear$2, - oS: oS$2, - oacut: oacut$2, - oacute: oacute$2, - oast: oast$2, - ocir: ocir$2, - ocirc: ocirc$2, - ocy: ocy$2, - odash: odash$2, - odblac: odblac$2, - odiv: odiv$2, - odot: odot$2, - odsold: odsold$2, - oelig: oelig$2, - ofcir: ofcir$2, - ofr: ofr$2, - ogon: ogon$2, - ograv: ograv$2, - ograve: ograve$2, - ogt: ogt$2, - ohbar: ohbar$2, - ohm: ohm$2, - oint: oint$2, - olarr: olarr$2, - olcir: olcir$2, - olcross: olcross$2, - oline: oline$2, - olt: olt$2, - omacr: omacr$2, - omega: omega$2, - omicron: omicron$2, - omid: omid$2, - ominus: ominus$2, - oopf: oopf$2, - opar: opar$2, - operp: operp$2, - oplus: oplus$2, - or: or$2, - orarr: orarr$2, - ord: ord$2, - order: order$2, - orderof: orderof$2, - ordf: ordf$2, - ordm: ordm$2, - origof: origof$2, - oror: oror$2, - orslope: orslope$2, - orv: orv$2, - oscr: oscr$2, - oslas: oslas$2, - oslash: oslash$2, - osol: osol$2, - otild: otild$2, - otilde: otilde$2, - otimes: otimes$2, - otimesas: otimesas$2, - oum: oum$2, - ouml: ouml$2, - ovbar: ovbar$2, - par: par$2, - para: para$2, - parallel: parallel$2, - parsim: parsim$2, - parsl: parsl$2, - part: part$2, - pcy: pcy$2, - percnt: percnt$2, - period: period$2, - permil: permil$2, - perp: perp$2, - pertenk: pertenk$2, - pfr: pfr$2, - phi: phi$2, - phiv: phiv$2, - phmmat: phmmat$2, - phone: phone$2, - pi: pi$2, - pitchfork: pitchfork$2, - piv: piv$2, - planck: planck$2, - planckh: planckh$2, - plankv: plankv$2, - plus: plus$2, - plusacir: plusacir$2, - plusb: plusb$2, - pluscir: pluscir$2, - plusdo: plusdo$2, - plusdu: plusdu$2, - pluse: pluse$2, - plusm: plusm$2, - plusmn: plusmn$2, - plussim: plussim$2, - plustwo: plustwo$2, - pm: pm$2, - pointint: pointint$2, - popf: popf$2, - poun: poun$2, - pound: pound$2, - pr: pr$2, - prE: prE$2, - prap: prap$2, - prcue: prcue$2, - pre: pre$2, - prec: prec$2, - precapprox: precapprox$2, - preccurlyeq: preccurlyeq$2, - preceq: preceq$2, - precnapprox: precnapprox$2, - precneqq: precneqq$2, - precnsim: precnsim$2, - precsim: precsim$2, - prime: prime$2, - primes: primes$2, - prnE: prnE$2, - prnap: prnap$2, - prnsim: prnsim$2, - prod: prod$2, - profalar: profalar$2, - profline: profline$2, - profsurf: profsurf$2, - prop: prop$2, - propto: propto$2, - prsim: prsim$2, - prurel: prurel$2, - pscr: pscr$2, - psi: psi$2, - puncsp: puncsp$2, - qfr: qfr$2, - qint: qint$2, - qopf: qopf$2, - qprime: qprime$2, - qscr: qscr$2, - quaternions: quaternions$2, - quatint: quatint$2, - quest: quest$2, - questeq: questeq$2, - quo: quo$2, - quot: quot$2, - rAarr: rAarr$2, - rArr: rArr$2, - rAtail: rAtail$2, - rBarr: rBarr$2, - rHar: rHar$2, - race: race$2, - racute: racute$2, - radic: radic$2, - raemptyv: raemptyv$2, - rang: rang$2, - rangd: rangd$2, - range: range$2, - rangle: rangle$2, - raqu: raqu$2, - raquo: raquo$2, - rarr: rarr$2, - rarrap: rarrap$2, - rarrb: rarrb$2, - rarrbfs: rarrbfs$2, - rarrc: rarrc$2, - rarrfs: rarrfs$2, - rarrhk: rarrhk$2, - rarrlp: rarrlp$2, - rarrpl: rarrpl$2, - rarrsim: rarrsim$2, - rarrtl: rarrtl$2, - rarrw: rarrw$2, - ratail: ratail$2, - ratio: ratio$2, - rationals: rationals$2, - rbarr: rbarr$2, - rbbrk: rbbrk$2, - rbrace: rbrace$2, - rbrack: rbrack$2, - rbrke: rbrke$2, - rbrksld: rbrksld$2, - rbrkslu: rbrkslu$2, - rcaron: rcaron$2, - rcedil: rcedil$2, - rceil: rceil$2, - rcub: rcub$2, - rcy: rcy$2, - rdca: rdca$2, - rdldhar: rdldhar$2, - rdquo: rdquo$2, - rdquor: rdquor$2, - rdsh: rdsh$2, - real: real$2, - realine: realine$2, - realpart: realpart$2, - reals: reals$2, - rect: rect$2, - re: re$6, - reg: reg$2, - rfisht: rfisht$2, - rfloor: rfloor$2, - rfr: rfr$2, - rhard: rhard$2, - rharu: rharu$2, - rharul: rharul$2, - rho: rho$2, - rhov: rhov$2, - rightarrow: rightarrow$2, - rightarrowtail: rightarrowtail$2, - rightharpoondown: rightharpoondown$2, - rightharpoonup: rightharpoonup$2, - rightleftarrows: rightleftarrows$2, - rightleftharpoons: rightleftharpoons$2, - rightrightarrows: rightrightarrows$2, - rightsquigarrow: rightsquigarrow$2, - rightthreetimes: rightthreetimes$2, - ring: ring$2, - risingdotseq: risingdotseq$2, - rlarr: rlarr$2, - rlhar: rlhar$2, - rlm: rlm$2, - rmoust: rmoust$2, - rmoustache: rmoustache$2, - rnmid: rnmid$2, - roang: roang$2, - roarr: roarr$2, - robrk: robrk$2, - ropar: ropar$2, - ropf: ropf$2, - roplus: roplus$2, - rotimes: rotimes$2, - rpar: rpar$2, - rpargt: rpargt$2, - rppolint: rppolint$2, - rrarr: rrarr$2, - rsaquo: rsaquo$2, - rscr: rscr$2, - rsh: rsh$2, - rsqb: rsqb$2, - rsquo: rsquo$2, - rsquor: rsquor$2, - rthree: rthree$2, - rtimes: rtimes$2, - rtri: rtri$2, - rtrie: rtrie$2, - rtrif: rtrif$2, - rtriltri: rtriltri$2, - ruluhar: ruluhar$2, - rx: rx$2, - sacute: sacute$2, - sbquo: sbquo$2, - sc: sc$2, - scE: scE$2, - scap: scap$2, - scaron: scaron$2, - sccue: sccue$2, - sce: sce$2, - scedil: scedil$2, - scirc: scirc$2, - scnE: scnE$2, - scnap: scnap$2, - scnsim: scnsim$2, - scpolint: scpolint$2, - scsim: scsim$2, - scy: scy$2, - sdot: sdot$2, - sdotb: sdotb$2, - sdote: sdote$2, - seArr: seArr$2, - searhk: searhk$2, - searr: searr$2, - searrow: searrow$2, - sec: sec$2, - sect: sect$2, - semi: semi$2, - seswar: seswar$2, - setminus: setminus$2, - setmn: setmn$2, - sext: sext$2, - sfr: sfr$2, - sfrown: sfrown$2, - sharp: sharp$2, - shchcy: shchcy$2, - shcy: shcy$2, - shortmid: shortmid$2, - shortparallel: shortparallel$2, - sh: sh$2, - shy: shy$2, - sigma: sigma$2, - sigmaf: sigmaf$2, - sigmav: sigmav$2, - sim: sim$2, - simdot: simdot$2, - sime: sime$2, - simeq: simeq$2, - simg: simg$2, - simgE: simgE$2, - siml: siml$2, - simlE: simlE$2, - simne: simne$2, - simplus: simplus$2, - simrarr: simrarr$2, - slarr: slarr$2, - smallsetminus: smallsetminus$2, - smashp: smashp$2, - smeparsl: smeparsl$2, - smid: smid$2, - smile: smile$2, - smt: smt$2, - smte: smte$2, - smtes: smtes$2, - softcy: softcy$2, - sol: sol$2, - solb: solb$2, - solbar: solbar$2, - sopf: sopf$2, - spades: spades$2, - spadesuit: spadesuit$2, - spar: spar$2, - sqcap: sqcap$2, - sqcaps: sqcaps$2, - sqcup: sqcup$2, - sqcups: sqcups$2, - sqsub: sqsub$2, - sqsube: sqsube$2, - sqsubset: sqsubset$2, - sqsubseteq: sqsubseteq$2, - sqsup: sqsup$2, - sqsupe: sqsupe$2, - sqsupset: sqsupset$2, - sqsupseteq: sqsupseteq$2, - squ: squ$2, - square: square$2, - squarf: squarf$2, - squf: squf$2, - srarr: srarr$2, - sscr: sscr$2, - ssetmn: ssetmn$2, - ssmile: ssmile$2, - sstarf: sstarf$2, - star: star$2, - starf: starf$2, - straightepsilon: straightepsilon$2, - straightphi: straightphi$2, - strns: strns$2, - sub: sub$2, - subE: subE$2, - subdot: subdot$2, - sube: sube$2, - subedot: subedot$2, - submult: submult$2, - subnE: subnE$2, - subne: subne$2, - subplus: subplus$2, - subrarr: subrarr$2, - subset: subset$2, - subseteq: subseteq$2, - subseteqq: subseteqq$2, - subsetneq: subsetneq$2, - subsetneqq: subsetneqq$2, - subsim: subsim$2, - subsub: subsub$2, - subsup: subsup$2, - succ: succ$2, - succapprox: succapprox$2, - succcurlyeq: succcurlyeq$2, - succeq: succeq$2, - succnapprox: succnapprox$2, - succneqq: succneqq$2, - succnsim: succnsim$2, - succsim: succsim$2, - sum: sum$2, - sung: sung$2, - sup: sup$2, - sup1: sup1$2, - sup2: sup2$2, - sup3: sup3$2, - supE: supE$2, - supdot: supdot$2, - supdsub: supdsub$2, - supe: supe$2, - supedot: supedot$2, - suphsol: suphsol$2, - suphsub: suphsub$2, - suplarr: suplarr$2, - supmult: supmult$2, - supnE: supnE$2, - supne: supne$2, - supplus: supplus$2, - supset: supset$2, - supseteq: supseteq$2, - supseteqq: supseteqq$2, - supsetneq: supsetneq$2, - supsetneqq: supsetneqq$2, - supsim: supsim$2, - supsub: supsub$2, - supsup: supsup$2, - swArr: swArr$2, - swarhk: swarhk$2, - swarr: swarr$2, - swarrow: swarrow$2, - swnwar: swnwar$2, - szli: szli$2, - szlig: szlig$2, - target: target$2, - tau: tau$2, - tbrk: tbrk$2, - tcaron: tcaron$2, - tcedil: tcedil$2, - tcy: tcy$2, - tdot: tdot$2, - telrec: telrec$2, - tfr: tfr$2, - there4: there4$2, - therefore: therefore$2, - theta: theta$2, - thetasym: thetasym$2, - thetav: thetav$2, - thickapprox: thickapprox$2, - thicksim: thicksim$2, - thinsp: thinsp$2, - thkap: thkap$2, - thksim: thksim$2, - thor: thor$2, - thorn: thorn$2, - tilde: tilde$2, - time: time$2, - times: times$2, - timesb: timesb$2, - timesbar: timesbar$2, - timesd: timesd$2, - tint: tint$2, - toea: toea$2, - top: top$2, - topbot: topbot$2, - topcir: topcir$2, - topf: topf$2, - topfork: topfork$2, - tosa: tosa$2, - tprime: tprime$2, - trade: trade$2, - triangle: triangle$2, - triangledown: triangledown$2, - triangleleft: triangleleft$2, - trianglelefteq: trianglelefteq$2, - triangleq: triangleq$2, - triangleright: triangleright$2, - trianglerighteq: trianglerighteq$2, - tridot: tridot$2, - trie: trie$2, - triminus: triminus$2, - triplus: triplus$2, - trisb: trisb$2, - tritime: tritime$2, - trpezium: trpezium$2, - tscr: tscr$2, - tscy: tscy$2, - tshcy: tshcy$2, - tstrok: tstrok$2, - twixt: twixt$2, - twoheadleftarrow: twoheadleftarrow$2, - twoheadrightarrow: twoheadrightarrow$2, - uArr: uArr$2, - uHar: uHar$2, - uacut: uacut$2, - uacute: uacute$2, - uarr: uarr$2, - ubrcy: ubrcy$2, - ubreve: ubreve$2, - ucir: ucir$2, - ucirc: ucirc$2, - ucy: ucy$2, - udarr: udarr$2, - udblac: udblac$2, - udhar: udhar$2, - ufisht: ufisht$2, - ufr: ufr$2, - ugrav: ugrav$2, - ugrave: ugrave$2, - uharl: uharl$2, - uharr: uharr$2, - uhblk: uhblk$2, - ulcorn: ulcorn$2, - ulcorner: ulcorner$2, - ulcrop: ulcrop$2, - ultri: ultri$2, - umacr: umacr$2, - um: um$2, - uml: uml$2, - uogon: uogon$2, - uopf: uopf$2, - uparrow: uparrow$2, - updownarrow: updownarrow$2, - upharpoonleft: upharpoonleft$2, - upharpoonright: upharpoonright$2, - uplus: uplus$2, - upsi: upsi$2, - upsih: upsih$2, - upsilon: upsilon$2, - upuparrows: upuparrows$2, - urcorn: urcorn$2, - urcorner: urcorner$2, - urcrop: urcrop$2, - uring: uring$2, - urtri: urtri$2, - uscr: uscr$2, - utdot: utdot$2, - utilde: utilde$2, - utri: utri$2, - utrif: utrif$2, - uuarr: uuarr$2, - uum: uum$2, - uuml: uuml$2, - uwangle: uwangle$2, - vArr: vArr$2, - vBar: vBar$2, - vBarv: vBarv$2, - vDash: vDash$2, - vangrt: vangrt$2, - varepsilon: varepsilon$2, - varkappa: varkappa$2, - varnothing: varnothing$2, - varphi: varphi$2, - varpi: varpi$2, - varpropto: varpropto$2, - varr: varr$2, - varrho: varrho$2, - varsigma: varsigma$2, - varsubsetneq: varsubsetneq$2, - varsubsetneqq: varsubsetneqq$2, - varsupsetneq: varsupsetneq$2, - varsupsetneqq: varsupsetneqq$2, - vartheta: vartheta$2, - vartriangleleft: vartriangleleft$2, - vartriangleright: vartriangleright$2, - vcy: vcy$2, - vdash: vdash$2, - vee: vee$2, - veebar: veebar$2, - veeeq: veeeq$2, - vellip: vellip$2, - verbar: verbar$2, - vert: vert$2, - vfr: vfr$2, - vltri: vltri$2, - vnsub: vnsub$2, - vnsup: vnsup$2, - vopf: vopf$2, - vprop: vprop$2, - vrtri: vrtri$2, - vscr: vscr$2, - vsubnE: vsubnE$2, - vsubne: vsubne$2, - vsupnE: vsupnE$2, - vsupne: vsupne$2, - vzigzag: vzigzag$2, - wcirc: wcirc$2, - wedbar: wedbar$2, - wedge: wedge$2, - wedgeq: wedgeq$2, - weierp: weierp$2, - wfr: wfr$2, - wopf: wopf$2, - wp: wp$2, - wr: wr$2, - wreath: wreath$2, - wscr: wscr$2, - xcap: xcap$2, - xcirc: xcirc$2, - xcup: xcup$2, - xdtri: xdtri$2, - xfr: xfr$2, - xhArr: xhArr$2, - xharr: xharr$2, - xi: xi$2, - xlArr: xlArr$2, - xlarr: xlarr$2, - xmap: xmap$2, - xnis: xnis$2, - xodot: xodot$2, - xopf: xopf$2, - xoplus: xoplus$2, - xotime: xotime$2, - xrArr: xrArr$2, - xrarr: xrarr$2, - xscr: xscr$2, - xsqcup: xsqcup$2, - xuplus: xuplus$2, - xutri: xutri$2, - xvee: xvee$2, - xwedge: xwedge$2, - yacut: yacut$2, - yacute: yacute$2, - yacy: yacy$2, - ycirc: ycirc$2, - ycy: ycy$2, - ye: ye$2, - yen: yen$2, - yfr: yfr$2, - yicy: yicy$2, - yopf: yopf$2, - yscr: yscr$2, - yucy: yucy$2, - yum: yum$2, - yuml: yuml$2, - zacute: zacute$2, - zcaron: zcaron$2, - zcy: zcy$2, - zdot: zdot$2, - zeetrf: zeetrf$2, - zeta: zeta$2, - zfr: zfr$2, - zhcy: zhcy$2, - zigrarr: zigrarr$2, - zopf: zopf$2, - zscr: zscr$2, - zwj: zwj$2, - zwnj: zwnj$2 +var characterEntities = { + AEli: 'Æ', + AElig: 'Æ', + AM: '&', + AMP: '&', + Aacut: 'Á', + Aacute: 'Á', + Abreve: 'Ă', + Acir: 'Â', + Acirc: 'Â', + Acy: 'А', + Afr: '𝔄', + Agrav: 'À', + Agrave: 'À', + Alpha: 'Α', + Amacr: 'Ā', + And: '⩓', + Aogon: 'Ą', + Aopf: '𝔸', + ApplyFunction: '', + Arin: 'Å', + Aring: 'Å', + Ascr: '𝒜', + Assign: '≔', + Atild: 'Ã', + Atilde: 'Ã', + Aum: 'Ä', + Auml: 'Ä', + Backslash: '∖', + Barv: '⫧', + Barwed: '⌆', + Bcy: 'Б', + Because: '∵', + Bernoullis: 'ℬ', + Beta: 'Β', + Bfr: '𝔅', + Bopf: '𝔹', + Breve: '˘', + Bscr: 'ℬ', + Bumpeq: '≎', + CHcy: 'Ч', + COP: '©', + COPY: '©', + Cacute: 'Ć', + Cap: '⋒', + CapitalDifferentialD: 'ⅅ', + Cayleys: 'ℭ', + Ccaron: 'Č', + Ccedi: 'Ç', + Ccedil: 'Ç', + Ccirc: 'Ĉ', + Cconint: '∰', + Cdot: 'Ċ', + Cedilla: '¸', + CenterDot: '·', + Cfr: 'ℭ', + Chi: 'Χ', + CircleDot: '⊙', + CircleMinus: '⊖', + CirclePlus: '⊕', + CircleTimes: '⊗', + ClockwiseContourIntegral: '∲', + CloseCurlyDoubleQuote: '”', + CloseCurlyQuote: '’', + Colon: '∷', + Colone: '⩴', + Congruent: '≡', + Conint: '∯', + ContourIntegral: '∮', + Copf: 'ℂ', + Coproduct: '∐', + CounterClockwiseContourIntegral: '∳', + Cross: '⨯', + Cscr: '𝒞', + Cup: '⋓', + CupCap: '≍', + DD: 'ⅅ', + DDotrahd: '⤑', + DJcy: 'Ђ', + DScy: 'Ѕ', + DZcy: 'Џ', + Dagger: '‡', + Darr: '↡', + Dashv: '⫤', + Dcaron: 'Ď', + Dcy: 'Д', + Del: '∇', + Delta: 'Δ', + Dfr: '𝔇', + DiacriticalAcute: '´', + DiacriticalDot: '˙', + DiacriticalDoubleAcute: '˝', + DiacriticalGrave: '`', + DiacriticalTilde: '˜', + Diamond: '⋄', + DifferentialD: 'ⅆ', + Dopf: '𝔻', + Dot: '¨', + DotDot: '⃜', + DotEqual: '≐', + DoubleContourIntegral: '∯', + DoubleDot: '¨', + DoubleDownArrow: '⇓', + DoubleLeftArrow: '⇐', + DoubleLeftRightArrow: '⇔', + DoubleLeftTee: '⫤', + DoubleLongLeftArrow: '⟸', + DoubleLongLeftRightArrow: '⟺', + DoubleLongRightArrow: '⟹', + DoubleRightArrow: '⇒', + DoubleRightTee: '⊨', + DoubleUpArrow: '⇑', + DoubleUpDownArrow: '⇕', + DoubleVerticalBar: '∥', + DownArrow: '↓', + DownArrowBar: '⤓', + DownArrowUpArrow: '⇵', + DownBreve: '̑', + DownLeftRightVector: '⥐', + DownLeftTeeVector: '⥞', + DownLeftVector: '↽', + DownLeftVectorBar: '⥖', + DownRightTeeVector: '⥟', + DownRightVector: '⇁', + DownRightVectorBar: '⥗', + DownTee: '⊤', + DownTeeArrow: '↧', + Downarrow: '⇓', + Dscr: '𝒟', + Dstrok: 'Đ', + ENG: 'Ŋ', + ET: 'Ð', + ETH: 'Ð', + Eacut: 'É', + Eacute: 'É', + Ecaron: 'Ě', + Ecir: 'Ê', + Ecirc: 'Ê', + Ecy: 'Э', + Edot: 'Ė', + Efr: '𝔈', + Egrav: 'È', + Egrave: 'È', + Element: '∈', + Emacr: 'Ē', + EmptySmallSquare: '◻', + EmptyVerySmallSquare: '▫', + Eogon: 'Ę', + Eopf: '𝔼', + Epsilon: 'Ε', + Equal: '⩵', + EqualTilde: '≂', + Equilibrium: '⇌', + Escr: 'ℰ', + Esim: '⩳', + Eta: 'Η', + Eum: 'Ë', + Euml: 'Ë', + Exists: '∃', + ExponentialE: 'ⅇ', + Fcy: 'Ф', + Ffr: '𝔉', + FilledSmallSquare: '◼', + FilledVerySmallSquare: '▪', + Fopf: '𝔽', + ForAll: '∀', + Fouriertrf: 'ℱ', + Fscr: 'ℱ', + GJcy: 'Ѓ', + G: '>', + GT: '>', + Gamma: 'Γ', + Gammad: 'Ϝ', + Gbreve: 'Ğ', + Gcedil: 'Ģ', + Gcirc: 'Ĝ', + Gcy: 'Г', + Gdot: 'Ġ', + Gfr: '𝔊', + Gg: '⋙', + Gopf: '𝔾', + GreaterEqual: '≥', + GreaterEqualLess: '⋛', + GreaterFullEqual: '≧', + GreaterGreater: '⪢', + GreaterLess: '≷', + GreaterSlantEqual: '⩾', + GreaterTilde: '≳', + Gscr: '𝒢', + Gt: '≫', + HARDcy: 'Ъ', + Hacek: 'ˇ', + Hat: '^', + Hcirc: 'Ĥ', + Hfr: 'ℌ', + HilbertSpace: 'ℋ', + Hopf: 'ℍ', + HorizontalLine: '─', + Hscr: 'ℋ', + Hstrok: 'Ħ', + HumpDownHump: '≎', + HumpEqual: '≏', + IEcy: 'Е', + IJlig: 'IJ', + IOcy: 'Ё', + Iacut: 'Í', + Iacute: 'Í', + Icir: 'Î', + Icirc: 'Î', + Icy: 'И', + Idot: 'İ', + Ifr: 'ℑ', + Igrav: 'Ì', + Igrave: 'Ì', + Im: 'ℑ', + Imacr: 'Ī', + ImaginaryI: 'ⅈ', + Implies: '⇒', + Int: '∬', + Integral: '∫', + Intersection: '⋂', + InvisibleComma: '', + InvisibleTimes: '', + Iogon: 'Į', + Iopf: '𝕀', + Iota: 'Ι', + Iscr: 'ℐ', + Itilde: 'Ĩ', + Iukcy: 'І', + Ium: 'Ï', + Iuml: 'Ï', + Jcirc: 'Ĵ', + Jcy: 'Й', + Jfr: '𝔍', + Jopf: '𝕁', + Jscr: '𝒥', + Jsercy: 'Ј', + Jukcy: 'Є', + KHcy: 'Х', + KJcy: 'Ќ', + Kappa: 'Κ', + Kcedil: 'Ķ', + Kcy: 'К', + Kfr: '𝔎', + Kopf: '𝕂', + Kscr: '𝒦', + LJcy: 'Љ', + L: '<', + LT: '<', + Lacute: 'Ĺ', + Lambda: 'Λ', + Lang: '⟪', + Laplacetrf: 'ℒ', + Larr: '↞', + Lcaron: 'Ľ', + Lcedil: 'Ļ', + Lcy: 'Л', + LeftAngleBracket: '⟨', + LeftArrow: '←', + LeftArrowBar: '⇤', + LeftArrowRightArrow: '⇆', + LeftCeiling: '⌈', + LeftDoubleBracket: '⟦', + LeftDownTeeVector: '⥡', + LeftDownVector: '⇃', + LeftDownVectorBar: '⥙', + LeftFloor: '⌊', + LeftRightArrow: '↔', + LeftRightVector: '⥎', + LeftTee: '⊣', + LeftTeeArrow: '↤', + LeftTeeVector: '⥚', + LeftTriangle: '⊲', + LeftTriangleBar: '⧏', + LeftTriangleEqual: '⊴', + LeftUpDownVector: '⥑', + LeftUpTeeVector: '⥠', + LeftUpVector: '↿', + LeftUpVectorBar: '⥘', + LeftVector: '↼', + LeftVectorBar: '⥒', + Leftarrow: '⇐', + Leftrightarrow: '⇔', + LessEqualGreater: '⋚', + LessFullEqual: '≦', + LessGreater: '≶', + LessLess: '⪡', + LessSlantEqual: '⩽', + LessTilde: '≲', + Lfr: '𝔏', + Ll: '⋘', + Lleftarrow: '⇚', + Lmidot: 'Ŀ', + LongLeftArrow: '⟵', + LongLeftRightArrow: '⟷', + LongRightArrow: '⟶', + Longleftarrow: '⟸', + Longleftrightarrow: '⟺', + Longrightarrow: '⟹', + Lopf: '𝕃', + LowerLeftArrow: '↙', + LowerRightArrow: '↘', + Lscr: 'ℒ', + Lsh: '↰', + Lstrok: 'Ł', + Lt: '≪', + Map: '⤅', + Mcy: 'М', + MediumSpace: ' ', + Mellintrf: 'ℳ', + Mfr: '𝔐', + MinusPlus: '∓', + Mopf: '𝕄', + Mscr: 'ℳ', + Mu: 'Μ', + NJcy: 'Њ', + Nacute: 'Ń', + Ncaron: 'Ň', + Ncedil: 'Ņ', + Ncy: 'Н', + NegativeMediumSpace: '', + NegativeThickSpace: '', + NegativeThinSpace: '', + NegativeVeryThinSpace: '', + NestedGreaterGreater: '≫', + NestedLessLess: '≪', + NewLine: '\n', + Nfr: '𝔑', + NoBreak: '', + NonBreakingSpace: ' ', + Nopf: 'ℕ', + Not: '⫬', + NotCongruent: '≢', + NotCupCap: '≭', + NotDoubleVerticalBar: '∦', + NotElement: '∉', + NotEqual: '≠', + NotEqualTilde: '≂̸', + NotExists: '∄', + NotGreater: '≯', + NotGreaterEqual: '≱', + NotGreaterFullEqual: '≧̸', + NotGreaterGreater: '≫̸', + NotGreaterLess: '≹', + NotGreaterSlantEqual: '⩾̸', + NotGreaterTilde: '≵', + NotHumpDownHump: '≎̸', + NotHumpEqual: '≏̸', + NotLeftTriangle: '⋪', + NotLeftTriangleBar: '⧏̸', + NotLeftTriangleEqual: '⋬', + NotLess: '≮', + NotLessEqual: '≰', + NotLessGreater: '≸', + NotLessLess: '≪̸', + NotLessSlantEqual: '⩽̸', + NotLessTilde: '≴', + NotNestedGreaterGreater: '⪢̸', + NotNestedLessLess: '⪡̸', + NotPrecedes: '⊀', + NotPrecedesEqual: '⪯̸', + NotPrecedesSlantEqual: '⋠', + NotReverseElement: '∌', + NotRightTriangle: '⋫', + NotRightTriangleBar: '⧐̸', + NotRightTriangleEqual: '⋭', + NotSquareSubset: '⊏̸', + NotSquareSubsetEqual: '⋢', + NotSquareSuperset: '⊐̸', + NotSquareSupersetEqual: '⋣', + NotSubset: '⊂⃒', + NotSubsetEqual: '⊈', + NotSucceeds: '⊁', + NotSucceedsEqual: '⪰̸', + NotSucceedsSlantEqual: '⋡', + NotSucceedsTilde: '≿̸', + NotSuperset: '⊃⃒', + NotSupersetEqual: '⊉', + NotTilde: '≁', + NotTildeEqual: '≄', + NotTildeFullEqual: '≇', + NotTildeTilde: '≉', + NotVerticalBar: '∤', + Nscr: '𝒩', + Ntild: 'Ñ', + Ntilde: 'Ñ', + Nu: 'Ν', + OElig: 'Œ', + Oacut: 'Ó', + Oacute: 'Ó', + Ocir: 'Ô', + Ocirc: 'Ô', + Ocy: 'О', + Odblac: 'Ő', + Ofr: '𝔒', + Ograv: 'Ò', + Ograve: 'Ò', + Omacr: 'Ō', + Omega: 'Ω', + Omicron: 'Ο', + Oopf: '𝕆', + OpenCurlyDoubleQuote: '“', + OpenCurlyQuote: '‘', + Or: '⩔', + Oscr: '𝒪', + Oslas: 'Ø', + Oslash: 'Ø', + Otild: 'Õ', + Otilde: 'Õ', + Otimes: '⨷', + Oum: 'Ö', + Ouml: 'Ö', + OverBar: '‾', + OverBrace: '⏞', + OverBracket: '⎴', + OverParenthesis: '⏜', + PartialD: '∂', + Pcy: 'П', + Pfr: '𝔓', + Phi: 'Φ', + Pi: 'Π', + PlusMinus: '±', + Poincareplane: 'ℌ', + Popf: 'ℙ', + Pr: '⪻', + Precedes: '≺', + PrecedesEqual: '⪯', + PrecedesSlantEqual: '≼', + PrecedesTilde: '≾', + Prime: '″', + Product: '∏', + Proportion: '∷', + Proportional: '∝', + Pscr: '𝒫', + Psi: 'Ψ', + QUO: '"', + QUOT: '"', + Qfr: '𝔔', + Qopf: 'ℚ', + Qscr: '𝒬', + RBarr: '⤐', + RE: '®', + REG: '®', + Racute: 'Ŕ', + Rang: '⟫', + Rarr: '↠', + Rarrtl: '⤖', + Rcaron: 'Ř', + Rcedil: 'Ŗ', + Rcy: 'Р', + Re: 'ℜ', + ReverseElement: '∋', + ReverseEquilibrium: '⇋', + ReverseUpEquilibrium: '⥯', + Rfr: 'ℜ', + Rho: 'Ρ', + RightAngleBracket: '⟩', + RightArrow: '→', + RightArrowBar: '⇥', + RightArrowLeftArrow: '⇄', + RightCeiling: '⌉', + RightDoubleBracket: '⟧', + RightDownTeeVector: '⥝', + RightDownVector: '⇂', + RightDownVectorBar: '⥕', + RightFloor: '⌋', + RightTee: '⊢', + RightTeeArrow: '↦', + RightTeeVector: '⥛', + RightTriangle: '⊳', + RightTriangleBar: '⧐', + RightTriangleEqual: '⊵', + RightUpDownVector: '⥏', + RightUpTeeVector: '⥜', + RightUpVector: '↾', + RightUpVectorBar: '⥔', + RightVector: '⇀', + RightVectorBar: '⥓', + Rightarrow: '⇒', + Ropf: 'ℝ', + RoundImplies: '⥰', + Rrightarrow: '⇛', + Rscr: 'ℛ', + Rsh: '↱', + RuleDelayed: '⧴', + SHCHcy: 'Щ', + SHcy: 'Ш', + SOFTcy: 'Ь', + Sacute: 'Ś', + Sc: '⪼', + Scaron: 'Š', + Scedil: 'Ş', + Scirc: 'Ŝ', + Scy: 'С', + Sfr: '𝔖', + ShortDownArrow: '↓', + ShortLeftArrow: '←', + ShortRightArrow: '→', + ShortUpArrow: '↑', + Sigma: 'Σ', + SmallCircle: '∘', + Sopf: '𝕊', + Sqrt: '√', + Square: '□', + SquareIntersection: '⊓', + SquareSubset: '⊏', + SquareSubsetEqual: '⊑', + SquareSuperset: '⊐', + SquareSupersetEqual: '⊒', + SquareUnion: '⊔', + Sscr: '𝒮', + Star: '⋆', + Sub: '⋐', + Subset: '⋐', + SubsetEqual: '⊆', + Succeeds: '≻', + SucceedsEqual: '⪰', + SucceedsSlantEqual: '≽', + SucceedsTilde: '≿', + SuchThat: '∋', + Sum: '∑', + Sup: '⋑', + Superset: '⊃', + SupersetEqual: '⊇', + Supset: '⋑', + THOR: 'Þ', + THORN: 'Þ', + TRADE: '™', + TSHcy: 'Ћ', + TScy: 'Ц', + Tab: '\t', + Tau: 'Τ', + Tcaron: 'Ť', + Tcedil: 'Ţ', + Tcy: 'Т', + Tfr: '𝔗', + Therefore: '∴', + Theta: 'Θ', + ThickSpace: ' ', + ThinSpace: ' ', + Tilde: '∼', + TildeEqual: '≃', + TildeFullEqual: '≅', + TildeTilde: '≈', + Topf: '𝕋', + TripleDot: '⃛', + Tscr: '𝒯', + Tstrok: 'Ŧ', + Uacut: 'Ú', + Uacute: 'Ú', + Uarr: '↟', + Uarrocir: '⥉', + Ubrcy: 'Ў', + Ubreve: 'Ŭ', + Ucir: 'Û', + Ucirc: 'Û', + Ucy: 'У', + Udblac: 'Ű', + Ufr: '𝔘', + Ugrav: 'Ù', + Ugrave: 'Ù', + Umacr: 'Ū', + UnderBar: '_', + UnderBrace: '⏟', + UnderBracket: '⎵', + UnderParenthesis: '⏝', + Union: '⋃', + UnionPlus: '⊎', + Uogon: 'Ų', + Uopf: '𝕌', + UpArrow: '↑', + UpArrowBar: '⤒', + UpArrowDownArrow: '⇅', + UpDownArrow: '↕', + UpEquilibrium: '⥮', + UpTee: '⊥', + UpTeeArrow: '↥', + Uparrow: '⇑', + Updownarrow: '⇕', + UpperLeftArrow: '↖', + UpperRightArrow: '↗', + Upsi: 'ϒ', + Upsilon: 'Υ', + Uring: 'Ů', + Uscr: '𝒰', + Utilde: 'Ũ', + Uum: 'Ü', + Uuml: 'Ü', + VDash: '⊫', + Vbar: '⫫', + Vcy: 'В', + Vdash: '⊩', + Vdashl: '⫦', + Vee: '⋁', + Verbar: '‖', + Vert: '‖', + VerticalBar: '∣', + VerticalLine: '|', + VerticalSeparator: '❘', + VerticalTilde: '≀', + VeryThinSpace: ' ', + Vfr: '𝔙', + Vopf: '𝕍', + Vscr: '𝒱', + Vvdash: '⊪', + Wcirc: 'Ŵ', + Wedge: '⋀', + Wfr: '𝔚', + Wopf: '𝕎', + Wscr: '𝒲', + Xfr: '𝔛', + Xi: 'Ξ', + Xopf: '𝕏', + Xscr: '𝒳', + YAcy: 'Я', + YIcy: 'Ї', + YUcy: 'Ю', + Yacut: 'Ý', + Yacute: 'Ý', + Ycirc: 'Ŷ', + Ycy: 'Ы', + Yfr: '𝔜', + Yopf: '𝕐', + Yscr: '𝒴', + Yuml: 'Ÿ', + ZHcy: 'Ж', + Zacute: 'Ź', + Zcaron: 'Ž', + Zcy: 'З', + Zdot: 'Ż', + ZeroWidthSpace: '', + Zeta: 'Ζ', + Zfr: 'ℨ', + Zopf: 'ℤ', + Zscr: '𝒵', + aacut: 'á', + aacute: 'á', + abreve: 'ă', + ac: '∾', + acE: '∾̳', + acd: '∿', + acir: 'â', + acirc: 'â', + acut: '´', + acute: '´', + acy: 'а', + aeli: 'æ', + aelig: 'æ', + af: '', + afr: '𝔞', + agrav: 'à', + agrave: 'à', + alefsym: 'ℵ', + aleph: 'ℵ', + alpha: 'α', + amacr: 'ā', + amalg: '⨿', + am: '&', + amp: '&', + and: '∧', + andand: '⩕', + andd: '⩜', + andslope: '⩘', + andv: '⩚', + ang: '∠', + ange: '⦤', + angle: '∠', + angmsd: '∡', + angmsdaa: '⦨', + angmsdab: '⦩', + angmsdac: '⦪', + angmsdad: '⦫', + angmsdae: '⦬', + angmsdaf: '⦭', + angmsdag: '⦮', + angmsdah: '⦯', + angrt: '∟', + angrtvb: '⊾', + angrtvbd: '⦝', + angsph: '∢', + angst: 'Å', + angzarr: '⍼', + aogon: 'ą', + aopf: '𝕒', + ap: '≈', + apE: '⩰', + apacir: '⩯', + ape: '≊', + apid: '≋', + apos: "'", + approx: '≈', + approxeq: '≊', + arin: 'å', + aring: 'å', + ascr: '𝒶', + ast: '*', + asymp: '≈', + asympeq: '≍', + atild: 'ã', + atilde: 'ã', + aum: 'ä', + auml: 'ä', + awconint: '∳', + awint: '⨑', + bNot: '⫭', + backcong: '≌', + backepsilon: '϶', + backprime: '‵', + backsim: '∽', + backsimeq: '⋍', + barvee: '⊽', + barwed: '⌅', + barwedge: '⌅', + bbrk: '⎵', + bbrktbrk: '⎶', + bcong: '≌', + bcy: 'б', + bdquo: '„', + becaus: '∵', + because: '∵', + bemptyv: '⦰', + bepsi: '϶', + bernou: 'ℬ', + beta: 'β', + beth: 'ℶ', + between: '≬', + bfr: '𝔟', + bigcap: '⋂', + bigcirc: '◯', + bigcup: '⋃', + bigodot: '⨀', + bigoplus: '⨁', + bigotimes: '⨂', + bigsqcup: '⨆', + bigstar: '★', + bigtriangledown: '▽', + bigtriangleup: '△', + biguplus: '⨄', + bigvee: '⋁', + bigwedge: '⋀', + bkarow: '⤍', + blacklozenge: '⧫', + blacksquare: '▪', + blacktriangle: '▴', + blacktriangledown: '▾', + blacktriangleleft: '◂', + blacktriangleright: '▸', + blank: '␣', + blk12: '▒', + blk14: '░', + blk34: '▓', + block: '█', + bne: '=⃥', + bnequiv: '≡⃥', + bnot: '⌐', + bopf: '𝕓', + bot: '⊥', + bottom: '⊥', + bowtie: '⋈', + boxDL: '╗', + boxDR: '╔', + boxDl: '╖', + boxDr: '╓', + boxH: '═', + boxHD: '╦', + boxHU: '╩', + boxHd: '╤', + boxHu: '╧', + boxUL: '╝', + boxUR: '╚', + boxUl: '╜', + boxUr: '╙', + boxV: '║', + boxVH: '╬', + boxVL: '╣', + boxVR: '╠', + boxVh: '╫', + boxVl: '╢', + boxVr: '╟', + boxbox: '⧉', + boxdL: '╕', + boxdR: '╒', + boxdl: '┐', + boxdr: '┌', + boxh: '─', + boxhD: '╥', + boxhU: '╨', + boxhd: '┬', + boxhu: '┴', + boxminus: '⊟', + boxplus: '⊞', + boxtimes: '⊠', + boxuL: '╛', + boxuR: '╘', + boxul: '┘', + boxur: '└', + boxv: '│', + boxvH: '╪', + boxvL: '╡', + boxvR: '╞', + boxvh: '┼', + boxvl: '┤', + boxvr: '├', + bprime: '‵', + breve: '˘', + brvba: '¦', + brvbar: '¦', + bscr: '𝒷', + bsemi: '⁏', + bsim: '∽', + bsime: '⋍', + bsol: '\\', + bsolb: '⧅', + bsolhsub: '⟈', + bull: '•', + bullet: '•', + bump: '≎', + bumpE: '⪮', + bumpe: '≏', + bumpeq: '≏', + cacute: 'ć', + cap: '∩', + capand: '⩄', + capbrcup: '⩉', + capcap: '⩋', + capcup: '⩇', + capdot: '⩀', + caps: '∩︀', + caret: '⁁', + caron: 'ˇ', + ccaps: '⩍', + ccaron: 'č', + ccedi: 'ç', + ccedil: 'ç', + ccirc: 'ĉ', + ccups: '⩌', + ccupssm: '⩐', + cdot: 'ċ', + cedi: '¸', + cedil: '¸', + cemptyv: '⦲', + cen: '¢', + cent: '¢', + centerdot: '·', + cfr: '𝔠', + chcy: 'ч', + check: '✓', + checkmark: '✓', + chi: 'χ', + cir: '○', + cirE: '⧃', + circ: 'ˆ', + circeq: '≗', + circlearrowleft: '↺', + circlearrowright: '↻', + circledR: '®', + circledS: 'Ⓢ', + circledast: '⊛', + circledcirc: '⊚', + circleddash: '⊝', + cire: '≗', + cirfnint: '⨐', + cirmid: '⫯', + cirscir: '⧂', + clubs: '♣', + clubsuit: '♣', + colon: ':', + colone: '≔', + coloneq: '≔', + comma: ',', + commat: '@', + comp: '∁', + compfn: '∘', + complement: '∁', + complexes: 'ℂ', + cong: '≅', + congdot: '⩭', + conint: '∮', + copf: '𝕔', + coprod: '∐', + cop: '©', + copy: '©', + copysr: '℗', + crarr: '↵', + cross: '✗', + cscr: '𝒸', + csub: '⫏', + csube: '⫑', + csup: '⫐', + csupe: '⫒', + ctdot: '⋯', + cudarrl: '⤸', + cudarrr: '⤵', + cuepr: '⋞', + cuesc: '⋟', + cularr: '↶', + cularrp: '⤽', + cup: '∪', + cupbrcap: '⩈', + cupcap: '⩆', + cupcup: '⩊', + cupdot: '⊍', + cupor: '⩅', + cups: '∪︀', + curarr: '↷', + curarrm: '⤼', + curlyeqprec: '⋞', + curlyeqsucc: '⋟', + curlyvee: '⋎', + curlywedge: '⋏', + curre: '¤', + curren: '¤', + curvearrowleft: '↶', + curvearrowright: '↷', + cuvee: '⋎', + cuwed: '⋏', + cwconint: '∲', + cwint: '∱', + cylcty: '⌭', + dArr: '⇓', + dHar: '⥥', + dagger: '†', + daleth: 'ℸ', + darr: '↓', + dash: '‐', + dashv: '⊣', + dbkarow: '⤏', + dblac: '˝', + dcaron: 'ď', + dcy: 'д', + dd: 'ⅆ', + ddagger: '‡', + ddarr: '⇊', + ddotseq: '⩷', + de: '°', + deg: '°', + delta: 'δ', + demptyv: '⦱', + dfisht: '⥿', + dfr: '𝔡', + dharl: '⇃', + dharr: '⇂', + diam: '⋄', + diamond: '⋄', + diamondsuit: '♦', + diams: '♦', + die: '¨', + digamma: 'ϝ', + disin: '⋲', + div: '÷', + divid: '÷', + divide: '÷', + divideontimes: '⋇', + divonx: '⋇', + djcy: 'ђ', + dlcorn: '⌞', + dlcrop: '⌍', + dollar: '$', + dopf: '𝕕', + dot: '˙', + doteq: '≐', + doteqdot: '≑', + dotminus: '∸', + dotplus: '∔', + dotsquare: '⊡', + doublebarwedge: '⌆', + downarrow: '↓', + downdownarrows: '⇊', + downharpoonleft: '⇃', + downharpoonright: '⇂', + drbkarow: '⤐', + drcorn: '⌟', + drcrop: '⌌', + dscr: '𝒹', + dscy: 'ѕ', + dsol: '⧶', + dstrok: 'đ', + dtdot: '⋱', + dtri: '▿', + dtrif: '▾', + duarr: '⇵', + duhar: '⥯', + dwangle: '⦦', + dzcy: 'џ', + dzigrarr: '⟿', + eDDot: '⩷', + eDot: '≑', + eacut: 'é', + eacute: 'é', + easter: '⩮', + ecaron: 'ě', + ecir: 'ê', + ecirc: 'ê', + ecolon: '≕', + ecy: 'э', + edot: 'ė', + ee: 'ⅇ', + efDot: '≒', + efr: '𝔢', + eg: '⪚', + egrav: 'è', + egrave: 'è', + egs: '⪖', + egsdot: '⪘', + el: '⪙', + elinters: '⏧', + ell: 'ℓ', + els: '⪕', + elsdot: '⪗', + emacr: 'ē', + empty: '∅', + emptyset: '∅', + emptyv: '∅', + emsp13: ' ', + emsp14: ' ', + emsp: ' ', + eng: 'ŋ', + ensp: ' ', + eogon: 'ę', + eopf: '𝕖', + epar: '⋕', + eparsl: '⧣', + eplus: '⩱', + epsi: 'ε', + epsilon: 'ε', + epsiv: 'ϵ', + eqcirc: '≖', + eqcolon: '≕', + eqsim: '≂', + eqslantgtr: '⪖', + eqslantless: '⪕', + equals: '=', + equest: '≟', + equiv: '≡', + equivDD: '⩸', + eqvparsl: '⧥', + erDot: '≓', + erarr: '⥱', + escr: 'ℯ', + esdot: '≐', + esim: '≂', + eta: 'η', + et: 'ð', + eth: 'ð', + eum: 'ë', + euml: 'ë', + euro: '€', + excl: '!', + exist: '∃', + expectation: 'ℰ', + exponentiale: 'ⅇ', + fallingdotseq: '≒', + fcy: 'ф', + female: '♀', + ffilig: 'ffi', + fflig: 'ff', + ffllig: 'ffl', + ffr: '𝔣', + filig: 'fi', + fjlig: 'fj', + flat: '♭', + fllig: 'fl', + fltns: '▱', + fnof: 'ƒ', + fopf: '𝕗', + forall: '∀', + fork: '⋔', + forkv: '⫙', + fpartint: '⨍', + frac1: '¼', + frac12: '½', + frac13: '⅓', + frac14: '¼', + frac15: '⅕', + frac16: '⅙', + frac18: '⅛', + frac23: '⅔', + frac25: '⅖', + frac3: '¾', + frac34: '¾', + frac35: '⅗', + frac38: '⅜', + frac45: '⅘', + frac56: '⅚', + frac58: '⅝', + frac78: '⅞', + frasl: '⁄', + frown: '⌢', + fscr: '𝒻', + gE: '≧', + gEl: '⪌', + gacute: 'ǵ', + gamma: 'γ', + gammad: 'ϝ', + gap: '⪆', + gbreve: 'ğ', + gcirc: 'ĝ', + gcy: 'г', + gdot: 'ġ', + ge: '≥', + gel: '⋛', + geq: '≥', + geqq: '≧', + geqslant: '⩾', + ges: '⩾', + gescc: '⪩', + gesdot: '⪀', + gesdoto: '⪂', + gesdotol: '⪄', + gesl: '⋛︀', + gesles: '⪔', + gfr: '𝔤', + gg: '≫', + ggg: '⋙', + gimel: 'ℷ', + gjcy: 'ѓ', + gl: '≷', + glE: '⪒', + gla: '⪥', + glj: '⪤', + gnE: '≩', + gnap: '⪊', + gnapprox: '⪊', + gne: '⪈', + gneq: '⪈', + gneqq: '≩', + gnsim: '⋧', + gopf: '𝕘', + grave: '`', + gscr: 'ℊ', + gsim: '≳', + gsime: '⪎', + gsiml: '⪐', + g: '>', + gt: '>', + gtcc: '⪧', + gtcir: '⩺', + gtdot: '⋗', + gtlPar: '⦕', + gtquest: '⩼', + gtrapprox: '⪆', + gtrarr: '⥸', + gtrdot: '⋗', + gtreqless: '⋛', + gtreqqless: '⪌', + gtrless: '≷', + gtrsim: '≳', + gvertneqq: '≩︀', + gvnE: '≩︀', + hArr: '⇔', + hairsp: ' ', + half: '½', + hamilt: 'ℋ', + hardcy: 'ъ', + harr: '↔', + harrcir: '⥈', + harrw: '↭', + hbar: 'ℏ', + hcirc: 'ĥ', + hearts: '♥', + heartsuit: '♥', + hellip: '…', + hercon: '⊹', + hfr: '𝔥', + hksearow: '⤥', + hkswarow: '⤦', + hoarr: '⇿', + homtht: '∻', + hookleftarrow: '↩', + hookrightarrow: '↪', + hopf: '𝕙', + horbar: '―', + hscr: '𝒽', + hslash: 'ℏ', + hstrok: 'ħ', + hybull: '⁃', + hyphen: '‐', + iacut: 'í', + iacute: 'í', + ic: '', + icir: 'î', + icirc: 'î', + icy: 'и', + iecy: 'е', + iexc: '¡', + iexcl: '¡', + iff: '⇔', + ifr: '𝔦', + igrav: 'ì', + igrave: 'ì', + ii: 'ⅈ', + iiiint: '⨌', + iiint: '∭', + iinfin: '⧜', + iiota: '℩', + ijlig: 'ij', + imacr: 'ī', + image: 'ℑ', + imagline: 'ℐ', + imagpart: 'ℑ', + imath: 'ı', + imof: '⊷', + imped: 'Ƶ', + in: '∈', + incare: '℅', + infin: '∞', + infintie: '⧝', + inodot: 'ı', + int: '∫', + intcal: '⊺', + integers: 'ℤ', + intercal: '⊺', + intlarhk: '⨗', + intprod: '⨼', + iocy: 'ё', + iogon: 'į', + iopf: '𝕚', + iota: 'ι', + iprod: '⨼', + iques: '¿', + iquest: '¿', + iscr: '𝒾', + isin: '∈', + isinE: '⋹', + isindot: '⋵', + isins: '⋴', + isinsv: '⋳', + isinv: '∈', + it: '', + itilde: 'ĩ', + iukcy: 'і', + ium: 'ï', + iuml: 'ï', + jcirc: 'ĵ', + jcy: 'й', + jfr: '𝔧', + jmath: 'ȷ', + jopf: '𝕛', + jscr: '𝒿', + jsercy: 'ј', + jukcy: 'є', + kappa: 'κ', + kappav: 'ϰ', + kcedil: 'ķ', + kcy: 'к', + kfr: '𝔨', + kgreen: 'ĸ', + khcy: 'х', + kjcy: 'ќ', + kopf: '𝕜', + kscr: '𝓀', + lAarr: '⇚', + lArr: '⇐', + lAtail: '⤛', + lBarr: '⤎', + lE: '≦', + lEg: '⪋', + lHar: '⥢', + lacute: 'ĺ', + laemptyv: '⦴', + lagran: 'ℒ', + lambda: 'λ', + lang: '⟨', + langd: '⦑', + langle: '⟨', + lap: '⪅', + laqu: '«', + laquo: '«', + larr: '←', + larrb: '⇤', + larrbfs: '⤟', + larrfs: '⤝', + larrhk: '↩', + larrlp: '↫', + larrpl: '⤹', + larrsim: '⥳', + larrtl: '↢', + lat: '⪫', + latail: '⤙', + late: '⪭', + lates: '⪭︀', + lbarr: '⤌', + lbbrk: '❲', + lbrace: '{', + lbrack: '[', + lbrke: '⦋', + lbrksld: '⦏', + lbrkslu: '⦍', + lcaron: 'ľ', + lcedil: 'ļ', + lceil: '⌈', + lcub: '{', + lcy: 'л', + ldca: '⤶', + ldquo: '“', + ldquor: '„', + ldrdhar: '⥧', + ldrushar: '⥋', + ldsh: '↲', + le: '≤', + leftarrow: '←', + leftarrowtail: '↢', + leftharpoondown: '↽', + leftharpoonup: '↼', + leftleftarrows: '⇇', + leftrightarrow: '↔', + leftrightarrows: '⇆', + leftrightharpoons: '⇋', + leftrightsquigarrow: '↭', + leftthreetimes: '⋋', + leg: '⋚', + leq: '≤', + leqq: '≦', + leqslant: '⩽', + les: '⩽', + lescc: '⪨', + lesdot: '⩿', + lesdoto: '⪁', + lesdotor: '⪃', + lesg: '⋚︀', + lesges: '⪓', + lessapprox: '⪅', + lessdot: '⋖', + lesseqgtr: '⋚', + lesseqqgtr: '⪋', + lessgtr: '≶', + lesssim: '≲', + lfisht: '⥼', + lfloor: '⌊', + lfr: '𝔩', + lg: '≶', + lgE: '⪑', + lhard: '↽', + lharu: '↼', + lharul: '⥪', + lhblk: '▄', + ljcy: 'љ', + ll: '≪', + llarr: '⇇', + llcorner: '⌞', + llhard: '⥫', + lltri: '◺', + lmidot: 'ŀ', + lmoust: '⎰', + lmoustache: '⎰', + lnE: '≨', + lnap: '⪉', + lnapprox: '⪉', + lne: '⪇', + lneq: '⪇', + lneqq: '≨', + lnsim: '⋦', + loang: '⟬', + loarr: '⇽', + lobrk: '⟦', + longleftarrow: '⟵', + longleftrightarrow: '⟷', + longmapsto: '⟼', + longrightarrow: '⟶', + looparrowleft: '↫', + looparrowright: '↬', + lopar: '⦅', + lopf: '𝕝', + loplus: '⨭', + lotimes: '⨴', + lowast: '∗', + lowbar: '_', + loz: '◊', + lozenge: '◊', + lozf: '⧫', + lpar: '(', + lparlt: '⦓', + lrarr: '⇆', + lrcorner: '⌟', + lrhar: '⇋', + lrhard: '⥭', + lrm: '', + lrtri: '⊿', + lsaquo: '‹', + lscr: '𝓁', + lsh: '↰', + lsim: '≲', + lsime: '⪍', + lsimg: '⪏', + lsqb: '[', + lsquo: '‘', + lsquor: '‚', + lstrok: 'ł', + l: '<', + lt: '<', + ltcc: '⪦', + ltcir: '⩹', + ltdot: '⋖', + lthree: '⋋', + ltimes: '⋉', + ltlarr: '⥶', + ltquest: '⩻', + ltrPar: '⦖', + ltri: '◃', + ltrie: '⊴', + ltrif: '◂', + lurdshar: '⥊', + luruhar: '⥦', + lvertneqq: '≨︀', + lvnE: '≨︀', + mDDot: '∺', + mac: '¯', + macr: '¯', + male: '♂', + malt: '✠', + maltese: '✠', + map: '↦', + mapsto: '↦', + mapstodown: '↧', + mapstoleft: '↤', + mapstoup: '↥', + marker: '▮', + mcomma: '⨩', + mcy: 'м', + mdash: '—', + measuredangle: '∡', + mfr: '𝔪', + mho: '℧', + micr: 'µ', + micro: 'µ', + mid: '∣', + midast: '*', + midcir: '⫰', + middo: '·', + middot: '·', + minus: '−', + minusb: '⊟', + minusd: '∸', + minusdu: '⨪', + mlcp: '⫛', + mldr: '…', + mnplus: '∓', + models: '⊧', + mopf: '𝕞', + mp: '∓', + mscr: '𝓂', + mstpos: '∾', + mu: 'μ', + multimap: '⊸', + mumap: '⊸', + nGg: '⋙̸', + nGt: '≫⃒', + nGtv: '≫̸', + nLeftarrow: '⇍', + nLeftrightarrow: '⇎', + nLl: '⋘̸', + nLt: '≪⃒', + nLtv: '≪̸', + nRightarrow: '⇏', + nVDash: '⊯', + nVdash: '⊮', + nabla: '∇', + nacute: 'ń', + nang: '∠⃒', + nap: '≉', + napE: '⩰̸', + napid: '≋̸', + napos: 'ʼn', + napprox: '≉', + natur: '♮', + natural: '♮', + naturals: 'ℕ', + nbs: ' ', + nbsp: ' ', + nbump: '≎̸', + nbumpe: '≏̸', + ncap: '⩃', + ncaron: 'ň', + ncedil: 'ņ', + ncong: '≇', + ncongdot: '⩭̸', + ncup: '⩂', + ncy: 'н', + ndash: '–', + ne: '≠', + neArr: '⇗', + nearhk: '⤤', + nearr: '↗', + nearrow: '↗', + nedot: '≐̸', + nequiv: '≢', + nesear: '⤨', + nesim: '≂̸', + nexist: '∄', + nexists: '∄', + nfr: '𝔫', + ngE: '≧̸', + nge: '≱', + ngeq: '≱', + ngeqq: '≧̸', + ngeqslant: '⩾̸', + nges: '⩾̸', + ngsim: '≵', + ngt: '≯', + ngtr: '≯', + nhArr: '⇎', + nharr: '↮', + nhpar: '⫲', + ni: '∋', + nis: '⋼', + nisd: '⋺', + niv: '∋', + njcy: 'њ', + nlArr: '⇍', + nlE: '≦̸', + nlarr: '↚', + nldr: '‥', + nle: '≰', + nleftarrow: '↚', + nleftrightarrow: '↮', + nleq: '≰', + nleqq: '≦̸', + nleqslant: '⩽̸', + nles: '⩽̸', + nless: '≮', + nlsim: '≴', + nlt: '≮', + nltri: '⋪', + nltrie: '⋬', + nmid: '∤', + nopf: '𝕟', + no: '¬', + not: '¬', + notin: '∉', + notinE: '⋹̸', + notindot: '⋵̸', + notinva: '∉', + notinvb: '⋷', + notinvc: '⋶', + notni: '∌', + notniva: '∌', + notnivb: '⋾', + notnivc: '⋽', + npar: '∦', + nparallel: '∦', + nparsl: '⫽⃥', + npart: '∂̸', + npolint: '⨔', + npr: '⊀', + nprcue: '⋠', + npre: '⪯̸', + nprec: '⊀', + npreceq: '⪯̸', + nrArr: '⇏', + nrarr: '↛', + nrarrc: '⤳̸', + nrarrw: '↝̸', + nrightarrow: '↛', + nrtri: '⋫', + nrtrie: '⋭', + nsc: '⊁', + nsccue: '⋡', + nsce: '⪰̸', + nscr: '𝓃', + nshortmid: '∤', + nshortparallel: '∦', + nsim: '≁', + nsime: '≄', + nsimeq: '≄', + nsmid: '∤', + nspar: '∦', + nsqsube: '⋢', + nsqsupe: '⋣', + nsub: '⊄', + nsubE: '⫅̸', + nsube: '⊈', + nsubset: '⊂⃒', + nsubseteq: '⊈', + nsubseteqq: '⫅̸', + nsucc: '⊁', + nsucceq: '⪰̸', + nsup: '⊅', + nsupE: '⫆̸', + nsupe: '⊉', + nsupset: '⊃⃒', + nsupseteq: '⊉', + nsupseteqq: '⫆̸', + ntgl: '≹', + ntild: 'ñ', + ntilde: 'ñ', + ntlg: '≸', + ntriangleleft: '⋪', + ntrianglelefteq: '⋬', + ntriangleright: '⋫', + ntrianglerighteq: '⋭', + nu: 'ν', + num: '#', + numero: '№', + numsp: ' ', + nvDash: '⊭', + nvHarr: '⤄', + nvap: '≍⃒', + nvdash: '⊬', + nvge: '≥⃒', + nvgt: '>⃒', + nvinfin: '⧞', + nvlArr: '⤂', + nvle: '≤⃒', + nvlt: '<⃒', + nvltrie: '⊴⃒', + nvrArr: '⤃', + nvrtrie: '⊵⃒', + nvsim: '∼⃒', + nwArr: '⇖', + nwarhk: '⤣', + nwarr: '↖', + nwarrow: '↖', + nwnear: '⤧', + oS: 'Ⓢ', + oacut: 'ó', + oacute: 'ó', + oast: '⊛', + ocir: 'ô', + ocirc: 'ô', + ocy: 'о', + odash: '⊝', + odblac: 'ő', + odiv: '⨸', + odot: '⊙', + odsold: '⦼', + oelig: 'œ', + ofcir: '⦿', + ofr: '𝔬', + ogon: '˛', + ograv: 'ò', + ograve: 'ò', + ogt: '⧁', + ohbar: '⦵', + ohm: 'Ω', + oint: '∮', + olarr: '↺', + olcir: '⦾', + olcross: '⦻', + oline: '‾', + olt: '⧀', + omacr: 'ō', + omega: 'ω', + omicron: 'ο', + omid: '⦶', + ominus: '⊖', + oopf: '𝕠', + opar: '⦷', + operp: '⦹', + oplus: '⊕', + or: '∨', + orarr: '↻', + ord: 'º', + order: 'ℴ', + orderof: 'ℴ', + ordf: 'ª', + ordm: 'º', + origof: '⊶', + oror: '⩖', + orslope: '⩗', + orv: '⩛', + oscr: 'ℴ', + oslas: 'ø', + oslash: 'ø', + osol: '⊘', + otild: 'õ', + otilde: 'õ', + otimes: '⊗', + otimesas: '⨶', + oum: 'ö', + ouml: 'ö', + ovbar: '⌽', + par: '¶', + para: '¶', + parallel: '∥', + parsim: '⫳', + parsl: '⫽', + part: '∂', + pcy: 'п', + percnt: '%', + period: '.', + permil: '‰', + perp: '⊥', + pertenk: '‱', + pfr: '𝔭', + phi: 'φ', + phiv: 'ϕ', + phmmat: 'ℳ', + phone: '☎', + pi: 'π', + pitchfork: '⋔', + piv: 'ϖ', + planck: 'ℏ', + planckh: 'ℎ', + plankv: 'ℏ', + plus: '+', + plusacir: '⨣', + plusb: '⊞', + pluscir: '⨢', + plusdo: '∔', + plusdu: '⨥', + pluse: '⩲', + plusm: '±', + plusmn: '±', + plussim: '⨦', + plustwo: '⨧', + pm: '±', + pointint: '⨕', + popf: '𝕡', + poun: '£', + pound: '£', + pr: '≺', + prE: '⪳', + prap: '⪷', + prcue: '≼', + pre: '⪯', + prec: '≺', + precapprox: '⪷', + preccurlyeq: '≼', + preceq: '⪯', + precnapprox: '⪹', + precneqq: '⪵', + precnsim: '⋨', + precsim: '≾', + prime: '′', + primes: 'ℙ', + prnE: '⪵', + prnap: '⪹', + prnsim: '⋨', + prod: '∏', + profalar: '⌮', + profline: '⌒', + profsurf: '⌓', + prop: '∝', + propto: '∝', + prsim: '≾', + prurel: '⊰', + pscr: '𝓅', + psi: 'ψ', + puncsp: ' ', + qfr: '𝔮', + qint: '⨌', + qopf: '𝕢', + qprime: '⁗', + qscr: '𝓆', + quaternions: 'ℍ', + quatint: '⨖', + quest: '?', + questeq: '≟', + quo: '"', + quot: '"', + rAarr: '⇛', + rArr: '⇒', + rAtail: '⤜', + rBarr: '⤏', + rHar: '⥤', + race: '∽̱', + racute: 'ŕ', + radic: '√', + raemptyv: '⦳', + rang: '⟩', + rangd: '⦒', + range: '⦥', + rangle: '⟩', + raqu: '»', + raquo: '»', + rarr: '→', + rarrap: '⥵', + rarrb: '⇥', + rarrbfs: '⤠', + rarrc: '⤳', + rarrfs: '⤞', + rarrhk: '↪', + rarrlp: '↬', + rarrpl: '⥅', + rarrsim: '⥴', + rarrtl: '↣', + rarrw: '↝', + ratail: '⤚', + ratio: '∶', + rationals: 'ℚ', + rbarr: '⤍', + rbbrk: '❳', + rbrace: '}', + rbrack: ']', + rbrke: '⦌', + rbrksld: '⦎', + rbrkslu: '⦐', + rcaron: 'ř', + rcedil: 'ŗ', + rceil: '⌉', + rcub: '}', + rcy: 'р', + rdca: '⤷', + rdldhar: '⥩', + rdquo: '”', + rdquor: '”', + rdsh: '↳', + real: 'ℜ', + realine: 'ℛ', + realpart: 'ℜ', + reals: 'ℝ', + rect: '▭', + re: '®', + reg: '®', + rfisht: '⥽', + rfloor: '⌋', + rfr: '𝔯', + rhard: '⇁', + rharu: '⇀', + rharul: '⥬', + rho: 'ρ', + rhov: 'ϱ', + rightarrow: '→', + rightarrowtail: '↣', + rightharpoondown: '⇁', + rightharpoonup: '⇀', + rightleftarrows: '⇄', + rightleftharpoons: '⇌', + rightrightarrows: '⇉', + rightsquigarrow: '↝', + rightthreetimes: '⋌', + ring: '˚', + risingdotseq: '≓', + rlarr: '⇄', + rlhar: '⇌', + rlm: '', + rmoust: '⎱', + rmoustache: '⎱', + rnmid: '⫮', + roang: '⟭', + roarr: '⇾', + robrk: '⟧', + ropar: '⦆', + ropf: '𝕣', + roplus: '⨮', + rotimes: '⨵', + rpar: ')', + rpargt: '⦔', + rppolint: '⨒', + rrarr: '⇉', + rsaquo: '›', + rscr: '𝓇', + rsh: '↱', + rsqb: ']', + rsquo: '’', + rsquor: '’', + rthree: '⋌', + rtimes: '⋊', + rtri: '▹', + rtrie: '⊵', + rtrif: '▸', + rtriltri: '⧎', + ruluhar: '⥨', + rx: '℞', + sacute: 'ś', + sbquo: '‚', + sc: '≻', + scE: '⪴', + scap: '⪸', + scaron: 'š', + sccue: '≽', + sce: '⪰', + scedil: 'ş', + scirc: 'ŝ', + scnE: '⪶', + scnap: '⪺', + scnsim: '⋩', + scpolint: '⨓', + scsim: '≿', + scy: 'с', + sdot: '⋅', + sdotb: '⊡', + sdote: '⩦', + seArr: '⇘', + searhk: '⤥', + searr: '↘', + searrow: '↘', + sec: '§', + sect: '§', + semi: ';', + seswar: '⤩', + setminus: '∖', + setmn: '∖', + sext: '✶', + sfr: '𝔰', + sfrown: '⌢', + sharp: '♯', + shchcy: 'щ', + shcy: 'ш', + shortmid: '∣', + shortparallel: '∥', + sh: '', + shy: '', + sigma: 'σ', + sigmaf: 'ς', + sigmav: 'ς', + sim: '∼', + simdot: '⩪', + sime: '≃', + simeq: '≃', + simg: '⪞', + simgE: '⪠', + siml: '⪝', + simlE: '⪟', + simne: '≆', + simplus: '⨤', + simrarr: '⥲', + slarr: '←', + smallsetminus: '∖', + smashp: '⨳', + smeparsl: '⧤', + smid: '∣', + smile: '⌣', + smt: '⪪', + smte: '⪬', + smtes: '⪬︀', + softcy: 'ь', + sol: '/', + solb: '⧄', + solbar: '⌿', + sopf: '𝕤', + spades: '♠', + spadesuit: '♠', + spar: '∥', + sqcap: '⊓', + sqcaps: '⊓︀', + sqcup: '⊔', + sqcups: '⊔︀', + sqsub: '⊏', + sqsube: '⊑', + sqsubset: '⊏', + sqsubseteq: '⊑', + sqsup: '⊐', + sqsupe: '⊒', + sqsupset: '⊐', + sqsupseteq: '⊒', + squ: '□', + square: '□', + squarf: '▪', + squf: '▪', + srarr: '→', + sscr: '𝓈', + ssetmn: '∖', + ssmile: '⌣', + sstarf: '⋆', + star: '☆', + starf: '★', + straightepsilon: 'ϵ', + straightphi: 'ϕ', + strns: '¯', + sub: '⊂', + subE: '⫅', + subdot: '⪽', + sube: '⊆', + subedot: '⫃', + submult: '⫁', + subnE: '⫋', + subne: '⊊', + subplus: '⪿', + subrarr: '⥹', + subset: '⊂', + subseteq: '⊆', + subseteqq: '⫅', + subsetneq: '⊊', + subsetneqq: '⫋', + subsim: '⫇', + subsub: '⫕', + subsup: '⫓', + succ: '≻', + succapprox: '⪸', + succcurlyeq: '≽', + succeq: '⪰', + succnapprox: '⪺', + succneqq: '⪶', + succnsim: '⋩', + succsim: '≿', + sum: '∑', + sung: '♪', + sup: '⊃', + sup1: '¹', + sup2: '²', + sup3: '³', + supE: '⫆', + supdot: '⪾', + supdsub: '⫘', + supe: '⊇', + supedot: '⫄', + suphsol: '⟉', + suphsub: '⫗', + suplarr: '⥻', + supmult: '⫂', + supnE: '⫌', + supne: '⊋', + supplus: '⫀', + supset: '⊃', + supseteq: '⊇', + supseteqq: '⫆', + supsetneq: '⊋', + supsetneqq: '⫌', + supsim: '⫈', + supsub: '⫔', + supsup: '⫖', + swArr: '⇙', + swarhk: '⤦', + swarr: '↙', + swarrow: '↙', + swnwar: '⤪', + szli: 'ß', + szlig: 'ß', + target: '⌖', + tau: 'τ', + tbrk: '⎴', + tcaron: 'ť', + tcedil: 'ţ', + tcy: 'т', + tdot: '⃛', + telrec: '⌕', + tfr: '𝔱', + there4: '∴', + therefore: '∴', + theta: 'θ', + thetasym: 'ϑ', + thetav: 'ϑ', + thickapprox: '≈', + thicksim: '∼', + thinsp: ' ', + thkap: '≈', + thksim: '∼', + thor: 'þ', + thorn: 'þ', + tilde: '˜', + time: '×', + times: '×', + timesb: '⊠', + timesbar: '⨱', + timesd: '⨰', + tint: '∭', + toea: '⤨', + top: '⊤', + topbot: '⌶', + topcir: '⫱', + topf: '𝕥', + topfork: '⫚', + tosa: '⤩', + tprime: '‴', + trade: '™', + triangle: '▵', + triangledown: '▿', + triangleleft: '◃', + trianglelefteq: '⊴', + triangleq: '≜', + triangleright: '▹', + trianglerighteq: '⊵', + tridot: '◬', + trie: '≜', + triminus: '⨺', + triplus: '⨹', + trisb: '⧍', + tritime: '⨻', + trpezium: '⏢', + tscr: '𝓉', + tscy: 'ц', + tshcy: 'ћ', + tstrok: 'ŧ', + twixt: '≬', + twoheadleftarrow: '↞', + twoheadrightarrow: '↠', + uArr: '⇑', + uHar: '⥣', + uacut: 'ú', + uacute: 'ú', + uarr: '↑', + ubrcy: 'ў', + ubreve: 'ŭ', + ucir: 'û', + ucirc: 'û', + ucy: 'у', + udarr: '⇅', + udblac: 'ű', + udhar: '⥮', + ufisht: '⥾', + ufr: '𝔲', + ugrav: 'ù', + ugrave: 'ù', + uharl: '↿', + uharr: '↾', + uhblk: '▀', + ulcorn: '⌜', + ulcorner: '⌜', + ulcrop: '⌏', + ultri: '◸', + umacr: 'ū', + um: '¨', + uml: '¨', + uogon: 'ų', + uopf: '𝕦', + uparrow: '↑', + updownarrow: '↕', + upharpoonleft: '↿', + upharpoonright: '↾', + uplus: '⊎', + upsi: 'υ', + upsih: 'ϒ', + upsilon: 'υ', + upuparrows: '⇈', + urcorn: '⌝', + urcorner: '⌝', + urcrop: '⌎', + uring: 'ů', + urtri: '◹', + uscr: '𝓊', + utdot: '⋰', + utilde: 'ũ', + utri: '▵', + utrif: '▴', + uuarr: '⇈', + uum: 'ü', + uuml: 'ü', + uwangle: '⦧', + vArr: '⇕', + vBar: '⫨', + vBarv: '⫩', + vDash: '⊨', + vangrt: '⦜', + varepsilon: 'ϵ', + varkappa: 'ϰ', + varnothing: '∅', + varphi: 'ϕ', + varpi: 'ϖ', + varpropto: '∝', + varr: '↕', + varrho: 'ϱ', + varsigma: 'ς', + varsubsetneq: '⊊︀', + varsubsetneqq: '⫋︀', + varsupsetneq: '⊋︀', + varsupsetneqq: '⫌︀', + vartheta: 'ϑ', + vartriangleleft: '⊲', + vartriangleright: '⊳', + vcy: 'в', + vdash: '⊢', + vee: '∨', + veebar: '⊻', + veeeq: '≚', + vellip: '⋮', + verbar: '|', + vert: '|', + vfr: '𝔳', + vltri: '⊲', + vnsub: '⊂⃒', + vnsup: '⊃⃒', + vopf: '𝕧', + vprop: '∝', + vrtri: '⊳', + vscr: '𝓋', + vsubnE: '⫋︀', + vsubne: '⊊︀', + vsupnE: '⫌︀', + vsupne: '⊋︀', + vzigzag: '⦚', + wcirc: 'ŵ', + wedbar: '⩟', + wedge: '∧', + wedgeq: '≙', + weierp: '℘', + wfr: '𝔴', + wopf: '𝕨', + wp: '℘', + wr: '≀', + wreath: '≀', + wscr: '𝓌', + xcap: '⋂', + xcirc: '◯', + xcup: '⋃', + xdtri: '▽', + xfr: '𝔵', + xhArr: '⟺', + xharr: '⟷', + xi: 'ξ', + xlArr: '⟸', + xlarr: '⟵', + xmap: '⟼', + xnis: '⋻', + xodot: '⨀', + xopf: '𝕩', + xoplus: '⨁', + xotime: '⨂', + xrArr: '⟹', + xrarr: '⟶', + xscr: '𝓍', + xsqcup: '⨆', + xuplus: '⨄', + xutri: '△', + xvee: '⋁', + xwedge: '⋀', + yacut: 'ý', + yacute: 'ý', + yacy: 'я', + ycirc: 'ŷ', + ycy: 'ы', + ye: '¥', + yen: '¥', + yfr: '𝔶', + yicy: 'ї', + yopf: '𝕪', + yscr: '𝓎', + yucy: 'ю', + yum: 'ÿ', + yuml: 'ÿ', + zacute: 'ź', + zcaron: 'ž', + zcy: 'з', + zdot: 'ż', + zeetrf: 'ℨ', + zeta: 'ζ', + zfr: '𝔷', + zhcy: 'ж', + zigrarr: '⇝', + zopf: '𝕫', + zscr: '𝓏', + zwj: '', + zwnj: '' }; -var characterEntities$2 = require$$0$2; - -var decodeEntity_1$2 = decodeEntity$3; - -var own$9 = {}.hasOwnProperty; +var own$5 = {}.hasOwnProperty; -function decodeEntity$3(characters) { - return own$9.call(characterEntities$2, characters) - ? characterEntities$2[characters] +/** + * @param {string} characters + * @returns {string|false} + */ +function decodeEntity(characters) { + return own$5.call(characterEntities, characters) + ? characterEntities[characters] : false } -var regexCheck$2 = regexCheck_1; - -var asciiDigit$3 = regexCheck$2(/\d/); - -var asciiDigit_1 = asciiDigit$3; - -var regexCheck$1 = regexCheck_1; - -var asciiHexDigit$1 = regexCheck$1(/[\dA-Fa-f]/); - -var asciiHexDigit_1 = asciiHexDigit$1; - -var decodeEntity$2 = decodeEntity_1$2; -var asciiAlphanumeric$3 = asciiAlphanumeric_1; -var asciiDigit$2 = asciiDigit_1; -var asciiHexDigit = asciiHexDigit_1; - -function _interopDefaultLegacy$1(e) { - return e && typeof e === 'object' && 'default' in e ? e : {default: e} -} - -var decodeEntity__default = /*#__PURE__*/ _interopDefaultLegacy$1(decodeEntity$2); +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ -var characterReference$2 = { +/** @type {Construct} */ +const characterReference$1 = { name: 'characterReference', tokenize: tokenizeCharacterReference }; +/** @type {Tokenizer} */ function tokenizeCharacterReference(effects, ok, nok) { - var self = this; - var size = 0; - var max; - var test; + const self = this; + let size = 0; + /** @type {number} */ + + let max; + /** @type {(code: Code) => code is number} */ + + let test; return start + /** @type {State} */ function start(code) { effects.enter('characterReference'); @@ -35077,6 +37484,7 @@ function tokenizeCharacterReference(effects, ok, nok) { effects.exit('characterReferenceMarker'); return open } + /** @type {State} */ function open(code) { if (code === 35) { @@ -35088,9 +37496,10 @@ function tokenizeCharacterReference(effects, ok, nok) { effects.enter('characterReferenceValue'); max = 31; - test = asciiAlphanumeric$3; + test = asciiAlphanumeric; return value(code) } + /** @type {State} */ function numeric(code) { if (code === 88 || code === 120) { @@ -35105,19 +37514,21 @@ function tokenizeCharacterReference(effects, ok, nok) { effects.enter('characterReferenceValue'); max = 7; - test = asciiDigit$2; + test = asciiDigit; return value(code) } + /** @type {State} */ function value(code) { - var token; + /** @type {Token} */ + let token; if (code === 59 && size) { token = effects.exit('characterReferenceValue'); if ( - test === asciiAlphanumeric$3 && - !decodeEntity__default['default'](self.sliceSerialize(token)) + test === asciiAlphanumeric && + !decodeEntity(self.sliceSerialize(token)) ) { return nok(code) } @@ -35138,29 +37549,46 @@ function tokenizeCharacterReference(effects, ok, nok) { } } -var characterReference_1 = characterReference$2; - -var markdownLineEnding$e = markdownLineEnding_1; -var markdownLineEndingOrSpace$7 = markdownLineEndingOrSpace_1; -var prefixSize$2 = prefixSize_1; -var factorySpace$b = factorySpace$i; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ -var codeFenced$1 = { +/** @type {Construct} */ +const codeFenced = { name: 'codeFenced', tokenize: tokenizeCodeFenced, concrete: true }; +/** @type {Tokenizer} */ function tokenizeCodeFenced(effects, ok, nok) { - var self = this; - var closingFenceConstruct = { + const self = this; + /** @type {Construct} */ + + const closingFenceConstruct = { tokenize: tokenizeClosingFence, partial: true }; - var initialPrefix = prefixSize$2(this.events, 'linePrefix'); - var sizeOpen = 0; - var marker; + /** @type {Construct} */ + + const nonLazyLine = { + tokenize: tokenizeNonLazyLine, + partial: true + }; + const tail = this.events[this.events.length - 1]; + const initialPrefix = + tail && tail[1].type === 'linePrefix' + ? tail[2].sliceSerialize(tail[1], true).length + : 0; + let sizeOpen = 0; + /** @type {NonNullable<Code>} */ + + let marker; return start + /** @type {State} */ function start(code) { effects.enter('codeFenced'); @@ -35169,6 +37597,7 @@ function tokenizeCodeFenced(effects, ok, nok) { marker = code; return sequenceOpen(code) } + /** @type {State} */ function sequenceOpen(code) { if (code === marker) { @@ -35180,11 +37609,12 @@ function tokenizeCodeFenced(effects, ok, nok) { effects.exit('codeFencedFenceSequence'); return sizeOpen < 3 ? nok(code) - : factorySpace$b(effects, infoOpen, 'whitespace')(code) + : factorySpace(effects, infoOpen, 'whitespace')(code) } + /** @type {State} */ function infoOpen(code) { - if (code === null || markdownLineEnding$e(code)) { + if (code === null || markdownLineEnding(code)) { return openAfter(code) } @@ -35194,21 +37624,23 @@ function tokenizeCodeFenced(effects, ok, nok) { }); return info(code) } + /** @type {State} */ function info(code) { - if (code === null || markdownLineEndingOrSpace$7(code)) { + if (code === null || markdownLineEndingOrSpace(code)) { effects.exit('chunkString'); effects.exit('codeFencedFenceInfo'); - return factorySpace$b(effects, infoAfter, 'whitespace')(code) + return factorySpace(effects, infoAfter, 'whitespace')(code) } if (code === 96 && code === marker) return nok(code) effects.consume(code); return info } + /** @type {State} */ function infoAfter(code) { - if (code === null || markdownLineEnding$e(code)) { + if (code === null || markdownLineEnding(code)) { return openAfter(code) } @@ -35218,9 +37650,10 @@ function tokenizeCodeFenced(effects, ok, nok) { }); return meta(code) } + /** @type {State} */ function meta(code) { - if (code === null || markdownLineEnding$e(code)) { + if (code === null || markdownLineEnding(code)) { effects.exit('chunkString'); effects.exit('codeFencedFenceMeta'); return openAfter(code) @@ -35230,65 +37663,97 @@ function tokenizeCodeFenced(effects, ok, nok) { effects.consume(code); return meta } + /** @type {State} */ function openAfter(code) { effects.exit('codeFencedFence'); - return self.interrupt ? ok(code) : content(code) + return self.interrupt ? ok(code) : contentStart(code) } + /** @type {State} */ - function content(code) { + function contentStart(code) { if (code === null) { return after(code) } - if (markdownLineEnding$e(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); + if (markdownLineEnding(code)) { return effects.attempt( - closingFenceConstruct, - after, - initialPrefix - ? factorySpace$b(effects, content, 'linePrefix', initialPrefix + 1) - : content - ) + nonLazyLine, + effects.attempt( + closingFenceConstruct, + after, + initialPrefix + ? factorySpace( + effects, + contentStart, + 'linePrefix', + initialPrefix + 1 + ) + : contentStart + ), + after + )(code) } effects.enter('codeFlowValue'); return contentContinue(code) } + /** @type {State} */ function contentContinue(code) { - if (code === null || markdownLineEnding$e(code)) { + if (code === null || markdownLineEnding(code)) { effects.exit('codeFlowValue'); - return content(code) + return contentStart(code) } effects.consume(code); return contentContinue } + /** @type {State} */ function after(code) { effects.exit('codeFenced'); return ok(code) } + /** @type {Tokenizer} */ + + function tokenizeNonLazyLine(effects, ok, nok) { + const self = this; + return start + /** @type {State} */ + + function start(code) { + effects.enter('lineEnding'); + effects.consume(code); + effects.exit('lineEnding'); + return lineStart + } + /** @type {State} */ + + function lineStart(code) { + return self.parser.lazy[self.now().line] ? nok(code) : ok(code) + } + } + /** @type {Tokenizer} */ function tokenizeClosingFence(effects, ok, nok) { - var size = 0; - return factorySpace$b( + let size = 0; + return factorySpace( effects, closingSequenceStart, 'linePrefix', - this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 ) + /** @type {State} */ function closingSequenceStart(code) { effects.enter('codeFencedFence'); effects.enter('codeFencedFenceSequence'); return closingSequence(code) } + /** @type {State} */ function closingSequence(code) { if (code === marker) { @@ -35299,11 +37764,12 @@ function tokenizeCodeFenced(effects, ok, nok) { if (size < sizeOpen) return nok(code) effects.exit('codeFencedFenceSequence'); - return factorySpace$b(effects, closingSequenceEnd, 'whitespace')(code) + return factorySpace(effects, closingSequenceEnd, 'whitespace')(code) } + /** @type {State} */ function closingSequenceEnd(code) { - if (code === null || markdownLineEnding$e(code)) { + if (code === null || markdownLineEnding(code)) { effects.exit('codeFencedFence'); return ok(code) } @@ -35313,52 +37779,64 @@ function tokenizeCodeFenced(effects, ok, nok) { } } -var codeFenced_1 = codeFenced$1; - -var markdownLineEnding$d = markdownLineEnding_1; -var chunkedSplice$2 = chunkedSplice_1; -var prefixSize$1 = prefixSize_1; -var factorySpace$a = factorySpace$i; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').Resolver} Resolver + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').State} State + */ -var codeIndented$1 = { +/** @type {Construct} */ +const codeIndented = { name: 'codeIndented', - tokenize: tokenizeCodeIndented, - resolve: resolveCodeIndented + tokenize: tokenizeCodeIndented }; -var indentedContentConstruct = { +/** @type {Construct} */ + +const indentedContent = { tokenize: tokenizeIndentedContent, partial: true }; - -function resolveCodeIndented(events, context) { - var code = { - type: 'codeIndented', - start: events[0][1].start, - end: events[events.length - 1][1].end - }; - chunkedSplice$2(events, 0, 0, [['enter', code, context]]); - chunkedSplice$2(events, events.length, 0, [['exit', code, context]]); - return events -} +/** @type {Tokenizer} */ function tokenizeCodeIndented(effects, ok, nok) { - return effects.attempt(indentedContentConstruct, afterPrefix, nok) + const self = this; + return start + /** @type {State} */ + + function start(code) { + effects.enter('codeIndented'); + return factorySpace(effects, afterStartPrefix, 'linePrefix', 4 + 1)(code) + } + /** @type {State} */ + + function afterStartPrefix(code) { + const tail = self.events[self.events.length - 1]; + return tail && + tail[1].type === 'linePrefix' && + tail[2].sliceSerialize(tail[1], true).length >= 4 + ? afterPrefix(code) + : nok(code) + } + /** @type {State} */ function afterPrefix(code) { if (code === null) { - return ok(code) + return after(code) } - if (markdownLineEnding$d(code)) { - return effects.attempt(indentedContentConstruct, afterPrefix, ok)(code) + if (markdownLineEnding(code)) { + return effects.attempt(indentedContent, afterPrefix, after)(code) } effects.enter('codeFlowValue'); return content(code) } + /** @type {State} */ function content(code) { - if (code === null || markdownLineEnding$d(code)) { + if (code === null || markdownLineEnding(code)) { effects.exit('codeFlowValue'); return afterPrefix(code) } @@ -35366,40 +37844,76 @@ function tokenizeCodeIndented(effects, ok, nok) { effects.consume(code); return content } + /** @type {State} */ + + function after(code) { + effects.exit('codeIndented'); + return ok(code) + } } +/** @type {Tokenizer} */ function tokenizeIndentedContent(effects, ok, nok) { - var self = this; - return factorySpace$a(effects, afterPrefix, 'linePrefix', 4 + 1) + const self = this; + return start + /** @type {State} */ - function afterPrefix(code) { - if (markdownLineEnding$d(code)) { + function start(code) { + // If this is a lazy line, it can’t be code. + if (self.parser.lazy[self.now().line]) { + return nok(code) + } + + if (markdownLineEnding(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); - return factorySpace$a(effects, afterPrefix, 'linePrefix', 4 + 1) + return start } - return prefixSize$1(self.events, 'linePrefix') < 4 ? nok(code) : ok(code) + return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code) } -} + /** @type {State} */ -var codeIndented_1 = codeIndented$1; + function afterPrefix(code) { + const tail = self.events[self.events.length - 1]; + return tail && + tail[1].type === 'linePrefix' && + tail[2].sliceSerialize(tail[1], true).length >= 4 + ? ok(code) + : markdownLineEnding(code) + ? start(code) + : nok(code) + } +} -var markdownLineEnding$c = markdownLineEnding_1; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Resolver} Resolver + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').Previous} Previous + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').State} State + */ -var codeText$1 = { +/** @type {Construct} */ +const codeText = { name: 'codeText', tokenize: tokenizeCodeText, resolve: resolveCodeText, previous: previous$1 }; +/** @type {Resolver} */ function resolveCodeText(events) { - var tailExitIndex = events.length - 4; - var headEnterIndex = 3; - var index; - var enter; // If we start and end with an EOL or a space. + let tailExitIndex = events.length - 4; + let headEnterIndex = 3; + /** @type {number} */ + + let index; + /** @type {number|undefined} */ + + let enter; // If we start and end with an EOL or a space. if ( (events[headEnterIndex][1].type === 'lineEnding' || @@ -35412,8 +37926,8 @@ function resolveCodeText(events) { while (++index < tailExitIndex) { if (events[index][1].type === 'codeTextData') { // Then we have padding. - events[tailExitIndex][1].type = events[headEnterIndex][1].type = - 'codeTextPadding'; + events[headEnterIndex][1].type = 'codeTextPadding'; + events[tailExitIndex][1].type = 'codeTextPadding'; headEnterIndex += 2; tailExitIndex -= 2; break @@ -35448,6 +37962,7 @@ function resolveCodeText(events) { return events } +/** @type {Previous} */ function previous$1(code) { // If there is a previous code, there will always be a tail. @@ -35456,18 +37971,25 @@ function previous$1(code) { this.events[this.events.length - 1][1].type === 'characterEscape' ) } +/** @type {Tokenizer} */ function tokenizeCodeText(effects, ok, nok) { - var sizeOpen = 0; - var size; - var token; + let sizeOpen = 0; + /** @type {number} */ + + let size; + /** @type {Token} */ + + let token; return start + /** @type {State} */ function start(code) { effects.enter('codeText'); effects.enter('codeTextSequence'); return openingSequence(code) } + /** @type {State} */ function openingSequence(code) { if (code === 96) { @@ -35479,6 +38001,7 @@ function tokenizeCodeText(effects, ok, nok) { effects.exit('codeTextSequence'); return gap(code) } + /** @type {State} */ function gap(code) { // EOF. @@ -35500,7 +38023,7 @@ function tokenizeCodeText(effects, ok, nok) { return gap } - if (markdownLineEnding$c(code)) { + if (markdownLineEnding(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); @@ -35511,12 +38034,14 @@ function tokenizeCodeText(effects, ok, nok) { return data(code) } // In code. + /** @type {State} */ + function data(code) { if ( code === null || code === 32 || code === 96 || - markdownLineEnding$c(code) + markdownLineEnding(code) ) { effects.exit('codeTextData'); return gap(code) @@ -35526,6 +38051,8 @@ function tokenizeCodeText(effects, ok, nok) { return data } // Closing fence. + /** @type {State} */ + function closingSequence(code) { // More. if (code === 96) { @@ -35545,14 +38072,394 @@ function tokenizeCodeText(effects, ok, nok) { } } -var codeText_1 = codeText$1; +/** + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').Chunk} Chunk + * @typedef {import('micromark-util-types').Event} Event + */ + +/** + * Tokenize subcontent. + * + * @param {Event[]} events + * @returns {boolean} + */ +function subtokenize(events) { + /** @type {Record<string, number>} */ + const jumps = {}; + let index = -1; + /** @type {Event} */ + + let event; + /** @type {number|undefined} */ + + let lineIndex; + /** @type {number} */ + + let otherIndex; + /** @type {Event} */ + + let otherEvent; + /** @type {Event[]} */ + + let parameters; + /** @type {Event[]} */ + + let subevents; + /** @type {boolean|undefined} */ + + let more; + + while (++index < events.length) { + while (index in jumps) { + index = jumps[index]; + } + + event = events[index]; // Add a hook for the GFM tasklist extension, which needs to know if text + // is in the first content of a list item. + + if ( + index && + event[1].type === 'chunkFlow' && + events[index - 1][1].type === 'listItemPrefix' + ) { + subevents = event[1]._tokenizer.events; + otherIndex = 0; + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === 'lineEndingBlank' + ) { + otherIndex += 2; + } + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === 'content' + ) { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === 'content') { + break + } + + if (subevents[otherIndex][1].type === 'chunkText') { + subevents[otherIndex][1]._isInFirstContentOfListItem = true; + otherIndex++; + } + } + } + } // Enter. + + if (event[0] === 'enter') { + if (event[1].contentType) { + Object.assign(jumps, subcontent(events, index)); + index = jumps[index]; + more = true; + } + } // Exit. + else if (event[1]._container) { + otherIndex = index; + lineIndex = undefined; + + while (otherIndex--) { + otherEvent = events[otherIndex]; + + if ( + otherEvent[1].type === 'lineEnding' || + otherEvent[1].type === 'lineEndingBlank' + ) { + if (otherEvent[0] === 'enter') { + if (lineIndex) { + events[lineIndex][1].type = 'lineEndingBlank'; + } + + otherEvent[1].type = 'lineEnding'; + lineIndex = otherIndex; + } + } else { + break + } + } + + if (lineIndex) { + // Fix position. + event[1].end = Object.assign({}, events[lineIndex][1].start); // Switch container exit w/ line endings. + + parameters = events.slice(lineIndex, index); + parameters.unshift(event); + splice(events, lineIndex, index - lineIndex + 1, parameters); + } + } + } + + return !more +} +/** + * Tokenize embedded tokens. + * + * @param {Event[]} events + * @param {number} eventIndex + * @returns {Record<string, number>} + */ + +function subcontent(events, eventIndex) { + const token = events[eventIndex][1]; + const context = events[eventIndex][2]; + let startPosition = eventIndex - 1; + /** @type {number[]} */ + + const startPositions = []; + const tokenizer = + token._tokenizer || context.parser[token.contentType](token.start); + const childEvents = tokenizer.events; + /** @type {[number, number][]} */ + + const jumps = []; + /** @type {Record<string, number>} */ + + const gaps = {}; + /** @type {Chunk[]} */ + + let stream; + /** @type {Token|undefined} */ + + let previous; + let index = -1; + /** @type {Token|undefined} */ + + let current = token; + let adjust = 0; + let start = 0; + const breaks = [start]; // Loop forward through the linked tokens to pass them in order to the + // subtokenizer. + + while (current) { + // Find the position of the event for this token. + while (events[++startPosition][1] !== current) { + // Empty. + } + + startPositions.push(startPosition); + + if (!current._tokenizer) { + stream = context.sliceStream(current); + + if (!current.next) { + stream.push(null); + } + + if (previous) { + tokenizer.defineSkip(current.start); + } + + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true; + } + + tokenizer.write(stream); + + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = undefined; + } + } // Unravel the next token. + + previous = current; + current = current.next; + } // Now, loop back through all events (and linked tokens), to figure out which + // parts belong where. + + current = token; + + while (++index < childEvents.length) { + if ( + // Find a void token that includes a break. + childEvents[index][0] === 'exit' && + childEvents[index - 1][0] === 'enter' && + childEvents[index][1].type === childEvents[index - 1][1].type && + childEvents[index][1].start.line !== childEvents[index][1].end.line + ) { + start = index + 1; + breaks.push(start); // Help GC. + + current._tokenizer = undefined; + current.previous = undefined; + current = current.next; + } + } // Help GC. + + tokenizer.events = []; // If there’s one more token (which is the cases for lines that end in an + // EOF), that’s perfect: the last point we found starts it. + // If there isn’t then make sure any remaining content is added to it. + + if (current) { + // Help GC. + current._tokenizer = undefined; + current.previous = undefined; + } else { + breaks.pop(); + } // Now splice the events from the subtokenizer into the current events, + // moving back to front so that splice indices aren’t affected. + + index = breaks.length; + + while (index--) { + const slice = childEvents.slice(breaks[index], breaks[index + 1]); + const start = startPositions.pop(); + jumps.unshift([start, start + slice.length - 1]); + splice(events, start, 2, slice); + } + + index = -1; + + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; + adjust += jumps[index][1] - jumps[index][0] - 1; + } + + return gaps +} + +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Resolver} Resolver + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').State} State + */ + +/** + * No name because it must not be turned off. + * @type {Construct} + */ +const content = { + tokenize: tokenizeContent, + resolve: resolveContent +}; +/** @type {Construct} */ + +const continuationConstruct = { + tokenize: tokenizeContinuation, + partial: true +}; +/** + * Content is transparent: it’s parsed right now. That way, definitions are also + * parsed right now: before text in paragraphs (specifically, media) are parsed. + * + * @type {Resolver} + */ + +function resolveContent(events) { + subtokenize(events); + return events +} +/** @type {Tokenizer} */ + +function tokenizeContent(effects, ok) { + /** @type {Token} */ + let previous; + return start + /** @type {State} */ + + function start(code) { + effects.enter('content'); + previous = effects.enter('chunkContent', { + contentType: 'content' + }); + return data(code) + } + /** @type {State} */ + + function data(code) { + if (code === null) { + return contentEnd(code) + } + + if (markdownLineEnding(code)) { + return effects.check( + continuationConstruct, + contentContinue, + contentEnd + )(code) + } // Data. + + effects.consume(code); + return data + } + /** @type {State} */ + + function contentEnd(code) { + effects.exit('chunkContent'); + effects.exit('content'); + return ok(code) + } + /** @type {State} */ + + function contentContinue(code) { + effects.consume(code); + effects.exit('chunkContent'); + previous.next = effects.enter('chunkContent', { + contentType: 'content', + previous + }); + previous = previous.next; + return data + } +} +/** @type {Tokenizer} */ + +function tokenizeContinuation(effects, ok, nok) { + const self = this; + return startLookahead + /** @type {State} */ -var asciiControl$1 = asciiControl_1; -var markdownLineEndingOrSpace$6 = markdownLineEndingOrSpace_1; -var markdownLineEnding$b = markdownLineEnding_1; + function startLookahead(code) { + effects.exit('chunkContent'); + effects.enter('lineEnding'); + effects.consume(code); + effects.exit('lineEnding'); + return factorySpace(effects, prefixed, 'linePrefix') + } + /** @type {State} */ + + function prefixed(code) { + if (code === null || markdownLineEnding(code)) { + return nok(code) + } + + const tail = self.events[self.events.length - 1]; + + if ( + !self.parser.constructs.disable.null.includes('codeIndented') && + tail && + tail[1].type === 'linePrefix' && + tail[2].sliceSerialize(tail[1], true).length >= 4 + ) { + return ok(code) + } + + return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) + } +} +/** + * @typedef {import('micromark-util-types').Effects} Effects + * @typedef {import('micromark-util-types').State} State + */ + +/** + * @param {Effects} effects + * @param {State} ok + * @param {State} nok + * @param {string} type + * @param {string} literalType + * @param {string} literalMarkerType + * @param {string} rawType + * @param {string} stringType + * @param {number} [max=Infinity] + * @returns {State} + */ // eslint-disable-next-line max-params -function destinationFactory( +function factoryDestination( effects, ok, nok, @@ -35563,9 +38470,10 @@ function destinationFactory( stringType, max ) { - var limit = max || Infinity; - var balance = 0; + const limit = max || Number.POSITIVE_INFINITY; + let balance = 0; return start + /** @type {State} */ function start(code) { if (code === 60) { @@ -35577,7 +38485,7 @@ function destinationFactory( return destinationEnclosedBefore } - if (asciiControl$1(code) || code === 41) { + if (code === null || code === 41 || asciiControl(code)) { return nok(code) } @@ -35589,6 +38497,7 @@ function destinationFactory( }); return destinationRaw(code) } + /** @type {State} */ function destinationEnclosedBefore(code) { if (code === 62) { @@ -35606,6 +38515,7 @@ function destinationFactory( }); return destinationEnclosed(code) } + /** @type {State} */ function destinationEnclosed(code) { if (code === 62) { @@ -35614,13 +38524,14 @@ function destinationFactory( return destinationEnclosedBefore(code) } - if (code === null || code === 60 || markdownLineEnding$b(code)) { + if (code === null || code === 60 || markdownLineEnding(code)) { return nok(code) } effects.consume(code); return code === 92 ? destinationEnclosedEscape : destinationEnclosed } + /** @type {State} */ function destinationEnclosedEscape(code) { if (code === 60 || code === 62 || code === 92) { @@ -35630,6 +38541,7 @@ function destinationFactory( return destinationEnclosed(code) } + /** @type {State} */ function destinationRaw(code) { if (code === 40) { @@ -35651,7 +38563,7 @@ function destinationFactory( return destinationRaw } - if (code === null || markdownLineEndingOrSpace$6(code)) { + if (code === null || markdownLineEndingOrSpace(code)) { if (balance) return nok(code) effects.exit('chunkString'); effects.exit(stringType); @@ -35660,10 +38572,11 @@ function destinationFactory( return ok(code) } - if (asciiControl$1(code)) return nok(code) + if (asciiControl(code)) return nok(code) effects.consume(code); return code === 92 ? destinationRawEscape : destinationRaw } + /** @type {State} */ function destinationRawEscape(code) { if (code === 40 || code === 41 || code === 92) { @@ -35675,17 +38588,31 @@ function destinationFactory( } } -var factoryDestination$2 = destinationFactory; - -var markdownLineEnding$a = markdownLineEnding_1; -var markdownSpace$7 = markdownSpace_1; +/** + * @typedef {import('micromark-util-types').Effects} Effects + * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext + * @typedef {import('micromark-util-types').State} State + */ +/** + * @this {TokenizeContext} + * @param {Effects} effects + * @param {State} ok + * @param {State} nok + * @param {string} type + * @param {string} markerType + * @param {string} stringType + * @returns {State} + */ // eslint-disable-next-line max-params -function labelFactory(effects, ok, nok, type, markerType, stringType) { - var self = this; - var size = 0; - var data; +function factoryLabel(effects, ok, nok, type, markerType, stringType) { + const self = this; + let size = 0; + /** @type {boolean} */ + + let data; return start + /** @type {State} */ function start(code) { effects.enter(type); @@ -35695,17 +38622,18 @@ function labelFactory(effects, ok, nok, type, markerType, stringType) { effects.enter(stringType); return atBreak } + /** @type {State} */ function atBreak(code) { if ( code === null || code === 91 || (code === 93 && !data) || - /* c8 ignore next */ + /* Hidden footnotes hook */ + + /* c8 ignore next 3 */ (code === 94 && - /* c8 ignore next */ !size && - /* c8 ignore next */ '_hiddenFootnoteSupport' in self.parser.constructs) || size > 999 ) { @@ -35721,7 +38649,7 @@ function labelFactory(effects, ok, nok, type, markerType, stringType) { return ok } - if (markdownLineEnding$a(code)) { + if (markdownLineEnding(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); @@ -35733,13 +38661,14 @@ function labelFactory(effects, ok, nok, type, markerType, stringType) { }); return label(code) } + /** @type {State} */ function label(code) { if ( code === null || code === 91 || code === 93 || - markdownLineEnding$a(code) || + markdownLineEnding(code) || size++ > 999 ) { effects.exit('chunkString'); @@ -35747,9 +38676,10 @@ function labelFactory(effects, ok, nok, type, markerType, stringType) { } effects.consume(code); - data = data || !markdownSpace$7(code); + data = data || !markdownSpace(code); return code === 92 ? labelEscape : label } + /** @type {State} */ function labelEscape(code) { if (code === 91 || code === 92 || code === 93) { @@ -35762,45 +38692,27 @@ function labelFactory(effects, ok, nok, type, markerType, stringType) { } } -var factoryLabel$2 = labelFactory; - -var markdownLineEnding$9 = markdownLineEnding_1; -var markdownSpace$6 = markdownSpace_1; -var factorySpace$9 = factorySpace$i; - -function whitespaceFactory(effects, ok) { - var seen; - return start - - function start(code) { - if (markdownLineEnding$9(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - seen = true; - return start - } - - if (markdownSpace$6(code)) { - return factorySpace$9( - effects, - start, - seen ? 'linePrefix' : 'lineSuffix' - )(code) - } - - return ok(code) - } -} - -var factoryWhitespace$2 = whitespaceFactory; - -var markdownLineEnding$8 = markdownLineEnding_1; -var factorySpace$8 = factorySpace$i; +/** + * @typedef {import('micromark-util-types').Effects} Effects + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ -function titleFactory(effects, ok, nok, type, markerType, stringType) { - var marker; +/** + * @param {Effects} effects + * @param {State} ok + * @param {State} nok + * @param {string} type + * @param {string} markerType + * @param {string} stringType + * @returns {State} + */ +// eslint-disable-next-line max-params +function factoryTitle(effects, ok, nok, type, markerType, stringType) { + /** @type {NonNullable<Code>} */ + let marker; return start + /** @type {State} */ function start(code) { effects.enter(type); @@ -35810,6 +38722,7 @@ function titleFactory(effects, ok, nok, type, markerType, stringType) { marker = code === 40 ? 41 : code; return atFirstTitleBreak } + /** @type {State} */ function atFirstTitleBreak(code) { if (code === marker) { @@ -35823,6 +38736,7 @@ function titleFactory(effects, ok, nok, type, markerType, stringType) { effects.enter(stringType); return atTitleBreak(code) } + /** @type {State} */ function atTitleBreak(code) { if (code === marker) { @@ -35834,11 +38748,11 @@ function titleFactory(effects, ok, nok, type, markerType, stringType) { return nok(code) } // Note: blank lines can’t exist in content. - if (markdownLineEnding$8(code)) { + if (markdownLineEnding(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); - return factorySpace$8(effects, atTitleBreak, 'linePrefix') + return factorySpace(effects, atTitleBreak, 'linePrefix') } effects.enter('chunkString', { @@ -35846,9 +38760,10 @@ function titleFactory(effects, ok, nok, type, markerType, stringType) { }); return title(code) } + /** @type {State} */ function title(code) { - if (code === marker || code === null || markdownLineEnding$8(code)) { + if (code === marker || code === null || markdownLineEnding(code)) { effects.exit('chunkString'); return atTitleBreak(code) } @@ -35856,6 +38771,7 @@ function titleFactory(effects, ok, nok, type, markerType, stringType) { effects.consume(code); return code === 92 ? titleEscape : title } + /** @type {State} */ function titleEscape(code) { if (code === marker || code === 92) { @@ -35867,34 +38783,93 @@ function titleFactory(effects, ok, nok, type, markerType, stringType) { } } -var factoryTitle$2 = titleFactory; +/** + * @typedef {import('micromark-util-types').Effects} Effects + * @typedef {import('micromark-util-types').State} State + */ -var markdownLineEnding$7 = markdownLineEnding_1; -var markdownLineEndingOrSpace$5 = markdownLineEndingOrSpace_1; -var normalizeIdentifier$3 = normalizeIdentifier_1; -var factoryDestination$1 = factoryDestination$2; -var factoryLabel$1 = factoryLabel$2; -var factorySpace$7 = factorySpace$i; -var factoryWhitespace$1 = factoryWhitespace$2; -var factoryTitle$1 = factoryTitle$2; +/** + * @param {Effects} effects + * @param {State} ok + */ +function factoryWhitespace(effects, ok) { + /** @type {boolean} */ + let seen; + return start + /** @type {State} */ + + function start(code) { + if (markdownLineEnding(code)) { + effects.enter('lineEnding'); + effects.consume(code); + effects.exit('lineEnding'); + seen = true; + return start + } -var definition$2 = { + if (markdownSpace(code)) { + return factorySpace( + effects, + start, + seen ? 'linePrefix' : 'lineSuffix' + )(code) + } + + return ok(code) + } +} + +/** + * Normalize an identifier (such as used in definitions). + * + * @param {string} value + * @returns {string} + */ +function normalizeIdentifier(value) { + return ( + value // Collapse Markdown whitespace. + .replace(/[\t\n\r ]+/g, ' ') // Trim. + .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase + // counterpart is uppercased will result in a different uppercase + // character. + // Hence, to get that form, we perform both lower- and uppercase. + // Upper case makes sure keys will not interact with default prototypal + // methods: no method is uppercase. + .toLowerCase() + .toUpperCase() + ) +} + +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + */ + +/** @type {Construct} */ +const definition$1 = { name: 'definition', tokenize: tokenizeDefinition }; -var titleConstruct = { +/** @type {Construct} */ + +const titleConstruct = { tokenize: tokenizeTitle, partial: true }; +/** @type {Tokenizer} */ function tokenizeDefinition(effects, ok, nok) { - var self = this; - var identifier; + const self = this; + /** @type {string} */ + + let identifier; return start + /** @type {State} */ function start(code) { effects.enter('definition'); - return factoryLabel$1.call( + return factoryLabel.call( self, effects, labelAfter, @@ -35904,9 +38879,10 @@ function tokenizeDefinition(effects, ok, nok) { 'definitionLabelString' )(code) } + /** @type {State} */ function labelAfter(code) { - identifier = normalizeIdentifier$3( + identifier = normalizeIdentifier( self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) ); @@ -35915,14 +38891,14 @@ function tokenizeDefinition(effects, ok, nok) { effects.consume(code); effects.exit('definitionMarker'); // Note: blank lines can’t exist in content. - return factoryWhitespace$1( + return factoryWhitespace( effects, - factoryDestination$1( + factoryDestination( effects, effects.attempt( titleConstruct, - factorySpace$7(effects, after, 'whitespace'), - factorySpace$7(effects, after, 'whitespace') + factorySpace(effects, after, 'whitespace'), + factorySpace(effects, after, 'whitespace') ), nok, 'definitionDestination', @@ -35936,12 +38912,13 @@ function tokenizeDefinition(effects, ok, nok) { return nok(code) } + /** @type {State} */ function after(code) { - if (code === null || markdownLineEnding$7(code)) { + if (code === null || markdownLineEnding(code)) { effects.exit('definition'); - if (self.parser.defined.indexOf(identifier) < 0) { + if (!self.parser.defined.includes(identifier)) { self.parser.defined.push(identifier); } @@ -35951,21 +38928,24 @@ function tokenizeDefinition(effects, ok, nok) { return nok(code) } } +/** @type {Tokenizer} */ function tokenizeTitle(effects, ok, nok) { return start + /** @type {State} */ function start(code) { - return markdownLineEndingOrSpace$5(code) - ? factoryWhitespace$1(effects, before)(code) + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, before)(code) : nok(code) } + /** @type {State} */ function before(code) { if (code === 34 || code === 39 || code === 40) { - return factoryTitle$1( + return factoryTitle( effects, - factorySpace$7(effects, after, 'whitespace'), + factorySpace(effects, after, 'whitespace'), nok, 'definitionTitle', 'definitionTitleMarker', @@ -35975,23 +38955,29 @@ function tokenizeTitle(effects, ok, nok) { return nok(code) } + /** @type {State} */ function after(code) { - return code === null || markdownLineEnding$7(code) ? ok(code) : nok(code) + return code === null || markdownLineEnding(code) ? ok(code) : nok(code) } } -var definition_1$1 = definition$2; - -var markdownLineEnding$6 = markdownLineEnding_1; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + */ -var hardBreakEscape$1 = { +/** @type {Construct} */ +const hardBreakEscape = { name: 'hardBreakEscape', tokenize: tokenizeHardBreakEscape }; +/** @type {Tokenizer} */ function tokenizeHardBreakEscape(effects, ok, nok) { return start + /** @type {State} */ function start(code) { effects.enter('hardBreakEscape'); @@ -35999,9 +38985,10 @@ function tokenizeHardBreakEscape(effects, ok, nok) { effects.consume(code); return open } + /** @type {State} */ function open(code) { - if (markdownLineEnding$6(code)) { + if (markdownLineEnding(code)) { effects.exit('escapeMarker'); effects.exit('hardBreakEscape'); return ok(code) @@ -36011,25 +38998,31 @@ function tokenizeHardBreakEscape(effects, ok, nok) { } } -var hardBreakEscape_1 = hardBreakEscape$1; - -var markdownLineEnding$5 = markdownLineEnding_1; -var markdownLineEndingOrSpace$4 = markdownLineEndingOrSpace_1; -var markdownSpace$5 = markdownSpace_1; -var chunkedSplice$1 = chunkedSplice_1; -var factorySpace$6 = factorySpace$i; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Resolver} Resolver + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').State} State + */ -var headingAtx$1 = { +/** @type {Construct} */ +const headingAtx = { name: 'headingAtx', tokenize: tokenizeHeadingAtx, resolve: resolveHeadingAtx }; +/** @type {Resolver} */ function resolveHeadingAtx(events, context) { - var contentEnd = events.length - 2; - var contentStart = 3; - var content; - var text; // Prefix whitespace, part of the opening. + let contentEnd = events.length - 2; + let contentStart = 3; + /** @type {Token} */ + + let content; + /** @type {Token} */ + + let text; // Prefix whitespace, part of the opening. if (events[contentStart][1].type === 'whitespace') { contentStart += 2; @@ -36061,9 +39054,10 @@ function resolveHeadingAtx(events, context) { type: 'chunkText', start: events[contentStart][1].start, end: events[contentEnd][1].end, + // @ts-expect-error Constants are fine to assign. contentType: 'text' }; - chunkedSplice$1(events, contentStart, contentEnd - contentStart + 1, [ + splice(events, contentStart, contentEnd - contentStart + 1, [ ['enter', content, context], ['enter', text, context], ['exit', text, context], @@ -36073,17 +39067,20 @@ function resolveHeadingAtx(events, context) { return events } +/** @type {Tokenizer} */ function tokenizeHeadingAtx(effects, ok, nok) { - var self = this; - var size = 0; + const self = this; + let size = 0; return start + /** @type {State} */ function start(code) { effects.enter('atxHeading'); effects.enter('atxHeadingSequence'); return fenceOpenInside(code) } + /** @type {State} */ function fenceOpenInside(code) { if (code === 35 && size++ < 6) { @@ -36091,13 +39088,14 @@ function tokenizeHeadingAtx(effects, ok, nok) { return fenceOpenInside } - if (code === null || markdownLineEndingOrSpace$4(code)) { + if (code === null || markdownLineEndingOrSpace(code)) { effects.exit('atxHeadingSequence'); return self.interrupt ? ok(code) : headingBreak(code) } return nok(code) } + /** @type {State} */ function headingBreak(code) { if (code === 35) { @@ -36105,18 +39103,19 @@ function tokenizeHeadingAtx(effects, ok, nok) { return sequence(code) } - if (code === null || markdownLineEnding$5(code)) { + if (code === null || markdownLineEnding(code)) { effects.exit('atxHeading'); return ok(code) } - if (markdownSpace$5(code)) { - return factorySpace$6(effects, headingBreak, 'whitespace')(code) + if (markdownSpace(code)) { + return factorySpace(effects, headingBreak, 'whitespace')(code) } effects.enter('atxHeadingText'); return data(code) } + /** @type {State} */ function sequence(code) { if (code === 35) { @@ -36127,9 +39126,10 @@ function tokenizeHeadingAtx(effects, ok, nok) { effects.exit('atxHeadingSequence'); return headingBreak(code) } + /** @type {State} */ function data(code) { - if (code === null || code === 35 || markdownLineEndingOrSpace$4(code)) { + if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { effects.exit('atxHeadingText'); return headingBreak(code) } @@ -36139,10 +39139,17 @@ function tokenizeHeadingAtx(effects, ok, nok) { } } -var headingAtx_1 = headingAtx$1; - -// This module is copied from <https://spec.commonmark.org/0.29/#html-blocks>. -var basics = [ +/** + * List of lowercase HTML tag names which when parsing HTML (flow), result + * in more relaxed rules (condition 6): because they are known blocks, the + * HTML-like syntax doesn’t have to be strictly parsed. + * For tag names not in this list, a more strict algorithm (condition 7) is used + * to detect whether the HTML-like syntax is seen as HTML (flow) or not. + * + * This is copied from: + * <https://spec.commonmark.org/0.29/#html-blocks>. + */ +const htmlBlockNames = [ 'address', 'article', 'aside', @@ -36207,36 +39214,45 @@ var basics = [ 'ul' ]; -var htmlBlockNames$1 = basics; - -// This module is copied from <https://spec.commonmark.org/0.29/#html-blocks>. -var raws = ['pre', 'script', 'style', 'textarea']; - -var htmlRawNames$1 = raws; +/** + * List of lowercase HTML tag names which when parsing HTML (flow), result in + * HTML that can include lines w/o exiting, until a closing tag also in this + * list is found (condition 1). + * + * This module is copied from: + * <https://spec.commonmark.org/0.29/#html-blocks>. + * + * Note that `textarea` is not available in `CommonMark@0.29` but has been + * merged to the primary branch and is slated to be released in the next release + * of CommonMark. + */ +const htmlRawNames = ['pre', 'script', 'style', 'textarea']; -var asciiAlpha$2 = asciiAlpha_1; -var asciiAlphanumeric$2 = asciiAlphanumeric_1; -var markdownLineEnding$4 = markdownLineEnding_1; -var markdownLineEndingOrSpace$3 = markdownLineEndingOrSpace_1; -var markdownSpace$4 = markdownSpace_1; -var fromCharCode = fromCharCode_1; -var htmlBlockNames = htmlBlockNames$1; -var htmlRawNames = htmlRawNames$1; -var partialBlankLine$1 = partialBlankLine_1; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Resolver} Resolver + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ +/** @type {Construct} */ -var htmlFlow$1 = { +const htmlFlow = { name: 'htmlFlow', tokenize: tokenizeHtmlFlow, resolveTo: resolveToHtmlFlow, concrete: true }; -var nextBlankConstruct = { +/** @type {Construct} */ + +const nextBlankConstruct = { tokenize: tokenizeNextBlank, partial: true }; +/** @type {Resolver} */ function resolveToHtmlFlow(events) { - var index = events.length; + let index = events.length; while (index--) { if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') { @@ -36255,15 +39271,27 @@ function resolveToHtmlFlow(events) { return events } +/** @type {Tokenizer} */ function tokenizeHtmlFlow(effects, ok, nok) { - var self = this; - var kind; - var startTag; - var buffer; - var index; - var marker; + const self = this; + /** @type {number} */ + + let kind; + /** @type {boolean} */ + + let startTag; + /** @type {string} */ + + let buffer; + /** @type {number} */ + + let index; + /** @type {Code} */ + + let marker; return start + /** @type {State} */ function start(code) { effects.enter('htmlFlow'); @@ -36271,6 +39299,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { effects.consume(code); return open } + /** @type {State} */ function open(code) { if (code === 33) { @@ -36291,15 +39320,16 @@ function tokenizeHtmlFlow(effects, ok, nok) { return self.interrupt ? ok : continuationDeclarationInside } - if (asciiAlpha$2(code)) { + if (asciiAlpha(code)) { effects.consume(code); - buffer = fromCharCode(code); + buffer = String.fromCharCode(code); startTag = true; return tagName } return nok(code) } + /** @type {State} */ function declarationStart(code) { if (code === 45) { @@ -36316,7 +39346,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { return cdataOpenInside } - if (asciiAlpha$2(code)) { + if (asciiAlpha(code)) { effects.consume(code); kind = 4; return self.interrupt ? ok : continuationDeclarationInside @@ -36324,6 +39354,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { return nok(code) } + /** @type {State} */ function commentOpenInside(code) { if (code === 45) { @@ -36333,6 +39364,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { return nok(code) } + /** @type {State} */ function cdataOpenInside(code) { if (code === buffer.charCodeAt(index++)) { @@ -36346,34 +39378,36 @@ function tokenizeHtmlFlow(effects, ok, nok) { return nok(code) } + /** @type {State} */ function tagCloseStart(code) { - if (asciiAlpha$2(code)) { + if (asciiAlpha(code)) { effects.consume(code); - buffer = fromCharCode(code); + buffer = String.fromCharCode(code); return tagName } return nok(code) } + /** @type {State} */ function tagName(code) { if ( code === null || code === 47 || code === 62 || - markdownLineEndingOrSpace$3(code) + markdownLineEndingOrSpace(code) ) { if ( code !== 47 && startTag && - htmlRawNames.indexOf(buffer.toLowerCase()) > -1 + htmlRawNames.includes(buffer.toLowerCase()) ) { kind = 1; return self.interrupt ? ok(code) : continuation(code) } - if (htmlBlockNames.indexOf(buffer.toLowerCase()) > -1) { + if (htmlBlockNames.includes(buffer.toLowerCase())) { kind = 6; if (code === 47) { @@ -36384,23 +39418,24 @@ function tokenizeHtmlFlow(effects, ok, nok) { return self.interrupt ? ok(code) : continuation(code) } - kind = 7; // Do not support complete HTML when interrupting. + kind = 7; // Do not support complete HTML when interrupting - return self.interrupt + return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : startTag ? completeAttributeNameBefore(code) : completeClosingTagAfter(code) } - if (code === 45 || asciiAlphanumeric$2(code)) { + if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code); - buffer += fromCharCode(code); + buffer += String.fromCharCode(code); return tagName } return nok(code) } + /** @type {State} */ function basicSelfClosing(code) { if (code === 62) { @@ -36410,15 +39445,17 @@ function tokenizeHtmlFlow(effects, ok, nok) { return nok(code) } + /** @type {State} */ function completeClosingTagAfter(code) { - if (markdownSpace$4(code)) { + if (markdownSpace(code)) { effects.consume(code); return completeClosingTagAfter } return completeEnd(code) } + /** @type {State} */ function completeAttributeNameBefore(code) { if (code === 47) { @@ -36426,18 +39463,19 @@ function tokenizeHtmlFlow(effects, ok, nok) { return completeEnd } - if (code === 58 || code === 95 || asciiAlpha$2(code)) { + if (code === 58 || code === 95 || asciiAlpha(code)) { effects.consume(code); return completeAttributeName } - if (markdownSpace$4(code)) { + if (markdownSpace(code)) { effects.consume(code); return completeAttributeNameBefore } return completeEnd(code) } + /** @type {State} */ function completeAttributeName(code) { if ( @@ -36445,7 +39483,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { code === 46 || code === 58 || code === 95 || - asciiAlphanumeric$2(code) + asciiAlphanumeric(code) ) { effects.consume(code); return completeAttributeName @@ -36453,6 +39491,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { return completeAttributeNameAfter(code) } + /** @type {State} */ function completeAttributeNameAfter(code) { if (code === 61) { @@ -36460,13 +39499,14 @@ function tokenizeHtmlFlow(effects, ok, nok) { return completeAttributeValueBefore } - if (markdownSpace$4(code)) { + if (markdownSpace(code)) { effects.consume(code); return completeAttributeNameAfter } return completeAttributeNameBefore(code) } + /** @type {State} */ function completeAttributeValueBefore(code) { if ( @@ -36485,28 +39525,30 @@ function tokenizeHtmlFlow(effects, ok, nok) { return completeAttributeValueQuoted } - if (markdownSpace$4(code)) { + if (markdownSpace(code)) { effects.consume(code); return completeAttributeValueBefore } - marker = undefined; + marker = null; return completeAttributeValueUnquoted(code) } + /** @type {State} */ function completeAttributeValueQuoted(code) { + if (code === null || markdownLineEnding(code)) { + return nok(code) + } + if (code === marker) { effects.consume(code); return completeAttributeValueQuotedAfter } - if (code === null || markdownLineEnding$4(code)) { - return nok(code) - } - effects.consume(code); return completeAttributeValueQuoted } + /** @type {State} */ function completeAttributeValueUnquoted(code) { if ( @@ -36517,7 +39559,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { code === 61 || code === 62 || code === 96 || - markdownLineEndingOrSpace$3(code) + markdownLineEndingOrSpace(code) ) { return completeAttributeNameAfter(code) } @@ -36525,14 +39567,16 @@ function tokenizeHtmlFlow(effects, ok, nok) { effects.consume(code); return completeAttributeValueUnquoted } + /** @type {State} */ function completeAttributeValueQuotedAfter(code) { - if (code === 47 || code === 62 || markdownSpace$4(code)) { + if (code === 47 || code === 62 || markdownSpace(code)) { return completeAttributeNameBefore(code) } return nok(code) } + /** @type {State} */ function completeEnd(code) { if (code === 62) { @@ -36542,17 +39586,19 @@ function tokenizeHtmlFlow(effects, ok, nok) { return nok(code) } + /** @type {State} */ function completeAfter(code) { - if (markdownSpace$4(code)) { + if (markdownSpace(code)) { effects.consume(code); return completeAfter } - return code === null || markdownLineEnding$4(code) + return code === null || markdownLineEnding(code) ? continuation(code) : nok(code) } + /** @type {State} */ function continuation(code) { if (code === 45 && kind === 2) { @@ -36580,7 +39626,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { return continuationCharacterDataInside } - if (markdownLineEnding$4(code) && (kind === 6 || kind === 7)) { + if (markdownLineEnding(code) && (kind === 6 || kind === 7)) { return effects.check( nextBlankConstruct, continuationClose, @@ -36588,34 +39634,59 @@ function tokenizeHtmlFlow(effects, ok, nok) { )(code) } - if (code === null || markdownLineEnding$4(code)) { + if (code === null || markdownLineEnding(code)) { return continuationAtLineEnding(code) } effects.consume(code); return continuation } + /** @type {State} */ function continuationAtLineEnding(code) { effects.exit('htmlFlowData'); return htmlContinueStart(code) } + /** @type {State} */ function htmlContinueStart(code) { if (code === null) { return done(code) } - if (markdownLineEnding$4(code)) { + if (markdownLineEnding(code)) { + return effects.attempt( + { + tokenize: htmlLineEnd, + partial: true + }, + htmlContinueStart, + done + )(code) + } + + effects.enter('htmlFlowData'); + return continuation(code) + } + /** @type {Tokenizer} */ + + function htmlLineEnd(effects, ok, nok) { + return start + /** @type {State} */ + + function start(code) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); - return htmlContinueStart + return lineStart } + /** @type {State} */ - effects.enter('htmlFlowData'); - return continuation(code) + function lineStart(code) { + return self.parser.lazy[self.now().line] ? nok(code) : ok(code) + } } + /** @type {State} */ function continuationCommentInside(code) { if (code === 45) { @@ -36625,6 +39696,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { return continuation(code) } + /** @type {State} */ function continuationRawTagOpen(code) { if (code === 47) { @@ -36635,21 +39707,23 @@ function tokenizeHtmlFlow(effects, ok, nok) { return continuation(code) } + /** @type {State} */ function continuationRawEndTag(code) { - if (code === 62 && htmlRawNames.indexOf(buffer.toLowerCase()) > -1) { + if (code === 62 && htmlRawNames.includes(buffer.toLowerCase())) { effects.consume(code); return continuationClose } - if (asciiAlpha$2(code) && buffer.length < 8) { + if (asciiAlpha(code) && buffer.length < 8) { effects.consume(code); - buffer += fromCharCode(code); + buffer += String.fromCharCode(code); return continuationRawEndTag } return continuation(code) } + /** @type {State} */ function continuationCharacterDataInside(code) { if (code === 93) { @@ -36659,6 +39733,7 @@ function tokenizeHtmlFlow(effects, ok, nok) { return continuation(code) } + /** @type {State} */ function continuationDeclarationInside(code) { if (code === 62) { @@ -36668,9 +39743,10 @@ function tokenizeHtmlFlow(effects, ok, nok) { return continuation(code) } + /** @type {State} */ function continuationClose(code) { - if (code === null || markdownLineEnding$4(code)) { + if (code === null || markdownLineEnding(code)) { effects.exit('htmlFlowData'); return done(code) } @@ -36678,46 +39754,58 @@ function tokenizeHtmlFlow(effects, ok, nok) { effects.consume(code); return continuationClose } + /** @type {State} */ function done(code) { effects.exit('htmlFlow'); return ok(code) } } +/** @type {Tokenizer} */ function tokenizeNextBlank(effects, ok, nok) { return start + /** @type {State} */ function start(code) { effects.exit('htmlFlowData'); effects.enter('lineEndingBlank'); effects.consume(code); effects.exit('lineEndingBlank'); - return effects.attempt(partialBlankLine$1, ok, nok) + return effects.attempt(blankLine, ok, nok) } } -var htmlFlow_1 = htmlFlow$1; - -var asciiAlpha$1 = asciiAlpha_1; -var asciiAlphanumeric$1 = asciiAlphanumeric_1; -var markdownLineEnding$3 = markdownLineEnding_1; -var markdownLineEndingOrSpace$2 = markdownLineEndingOrSpace_1; -var markdownSpace$3 = markdownSpace_1; -var factorySpace$5 = factorySpace$i; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ -var htmlText$1 = { +/** @type {Construct} */ +const htmlText = { name: 'htmlText', tokenize: tokenizeHtmlText }; +/** @type {Tokenizer} */ function tokenizeHtmlText(effects, ok, nok) { - var self = this; - var marker; - var buffer; - var index; - var returnState; + const self = this; + /** @type {NonNullable<Code>|undefined} */ + + let marker; + /** @type {string} */ + + let buffer; + /** @type {number} */ + + let index; + /** @type {State} */ + + let returnState; return start + /** @type {State} */ function start(code) { effects.enter('htmlText'); @@ -36725,6 +39813,7 @@ function tokenizeHtmlText(effects, ok, nok) { effects.consume(code); return open } + /** @type {State} */ function open(code) { if (code === 33) { @@ -36742,13 +39831,14 @@ function tokenizeHtmlText(effects, ok, nok) { return instruction } - if (asciiAlpha$1(code)) { + if (asciiAlpha(code)) { effects.consume(code); return tagOpen } return nok(code) } + /** @type {State} */ function declarationOpen(code) { if (code === 45) { @@ -36763,13 +39853,14 @@ function tokenizeHtmlText(effects, ok, nok) { return cdataOpen } - if (asciiAlpha$1(code)) { + if (asciiAlpha(code)) { effects.consume(code); return declaration } return nok(code) } + /** @type {State} */ function commentOpen(code) { if (code === 45) { @@ -36779,6 +39870,7 @@ function tokenizeHtmlText(effects, ok, nok) { return nok(code) } + /** @type {State} */ function commentStart(code) { if (code === null || code === 62) { @@ -36792,6 +39884,7 @@ function tokenizeHtmlText(effects, ok, nok) { return comment(code) } + /** @type {State} */ function commentStartDash(code) { if (code === null || code === 62) { @@ -36800,6 +39893,7 @@ function tokenizeHtmlText(effects, ok, nok) { return comment(code) } + /** @type {State} */ function comment(code) { if (code === null) { @@ -36811,7 +39905,7 @@ function tokenizeHtmlText(effects, ok, nok) { return commentClose } - if (markdownLineEnding$3(code)) { + if (markdownLineEnding(code)) { returnState = comment; return atLineEnding(code) } @@ -36819,6 +39913,7 @@ function tokenizeHtmlText(effects, ok, nok) { effects.consume(code); return comment } + /** @type {State} */ function commentClose(code) { if (code === 45) { @@ -36828,6 +39923,7 @@ function tokenizeHtmlText(effects, ok, nok) { return comment(code) } + /** @type {State} */ function cdataOpen(code) { if (code === buffer.charCodeAt(index++)) { @@ -36837,6 +39933,7 @@ function tokenizeHtmlText(effects, ok, nok) { return nok(code) } + /** @type {State} */ function cdata(code) { if (code === null) { @@ -36848,7 +39945,7 @@ function tokenizeHtmlText(effects, ok, nok) { return cdataClose } - if (markdownLineEnding$3(code)) { + if (markdownLineEnding(code)) { returnState = cdata; return atLineEnding(code) } @@ -36856,6 +39953,7 @@ function tokenizeHtmlText(effects, ok, nok) { effects.consume(code); return cdata } + /** @type {State} */ function cdataClose(code) { if (code === 93) { @@ -36865,6 +39963,7 @@ function tokenizeHtmlText(effects, ok, nok) { return cdata(code) } + /** @type {State} */ function cdataEnd(code) { if (code === 62) { @@ -36878,13 +39977,14 @@ function tokenizeHtmlText(effects, ok, nok) { return cdata(code) } + /** @type {State} */ function declaration(code) { if (code === null || code === 62) { return end(code) } - if (markdownLineEnding$3(code)) { + if (markdownLineEnding(code)) { returnState = declaration; return atLineEnding(code) } @@ -36892,6 +39992,7 @@ function tokenizeHtmlText(effects, ok, nok) { effects.consume(code); return declaration } + /** @type {State} */ function instruction(code) { if (code === null) { @@ -36903,7 +40004,7 @@ function tokenizeHtmlText(effects, ok, nok) { return instructionClose } - if (markdownLineEnding$3(code)) { + if (markdownLineEnding(code)) { returnState = instruction; return atLineEnding(code) } @@ -36911,55 +40012,61 @@ function tokenizeHtmlText(effects, ok, nok) { effects.consume(code); return instruction } + /** @type {State} */ function instructionClose(code) { return code === 62 ? end(code) : instruction(code) } + /** @type {State} */ function tagCloseStart(code) { - if (asciiAlpha$1(code)) { + if (asciiAlpha(code)) { effects.consume(code); return tagClose } return nok(code) } + /** @type {State} */ function tagClose(code) { - if (code === 45 || asciiAlphanumeric$1(code)) { + if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code); return tagClose } return tagCloseBetween(code) } + /** @type {State} */ function tagCloseBetween(code) { - if (markdownLineEnding$3(code)) { + if (markdownLineEnding(code)) { returnState = tagCloseBetween; return atLineEnding(code) } - if (markdownSpace$3(code)) { + if (markdownSpace(code)) { effects.consume(code); return tagCloseBetween } return end(code) } + /** @type {State} */ function tagOpen(code) { - if (code === 45 || asciiAlphanumeric$1(code)) { + if (code === 45 || asciiAlphanumeric(code)) { effects.consume(code); return tagOpen } - if (code === 47 || code === 62 || markdownLineEndingOrSpace$2(code)) { + if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code) } return nok(code) } + /** @type {State} */ function tagOpenBetween(code) { if (code === 47) { @@ -36967,23 +40074,24 @@ function tokenizeHtmlText(effects, ok, nok) { return end } - if (code === 58 || code === 95 || asciiAlpha$1(code)) { + if (code === 58 || code === 95 || asciiAlpha(code)) { effects.consume(code); return tagOpenAttributeName } - if (markdownLineEnding$3(code)) { + if (markdownLineEnding(code)) { returnState = tagOpenBetween; return atLineEnding(code) } - if (markdownSpace$3(code)) { + if (markdownSpace(code)) { effects.consume(code); return tagOpenBetween } return end(code) } + /** @type {State} */ function tagOpenAttributeName(code) { if ( @@ -36991,7 +40099,7 @@ function tokenizeHtmlText(effects, ok, nok) { code === 46 || code === 58 || code === 95 || - asciiAlphanumeric$1(code) + asciiAlphanumeric(code) ) { effects.consume(code); return tagOpenAttributeName @@ -36999,6 +40107,7 @@ function tokenizeHtmlText(effects, ok, nok) { return tagOpenAttributeNameAfter(code) } + /** @type {State} */ function tagOpenAttributeNameAfter(code) { if (code === 61) { @@ -37006,18 +40115,19 @@ function tokenizeHtmlText(effects, ok, nok) { return tagOpenAttributeValueBefore } - if (markdownLineEnding$3(code)) { + if (markdownLineEnding(code)) { returnState = tagOpenAttributeNameAfter; return atLineEnding(code) } - if (markdownSpace$3(code)) { + if (markdownSpace(code)) { effects.consume(code); return tagOpenAttributeNameAfter } return tagOpenBetween(code) } + /** @type {State} */ function tagOpenAttributeValueBefore(code) { if ( @@ -37036,12 +40146,12 @@ function tokenizeHtmlText(effects, ok, nok) { return tagOpenAttributeValueQuoted } - if (markdownLineEnding$3(code)) { + if (markdownLineEnding(code)) { returnState = tagOpenAttributeValueBefore; return atLineEnding(code) } - if (markdownSpace$3(code)) { + if (markdownSpace(code)) { effects.consume(code); return tagOpenAttributeValueBefore } @@ -37050,6 +40160,7 @@ function tokenizeHtmlText(effects, ok, nok) { marker = undefined; return tagOpenAttributeValueUnquoted } + /** @type {State} */ function tagOpenAttributeValueQuoted(code) { if (code === marker) { @@ -37061,7 +40172,7 @@ function tokenizeHtmlText(effects, ok, nok) { return nok(code) } - if (markdownLineEnding$3(code)) { + if (markdownLineEnding(code)) { returnState = tagOpenAttributeValueQuoted; return atLineEnding(code) } @@ -37069,14 +40180,16 @@ function tokenizeHtmlText(effects, ok, nok) { effects.consume(code); return tagOpenAttributeValueQuoted } + /** @type {State} */ function tagOpenAttributeValueQuotedAfter(code) { - if (code === 62 || code === 47 || markdownLineEndingOrSpace$2(code)) { + if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code) } return nok(code) } + /** @type {State} */ function tagOpenAttributeValueUnquoted(code) { if ( @@ -37090,7 +40203,7 @@ function tokenizeHtmlText(effects, ok, nok) { return nok(code) } - if (code === 62 || markdownLineEndingOrSpace$2(code)) { + if (code === 62 || markdownLineEndingOrSpace(code)) { return tagOpenBetween(code) } @@ -37099,25 +40212,29 @@ function tokenizeHtmlText(effects, ok, nok) { } // We can’t have blank lines in content, so no need to worry about empty // tokens. + /** @type {State} */ + function atLineEnding(code) { effects.exit('htmlTextData'); effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); - return factorySpace$5( + return factorySpace( effects, afterPrefix, 'linePrefix', - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 ) } + /** @type {State} */ function afterPrefix(code) { effects.enter('htmlTextData'); return returnState(code) } + /** @type {State} */ function end(code) { if (code === 62) { @@ -37131,47 +40248,53 @@ function tokenizeHtmlText(effects, ok, nok) { } } -var htmlText_1 = htmlText$1; - -var markdownLineEndingOrSpace$1 = markdownLineEndingOrSpace_1; -var chunkedPush = chunkedPush_1; -var chunkedSplice = chunkedSplice_1; -var normalizeIdentifier$2 = normalizeIdentifier_1; -var resolveAll$1 = resolveAll_1; -var shallow$1 = shallow_1; -var factoryDestination = factoryDestination$2; -var factoryLabel = factoryLabel$2; -var factoryTitle = factoryTitle$2; -var factoryWhitespace = factoryWhitespace$2; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Resolver} Resolver + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').Event} Event + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ -var labelEnd$3 = { +/** @type {Construct} */ +const labelEnd = { name: 'labelEnd', tokenize: tokenizeLabelEnd, resolveTo: resolveToLabelEnd, resolveAll: resolveAllLabelEnd }; -var resourceConstruct = { +/** @type {Construct} */ + +const resourceConstruct = { tokenize: tokenizeResource }; -var fullReferenceConstruct = { +/** @type {Construct} */ + +const fullReferenceConstruct = { tokenize: tokenizeFullReference }; -var collapsedReferenceConstruct = { +/** @type {Construct} */ + +const collapsedReferenceConstruct = { tokenize: tokenizeCollapsedReference }; +/** @type {Resolver} */ function resolveAllLabelEnd(events) { - var index = -1; - var token; + let index = -1; + /** @type {Token} */ + + let token; while (++index < events.length) { token = events[index][1]; if ( - !token._used && - (token.type === 'labelImage' || - token.type === 'labelLink' || - token.type === 'labelEnd') + token.type === 'labelImage' || + token.type === 'labelLink' || + token.type === 'labelEnd' ) { // Remove the marker. events.splice(index + 1, token.type === 'labelImage' ? 4 : 2); @@ -37182,17 +40305,23 @@ function resolveAllLabelEnd(events) { return events } +/** @type {Resolver} */ function resolveToLabelEnd(events, context) { - var index = events.length; - var offset = 0; - var group; - var label; - var text; - var token; - var open; - var close; - var media; // Find an opening. + let index = events.length; + let offset = 0; + /** @type {Token} */ + + let token; + /** @type {number|undefined} */ + + let open; + /** @type {number|undefined} */ + + let close; + /** @type {Event[]} */ + + let media; // Find an opening. while (index--) { token = events[index][1]; @@ -37228,58 +40357,63 @@ function resolveToLabelEnd(events, context) { } } - group = { + const group = { type: events[open][1].type === 'labelLink' ? 'link' : 'image', - start: shallow$1(events[open][1].start), - end: shallow$1(events[events.length - 1][1].end) + start: Object.assign({}, events[open][1].start), + end: Object.assign({}, events[events.length - 1][1].end) }; - label = { + const label = { type: 'label', - start: shallow$1(events[open][1].start), - end: shallow$1(events[close][1].end) + start: Object.assign({}, events[open][1].start), + end: Object.assign({}, events[close][1].end) }; - text = { + const text = { type: 'labelText', - start: shallow$1(events[open + offset + 2][1].end), - end: shallow$1(events[close - 2][1].start) + start: Object.assign({}, events[open + offset + 2][1].end), + end: Object.assign({}, events[close - 2][1].start) }; media = [ ['enter', group, context], ['enter', label, context] ]; // Opening marker. - media = chunkedPush(media, events.slice(open + 1, open + offset + 3)); // Text open. + media = push(media, events.slice(open + 1, open + offset + 3)); // Text open. - media = chunkedPush(media, [['enter', text, context]]); // Between. + media = push(media, [['enter', text, context]]); // Between. - media = chunkedPush( + media = push( media, - resolveAll$1( + resolveAll( context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context ) ); // Text close, marker close, label close. - media = chunkedPush(media, [ + media = push(media, [ ['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context] ]); // Reference, resource, or so. - media = chunkedPush(media, events.slice(close + 1)); // Media close. + media = push(media, events.slice(close + 1)); // Media close. - media = chunkedPush(media, [['exit', group, context]]); - chunkedSplice(events, open, events.length, media); + media = push(media, [['exit', group, context]]); + splice(events, open, events.length, media); return events } +/** @type {Tokenizer} */ function tokenizeLabelEnd(effects, ok, nok) { - var self = this; - var index = self.events.length; - var labelStart; - var defined; // Find an opening. + const self = this; + let index = self.events.length; + /** @type {Token} */ + + let labelStart; + /** @type {boolean} */ + + let defined; // Find an opening. while (index--) { if ( @@ -37293,6 +40427,7 @@ function tokenizeLabelEnd(effects, ok, nok) { } return start + /** @type {State} */ function start(code) { if (!labelStart) { @@ -37300,15 +40435,14 @@ function tokenizeLabelEnd(effects, ok, nok) { } // It’s a balanced bracket, but contains a link. if (labelStart._inactive) return balanced(code) - defined = - self.parser.defined.indexOf( - normalizeIdentifier$2( - self.sliceSerialize({ - start: labelStart.end, - end: self.now() - }) - ) - ) > -1; + defined = self.parser.defined.includes( + normalizeIdentifier( + self.sliceSerialize({ + start: labelStart.end, + end: self.now() + }) + ) + ); effects.enter('labelEnd'); effects.enter('labelMarker'); effects.consume(code); @@ -37316,6 +40450,7 @@ function tokenizeLabelEnd(effects, ok, nok) { effects.exit('labelEnd'); return afterLabelEnd } + /** @type {State} */ function afterLabelEnd(code) { // Resource: `[asd](fgh)`. @@ -37339,15 +40474,18 @@ function tokenizeLabelEnd(effects, ok, nok) { return defined ? ok(code) : balanced(code) } + /** @type {State} */ function balanced(code) { labelStart._balanced = true; return nok(code) } } +/** @type {Tokenizer} */ function tokenizeResource(effects, ok, nok) { return start + /** @type {State} */ function start(code) { effects.enter('resource'); @@ -37356,6 +40494,7 @@ function tokenizeResource(effects, ok, nok) { effects.exit('resourceMarker'); return factoryWhitespace(effects, open) } + /** @type {State} */ function open(code) { if (code === 41) { @@ -37374,12 +40513,14 @@ function tokenizeResource(effects, ok, nok) { 3 )(code) } + /** @type {State} */ function destinationAfter(code) { - return markdownLineEndingOrSpace$1(code) + return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, between)(code) : end(code) } + /** @type {State} */ function between(code) { if (code === 34 || code === 39 || code === 40) { @@ -37395,6 +40536,7 @@ function tokenizeResource(effects, ok, nok) { return end(code) } + /** @type {State} */ function end(code) { if (code === 41) { @@ -37408,10 +40550,12 @@ function tokenizeResource(effects, ok, nok) { return nok(code) } } +/** @type {Tokenizer} */ function tokenizeFullReference(effects, ok, nok) { - var self = this; + const self = this; return start + /** @type {State} */ function start(code) { return factoryLabel.call( @@ -37424,20 +40568,23 @@ function tokenizeFullReference(effects, ok, nok) { 'referenceString' )(code) } + /** @type {State} */ function afterLabel(code) { - return self.parser.defined.indexOf( - normalizeIdentifier$2( + return self.parser.defined.includes( + normalizeIdentifier( self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) ) - ) < 0 - ? nok(code) - : ok(code) + ) + ? ok(code) + : nok(code) } } +/** @type {Tokenizer} */ function tokenizeCollapsedReference(effects, ok, nok) { return start + /** @type {State} */ function start(code) { effects.enter('reference'); @@ -37446,6 +40593,7 @@ function tokenizeCollapsedReference(effects, ok, nok) { effects.exit('referenceMarker'); return open } + /** @type {State} */ function open(code) { if (code === 93) { @@ -37460,19 +40608,24 @@ function tokenizeCollapsedReference(effects, ok, nok) { } } -var labelEnd_1 = labelEnd$3; - -var labelEnd$2 = labelEnd_1; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + */ +/** @type {Construct} */ -var labelStartImage$1 = { +const labelStartImage = { name: 'labelStartImage', tokenize: tokenizeLabelStartImage, - resolveAll: labelEnd$2.resolveAll + resolveAll: labelEnd.resolveAll }; +/** @type {Tokenizer} */ function tokenizeLabelStartImage(effects, ok, nok) { - var self = this; + const self = this; return start + /** @type {State} */ function start(code) { effects.enter('labelImage'); @@ -37481,6 +40634,7 @@ function tokenizeLabelStartImage(effects, ok, nok) { effects.exit('labelImageMarker'); return open } + /** @type {State} */ function open(code) { if (code === 91) { @@ -37493,31 +40647,36 @@ function tokenizeLabelStartImage(effects, ok, nok) { return nok(code) } + /** @type {State} */ function after(code) { - /* c8 ignore next */ - return code === 94 && - /* c8 ignore next */ - '_hiddenFootnoteSupport' in self.parser.constructs - ? /* c8 ignore next */ - nok(code) + /* Hidden footnotes hook */ + + /* c8 ignore next 3 */ + return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs + ? nok(code) : ok(code) } } -var labelStartImage_1 = labelStartImage$1; - -var labelEnd$1 = labelEnd_1; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + */ +/** @type {Construct} */ -var labelStartLink$1 = { +const labelStartLink = { name: 'labelStartLink', tokenize: tokenizeLabelStartLink, - resolveAll: labelEnd$1.resolveAll + resolveAll: labelEnd.resolveAll }; +/** @type {Tokenizer} */ function tokenizeLabelStartLink(effects, ok, nok) { - var self = this; + const self = this; return start + /** @type {State} */ function start(code) { effects.enter('labelLink'); @@ -37527,59 +40686,71 @@ function tokenizeLabelStartLink(effects, ok, nok) { effects.exit('labelLink'); return after } + /** @type {State} */ function after(code) { - /* c8 ignore next */ - return code === 94 && - /* c8 ignore next */ - '_hiddenFootnoteSupport' in self.parser.constructs - ? /* c8 ignore next */ - nok(code) + /* Hidden footnotes hook. */ + + /* c8 ignore next 3 */ + return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs + ? nok(code) : ok(code) } } -var labelStartLink_1 = labelStartLink$1; - -var factorySpace$4 = factorySpace$i; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + */ -var lineEnding$1 = { +/** @type {Construct} */ +const lineEnding = { name: 'lineEnding', tokenize: tokenizeLineEnding }; +/** @type {Tokenizer} */ function tokenizeLineEnding(effects, ok) { return start + /** @type {State} */ function start(code) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); - return factorySpace$4(effects, ok, 'linePrefix') + return factorySpace(effects, ok, 'linePrefix') } } -var lineEnding_1 = lineEnding$1; - -var markdownLineEnding$2 = markdownLineEnding_1; -var markdownSpace$2 = markdownSpace_1; -var factorySpace$3 = factorySpace$i; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ -var thematicBreak$3 = { +/** @type {Construct} */ +const thematicBreak$1 = { name: 'thematicBreak', tokenize: tokenizeThematicBreak }; +/** @type {Tokenizer} */ function tokenizeThematicBreak(effects, ok, nok) { - var size = 0; - var marker; + let size = 0; + /** @type {NonNullable<Code>} */ + + let marker; return start + /** @type {State} */ function start(code) { effects.enter('thematicBreak'); marker = code; return atBreak(code) } + /** @type {State} */ function atBreak(code) { if (code === marker) { @@ -37587,17 +40758,18 @@ function tokenizeThematicBreak(effects, ok, nok) { return sequence(code) } - if (markdownSpace$2(code)) { - return factorySpace$3(effects, atBreak, 'whitespace')(code) + if (markdownSpace(code)) { + return factorySpace(effects, atBreak, 'whitespace')(code) } - if (size < 3 || (code !== null && !markdownLineEnding$2(code))) { + if (size < 3 || (code !== null && !markdownLineEnding(code))) { return nok(code) } effects.exit('thematicBreak'); return ok(code) } + /** @type {State} */ function sequence(code) { if (code === marker) { @@ -37611,17 +40783,17 @@ function tokenizeThematicBreak(effects, ok, nok) { } } -var thematicBreak_1$1 = thematicBreak$3; - -var asciiDigit$1 = asciiDigit_1; -var markdownSpace$1 = markdownSpace_1; -var prefixSize = prefixSize_1; -var sizeChunks = sizeChunks_1; -var factorySpace$2 = factorySpace$i; -var partialBlankLine = partialBlankLine_1; -var thematicBreak$2 = thematicBreak_1$1; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext + * @typedef {import('micromark-util-types').Exiter} Exiter + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ +/** @type {Construct} */ -var list$2 = { +const list$1 = { name: 'list', tokenize: tokenizeListStart, continuation: { @@ -37629,23 +40801,36 @@ var list$2 = { }, exit: tokenizeListEnd }; -var listItemPrefixWhitespaceConstruct = { +/** @type {Construct} */ + +const listItemPrefixWhitespaceConstruct = { tokenize: tokenizeListItemPrefixWhitespace, partial: true }; -var indentConstruct = { +/** @type {Construct} */ + +const indentConstruct = { tokenize: tokenizeIndent, partial: true }; +/** + * @type {Tokenizer} + * @this {TokenizeContextWithState} + */ function tokenizeListStart(effects, ok, nok) { - var self = this; - var initialSize = prefixSize(self.events, 'linePrefix'); - var size = 0; + const self = this; + const tail = self.events[self.events.length - 1]; + let initialSize = + tail && tail[1].type === 'linePrefix' + ? tail[2].sliceSerialize(tail[1], true).length + : 0; + let size = 0; return start + /** @type {State} */ function start(code) { - var kind = + const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? 'listUnordered' @@ -37654,7 +40839,7 @@ function tokenizeListStart(effects, ok, nok) { if ( kind === 'listUnordered' ? !self.containerState.marker || code === self.containerState.marker - : asciiDigit$1(code) + : asciiDigit(code) ) { if (!self.containerState.type) { self.containerState.type = kind; @@ -37666,7 +40851,7 @@ function tokenizeListStart(effects, ok, nok) { if (kind === 'listUnordered') { effects.enter('listItemPrefix'); return code === 42 || code === 45 - ? effects.check(thematicBreak$2, nok, atMarker)(code) + ? effects.check(thematicBreak$1, nok, atMarker)(code) : atMarker(code) } @@ -37679,9 +40864,10 @@ function tokenizeListStart(effects, ok, nok) { return nok(code) } + /** @type {State} */ function inside(code) { - if (asciiDigit$1(code) && ++size < 10) { + if (asciiDigit(code) && ++size < 10) { effects.consume(code); return inside } @@ -37698,6 +40884,9 @@ function tokenizeListStart(effects, ok, nok) { return nok(code) } + /** + * @type {State} + **/ function atMarker(code) { effects.enter('listItemMarker'); @@ -37705,7 +40894,7 @@ function tokenizeListStart(effects, ok, nok) { effects.exit('listItemMarker'); self.containerState.marker = self.containerState.marker || code; return effects.check( - partialBlankLine, // Can’t be empty when interrupting. + blankLine, // Can’t be empty when interrupting. self.interrupt ? nok : onBlank, effects.attempt( listItemPrefixWhitespaceConstruct, @@ -37714,15 +40903,17 @@ function tokenizeListStart(effects, ok, nok) { ) ) } + /** @type {State} */ function onBlank(code) { self.containerState.initialBlankLine = true; initialSize++; return endOfPrefix(code) } + /** @type {State} */ function otherPrefix(code) { - if (markdownSpace$1(code)) { + if (markdownSpace(code)) { effects.enter('listItemPrefixWhitespace'); effects.consume(code); effects.exit('listItemPrefixWhitespace'); @@ -37731,18 +40922,25 @@ function tokenizeListStart(effects, ok, nok) { return nok(code) } + /** @type {State} */ function endOfPrefix(code) { self.containerState.size = - initialSize + sizeChunks(self.sliceStream(effects.exit('listItemPrefix'))); + initialSize + + self.sliceSerialize(effects.exit('listItemPrefix'), true).length; return ok(code) } } +/** + * @type {Tokenizer} + * @this {TokenizeContextWithState} + */ function tokenizeListContinuation(effects, ok, nok) { - var self = this; + const self = this; self.containerState._closeFlow = undefined; - return effects.check(partialBlankLine, onBlank, notBlank) + return effects.check(blankLine, onBlank, notBlank) + /** @type {State} */ function onBlank(code) { self.containerState.furtherBlankLines = @@ -37750,98 +40948,129 @@ function tokenizeListContinuation(effects, ok, nok) { self.containerState.initialBlankLine; // We have a blank line. // Still, try to consume at most the items size. - return factorySpace$2( + return factorySpace( effects, ok, 'listItemIndent', self.containerState.size + 1 )(code) } + /** @type {State} */ function notBlank(code) { - if (self.containerState.furtherBlankLines || !markdownSpace$1(code)) { - self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; + if (self.containerState.furtherBlankLines || !markdownSpace(code)) { + self.containerState.furtherBlankLines = undefined; + self.containerState.initialBlankLine = undefined; return notInCurrentItem(code) } - self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; + self.containerState.furtherBlankLines = undefined; + self.containerState.initialBlankLine = undefined; return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) } + /** @type {State} */ function notInCurrentItem(code) { // While we do continue, we signal that the flow should be closed. self.containerState._closeFlow = true; // As we’re closing flow, we’re no longer interrupting. self.interrupt = undefined; - return factorySpace$2( + return factorySpace( effects, - effects.attempt(list$2, ok, nok), + effects.attempt(list$1, ok, nok), 'linePrefix', - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 )(code) } } +/** + * @type {Tokenizer} + * @this {TokenizeContextWithState} + */ function tokenizeIndent(effects, ok, nok) { - var self = this; - return factorySpace$2( + const self = this; + return factorySpace( effects, afterPrefix, 'listItemIndent', self.containerState.size + 1 ) + /** @type {State} */ function afterPrefix(code) { - return prefixSize(self.events, 'listItemIndent') === - self.containerState.size + const tail = self.events[self.events.length - 1]; + return tail && + tail[1].type === 'listItemIndent' && + tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code) } } +/** + * @type {Exiter} + * @this {TokenizeContextWithState} + */ function tokenizeListEnd(effects) { effects.exit(this.containerState.type); } +/** + * @type {Tokenizer} + * @this {TokenizeContextWithState} + */ function tokenizeListItemPrefixWhitespace(effects, ok, nok) { - var self = this; - return factorySpace$2( + const self = this; + return factorySpace( effects, afterPrefix, 'listItemPrefixWhitespace', - self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1 ) + /** @type {State} */ function afterPrefix(code) { - return markdownSpace$1(code) || - !prefixSize(self.events, 'listItemPrefixWhitespace') - ? nok(code) - : ok(code) + const tail = self.events[self.events.length - 1]; + return !markdownSpace(code) && + tail && + tail[1].type === 'listItemPrefixWhitespace' + ? ok(code) + : nok(code) } } -var list_1$1 = list$2; - -var markdownLineEnding$1 = markdownLineEnding_1; -var shallow = shallow_1; -var factorySpace$1 = factorySpace$i; +/** + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').Resolver} Resolver + * @typedef {import('micromark-util-types').Tokenizer} Tokenizer + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ -var setextUnderline$1 = { +/** @type {Construct} */ +const setextUnderline = { name: 'setextUnderline', tokenize: tokenizeSetextUnderline, resolveTo: resolveToSetextUnderline }; +/** @type {Resolver} */ function resolveToSetextUnderline(events, context) { - var index = events.length; - var content; - var text; - var definition; - var heading; // Find the opening of the content. + let index = events.length; + /** @type {number|undefined} */ + + let content; + /** @type {number|undefined} */ + + let text; + /** @type {number|undefined} */ + + let definition; // Find the opening of the content. // It’ll always exist: we don’t tokenize if it isn’t there. while (index--) { @@ -37867,10 +41096,10 @@ function resolveToSetextUnderline(events, context) { } } - heading = { + const heading = { type: 'setextHeading', - start: shallow(events[text][1].start), - end: shallow(events[events.length - 1][1].end) + start: Object.assign({}, events[text][1].start), + end: Object.assign({}, events[events.length - 1][1].end) }; // Change the paragraph to setext heading text. events[text][1].type = 'setextHeadingText'; // If we have definitions in the content, we’ll keep on having content, @@ -37879,7 +41108,7 @@ function resolveToSetextUnderline(events, context) { if (definition) { events.splice(text, 0, ['enter', heading, context]); events.splice(definition + 1, 0, ['exit', events[content][1], context]); - events[content][1].end = shallow(events[definition][1].end); + events[content][1].end = Object.assign({}, events[definition][1].end); } else { events[content][1] = heading; } // Add the heading exit at the end. @@ -37887,12 +41116,17 @@ function resolveToSetextUnderline(events, context) { events.push(['exit', heading, context]); return events } +/** @type {Tokenizer} */ function tokenizeSetextUnderline(effects, ok, nok) { - var self = this; - var index = self.events.length; - var marker; - var paragraph; // Find an opening. + const self = this; + let index = self.events.length; + /** @type {NonNullable<Code>} */ + + let marker; + /** @type {boolean} */ + + let paragraph; // Find an opening. while (index--) { // Skip enter/exit of line ending, line prefix, and content. @@ -37908,9 +41142,10 @@ function tokenizeSetextUnderline(effects, ok, nok) { } return start + /** @type {State} */ function start(code) { - if (!self.lazy && (self.interrupt || paragraph)) { + if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) { effects.enter('setextHeadingLine'); effects.enter('setextHeadingLineSequence'); marker = code; @@ -37919,6 +41154,7 @@ function tokenizeSetextUnderline(effects, ok, nok) { return nok(code) } + /** @type {State} */ function closingSequence(code) { if (code === marker) { @@ -37927,11 +41163,12 @@ function tokenizeSetextUnderline(effects, ok, nok) { } effects.exit('setextHeadingLineSequence'); - return factorySpace$1(effects, closingSequenceEnd, 'lineSuffix')(code) + return factorySpace(effects, closingSequenceEnd, 'lineSuffix')(code) } + /** @type {State} */ function closingSequenceEnd(code) { - if (code === null || markdownLineEnding$1(code)) { + if (code === null || markdownLineEnding(code)) { effects.exit('setextHeadingLine'); return ok(code) } @@ -37940,185 +41177,1037 @@ function tokenizeSetextUnderline(effects, ok, nok) { } } -var setextUnderline_1 = setextUnderline$1; - -Object.defineProperty(constructs$2, '__esModule', {value: true}); - -var text$1$1 = text$5; -var attention = attention_1; -var autolink = autolink_1; -var blockQuote = blockQuote_1; -var characterEscape$1 = characterEscape_1; -var characterReference$1 = characterReference_1; -var codeFenced = codeFenced_1; -var codeIndented = codeIndented_1; -var codeText = codeText_1; -var definition$1 = definition_1$1; -var hardBreakEscape = hardBreakEscape_1; -var headingAtx = headingAtx_1; -var htmlFlow = htmlFlow_1; -var htmlText = htmlText_1; -var labelEnd = labelEnd_1; -var labelStartImage = labelStartImage_1; -var labelStartLink = labelStartLink_1; -var lineEnding = lineEnding_1; -var list$1 = list_1$1; -var setextUnderline = setextUnderline_1; -var thematicBreak$1 = thematicBreak_1$1; - -var document$2 = { - 42: list$1, - // Asterisk - 43: list$1, - // Plus sign - 45: list$1, - // Dash - 48: list$1, - // 0 - 49: list$1, - // 1 - 50: list$1, - // 2 - 51: list$1, - // 3 - 52: list$1, - // 4 - 53: list$1, - // 5 - 54: list$1, - // 6 - 55: list$1, - // 7 - 56: list$1, - // 8 - 57: list$1, - // 9 - 62: blockQuote // Greater than -}; -var contentInitial = { - 91: definition$1 // Left square bracket -}; -var flowInitial = { - '-2': codeIndented, - // Horizontal tab - '-1': codeIndented, - // Virtual space - 32: codeIndented // Space -}; -var flow$6 = { - 35: headingAtx, - // Number sign - 42: thematicBreak$1, - // Asterisk - 45: [setextUnderline, thematicBreak$1], - // Dash - 60: htmlFlow, - // Less than - 61: setextUnderline, - // Equals to - 95: thematicBreak$1, - // Underscore - 96: codeFenced, - // Grave accent - 126: codeFenced // Tilde -}; -var string = { - 38: characterReference$1, - // Ampersand - 92: characterEscape$1 // Backslash -}; -var text$3 = { - '-5': lineEnding, - // Carriage return - '-4': lineEnding, - // Line feed - '-3': lineEnding, - // Carriage return + line feed - 33: labelStartImage, - // Exclamation mark - 38: characterReference$1, - // Ampersand - 42: attention, - // Asterisk - 60: [autolink, htmlText], - // Less than - 91: labelStartLink, - // Left square bracket - 92: [hardBreakEscape, characterEscape$1], - // Backslash - 93: labelEnd, - // Right square bracket - 95: attention, - // Underscore - 96: codeText // Grave accent +/** + * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct + * @typedef {import('micromark-util-types').Initializer} Initializer + * @typedef {import('micromark-util-types').State} State + */ + +/** @type {InitialConstruct} */ +const flow$1 = { + tokenize: initializeFlow }; -var insideSpan = { - null: [attention, text$1$1.resolver] +/** @type {Initializer} */ + +function initializeFlow(effects) { + const self = this; + const initial = effects.attempt( + // Try to parse a blank line. + blankLine, + atBlankEnding, // Try to parse initial flow (essentially, only code). + effects.attempt( + this.parser.constructs.flowInitial, + afterConstruct, + factorySpace( + effects, + effects.attempt( + this.parser.constructs.flow, + afterConstruct, + effects.attempt(content, afterConstruct) + ), + 'linePrefix' + ) + ) + ); + return initial + /** @type {State} */ + + function atBlankEnding(code) { + if (code === null) { + effects.consume(code); + return + } + + effects.enter('lineEndingBlank'); + effects.consume(code); + effects.exit('lineEndingBlank'); + self.currentConstruct = undefined; + return initial + } + /** @type {State} */ + + function afterConstruct(code) { + if (code === null) { + effects.consume(code); + return + } + + effects.enter('lineEnding'); + effects.consume(code); + effects.exit('lineEnding'); + self.currentConstruct = undefined; + return initial + } +} + +/** + * @typedef {import('micromark-util-types').Resolver} Resolver + * @typedef {import('micromark-util-types').Initializer} Initializer + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Code} Code + */ +const resolver = { + resolveAll: createResolver() }; -var disable = { +const string$1 = initializeFactory('string'); +const text$3 = initializeFactory('text'); +/** + * @param {'string'|'text'} field + * @returns {InitialConstruct} + */ + +function initializeFactory(field) { + return { + tokenize: initializeText, + resolveAll: createResolver( + field === 'text' ? resolveAllLineSuffixes : undefined + ) + } + /** @type {Initializer} */ + + function initializeText(effects) { + const self = this; + const constructs = this.parser.constructs[field]; + const text = effects.attempt(constructs, start, notText); + return start + /** @type {State} */ + + function start(code) { + return atBreak(code) ? text(code) : notText(code) + } + /** @type {State} */ + + function notText(code) { + if (code === null) { + effects.consume(code); + return + } + + effects.enter('data'); + effects.consume(code); + return data + } + /** @type {State} */ + + function data(code) { + if (atBreak(code)) { + effects.exit('data'); + return text(code) + } // Data. + + effects.consume(code); + return data + } + /** + * @param {Code} code + * @returns {boolean} + */ + + function atBreak(code) { + if (code === null) { + return true + } + + const list = constructs[code]; + let index = -1; + + if (list) { + while (++index < list.length) { + const item = list[index]; + + if (!item.previous || item.previous.call(self, self.previous)) { + return true + } + } + } + + return false + } + } +} +/** + * @param {Resolver} [extraResolver] + * @returns {Resolver} + */ + +function createResolver(extraResolver) { + return resolveAllText + /** @type {Resolver} */ + + function resolveAllText(events, context) { + let index = -1; + /** @type {number|undefined} */ + + let enter; // A rather boring computation (to merge adjacent `data` events) which + // improves mm performance by 29%. + + while (++index <= events.length) { + if (enter === undefined) { + if (events[index] && events[index][1].type === 'data') { + enter = index; + index++; + } + } else if (!events[index] || events[index][1].type !== 'data') { + // Don’t do anything if there is one data token. + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end; + events.splice(enter + 2, index - enter - 2); + index = enter + 2; + } + + enter = undefined; + } + } + + return extraResolver ? extraResolver(events, context) : events + } +} +/** + * A rather ugly set of instructions which again looks at chunks in the input + * stream. + * The reason to do this here is that it is *much* faster to parse in reverse. + * And that we can’t hook into `null` to split the line suffix before an EOF. + * To do: figure out if we can make this into a clean utility, or even in core. + * As it will be useful for GFMs literal autolink extension (and maybe even + * tables?) + * + * @type {Resolver} + */ + +function resolveAllLineSuffixes(events, context) { + let eventIndex = -1; + + while (++eventIndex <= events.length) { + if ( + (eventIndex === events.length || + events[eventIndex][1].type === 'lineEnding') && + events[eventIndex - 1][1].type === 'data' + ) { + const data = events[eventIndex - 1][1]; + const chunks = context.sliceStream(data); + let index = chunks.length; + let bufferIndex = -1; + let size = 0; + /** @type {boolean|undefined} */ + + let tabs; + + while (index--) { + const chunk = chunks[index]; + + if (typeof chunk === 'string') { + bufferIndex = chunk.length; + + while (chunk.charCodeAt(bufferIndex - 1) === 32) { + size++; + bufferIndex--; + } + + if (bufferIndex) break + bufferIndex = -1; + } // Number + else if (chunk === -2) { + tabs = true; + size++; + } else if (chunk === -1) ; else { + // Replacement character, exit. + index++; + break + } + } + + if (size) { + const token = { + type: + eventIndex === events.length || tabs || size < 2 + ? 'lineSuffix' + : 'hardBreakTrailing', + start: { + line: data.end.line, + column: data.end.column - size, + offset: data.end.offset - size, + _index: data.start._index + index, + _bufferIndex: index + ? bufferIndex + : data.start._bufferIndex + bufferIndex + }, + end: Object.assign({}, data.end) + }; + data.end = Object.assign({}, token.start); + + if (data.start.offset === data.end.offset) { + Object.assign(data, token); + } else { + events.splice( + eventIndex, + 0, + ['enter', token, context], + ['exit', token, context] + ); + eventIndex += 2; + } + } + + eventIndex++; + } + } + + return events +} + +/** + * @typedef {import('micromark-util-types').Code} Code + * @typedef {import('micromark-util-types').Chunk} Chunk + * @typedef {import('micromark-util-types').Point} Point + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').Effects} Effects + * @typedef {import('micromark-util-types').State} State + * @typedef {import('micromark-util-types').Construct} Construct + * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct + * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord + * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext + * @typedef {import('micromark-util-types').ParseContext} ParseContext + */ + +/** + * Create a tokenizer. + * Tokenizers deal with one type of data (e.g., containers, flow, text). + * The parser is the object dealing with it all. + * `initialize` works like other constructs, except that only its `tokenize` + * function is used, in which case it doesn’t receive an `ok` or `nok`. + * `from` can be given to set the point before the first character, although + * when further lines are indented, they must be set with `defineSkip`. + * + * @param {ParseContext} parser + * @param {InitialConstruct} initialize + * @param {Omit<Point, '_index'|'_bufferIndex'>} [from] + * @returns {TokenizeContext} + */ +function createTokenizer(parser, initialize, from) { + /** @type {Point} */ + let point = Object.assign( + from + ? Object.assign({}, from) + : { + line: 1, + column: 1, + offset: 0 + }, + { + _index: 0, + _bufferIndex: -1 + } + ); + /** @type {Record<string, number>} */ + + const columnStart = {}; + /** @type {Construct[]} */ + + const resolveAllConstructs = []; + /** @type {Chunk[]} */ + + let chunks = []; + /** @type {Token[]} */ + + let stack = []; + /** + * Tools used for tokenizing. + * + * @type {Effects} + */ + + const effects = { + consume, + enter, + exit, + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + interrupt: constructFactory(onsuccessfulcheck, { + interrupt: true + }) + }; + /** + * State and tools for resolving and serializing. + * + * @type {TokenizeContext} + */ + + const context = { + previous: null, + code: null, + containerState: {}, + events: [], + parser, + sliceStream, + sliceSerialize, + now, + defineSkip, + write + }; + /** + * The state function. + * + * @type {State|void} + */ + + let state = initialize.tokenize.call(context, effects); + + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize); + } + + return context + /** @type {TokenizeContext['write']} */ + + function write(slice) { + chunks = push(chunks, slice); + main(); // Exit if we’re not done, resolve might change stuff. + + if (chunks[chunks.length - 1] !== null) { + return [] + } + + addResult(initialize, 0); // Otherwise, resolve, and exit. + + context.events = resolveAll(resolveAllConstructs, context.events, context); + return context.events + } // + // Tools. + // + + /** @type {TokenizeContext['sliceSerialize']} */ + + function sliceSerialize(token, expandTabs) { + return serializeChunks(sliceStream(token), expandTabs) + } + /** @type {TokenizeContext['sliceStream']} */ + + function sliceStream(token) { + return sliceChunks(chunks, token) + } + /** @type {TokenizeContext['now']} */ + + function now() { + return Object.assign({}, point) + } + /** @type {TokenizeContext['defineSkip']} */ + + function defineSkip(value) { + columnStart[value.line] = value.column; + accountForPotentialSkip(); + } // + // State management. + // + + /** + * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by + * `consume`). + * Here is where we walk through the chunks, which either include strings of + * several characters, or numerical character codes. + * The reason to do this in a loop instead of a call is so the stack can + * drain. + * + * @returns {void} + */ + + function main() { + /** @type {number} */ + let chunkIndex; + + while (point._index < chunks.length) { + const chunk = chunks[point._index]; // If we’re in a buffer chunk, loop through it. + + if (typeof chunk === 'string') { + chunkIndex = point._index; + + if (point._bufferIndex < 0) { + point._bufferIndex = 0; + } + + while ( + point._index === chunkIndex && + point._bufferIndex < chunk.length + ) { + go(chunk.charCodeAt(point._bufferIndex)); + } + } else { + go(chunk); + } + } + } + /** + * Deal with one code. + * + * @param {Code} code + * @returns {void} + */ + + function go(code) { + state = state(code); + } + /** @type {Effects['consume']} */ + + function consume(code) { + if (markdownLineEnding(code)) { + point.line++; + point.column = 1; + point.offset += code === -3 ? 2 : 1; + accountForPotentialSkip(); + } else if (code !== -1) { + point.column++; + point.offset++; + } // Not in a string chunk. + + if (point._bufferIndex < 0) { + point._index++; + } else { + point._bufferIndex++; // At end of string chunk. + // @ts-expect-error Points w/ non-negative `_bufferIndex` reference + // strings. + + if (point._bufferIndex === chunks[point._index].length) { + point._bufferIndex = -1; + point._index++; + } + } // Expose the previous character. + + context.previous = code; // Mark as consumed. + } + /** @type {Effects['enter']} */ + + function enter(type, fields) { + /** @type {Token} */ + // @ts-expect-error Patch instead of assign required fields to help GC. + const token = fields || {}; + token.type = type; + token.start = now(); + context.events.push(['enter', token, context]); + stack.push(token); + return token + } + /** @type {Effects['exit']} */ + + function exit(type) { + const token = stack.pop(); + token.end = now(); + context.events.push(['exit', token, context]); + return token + } + /** + * Use results. + * + * @type {ReturnHandle} + */ + + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from); + } + /** + * Discard results. + * + * @type {ReturnHandle} + */ + + function onsuccessfulcheck(_, info) { + info.restore(); + } + /** + * Factory to attempt/check/interrupt. + * + * @param {ReturnHandle} onreturn + * @param {Record<string, unknown>} [fields] + */ + + function constructFactory(onreturn, fields) { + return hook + /** + * Handle either an object mapping codes to constructs, a list of + * constructs, or a single construct. + * + * @param {Construct|Construct[]|ConstructRecord} constructs + * @param {State} returnState + * @param {State} [bogusState] + * @returns {State} + */ + + function hook(constructs, returnState, bogusState) { + /** @type {Construct[]} */ + let listOfConstructs; + /** @type {number} */ + + let constructIndex; + /** @type {Construct} */ + + let currentConstruct; + /** @type {Info} */ + + let info; + return Array.isArray(constructs) + ? /* c8 ignore next 1 */ + handleListOfConstructs(constructs) + : 'tokenize' in constructs // @ts-expect-error Looks like a construct. + ? handleListOfConstructs([constructs]) + : handleMapOfConstructs(constructs) + /** + * Handle a list of construct. + * + * @param {ConstructRecord} map + * @returns {State} + */ + + function handleMapOfConstructs(map) { + return start + /** @type {State} */ + + function start(code) { + const def = code !== null && map[code]; + const all = code !== null && map.null; + const list = [ + // To do: add more extension tests. + + /* c8 ignore next 2 */ + ...(Array.isArray(def) ? def : def ? [def] : []), + ...(Array.isArray(all) ? all : all ? [all] : []) + ]; + return handleListOfConstructs(list)(code) + } + } + /** + * Handle a list of construct. + * + * @param {Construct[]} list + * @returns {State} + */ + + function handleListOfConstructs(list) { + listOfConstructs = list; + constructIndex = 0; + + if (list.length === 0) { + return bogusState + } + + return handleConstruct(list[constructIndex]) + } + /** + * Handle a single construct. + * + * @param {Construct} construct + * @returns {State} + */ + + function handleConstruct(construct) { + return start + /** @type {State} */ + + function start(code) { + // To do: not needed to store if there is no bogus state, probably? + // Currently doesn’t work because `inspect` in document does a check + // w/o a bogus, which doesn’t make sense. But it does seem to help perf + // by not storing. + info = store(); + currentConstruct = construct; + + if (!construct.partial) { + context.currentConstruct = construct; + } + + if ( + construct.name && + context.parser.constructs.disable.null.includes(construct.name) + ) { + return nok() + } + + return construct.tokenize.call( + // If we do have fields, create an object w/ `context` as its + // prototype. + // This allows a “live binding”, which is needed for `interrupt`. + fields ? Object.assign(Object.create(context), fields) : context, + effects, + ok, + nok + )(code) + } + } + /** @type {State} */ + + function ok(code) { + onreturn(currentConstruct, info); + return returnState + } + /** @type {State} */ + + function nok(code) { + info.restore(); + + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]) + } + + return bogusState + } + } + } + /** + * @param {Construct} construct + * @param {number} from + * @returns {void} + */ + + function addResult(construct, from) { + if (construct.resolveAll && !resolveAllConstructs.includes(construct)) { + resolveAllConstructs.push(construct); + } + + if (construct.resolve) { + splice( + context.events, + from, + context.events.length - from, + construct.resolve(context.events.slice(from), context) + ); + } + + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context); + } + } + /** + * Store state. + * + * @returns {Info} + */ + + function store() { + const startPoint = now(); + const startPrevious = context.previous; + const startCurrentConstruct = context.currentConstruct; + const startEventsIndex = context.events.length; + const startStack = Array.from(stack); + return { + restore, + from: startEventsIndex + } + /** + * Restore state. + * + * @returns {void} + */ + + function restore() { + point = startPoint; + context.previous = startPrevious; + context.currentConstruct = startCurrentConstruct; + context.events.length = startEventsIndex; + stack = startStack; + accountForPotentialSkip(); + } + } + /** + * Move the current point a bit forward in the line when it’s on a column + * skip. + * + * @returns {void} + */ + + function accountForPotentialSkip() { + if (point.line in columnStart && point.column < 2) { + point.column = columnStart[point.line]; + point.offset += columnStart[point.line] - 1; + } + } +} +/** + * Get the chunks from a slice of chunks in the range of a token. + * + * @param {Chunk[]} chunks + * @param {Pick<Token, 'start'|'end'>} token + * @returns {Chunk[]} + */ + +function sliceChunks(chunks, token) { + const startIndex = token.start._index; + const startBufferIndex = token.start._bufferIndex; + const endIndex = token.end._index; + const endBufferIndex = token.end._bufferIndex; + /** @type {Chunk[]} */ + + let view; + + if (startIndex === endIndex) { + // @ts-expect-error `_bufferIndex` is used on string chunks. + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; + } else { + view = chunks.slice(startIndex, endIndex); + + if (startBufferIndex > -1) { + // @ts-expect-error `_bufferIndex` is used on string chunks. + view[0] = view[0].slice(startBufferIndex); + } + + if (endBufferIndex > 0) { + // @ts-expect-error `_bufferIndex` is used on string chunks. + view.push(chunks[endIndex].slice(0, endBufferIndex)); + } + } + + return view +} +/** + * Get the string value of a slice of chunks. + * + * @param {Chunk[]} chunks + * @param {boolean} [expandTabs=false] + * @returns {string} + */ + +function serializeChunks(chunks, expandTabs) { + let index = -1; + /** @type {string[]} */ + + const result = []; + /** @type {boolean|undefined} */ + + let atTab; + + while (++index < chunks.length) { + const chunk = chunks[index]; + /** @type {string} */ + + let value; + + if (typeof chunk === 'string') { + value = chunk; + } else + switch (chunk) { + case -5: { + value = '\r'; + break + } + + case -4: { + value = '\n'; + break + } + + case -3: { + value = '\r' + '\n'; + break + } + + case -2: { + value = expandTabs ? ' ' : '\t'; + break + } + + case -1: { + if (!expandTabs && atTab) continue + value = ' '; + break + } + + default: { + // Currently only replacement character. + value = String.fromCharCode(chunk); + } + } + + atTab = chunk === -2; + result.push(value); + } + + return result.join('') +} + +/** + * @typedef {import('micromark-util-types').Extension} Extension + */ +/** @type {Extension['document']} */ + +const document$1 = { + [42]: list$1, + [43]: list$1, + [45]: list$1, + [48]: list$1, + [49]: list$1, + [50]: list$1, + [51]: list$1, + [52]: list$1, + [53]: list$1, + [54]: list$1, + [55]: list$1, + [56]: list$1, + [57]: list$1, + [62]: blockQuote +}; +/** @type {Extension['contentInitial']} */ + +const contentInitial = { + [91]: definition$1 +}; +/** @type {Extension['flowInitial']} */ + +const flowInitial = { + [-2]: codeIndented, + [-1]: codeIndented, + [32]: codeIndented +}; +/** @type {Extension['flow']} */ + +const flow = { + [35]: headingAtx, + [42]: thematicBreak$1, + [45]: [setextUnderline, thematicBreak$1], + [60]: htmlFlow, + [61]: setextUnderline, + [95]: thematicBreak$1, + [96]: codeFenced, + [126]: codeFenced +}; +/** @type {Extension['string']} */ + +const string = { + [38]: characterReference$1, + [92]: characterEscape$1 +}; +/** @type {Extension['text']} */ + +const text$2 = { + [-5]: lineEnding, + [-4]: lineEnding, + [-3]: lineEnding, + [33]: labelStartImage, + [38]: characterReference$1, + [42]: attention, + [60]: [autolink, htmlText], + [91]: labelStartLink, + [92]: [hardBreakEscape, characterEscape$1], + [93]: labelEnd, + [95]: attention, + [96]: codeText +}; +/** @type {Extension['insideSpan']} */ + +const insideSpan = { + null: [attention, resolver] +}; +/** @type {Extension['disable']} */ + +const disable = { null: [] }; -constructs$2.contentInitial = contentInitial; -constructs$2.disable = disable; -constructs$2.document = document$2; -constructs$2.flow = flow$6; -constructs$2.flowInitial = flowInitial; -constructs$2.insideSpan = insideSpan; -constructs$2.string = string; -constructs$2.text = text$3; - -var content = content$3; -var document$1 = document$3; -var flow$5 = flow$7; -var text$2 = text$5; -var combineExtensions$1 = combineExtensions_1; -var createTokenizer = createTokenizer_1; -var miniflat = miniflat_1; -var constructs$1 = constructs$2; - -function parse$3(options) { - var settings = options || {}; - var parser = { +var defaultConstructs = /*#__PURE__*/Object.freeze({ + __proto__: null, + document: document$1, + contentInitial: contentInitial, + flowInitial: flowInitial, + flow: flow, + string: string, + text: text$2, + insideSpan: insideSpan, + disable: disable +}); + +/** + * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct + * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension + * @typedef {import('micromark-util-types').ParseOptions} ParseOptions + * @typedef {import('micromark-util-types').ParseContext} ParseContext + * @typedef {import('micromark-util-types').Create} Create + */ +/** + * @param {ParseOptions} [options] + * @returns {ParseContext} + */ + +function parse(options = {}) { + /** @type {FullNormalizedExtension} */ + // @ts-expect-error `defaultConstructs` is full, so the result will be too. + const constructs = combineExtensions( + // @ts-expect-error Same as above. + [defaultConstructs].concat(options.extensions || []) + ); + /** @type {ParseContext} */ + + const parser = { defined: [], - constructs: combineExtensions$1( - [constructs$1].concat(miniflat(settings.extensions)) - ), - content: create(content), - document: create(document$1), - flow: create(flow$5), - string: create(text$2.string), - text: create(text$2.text) + lazy: {}, + constructs, + content: create(content$1), + document: create(document$2), + flow: create(flow$1), + string: create(string$1), + text: create(text$3) }; return parser + /** + * @param {InitialConstruct} initial + */ - function create(initializer) { + function create(initial) { return creator + /** @type {Create} */ function creator(from) { - return createTokenizer(parser, initializer, from) + return createTokenizer(parser, initial, from) } } } -var parse_1$1 = parse$3; +/** + * @typedef {import('micromark-util-types').Encoding} Encoding + * @typedef {import('micromark-util-types').Value} Value + * @typedef {import('micromark-util-types').Chunk} Chunk + * @typedef {import('micromark-util-types').Code} Code + */ -var search = /[\0\t\n\r]/g; +/** + * @callback Preprocessor + * @param {Value} value + * @param {Encoding} [encoding] + * @param {boolean} [end=false] + * @returns {Chunk[]} + */ +const search = /[\0\t\n\r]/g; +/** + * @returns {Preprocessor} + */ function preprocess() { - var start = true; - var column = 1; - var buffer = ''; - var atCarriageReturn; + let column = 1; + let buffer = ''; + /** @type {boolean|undefined} */ + + let start = true; + /** @type {boolean|undefined} */ + + let atCarriageReturn; return preprocessor + /** @type {Preprocessor} */ function preprocessor(value, encoding, end) { - var chunks = []; - var match; - var next; - var startPosition; - var endPosition; - var code; + /** @type {Chunk[]} */ + const chunks = []; + /** @type {RegExpMatchArray|null} */ + + let match; + /** @type {number} */ + + let next; + /** @type {number} */ + + let startPosition; + /** @type {number} */ + + let endPosition; + /** @type {Code} */ + + let code; // @ts-expect-error `Buffer` does allow an encoding. + value = buffer + value.toString(encoding); startPosition = 0; buffer = ''; @@ -38134,7 +42223,8 @@ function preprocess() { while (startPosition < value.length) { search.lastIndex = startPosition; match = search.exec(value); - endPosition = match ? match.index : value.length; + endPosition = + match && match.index !== undefined ? match.index : value.length; code = value.charCodeAt(endPosition); if (!match) { @@ -38156,21 +42246,32 @@ function preprocess() { column += endPosition - startPosition; } - if (code === 0) { - chunks.push(65533); - column++; - } else if (code === 9) { - next = Math.ceil(column / 4) * 4; - chunks.push(-2); - - while (column++ < next) chunks.push(-1); - } else if (code === 10) { - chunks.push(-4); - column = 1; - } // Must be carriage return. - else { - atCarriageReturn = true; - column = 1; + switch (code) { + case 0: { + chunks.push(65533); + column++; + break + } + + case 9: { + next = Math.ceil(column / 4) * 4; + chunks.push(-2); + + while (column++ < next) chunks.push(-1); + + break + } + + case 10: { + chunks.push(-4); + column = 1; + break + } + + default: { + atCarriageReturn = true; + column = 1; + } } } @@ -38187,11 +42288,15 @@ function preprocess() { } } -var preprocess_1 = preprocess; - -var subtokenize = subtokenize_1; +/** + * @typedef {import('micromark-util-types').Event} Event + */ +/** + * @param {Event[]} events + * @returns {Event[]} + */ -function postprocess$1(events) { +function postprocess(events) { while (!subtokenize(events)) { // Empty } @@ -38199,4497 +42304,108 @@ function postprocess$1(events) { return events } -var postprocess_1 = postprocess$1; - -const AEli$1 = "Æ"; -const AElig$1 = "Æ"; -const AM$1 = "&"; -const AMP$1 = "&"; -const Aacut$1 = "Á"; -const Aacute$1 = "Á"; -const Abreve$1 = "Ă"; -const Acir$1 = "Â"; -const Acirc$1 = "Â"; -const Acy$1 = "А"; -const Afr$1 = "𝔄"; -const Agrav$1 = "À"; -const Agrave$1 = "À"; -const Alpha$1 = "Α"; -const Amacr$1 = "Ā"; -const And$1 = "⩓"; -const Aogon$1 = "Ą"; -const Aopf$1 = "𝔸"; -const ApplyFunction$1 = ""; -const Arin$1 = "Å"; -const Aring$1 = "Å"; -const Ascr$1 = "𝒜"; -const Assign$1 = "≔"; -const Atild$1 = "Ã"; -const Atilde$1 = "Ã"; -const Aum$1 = "Ä"; -const Auml$1 = "Ä"; -const Backslash$1 = "∖"; -const Barv$1 = "⫧"; -const Barwed$1 = "⌆"; -const Bcy$1 = "Б"; -const Because$1 = "∵"; -const Bernoullis$1 = "ℬ"; -const Beta$1 = "Β"; -const Bfr$1 = "𝔅"; -const Bopf$1 = "𝔹"; -const Breve$1 = "˘"; -const Bscr$1 = "ℬ"; -const Bumpeq$1 = "≎"; -const CHcy$1 = "Ч"; -const COP$1 = "©"; -const COPY$1 = "©"; -const Cacute$1 = "Ć"; -const Cap$1 = "⋒"; -const CapitalDifferentialD$1 = "ⅅ"; -const Cayleys$1 = "ℭ"; -const Ccaron$1 = "Č"; -const Ccedi$1 = "Ç"; -const Ccedil$1 = "Ç"; -const Ccirc$1 = "Ĉ"; -const Cconint$1 = "∰"; -const Cdot$1 = "Ċ"; -const Cedilla$1 = "¸"; -const CenterDot$1 = "·"; -const Cfr$1 = "ℭ"; -const Chi$1 = "Χ"; -const CircleDot$1 = "⊙"; -const CircleMinus$1 = "⊖"; -const CirclePlus$1 = "⊕"; -const CircleTimes$1 = "⊗"; -const ClockwiseContourIntegral$1 = "∲"; -const CloseCurlyDoubleQuote$1 = "”"; -const CloseCurlyQuote$1 = "’"; -const Colon$1 = "∷"; -const Colone$1 = "⩴"; -const Congruent$1 = "≡"; -const Conint$1 = "∯"; -const ContourIntegral$1 = "∮"; -const Copf$1 = "ℂ"; -const Coproduct$1 = "∐"; -const CounterClockwiseContourIntegral$1 = "∳"; -const Cross$1 = "⨯"; -const Cscr$1 = "𝒞"; -const Cup$1 = "⋓"; -const CupCap$1 = "≍"; -const DD$1 = "ⅅ"; -const DDotrahd$1 = "⤑"; -const DJcy$1 = "Ђ"; -const DScy$1 = "Ѕ"; -const DZcy$1 = "Џ"; -const Dagger$1 = "‡"; -const Darr$1 = "↡"; -const Dashv$1 = "⫤"; -const Dcaron$1 = "Ď"; -const Dcy$1 = "Д"; -const Del$1 = "∇"; -const Delta$1 = "Δ"; -const Dfr$1 = "𝔇"; -const DiacriticalAcute$1 = "´"; -const DiacriticalDot$1 = "˙"; -const DiacriticalDoubleAcute$1 = "˝"; -const DiacriticalGrave$1 = "`"; -const DiacriticalTilde$1 = "˜"; -const Diamond$1 = "⋄"; -const DifferentialD$1 = "ⅆ"; -const Dopf$1 = "𝔻"; -const Dot$1 = "¨"; -const DotDot$1 = "⃜"; -const DotEqual$1 = "≐"; -const DoubleContourIntegral$1 = "∯"; -const DoubleDot$1 = "¨"; -const DoubleDownArrow$1 = "⇓"; -const DoubleLeftArrow$1 = "⇐"; -const DoubleLeftRightArrow$1 = "⇔"; -const DoubleLeftTee$1 = "⫤"; -const DoubleLongLeftArrow$1 = "⟸"; -const DoubleLongLeftRightArrow$1 = "⟺"; -const DoubleLongRightArrow$1 = "⟹"; -const DoubleRightArrow$1 = "⇒"; -const DoubleRightTee$1 = "⊨"; -const DoubleUpArrow$1 = "⇑"; -const DoubleUpDownArrow$1 = "⇕"; -const DoubleVerticalBar$1 = "∥"; -const DownArrow$1 = "↓"; -const DownArrowBar$1 = "⤓"; -const DownArrowUpArrow$1 = "⇵"; -const DownBreve$1 = "̑"; -const DownLeftRightVector$1 = "⥐"; -const DownLeftTeeVector$1 = "⥞"; -const DownLeftVector$1 = "↽"; -const DownLeftVectorBar$1 = "⥖"; -const DownRightTeeVector$1 = "⥟"; -const DownRightVector$1 = "⇁"; -const DownRightVectorBar$1 = "⥗"; -const DownTee$1 = "⊤"; -const DownTeeArrow$1 = "↧"; -const Downarrow$1 = "⇓"; -const Dscr$1 = "𝒟"; -const Dstrok$1 = "Đ"; -const ENG$1 = "Ŋ"; -const ET$1 = "Ð"; -const ETH$1 = "Ð"; -const Eacut$1 = "É"; -const Eacute$1 = "É"; -const Ecaron$1 = "Ě"; -const Ecir$1 = "Ê"; -const Ecirc$1 = "Ê"; -const Ecy$1 = "Э"; -const Edot$1 = "Ė"; -const Efr$1 = "𝔈"; -const Egrav$1 = "È"; -const Egrave$1 = "È"; -const Element$1 = "∈"; -const Emacr$1 = "Ē"; -const EmptySmallSquare$1 = "◻"; -const EmptyVerySmallSquare$1 = "▫"; -const Eogon$1 = "Ę"; -const Eopf$1 = "𝔼"; -const Epsilon$1 = "Ε"; -const Equal$1 = "⩵"; -const EqualTilde$1 = "≂"; -const Equilibrium$1 = "⇌"; -const Escr$1 = "ℰ"; -const Esim$1 = "⩳"; -const Eta$1 = "Η"; -const Eum$1 = "Ë"; -const Euml$1 = "Ë"; -const Exists$1 = "∃"; -const ExponentialE$1 = "ⅇ"; -const Fcy$1 = "Ф"; -const Ffr$1 = "𝔉"; -const FilledSmallSquare$1 = "◼"; -const FilledVerySmallSquare$1 = "▪"; -const Fopf$1 = "𝔽"; -const ForAll$1 = "∀"; -const Fouriertrf$1 = "ℱ"; -const Fscr$1 = "ℱ"; -const GJcy$1 = "Ѓ"; -const G$1 = ">"; -const GT$1 = ">"; -const Gamma$1 = "Γ"; -const Gammad$1 = "Ϝ"; -const Gbreve$1 = "Ğ"; -const Gcedil$1 = "Ģ"; -const Gcirc$1 = "Ĝ"; -const Gcy$1 = "Г"; -const Gdot$1 = "Ġ"; -const Gfr$1 = "𝔊"; -const Gg$1 = "⋙"; -const Gopf$1 = "𝔾"; -const GreaterEqual$1 = "≥"; -const GreaterEqualLess$1 = "⋛"; -const GreaterFullEqual$1 = "≧"; -const GreaterGreater$1 = "⪢"; -const GreaterLess$1 = "≷"; -const GreaterSlantEqual$1 = "⩾"; -const GreaterTilde$1 = "≳"; -const Gscr$1 = "𝒢"; -const Gt$1 = "≫"; -const HARDcy$1 = "Ъ"; -const Hacek$1 = "ˇ"; -const Hat$1 = "^"; -const Hcirc$1 = "Ĥ"; -const Hfr$1 = "ℌ"; -const HilbertSpace$1 = "ℋ"; -const Hopf$1 = "ℍ"; -const HorizontalLine$1 = "─"; -const Hscr$1 = "ℋ"; -const Hstrok$1 = "Ħ"; -const HumpDownHump$1 = "≎"; -const HumpEqual$1 = "≏"; -const IEcy$1 = "Е"; -const IJlig$1 = "IJ"; -const IOcy$1 = "Ё"; -const Iacut$1 = "Í"; -const Iacute$1 = "Í"; -const Icir$1 = "Î"; -const Icirc$1 = "Î"; -const Icy$1 = "И"; -const Idot$1 = "İ"; -const Ifr$1 = "ℑ"; -const Igrav$1 = "Ì"; -const Igrave$1 = "Ì"; -const Im$1 = "ℑ"; -const Imacr$1 = "Ī"; -const ImaginaryI$1 = "ⅈ"; -const Implies$1 = "⇒"; -const Int$1 = "∬"; -const Integral$1 = "∫"; -const Intersection$1 = "⋂"; -const InvisibleComma$1 = ""; -const InvisibleTimes$1 = ""; -const Iogon$1 = "Į"; -const Iopf$1 = "𝕀"; -const Iota$1 = "Ι"; -const Iscr$1 = "ℐ"; -const Itilde$1 = "Ĩ"; -const Iukcy$1 = "І"; -const Ium$1 = "Ï"; -const Iuml$1 = "Ï"; -const Jcirc$1 = "Ĵ"; -const Jcy$1 = "Й"; -const Jfr$1 = "𝔍"; -const Jopf$1 = "𝕁"; -const Jscr$1 = "𝒥"; -const Jsercy$1 = "Ј"; -const Jukcy$1 = "Є"; -const KHcy$1 = "Х"; -const KJcy$1 = "Ќ"; -const Kappa$1 = "Κ"; -const Kcedil$1 = "Ķ"; -const Kcy$1 = "К"; -const Kfr$1 = "𝔎"; -const Kopf$1 = "𝕂"; -const Kscr$1 = "𝒦"; -const LJcy$1 = "Љ"; -const L$1 = "<"; -const LT$1 = "<"; -const Lacute$1 = "Ĺ"; -const Lambda$1 = "Λ"; -const Lang$1 = "⟪"; -const Laplacetrf$1 = "ℒ"; -const Larr$1 = "↞"; -const Lcaron$1 = "Ľ"; -const Lcedil$1 = "Ļ"; -const Lcy$1 = "Л"; -const LeftAngleBracket$1 = "⟨"; -const LeftArrow$1 = "←"; -const LeftArrowBar$1 = "⇤"; -const LeftArrowRightArrow$1 = "⇆"; -const LeftCeiling$1 = "⌈"; -const LeftDoubleBracket$1 = "⟦"; -const LeftDownTeeVector$1 = "⥡"; -const LeftDownVector$1 = "⇃"; -const LeftDownVectorBar$1 = "⥙"; -const LeftFloor$1 = "⌊"; -const LeftRightArrow$1 = "↔"; -const LeftRightVector$1 = "⥎"; -const LeftTee$1 = "⊣"; -const LeftTeeArrow$1 = "↤"; -const LeftTeeVector$1 = "⥚"; -const LeftTriangle$1 = "⊲"; -const LeftTriangleBar$1 = "⧏"; -const LeftTriangleEqual$1 = "⊴"; -const LeftUpDownVector$1 = "⥑"; -const LeftUpTeeVector$1 = "⥠"; -const LeftUpVector$1 = "↿"; -const LeftUpVectorBar$1 = "⥘"; -const LeftVector$1 = "↼"; -const LeftVectorBar$1 = "⥒"; -const Leftarrow$1 = "⇐"; -const Leftrightarrow$1 = "⇔"; -const LessEqualGreater$1 = "⋚"; -const LessFullEqual$1 = "≦"; -const LessGreater$1 = "≶"; -const LessLess$1 = "⪡"; -const LessSlantEqual$1 = "⩽"; -const LessTilde$1 = "≲"; -const Lfr$1 = "𝔏"; -const Ll$1 = "⋘"; -const Lleftarrow$1 = "⇚"; -const Lmidot$1 = "Ŀ"; -const LongLeftArrow$1 = "⟵"; -const LongLeftRightArrow$1 = "⟷"; -const LongRightArrow$1 = "⟶"; -const Longleftarrow$1 = "⟸"; -const Longleftrightarrow$1 = "⟺"; -const Longrightarrow$1 = "⟹"; -const Lopf$1 = "𝕃"; -const LowerLeftArrow$1 = "↙"; -const LowerRightArrow$1 = "↘"; -const Lscr$1 = "ℒ"; -const Lsh$1 = "↰"; -const Lstrok$1 = "Ł"; -const Lt$1 = "≪"; -const Mcy$1 = "М"; -const MediumSpace$1 = " "; -const Mellintrf$1 = "ℳ"; -const Mfr$1 = "𝔐"; -const MinusPlus$1 = "∓"; -const Mopf$1 = "𝕄"; -const Mscr$1 = "ℳ"; -const Mu$1 = "Μ"; -const NJcy$1 = "Њ"; -const Nacute$1 = "Ń"; -const Ncaron$1 = "Ň"; -const Ncedil$1 = "Ņ"; -const Ncy$1 = "Н"; -const NegativeMediumSpace$1 = ""; -const NegativeThickSpace$1 = ""; -const NegativeThinSpace$1 = ""; -const NegativeVeryThinSpace$1 = ""; -const NestedGreaterGreater$1 = "≫"; -const NestedLessLess$1 = "≪"; -const NewLine$1 = "\n"; -const Nfr$1 = "𝔑"; -const NoBreak$1 = ""; -const NonBreakingSpace$1 = " "; -const Nopf$1 = "ℕ"; -const Not$1 = "⫬"; -const NotCongruent$1 = "≢"; -const NotCupCap$1 = "≭"; -const NotDoubleVerticalBar$1 = "∦"; -const NotElement$1 = "∉"; -const NotEqual$1 = "≠"; -const NotEqualTilde$1 = "≂̸"; -const NotExists$1 = "∄"; -const NotGreater$1 = "≯"; -const NotGreaterEqual$1 = "≱"; -const NotGreaterFullEqual$1 = "≧̸"; -const NotGreaterGreater$1 = "≫̸"; -const NotGreaterLess$1 = "≹"; -const NotGreaterSlantEqual$1 = "⩾̸"; -const NotGreaterTilde$1 = "≵"; -const NotHumpDownHump$1 = "≎̸"; -const NotHumpEqual$1 = "≏̸"; -const NotLeftTriangle$1 = "⋪"; -const NotLeftTriangleBar$1 = "⧏̸"; -const NotLeftTriangleEqual$1 = "⋬"; -const NotLess$1 = "≮"; -const NotLessEqual$1 = "≰"; -const NotLessGreater$1 = "≸"; -const NotLessLess$1 = "≪̸"; -const NotLessSlantEqual$1 = "⩽̸"; -const NotLessTilde$1 = "≴"; -const NotNestedGreaterGreater$1 = "⪢̸"; -const NotNestedLessLess$1 = "⪡̸"; -const NotPrecedes$1 = "⊀"; -const NotPrecedesEqual$1 = "⪯̸"; -const NotPrecedesSlantEqual$1 = "⋠"; -const NotReverseElement$1 = "∌"; -const NotRightTriangle$1 = "⋫"; -const NotRightTriangleBar$1 = "⧐̸"; -const NotRightTriangleEqual$1 = "⋭"; -const NotSquareSubset$1 = "⊏̸"; -const NotSquareSubsetEqual$1 = "⋢"; -const NotSquareSuperset$1 = "⊐̸"; -const NotSquareSupersetEqual$1 = "⋣"; -const NotSubset$1 = "⊂⃒"; -const NotSubsetEqual$1 = "⊈"; -const NotSucceeds$1 = "⊁"; -const NotSucceedsEqual$1 = "⪰̸"; -const NotSucceedsSlantEqual$1 = "⋡"; -const NotSucceedsTilde$1 = "≿̸"; -const NotSuperset$1 = "⊃⃒"; -const NotSupersetEqual$1 = "⊉"; -const NotTilde$1 = "≁"; -const NotTildeEqual$1 = "≄"; -const NotTildeFullEqual$1 = "≇"; -const NotTildeTilde$1 = "≉"; -const NotVerticalBar$1 = "∤"; -const Nscr$1 = "𝒩"; -const Ntild$1 = "Ñ"; -const Ntilde$1 = "Ñ"; -const Nu$1 = "Ν"; -const OElig$1 = "Œ"; -const Oacut$1 = "Ó"; -const Oacute$1 = "Ó"; -const Ocir$1 = "Ô"; -const Ocirc$1 = "Ô"; -const Ocy$1 = "О"; -const Odblac$1 = "Ő"; -const Ofr$1 = "𝔒"; -const Ograv$1 = "Ò"; -const Ograve$1 = "Ò"; -const Omacr$1 = "Ō"; -const Omega$1 = "Ω"; -const Omicron$1 = "Ο"; -const Oopf$1 = "𝕆"; -const OpenCurlyDoubleQuote$1 = "“"; -const OpenCurlyQuote$1 = "‘"; -const Or$1 = "⩔"; -const Oscr$1 = "𝒪"; -const Oslas$1 = "Ø"; -const Oslash$1 = "Ø"; -const Otild$1 = "Õ"; -const Otilde$1 = "Õ"; -const Otimes$1 = "⨷"; -const Oum$1 = "Ö"; -const Ouml$1 = "Ö"; -const OverBar$1 = "‾"; -const OverBrace$1 = "⏞"; -const OverBracket$1 = "⎴"; -const OverParenthesis$1 = "⏜"; -const PartialD$1 = "∂"; -const Pcy$1 = "П"; -const Pfr$1 = "𝔓"; -const Phi$1 = "Φ"; -const Pi$1 = "Π"; -const PlusMinus$1 = "±"; -const Poincareplane$1 = "ℌ"; -const Popf$1 = "ℙ"; -const Pr$1 = "⪻"; -const Precedes$1 = "≺"; -const PrecedesEqual$1 = "⪯"; -const PrecedesSlantEqual$1 = "≼"; -const PrecedesTilde$1 = "≾"; -const Prime$1 = "″"; -const Product$1 = "∏"; -const Proportion$1 = "∷"; -const Proportional$1 = "∝"; -const Pscr$1 = "𝒫"; -const Psi$1 = "Ψ"; -const QUO$1 = "\""; -const QUOT$1 = "\""; -const Qfr$1 = "𝔔"; -const Qopf$1 = "ℚ"; -const Qscr$1 = "𝒬"; -const RBarr$1 = "⤐"; -const RE$1 = "®"; -const REG$1 = "®"; -const Racute$1 = "Ŕ"; -const Rang$1 = "⟫"; -const Rarr$1 = "↠"; -const Rarrtl$1 = "⤖"; -const Rcaron$1 = "Ř"; -const Rcedil$1 = "Ŗ"; -const Rcy$1 = "Р"; -const Re$1 = "ℜ"; -const ReverseElement$1 = "∋"; -const ReverseEquilibrium$1 = "⇋"; -const ReverseUpEquilibrium$1 = "⥯"; -const Rfr$1 = "ℜ"; -const Rho$1 = "Ρ"; -const RightAngleBracket$1 = "⟩"; -const RightArrow$1 = "→"; -const RightArrowBar$1 = "⇥"; -const RightArrowLeftArrow$1 = "⇄"; -const RightCeiling$1 = "⌉"; -const RightDoubleBracket$1 = "⟧"; -const RightDownTeeVector$1 = "⥝"; -const RightDownVector$1 = "⇂"; -const RightDownVectorBar$1 = "⥕"; -const RightFloor$1 = "⌋"; -const RightTee$1 = "⊢"; -const RightTeeArrow$1 = "↦"; -const RightTeeVector$1 = "⥛"; -const RightTriangle$1 = "⊳"; -const RightTriangleBar$1 = "⧐"; -const RightTriangleEqual$1 = "⊵"; -const RightUpDownVector$1 = "⥏"; -const RightUpTeeVector$1 = "⥜"; -const RightUpVector$1 = "↾"; -const RightUpVectorBar$1 = "⥔"; -const RightVector$1 = "⇀"; -const RightVectorBar$1 = "⥓"; -const Rightarrow$1 = "⇒"; -const Ropf$1 = "ℝ"; -const RoundImplies$1 = "⥰"; -const Rrightarrow$1 = "⇛"; -const Rscr$1 = "ℛ"; -const Rsh$1 = "↱"; -const RuleDelayed$1 = "⧴"; -const SHCHcy$1 = "Щ"; -const SHcy$1 = "Ш"; -const SOFTcy$1 = "Ь"; -const Sacute$1 = "Ś"; -const Sc$1 = "⪼"; -const Scaron$1 = "Š"; -const Scedil$1 = "Ş"; -const Scirc$1 = "Ŝ"; -const Scy$1 = "С"; -const Sfr$1 = "𝔖"; -const ShortDownArrow$1 = "↓"; -const ShortLeftArrow$1 = "←"; -const ShortRightArrow$1 = "→"; -const ShortUpArrow$1 = "↑"; -const Sigma$1 = "Σ"; -const SmallCircle$1 = "∘"; -const Sopf$1 = "𝕊"; -const Sqrt$1 = "√"; -const Square$1 = "□"; -const SquareIntersection$1 = "⊓"; -const SquareSubset$1 = "⊏"; -const SquareSubsetEqual$1 = "⊑"; -const SquareSuperset$1 = "⊐"; -const SquareSupersetEqual$1 = "⊒"; -const SquareUnion$1 = "⊔"; -const Sscr$1 = "𝒮"; -const Star$1 = "⋆"; -const Sub$1 = "⋐"; -const Subset$1 = "⋐"; -const SubsetEqual$1 = "⊆"; -const Succeeds$1 = "≻"; -const SucceedsEqual$1 = "⪰"; -const SucceedsSlantEqual$1 = "≽"; -const SucceedsTilde$1 = "≿"; -const SuchThat$1 = "∋"; -const Sum$1 = "∑"; -const Sup$1 = "⋑"; -const Superset$1 = "⊃"; -const SupersetEqual$1 = "⊇"; -const Supset$1 = "⋑"; -const THOR$1 = "Þ"; -const THORN$1 = "Þ"; -const TRADE$1 = "™"; -const TSHcy$1 = "Ћ"; -const TScy$1 = "Ц"; -const Tab$1 = "\t"; -const Tau$1 = "Τ"; -const Tcaron$1 = "Ť"; -const Tcedil$1 = "Ţ"; -const Tcy$1 = "Т"; -const Tfr$1 = "𝔗"; -const Therefore$1 = "∴"; -const Theta$1 = "Θ"; -const ThickSpace$1 = " "; -const ThinSpace$1 = " "; -const Tilde$1 = "∼"; -const TildeEqual$1 = "≃"; -const TildeFullEqual$1 = "≅"; -const TildeTilde$1 = "≈"; -const Topf$1 = "𝕋"; -const TripleDot$1 = "⃛"; -const Tscr$1 = "𝒯"; -const Tstrok$1 = "Ŧ"; -const Uacut$1 = "Ú"; -const Uacute$1 = "Ú"; -const Uarr$1 = "↟"; -const Uarrocir$1 = "⥉"; -const Ubrcy$1 = "Ў"; -const Ubreve$1 = "Ŭ"; -const Ucir$1 = "Û"; -const Ucirc$1 = "Û"; -const Ucy$1 = "У"; -const Udblac$1 = "Ű"; -const Ufr$1 = "𝔘"; -const Ugrav$1 = "Ù"; -const Ugrave$1 = "Ù"; -const Umacr$1 = "Ū"; -const UnderBar$1 = "_"; -const UnderBrace$1 = "⏟"; -const UnderBracket$1 = "⎵"; -const UnderParenthesis$1 = "⏝"; -const Union$1 = "⋃"; -const UnionPlus$1 = "⊎"; -const Uogon$1 = "Ų"; -const Uopf$1 = "𝕌"; -const UpArrow$1 = "↑"; -const UpArrowBar$1 = "⤒"; -const UpArrowDownArrow$1 = "⇅"; -const UpDownArrow$1 = "↕"; -const UpEquilibrium$1 = "⥮"; -const UpTee$1 = "⊥"; -const UpTeeArrow$1 = "↥"; -const Uparrow$1 = "⇑"; -const Updownarrow$1 = "⇕"; -const UpperLeftArrow$1 = "↖"; -const UpperRightArrow$1 = "↗"; -const Upsi$1 = "ϒ"; -const Upsilon$1 = "Υ"; -const Uring$1 = "Ů"; -const Uscr$1 = "𝒰"; -const Utilde$1 = "Ũ"; -const Uum$1 = "Ü"; -const Uuml$1 = "Ü"; -const VDash$1 = "⊫"; -const Vbar$1 = "⫫"; -const Vcy$1 = "В"; -const Vdash$1 = "⊩"; -const Vdashl$1 = "⫦"; -const Vee$1 = "⋁"; -const Verbar$1 = "‖"; -const Vert$1 = "‖"; -const VerticalBar$1 = "∣"; -const VerticalLine$1 = "|"; -const VerticalSeparator$1 = "❘"; -const VerticalTilde$1 = "≀"; -const VeryThinSpace$1 = " "; -const Vfr$1 = "𝔙"; -const Vopf$1 = "𝕍"; -const Vscr$1 = "𝒱"; -const Vvdash$1 = "⊪"; -const Wcirc$1 = "Ŵ"; -const Wedge$1 = "⋀"; -const Wfr$1 = "𝔚"; -const Wopf$1 = "𝕎"; -const Wscr$1 = "𝒲"; -const Xfr$1 = "𝔛"; -const Xi$1 = "Ξ"; -const Xopf$1 = "𝕏"; -const Xscr$1 = "𝒳"; -const YAcy$1 = "Я"; -const YIcy$1 = "Ї"; -const YUcy$1 = "Ю"; -const Yacut$1 = "Ý"; -const Yacute$1 = "Ý"; -const Ycirc$1 = "Ŷ"; -const Ycy$1 = "Ы"; -const Yfr$1 = "𝔜"; -const Yopf$1 = "𝕐"; -const Yscr$1 = "𝒴"; -const Yuml$1 = "Ÿ"; -const ZHcy$1 = "Ж"; -const Zacute$1 = "Ź"; -const Zcaron$1 = "Ž"; -const Zcy$1 = "З"; -const Zdot$1 = "Ż"; -const ZeroWidthSpace$1 = ""; -const Zeta$1 = "Ζ"; -const Zfr$1 = "ℨ"; -const Zopf$1 = "ℤ"; -const Zscr$1 = "𝒵"; -const aacut$1 = "á"; -const aacute$1 = "á"; -const abreve$1 = "ă"; -const ac$1 = "∾"; -const acE$1 = "∾̳"; -const acd$1 = "∿"; -const acir$1 = "â"; -const acirc$1 = "â"; -const acut$1 = "´"; -const acute$1 = "´"; -const acy$1 = "а"; -const aeli$1 = "æ"; -const aelig$1 = "æ"; -const af$1 = ""; -const afr$1 = "𝔞"; -const agrav$1 = "à"; -const agrave$1 = "à"; -const alefsym$1 = "ℵ"; -const aleph$1 = "ℵ"; -const alpha$1 = "α"; -const amacr$1 = "ā"; -const amalg$1 = "⨿"; -const am$1 = "&"; -const amp$1 = "&"; -const and$1 = "∧"; -const andand$1 = "⩕"; -const andd$1 = "⩜"; -const andslope$1 = "⩘"; -const andv$1 = "⩚"; -const ang$1 = "∠"; -const ange$1 = "⦤"; -const angle$1 = "∠"; -const angmsd$1 = "∡"; -const angmsdaa$1 = "⦨"; -const angmsdab$1 = "⦩"; -const angmsdac$1 = "⦪"; -const angmsdad$1 = "⦫"; -const angmsdae$1 = "⦬"; -const angmsdaf$1 = "⦭"; -const angmsdag$1 = "⦮"; -const angmsdah$1 = "⦯"; -const angrt$1 = "∟"; -const angrtvb$1 = "⊾"; -const angrtvbd$1 = "⦝"; -const angsph$1 = "∢"; -const angst$1 = "Å"; -const angzarr$1 = "⍼"; -const aogon$1 = "ą"; -const aopf$1 = "𝕒"; -const ap$1 = "≈"; -const apE$1 = "⩰"; -const apacir$1 = "⩯"; -const ape$1 = "≊"; -const apid$1 = "≋"; -const apos$1 = "'"; -const approx$1 = "≈"; -const approxeq$1 = "≊"; -const arin$1 = "å"; -const aring$1 = "å"; -const ascr$1 = "𝒶"; -const ast$1 = "*"; -const asymp$1 = "≈"; -const asympeq$1 = "≍"; -const atild$1 = "ã"; -const atilde$1 = "ã"; -const aum$1 = "ä"; -const auml$1 = "ä"; -const awconint$1 = "∳"; -const awint$1 = "⨑"; -const bNot$1 = "⫭"; -const backcong$1 = "≌"; -const backepsilon$1 = "϶"; -const backprime$1 = "‵"; -const backsim$1 = "∽"; -const backsimeq$1 = "⋍"; -const barvee$1 = "⊽"; -const barwed$1 = "⌅"; -const barwedge$1 = "⌅"; -const bbrk$1 = "⎵"; -const bbrktbrk$1 = "⎶"; -const bcong$1 = "≌"; -const bcy$1 = "б"; -const bdquo$1 = "„"; -const becaus$1 = "∵"; -const because$1 = "∵"; -const bemptyv$1 = "⦰"; -const bepsi$1 = "϶"; -const bernou$1 = "ℬ"; -const beta$1 = "β"; -const beth$1 = "ℶ"; -const between$1 = "≬"; -const bfr$1 = "𝔟"; -const bigcap$1 = "⋂"; -const bigcirc$1 = "◯"; -const bigcup$1 = "⋃"; -const bigodot$1 = "⨀"; -const bigoplus$1 = "⨁"; -const bigotimes$1 = "⨂"; -const bigsqcup$1 = "⨆"; -const bigstar$1 = "★"; -const bigtriangledown$1 = "▽"; -const bigtriangleup$1 = "△"; -const biguplus$1 = "⨄"; -const bigvee$1 = "⋁"; -const bigwedge$1 = "⋀"; -const bkarow$1 = "⤍"; -const blacklozenge$1 = "⧫"; -const blacksquare$1 = "▪"; -const blacktriangle$1 = "▴"; -const blacktriangledown$1 = "▾"; -const blacktriangleleft$1 = "◂"; -const blacktriangleright$1 = "▸"; -const blank$1 = "␣"; -const blk12$1 = "▒"; -const blk14$1 = "░"; -const blk34$1 = "▓"; -const block$1 = "█"; -const bne$1 = "=⃥"; -const bnequiv$1 = "≡⃥"; -const bnot$1 = "⌐"; -const bopf$1 = "𝕓"; -const bot$1 = "⊥"; -const bottom$1 = "⊥"; -const bowtie$1 = "⋈"; -const boxDL$1 = "╗"; -const boxDR$1 = "╔"; -const boxDl$1 = "╖"; -const boxDr$1 = "╓"; -const boxH$1 = "═"; -const boxHD$1 = "╦"; -const boxHU$1 = "╩"; -const boxHd$1 = "╤"; -const boxHu$1 = "╧"; -const boxUL$1 = "╝"; -const boxUR$1 = "╚"; -const boxUl$1 = "╜"; -const boxUr$1 = "╙"; -const boxV$1 = "║"; -const boxVH$1 = "╬"; -const boxVL$1 = "╣"; -const boxVR$1 = "╠"; -const boxVh$1 = "╫"; -const boxVl$1 = "╢"; -const boxVr$1 = "╟"; -const boxbox$1 = "⧉"; -const boxdL$1 = "╕"; -const boxdR$1 = "╒"; -const boxdl$1 = "┐"; -const boxdr$1 = "┌"; -const boxh$1 = "─"; -const boxhD$1 = "╥"; -const boxhU$1 = "╨"; -const boxhd$1 = "┬"; -const boxhu$1 = "┴"; -const boxminus$1 = "⊟"; -const boxplus$1 = "⊞"; -const boxtimes$1 = "⊠"; -const boxuL$1 = "╛"; -const boxuR$1 = "╘"; -const boxul$1 = "┘"; -const boxur$1 = "└"; -const boxv$1 = "│"; -const boxvH$1 = "╪"; -const boxvL$1 = "╡"; -const boxvR$1 = "╞"; -const boxvh$1 = "┼"; -const boxvl$1 = "┤"; -const boxvr$1 = "├"; -const bprime$1 = "‵"; -const breve$1 = "˘"; -const brvba$1 = "¦"; -const brvbar$1 = "¦"; -const bscr$1 = "𝒷"; -const bsemi$1 = "⁏"; -const bsim$1 = "∽"; -const bsime$1 = "⋍"; -const bsol$1 = "\\"; -const bsolb$1 = "⧅"; -const bsolhsub$1 = "⟈"; -const bull$1 = "•"; -const bullet$1 = "•"; -const bump$1 = "≎"; -const bumpE$1 = "⪮"; -const bumpe$1 = "≏"; -const bumpeq$1 = "≏"; -const cacute$1 = "ć"; -const cap$1 = "∩"; -const capand$1 = "⩄"; -const capbrcup$1 = "⩉"; -const capcap$1 = "⩋"; -const capcup$1 = "⩇"; -const capdot$1 = "⩀"; -const caps$1 = "∩︀"; -const caret$1 = "⁁"; -const caron$1 = "ˇ"; -const ccaps$1 = "⩍"; -const ccaron$1 = "č"; -const ccedi$1 = "ç"; -const ccedil$1 = "ç"; -const ccirc$1 = "ĉ"; -const ccups$1 = "⩌"; -const ccupssm$1 = "⩐"; -const cdot$1 = "ċ"; -const cedi$1 = "¸"; -const cedil$1 = "¸"; -const cemptyv$1 = "⦲"; -const cen$1 = "¢"; -const cent$1 = "¢"; -const centerdot$1 = "·"; -const cfr$1 = "𝔠"; -const chcy$1 = "ч"; -const check$2 = "✓"; -const checkmark$1 = "✓"; -const chi$1 = "χ"; -const cir$1 = "○"; -const cirE$1 = "⧃"; -const circ$1 = "ˆ"; -const circeq$1 = "≗"; -const circlearrowleft$1 = "↺"; -const circlearrowright$1 = "↻"; -const circledR$1 = "®"; -const circledS$1 = "Ⓢ"; -const circledast$1 = "⊛"; -const circledcirc$1 = "⊚"; -const circleddash$1 = "⊝"; -const cire$1 = "≗"; -const cirfnint$1 = "⨐"; -const cirmid$1 = "⫯"; -const cirscir$1 = "⧂"; -const clubs$1 = "♣"; -const clubsuit$1 = "♣"; -const colon$1 = ":"; -const colone$1 = "≔"; -const coloneq$1 = "≔"; -const comma$1 = ","; -const commat$1 = "@"; -const comp$1 = "∁"; -const compfn$1 = "∘"; -const complement$1 = "∁"; -const complexes$1 = "ℂ"; -const cong$1 = "≅"; -const congdot$1 = "⩭"; -const conint$1 = "∮"; -const copf$1 = "𝕔"; -const coprod$1 = "∐"; -const cop$1 = "©"; -const copy$1 = "©"; -const copysr$1 = "℗"; -const crarr$1 = "↵"; -const cross$1 = "✗"; -const cscr$1 = "𝒸"; -const csub$1 = "⫏"; -const csube$1 = "⫑"; -const csup$1 = "⫐"; -const csupe$1 = "⫒"; -const ctdot$1 = "⋯"; -const cudarrl$1 = "⤸"; -const cudarrr$1 = "⤵"; -const cuepr$1 = "⋞"; -const cuesc$1 = "⋟"; -const cularr$1 = "↶"; -const cularrp$1 = "⤽"; -const cup$1 = "∪"; -const cupbrcap$1 = "⩈"; -const cupcap$1 = "⩆"; -const cupcup$1 = "⩊"; -const cupdot$1 = "⊍"; -const cupor$1 = "⩅"; -const cups$1 = "∪︀"; -const curarr$1 = "↷"; -const curarrm$1 = "⤼"; -const curlyeqprec$1 = "⋞"; -const curlyeqsucc$1 = "⋟"; -const curlyvee$1 = "⋎"; -const curlywedge$1 = "⋏"; -const curre$1 = "¤"; -const curren$1 = "¤"; -const curvearrowleft$1 = "↶"; -const curvearrowright$1 = "↷"; -const cuvee$1 = "⋎"; -const cuwed$1 = "⋏"; -const cwconint$1 = "∲"; -const cwint$1 = "∱"; -const cylcty$1 = "⌭"; -const dArr$1 = "⇓"; -const dHar$1 = "⥥"; -const dagger$1 = "†"; -const daleth$1 = "ℸ"; -const darr$1 = "↓"; -const dash$1 = "‐"; -const dashv$1 = "⊣"; -const dbkarow$1 = "⤏"; -const dblac$1 = "˝"; -const dcaron$1 = "ď"; -const dcy$1 = "д"; -const dd$1 = "ⅆ"; -const ddagger$1 = "‡"; -const ddarr$1 = "⇊"; -const ddotseq$1 = "⩷"; -const de$1 = "°"; -const deg$1 = "°"; -const delta$1 = "δ"; -const demptyv$1 = "⦱"; -const dfisht$1 = "⥿"; -const dfr$1 = "𝔡"; -const dharl$1 = "⇃"; -const dharr$1 = "⇂"; -const diam$1 = "⋄"; -const diamond$1 = "⋄"; -const diamondsuit$1 = "♦"; -const diams$1 = "♦"; -const die$1 = "¨"; -const digamma$1 = "ϝ"; -const disin$1 = "⋲"; -const div$1 = "÷"; -const divid$1 = "÷"; -const divide$1 = "÷"; -const divideontimes$1 = "⋇"; -const divonx$1 = "⋇"; -const djcy$1 = "ђ"; -const dlcorn$1 = "⌞"; -const dlcrop$1 = "⌍"; -const dollar$1 = "$"; -const dopf$1 = "𝕕"; -const dot$1 = "˙"; -const doteq$1 = "≐"; -const doteqdot$1 = "≑"; -const dotminus$1 = "∸"; -const dotplus$1 = "∔"; -const dotsquare$1 = "⊡"; -const doublebarwedge$1 = "⌆"; -const downarrow$1 = "↓"; -const downdownarrows$1 = "⇊"; -const downharpoonleft$1 = "⇃"; -const downharpoonright$1 = "⇂"; -const drbkarow$1 = "⤐"; -const drcorn$1 = "⌟"; -const drcrop$1 = "⌌"; -const dscr$1 = "𝒹"; -const dscy$1 = "ѕ"; -const dsol$1 = "⧶"; -const dstrok$1 = "đ"; -const dtdot$1 = "⋱"; -const dtri$1 = "▿"; -const dtrif$1 = "▾"; -const duarr$1 = "⇵"; -const duhar$1 = "⥯"; -const dwangle$1 = "⦦"; -const dzcy$1 = "џ"; -const dzigrarr$1 = "⟿"; -const eDDot$1 = "⩷"; -const eDot$1 = "≑"; -const eacut$1 = "é"; -const eacute$1 = "é"; -const easter$1 = "⩮"; -const ecaron$1 = "ě"; -const ecir$1 = "ê"; -const ecirc$1 = "ê"; -const ecolon$1 = "≕"; -const ecy$1 = "э"; -const edot$1 = "ė"; -const ee$1 = "ⅇ"; -const efDot$1 = "≒"; -const efr$1 = "𝔢"; -const eg$1 = "⪚"; -const egrav$1 = "è"; -const egrave$1 = "è"; -const egs$1 = "⪖"; -const egsdot$1 = "⪘"; -const el$1 = "⪙"; -const elinters$1 = "⏧"; -const ell$1 = "ℓ"; -const els$1 = "⪕"; -const elsdot$1 = "⪗"; -const emacr$1 = "ē"; -const empty$1 = "∅"; -const emptyset$1 = "∅"; -const emptyv$1 = "∅"; -const emsp13$1 = " "; -const emsp14$1 = " "; -const emsp$1 = " "; -const eng$1 = "ŋ"; -const ensp$1 = " "; -const eogon$1 = "ę"; -const eopf$1 = "𝕖"; -const epar$1 = "⋕"; -const eparsl$1 = "⧣"; -const eplus$1 = "⩱"; -const epsi$1 = "ε"; -const epsilon$1 = "ε"; -const epsiv$1 = "ϵ"; -const eqcirc$1 = "≖"; -const eqcolon$1 = "≕"; -const eqsim$1 = "≂"; -const eqslantgtr$1 = "⪖"; -const eqslantless$1 = "⪕"; -const equals$1 = "="; -const equest$1 = "≟"; -const equiv$1 = "≡"; -const equivDD$1 = "⩸"; -const eqvparsl$1 = "⧥"; -const erDot$1 = "≓"; -const erarr$1 = "⥱"; -const escr$1 = "ℯ"; -const esdot$1 = "≐"; -const esim$1 = "≂"; -const eta$1 = "η"; -const et$1 = "ð"; -const eth$1 = "ð"; -const eum$1 = "ë"; -const euml$1 = "ë"; -const euro$1 = "€"; -const excl$1 = "!"; -const exist$1 = "∃"; -const expectation$1 = "ℰ"; -const exponentiale$1 = "ⅇ"; -const fallingdotseq$1 = "≒"; -const fcy$1 = "ф"; -const female$1 = "♀"; -const ffilig$1 = "ffi"; -const fflig$1 = "ff"; -const ffllig$1 = "ffl"; -const ffr$1 = "𝔣"; -const filig$1 = "fi"; -const fjlig$1 = "fj"; -const flat$1 = "♭"; -const fllig$1 = "fl"; -const fltns$1 = "▱"; -const fnof$1 = "ƒ"; -const fopf$1 = "𝕗"; -const forall$1 = "∀"; -const fork$1 = "⋔"; -const forkv$1 = "⫙"; -const fpartint$1 = "⨍"; -const frac1$1 = "¼"; -const frac12$1 = "½"; -const frac13$1 = "⅓"; -const frac14$1 = "¼"; -const frac15$1 = "⅕"; -const frac16$1 = "⅙"; -const frac18$1 = "⅛"; -const frac23$1 = "⅔"; -const frac25$1 = "⅖"; -const frac3$1 = "¾"; -const frac34$1 = "¾"; -const frac35$1 = "⅗"; -const frac38$1 = "⅜"; -const frac45$1 = "⅘"; -const frac56$1 = "⅚"; -const frac58$1 = "⅝"; -const frac78$1 = "⅞"; -const frasl$1 = "⁄"; -const frown$1 = "⌢"; -const fscr$1 = "𝒻"; -const gE$1 = "≧"; -const gEl$1 = "⪌"; -const gacute$1 = "ǵ"; -const gamma$1 = "γ"; -const gammad$1 = "ϝ"; -const gap$1 = "⪆"; -const gbreve$1 = "ğ"; -const gcirc$1 = "ĝ"; -const gcy$1 = "г"; -const gdot$1 = "ġ"; -const ge$1 = "≥"; -const gel$1 = "⋛"; -const geq$1 = "≥"; -const geqq$1 = "≧"; -const geqslant$1 = "⩾"; -const ges$1 = "⩾"; -const gescc$1 = "⪩"; -const gesdot$1 = "⪀"; -const gesdoto$1 = "⪂"; -const gesdotol$1 = "⪄"; -const gesl$1 = "⋛︀"; -const gesles$1 = "⪔"; -const gfr$1 = "𝔤"; -const gg$1 = "≫"; -const ggg$1 = "⋙"; -const gimel$1 = "ℷ"; -const gjcy$1 = "ѓ"; -const gl$1 = "≷"; -const glE$1 = "⪒"; -const gla$1 = "⪥"; -const glj$1 = "⪤"; -const gnE$1 = "≩"; -const gnap$1 = "⪊"; -const gnapprox$1 = "⪊"; -const gne$1 = "⪈"; -const gneq$1 = "⪈"; -const gneqq$1 = "≩"; -const gnsim$1 = "⋧"; -const gopf$1 = "𝕘"; -const grave$1 = "`"; -const gscr$1 = "ℊ"; -const gsim$1 = "≳"; -const gsime$1 = "⪎"; -const gsiml$1 = "⪐"; -const g$1 = ">"; -const gt$1 = ">"; -const gtcc$1 = "⪧"; -const gtcir$1 = "⩺"; -const gtdot$1 = "⋗"; -const gtlPar$1 = "⦕"; -const gtquest$1 = "⩼"; -const gtrapprox$1 = "⪆"; -const gtrarr$1 = "⥸"; -const gtrdot$1 = "⋗"; -const gtreqless$1 = "⋛"; -const gtreqqless$1 = "⪌"; -const gtrless$1 = "≷"; -const gtrsim$1 = "≳"; -const gvertneqq$1 = "≩︀"; -const gvnE$1 = "≩︀"; -const hArr$1 = "⇔"; -const hairsp$1 = " "; -const half$1 = "½"; -const hamilt$1 = "ℋ"; -const hardcy$1 = "ъ"; -const harr$1 = "↔"; -const harrcir$1 = "⥈"; -const harrw$1 = "↭"; -const hbar$1 = "ℏ"; -const hcirc$1 = "ĥ"; -const hearts$1 = "♥"; -const heartsuit$1 = "♥"; -const hellip$1 = "…"; -const hercon$1 = "⊹"; -const hfr$1 = "𝔥"; -const hksearow$1 = "⤥"; -const hkswarow$1 = "⤦"; -const hoarr$1 = "⇿"; -const homtht$1 = "∻"; -const hookleftarrow$1 = "↩"; -const hookrightarrow$1 = "↪"; -const hopf$1 = "𝕙"; -const horbar$1 = "―"; -const hscr$1 = "𝒽"; -const hslash$1 = "ℏ"; -const hstrok$1 = "ħ"; -const hybull$1 = "⁃"; -const hyphen$1 = "‐"; -const iacut$1 = "í"; -const iacute$1 = "í"; -const ic$1 = ""; -const icir$1 = "î"; -const icirc$1 = "î"; -const icy$1 = "и"; -const iecy$1 = "е"; -const iexc$1 = "¡"; -const iexcl$1 = "¡"; -const iff$1 = "⇔"; -const ifr$1 = "𝔦"; -const igrav$1 = "ì"; -const igrave$1 = "ì"; -const ii$1 = "ⅈ"; -const iiiint$1 = "⨌"; -const iiint$1 = "∭"; -const iinfin$1 = "⧜"; -const iiota$1 = "℩"; -const ijlig$1 = "ij"; -const imacr$1 = "ī"; -const image$2 = "ℑ"; -const imagline$1 = "ℐ"; -const imagpart$1 = "ℑ"; -const imath$1 = "ı"; -const imof$1 = "⊷"; -const imped$1 = "Ƶ"; -const incare$1 = "℅"; -const infin$1 = "∞"; -const infintie$1 = "⧝"; -const inodot$1 = "ı"; -const int$2 = "∫"; -const intcal$1 = "⊺"; -const integers$1 = "ℤ"; -const intercal$1 = "⊺"; -const intlarhk$1 = "⨗"; -const intprod$1 = "⨼"; -const iocy$1 = "ё"; -const iogon$1 = "į"; -const iopf$1 = "𝕚"; -const iota$1 = "ι"; -const iprod$1 = "⨼"; -const iques$1 = "¿"; -const iquest$1 = "¿"; -const iscr$1 = "𝒾"; -const isin$1 = "∈"; -const isinE$1 = "⋹"; -const isindot$1 = "⋵"; -const isins$1 = "⋴"; -const isinsv$1 = "⋳"; -const isinv$1 = "∈"; -const it$1 = ""; -const itilde$1 = "ĩ"; -const iukcy$1 = "і"; -const ium$1 = "ï"; -const iuml$1 = "ï"; -const jcirc$1 = "ĵ"; -const jcy$1 = "й"; -const jfr$1 = "𝔧"; -const jmath$1 = "ȷ"; -const jopf$1 = "𝕛"; -const jscr$1 = "𝒿"; -const jsercy$1 = "ј"; -const jukcy$1 = "є"; -const kappa$1 = "κ"; -const kappav$1 = "ϰ"; -const kcedil$1 = "ķ"; -const kcy$1 = "к"; -const kfr$1 = "𝔨"; -const kgreen$1 = "ĸ"; -const khcy$1 = "х"; -const kjcy$1 = "ќ"; -const kopf$1 = "𝕜"; -const kscr$1 = "𝓀"; -const lAarr$1 = "⇚"; -const lArr$1 = "⇐"; -const lAtail$1 = "⤛"; -const lBarr$1 = "⤎"; -const lE$1 = "≦"; -const lEg$1 = "⪋"; -const lHar$1 = "⥢"; -const lacute$1 = "ĺ"; -const laemptyv$1 = "⦴"; -const lagran$1 = "ℒ"; -const lambda$1 = "λ"; -const lang$1 = "⟨"; -const langd$1 = "⦑"; -const langle$1 = "⟨"; -const lap$1 = "⪅"; -const laqu$1 = "«"; -const laquo$1 = "«"; -const larr$1 = "←"; -const larrb$1 = "⇤"; -const larrbfs$1 = "⤟"; -const larrfs$1 = "⤝"; -const larrhk$1 = "↩"; -const larrlp$1 = "↫"; -const larrpl$1 = "⤹"; -const larrsim$1 = "⥳"; -const larrtl$1 = "↢"; -const lat$1 = "⪫"; -const latail$1 = "⤙"; -const late$1 = "⪭"; -const lates$1 = "⪭︀"; -const lbarr$1 = "⤌"; -const lbbrk$1 = "❲"; -const lbrace$1 = "{"; -const lbrack$1 = "["; -const lbrke$1 = "⦋"; -const lbrksld$1 = "⦏"; -const lbrkslu$1 = "⦍"; -const lcaron$1 = "ľ"; -const lcedil$1 = "ļ"; -const lceil$1 = "⌈"; -const lcub$1 = "{"; -const lcy$1 = "л"; -const ldca$1 = "⤶"; -const ldquo$1 = "“"; -const ldquor$1 = "„"; -const ldrdhar$1 = "⥧"; -const ldrushar$1 = "⥋"; -const ldsh$1 = "↲"; -const le$1 = "≤"; -const leftarrow$1 = "←"; -const leftarrowtail$1 = "↢"; -const leftharpoondown$1 = "↽"; -const leftharpoonup$1 = "↼"; -const leftleftarrows$1 = "⇇"; -const leftrightarrow$1 = "↔"; -const leftrightarrows$1 = "⇆"; -const leftrightharpoons$1 = "⇋"; -const leftrightsquigarrow$1 = "↭"; -const leftthreetimes$1 = "⋋"; -const leg$1 = "⋚"; -const leq$1 = "≤"; -const leqq$1 = "≦"; -const leqslant$1 = "⩽"; -const les$1 = "⩽"; -const lescc$1 = "⪨"; -const lesdot$1 = "⩿"; -const lesdoto$1 = "⪁"; -const lesdotor$1 = "⪃"; -const lesg$1 = "⋚︀"; -const lesges$1 = "⪓"; -const lessapprox$1 = "⪅"; -const lessdot$1 = "⋖"; -const lesseqgtr$1 = "⋚"; -const lesseqqgtr$1 = "⪋"; -const lessgtr$1 = "≶"; -const lesssim$1 = "≲"; -const lfisht$1 = "⥼"; -const lfloor$1 = "⌊"; -const lfr$1 = "𝔩"; -const lg$1 = "≶"; -const lgE$1 = "⪑"; -const lhard$1 = "↽"; -const lharu$1 = "↼"; -const lharul$1 = "⥪"; -const lhblk$1 = "▄"; -const ljcy$1 = "љ"; -const ll$1 = "≪"; -const llarr$1 = "⇇"; -const llcorner$1 = "⌞"; -const llhard$1 = "⥫"; -const lltri$1 = "◺"; -const lmidot$1 = "ŀ"; -const lmoust$1 = "⎰"; -const lmoustache$1 = "⎰"; -const lnE$1 = "≨"; -const lnap$1 = "⪉"; -const lnapprox$1 = "⪉"; -const lne$1 = "⪇"; -const lneq$1 = "⪇"; -const lneqq$1 = "≨"; -const lnsim$1 = "⋦"; -const loang$1 = "⟬"; -const loarr$1 = "⇽"; -const lobrk$1 = "⟦"; -const longleftarrow$1 = "⟵"; -const longleftrightarrow$1 = "⟷"; -const longmapsto$1 = "⟼"; -const longrightarrow$1 = "⟶"; -const looparrowleft$1 = "↫"; -const looparrowright$1 = "↬"; -const lopar$1 = "⦅"; -const lopf$1 = "𝕝"; -const loplus$1 = "⨭"; -const lotimes$1 = "⨴"; -const lowast$1 = "∗"; -const lowbar$1 = "_"; -const loz$1 = "◊"; -const lozenge$1 = "◊"; -const lozf$1 = "⧫"; -const lpar$1 = "("; -const lparlt$1 = "⦓"; -const lrarr$1 = "⇆"; -const lrcorner$1 = "⌟"; -const lrhar$1 = "⇋"; -const lrhard$1 = "⥭"; -const lrm$1 = ""; -const lrtri$1 = "⊿"; -const lsaquo$1 = "‹"; -const lscr$1 = "𝓁"; -const lsh$1 = "↰"; -const lsim$1 = "≲"; -const lsime$1 = "⪍"; -const lsimg$1 = "⪏"; -const lsqb$1 = "["; -const lsquo$1 = "‘"; -const lsquor$1 = "‚"; -const lstrok$1 = "ł"; -const l$1 = "<"; -const lt$2 = "<"; -const ltcc$1 = "⪦"; -const ltcir$1 = "⩹"; -const ltdot$1 = "⋖"; -const lthree$1 = "⋋"; -const ltimes$1 = "⋉"; -const ltlarr$1 = "⥶"; -const ltquest$1 = "⩻"; -const ltrPar$1 = "⦖"; -const ltri$1 = "◃"; -const ltrie$1 = "⊴"; -const ltrif$1 = "◂"; -const lurdshar$1 = "⥊"; -const luruhar$1 = "⥦"; -const lvertneqq$1 = "≨︀"; -const lvnE$1 = "≨︀"; -const mDDot$1 = "∺"; -const mac$1 = "¯"; -const macr$1 = "¯"; -const male$1 = "♂"; -const malt$1 = "✠"; -const maltese$1 = "✠"; -const map$4 = "↦"; -const mapsto$1 = "↦"; -const mapstodown$1 = "↧"; -const mapstoleft$1 = "↤"; -const mapstoup$1 = "↥"; -const marker$1 = "▮"; -const mcomma$1 = "⨩"; -const mcy$1 = "м"; -const mdash$1 = "—"; -const measuredangle$1 = "∡"; -const mfr$1 = "𝔪"; -const mho$1 = "℧"; -const micr$1 = "µ"; -const micro$1 = "µ"; -const mid$1 = "∣"; -const midast$1 = "*"; -const midcir$1 = "⫰"; -const middo$1 = "·"; -const middot$1 = "·"; -const minus$1 = "−"; -const minusb$1 = "⊟"; -const minusd$1 = "∸"; -const minusdu$1 = "⨪"; -const mlcp$1 = "⫛"; -const mldr$1 = "…"; -const mnplus$1 = "∓"; -const models$1 = "⊧"; -const mopf$1 = "𝕞"; -const mp$1 = "∓"; -const mscr$1 = "𝓂"; -const mstpos$1 = "∾"; -const mu$1 = "μ"; -const multimap$1 = "⊸"; -const mumap$1 = "⊸"; -const nGg$1 = "⋙̸"; -const nGt$1 = "≫⃒"; -const nGtv$1 = "≫̸"; -const nLeftarrow$1 = "⇍"; -const nLeftrightarrow$1 = "⇎"; -const nLl$1 = "⋘̸"; -const nLt$1 = "≪⃒"; -const nLtv$1 = "≪̸"; -const nRightarrow$1 = "⇏"; -const nVDash$1 = "⊯"; -const nVdash$1 = "⊮"; -const nabla$1 = "∇"; -const nacute$1 = "ń"; -const nang$1 = "∠⃒"; -const nap$1 = "≉"; -const napE$1 = "⩰̸"; -const napid$1 = "≋̸"; -const napos$1 = "ʼn"; -const napprox$1 = "≉"; -const natur$1 = "♮"; -const natural$1 = "♮"; -const naturals$1 = "ℕ"; -const nbs$1 = " "; -const nbsp$1 = " "; -const nbump$1 = "≎̸"; -const nbumpe$1 = "≏̸"; -const ncap$1 = "⩃"; -const ncaron$1 = "ň"; -const ncedil$1 = "ņ"; -const ncong$1 = "≇"; -const ncongdot$1 = "⩭̸"; -const ncup$1 = "⩂"; -const ncy$1 = "н"; -const ndash$1 = "–"; -const ne$1 = "≠"; -const neArr$1 = "⇗"; -const nearhk$1 = "⤤"; -const nearr$1 = "↗"; -const nearrow$1 = "↗"; -const nedot$1 = "≐̸"; -const nequiv$1 = "≢"; -const nesear$1 = "⤨"; -const nesim$1 = "≂̸"; -const nexist$1 = "∄"; -const nexists$1 = "∄"; -const nfr$1 = "𝔫"; -const ngE$1 = "≧̸"; -const nge$1 = "≱"; -const ngeq$1 = "≱"; -const ngeqq$1 = "≧̸"; -const ngeqslant$1 = "⩾̸"; -const nges$1 = "⩾̸"; -const ngsim$1 = "≵"; -const ngt$1 = "≯"; -const ngtr$1 = "≯"; -const nhArr$1 = "⇎"; -const nharr$1 = "↮"; -const nhpar$1 = "⫲"; -const ni$1 = "∋"; -const nis$1 = "⋼"; -const nisd$1 = "⋺"; -const niv$1 = "∋"; -const njcy$1 = "њ"; -const nlArr$1 = "⇍"; -const nlE$1 = "≦̸"; -const nlarr$1 = "↚"; -const nldr$1 = "‥"; -const nle$1 = "≰"; -const nleftarrow$1 = "↚"; -const nleftrightarrow$1 = "↮"; -const nleq$1 = "≰"; -const nleqq$1 = "≦̸"; -const nleqslant$1 = "⩽̸"; -const nles$1 = "⩽̸"; -const nless$1 = "≮"; -const nlsim$1 = "≴"; -const nlt$1 = "≮"; -const nltri$1 = "⋪"; -const nltrie$1 = "⋬"; -const nmid$1 = "∤"; -const nopf$1 = "𝕟"; -const no$1 = "¬"; -const not$1 = "¬"; -const notin$1 = "∉"; -const notinE$1 = "⋹̸"; -const notindot$1 = "⋵̸"; -const notinva$1 = "∉"; -const notinvb$1 = "⋷"; -const notinvc$1 = "⋶"; -const notni$1 = "∌"; -const notniva$1 = "∌"; -const notnivb$1 = "⋾"; -const notnivc$1 = "⋽"; -const npar$1 = "∦"; -const nparallel$1 = "∦"; -const nparsl$1 = "⫽⃥"; -const npart$1 = "∂̸"; -const npolint$1 = "⨔"; -const npr$1 = "⊀"; -const nprcue$1 = "⋠"; -const npre$1 = "⪯̸"; -const nprec$1 = "⊀"; -const npreceq$1 = "⪯̸"; -const nrArr$1 = "⇏"; -const nrarr$1 = "↛"; -const nrarrc$1 = "⤳̸"; -const nrarrw$1 = "↝̸"; -const nrightarrow$1 = "↛"; -const nrtri$1 = "⋫"; -const nrtrie$1 = "⋭"; -const nsc$1 = "⊁"; -const nsccue$1 = "⋡"; -const nsce$1 = "⪰̸"; -const nscr$1 = "𝓃"; -const nshortmid$1 = "∤"; -const nshortparallel$1 = "∦"; -const nsim$1 = "≁"; -const nsime$1 = "≄"; -const nsimeq$1 = "≄"; -const nsmid$1 = "∤"; -const nspar$1 = "∦"; -const nsqsube$1 = "⋢"; -const nsqsupe$1 = "⋣"; -const nsub$1 = "⊄"; -const nsubE$1 = "⫅̸"; -const nsube$1 = "⊈"; -const nsubset$1 = "⊂⃒"; -const nsubseteq$1 = "⊈"; -const nsubseteqq$1 = "⫅̸"; -const nsucc$1 = "⊁"; -const nsucceq$1 = "⪰̸"; -const nsup$1 = "⊅"; -const nsupE$1 = "⫆̸"; -const nsupe$1 = "⊉"; -const nsupset$1 = "⊃⃒"; -const nsupseteq$1 = "⊉"; -const nsupseteqq$1 = "⫆̸"; -const ntgl$1 = "≹"; -const ntild$1 = "ñ"; -const ntilde$1 = "ñ"; -const ntlg$1 = "≸"; -const ntriangleleft$1 = "⋪"; -const ntrianglelefteq$1 = "⋬"; -const ntriangleright$1 = "⋫"; -const ntrianglerighteq$1 = "⋭"; -const nu$1 = "ν"; -const num$1 = "#"; -const numero$1 = "№"; -const numsp$1 = " "; -const nvDash$1 = "⊭"; -const nvHarr$1 = "⤄"; -const nvap$1 = "≍⃒"; -const nvdash$1 = "⊬"; -const nvge$1 = "≥⃒"; -const nvgt$1 = ">⃒"; -const nvinfin$1 = "⧞"; -const nvlArr$1 = "⤂"; -const nvle$1 = "≤⃒"; -const nvlt$1 = "<⃒"; -const nvltrie$1 = "⊴⃒"; -const nvrArr$1 = "⤃"; -const nvrtrie$1 = "⊵⃒"; -const nvsim$1 = "∼⃒"; -const nwArr$1 = "⇖"; -const nwarhk$1 = "⤣"; -const nwarr$1 = "↖"; -const nwarrow$1 = "↖"; -const nwnear$1 = "⤧"; -const oS$1 = "Ⓢ"; -const oacut$1 = "ó"; -const oacute$1 = "ó"; -const oast$1 = "⊛"; -const ocir$1 = "ô"; -const ocirc$1 = "ô"; -const ocy$1 = "о"; -const odash$1 = "⊝"; -const odblac$1 = "ő"; -const odiv$1 = "⨸"; -const odot$1 = "⊙"; -const odsold$1 = "⦼"; -const oelig$1 = "œ"; -const ofcir$1 = "⦿"; -const ofr$1 = "𝔬"; -const ogon$1 = "˛"; -const ograv$1 = "ò"; -const ograve$1 = "ò"; -const ogt$1 = "⧁"; -const ohbar$1 = "⦵"; -const ohm$1 = "Ω"; -const oint$1 = "∮"; -const olarr$1 = "↺"; -const olcir$1 = "⦾"; -const olcross$1 = "⦻"; -const oline$1 = "‾"; -const olt$1 = "⧀"; -const omacr$1 = "ō"; -const omega$1 = "ω"; -const omicron$1 = "ο"; -const omid$1 = "⦶"; -const ominus$1 = "⊖"; -const oopf$1 = "𝕠"; -const opar$1 = "⦷"; -const operp$1 = "⦹"; -const oplus$1 = "⊕"; -const or$1 = "∨"; -const orarr$1 = "↻"; -const ord$1 = "º"; -const order$1 = "ℴ"; -const orderof$1 = "ℴ"; -const ordf$1 = "ª"; -const ordm$1 = "º"; -const origof$1 = "⊶"; -const oror$1 = "⩖"; -const orslope$1 = "⩗"; -const orv$1 = "⩛"; -const oscr$1 = "ℴ"; -const oslas$1 = "ø"; -const oslash$1 = "ø"; -const osol$1 = "⊘"; -const otild$1 = "õ"; -const otilde$1 = "õ"; -const otimes$1 = "⊗"; -const otimesas$1 = "⨶"; -const oum$1 = "ö"; -const ouml$1 = "ö"; -const ovbar$1 = "⌽"; -const par$1 = "¶"; -const para$1 = "¶"; -const parallel$1 = "∥"; -const parsim$1 = "⫳"; -const parsl$1 = "⫽"; -const part$1 = "∂"; -const pcy$1 = "п"; -const percnt$1 = "%"; -const period$1 = "."; -const permil$1 = "‰"; -const perp$1 = "⊥"; -const pertenk$1 = "‱"; -const pfr$1 = "𝔭"; -const phi$1 = "φ"; -const phiv$1 = "ϕ"; -const phmmat$1 = "ℳ"; -const phone$1 = "☎"; -const pi$1 = "π"; -const pitchfork$1 = "⋔"; -const piv$1 = "ϖ"; -const planck$1 = "ℏ"; -const planckh$1 = "ℎ"; -const plankv$1 = "ℏ"; -const plus$1 = "+"; -const plusacir$1 = "⨣"; -const plusb$1 = "⊞"; -const pluscir$1 = "⨢"; -const plusdo$1 = "∔"; -const plusdu$1 = "⨥"; -const pluse$1 = "⩲"; -const plusm$1 = "±"; -const plusmn$1 = "±"; -const plussim$1 = "⨦"; -const plustwo$1 = "⨧"; -const pm$1 = "±"; -const pointint$1 = "⨕"; -const popf$1 = "𝕡"; -const poun$1 = "£"; -const pound$1 = "£"; -const pr$1 = "≺"; -const prE$1 = "⪳"; -const prap$1 = "⪷"; -const prcue$1 = "≼"; -const pre$1 = "⪯"; -const prec$1 = "≺"; -const precapprox$1 = "⪷"; -const preccurlyeq$1 = "≼"; -const preceq$1 = "⪯"; -const precnapprox$1 = "⪹"; -const precneqq$1 = "⪵"; -const precnsim$1 = "⋨"; -const precsim$1 = "≾"; -const prime$1 = "′"; -const primes$1 = "ℙ"; -const prnE$1 = "⪵"; -const prnap$1 = "⪹"; -const prnsim$1 = "⋨"; -const prod$1 = "∏"; -const profalar$1 = "⌮"; -const profline$1 = "⌒"; -const profsurf$1 = "⌓"; -const prop$1 = "∝"; -const propto$1 = "∝"; -const prsim$1 = "≾"; -const prurel$1 = "⊰"; -const pscr$1 = "𝓅"; -const psi$1 = "ψ"; -const puncsp$1 = " "; -const qfr$1 = "𝔮"; -const qint$1 = "⨌"; -const qopf$1 = "𝕢"; -const qprime$1 = "⁗"; -const qscr$1 = "𝓆"; -const quaternions$1 = "ℍ"; -const quatint$1 = "⨖"; -const quest$1 = "?"; -const questeq$1 = "≟"; -const quo$1 = "\""; -const quot$1 = "\""; -const rAarr$1 = "⇛"; -const rArr$1 = "⇒"; -const rAtail$1 = "⤜"; -const rBarr$1 = "⤏"; -const rHar$1 = "⥤"; -const race$1 = "∽̱"; -const racute$1 = "ŕ"; -const radic$1 = "√"; -const raemptyv$1 = "⦳"; -const rang$1 = "⟩"; -const rangd$1 = "⦒"; -const range$1 = "⦥"; -const rangle$1 = "⟩"; -const raqu$1 = "»"; -const raquo$1 = "»"; -const rarr$1 = "→"; -const rarrap$1 = "⥵"; -const rarrb$1 = "⇥"; -const rarrbfs$1 = "⤠"; -const rarrc$1 = "⤳"; -const rarrfs$1 = "⤞"; -const rarrhk$1 = "↪"; -const rarrlp$1 = "↬"; -const rarrpl$1 = "⥅"; -const rarrsim$1 = "⥴"; -const rarrtl$1 = "↣"; -const rarrw$1 = "↝"; -const ratail$1 = "⤚"; -const ratio$1 = "∶"; -const rationals$1 = "ℚ"; -const rbarr$1 = "⤍"; -const rbbrk$1 = "❳"; -const rbrace$1 = "}"; -const rbrack$1 = "]"; -const rbrke$1 = "⦌"; -const rbrksld$1 = "⦎"; -const rbrkslu$1 = "⦐"; -const rcaron$1 = "ř"; -const rcedil$1 = "ŗ"; -const rceil$1 = "⌉"; -const rcub$1 = "}"; -const rcy$1 = "р"; -const rdca$1 = "⤷"; -const rdldhar$1 = "⥩"; -const rdquo$1 = "”"; -const rdquor$1 = "”"; -const rdsh$1 = "↳"; -const real$1 = "ℜ"; -const realine$1 = "ℛ"; -const realpart$1 = "ℜ"; -const reals$1 = "ℝ"; -const rect$1 = "▭"; -const re$5 = "®"; -const reg$1 = "®"; -const rfisht$1 = "⥽"; -const rfloor$1 = "⌋"; -const rfr$1 = "𝔯"; -const rhard$1 = "⇁"; -const rharu$1 = "⇀"; -const rharul$1 = "⥬"; -const rho$1 = "ρ"; -const rhov$1 = "ϱ"; -const rightarrow$1 = "→"; -const rightarrowtail$1 = "↣"; -const rightharpoondown$1 = "⇁"; -const rightharpoonup$1 = "⇀"; -const rightleftarrows$1 = "⇄"; -const rightleftharpoons$1 = "⇌"; -const rightrightarrows$1 = "⇉"; -const rightsquigarrow$1 = "↝"; -const rightthreetimes$1 = "⋌"; -const ring$1 = "˚"; -const risingdotseq$1 = "≓"; -const rlarr$1 = "⇄"; -const rlhar$1 = "⇌"; -const rlm$1 = ""; -const rmoust$1 = "⎱"; -const rmoustache$1 = "⎱"; -const rnmid$1 = "⫮"; -const roang$1 = "⟭"; -const roarr$1 = "⇾"; -const robrk$1 = "⟧"; -const ropar$1 = "⦆"; -const ropf$1 = "𝕣"; -const roplus$1 = "⨮"; -const rotimes$1 = "⨵"; -const rpar$1 = ")"; -const rpargt$1 = "⦔"; -const rppolint$1 = "⨒"; -const rrarr$1 = "⇉"; -const rsaquo$1 = "›"; -const rscr$1 = "𝓇"; -const rsh$1 = "↱"; -const rsqb$1 = "]"; -const rsquo$1 = "’"; -const rsquor$1 = "’"; -const rthree$1 = "⋌"; -const rtimes$1 = "⋊"; -const rtri$1 = "▹"; -const rtrie$1 = "⊵"; -const rtrif$1 = "▸"; -const rtriltri$1 = "⧎"; -const ruluhar$1 = "⥨"; -const rx$1 = "℞"; -const sacute$1 = "ś"; -const sbquo$1 = "‚"; -const sc$1 = "≻"; -const scE$1 = "⪴"; -const scap$1 = "⪸"; -const scaron$1 = "š"; -const sccue$1 = "≽"; -const sce$1 = "⪰"; -const scedil$1 = "ş"; -const scirc$1 = "ŝ"; -const scnE$1 = "⪶"; -const scnap$1 = "⪺"; -const scnsim$1 = "⋩"; -const scpolint$1 = "⨓"; -const scsim$1 = "≿"; -const scy$1 = "с"; -const sdot$1 = "⋅"; -const sdotb$1 = "⊡"; -const sdote$1 = "⩦"; -const seArr$1 = "⇘"; -const searhk$1 = "⤥"; -const searr$1 = "↘"; -const searrow$1 = "↘"; -const sec$1 = "§"; -const sect$1 = "§"; -const semi$1 = ";"; -const seswar$1 = "⤩"; -const setminus$1 = "∖"; -const setmn$1 = "∖"; -const sext$1 = "✶"; -const sfr$1 = "𝔰"; -const sfrown$1 = "⌢"; -const sharp$1 = "♯"; -const shchcy$1 = "щ"; -const shcy$1 = "ш"; -const shortmid$1 = "∣"; -const shortparallel$1 = "∥"; -const sh$1 = ""; -const shy$1 = ""; -const sigma$1 = "σ"; -const sigmaf$1 = "ς"; -const sigmav$1 = "ς"; -const sim$1 = "∼"; -const simdot$1 = "⩪"; -const sime$1 = "≃"; -const simeq$1 = "≃"; -const simg$1 = "⪞"; -const simgE$1 = "⪠"; -const siml$1 = "⪝"; -const simlE$1 = "⪟"; -const simne$1 = "≆"; -const simplus$1 = "⨤"; -const simrarr$1 = "⥲"; -const slarr$1 = "←"; -const smallsetminus$1 = "∖"; -const smashp$1 = "⨳"; -const smeparsl$1 = "⧤"; -const smid$1 = "∣"; -const smile$1 = "⌣"; -const smt$1 = "⪪"; -const smte$1 = "⪬"; -const smtes$1 = "⪬︀"; -const softcy$1 = "ь"; -const sol$1 = "/"; -const solb$1 = "⧄"; -const solbar$1 = "⌿"; -const sopf$1 = "𝕤"; -const spades$1 = "♠"; -const spadesuit$1 = "♠"; -const spar$1 = "∥"; -const sqcap$1 = "⊓"; -const sqcaps$1 = "⊓︀"; -const sqcup$1 = "⊔"; -const sqcups$1 = "⊔︀"; -const sqsub$1 = "⊏"; -const sqsube$1 = "⊑"; -const sqsubset$1 = "⊏"; -const sqsubseteq$1 = "⊑"; -const sqsup$1 = "⊐"; -const sqsupe$1 = "⊒"; -const sqsupset$1 = "⊐"; -const sqsupseteq$1 = "⊒"; -const squ$1 = "□"; -const square$1 = "□"; -const squarf$1 = "▪"; -const squf$1 = "▪"; -const srarr$1 = "→"; -const sscr$1 = "𝓈"; -const ssetmn$1 = "∖"; -const ssmile$1 = "⌣"; -const sstarf$1 = "⋆"; -const star$1 = "☆"; -const starf$1 = "★"; -const straightepsilon$1 = "ϵ"; -const straightphi$1 = "ϕ"; -const strns$1 = "¯"; -const sub$1 = "⊂"; -const subE$1 = "⫅"; -const subdot$1 = "⪽"; -const sube$1 = "⊆"; -const subedot$1 = "⫃"; -const submult$1 = "⫁"; -const subnE$1 = "⫋"; -const subne$1 = "⊊"; -const subplus$1 = "⪿"; -const subrarr$1 = "⥹"; -const subset$1 = "⊂"; -const subseteq$1 = "⊆"; -const subseteqq$1 = "⫅"; -const subsetneq$1 = "⊊"; -const subsetneqq$1 = "⫋"; -const subsim$1 = "⫇"; -const subsub$1 = "⫕"; -const subsup$1 = "⫓"; -const succ$1 = "≻"; -const succapprox$1 = "⪸"; -const succcurlyeq$1 = "≽"; -const succeq$1 = "⪰"; -const succnapprox$1 = "⪺"; -const succneqq$1 = "⪶"; -const succnsim$1 = "⋩"; -const succsim$1 = "≿"; -const sum$1 = "∑"; -const sung$1 = "♪"; -const sup$1 = "⊃"; -const sup1$1 = "¹"; -const sup2$1 = "²"; -const sup3$1 = "³"; -const supE$1 = "⫆"; -const supdot$1 = "⪾"; -const supdsub$1 = "⫘"; -const supe$1 = "⊇"; -const supedot$1 = "⫄"; -const suphsol$1 = "⟉"; -const suphsub$1 = "⫗"; -const suplarr$1 = "⥻"; -const supmult$1 = "⫂"; -const supnE$1 = "⫌"; -const supne$1 = "⊋"; -const supplus$1 = "⫀"; -const supset$1 = "⊃"; -const supseteq$1 = "⊇"; -const supseteqq$1 = "⫆"; -const supsetneq$1 = "⊋"; -const supsetneqq$1 = "⫌"; -const supsim$1 = "⫈"; -const supsub$1 = "⫔"; -const supsup$1 = "⫖"; -const swArr$1 = "⇙"; -const swarhk$1 = "⤦"; -const swarr$1 = "↙"; -const swarrow$1 = "↙"; -const swnwar$1 = "⤪"; -const szli$1 = "ß"; -const szlig$1 = "ß"; -const target$1 = "⌖"; -const tau$1 = "τ"; -const tbrk$1 = "⎴"; -const tcaron$1 = "ť"; -const tcedil$1 = "ţ"; -const tcy$1 = "т"; -const tdot$1 = "⃛"; -const telrec$1 = "⌕"; -const tfr$1 = "𝔱"; -const there4$1 = "∴"; -const therefore$1 = "∴"; -const theta$1 = "θ"; -const thetasym$1 = "ϑ"; -const thetav$1 = "ϑ"; -const thickapprox$1 = "≈"; -const thicksim$1 = "∼"; -const thinsp$1 = " "; -const thkap$1 = "≈"; -const thksim$1 = "∼"; -const thor$1 = "þ"; -const thorn$1 = "þ"; -const tilde$1 = "˜"; -const time$1 = "×"; -const times$1 = "×"; -const timesb$1 = "⊠"; -const timesbar$1 = "⨱"; -const timesd$1 = "⨰"; -const tint$1 = "∭"; -const toea$1 = "⤨"; -const top$1 = "⊤"; -const topbot$1 = "⌶"; -const topcir$1 = "⫱"; -const topf$1 = "𝕥"; -const topfork$1 = "⫚"; -const tosa$1 = "⤩"; -const tprime$1 = "‴"; -const trade$1 = "™"; -const triangle$1 = "▵"; -const triangledown$1 = "▿"; -const triangleleft$1 = "◃"; -const trianglelefteq$1 = "⊴"; -const triangleq$1 = "≜"; -const triangleright$1 = "▹"; -const trianglerighteq$1 = "⊵"; -const tridot$1 = "◬"; -const trie$1 = "≜"; -const triminus$1 = "⨺"; -const triplus$1 = "⨹"; -const trisb$1 = "⧍"; -const tritime$1 = "⨻"; -const trpezium$1 = "⏢"; -const tscr$1 = "𝓉"; -const tscy$1 = "ц"; -const tshcy$1 = "ћ"; -const tstrok$1 = "ŧ"; -const twixt$1 = "≬"; -const twoheadleftarrow$1 = "↞"; -const twoheadrightarrow$1 = "↠"; -const uArr$1 = "⇑"; -const uHar$1 = "⥣"; -const uacut$1 = "ú"; -const uacute$1 = "ú"; -const uarr$1 = "↑"; -const ubrcy$1 = "ў"; -const ubreve$1 = "ŭ"; -const ucir$1 = "û"; -const ucirc$1 = "û"; -const ucy$1 = "у"; -const udarr$1 = "⇅"; -const udblac$1 = "ű"; -const udhar$1 = "⥮"; -const ufisht$1 = "⥾"; -const ufr$1 = "𝔲"; -const ugrav$1 = "ù"; -const ugrave$1 = "ù"; -const uharl$1 = "↿"; -const uharr$1 = "↾"; -const uhblk$1 = "▀"; -const ulcorn$1 = "⌜"; -const ulcorner$1 = "⌜"; -const ulcrop$1 = "⌏"; -const ultri$1 = "◸"; -const umacr$1 = "ū"; -const um$1 = "¨"; -const uml$1 = "¨"; -const uogon$1 = "ų"; -const uopf$1 = "𝕦"; -const uparrow$1 = "↑"; -const updownarrow$1 = "↕"; -const upharpoonleft$1 = "↿"; -const upharpoonright$1 = "↾"; -const uplus$1 = "⊎"; -const upsi$1 = "υ"; -const upsih$1 = "ϒ"; -const upsilon$1 = "υ"; -const upuparrows$1 = "⇈"; -const urcorn$1 = "⌝"; -const urcorner$1 = "⌝"; -const urcrop$1 = "⌎"; -const uring$1 = "ů"; -const urtri$1 = "◹"; -const uscr$1 = "𝓊"; -const utdot$1 = "⋰"; -const utilde$1 = "ũ"; -const utri$1 = "▵"; -const utrif$1 = "▴"; -const uuarr$1 = "⇈"; -const uum$1 = "ü"; -const uuml$1 = "ü"; -const uwangle$1 = "⦧"; -const vArr$1 = "⇕"; -const vBar$1 = "⫨"; -const vBarv$1 = "⫩"; -const vDash$1 = "⊨"; -const vangrt$1 = "⦜"; -const varepsilon$1 = "ϵ"; -const varkappa$1 = "ϰ"; -const varnothing$1 = "∅"; -const varphi$1 = "ϕ"; -const varpi$1 = "ϖ"; -const varpropto$1 = "∝"; -const varr$1 = "↕"; -const varrho$1 = "ϱ"; -const varsigma$1 = "ς"; -const varsubsetneq$1 = "⊊︀"; -const varsubsetneqq$1 = "⫋︀"; -const varsupsetneq$1 = "⊋︀"; -const varsupsetneqq$1 = "⫌︀"; -const vartheta$1 = "ϑ"; -const vartriangleleft$1 = "⊲"; -const vartriangleright$1 = "⊳"; -const vcy$1 = "в"; -const vdash$1 = "⊢"; -const vee$1 = "∨"; -const veebar$1 = "⊻"; -const veeeq$1 = "≚"; -const vellip$1 = "⋮"; -const verbar$1 = "|"; -const vert$1 = "|"; -const vfr$1 = "𝔳"; -const vltri$1 = "⊲"; -const vnsub$1 = "⊂⃒"; -const vnsup$1 = "⊃⃒"; -const vopf$1 = "𝕧"; -const vprop$1 = "∝"; -const vrtri$1 = "⊳"; -const vscr$1 = "𝓋"; -const vsubnE$1 = "⫋︀"; -const vsubne$1 = "⊊︀"; -const vsupnE$1 = "⫌︀"; -const vsupne$1 = "⊋︀"; -const vzigzag$1 = "⦚"; -const wcirc$1 = "ŵ"; -const wedbar$1 = "⩟"; -const wedge$1 = "∧"; -const wedgeq$1 = "≙"; -const weierp$1 = "℘"; -const wfr$1 = "𝔴"; -const wopf$1 = "𝕨"; -const wp$1 = "℘"; -const wr$1 = "≀"; -const wreath$1 = "≀"; -const wscr$1 = "𝓌"; -const xcap$1 = "⋂"; -const xcirc$1 = "◯"; -const xcup$1 = "⋃"; -const xdtri$1 = "▽"; -const xfr$1 = "𝔵"; -const xhArr$1 = "⟺"; -const xharr$1 = "⟷"; -const xi$1 = "ξ"; -const xlArr$1 = "⟸"; -const xlarr$1 = "⟵"; -const xmap$1 = "⟼"; -const xnis$1 = "⋻"; -const xodot$1 = "⨀"; -const xopf$1 = "𝕩"; -const xoplus$1 = "⨁"; -const xotime$1 = "⨂"; -const xrArr$1 = "⟹"; -const xrarr$1 = "⟶"; -const xscr$1 = "𝓍"; -const xsqcup$1 = "⨆"; -const xuplus$1 = "⨄"; -const xutri$1 = "△"; -const xvee$1 = "⋁"; -const xwedge$1 = "⋀"; -const yacut$1 = "ý"; -const yacute$1 = "ý"; -const yacy$1 = "я"; -const ycirc$1 = "ŷ"; -const ycy$1 = "ы"; -const ye$1 = "¥"; -const yen$1 = "¥"; -const yfr$1 = "𝔶"; -const yicy$1 = "ї"; -const yopf$1 = "𝕪"; -const yscr$1 = "𝓎"; -const yucy$1 = "ю"; -const yum$1 = "ÿ"; -const yuml$1 = "ÿ"; -const zacute$1 = "ź"; -const zcaron$1 = "ž"; -const zcy$1 = "з"; -const zdot$1 = "ż"; -const zeetrf$1 = "ℨ"; -const zeta$1 = "ζ"; -const zfr$1 = "𝔷"; -const zhcy$1 = "ж"; -const zigrarr$1 = "⇝"; -const zopf$1 = "𝕫"; -const zscr$1 = "𝓏"; -const zwj$1 = ""; -const zwnj$1 = ""; -var require$$0$1 = { - AEli: AEli$1, - AElig: AElig$1, - AM: AM$1, - AMP: AMP$1, - Aacut: Aacut$1, - Aacute: Aacute$1, - Abreve: Abreve$1, - Acir: Acir$1, - Acirc: Acirc$1, - Acy: Acy$1, - Afr: Afr$1, - Agrav: Agrav$1, - Agrave: Agrave$1, - Alpha: Alpha$1, - Amacr: Amacr$1, - And: And$1, - Aogon: Aogon$1, - Aopf: Aopf$1, - ApplyFunction: ApplyFunction$1, - Arin: Arin$1, - Aring: Aring$1, - Ascr: Ascr$1, - Assign: Assign$1, - Atild: Atild$1, - Atilde: Atilde$1, - Aum: Aum$1, - Auml: Auml$1, - Backslash: Backslash$1, - Barv: Barv$1, - Barwed: Barwed$1, - Bcy: Bcy$1, - Because: Because$1, - Bernoullis: Bernoullis$1, - Beta: Beta$1, - Bfr: Bfr$1, - Bopf: Bopf$1, - Breve: Breve$1, - Bscr: Bscr$1, - Bumpeq: Bumpeq$1, - CHcy: CHcy$1, - COP: COP$1, - COPY: COPY$1, - Cacute: Cacute$1, - Cap: Cap$1, - CapitalDifferentialD: CapitalDifferentialD$1, - Cayleys: Cayleys$1, - Ccaron: Ccaron$1, - Ccedi: Ccedi$1, - Ccedil: Ccedil$1, - Ccirc: Ccirc$1, - Cconint: Cconint$1, - Cdot: Cdot$1, - Cedilla: Cedilla$1, - CenterDot: CenterDot$1, - Cfr: Cfr$1, - Chi: Chi$1, - CircleDot: CircleDot$1, - CircleMinus: CircleMinus$1, - CirclePlus: CirclePlus$1, - CircleTimes: CircleTimes$1, - ClockwiseContourIntegral: ClockwiseContourIntegral$1, - CloseCurlyDoubleQuote: CloseCurlyDoubleQuote$1, - CloseCurlyQuote: CloseCurlyQuote$1, - Colon: Colon$1, - Colone: Colone$1, - Congruent: Congruent$1, - Conint: Conint$1, - ContourIntegral: ContourIntegral$1, - Copf: Copf$1, - Coproduct: Coproduct$1, - CounterClockwiseContourIntegral: CounterClockwiseContourIntegral$1, - Cross: Cross$1, - Cscr: Cscr$1, - Cup: Cup$1, - CupCap: CupCap$1, - DD: DD$1, - DDotrahd: DDotrahd$1, - DJcy: DJcy$1, - DScy: DScy$1, - DZcy: DZcy$1, - Dagger: Dagger$1, - Darr: Darr$1, - Dashv: Dashv$1, - Dcaron: Dcaron$1, - Dcy: Dcy$1, - Del: Del$1, - Delta: Delta$1, - Dfr: Dfr$1, - DiacriticalAcute: DiacriticalAcute$1, - DiacriticalDot: DiacriticalDot$1, - DiacriticalDoubleAcute: DiacriticalDoubleAcute$1, - DiacriticalGrave: DiacriticalGrave$1, - DiacriticalTilde: DiacriticalTilde$1, - Diamond: Diamond$1, - DifferentialD: DifferentialD$1, - Dopf: Dopf$1, - Dot: Dot$1, - DotDot: DotDot$1, - DotEqual: DotEqual$1, - DoubleContourIntegral: DoubleContourIntegral$1, - DoubleDot: DoubleDot$1, - DoubleDownArrow: DoubleDownArrow$1, - DoubleLeftArrow: DoubleLeftArrow$1, - DoubleLeftRightArrow: DoubleLeftRightArrow$1, - DoubleLeftTee: DoubleLeftTee$1, - DoubleLongLeftArrow: DoubleLongLeftArrow$1, - DoubleLongLeftRightArrow: DoubleLongLeftRightArrow$1, - DoubleLongRightArrow: DoubleLongRightArrow$1, - DoubleRightArrow: DoubleRightArrow$1, - DoubleRightTee: DoubleRightTee$1, - DoubleUpArrow: DoubleUpArrow$1, - DoubleUpDownArrow: DoubleUpDownArrow$1, - DoubleVerticalBar: DoubleVerticalBar$1, - DownArrow: DownArrow$1, - DownArrowBar: DownArrowBar$1, - DownArrowUpArrow: DownArrowUpArrow$1, - DownBreve: DownBreve$1, - DownLeftRightVector: DownLeftRightVector$1, - DownLeftTeeVector: DownLeftTeeVector$1, - DownLeftVector: DownLeftVector$1, - DownLeftVectorBar: DownLeftVectorBar$1, - DownRightTeeVector: DownRightTeeVector$1, - DownRightVector: DownRightVector$1, - DownRightVectorBar: DownRightVectorBar$1, - DownTee: DownTee$1, - DownTeeArrow: DownTeeArrow$1, - Downarrow: Downarrow$1, - Dscr: Dscr$1, - Dstrok: Dstrok$1, - ENG: ENG$1, - ET: ET$1, - ETH: ETH$1, - Eacut: Eacut$1, - Eacute: Eacute$1, - Ecaron: Ecaron$1, - Ecir: Ecir$1, - Ecirc: Ecirc$1, - Ecy: Ecy$1, - Edot: Edot$1, - Efr: Efr$1, - Egrav: Egrav$1, - Egrave: Egrave$1, - Element: Element$1, - Emacr: Emacr$1, - EmptySmallSquare: EmptySmallSquare$1, - EmptyVerySmallSquare: EmptyVerySmallSquare$1, - Eogon: Eogon$1, - Eopf: Eopf$1, - Epsilon: Epsilon$1, - Equal: Equal$1, - EqualTilde: EqualTilde$1, - Equilibrium: Equilibrium$1, - Escr: Escr$1, - Esim: Esim$1, - Eta: Eta$1, - Eum: Eum$1, - Euml: Euml$1, - Exists: Exists$1, - ExponentialE: ExponentialE$1, - Fcy: Fcy$1, - Ffr: Ffr$1, - FilledSmallSquare: FilledSmallSquare$1, - FilledVerySmallSquare: FilledVerySmallSquare$1, - Fopf: Fopf$1, - ForAll: ForAll$1, - Fouriertrf: Fouriertrf$1, - Fscr: Fscr$1, - GJcy: GJcy$1, - G: G$1, - GT: GT$1, - Gamma: Gamma$1, - Gammad: Gammad$1, - Gbreve: Gbreve$1, - Gcedil: Gcedil$1, - Gcirc: Gcirc$1, - Gcy: Gcy$1, - Gdot: Gdot$1, - Gfr: Gfr$1, - Gg: Gg$1, - Gopf: Gopf$1, - GreaterEqual: GreaterEqual$1, - GreaterEqualLess: GreaterEqualLess$1, - GreaterFullEqual: GreaterFullEqual$1, - GreaterGreater: GreaterGreater$1, - GreaterLess: GreaterLess$1, - GreaterSlantEqual: GreaterSlantEqual$1, - GreaterTilde: GreaterTilde$1, - Gscr: Gscr$1, - Gt: Gt$1, - HARDcy: HARDcy$1, - Hacek: Hacek$1, - Hat: Hat$1, - Hcirc: Hcirc$1, - Hfr: Hfr$1, - HilbertSpace: HilbertSpace$1, - Hopf: Hopf$1, - HorizontalLine: HorizontalLine$1, - Hscr: Hscr$1, - Hstrok: Hstrok$1, - HumpDownHump: HumpDownHump$1, - HumpEqual: HumpEqual$1, - IEcy: IEcy$1, - IJlig: IJlig$1, - IOcy: IOcy$1, - Iacut: Iacut$1, - Iacute: Iacute$1, - Icir: Icir$1, - Icirc: Icirc$1, - Icy: Icy$1, - Idot: Idot$1, - Ifr: Ifr$1, - Igrav: Igrav$1, - Igrave: Igrave$1, - Im: Im$1, - Imacr: Imacr$1, - ImaginaryI: ImaginaryI$1, - Implies: Implies$1, - Int: Int$1, - Integral: Integral$1, - Intersection: Intersection$1, - InvisibleComma: InvisibleComma$1, - InvisibleTimes: InvisibleTimes$1, - Iogon: Iogon$1, - Iopf: Iopf$1, - Iota: Iota$1, - Iscr: Iscr$1, - Itilde: Itilde$1, - Iukcy: Iukcy$1, - Ium: Ium$1, - Iuml: Iuml$1, - Jcirc: Jcirc$1, - Jcy: Jcy$1, - Jfr: Jfr$1, - Jopf: Jopf$1, - Jscr: Jscr$1, - Jsercy: Jsercy$1, - Jukcy: Jukcy$1, - KHcy: KHcy$1, - KJcy: KJcy$1, - Kappa: Kappa$1, - Kcedil: Kcedil$1, - Kcy: Kcy$1, - Kfr: Kfr$1, - Kopf: Kopf$1, - Kscr: Kscr$1, - LJcy: LJcy$1, - L: L$1, - LT: LT$1, - Lacute: Lacute$1, - Lambda: Lambda$1, - Lang: Lang$1, - Laplacetrf: Laplacetrf$1, - Larr: Larr$1, - Lcaron: Lcaron$1, - Lcedil: Lcedil$1, - Lcy: Lcy$1, - LeftAngleBracket: LeftAngleBracket$1, - LeftArrow: LeftArrow$1, - LeftArrowBar: LeftArrowBar$1, - LeftArrowRightArrow: LeftArrowRightArrow$1, - LeftCeiling: LeftCeiling$1, - LeftDoubleBracket: LeftDoubleBracket$1, - LeftDownTeeVector: LeftDownTeeVector$1, - LeftDownVector: LeftDownVector$1, - LeftDownVectorBar: LeftDownVectorBar$1, - LeftFloor: LeftFloor$1, - LeftRightArrow: LeftRightArrow$1, - LeftRightVector: LeftRightVector$1, - LeftTee: LeftTee$1, - LeftTeeArrow: LeftTeeArrow$1, - LeftTeeVector: LeftTeeVector$1, - LeftTriangle: LeftTriangle$1, - LeftTriangleBar: LeftTriangleBar$1, - LeftTriangleEqual: LeftTriangleEqual$1, - LeftUpDownVector: LeftUpDownVector$1, - LeftUpTeeVector: LeftUpTeeVector$1, - LeftUpVector: LeftUpVector$1, - LeftUpVectorBar: LeftUpVectorBar$1, - LeftVector: LeftVector$1, - LeftVectorBar: LeftVectorBar$1, - Leftarrow: Leftarrow$1, - Leftrightarrow: Leftrightarrow$1, - LessEqualGreater: LessEqualGreater$1, - LessFullEqual: LessFullEqual$1, - LessGreater: LessGreater$1, - LessLess: LessLess$1, - LessSlantEqual: LessSlantEqual$1, - LessTilde: LessTilde$1, - Lfr: Lfr$1, - Ll: Ll$1, - Lleftarrow: Lleftarrow$1, - Lmidot: Lmidot$1, - LongLeftArrow: LongLeftArrow$1, - LongLeftRightArrow: LongLeftRightArrow$1, - LongRightArrow: LongRightArrow$1, - Longleftarrow: Longleftarrow$1, - Longleftrightarrow: Longleftrightarrow$1, - Longrightarrow: Longrightarrow$1, - Lopf: Lopf$1, - LowerLeftArrow: LowerLeftArrow$1, - LowerRightArrow: LowerRightArrow$1, - Lscr: Lscr$1, - Lsh: Lsh$1, - Lstrok: Lstrok$1, - Lt: Lt$1, - "Map": "⤅", - Mcy: Mcy$1, - MediumSpace: MediumSpace$1, - Mellintrf: Mellintrf$1, - Mfr: Mfr$1, - MinusPlus: MinusPlus$1, - Mopf: Mopf$1, - Mscr: Mscr$1, - Mu: Mu$1, - NJcy: NJcy$1, - Nacute: Nacute$1, - Ncaron: Ncaron$1, - Ncedil: Ncedil$1, - Ncy: Ncy$1, - NegativeMediumSpace: NegativeMediumSpace$1, - NegativeThickSpace: NegativeThickSpace$1, - NegativeThinSpace: NegativeThinSpace$1, - NegativeVeryThinSpace: NegativeVeryThinSpace$1, - NestedGreaterGreater: NestedGreaterGreater$1, - NestedLessLess: NestedLessLess$1, - NewLine: NewLine$1, - Nfr: Nfr$1, - NoBreak: NoBreak$1, - NonBreakingSpace: NonBreakingSpace$1, - Nopf: Nopf$1, - Not: Not$1, - NotCongruent: NotCongruent$1, - NotCupCap: NotCupCap$1, - NotDoubleVerticalBar: NotDoubleVerticalBar$1, - NotElement: NotElement$1, - NotEqual: NotEqual$1, - NotEqualTilde: NotEqualTilde$1, - NotExists: NotExists$1, - NotGreater: NotGreater$1, - NotGreaterEqual: NotGreaterEqual$1, - NotGreaterFullEqual: NotGreaterFullEqual$1, - NotGreaterGreater: NotGreaterGreater$1, - NotGreaterLess: NotGreaterLess$1, - NotGreaterSlantEqual: NotGreaterSlantEqual$1, - NotGreaterTilde: NotGreaterTilde$1, - NotHumpDownHump: NotHumpDownHump$1, - NotHumpEqual: NotHumpEqual$1, - NotLeftTriangle: NotLeftTriangle$1, - NotLeftTriangleBar: NotLeftTriangleBar$1, - NotLeftTriangleEqual: NotLeftTriangleEqual$1, - NotLess: NotLess$1, - NotLessEqual: NotLessEqual$1, - NotLessGreater: NotLessGreater$1, - NotLessLess: NotLessLess$1, - NotLessSlantEqual: NotLessSlantEqual$1, - NotLessTilde: NotLessTilde$1, - NotNestedGreaterGreater: NotNestedGreaterGreater$1, - NotNestedLessLess: NotNestedLessLess$1, - NotPrecedes: NotPrecedes$1, - NotPrecedesEqual: NotPrecedesEqual$1, - NotPrecedesSlantEqual: NotPrecedesSlantEqual$1, - NotReverseElement: NotReverseElement$1, - NotRightTriangle: NotRightTriangle$1, - NotRightTriangleBar: NotRightTriangleBar$1, - NotRightTriangleEqual: NotRightTriangleEqual$1, - NotSquareSubset: NotSquareSubset$1, - NotSquareSubsetEqual: NotSquareSubsetEqual$1, - NotSquareSuperset: NotSquareSuperset$1, - NotSquareSupersetEqual: NotSquareSupersetEqual$1, - NotSubset: NotSubset$1, - NotSubsetEqual: NotSubsetEqual$1, - NotSucceeds: NotSucceeds$1, - NotSucceedsEqual: NotSucceedsEqual$1, - NotSucceedsSlantEqual: NotSucceedsSlantEqual$1, - NotSucceedsTilde: NotSucceedsTilde$1, - NotSuperset: NotSuperset$1, - NotSupersetEqual: NotSupersetEqual$1, - NotTilde: NotTilde$1, - NotTildeEqual: NotTildeEqual$1, - NotTildeFullEqual: NotTildeFullEqual$1, - NotTildeTilde: NotTildeTilde$1, - NotVerticalBar: NotVerticalBar$1, - Nscr: Nscr$1, - Ntild: Ntild$1, - Ntilde: Ntilde$1, - Nu: Nu$1, - OElig: OElig$1, - Oacut: Oacut$1, - Oacute: Oacute$1, - Ocir: Ocir$1, - Ocirc: Ocirc$1, - Ocy: Ocy$1, - Odblac: Odblac$1, - Ofr: Ofr$1, - Ograv: Ograv$1, - Ograve: Ograve$1, - Omacr: Omacr$1, - Omega: Omega$1, - Omicron: Omicron$1, - Oopf: Oopf$1, - OpenCurlyDoubleQuote: OpenCurlyDoubleQuote$1, - OpenCurlyQuote: OpenCurlyQuote$1, - Or: Or$1, - Oscr: Oscr$1, - Oslas: Oslas$1, - Oslash: Oslash$1, - Otild: Otild$1, - Otilde: Otilde$1, - Otimes: Otimes$1, - Oum: Oum$1, - Ouml: Ouml$1, - OverBar: OverBar$1, - OverBrace: OverBrace$1, - OverBracket: OverBracket$1, - OverParenthesis: OverParenthesis$1, - PartialD: PartialD$1, - Pcy: Pcy$1, - Pfr: Pfr$1, - Phi: Phi$1, - Pi: Pi$1, - PlusMinus: PlusMinus$1, - Poincareplane: Poincareplane$1, - Popf: Popf$1, - Pr: Pr$1, - Precedes: Precedes$1, - PrecedesEqual: PrecedesEqual$1, - PrecedesSlantEqual: PrecedesSlantEqual$1, - PrecedesTilde: PrecedesTilde$1, - Prime: Prime$1, - Product: Product$1, - Proportion: Proportion$1, - Proportional: Proportional$1, - Pscr: Pscr$1, - Psi: Psi$1, - QUO: QUO$1, - QUOT: QUOT$1, - Qfr: Qfr$1, - Qopf: Qopf$1, - Qscr: Qscr$1, - RBarr: RBarr$1, - RE: RE$1, - REG: REG$1, - Racute: Racute$1, - Rang: Rang$1, - Rarr: Rarr$1, - Rarrtl: Rarrtl$1, - Rcaron: Rcaron$1, - Rcedil: Rcedil$1, - Rcy: Rcy$1, - Re: Re$1, - ReverseElement: ReverseElement$1, - ReverseEquilibrium: ReverseEquilibrium$1, - ReverseUpEquilibrium: ReverseUpEquilibrium$1, - Rfr: Rfr$1, - Rho: Rho$1, - RightAngleBracket: RightAngleBracket$1, - RightArrow: RightArrow$1, - RightArrowBar: RightArrowBar$1, - RightArrowLeftArrow: RightArrowLeftArrow$1, - RightCeiling: RightCeiling$1, - RightDoubleBracket: RightDoubleBracket$1, - RightDownTeeVector: RightDownTeeVector$1, - RightDownVector: RightDownVector$1, - RightDownVectorBar: RightDownVectorBar$1, - RightFloor: RightFloor$1, - RightTee: RightTee$1, - RightTeeArrow: RightTeeArrow$1, - RightTeeVector: RightTeeVector$1, - RightTriangle: RightTriangle$1, - RightTriangleBar: RightTriangleBar$1, - RightTriangleEqual: RightTriangleEqual$1, - RightUpDownVector: RightUpDownVector$1, - RightUpTeeVector: RightUpTeeVector$1, - RightUpVector: RightUpVector$1, - RightUpVectorBar: RightUpVectorBar$1, - RightVector: RightVector$1, - RightVectorBar: RightVectorBar$1, - Rightarrow: Rightarrow$1, - Ropf: Ropf$1, - RoundImplies: RoundImplies$1, - Rrightarrow: Rrightarrow$1, - Rscr: Rscr$1, - Rsh: Rsh$1, - RuleDelayed: RuleDelayed$1, - SHCHcy: SHCHcy$1, - SHcy: SHcy$1, - SOFTcy: SOFTcy$1, - Sacute: Sacute$1, - Sc: Sc$1, - Scaron: Scaron$1, - Scedil: Scedil$1, - Scirc: Scirc$1, - Scy: Scy$1, - Sfr: Sfr$1, - ShortDownArrow: ShortDownArrow$1, - ShortLeftArrow: ShortLeftArrow$1, - ShortRightArrow: ShortRightArrow$1, - ShortUpArrow: ShortUpArrow$1, - Sigma: Sigma$1, - SmallCircle: SmallCircle$1, - Sopf: Sopf$1, - Sqrt: Sqrt$1, - Square: Square$1, - SquareIntersection: SquareIntersection$1, - SquareSubset: SquareSubset$1, - SquareSubsetEqual: SquareSubsetEqual$1, - SquareSuperset: SquareSuperset$1, - SquareSupersetEqual: SquareSupersetEqual$1, - SquareUnion: SquareUnion$1, - Sscr: Sscr$1, - Star: Star$1, - Sub: Sub$1, - Subset: Subset$1, - SubsetEqual: SubsetEqual$1, - Succeeds: Succeeds$1, - SucceedsEqual: SucceedsEqual$1, - SucceedsSlantEqual: SucceedsSlantEqual$1, - SucceedsTilde: SucceedsTilde$1, - SuchThat: SuchThat$1, - Sum: Sum$1, - Sup: Sup$1, - Superset: Superset$1, - SupersetEqual: SupersetEqual$1, - Supset: Supset$1, - THOR: THOR$1, - THORN: THORN$1, - TRADE: TRADE$1, - TSHcy: TSHcy$1, - TScy: TScy$1, - Tab: Tab$1, - Tau: Tau$1, - Tcaron: Tcaron$1, - Tcedil: Tcedil$1, - Tcy: Tcy$1, - Tfr: Tfr$1, - Therefore: Therefore$1, - Theta: Theta$1, - ThickSpace: ThickSpace$1, - ThinSpace: ThinSpace$1, - Tilde: Tilde$1, - TildeEqual: TildeEqual$1, - TildeFullEqual: TildeFullEqual$1, - TildeTilde: TildeTilde$1, - Topf: Topf$1, - TripleDot: TripleDot$1, - Tscr: Tscr$1, - Tstrok: Tstrok$1, - Uacut: Uacut$1, - Uacute: Uacute$1, - Uarr: Uarr$1, - Uarrocir: Uarrocir$1, - Ubrcy: Ubrcy$1, - Ubreve: Ubreve$1, - Ucir: Ucir$1, - Ucirc: Ucirc$1, - Ucy: Ucy$1, - Udblac: Udblac$1, - Ufr: Ufr$1, - Ugrav: Ugrav$1, - Ugrave: Ugrave$1, - Umacr: Umacr$1, - UnderBar: UnderBar$1, - UnderBrace: UnderBrace$1, - UnderBracket: UnderBracket$1, - UnderParenthesis: UnderParenthesis$1, - Union: Union$1, - UnionPlus: UnionPlus$1, - Uogon: Uogon$1, - Uopf: Uopf$1, - UpArrow: UpArrow$1, - UpArrowBar: UpArrowBar$1, - UpArrowDownArrow: UpArrowDownArrow$1, - UpDownArrow: UpDownArrow$1, - UpEquilibrium: UpEquilibrium$1, - UpTee: UpTee$1, - UpTeeArrow: UpTeeArrow$1, - Uparrow: Uparrow$1, - Updownarrow: Updownarrow$1, - UpperLeftArrow: UpperLeftArrow$1, - UpperRightArrow: UpperRightArrow$1, - Upsi: Upsi$1, - Upsilon: Upsilon$1, - Uring: Uring$1, - Uscr: Uscr$1, - Utilde: Utilde$1, - Uum: Uum$1, - Uuml: Uuml$1, - VDash: VDash$1, - Vbar: Vbar$1, - Vcy: Vcy$1, - Vdash: Vdash$1, - Vdashl: Vdashl$1, - Vee: Vee$1, - Verbar: Verbar$1, - Vert: Vert$1, - VerticalBar: VerticalBar$1, - VerticalLine: VerticalLine$1, - VerticalSeparator: VerticalSeparator$1, - VerticalTilde: VerticalTilde$1, - VeryThinSpace: VeryThinSpace$1, - Vfr: Vfr$1, - Vopf: Vopf$1, - Vscr: Vscr$1, - Vvdash: Vvdash$1, - Wcirc: Wcirc$1, - Wedge: Wedge$1, - Wfr: Wfr$1, - Wopf: Wopf$1, - Wscr: Wscr$1, - Xfr: Xfr$1, - Xi: Xi$1, - Xopf: Xopf$1, - Xscr: Xscr$1, - YAcy: YAcy$1, - YIcy: YIcy$1, - YUcy: YUcy$1, - Yacut: Yacut$1, - Yacute: Yacute$1, - Ycirc: Ycirc$1, - Ycy: Ycy$1, - Yfr: Yfr$1, - Yopf: Yopf$1, - Yscr: Yscr$1, - Yuml: Yuml$1, - ZHcy: ZHcy$1, - Zacute: Zacute$1, - Zcaron: Zcaron$1, - Zcy: Zcy$1, - Zdot: Zdot$1, - ZeroWidthSpace: ZeroWidthSpace$1, - Zeta: Zeta$1, - Zfr: Zfr$1, - Zopf: Zopf$1, - Zscr: Zscr$1, - aacut: aacut$1, - aacute: aacute$1, - abreve: abreve$1, - ac: ac$1, - acE: acE$1, - acd: acd$1, - acir: acir$1, - acirc: acirc$1, - acut: acut$1, - acute: acute$1, - acy: acy$1, - aeli: aeli$1, - aelig: aelig$1, - af: af$1, - afr: afr$1, - agrav: agrav$1, - agrave: agrave$1, - alefsym: alefsym$1, - aleph: aleph$1, - alpha: alpha$1, - amacr: amacr$1, - amalg: amalg$1, - am: am$1, - amp: amp$1, - and: and$1, - andand: andand$1, - andd: andd$1, - andslope: andslope$1, - andv: andv$1, - ang: ang$1, - ange: ange$1, - angle: angle$1, - angmsd: angmsd$1, - angmsdaa: angmsdaa$1, - angmsdab: angmsdab$1, - angmsdac: angmsdac$1, - angmsdad: angmsdad$1, - angmsdae: angmsdae$1, - angmsdaf: angmsdaf$1, - angmsdag: angmsdag$1, - angmsdah: angmsdah$1, - angrt: angrt$1, - angrtvb: angrtvb$1, - angrtvbd: angrtvbd$1, - angsph: angsph$1, - angst: angst$1, - angzarr: angzarr$1, - aogon: aogon$1, - aopf: aopf$1, - ap: ap$1, - apE: apE$1, - apacir: apacir$1, - ape: ape$1, - apid: apid$1, - apos: apos$1, - approx: approx$1, - approxeq: approxeq$1, - arin: arin$1, - aring: aring$1, - ascr: ascr$1, - ast: ast$1, - asymp: asymp$1, - asympeq: asympeq$1, - atild: atild$1, - atilde: atilde$1, - aum: aum$1, - auml: auml$1, - awconint: awconint$1, - awint: awint$1, - bNot: bNot$1, - backcong: backcong$1, - backepsilon: backepsilon$1, - backprime: backprime$1, - backsim: backsim$1, - backsimeq: backsimeq$1, - barvee: barvee$1, - barwed: barwed$1, - barwedge: barwedge$1, - bbrk: bbrk$1, - bbrktbrk: bbrktbrk$1, - bcong: bcong$1, - bcy: bcy$1, - bdquo: bdquo$1, - becaus: becaus$1, - because: because$1, - bemptyv: bemptyv$1, - bepsi: bepsi$1, - bernou: bernou$1, - beta: beta$1, - beth: beth$1, - between: between$1, - bfr: bfr$1, - bigcap: bigcap$1, - bigcirc: bigcirc$1, - bigcup: bigcup$1, - bigodot: bigodot$1, - bigoplus: bigoplus$1, - bigotimes: bigotimes$1, - bigsqcup: bigsqcup$1, - bigstar: bigstar$1, - bigtriangledown: bigtriangledown$1, - bigtriangleup: bigtriangleup$1, - biguplus: biguplus$1, - bigvee: bigvee$1, - bigwedge: bigwedge$1, - bkarow: bkarow$1, - blacklozenge: blacklozenge$1, - blacksquare: blacksquare$1, - blacktriangle: blacktriangle$1, - blacktriangledown: blacktriangledown$1, - blacktriangleleft: blacktriangleleft$1, - blacktriangleright: blacktriangleright$1, - blank: blank$1, - blk12: blk12$1, - blk14: blk14$1, - blk34: blk34$1, - block: block$1, - bne: bne$1, - bnequiv: bnequiv$1, - bnot: bnot$1, - bopf: bopf$1, - bot: bot$1, - bottom: bottom$1, - bowtie: bowtie$1, - boxDL: boxDL$1, - boxDR: boxDR$1, - boxDl: boxDl$1, - boxDr: boxDr$1, - boxH: boxH$1, - boxHD: boxHD$1, - boxHU: boxHU$1, - boxHd: boxHd$1, - boxHu: boxHu$1, - boxUL: boxUL$1, - boxUR: boxUR$1, - boxUl: boxUl$1, - boxUr: boxUr$1, - boxV: boxV$1, - boxVH: boxVH$1, - boxVL: boxVL$1, - boxVR: boxVR$1, - boxVh: boxVh$1, - boxVl: boxVl$1, - boxVr: boxVr$1, - boxbox: boxbox$1, - boxdL: boxdL$1, - boxdR: boxdR$1, - boxdl: boxdl$1, - boxdr: boxdr$1, - boxh: boxh$1, - boxhD: boxhD$1, - boxhU: boxhU$1, - boxhd: boxhd$1, - boxhu: boxhu$1, - boxminus: boxminus$1, - boxplus: boxplus$1, - boxtimes: boxtimes$1, - boxuL: boxuL$1, - boxuR: boxuR$1, - boxul: boxul$1, - boxur: boxur$1, - boxv: boxv$1, - boxvH: boxvH$1, - boxvL: boxvL$1, - boxvR: boxvR$1, - boxvh: boxvh$1, - boxvl: boxvl$1, - boxvr: boxvr$1, - bprime: bprime$1, - breve: breve$1, - brvba: brvba$1, - brvbar: brvbar$1, - bscr: bscr$1, - bsemi: bsemi$1, - bsim: bsim$1, - bsime: bsime$1, - bsol: bsol$1, - bsolb: bsolb$1, - bsolhsub: bsolhsub$1, - bull: bull$1, - bullet: bullet$1, - bump: bump$1, - bumpE: bumpE$1, - bumpe: bumpe$1, - bumpeq: bumpeq$1, - cacute: cacute$1, - cap: cap$1, - capand: capand$1, - capbrcup: capbrcup$1, - capcap: capcap$1, - capcup: capcup$1, - capdot: capdot$1, - caps: caps$1, - caret: caret$1, - caron: caron$1, - ccaps: ccaps$1, - ccaron: ccaron$1, - ccedi: ccedi$1, - ccedil: ccedil$1, - ccirc: ccirc$1, - ccups: ccups$1, - ccupssm: ccupssm$1, - cdot: cdot$1, - cedi: cedi$1, - cedil: cedil$1, - cemptyv: cemptyv$1, - cen: cen$1, - cent: cent$1, - centerdot: centerdot$1, - cfr: cfr$1, - chcy: chcy$1, - check: check$2, - checkmark: checkmark$1, - chi: chi$1, - cir: cir$1, - cirE: cirE$1, - circ: circ$1, - circeq: circeq$1, - circlearrowleft: circlearrowleft$1, - circlearrowright: circlearrowright$1, - circledR: circledR$1, - circledS: circledS$1, - circledast: circledast$1, - circledcirc: circledcirc$1, - circleddash: circleddash$1, - cire: cire$1, - cirfnint: cirfnint$1, - cirmid: cirmid$1, - cirscir: cirscir$1, - clubs: clubs$1, - clubsuit: clubsuit$1, - colon: colon$1, - colone: colone$1, - coloneq: coloneq$1, - comma: comma$1, - commat: commat$1, - comp: comp$1, - compfn: compfn$1, - complement: complement$1, - complexes: complexes$1, - cong: cong$1, - congdot: congdot$1, - conint: conint$1, - copf: copf$1, - coprod: coprod$1, - cop: cop$1, - copy: copy$1, - copysr: copysr$1, - crarr: crarr$1, - cross: cross$1, - cscr: cscr$1, - csub: csub$1, - csube: csube$1, - csup: csup$1, - csupe: csupe$1, - ctdot: ctdot$1, - cudarrl: cudarrl$1, - cudarrr: cudarrr$1, - cuepr: cuepr$1, - cuesc: cuesc$1, - cularr: cularr$1, - cularrp: cularrp$1, - cup: cup$1, - cupbrcap: cupbrcap$1, - cupcap: cupcap$1, - cupcup: cupcup$1, - cupdot: cupdot$1, - cupor: cupor$1, - cups: cups$1, - curarr: curarr$1, - curarrm: curarrm$1, - curlyeqprec: curlyeqprec$1, - curlyeqsucc: curlyeqsucc$1, - curlyvee: curlyvee$1, - curlywedge: curlywedge$1, - curre: curre$1, - curren: curren$1, - curvearrowleft: curvearrowleft$1, - curvearrowright: curvearrowright$1, - cuvee: cuvee$1, - cuwed: cuwed$1, - cwconint: cwconint$1, - cwint: cwint$1, - cylcty: cylcty$1, - dArr: dArr$1, - dHar: dHar$1, - dagger: dagger$1, - daleth: daleth$1, - darr: darr$1, - dash: dash$1, - dashv: dashv$1, - dbkarow: dbkarow$1, - dblac: dblac$1, - dcaron: dcaron$1, - dcy: dcy$1, - dd: dd$1, - ddagger: ddagger$1, - ddarr: ddarr$1, - ddotseq: ddotseq$1, - de: de$1, - deg: deg$1, - delta: delta$1, - demptyv: demptyv$1, - dfisht: dfisht$1, - dfr: dfr$1, - dharl: dharl$1, - dharr: dharr$1, - diam: diam$1, - diamond: diamond$1, - diamondsuit: diamondsuit$1, - diams: diams$1, - die: die$1, - digamma: digamma$1, - disin: disin$1, - div: div$1, - divid: divid$1, - divide: divide$1, - divideontimes: divideontimes$1, - divonx: divonx$1, - djcy: djcy$1, - dlcorn: dlcorn$1, - dlcrop: dlcrop$1, - dollar: dollar$1, - dopf: dopf$1, - dot: dot$1, - doteq: doteq$1, - doteqdot: doteqdot$1, - dotminus: dotminus$1, - dotplus: dotplus$1, - dotsquare: dotsquare$1, - doublebarwedge: doublebarwedge$1, - downarrow: downarrow$1, - downdownarrows: downdownarrows$1, - downharpoonleft: downharpoonleft$1, - downharpoonright: downharpoonright$1, - drbkarow: drbkarow$1, - drcorn: drcorn$1, - drcrop: drcrop$1, - dscr: dscr$1, - dscy: dscy$1, - dsol: dsol$1, - dstrok: dstrok$1, - dtdot: dtdot$1, - dtri: dtri$1, - dtrif: dtrif$1, - duarr: duarr$1, - duhar: duhar$1, - dwangle: dwangle$1, - dzcy: dzcy$1, - dzigrarr: dzigrarr$1, - eDDot: eDDot$1, - eDot: eDot$1, - eacut: eacut$1, - eacute: eacute$1, - easter: easter$1, - ecaron: ecaron$1, - ecir: ecir$1, - ecirc: ecirc$1, - ecolon: ecolon$1, - ecy: ecy$1, - edot: edot$1, - ee: ee$1, - efDot: efDot$1, - efr: efr$1, - eg: eg$1, - egrav: egrav$1, - egrave: egrave$1, - egs: egs$1, - egsdot: egsdot$1, - el: el$1, - elinters: elinters$1, - ell: ell$1, - els: els$1, - elsdot: elsdot$1, - emacr: emacr$1, - empty: empty$1, - emptyset: emptyset$1, - emptyv: emptyv$1, - emsp13: emsp13$1, - emsp14: emsp14$1, - emsp: emsp$1, - eng: eng$1, - ensp: ensp$1, - eogon: eogon$1, - eopf: eopf$1, - epar: epar$1, - eparsl: eparsl$1, - eplus: eplus$1, - epsi: epsi$1, - epsilon: epsilon$1, - epsiv: epsiv$1, - eqcirc: eqcirc$1, - eqcolon: eqcolon$1, - eqsim: eqsim$1, - eqslantgtr: eqslantgtr$1, - eqslantless: eqslantless$1, - equals: equals$1, - equest: equest$1, - equiv: equiv$1, - equivDD: equivDD$1, - eqvparsl: eqvparsl$1, - erDot: erDot$1, - erarr: erarr$1, - escr: escr$1, - esdot: esdot$1, - esim: esim$1, - eta: eta$1, - et: et$1, - eth: eth$1, - eum: eum$1, - euml: euml$1, - euro: euro$1, - excl: excl$1, - exist: exist$1, - expectation: expectation$1, - exponentiale: exponentiale$1, - fallingdotseq: fallingdotseq$1, - fcy: fcy$1, - female: female$1, - ffilig: ffilig$1, - fflig: fflig$1, - ffllig: ffllig$1, - ffr: ffr$1, - filig: filig$1, - fjlig: fjlig$1, - flat: flat$1, - fllig: fllig$1, - fltns: fltns$1, - fnof: fnof$1, - fopf: fopf$1, - forall: forall$1, - fork: fork$1, - forkv: forkv$1, - fpartint: fpartint$1, - frac1: frac1$1, - frac12: frac12$1, - frac13: frac13$1, - frac14: frac14$1, - frac15: frac15$1, - frac16: frac16$1, - frac18: frac18$1, - frac23: frac23$1, - frac25: frac25$1, - frac3: frac3$1, - frac34: frac34$1, - frac35: frac35$1, - frac38: frac38$1, - frac45: frac45$1, - frac56: frac56$1, - frac58: frac58$1, - frac78: frac78$1, - frasl: frasl$1, - frown: frown$1, - fscr: fscr$1, - gE: gE$1, - gEl: gEl$1, - gacute: gacute$1, - gamma: gamma$1, - gammad: gammad$1, - gap: gap$1, - gbreve: gbreve$1, - gcirc: gcirc$1, - gcy: gcy$1, - gdot: gdot$1, - ge: ge$1, - gel: gel$1, - geq: geq$1, - geqq: geqq$1, - geqslant: geqslant$1, - ges: ges$1, - gescc: gescc$1, - gesdot: gesdot$1, - gesdoto: gesdoto$1, - gesdotol: gesdotol$1, - gesl: gesl$1, - gesles: gesles$1, - gfr: gfr$1, - gg: gg$1, - ggg: ggg$1, - gimel: gimel$1, - gjcy: gjcy$1, - gl: gl$1, - glE: glE$1, - gla: gla$1, - glj: glj$1, - gnE: gnE$1, - gnap: gnap$1, - gnapprox: gnapprox$1, - gne: gne$1, - gneq: gneq$1, - gneqq: gneqq$1, - gnsim: gnsim$1, - gopf: gopf$1, - grave: grave$1, - gscr: gscr$1, - gsim: gsim$1, - gsime: gsime$1, - gsiml: gsiml$1, - g: g$1, - gt: gt$1, - gtcc: gtcc$1, - gtcir: gtcir$1, - gtdot: gtdot$1, - gtlPar: gtlPar$1, - gtquest: gtquest$1, - gtrapprox: gtrapprox$1, - gtrarr: gtrarr$1, - gtrdot: gtrdot$1, - gtreqless: gtreqless$1, - gtreqqless: gtreqqless$1, - gtrless: gtrless$1, - gtrsim: gtrsim$1, - gvertneqq: gvertneqq$1, - gvnE: gvnE$1, - hArr: hArr$1, - hairsp: hairsp$1, - half: half$1, - hamilt: hamilt$1, - hardcy: hardcy$1, - harr: harr$1, - harrcir: harrcir$1, - harrw: harrw$1, - hbar: hbar$1, - hcirc: hcirc$1, - hearts: hearts$1, - heartsuit: heartsuit$1, - hellip: hellip$1, - hercon: hercon$1, - hfr: hfr$1, - hksearow: hksearow$1, - hkswarow: hkswarow$1, - hoarr: hoarr$1, - homtht: homtht$1, - hookleftarrow: hookleftarrow$1, - hookrightarrow: hookrightarrow$1, - hopf: hopf$1, - horbar: horbar$1, - hscr: hscr$1, - hslash: hslash$1, - hstrok: hstrok$1, - hybull: hybull$1, - hyphen: hyphen$1, - iacut: iacut$1, - iacute: iacute$1, - ic: ic$1, - icir: icir$1, - icirc: icirc$1, - icy: icy$1, - iecy: iecy$1, - iexc: iexc$1, - iexcl: iexcl$1, - iff: iff$1, - ifr: ifr$1, - igrav: igrav$1, - igrave: igrave$1, - ii: ii$1, - iiiint: iiiint$1, - iiint: iiint$1, - iinfin: iinfin$1, - iiota: iiota$1, - ijlig: ijlig$1, - imacr: imacr$1, - image: image$2, - imagline: imagline$1, - imagpart: imagpart$1, - imath: imath$1, - imof: imof$1, - imped: imped$1, - "in": "∈", - incare: incare$1, - infin: infin$1, - infintie: infintie$1, - inodot: inodot$1, - int: int$2, - intcal: intcal$1, - integers: integers$1, - intercal: intercal$1, - intlarhk: intlarhk$1, - intprod: intprod$1, - iocy: iocy$1, - iogon: iogon$1, - iopf: iopf$1, - iota: iota$1, - iprod: iprod$1, - iques: iques$1, - iquest: iquest$1, - iscr: iscr$1, - isin: isin$1, - isinE: isinE$1, - isindot: isindot$1, - isins: isins$1, - isinsv: isinsv$1, - isinv: isinv$1, - it: it$1, - itilde: itilde$1, - iukcy: iukcy$1, - ium: ium$1, - iuml: iuml$1, - jcirc: jcirc$1, - jcy: jcy$1, - jfr: jfr$1, - jmath: jmath$1, - jopf: jopf$1, - jscr: jscr$1, - jsercy: jsercy$1, - jukcy: jukcy$1, - kappa: kappa$1, - kappav: kappav$1, - kcedil: kcedil$1, - kcy: kcy$1, - kfr: kfr$1, - kgreen: kgreen$1, - khcy: khcy$1, - kjcy: kjcy$1, - kopf: kopf$1, - kscr: kscr$1, - lAarr: lAarr$1, - lArr: lArr$1, - lAtail: lAtail$1, - lBarr: lBarr$1, - lE: lE$1, - lEg: lEg$1, - lHar: lHar$1, - lacute: lacute$1, - laemptyv: laemptyv$1, - lagran: lagran$1, - lambda: lambda$1, - lang: lang$1, - langd: langd$1, - langle: langle$1, - lap: lap$1, - laqu: laqu$1, - laquo: laquo$1, - larr: larr$1, - larrb: larrb$1, - larrbfs: larrbfs$1, - larrfs: larrfs$1, - larrhk: larrhk$1, - larrlp: larrlp$1, - larrpl: larrpl$1, - larrsim: larrsim$1, - larrtl: larrtl$1, - lat: lat$1, - latail: latail$1, - late: late$1, - lates: lates$1, - lbarr: lbarr$1, - lbbrk: lbbrk$1, - lbrace: lbrace$1, - lbrack: lbrack$1, - lbrke: lbrke$1, - lbrksld: lbrksld$1, - lbrkslu: lbrkslu$1, - lcaron: lcaron$1, - lcedil: lcedil$1, - lceil: lceil$1, - lcub: lcub$1, - lcy: lcy$1, - ldca: ldca$1, - ldquo: ldquo$1, - ldquor: ldquor$1, - ldrdhar: ldrdhar$1, - ldrushar: ldrushar$1, - ldsh: ldsh$1, - le: le$1, - leftarrow: leftarrow$1, - leftarrowtail: leftarrowtail$1, - leftharpoondown: leftharpoondown$1, - leftharpoonup: leftharpoonup$1, - leftleftarrows: leftleftarrows$1, - leftrightarrow: leftrightarrow$1, - leftrightarrows: leftrightarrows$1, - leftrightharpoons: leftrightharpoons$1, - leftrightsquigarrow: leftrightsquigarrow$1, - leftthreetimes: leftthreetimes$1, - leg: leg$1, - leq: leq$1, - leqq: leqq$1, - leqslant: leqslant$1, - les: les$1, - lescc: lescc$1, - lesdot: lesdot$1, - lesdoto: lesdoto$1, - lesdotor: lesdotor$1, - lesg: lesg$1, - lesges: lesges$1, - lessapprox: lessapprox$1, - lessdot: lessdot$1, - lesseqgtr: lesseqgtr$1, - lesseqqgtr: lesseqqgtr$1, - lessgtr: lessgtr$1, - lesssim: lesssim$1, - lfisht: lfisht$1, - lfloor: lfloor$1, - lfr: lfr$1, - lg: lg$1, - lgE: lgE$1, - lhard: lhard$1, - lharu: lharu$1, - lharul: lharul$1, - lhblk: lhblk$1, - ljcy: ljcy$1, - ll: ll$1, - llarr: llarr$1, - llcorner: llcorner$1, - llhard: llhard$1, - lltri: lltri$1, - lmidot: lmidot$1, - lmoust: lmoust$1, - lmoustache: lmoustache$1, - lnE: lnE$1, - lnap: lnap$1, - lnapprox: lnapprox$1, - lne: lne$1, - lneq: lneq$1, - lneqq: lneqq$1, - lnsim: lnsim$1, - loang: loang$1, - loarr: loarr$1, - lobrk: lobrk$1, - longleftarrow: longleftarrow$1, - longleftrightarrow: longleftrightarrow$1, - longmapsto: longmapsto$1, - longrightarrow: longrightarrow$1, - looparrowleft: looparrowleft$1, - looparrowright: looparrowright$1, - lopar: lopar$1, - lopf: lopf$1, - loplus: loplus$1, - lotimes: lotimes$1, - lowast: lowast$1, - lowbar: lowbar$1, - loz: loz$1, - lozenge: lozenge$1, - lozf: lozf$1, - lpar: lpar$1, - lparlt: lparlt$1, - lrarr: lrarr$1, - lrcorner: lrcorner$1, - lrhar: lrhar$1, - lrhard: lrhard$1, - lrm: lrm$1, - lrtri: lrtri$1, - lsaquo: lsaquo$1, - lscr: lscr$1, - lsh: lsh$1, - lsim: lsim$1, - lsime: lsime$1, - lsimg: lsimg$1, - lsqb: lsqb$1, - lsquo: lsquo$1, - lsquor: lsquor$1, - lstrok: lstrok$1, - l: l$1, - lt: lt$2, - ltcc: ltcc$1, - ltcir: ltcir$1, - ltdot: ltdot$1, - lthree: lthree$1, - ltimes: ltimes$1, - ltlarr: ltlarr$1, - ltquest: ltquest$1, - ltrPar: ltrPar$1, - ltri: ltri$1, - ltrie: ltrie$1, - ltrif: ltrif$1, - lurdshar: lurdshar$1, - luruhar: luruhar$1, - lvertneqq: lvertneqq$1, - lvnE: lvnE$1, - mDDot: mDDot$1, - mac: mac$1, - macr: macr$1, - male: male$1, - malt: malt$1, - maltese: maltese$1, - map: map$4, - mapsto: mapsto$1, - mapstodown: mapstodown$1, - mapstoleft: mapstoleft$1, - mapstoup: mapstoup$1, - marker: marker$1, - mcomma: mcomma$1, - mcy: mcy$1, - mdash: mdash$1, - measuredangle: measuredangle$1, - mfr: mfr$1, - mho: mho$1, - micr: micr$1, - micro: micro$1, - mid: mid$1, - midast: midast$1, - midcir: midcir$1, - middo: middo$1, - middot: middot$1, - minus: minus$1, - minusb: minusb$1, - minusd: minusd$1, - minusdu: minusdu$1, - mlcp: mlcp$1, - mldr: mldr$1, - mnplus: mnplus$1, - models: models$1, - mopf: mopf$1, - mp: mp$1, - mscr: mscr$1, - mstpos: mstpos$1, - mu: mu$1, - multimap: multimap$1, - mumap: mumap$1, - nGg: nGg$1, - nGt: nGt$1, - nGtv: nGtv$1, - nLeftarrow: nLeftarrow$1, - nLeftrightarrow: nLeftrightarrow$1, - nLl: nLl$1, - nLt: nLt$1, - nLtv: nLtv$1, - nRightarrow: nRightarrow$1, - nVDash: nVDash$1, - nVdash: nVdash$1, - nabla: nabla$1, - nacute: nacute$1, - nang: nang$1, - nap: nap$1, - napE: napE$1, - napid: napid$1, - napos: napos$1, - napprox: napprox$1, - natur: natur$1, - natural: natural$1, - naturals: naturals$1, - nbs: nbs$1, - nbsp: nbsp$1, - nbump: nbump$1, - nbumpe: nbumpe$1, - ncap: ncap$1, - ncaron: ncaron$1, - ncedil: ncedil$1, - ncong: ncong$1, - ncongdot: ncongdot$1, - ncup: ncup$1, - ncy: ncy$1, - ndash: ndash$1, - ne: ne$1, - neArr: neArr$1, - nearhk: nearhk$1, - nearr: nearr$1, - nearrow: nearrow$1, - nedot: nedot$1, - nequiv: nequiv$1, - nesear: nesear$1, - nesim: nesim$1, - nexist: nexist$1, - nexists: nexists$1, - nfr: nfr$1, - ngE: ngE$1, - nge: nge$1, - ngeq: ngeq$1, - ngeqq: ngeqq$1, - ngeqslant: ngeqslant$1, - nges: nges$1, - ngsim: ngsim$1, - ngt: ngt$1, - ngtr: ngtr$1, - nhArr: nhArr$1, - nharr: nharr$1, - nhpar: nhpar$1, - ni: ni$1, - nis: nis$1, - nisd: nisd$1, - niv: niv$1, - njcy: njcy$1, - nlArr: nlArr$1, - nlE: nlE$1, - nlarr: nlarr$1, - nldr: nldr$1, - nle: nle$1, - nleftarrow: nleftarrow$1, - nleftrightarrow: nleftrightarrow$1, - nleq: nleq$1, - nleqq: nleqq$1, - nleqslant: nleqslant$1, - nles: nles$1, - nless: nless$1, - nlsim: nlsim$1, - nlt: nlt$1, - nltri: nltri$1, - nltrie: nltrie$1, - nmid: nmid$1, - nopf: nopf$1, - no: no$1, - not: not$1, - notin: notin$1, - notinE: notinE$1, - notindot: notindot$1, - notinva: notinva$1, - notinvb: notinvb$1, - notinvc: notinvc$1, - notni: notni$1, - notniva: notniva$1, - notnivb: notnivb$1, - notnivc: notnivc$1, - npar: npar$1, - nparallel: nparallel$1, - nparsl: nparsl$1, - npart: npart$1, - npolint: npolint$1, - npr: npr$1, - nprcue: nprcue$1, - npre: npre$1, - nprec: nprec$1, - npreceq: npreceq$1, - nrArr: nrArr$1, - nrarr: nrarr$1, - nrarrc: nrarrc$1, - nrarrw: nrarrw$1, - nrightarrow: nrightarrow$1, - nrtri: nrtri$1, - nrtrie: nrtrie$1, - nsc: nsc$1, - nsccue: nsccue$1, - nsce: nsce$1, - nscr: nscr$1, - nshortmid: nshortmid$1, - nshortparallel: nshortparallel$1, - nsim: nsim$1, - nsime: nsime$1, - nsimeq: nsimeq$1, - nsmid: nsmid$1, - nspar: nspar$1, - nsqsube: nsqsube$1, - nsqsupe: nsqsupe$1, - nsub: nsub$1, - nsubE: nsubE$1, - nsube: nsube$1, - nsubset: nsubset$1, - nsubseteq: nsubseteq$1, - nsubseteqq: nsubseteqq$1, - nsucc: nsucc$1, - nsucceq: nsucceq$1, - nsup: nsup$1, - nsupE: nsupE$1, - nsupe: nsupe$1, - nsupset: nsupset$1, - nsupseteq: nsupseteq$1, - nsupseteqq: nsupseteqq$1, - ntgl: ntgl$1, - ntild: ntild$1, - ntilde: ntilde$1, - ntlg: ntlg$1, - ntriangleleft: ntriangleleft$1, - ntrianglelefteq: ntrianglelefteq$1, - ntriangleright: ntriangleright$1, - ntrianglerighteq: ntrianglerighteq$1, - nu: nu$1, - num: num$1, - numero: numero$1, - numsp: numsp$1, - nvDash: nvDash$1, - nvHarr: nvHarr$1, - nvap: nvap$1, - nvdash: nvdash$1, - nvge: nvge$1, - nvgt: nvgt$1, - nvinfin: nvinfin$1, - nvlArr: nvlArr$1, - nvle: nvle$1, - nvlt: nvlt$1, - nvltrie: nvltrie$1, - nvrArr: nvrArr$1, - nvrtrie: nvrtrie$1, - nvsim: nvsim$1, - nwArr: nwArr$1, - nwarhk: nwarhk$1, - nwarr: nwarr$1, - nwarrow: nwarrow$1, - nwnear: nwnear$1, - oS: oS$1, - oacut: oacut$1, - oacute: oacute$1, - oast: oast$1, - ocir: ocir$1, - ocirc: ocirc$1, - ocy: ocy$1, - odash: odash$1, - odblac: odblac$1, - odiv: odiv$1, - odot: odot$1, - odsold: odsold$1, - oelig: oelig$1, - ofcir: ofcir$1, - ofr: ofr$1, - ogon: ogon$1, - ograv: ograv$1, - ograve: ograve$1, - ogt: ogt$1, - ohbar: ohbar$1, - ohm: ohm$1, - oint: oint$1, - olarr: olarr$1, - olcir: olcir$1, - olcross: olcross$1, - oline: oline$1, - olt: olt$1, - omacr: omacr$1, - omega: omega$1, - omicron: omicron$1, - omid: omid$1, - ominus: ominus$1, - oopf: oopf$1, - opar: opar$1, - operp: operp$1, - oplus: oplus$1, - or: or$1, - orarr: orarr$1, - ord: ord$1, - order: order$1, - orderof: orderof$1, - ordf: ordf$1, - ordm: ordm$1, - origof: origof$1, - oror: oror$1, - orslope: orslope$1, - orv: orv$1, - oscr: oscr$1, - oslas: oslas$1, - oslash: oslash$1, - osol: osol$1, - otild: otild$1, - otilde: otilde$1, - otimes: otimes$1, - otimesas: otimesas$1, - oum: oum$1, - ouml: ouml$1, - ovbar: ovbar$1, - par: par$1, - para: para$1, - parallel: parallel$1, - parsim: parsim$1, - parsl: parsl$1, - part: part$1, - pcy: pcy$1, - percnt: percnt$1, - period: period$1, - permil: permil$1, - perp: perp$1, - pertenk: pertenk$1, - pfr: pfr$1, - phi: phi$1, - phiv: phiv$1, - phmmat: phmmat$1, - phone: phone$1, - pi: pi$1, - pitchfork: pitchfork$1, - piv: piv$1, - planck: planck$1, - planckh: planckh$1, - plankv: plankv$1, - plus: plus$1, - plusacir: plusacir$1, - plusb: plusb$1, - pluscir: pluscir$1, - plusdo: plusdo$1, - plusdu: plusdu$1, - pluse: pluse$1, - plusm: plusm$1, - plusmn: plusmn$1, - plussim: plussim$1, - plustwo: plustwo$1, - pm: pm$1, - pointint: pointint$1, - popf: popf$1, - poun: poun$1, - pound: pound$1, - pr: pr$1, - prE: prE$1, - prap: prap$1, - prcue: prcue$1, - pre: pre$1, - prec: prec$1, - precapprox: precapprox$1, - preccurlyeq: preccurlyeq$1, - preceq: preceq$1, - precnapprox: precnapprox$1, - precneqq: precneqq$1, - precnsim: precnsim$1, - precsim: precsim$1, - prime: prime$1, - primes: primes$1, - prnE: prnE$1, - prnap: prnap$1, - prnsim: prnsim$1, - prod: prod$1, - profalar: profalar$1, - profline: profline$1, - profsurf: profsurf$1, - prop: prop$1, - propto: propto$1, - prsim: prsim$1, - prurel: prurel$1, - pscr: pscr$1, - psi: psi$1, - puncsp: puncsp$1, - qfr: qfr$1, - qint: qint$1, - qopf: qopf$1, - qprime: qprime$1, - qscr: qscr$1, - quaternions: quaternions$1, - quatint: quatint$1, - quest: quest$1, - questeq: questeq$1, - quo: quo$1, - quot: quot$1, - rAarr: rAarr$1, - rArr: rArr$1, - rAtail: rAtail$1, - rBarr: rBarr$1, - rHar: rHar$1, - race: race$1, - racute: racute$1, - radic: radic$1, - raemptyv: raemptyv$1, - rang: rang$1, - rangd: rangd$1, - range: range$1, - rangle: rangle$1, - raqu: raqu$1, - raquo: raquo$1, - rarr: rarr$1, - rarrap: rarrap$1, - rarrb: rarrb$1, - rarrbfs: rarrbfs$1, - rarrc: rarrc$1, - rarrfs: rarrfs$1, - rarrhk: rarrhk$1, - rarrlp: rarrlp$1, - rarrpl: rarrpl$1, - rarrsim: rarrsim$1, - rarrtl: rarrtl$1, - rarrw: rarrw$1, - ratail: ratail$1, - ratio: ratio$1, - rationals: rationals$1, - rbarr: rbarr$1, - rbbrk: rbbrk$1, - rbrace: rbrace$1, - rbrack: rbrack$1, - rbrke: rbrke$1, - rbrksld: rbrksld$1, - rbrkslu: rbrkslu$1, - rcaron: rcaron$1, - rcedil: rcedil$1, - rceil: rceil$1, - rcub: rcub$1, - rcy: rcy$1, - rdca: rdca$1, - rdldhar: rdldhar$1, - rdquo: rdquo$1, - rdquor: rdquor$1, - rdsh: rdsh$1, - real: real$1, - realine: realine$1, - realpart: realpart$1, - reals: reals$1, - rect: rect$1, - re: re$5, - reg: reg$1, - rfisht: rfisht$1, - rfloor: rfloor$1, - rfr: rfr$1, - rhard: rhard$1, - rharu: rharu$1, - rharul: rharul$1, - rho: rho$1, - rhov: rhov$1, - rightarrow: rightarrow$1, - rightarrowtail: rightarrowtail$1, - rightharpoondown: rightharpoondown$1, - rightharpoonup: rightharpoonup$1, - rightleftarrows: rightleftarrows$1, - rightleftharpoons: rightleftharpoons$1, - rightrightarrows: rightrightarrows$1, - rightsquigarrow: rightsquigarrow$1, - rightthreetimes: rightthreetimes$1, - ring: ring$1, - risingdotseq: risingdotseq$1, - rlarr: rlarr$1, - rlhar: rlhar$1, - rlm: rlm$1, - rmoust: rmoust$1, - rmoustache: rmoustache$1, - rnmid: rnmid$1, - roang: roang$1, - roarr: roarr$1, - robrk: robrk$1, - ropar: ropar$1, - ropf: ropf$1, - roplus: roplus$1, - rotimes: rotimes$1, - rpar: rpar$1, - rpargt: rpargt$1, - rppolint: rppolint$1, - rrarr: rrarr$1, - rsaquo: rsaquo$1, - rscr: rscr$1, - rsh: rsh$1, - rsqb: rsqb$1, - rsquo: rsquo$1, - rsquor: rsquor$1, - rthree: rthree$1, - rtimes: rtimes$1, - rtri: rtri$1, - rtrie: rtrie$1, - rtrif: rtrif$1, - rtriltri: rtriltri$1, - ruluhar: ruluhar$1, - rx: rx$1, - sacute: sacute$1, - sbquo: sbquo$1, - sc: sc$1, - scE: scE$1, - scap: scap$1, - scaron: scaron$1, - sccue: sccue$1, - sce: sce$1, - scedil: scedil$1, - scirc: scirc$1, - scnE: scnE$1, - scnap: scnap$1, - scnsim: scnsim$1, - scpolint: scpolint$1, - scsim: scsim$1, - scy: scy$1, - sdot: sdot$1, - sdotb: sdotb$1, - sdote: sdote$1, - seArr: seArr$1, - searhk: searhk$1, - searr: searr$1, - searrow: searrow$1, - sec: sec$1, - sect: sect$1, - semi: semi$1, - seswar: seswar$1, - setminus: setminus$1, - setmn: setmn$1, - sext: sext$1, - sfr: sfr$1, - sfrown: sfrown$1, - sharp: sharp$1, - shchcy: shchcy$1, - shcy: shcy$1, - shortmid: shortmid$1, - shortparallel: shortparallel$1, - sh: sh$1, - shy: shy$1, - sigma: sigma$1, - sigmaf: sigmaf$1, - sigmav: sigmav$1, - sim: sim$1, - simdot: simdot$1, - sime: sime$1, - simeq: simeq$1, - simg: simg$1, - simgE: simgE$1, - siml: siml$1, - simlE: simlE$1, - simne: simne$1, - simplus: simplus$1, - simrarr: simrarr$1, - slarr: slarr$1, - smallsetminus: smallsetminus$1, - smashp: smashp$1, - smeparsl: smeparsl$1, - smid: smid$1, - smile: smile$1, - smt: smt$1, - smte: smte$1, - smtes: smtes$1, - softcy: softcy$1, - sol: sol$1, - solb: solb$1, - solbar: solbar$1, - sopf: sopf$1, - spades: spades$1, - spadesuit: spadesuit$1, - spar: spar$1, - sqcap: sqcap$1, - sqcaps: sqcaps$1, - sqcup: sqcup$1, - sqcups: sqcups$1, - sqsub: sqsub$1, - sqsube: sqsube$1, - sqsubset: sqsubset$1, - sqsubseteq: sqsubseteq$1, - sqsup: sqsup$1, - sqsupe: sqsupe$1, - sqsupset: sqsupset$1, - sqsupseteq: sqsupseteq$1, - squ: squ$1, - square: square$1, - squarf: squarf$1, - squf: squf$1, - srarr: srarr$1, - sscr: sscr$1, - ssetmn: ssetmn$1, - ssmile: ssmile$1, - sstarf: sstarf$1, - star: star$1, - starf: starf$1, - straightepsilon: straightepsilon$1, - straightphi: straightphi$1, - strns: strns$1, - sub: sub$1, - subE: subE$1, - subdot: subdot$1, - sube: sube$1, - subedot: subedot$1, - submult: submult$1, - subnE: subnE$1, - subne: subne$1, - subplus: subplus$1, - subrarr: subrarr$1, - subset: subset$1, - subseteq: subseteq$1, - subseteqq: subseteqq$1, - subsetneq: subsetneq$1, - subsetneqq: subsetneqq$1, - subsim: subsim$1, - subsub: subsub$1, - subsup: subsup$1, - succ: succ$1, - succapprox: succapprox$1, - succcurlyeq: succcurlyeq$1, - succeq: succeq$1, - succnapprox: succnapprox$1, - succneqq: succneqq$1, - succnsim: succnsim$1, - succsim: succsim$1, - sum: sum$1, - sung: sung$1, - sup: sup$1, - sup1: sup1$1, - sup2: sup2$1, - sup3: sup3$1, - supE: supE$1, - supdot: supdot$1, - supdsub: supdsub$1, - supe: supe$1, - supedot: supedot$1, - suphsol: suphsol$1, - suphsub: suphsub$1, - suplarr: suplarr$1, - supmult: supmult$1, - supnE: supnE$1, - supne: supne$1, - supplus: supplus$1, - supset: supset$1, - supseteq: supseteq$1, - supseteqq: supseteqq$1, - supsetneq: supsetneq$1, - supsetneqq: supsetneqq$1, - supsim: supsim$1, - supsub: supsub$1, - supsup: supsup$1, - swArr: swArr$1, - swarhk: swarhk$1, - swarr: swarr$1, - swarrow: swarrow$1, - swnwar: swnwar$1, - szli: szli$1, - szlig: szlig$1, - target: target$1, - tau: tau$1, - tbrk: tbrk$1, - tcaron: tcaron$1, - tcedil: tcedil$1, - tcy: tcy$1, - tdot: tdot$1, - telrec: telrec$1, - tfr: tfr$1, - there4: there4$1, - therefore: therefore$1, - theta: theta$1, - thetasym: thetasym$1, - thetav: thetav$1, - thickapprox: thickapprox$1, - thicksim: thicksim$1, - thinsp: thinsp$1, - thkap: thkap$1, - thksim: thksim$1, - thor: thor$1, - thorn: thorn$1, - tilde: tilde$1, - time: time$1, - times: times$1, - timesb: timesb$1, - timesbar: timesbar$1, - timesd: timesd$1, - tint: tint$1, - toea: toea$1, - top: top$1, - topbot: topbot$1, - topcir: topcir$1, - topf: topf$1, - topfork: topfork$1, - tosa: tosa$1, - tprime: tprime$1, - trade: trade$1, - triangle: triangle$1, - triangledown: triangledown$1, - triangleleft: triangleleft$1, - trianglelefteq: trianglelefteq$1, - triangleq: triangleq$1, - triangleright: triangleright$1, - trianglerighteq: trianglerighteq$1, - tridot: tridot$1, - trie: trie$1, - triminus: triminus$1, - triplus: triplus$1, - trisb: trisb$1, - tritime: tritime$1, - trpezium: trpezium$1, - tscr: tscr$1, - tscy: tscy$1, - tshcy: tshcy$1, - tstrok: tstrok$1, - twixt: twixt$1, - twoheadleftarrow: twoheadleftarrow$1, - twoheadrightarrow: twoheadrightarrow$1, - uArr: uArr$1, - uHar: uHar$1, - uacut: uacut$1, - uacute: uacute$1, - uarr: uarr$1, - ubrcy: ubrcy$1, - ubreve: ubreve$1, - ucir: ucir$1, - ucirc: ucirc$1, - ucy: ucy$1, - udarr: udarr$1, - udblac: udblac$1, - udhar: udhar$1, - ufisht: ufisht$1, - ufr: ufr$1, - ugrav: ugrav$1, - ugrave: ugrave$1, - uharl: uharl$1, - uharr: uharr$1, - uhblk: uhblk$1, - ulcorn: ulcorn$1, - ulcorner: ulcorner$1, - ulcrop: ulcrop$1, - ultri: ultri$1, - umacr: umacr$1, - um: um$1, - uml: uml$1, - uogon: uogon$1, - uopf: uopf$1, - uparrow: uparrow$1, - updownarrow: updownarrow$1, - upharpoonleft: upharpoonleft$1, - upharpoonright: upharpoonright$1, - uplus: uplus$1, - upsi: upsi$1, - upsih: upsih$1, - upsilon: upsilon$1, - upuparrows: upuparrows$1, - urcorn: urcorn$1, - urcorner: urcorner$1, - urcrop: urcrop$1, - uring: uring$1, - urtri: urtri$1, - uscr: uscr$1, - utdot: utdot$1, - utilde: utilde$1, - utri: utri$1, - utrif: utrif$1, - uuarr: uuarr$1, - uum: uum$1, - uuml: uuml$1, - uwangle: uwangle$1, - vArr: vArr$1, - vBar: vBar$1, - vBarv: vBarv$1, - vDash: vDash$1, - vangrt: vangrt$1, - varepsilon: varepsilon$1, - varkappa: varkappa$1, - varnothing: varnothing$1, - varphi: varphi$1, - varpi: varpi$1, - varpropto: varpropto$1, - varr: varr$1, - varrho: varrho$1, - varsigma: varsigma$1, - varsubsetneq: varsubsetneq$1, - varsubsetneqq: varsubsetneqq$1, - varsupsetneq: varsupsetneq$1, - varsupsetneqq: varsupsetneqq$1, - vartheta: vartheta$1, - vartriangleleft: vartriangleleft$1, - vartriangleright: vartriangleright$1, - vcy: vcy$1, - vdash: vdash$1, - vee: vee$1, - veebar: veebar$1, - veeeq: veeeq$1, - vellip: vellip$1, - verbar: verbar$1, - vert: vert$1, - vfr: vfr$1, - vltri: vltri$1, - vnsub: vnsub$1, - vnsup: vnsup$1, - vopf: vopf$1, - vprop: vprop$1, - vrtri: vrtri$1, - vscr: vscr$1, - vsubnE: vsubnE$1, - vsubne: vsubne$1, - vsupnE: vsupnE$1, - vsupne: vsupne$1, - vzigzag: vzigzag$1, - wcirc: wcirc$1, - wedbar: wedbar$1, - wedge: wedge$1, - wedgeq: wedgeq$1, - weierp: weierp$1, - wfr: wfr$1, - wopf: wopf$1, - wp: wp$1, - wr: wr$1, - wreath: wreath$1, - wscr: wscr$1, - xcap: xcap$1, - xcirc: xcirc$1, - xcup: xcup$1, - xdtri: xdtri$1, - xfr: xfr$1, - xhArr: xhArr$1, - xharr: xharr$1, - xi: xi$1, - xlArr: xlArr$1, - xlarr: xlarr$1, - xmap: xmap$1, - xnis: xnis$1, - xodot: xodot$1, - xopf: xopf$1, - xoplus: xoplus$1, - xotime: xotime$1, - xrArr: xrArr$1, - xrarr: xrarr$1, - xscr: xscr$1, - xsqcup: xsqcup$1, - xuplus: xuplus$1, - xutri: xutri$1, - xvee: xvee$1, - xwedge: xwedge$1, - yacut: yacut$1, - yacute: yacute$1, - yacy: yacy$1, - ycirc: ycirc$1, - ycy: ycy$1, - ye: ye$1, - yen: yen$1, - yfr: yfr$1, - yicy: yicy$1, - yopf: yopf$1, - yscr: yscr$1, - yucy: yucy$1, - yum: yum$1, - yuml: yuml$1, - zacute: zacute$1, - zcaron: zcaron$1, - zcy: zcy$1, - zdot: zdot$1, - zeetrf: zeetrf$1, - zeta: zeta$1, - zfr: zfr$1, - zhcy: zhcy$1, - zigrarr: zigrarr$1, - zopf: zopf$1, - zscr: zscr$1, - zwj: zwj$1, - zwnj: zwnj$1 -}; - -var characterEntities$1 = require$$0$1; - -var decodeEntity_1$1 = decodeEntity$1; +/** + * Turn the number (in string form as either hexa- or plain decimal) coming from + * a numeric character reference into a character. + * + * @param {string} value + * Value to decode. + * @param {number} base + * Numeric base. + * @returns {string} + */ +function decodeNumericCharacterReference(value, base) { + const code = Number.parseInt(value, base); -var own$8 = {}.hasOwnProperty; + if ( + // C0 except for HT, LF, FF, CR, space + code < 9 || + code === 11 || + (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. + (code > 126 && code < 160) || // Lone high surrogates and low surrogates. + (code > 55295 && code < 57344) || // Noncharacters. + (code > 64975 && code < 65008) || + (code & 65535) === 65535 || + (code & 65535) === 65534 || // Out of range + code > 1114111 + ) { + return '\uFFFD' + } -function decodeEntity$1(characters) { - return own$8.call(characterEntities$1, characters) - ? characterEntities$1[characters] - : false + return String.fromCharCode(code) } -var dist = fromMarkdown$1; - -// These three are compiled away in the `dist/` +/** + * @typedef {import('micromark-util-types').Encoding} Encoding + * @typedef {import('micromark-util-types').Event} Event + * @typedef {import('micromark-util-types').ParseOptions} ParseOptions + * @typedef {import('micromark-util-types').Token} Token + * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext + * @typedef {import('micromark-util-types').Value} Value + * @typedef {Root|Root['children'][number]} Node + * @typedef {import('unist').Parent} Parent + * @typedef {import('unist').Point} Point + * @typedef {import('mdast').Break} Break + * @typedef {import('mdast').Blockquote} Blockquote + * @typedef {import('mdast').Code} Code + * @typedef {import('mdast').Definition} Definition + * @typedef {import('mdast').Emphasis} Emphasis + * @typedef {import('mdast').Heading} Heading + * @typedef {import('mdast').HTML} HTML + * @typedef {import('mdast').Image} Image + * @typedef {import('mdast').InlineCode} InlineCode + * @typedef {import('mdast').Link} Link + * @typedef {import('mdast').List} List + * @typedef {import('mdast').ListItem} ListItem + * @typedef {import('mdast').Paragraph} Paragraph + * @typedef {import('mdast').Root} Root + * @typedef {import('mdast').Strong} Strong + * @typedef {import('mdast').Text} Text + * @typedef {import('mdast').ThematicBreak} ThematicBreak + */ +const own$4 = {}.hasOwnProperty; +/** + * @param value Markdown to parse (`string` or `Buffer`). + * @param [encoding] Character encoding to understand `value` as when it’s a `Buffer` (`string`, default: `'utf8'`). + * @param [options] Configuration + */ -var toString$4 = mdastUtilToString$1; -var assign = assign_1; -var own$7 = hasOwnProperty$2; -var normalizeIdentifier$1 = normalizeIdentifier_1; -var safeFromInt = safeFromInt_1; -var parser = parse_1$1; -var preprocessor = preprocess_1; -var postprocess = postprocess_1; -var decode$1 = decodeEntity_1$1; -var stringifyPosition$2 = unistUtilStringifyPosition; +const fromMarkdown = + /** + * @type {( + * ((value: Value, encoding: Encoding, options?: Options) => Root) & + * ((value: Value, options?: Options) => Root) + * )} + */ -function fromMarkdown$1(value, encoding, options) { - if (typeof encoding !== 'string') { - options = encoding; - encoding = undefined; - } + /** + * @param {Value} value + * @param {Encoding} [encoding] + * @param {Options} [options] + * @returns {Root} + */ + function (value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding; + encoding = undefined; + } - return compiler(options)( - postprocess( - parser(options).document().write(preprocessor()(value, encoding, true)) + return compiler(options)( + postprocess( + parse(options).document().write(preprocess()(value, encoding, true)) + ) ) - ) -} + }; +/** + * Note this compiler only understand complete buffering, not streaming. + * + * @param {Options} [options] + */ -// Note this compiler only understand complete buffering, not streaming. -function compiler(options) { - var settings = options || {}; - var config = configure$2( +function compiler(options = {}) { + /** @type {NormalizedExtension} */ + // @ts-expect-error: our base has all required fields, so the result will too. + const config = configure$1( { transforms: [], canContainEols: [ @@ -42699,7 +42415,6 @@ function compiler(options) { 'paragraph', 'strong' ], - enter: { autolink: opener(link), autolinkProtocol: onenterdata, @@ -42743,7 +42458,6 @@ function compiler(options) { strong: opener(strong), thematicBreak: opener(thematicBreak) }, - exit: { atxHeading: closer(), atxHeadingSequence: onexitatxheadingsequence, @@ -42795,34 +42509,46 @@ function compiler(options) { thematicBreak: closer() } }, - - settings.mdastExtensions || [] + options.mdastExtensions || [] ); + /** @type {CompileData} */ - var data = {}; - + const data = {}; return compile + /** + * @param {Array.<Event>} events + * @returns {Root} + */ function compile(events) { - var tree = {type: 'root', children: []}; - var stack = [tree]; - var tokenStack = []; - var listStack = []; - var index = -1; - var handler; - var listStart; - - var context = { - stack: stack, - tokenStack: tokenStack, - config: config, - enter: enter, - exit: exit, - buffer: buffer, - resume: resume, - setData: setData, - getData: getData + /** @type {Root} */ + let tree = { + type: 'root', + children: [] }; + /** @type {CompileContext['stack']} */ + + const stack = [tree]; + /** @type {CompileContext['tokenStack']} */ + + const tokenStack = []; + /** @type {Array.<number>} */ + + const listStack = []; + /** @type {Omit<CompileContext, 'sliceSerialize'>} */ + + const context = { + stack, + tokenStack, + config, + enter, + exit, + buffer, + resume, + setData, + getData + }; + let index = -1; while (++index < events.length) { // We preprocess lists to add `listItem` tokens, and to infer whether @@ -42834,8 +42560,8 @@ function compiler(options) { if (events[index][0] === 'enter') { listStack.push(index); } else { - listStart = listStack.pop(index); - index = prepareList(events, listStart, index); + const tail = listStack.pop(); + index = prepareList(events, tail, index); } } } @@ -42843,64 +42569,88 @@ function compiler(options) { index = -1; while (++index < events.length) { - handler = config[events[index][0]]; + const handler = config[events[index][0]]; - if (own$7.call(handler, events[index][1].type)) { + if (own$4.call(handler, events[index][1].type)) { handler[events[index][1].type].call( - assign({sliceSerialize: events[index][2].sliceSerialize}, context), + Object.assign( + { + sliceSerialize: events[index][2].sliceSerialize + }, + context + ), events[index][1] ); } } - if (tokenStack.length) { + if (tokenStack.length > 0) { throw new Error( 'Cannot close document, a token (`' + tokenStack[tokenStack.length - 1].type + '`, ' + - stringifyPosition$2({ + stringifyPosition$1({ start: tokenStack[tokenStack.length - 1].start, end: tokenStack[tokenStack.length - 1].end }) + ') is still open' ) - } + } // Figure out `root` position. - // Figure out `root` position. tree.position = { start: point( - events.length ? events[0][1].start : {line: 1, column: 1, offset: 0} + events.length > 0 + ? events[0][1].start + : { + line: 1, + column: 1, + offset: 0 + } ), - end: point( - events.length + events.length > 0 ? events[events.length - 2][1].end - : {line: 1, column: 1, offset: 0} + : { + line: 1, + column: 1, + offset: 0 + } ) }; - index = -1; + while (++index < config.transforms.length) { tree = config.transforms[index](tree) || tree; } return tree } + /** + * @param {Array.<Event>} events + * @param {number} start + * @param {number} length + * @returns {number} + */ function prepareList(events, start, length) { - var index = start - 1; - var containerBalance = -1; - var listSpread = false; - var listItem; - var tailIndex; - var lineIndex; - var tailEvent; - var event; - var firstBlankLineIndex; - var atMarker; + let index = start - 1; + let containerBalance = -1; + let listSpread = false; + /** @type {Token|undefined} */ + + let listItem; + /** @type {number|undefined} */ + + let lineIndex; + /** @type {number|undefined} */ + + let firstBlankLineIndex; + /** @type {boolean|undefined} */ + + let atMarker; while (++index <= length) { - event = events[index]; + const event = events[index]; if ( event[1].type === 'listUnordered' || @@ -42947,11 +42697,11 @@ function compiler(options) { event[1].type === 'listOrdered')) ) { if (listItem) { - tailIndex = index; + let tailIndex = index; lineIndex = undefined; while (tailIndex--) { - tailEvent = events[tailIndex]; + const tailEvent = events[tailIndex]; if ( tailEvent[1].type === 'lineEnding' || @@ -42981,26 +42731,26 @@ function compiler(options) { firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex) ) { + // @ts-expect-error Patched. listItem._spread = true; - } + } // Fix position. - // Fix position. - listItem.end = point( + listItem.end = Object.assign( + {}, lineIndex ? events[lineIndex][1].start : event[1].end ); - events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]); index++; length++; - } + } // Create a new list item. - // Create a new list item. if (event[1].type === 'listItemPrefix') { listItem = { type: 'listItem', + // @ts-expect-error Patched _spread: false, - start: point(event[1].start) - }; + start: Object.assign({}, event[1].start) + }; // @ts-expect-error: `listItem` is most definitely defined, TS... events.splice(index, 0, ['enter', listItem, event[2]]); index++; @@ -43009,64 +42759,124 @@ function compiler(options) { atMarker = true; } } - } + } // @ts-expect-error Patched. events[start][1]._spread = listSpread; return length } + /** + * @type {CompileContext['setData']} + * @param [value] + */ function setData(key, value) { data[key] = value; } + /** + * @type {CompileContext['getData']} + * @template {string} K + * @param {K} key + * @returns {CompileData[K]} + */ function getData(key) { return data[key] } + /** + * @param {Point} d + * @returns {Point} + */ function point(d) { - return {line: d.line, column: d.column, offset: d.offset} + return { + line: d.line, + column: d.column, + offset: d.offset + } } + /** + * @param {(token: Token) => Node} create + * @param {Handle} [and] + * @returns {Handle} + */ function opener(create, and) { return open + /** + * @this {CompileContext} + * @param {Token} token + * @returns {void} + */ function open(token) { enter.call(this, create(token), token); if (and) and.call(this, token); } } + /** @type {CompileContext['buffer']} */ function buffer() { - this.stack.push({type: 'fragment', children: []}); + // @ts-expect-error: Custom node type to collect text. + this.stack.push({ + type: 'fragment', + children: [] + }); } + /** + * @type {CompileContext['enter']} + * @template {Node} N + * @this {CompileContext} + * @param {N} node + * @param {Token} token + * @returns {N} + */ function enter(node, token) { - this.stack[this.stack.length - 1].children.push(node); + /** @type {Parent} */ + // @ts-expect-error: Assume parent. + const parent = this.stack[this.stack.length - 1]; + parent.children.push(node); this.stack.push(node); - this.tokenStack.push(token); - node.position = {start: point(token.start)}; + this.tokenStack.push(token); // @ts-expect-error: `end` will be patched later. + + node.position = { + start: point(token.start) + }; return node } + /** + * @param {Handle} [and] + * @returns {Handle} + */ function closer(and) { return close + /** + * @this {CompileContext} + * @param {Token} token + * @returns {void} + */ function close(token) { if (and) and.call(this, token); exit.call(this, token); } } + /** @type {CompileContext['exit']} */ function exit(token) { - var node = this.stack.pop(); - var open = this.tokenStack.pop(); + const node = this.stack.pop(); + const open = this.tokenStack.pop(); if (!open) { throw new Error( 'Cannot close `' + token.type + '` (' + - stringifyPosition$2({start: token.start, end: token.end}) + + stringifyPosition$1({ + start: token.start, + end: token.end + }) + '): it’s not open' ) } else if (open.type !== token.type) { @@ -43074,11 +42884,17 @@ function compiler(options) { 'Cannot close `' + token.type + '` (' + - stringifyPosition$2({start: token.start, end: token.end}) + + stringifyPosition$1({ + start: token.start, + end: token.end + }) + '): a different token (`' + open.type + '`, ' + - stringifyPosition$2({start: open.start, end: open.end}) + + stringifyPosition$1({ + start: open.start, + end: open.end + }) + ') is open' ) } @@ -43086,39 +42902,46 @@ function compiler(options) { node.position.end = point(token.end); return node } + /** + * @this {CompileContext} + * @returns {string} + */ function resume() { - return toString$4(this.stack.pop()) - } - - // + return toString(this.stack.pop()) + } // // Handlers. // + /** @type {Handle} */ + function onenterlistordered() { setData('expectingFirstListItemValue', true); } + /** @type {Handle} */ function onenterlistitemvalue(token) { if (getData('expectingFirstListItemValue')) { - this.stack[this.stack.length - 2].start = parseInt( + this.stack[this.stack.length - 2].start = Number.parseInt( this.sliceSerialize(token), 10 ); - setData('expectingFirstListItemValue'); } } + /** @type {Handle} */ function onexitcodefencedfenceinfo() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].lang = data; } + /** @type {Handle} */ function onexitcodefencedfencemeta() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].meta = data; } + /** @type {Handle} */ function onexitcodefencedfence() { // Exit if this is the closing fence. @@ -43126,127 +42949,149 @@ function compiler(options) { this.buffer(); setData('flowCodeInside', true); } + /** @type {Handle} */ function onexitcodefenced() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].value = data.replace( /^(\r?\n|\r)|(\r?\n|\r)$/g, '' ); - setData('flowCodeInside'); } + /** @type {Handle} */ function onexitcodeindented() { - var data = this.resume(); - this.stack[this.stack.length - 1].value = data; + const data = this.resume(); + this.stack[this.stack.length - 1].value = data.replace(/(\r?\n|\r)$/g, ''); } + /** @type {Handle} */ function onexitdefinitionlabelstring(token) { // Discard label, use the source content instead. - var label = this.resume(); + const label = this.resume(); this.stack[this.stack.length - 1].label = label; - this.stack[this.stack.length - 1].identifier = normalizeIdentifier$1( + this.stack[this.stack.length - 1].identifier = normalizeIdentifier( this.sliceSerialize(token) ).toLowerCase(); } + /** @type {Handle} */ function onexitdefinitiontitlestring() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].title = data; } + /** @type {Handle} */ function onexitdefinitiondestinationstring() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].url = data; } + /** @type {Handle} */ function onexitatxheadingsequence(token) { if (!this.stack[this.stack.length - 1].depth) { - this.stack[this.stack.length - 1].depth = this.sliceSerialize( - token - ).length; + this.stack[this.stack.length - 1].depth = + this.sliceSerialize(token).length; } } + /** @type {Handle} */ function onexitsetextheadingtext() { setData('setextHeadingSlurpLineEnding', true); } + /** @type {Handle} */ function onexitsetextheadinglinesequence(token) { this.stack[this.stack.length - 1].depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2; } + /** @type {Handle} */ function onexitsetextheading() { setData('setextHeadingSlurpLineEnding'); } + /** @type {Handle} */ function onenterdata(token) { - var siblings = this.stack[this.stack.length - 1].children; - var tail = siblings[siblings.length - 1]; + /** @type {Parent} */ + // @ts-expect-error: assume parent. + const parent = this.stack[this.stack.length - 1]; + /** @type {Node} */ + // @ts-expect-error: assume child. + + let tail = parent.children[parent.children.length - 1]; if (!tail || tail.type !== 'text') { // Add a new text node. - tail = text(); - tail.position = {start: point(token.start)}; - this.stack[this.stack.length - 1].children.push(tail); + tail = text(); // @ts-expect-error: we’ll add `end` later. + + tail.position = { + start: point(token.start) + }; + parent.children.push(tail); } this.stack.push(tail); } + /** @type {Handle} */ function onexitdata(token) { - var tail = this.stack.pop(); + const tail = this.stack.pop(); tail.value += this.sliceSerialize(token); tail.position.end = point(token.end); } + /** @type {Handle} */ function onexitlineending(token) { - var context = this.stack[this.stack.length - 1]; + /** @type {Parent} */ + // @ts-expect-error: supposed to be a parent. + const context = this.stack[this.stack.length - 1]; // If we’re at a hard break, include the line ending in there. if (getData('atHardBreak')) { - context.children[context.children.length - 1].position.end = point( - token.end - ); - + const tail = context.children[context.children.length - 1]; + tail.position.end = point(token.end); setData('atHardBreak'); return } if ( !getData('setextHeadingSlurpLineEnding') && - config.canContainEols.indexOf(context.type) > -1 + config.canContainEols.includes(context.type) ) { onenterdata.call(this, token); onexitdata.call(this, token); } } + /** @type {Handle} */ function onexithardbreak() { setData('atHardBreak', true); } + /** @type {Handle} */ function onexithtmlflow() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].value = data; } + /** @type {Handle} */ function onexithtmltext() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].value = data; } + /** @type {Handle} */ function onexitcodetext() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].value = data; } + /** @type {Handle} */ function onexitlink() { - var context = this.stack[this.stack.length - 1]; + const context = this.stack[this.stack.length - 1]; // To do: clean. - // To do: clean. if (getData('inReference')) { context.type += 'Reference'; context.referenceType = getData('referenceType') || 'shortcut'; @@ -43260,11 +43105,11 @@ function compiler(options) { setData('referenceType'); } + /** @type {Handle} */ function onexitimage() { - var context = this.stack[this.stack.length - 1]; + const context = this.stack[this.stack.length - 1]; // To do: clean. - // To do: clean. if (getData('inReference')) { context.type += 'Reference'; context.referenceType = getData('referenceType') || 'shortcut'; @@ -43278,20 +43123,20 @@ function compiler(options) { setData('referenceType'); } + /** @type {Handle} */ function onexitlabeltext(token) { - this.stack[this.stack.length - 2].identifier = normalizeIdentifier$1( + this.stack[this.stack.length - 2].identifier = normalizeIdentifier( this.sliceSerialize(token) ).toLowerCase(); } + /** @type {Handle} */ function onexitlabel() { - var fragment = this.stack[this.stack.length - 1]; - var value = this.resume(); - - this.stack[this.stack.length - 1].label = value; + const fragment = this.stack[this.stack.length - 1]; + const value = this.resume(); + this.stack[this.stack.length - 1].label = value; // Assume a reference. - // Assume a reference. setData('inReference', true); if (this.stack[this.stack.length - 1].type === 'link') { @@ -43300,225 +43145,374 @@ function compiler(options) { this.stack[this.stack.length - 1].alt = value; } } + /** @type {Handle} */ function onexitresourcedestinationstring() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].url = data; } + /** @type {Handle} */ function onexitresourcetitlestring() { - var data = this.resume(); + const data = this.resume(); this.stack[this.stack.length - 1].title = data; } + /** @type {Handle} */ function onexitresource() { setData('inReference'); } + /** @type {Handle} */ function onenterreference() { setData('referenceType', 'collapsed'); } + /** @type {Handle} */ function onexitreferencestring(token) { - var label = this.resume(); + const label = this.resume(); this.stack[this.stack.length - 1].label = label; - this.stack[this.stack.length - 1].identifier = normalizeIdentifier$1( + this.stack[this.stack.length - 1].identifier = normalizeIdentifier( this.sliceSerialize(token) ).toLowerCase(); setData('referenceType', 'full'); } + /** @type {Handle} */ function onexitcharacterreferencemarker(token) { setData('characterReferenceType', token.type); } + /** @type {Handle} */ function onexitcharacterreferencevalue(token) { - var data = this.sliceSerialize(token); - var type = getData('characterReferenceType'); - var value; - var tail; + const data = this.sliceSerialize(token); + const type = getData('characterReferenceType'); + /** @type {string} */ + + let value; if (type) { - value = safeFromInt( + value = decodeNumericCharacterReference( data, type === 'characterReferenceMarkerNumeric' ? 10 : 16 ); - setData('characterReferenceType'); } else { - value = decode$1(data); + // @ts-expect-error `decodeEntity` can return false for invalid named + // character references, but everything we’ve tokenized is valid. + value = decodeEntity(data); } - tail = this.stack.pop(); + const tail = this.stack.pop(); tail.value += value; tail.position.end = point(token.end); } + /** @type {Handle} */ function onexitautolinkprotocol(token) { onexitdata.call(this, token); this.stack[this.stack.length - 1].url = this.sliceSerialize(token); } + /** @type {Handle} */ function onexitautolinkemail(token) { onexitdata.call(this, token); this.stack[this.stack.length - 1].url = 'mailto:' + this.sliceSerialize(token); - } - - // + } // // Creaters. // + /** @returns {Blockquote} */ + function blockQuote() { - return {type: 'blockquote', children: []} + return { + type: 'blockquote', + children: [] + } } + /** @returns {Code} */ function codeFlow() { - return {type: 'code', lang: null, meta: null, value: ''} + // @ts-expect-error: we’ve always used `null`. + return { + type: 'code', + lang: null, + meta: null, + value: '' + } } + /** @returns {InlineCode} */ function codeText() { - return {type: 'inlineCode', value: ''} + return { + type: 'inlineCode', + value: '' + } } + /** @returns {Definition} */ function definition() { return { type: 'definition', identifier: '', + // @ts-expect-error: we’ve always used `null`. label: null, + // @ts-expect-error: we’ve always used `null`. title: null, url: '' } } + /** @returns {Emphasis} */ function emphasis() { - return {type: 'emphasis', children: []} + return { + type: 'emphasis', + children: [] + } } + /** @returns {Heading} */ function heading() { - return {type: 'heading', depth: undefined, children: []} + // @ts-expect-error `depth` will be set later. + return { + type: 'heading', + depth: undefined, + children: [] + } } + /** @returns {Break} */ function hardBreak() { - return {type: 'break'} + return { + type: 'break' + } } + /** @returns {HTML} */ function html() { - return {type: 'html', value: ''} + return { + type: 'html', + value: '' + } } + /** @returns {Image} */ function image() { - return {type: 'image', title: null, url: '', alt: null} + // @ts-expect-error: we’ve always used `null`. + return { + type: 'image', + title: null, + url: '', + alt: null + } } + /** @returns {Link} */ function link() { - return {type: 'link', title: null, url: '', children: []} + // @ts-expect-error: we’ve always used `null`. + return { + type: 'link', + title: null, + url: '', + children: [] + } } + /** + * @param {Token} token + * @returns {List} + */ function list(token) { return { type: 'list', ordered: token.type === 'listOrdered', + // @ts-expect-error: we’ve always used `null`. start: null, + // @ts-expect-error Patched. spread: token._spread, children: [] } } + /** + * @param {Token} token + * @returns {ListItem} + */ function listItem(token) { return { type: 'listItem', + // @ts-expect-error Patched. spread: token._spread, + // @ts-expect-error: we’ve always used `null`. checked: null, children: [] } } + /** @returns {Paragraph} */ function paragraph() { - return {type: 'paragraph', children: []} + return { + type: 'paragraph', + children: [] + } } + /** @returns {Strong} */ function strong() { - return {type: 'strong', children: []} + return { + type: 'strong', + children: [] + } } + /** @returns {Text} */ function text() { - return {type: 'text', value: ''} + return { + type: 'text', + value: '' + } } + /** @returns {ThematicBreak} */ function thematicBreak() { - return {type: 'thematicBreak'} + return { + type: 'thematicBreak' + } } } +/** + * @param {Extension} combined + * @param {Array.<Extension|Array.<Extension>>} extensions + * @returns {Extension} + */ -function configure$2(config, extensions) { - var index = -1; +function configure$1(combined, extensions) { + let index = -1; while (++index < extensions.length) { - extension(config, extensions[index]); + const value = extensions[index]; + + if (Array.isArray(value)) { + configure$1(combined, value); + } else { + extension(combined, value); + } } - return config + return combined } +/** + * @param {Extension} combined + * @param {Extension} extension + * @returns {void} + */ -function extension(config, extension) { - var key; - var left; +function extension(combined, extension) { + /** @type {string} */ + let key; for (key in extension) { - left = own$7.call(config, key) ? config[key] : (config[key] = {}); + if (own$4.call(extension, key)) { + const list = key === 'canContainEols' || key === 'transforms'; + const maybe = own$4.call(combined, key) ? combined[key] : undefined; + /* c8 ignore next */ - if (key === 'canContainEols' || key === 'transforms') { - config[key] = [].concat(left, extension[key]); - } else { - Object.assign(left, extension[key]); + const left = maybe || (combined[key] = list ? [] : {}); + const right = extension[key]; + + if (right) { + if (list) { + // @ts-expect-error: `left` is an array. + combined[key] = [...left, ...right]; + } else { + Object.assign(left, right); + } + } } } } -var mdastUtilFromMarkdown = dist; - -var remarkParse = parse$2; - -var fromMarkdown = mdastUtilFromMarkdown; - -function parse$2(options) { - var self = this; +/** + * @typedef {import('mdast').Root} Root + * @typedef {import('mdast-util-from-markdown').Options} Options + */ - this.Parser = parse; +/** @type {import('unified').Plugin<[Options?] | void[], string, Root>} */ +function remarkParse(options) { + /** @type {import('unified').ParserFunction<Root>} */ + const parser = (doc) => { + // Assume options. + const settings = /** @type {Options} */ (this.data('settings')); - function parse(doc) { return fromMarkdown( doc, - Object.assign({}, self.data('settings'), options, { + Object.assign({}, settings, options, { // Note: these options are not in the readme. // The goal is for them to be set by plugins on `data` instead of being // passed by users. - extensions: self.data('micromarkExtensions') || [], - mdastExtensions: self.data('fromMarkdownExtensions') || [] + extensions: this.data('micromarkExtensions') || [], + mdastExtensions: this.data('fromMarkdownExtensions') || [] }) ) - } + }; + + Object.assign(this, {Parser: parser}); } -var zwitch$1 = factory$4; +var own$3 = {}.hasOwnProperty; -var noop$1 = Function.prototype; -var own$6 = {}.hasOwnProperty; +/** + * @callback Handler + * @param {...unknown} value + * @return {unknown} + * + * @typedef {Record<string, Handler>} Handlers + * + * @typedef {Object} Options + * @property {Handler} [unknown] + * @property {Handler} [invalid] + * @property {Handlers} [handlers] + */ -// Handle values based on a property. -function factory$4(key, options) { +/** + * Handle values based on a property. + * + * @param {string} key + * @param {Options} [options] + */ +function zwitch(key, options) { var settings = options || {}; + /** + * Handle one value. + * Based on the bound `key`, a respective handler will be called. + * If `value` is not an object, or doesn’t have a `key` property, the special + * “invalid” handler will be called. + * If `value` has an unknown `key`, the special “unknown” handler will be + * called. + * + * All arguments, and the context object, are passed through to the handler, + * and it’s result is returned. + * + * @param {...unknown} [value] + * @this {unknown} + * @returns {unknown} + * @property {Handler} invalid + * @property {Handler} unknown + * @property {Handlers} handlers + */ function one(value) { var fn = one.invalid; var handlers = one.handlers; - if (value && own$6.call(value, key)) { - fn = own$6.call(handlers, value[key]) ? handlers[value[key]] : one.unknown; + if (value && own$3.call(value, key)) { + fn = own$3.call(handlers, value[key]) ? handlers[value[key]] : one.unknown; } - return (fn || noop$1).apply(this, arguments) + if (fn) { + return fn.apply(this, arguments) + } } one.handlers = settings.handlers || {}; @@ -43528,25 +43522,37 @@ function factory$4(key, options) { return one } -var configure_1 = configure$1; +/** + * @typedef {import('./types.js').Options} Options + * @typedef {import('./types.js').Context} Context + */ -function configure$1(base, extension) { - var index = -1; - var key; +/** + * @param {Context} base + * @param {Options} extension + * @returns {Context} + */ +function configure(base, extension) { + let index = -1; + /** @type {string} */ + let key; // First do subextensions. if (extension.extensions) { while (++index < extension.extensions.length) { - configure$1(base, extension.extensions[index]); + configure(base, extension.extensions[index]); } } for (key in extension) { if (key === 'extensions') ; else if (key === 'unsafe' || key === 'join') { - base[key] = base[key].concat(extension[key] || []); + /* c8 ignore next 2 */ + // @ts-expect-error: hush. + base[key] = [...(base[key] || []), ...(extension[key] || [])]; } else if (key === 'handlers') { base[key] = Object.assign(base[key], extension[key] || {}); } else { + // @ts-expect-error: hush. base.options[key] = extension[key]; } } @@ -43554,37 +43560,49 @@ function configure$1(base, extension) { return base } -var handle = {}; - -var containerFlow$1 = flow$4; - -var repeat$5 = repeatString; +/** + * @typedef {import('../types.js').Node} Node + * @typedef {import('../types.js').Parent} Parent + * @typedef {import('../types.js').Join} Join + * @typedef {import('../types.js').Context} Context + */ -function flow$4(parent, context) { - var children = parent.children || []; - var results = []; - var index = -1; - var child; +/** + * @param {Parent} parent + * @param {Context} context + * @returns {string} + */ +function containerFlow(parent, context) { + const children = parent.children || []; + /** @type {Array.<string>} */ + const results = []; + let index = -1; while (++index < children.length) { - child = children[index]; + const child = children[index]; results.push( context.handle(child, parent, context, {before: '\n', after: '\n'}) ); - if (index + 1 < children.length) { + if (index < children.length - 1) { results.push(between(child, children[index + 1])); } } return results.join('') + /** + * @param {Node} left + * @param {Node} right + * @returns {string} + */ function between(left, right) { - var index = -1; - var result; + let index = context.join.length; + /** @type {ReturnType<Join>} */ + let result; - while (++index < context.join.length) { + while (index--) { result = context.join[index](left, right, parent, context); if (result === true || result === 1) { @@ -43592,7 +43610,7 @@ function flow$4(parent, context) { } if (typeof result === 'number') { - return repeat$5('\n', 1 + Number(result)) + return '\n'.repeat(1 + result) } if (result === false) { @@ -43604,17 +43622,30 @@ function flow$4(parent, context) { } } -var indentLines_1 = indentLines$4; +/** + * @callback Map + * @param {string} value + * @param {number} line + * @param {boolean} blank + * @returns {string} + */ -var eol$1 = /\r?\n|\r/g; +const eol = /\r?\n|\r/g; -function indentLines$4(value, map) { - var result = []; - var start = 0; - var line = 0; - var match; +/** + * @param {string} value + * @param {Map} map + * @returns {string} + */ +function indentLines(value, map) { + /** @type {Array.<string>} */ + const result = []; + let start = 0; + let line = 0; + /** @type {RegExpExecArray|null} */ + let match; - while ((match = eol$1.exec(value))) { + while ((match = eol.exec(value))) { one(value.slice(start, match.index)); result.push(match[0]); start = match.index + match[0].length; @@ -43625,39 +43656,59 @@ function indentLines$4(value, map) { return result.join('') + /** + * @param {string} value + */ function one(value) { result.push(map(value, line, !value)); } } -var blockquote_1 = blockquote; - -var flow$3 = containerFlow$1; -var indentLines$3 = indentLines_1; +/** + * @typedef {import('mdast').Blockquote} Blockquote + * @typedef {import('../types.js').Handle} Handle + * @typedef {import('../util/indent-lines.js').Map} Map + */ +/** + * @type {Handle} + * @param {Blockquote} node + */ function blockquote(node, _, context) { - var exit = context.enter('blockquote'); - var value = indentLines$3(flow$3(node, context), map$3); + const exit = context.enter('blockquote'); + const value = indentLines(containerFlow(node, context), map$1); exit(); return value } -function map$3(line, index, blank) { +/** @type {Map} */ +function map$1(line, _, blank) { return '>' + (blank ? '' : ' ') + line } -var patternInScope_1 = patternInScope$2; +/** + * @typedef {import('../types.js').Unsafe} Unsafe + */ -function patternInScope$2(stack, pattern) { +/** + * @param {Array.<string>} stack + * @param {Unsafe} pattern + * @returns {boolean} + */ +function patternInScope(stack, pattern) { return ( listInScope(stack, pattern.inConstruct, true) && - !listInScope(stack, pattern.notInConstruct) + !listInScope(stack, pattern.notInConstruct, false) ) } +/** + * @param {Array.<string>} stack + * @param {Unsafe['inConstruct']} list + * @param {boolean} none + * @returns {boolean} + */ function listInScope(stack, list, none) { - var index; - if (!list) { return none } @@ -43666,10 +43717,10 @@ function listInScope(stack, list, none) { list = [list]; } - index = -1; + let index = -1; while (++index < list.length) { - if (stack.indexOf(list[index]) !== -1) { + if (stack.includes(list[index])) { return true } } @@ -43677,19 +43728,24 @@ function listInScope(stack, list, none) { return false } -var _break = hardBreak; - -var patternInScope$1 = patternInScope_1; +/** + * @typedef {import('../types.js').Handle} Handle + * @typedef {import('mdast').Break} Break + */ -function hardBreak(node, _, context, safe) { - var index = -1; +/** + * @type {Handle} + * @param {Break} _ + */ +function hardBreak(_, _1, context, safe) { + let index = -1; while (++index < context.unsafe.length) { // If we can’t put eols in this construct (setext headings, tables), use a // space instead. if ( context.unsafe[index].character === '\n' && - patternInScope$1(context.stack, context.unsafe[index]) + patternInScope(context.stack, context.unsafe[index]) ) { return /[ \t]/.test(safe.before) ? '' : ' ' } @@ -43698,60 +43754,74 @@ function hardBreak(node, _, context, safe) { return '\\\n' } -var longestStreak_1 = longestStreak; - -// Get the count of the longest repeating streak of `character` in `value`. +/** + * Get the count of the longest repeating streak of `character` in `value`. + * + * @param {string} value Content. + * @param {string} character Single character to look for + * @returns {number} Count of most frequent adjacent `character`s in `value` + */ function longestStreak(value, character) { + var source = String(value); + var index = source.indexOf(character); + var expected = index; var count = 0; - var maximum = 0; - var expected; - var index; + var max = 0; if (typeof character !== 'string' || character.length !== 1) { throw new Error('Expected character') } - value = String(value); - index = value.indexOf(character); - expected = index; - while (index !== -1) { - count++; - if (index === expected) { - if (count > maximum) { - maximum = count; + if (++count > max) { + max = count; } } else { count = 1; } expected = index + 1; - index = value.indexOf(character, expected); + index = source.indexOf(character, expected); } - return maximum + return max } -var formatCodeAsIndented_1 = formatCodeAsIndented$2; +/** + * @typedef {import('mdast').Code} Code + * @typedef {import('../types.js').Context} Context + */ -function formatCodeAsIndented$2(node, context) { - return ( +/** + * @param {Code} node + * @param {Context} context + * @returns {boolean} + */ +function formatCodeAsIndented(node, context) { + return Boolean( !context.options.fences && - node.value && - // If there’s no info… - !node.lang && - // And there’s a non-whitespace character… - /[^ \r\n]/.test(node.value) && - // And the value doesn’t start or end in a blank… - !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value) + node.value && + // If there’s no info… + !node.lang && + // And there’s a non-whitespace character… + /[^ \r\n]/.test(node.value) && + // And the value doesn’t start or end in a blank… + !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value) ) } -var checkFence_1 = checkFence$1; +/** + * @typedef {import('../types.js').Context} Context + * @typedef {import('../types.js').Options} Options + */ -function checkFence$1(context) { - var marker = context.options.fence || '`'; +/** + * @param {Context} context + * @returns {Exclude<Options['fence'], undefined>} + */ +function checkFence(context) { + const marker = context.options.fence || '`'; if (marker !== '`' && marker !== '~') { throw new Error( @@ -43764,25 +43834,25 @@ function checkFence$1(context) { return marker } -var patternCompile_1 = patternCompile$3; - -function patternCompile$3(pattern) { - var before; - var after; +/** + * @typedef {import('../types.js').Unsafe} Unsafe + */ +/** + * @param {Unsafe} pattern + * @returns {RegExp} + */ +function patternCompile(pattern) { if (!pattern._compiled) { - before = pattern.before ? '(?:' + pattern.before + ')' : ''; - after = pattern.after ? '(?:' + pattern.after + ')' : ''; - - if (pattern.atBreak) { - before = '[\\r\\n][\\t ]*' + before; - } + const before = + (pattern.atBreak ? '[\\r\\n][\\t ]*' : '') + + (pattern.before ? '(?:' + pattern.before + ')' : ''); pattern._compiled = new RegExp( (before ? '(' + before + ')' : '') + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') + pattern.character + - (after || ''), + (pattern.after ? '(?:' + pattern.after + ')' : ''), 'g' ); } @@ -43790,45 +43860,44 @@ function patternCompile$3(pattern) { return pattern._compiled } -var safe_1 = safe$7; - -var patternCompile$2 = patternCompile_1; -var patternInScope = patternInScope_1; +/** + * @typedef {import('../types.js').Context} Context + * @typedef {import('../types.js').SafeOptions} SafeOptions + */ -function safe$7(context, input, config) { - var value = (config.before || '') + (input || '') + (config.after || ''); - var positions = []; - var result = []; - var infos = {}; - var index = -1; - var before; - var after; - var position; - var pattern; - var expression; - var match; - var start; - var end; +/** + * @param {Context} context + * @param {string|null|undefined} input + * @param {SafeOptions & {encode?: Array.<string>}} config + * @returns {string} + */ +function safe(context, input, config) { + const value = (config.before || '') + (input || '') + (config.after || ''); + /** @type {Array.<number>} */ + const positions = []; + /** @type {Array.<string>} */ + const result = []; + /** @type {Record<number, {before: boolean, after: boolean}>} */ + const infos = {}; + let index = -1; while (++index < context.unsafe.length) { - pattern = context.unsafe[index]; + const pattern = context.unsafe[index]; if (!patternInScope(context.stack, pattern)) { continue } - expression = patternCompile$2(pattern); + const expression = patternCompile(pattern); + /** @type {RegExpExecArray|null} */ + let match; while ((match = expression.exec(value))) { - before = 'before' in pattern || pattern.atBreak; - after = 'after' in pattern; - - position = match.index + (before ? match[1].length : 0); + const before = 'before' in pattern || Boolean(pattern.atBreak); + const after = 'after' in pattern; + const position = match.index + (before ? match[1].length : 0); - if (positions.indexOf(position) === -1) { - positions.push(position); - infos[position] = {before: before, after: after}; - } else { + if (positions.includes(position)) { if (infos[position].before && !before) { infos[position].before = false; } @@ -43836,24 +43905,24 @@ function safe$7(context, input, config) { if (infos[position].after && !after) { infos[position].after = false; } + } else { + positions.push(position); + infos[position] = {before, after}; } } } positions.sort(numerical); - start = config.before ? config.before.length : 0; - end = value.length - (config.after ? config.after.length : 0); + let start = config.before ? config.before.length : 0; + const end = value.length - (config.after ? config.after.length : 0); index = -1; while (++index < positions.length) { - position = positions[index]; + const position = positions[index]; - if ( - // Character before or after matched: - position < start || - position >= end - ) { + // Character before or after matched: + if (position < start || position >= end) { continue } @@ -43881,7 +43950,7 @@ function safe$7(context, input, config) { if ( /[!-/:-@[-`{-~]/.test(value.charAt(position)) && - (!config.encode || config.encode.indexOf(value.charAt(position)) === -1) + (!config.encode || !config.encode.includes(value.charAt(position))) ) { // Character escape. result.push('\\'); @@ -43899,18 +43968,31 @@ function safe$7(context, input, config) { return result.join('') } +/** + * @param {number} a + * @param {number} b + * @returns {number} + */ function numerical(a, b) { return a - b } +/** + * @param {string} value + * @param {string} after + * @returns {string} + */ function escapeBackslashes(value, after) { - var expression = /\\(?=[!-/:-@[-`{-~])/g; - var positions = []; - var results = []; - var index = -1; - var start = 0; - var whole = value + after; - var match; + const expression = /\\(?=[!-/:-@[-`{-~])/g; + /** @type {Array.<number>} */ + const positions = []; + /** @type {Array.<string>} */ + const results = []; + const whole = value + after; + let index = -1; + let start = 0; + /** @type {RegExpExecArray|null} */ + let match; while ((match = expression.exec(whole))) { positions.push(match.index); @@ -43930,35 +44012,39 @@ function escapeBackslashes(value, after) { return results.join('') } -var code_1 = code$1; - -var repeat$4 = repeatString; -var streak = longestStreak_1; -var formatCodeAsIndented$1 = formatCodeAsIndented_1; -var checkFence = checkFence_1; -var indentLines$2 = indentLines_1; -var safe$6 = safe_1; +/** + * @typedef {import('mdast').Code} Code + * @typedef {import('../types.js').Handle} Handle + * @typedef {import('../types.js').Exit} Exit + * @typedef {import('../util/indent-lines.js').Map} Map + */ +/** + * @type {Handle} + * @param {Code} node + */ function code$1(node, _, context) { - var marker = checkFence(context); - var raw = node.value || ''; - var suffix = marker === '`' ? 'GraveAccent' : 'Tilde'; - var value; - var sequence; - var exit; - var subexit; - - if (formatCodeAsIndented$1(node, context)) { + const marker = checkFence(context); + const raw = node.value || ''; + const suffix = marker === '`' ? 'GraveAccent' : 'Tilde'; + /** @type {string} */ + let value; + /** @type {Exit} */ + let exit; + + if (formatCodeAsIndented(node, context)) { exit = context.enter('codeIndented'); - value = indentLines$2(raw, map$2); + value = indentLines(raw, map); } else { - sequence = repeat$4(marker, Math.max(streak(raw, marker) + 1, 3)); + const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3)); + /** @type {Exit} */ + let subexit; exit = context.enter('codeFenced'); value = sequence; if (node.lang) { subexit = context.enter('codeFencedLang' + suffix); - value += safe$6(context, node.lang, { + value += safe(context, node.lang, { before: '`', after: ' ', encode: ['`'] @@ -43970,7 +44056,7 @@ function code$1(node, _, context) { subexit = context.enter('codeFencedMeta' + suffix); value += ' ' + - safe$6(context, node.meta, { + safe(context, node.meta, { before: ' ', after: '\n', encode: ['`'] @@ -43991,4485 +44077,34 @@ function code$1(node, _, context) { return value } -function map$2(line, _, blank) { +/** @type {Map} */ +function map(line, _, blank) { return (blank ? '' : ' ') + line } -const AEli = "Æ"; -const AElig = "Æ"; -const AM = "&"; -const AMP = "&"; -const Aacut = "Á"; -const Aacute = "Á"; -const Abreve = "Ă"; -const Acir = "Â"; -const Acirc = "Â"; -const Acy = "А"; -const Afr = "𝔄"; -const Agrav = "À"; -const Agrave = "À"; -const Alpha = "Α"; -const Amacr = "Ā"; -const And = "⩓"; -const Aogon = "Ą"; -const Aopf = "𝔸"; -const ApplyFunction = ""; -const Arin = "Å"; -const Aring = "Å"; -const Ascr = "𝒜"; -const Assign = "≔"; -const Atild = "Ã"; -const Atilde = "Ã"; -const Aum = "Ä"; -const Auml = "Ä"; -const Backslash = "∖"; -const Barv = "⫧"; -const Barwed = "⌆"; -const Bcy = "Б"; -const Because = "∵"; -const Bernoullis = "ℬ"; -const Beta = "Β"; -const Bfr = "𝔅"; -const Bopf = "𝔹"; -const Breve = "˘"; -const Bscr = "ℬ"; -const Bumpeq = "≎"; -const CHcy = "Ч"; -const COP = "©"; -const COPY = "©"; -const Cacute = "Ć"; -const Cap = "⋒"; -const CapitalDifferentialD = "ⅅ"; -const Cayleys = "ℭ"; -const Ccaron = "Č"; -const Ccedi = "Ç"; -const Ccedil = "Ç"; -const Ccirc = "Ĉ"; -const Cconint = "∰"; -const Cdot = "Ċ"; -const Cedilla = "¸"; -const CenterDot = "·"; -const Cfr = "ℭ"; -const Chi = "Χ"; -const CircleDot = "⊙"; -const CircleMinus = "⊖"; -const CirclePlus = "⊕"; -const CircleTimes = "⊗"; -const ClockwiseContourIntegral = "∲"; -const CloseCurlyDoubleQuote = "”"; -const CloseCurlyQuote = "’"; -const Colon = "∷"; -const Colone = "⩴"; -const Congruent = "≡"; -const Conint = "∯"; -const ContourIntegral = "∮"; -const Copf = "ℂ"; -const Coproduct = "∐"; -const CounterClockwiseContourIntegral = "∳"; -const Cross = "⨯"; -const Cscr = "𝒞"; -const Cup = "⋓"; -const CupCap = "≍"; -const DD = "ⅅ"; -const DDotrahd = "⤑"; -const DJcy = "Ђ"; -const DScy = "Ѕ"; -const DZcy = "Џ"; -const Dagger = "‡"; -const Darr = "↡"; -const Dashv = "⫤"; -const Dcaron = "Ď"; -const Dcy = "Д"; -const Del = "∇"; -const Delta = "Δ"; -const Dfr = "𝔇"; -const DiacriticalAcute = "´"; -const DiacriticalDot = "˙"; -const DiacriticalDoubleAcute = "˝"; -const DiacriticalGrave = "`"; -const DiacriticalTilde = "˜"; -const Diamond = "⋄"; -const DifferentialD = "ⅆ"; -const Dopf = "𝔻"; -const Dot = "¨"; -const DotDot = "⃜"; -const DotEqual = "≐"; -const DoubleContourIntegral = "∯"; -const DoubleDot = "¨"; -const DoubleDownArrow = "⇓"; -const DoubleLeftArrow = "⇐"; -const DoubleLeftRightArrow = "⇔"; -const DoubleLeftTee = "⫤"; -const DoubleLongLeftArrow = "⟸"; -const DoubleLongLeftRightArrow = "⟺"; -const DoubleLongRightArrow = "⟹"; -const DoubleRightArrow = "⇒"; -const DoubleRightTee = "⊨"; -const DoubleUpArrow = "⇑"; -const DoubleUpDownArrow = "⇕"; -const DoubleVerticalBar = "∥"; -const DownArrow = "↓"; -const DownArrowBar = "⤓"; -const DownArrowUpArrow = "⇵"; -const DownBreve = "̑"; -const DownLeftRightVector = "⥐"; -const DownLeftTeeVector = "⥞"; -const DownLeftVector = "↽"; -const DownLeftVectorBar = "⥖"; -const DownRightTeeVector = "⥟"; -const DownRightVector = "⇁"; -const DownRightVectorBar = "⥗"; -const DownTee = "⊤"; -const DownTeeArrow = "↧"; -const Downarrow = "⇓"; -const Dscr = "𝒟"; -const Dstrok = "Đ"; -const ENG = "Ŋ"; -const ET = "Ð"; -const ETH = "Ð"; -const Eacut = "É"; -const Eacute = "É"; -const Ecaron = "Ě"; -const Ecir = "Ê"; -const Ecirc = "Ê"; -const Ecy = "Э"; -const Edot = "Ė"; -const Efr = "𝔈"; -const Egrav = "È"; -const Egrave = "È"; -const Element = "∈"; -const Emacr = "Ē"; -const EmptySmallSquare = "◻"; -const EmptyVerySmallSquare = "▫"; -const Eogon = "Ę"; -const Eopf = "𝔼"; -const Epsilon = "Ε"; -const Equal = "⩵"; -const EqualTilde = "≂"; -const Equilibrium = "⇌"; -const Escr = "ℰ"; -const Esim = "⩳"; -const Eta = "Η"; -const Eum = "Ë"; -const Euml = "Ë"; -const Exists = "∃"; -const ExponentialE = "ⅇ"; -const Fcy = "Ф"; -const Ffr = "𝔉"; -const FilledSmallSquare = "◼"; -const FilledVerySmallSquare = "▪"; -const Fopf = "𝔽"; -const ForAll = "∀"; -const Fouriertrf = "ℱ"; -const Fscr = "ℱ"; -const GJcy = "Ѓ"; -const G = ">"; -const GT = ">"; -const Gamma = "Γ"; -const Gammad = "Ϝ"; -const Gbreve = "Ğ"; -const Gcedil = "Ģ"; -const Gcirc = "Ĝ"; -const Gcy = "Г"; -const Gdot = "Ġ"; -const Gfr = "𝔊"; -const Gg = "⋙"; -const Gopf = "𝔾"; -const GreaterEqual = "≥"; -const GreaterEqualLess = "⋛"; -const GreaterFullEqual = "≧"; -const GreaterGreater = "⪢"; -const GreaterLess = "≷"; -const GreaterSlantEqual = "⩾"; -const GreaterTilde = "≳"; -const Gscr = "𝒢"; -const Gt = "≫"; -const HARDcy = "Ъ"; -const Hacek = "ˇ"; -const Hat = "^"; -const Hcirc = "Ĥ"; -const Hfr = "ℌ"; -const HilbertSpace = "ℋ"; -const Hopf = "ℍ"; -const HorizontalLine = "─"; -const Hscr = "ℋ"; -const Hstrok = "Ħ"; -const HumpDownHump = "≎"; -const HumpEqual = "≏"; -const IEcy = "Е"; -const IJlig = "IJ"; -const IOcy = "Ё"; -const Iacut = "Í"; -const Iacute = "Í"; -const Icir = "Î"; -const Icirc = "Î"; -const Icy = "И"; -const Idot = "İ"; -const Ifr = "ℑ"; -const Igrav = "Ì"; -const Igrave = "Ì"; -const Im = "ℑ"; -const Imacr = "Ī"; -const ImaginaryI = "ⅈ"; -const Implies = "⇒"; -const Int = "∬"; -const Integral = "∫"; -const Intersection = "⋂"; -const InvisibleComma = ""; -const InvisibleTimes = ""; -const Iogon = "Į"; -const Iopf = "𝕀"; -const Iota = "Ι"; -const Iscr = "ℐ"; -const Itilde = "Ĩ"; -const Iukcy = "І"; -const Ium = "Ï"; -const Iuml = "Ï"; -const Jcirc = "Ĵ"; -const Jcy = "Й"; -const Jfr = "𝔍"; -const Jopf = "𝕁"; -const Jscr = "𝒥"; -const Jsercy = "Ј"; -const Jukcy = "Є"; -const KHcy = "Х"; -const KJcy = "Ќ"; -const Kappa = "Κ"; -const Kcedil = "Ķ"; -const Kcy = "К"; -const Kfr = "𝔎"; -const Kopf = "𝕂"; -const Kscr = "𝒦"; -const LJcy = "Љ"; -const L = "<"; -const LT = "<"; -const Lacute = "Ĺ"; -const Lambda = "Λ"; -const Lang = "⟪"; -const Laplacetrf = "ℒ"; -const Larr = "↞"; -const Lcaron = "Ľ"; -const Lcedil = "Ļ"; -const Lcy = "Л"; -const LeftAngleBracket = "⟨"; -const LeftArrow = "←"; -const LeftArrowBar = "⇤"; -const LeftArrowRightArrow = "⇆"; -const LeftCeiling = "⌈"; -const LeftDoubleBracket = "⟦"; -const LeftDownTeeVector = "⥡"; -const LeftDownVector = "⇃"; -const LeftDownVectorBar = "⥙"; -const LeftFloor = "⌊"; -const LeftRightArrow = "↔"; -const LeftRightVector = "⥎"; -const LeftTee = "⊣"; -const LeftTeeArrow = "↤"; -const LeftTeeVector = "⥚"; -const LeftTriangle = "⊲"; -const LeftTriangleBar = "⧏"; -const LeftTriangleEqual = "⊴"; -const LeftUpDownVector = "⥑"; -const LeftUpTeeVector = "⥠"; -const LeftUpVector = "↿"; -const LeftUpVectorBar = "⥘"; -const LeftVector = "↼"; -const LeftVectorBar = "⥒"; -const Leftarrow = "⇐"; -const Leftrightarrow = "⇔"; -const LessEqualGreater = "⋚"; -const LessFullEqual = "≦"; -const LessGreater = "≶"; -const LessLess = "⪡"; -const LessSlantEqual = "⩽"; -const LessTilde = "≲"; -const Lfr = "𝔏"; -const Ll = "⋘"; -const Lleftarrow = "⇚"; -const Lmidot = "Ŀ"; -const LongLeftArrow = "⟵"; -const LongLeftRightArrow = "⟷"; -const LongRightArrow = "⟶"; -const Longleftarrow = "⟸"; -const Longleftrightarrow = "⟺"; -const Longrightarrow = "⟹"; -const Lopf = "𝕃"; -const LowerLeftArrow = "↙"; -const LowerRightArrow = "↘"; -const Lscr = "ℒ"; -const Lsh = "↰"; -const Lstrok = "Ł"; -const Lt = "≪"; -const Mcy = "М"; -const MediumSpace = " "; -const Mellintrf = "ℳ"; -const Mfr = "𝔐"; -const MinusPlus = "∓"; -const Mopf = "𝕄"; -const Mscr = "ℳ"; -const Mu = "Μ"; -const NJcy = "Њ"; -const Nacute = "Ń"; -const Ncaron = "Ň"; -const Ncedil = "Ņ"; -const Ncy = "Н"; -const NegativeMediumSpace = ""; -const NegativeThickSpace = ""; -const NegativeThinSpace = ""; -const NegativeVeryThinSpace = ""; -const NestedGreaterGreater = "≫"; -const NestedLessLess = "≪"; -const NewLine = "\n"; -const Nfr = "𝔑"; -const NoBreak = ""; -const NonBreakingSpace = " "; -const Nopf = "ℕ"; -const Not = "⫬"; -const NotCongruent = "≢"; -const NotCupCap = "≭"; -const NotDoubleVerticalBar = "∦"; -const NotElement = "∉"; -const NotEqual = "≠"; -const NotEqualTilde = "≂̸"; -const NotExists = "∄"; -const NotGreater = "≯"; -const NotGreaterEqual = "≱"; -const NotGreaterFullEqual = "≧̸"; -const NotGreaterGreater = "≫̸"; -const NotGreaterLess = "≹"; -const NotGreaterSlantEqual = "⩾̸"; -const NotGreaterTilde = "≵"; -const NotHumpDownHump = "≎̸"; -const NotHumpEqual = "≏̸"; -const NotLeftTriangle = "⋪"; -const NotLeftTriangleBar = "⧏̸"; -const NotLeftTriangleEqual = "⋬"; -const NotLess = "≮"; -const NotLessEqual = "≰"; -const NotLessGreater = "≸"; -const NotLessLess = "≪̸"; -const NotLessSlantEqual = "⩽̸"; -const NotLessTilde = "≴"; -const NotNestedGreaterGreater = "⪢̸"; -const NotNestedLessLess = "⪡̸"; -const NotPrecedes = "⊀"; -const NotPrecedesEqual = "⪯̸"; -const NotPrecedesSlantEqual = "⋠"; -const NotReverseElement = "∌"; -const NotRightTriangle = "⋫"; -const NotRightTriangleBar = "⧐̸"; -const NotRightTriangleEqual = "⋭"; -const NotSquareSubset = "⊏̸"; -const NotSquareSubsetEqual = "⋢"; -const NotSquareSuperset = "⊐̸"; -const NotSquareSupersetEqual = "⋣"; -const NotSubset = "⊂⃒"; -const NotSubsetEqual = "⊈"; -const NotSucceeds = "⊁"; -const NotSucceedsEqual = "⪰̸"; -const NotSucceedsSlantEqual = "⋡"; -const NotSucceedsTilde = "≿̸"; -const NotSuperset = "⊃⃒"; -const NotSupersetEqual = "⊉"; -const NotTilde = "≁"; -const NotTildeEqual = "≄"; -const NotTildeFullEqual = "≇"; -const NotTildeTilde = "≉"; -const NotVerticalBar = "∤"; -const Nscr = "𝒩"; -const Ntild = "Ñ"; -const Ntilde = "Ñ"; -const Nu = "Ν"; -const OElig = "Œ"; -const Oacut = "Ó"; -const Oacute = "Ó"; -const Ocir = "Ô"; -const Ocirc = "Ô"; -const Ocy = "О"; -const Odblac = "Ő"; -const Ofr = "𝔒"; -const Ograv = "Ò"; -const Ograve = "Ò"; -const Omacr = "Ō"; -const Omega = "Ω"; -const Omicron = "Ο"; -const Oopf = "𝕆"; -const OpenCurlyDoubleQuote = "“"; -const OpenCurlyQuote = "‘"; -const Or = "⩔"; -const Oscr = "𝒪"; -const Oslas = "Ø"; -const Oslash = "Ø"; -const Otild = "Õ"; -const Otilde = "Õ"; -const Otimes = "⨷"; -const Oum = "Ö"; -const Ouml = "Ö"; -const OverBar = "‾"; -const OverBrace = "⏞"; -const OverBracket = "⎴"; -const OverParenthesis = "⏜"; -const PartialD = "∂"; -const Pcy = "П"; -const Pfr = "𝔓"; -const Phi = "Φ"; -const Pi = "Π"; -const PlusMinus = "±"; -const Poincareplane = "ℌ"; -const Popf = "ℙ"; -const Pr = "⪻"; -const Precedes = "≺"; -const PrecedesEqual = "⪯"; -const PrecedesSlantEqual = "≼"; -const PrecedesTilde = "≾"; -const Prime = "″"; -const Product = "∏"; -const Proportion = "∷"; -const Proportional = "∝"; -const Pscr = "𝒫"; -const Psi = "Ψ"; -const QUO = "\""; -const QUOT = "\""; -const Qfr = "𝔔"; -const Qopf = "ℚ"; -const Qscr = "𝒬"; -const RBarr = "⤐"; -const RE = "®"; -const REG = "®"; -const Racute = "Ŕ"; -const Rang = "⟫"; -const Rarr = "↠"; -const Rarrtl = "⤖"; -const Rcaron = "Ř"; -const Rcedil = "Ŗ"; -const Rcy = "Р"; -const Re = "ℜ"; -const ReverseElement = "∋"; -const ReverseEquilibrium = "⇋"; -const ReverseUpEquilibrium = "⥯"; -const Rfr = "ℜ"; -const Rho = "Ρ"; -const RightAngleBracket = "⟩"; -const RightArrow = "→"; -const RightArrowBar = "⇥"; -const RightArrowLeftArrow = "⇄"; -const RightCeiling = "⌉"; -const RightDoubleBracket = "⟧"; -const RightDownTeeVector = "⥝"; -const RightDownVector = "⇂"; -const RightDownVectorBar = "⥕"; -const RightFloor = "⌋"; -const RightTee = "⊢"; -const RightTeeArrow = "↦"; -const RightTeeVector = "⥛"; -const RightTriangle = "⊳"; -const RightTriangleBar = "⧐"; -const RightTriangleEqual = "⊵"; -const RightUpDownVector = "⥏"; -const RightUpTeeVector = "⥜"; -const RightUpVector = "↾"; -const RightUpVectorBar = "⥔"; -const RightVector = "⇀"; -const RightVectorBar = "⥓"; -const Rightarrow = "⇒"; -const Ropf = "ℝ"; -const RoundImplies = "⥰"; -const Rrightarrow = "⇛"; -const Rscr = "ℛ"; -const Rsh = "↱"; -const RuleDelayed = "⧴"; -const SHCHcy = "Щ"; -const SHcy = "Ш"; -const SOFTcy = "Ь"; -const Sacute = "Ś"; -const Sc = "⪼"; -const Scaron = "Š"; -const Scedil = "Ş"; -const Scirc = "Ŝ"; -const Scy = "С"; -const Sfr = "𝔖"; -const ShortDownArrow = "↓"; -const ShortLeftArrow = "←"; -const ShortRightArrow = "→"; -const ShortUpArrow = "↑"; -const Sigma = "Σ"; -const SmallCircle = "∘"; -const Sopf = "𝕊"; -const Sqrt = "√"; -const Square = "□"; -const SquareIntersection = "⊓"; -const SquareSubset = "⊏"; -const SquareSubsetEqual = "⊑"; -const SquareSuperset = "⊐"; -const SquareSupersetEqual = "⊒"; -const SquareUnion = "⊔"; -const Sscr = "𝒮"; -const Star = "⋆"; -const Sub = "⋐"; -const Subset = "⋐"; -const SubsetEqual = "⊆"; -const Succeeds = "≻"; -const SucceedsEqual = "⪰"; -const SucceedsSlantEqual = "≽"; -const SucceedsTilde = "≿"; -const SuchThat = "∋"; -const Sum = "∑"; -const Sup = "⋑"; -const Superset = "⊃"; -const SupersetEqual = "⊇"; -const Supset = "⋑"; -const THOR = "Þ"; -const THORN = "Þ"; -const TRADE = "™"; -const TSHcy = "Ћ"; -const TScy = "Ц"; -const Tab = "\t"; -const Tau = "Τ"; -const Tcaron = "Ť"; -const Tcedil = "Ţ"; -const Tcy = "Т"; -const Tfr = "𝔗"; -const Therefore = "∴"; -const Theta = "Θ"; -const ThickSpace = " "; -const ThinSpace = " "; -const Tilde = "∼"; -const TildeEqual = "≃"; -const TildeFullEqual = "≅"; -const TildeTilde = "≈"; -const Topf = "𝕋"; -const TripleDot = "⃛"; -const Tscr = "𝒯"; -const Tstrok = "Ŧ"; -const Uacut = "Ú"; -const Uacute = "Ú"; -const Uarr = "↟"; -const Uarrocir = "⥉"; -const Ubrcy = "Ў"; -const Ubreve = "Ŭ"; -const Ucir = "Û"; -const Ucirc = "Û"; -const Ucy = "У"; -const Udblac = "Ű"; -const Ufr = "𝔘"; -const Ugrav = "Ù"; -const Ugrave = "Ù"; -const Umacr = "Ū"; -const UnderBar = "_"; -const UnderBrace = "⏟"; -const UnderBracket = "⎵"; -const UnderParenthesis = "⏝"; -const Union = "⋃"; -const UnionPlus = "⊎"; -const Uogon = "Ų"; -const Uopf = "𝕌"; -const UpArrow = "↑"; -const UpArrowBar = "⤒"; -const UpArrowDownArrow = "⇅"; -const UpDownArrow = "↕"; -const UpEquilibrium = "⥮"; -const UpTee = "⊥"; -const UpTeeArrow = "↥"; -const Uparrow = "⇑"; -const Updownarrow = "⇕"; -const UpperLeftArrow = "↖"; -const UpperRightArrow = "↗"; -const Upsi = "ϒ"; -const Upsilon = "Υ"; -const Uring = "Ů"; -const Uscr = "𝒰"; -const Utilde = "Ũ"; -const Uum = "Ü"; -const Uuml = "Ü"; -const VDash = "⊫"; -const Vbar = "⫫"; -const Vcy = "В"; -const Vdash = "⊩"; -const Vdashl = "⫦"; -const Vee = "⋁"; -const Verbar = "‖"; -const Vert = "‖"; -const VerticalBar = "∣"; -const VerticalLine = "|"; -const VerticalSeparator = "❘"; -const VerticalTilde = "≀"; -const VeryThinSpace = " "; -const Vfr = "𝔙"; -const Vopf = "𝕍"; -const Vscr = "𝒱"; -const Vvdash = "⊪"; -const Wcirc = "Ŵ"; -const Wedge = "⋀"; -const Wfr = "𝔚"; -const Wopf = "𝕎"; -const Wscr = "𝒲"; -const Xfr = "𝔛"; -const Xi = "Ξ"; -const Xopf = "𝕏"; -const Xscr = "𝒳"; -const YAcy = "Я"; -const YIcy = "Ї"; -const YUcy = "Ю"; -const Yacut = "Ý"; -const Yacute = "Ý"; -const Ycirc = "Ŷ"; -const Ycy = "Ы"; -const Yfr = "𝔜"; -const Yopf = "𝕐"; -const Yscr = "𝒴"; -const Yuml = "Ÿ"; -const ZHcy = "Ж"; -const Zacute = "Ź"; -const Zcaron = "Ž"; -const Zcy = "З"; -const Zdot = "Ż"; -const ZeroWidthSpace = ""; -const Zeta = "Ζ"; -const Zfr = "ℨ"; -const Zopf = "ℤ"; -const Zscr = "𝒵"; -const aacut = "á"; -const aacute = "á"; -const abreve = "ă"; -const ac = "∾"; -const acE = "∾̳"; -const acd = "∿"; -const acir = "â"; -const acirc = "â"; -const acut = "´"; -const acute = "´"; -const acy = "а"; -const aeli = "æ"; -const aelig = "æ"; -const af = ""; -const afr = "𝔞"; -const agrav = "à"; -const agrave = "à"; -const alefsym = "ℵ"; -const aleph = "ℵ"; -const alpha = "α"; -const amacr = "ā"; -const amalg = "⨿"; -const am = "&"; -const amp = "&"; -const and = "∧"; -const andand = "⩕"; -const andd = "⩜"; -const andslope = "⩘"; -const andv = "⩚"; -const ang = "∠"; -const ange = "⦤"; -const angle = "∠"; -const angmsd = "∡"; -const angmsdaa = "⦨"; -const angmsdab = "⦩"; -const angmsdac = "⦪"; -const angmsdad = "⦫"; -const angmsdae = "⦬"; -const angmsdaf = "⦭"; -const angmsdag = "⦮"; -const angmsdah = "⦯"; -const angrt = "∟"; -const angrtvb = "⊾"; -const angrtvbd = "⦝"; -const angsph = "∢"; -const angst = "Å"; -const angzarr = "⍼"; -const aogon = "ą"; -const aopf = "𝕒"; -const ap = "≈"; -const apE = "⩰"; -const apacir = "⩯"; -const ape = "≊"; -const apid = "≋"; -const apos = "'"; -const approx = "≈"; -const approxeq = "≊"; -const arin = "å"; -const aring = "å"; -const ascr = "𝒶"; -const ast = "*"; -const asymp = "≈"; -const asympeq = "≍"; -const atild = "ã"; -const atilde = "ã"; -const aum = "ä"; -const auml = "ä"; -const awconint = "∳"; -const awint = "⨑"; -const bNot = "⫭"; -const backcong = "≌"; -const backepsilon = "϶"; -const backprime = "‵"; -const backsim = "∽"; -const backsimeq = "⋍"; -const barvee = "⊽"; -const barwed = "⌅"; -const barwedge = "⌅"; -const bbrk = "⎵"; -const bbrktbrk = "⎶"; -const bcong = "≌"; -const bcy = "б"; -const bdquo = "„"; -const becaus = "∵"; -const because = "∵"; -const bemptyv = "⦰"; -const bepsi = "϶"; -const bernou = "ℬ"; -const beta = "β"; -const beth = "ℶ"; -const between = "≬"; -const bfr = "𝔟"; -const bigcap = "⋂"; -const bigcirc = "◯"; -const bigcup = "⋃"; -const bigodot = "⨀"; -const bigoplus = "⨁"; -const bigotimes = "⨂"; -const bigsqcup = "⨆"; -const bigstar = "★"; -const bigtriangledown = "▽"; -const bigtriangleup = "△"; -const biguplus = "⨄"; -const bigvee = "⋁"; -const bigwedge = "⋀"; -const bkarow = "⤍"; -const blacklozenge = "⧫"; -const blacksquare = "▪"; -const blacktriangle = "▴"; -const blacktriangledown = "▾"; -const blacktriangleleft = "◂"; -const blacktriangleright = "▸"; -const blank = "␣"; -const blk12 = "▒"; -const blk14 = "░"; -const blk34 = "▓"; -const block = "█"; -const bne = "=⃥"; -const bnequiv = "≡⃥"; -const bnot = "⌐"; -const bopf = "𝕓"; -const bot = "⊥"; -const bottom = "⊥"; -const bowtie = "⋈"; -const boxDL = "╗"; -const boxDR = "╔"; -const boxDl = "╖"; -const boxDr = "╓"; -const boxH = "═"; -const boxHD = "╦"; -const boxHU = "╩"; -const boxHd = "╤"; -const boxHu = "╧"; -const boxUL = "╝"; -const boxUR = "╚"; -const boxUl = "╜"; -const boxUr = "╙"; -const boxV = "║"; -const boxVH = "╬"; -const boxVL = "╣"; -const boxVR = "╠"; -const boxVh = "╫"; -const boxVl = "╢"; -const boxVr = "╟"; -const boxbox = "⧉"; -const boxdL = "╕"; -const boxdR = "╒"; -const boxdl = "┐"; -const boxdr = "┌"; -const boxh = "─"; -const boxhD = "╥"; -const boxhU = "╨"; -const boxhd = "┬"; -const boxhu = "┴"; -const boxminus = "⊟"; -const boxplus = "⊞"; -const boxtimes = "⊠"; -const boxuL = "╛"; -const boxuR = "╘"; -const boxul = "┘"; -const boxur = "└"; -const boxv = "│"; -const boxvH = "╪"; -const boxvL = "╡"; -const boxvR = "╞"; -const boxvh = "┼"; -const boxvl = "┤"; -const boxvr = "├"; -const bprime = "‵"; -const breve = "˘"; -const brvba = "¦"; -const brvbar = "¦"; -const bscr = "𝒷"; -const bsemi = "⁏"; -const bsim = "∽"; -const bsime = "⋍"; -const bsol = "\\"; -const bsolb = "⧅"; -const bsolhsub = "⟈"; -const bull = "•"; -const bullet = "•"; -const bump = "≎"; -const bumpE = "⪮"; -const bumpe = "≏"; -const bumpeq = "≏"; -const cacute = "ć"; -const cap = "∩"; -const capand = "⩄"; -const capbrcup = "⩉"; -const capcap = "⩋"; -const capcup = "⩇"; -const capdot = "⩀"; -const caps = "∩︀"; -const caret = "⁁"; -const caron = "ˇ"; -const ccaps = "⩍"; -const ccaron = "č"; -const ccedi = "ç"; -const ccedil = "ç"; -const ccirc = "ĉ"; -const ccups = "⩌"; -const ccupssm = "⩐"; -const cdot = "ċ"; -const cedi = "¸"; -const cedil = "¸"; -const cemptyv = "⦲"; -const cen = "¢"; -const cent = "¢"; -const centerdot = "·"; -const cfr = "𝔠"; -const chcy = "ч"; -const check$1 = "✓"; -const checkmark = "✓"; -const chi = "χ"; -const cir = "○"; -const cirE = "⧃"; -const circ = "ˆ"; -const circeq = "≗"; -const circlearrowleft = "↺"; -const circlearrowright = "↻"; -const circledR = "®"; -const circledS = "Ⓢ"; -const circledast = "⊛"; -const circledcirc = "⊚"; -const circleddash = "⊝"; -const cire = "≗"; -const cirfnint = "⨐"; -const cirmid = "⫯"; -const cirscir = "⧂"; -const clubs = "♣"; -const clubsuit = "♣"; -const colon = ":"; -const colone = "≔"; -const coloneq = "≔"; -const comma = ","; -const commat = "@"; -const comp = "∁"; -const compfn = "∘"; -const complement = "∁"; -const complexes = "ℂ"; -const cong = "≅"; -const congdot = "⩭"; -const conint = "∮"; -const copf = "𝕔"; -const coprod = "∐"; -const cop = "©"; -const copy = "©"; -const copysr = "℗"; -const crarr = "↵"; -const cross = "✗"; -const cscr = "𝒸"; -const csub = "⫏"; -const csube = "⫑"; -const csup = "⫐"; -const csupe = "⫒"; -const ctdot = "⋯"; -const cudarrl = "⤸"; -const cudarrr = "⤵"; -const cuepr = "⋞"; -const cuesc = "⋟"; -const cularr = "↶"; -const cularrp = "⤽"; -const cup = "∪"; -const cupbrcap = "⩈"; -const cupcap = "⩆"; -const cupcup = "⩊"; -const cupdot = "⊍"; -const cupor = "⩅"; -const cups = "∪︀"; -const curarr = "↷"; -const curarrm = "⤼"; -const curlyeqprec = "⋞"; -const curlyeqsucc = "⋟"; -const curlyvee = "⋎"; -const curlywedge = "⋏"; -const curre = "¤"; -const curren = "¤"; -const curvearrowleft = "↶"; -const curvearrowright = "↷"; -const cuvee = "⋎"; -const cuwed = "⋏"; -const cwconint = "∲"; -const cwint = "∱"; -const cylcty = "⌭"; -const dArr = "⇓"; -const dHar = "⥥"; -const dagger = "†"; -const daleth = "ℸ"; -const darr = "↓"; -const dash = "‐"; -const dashv = "⊣"; -const dbkarow = "⤏"; -const dblac = "˝"; -const dcaron = "ď"; -const dcy = "д"; -const dd = "ⅆ"; -const ddagger = "‡"; -const ddarr = "⇊"; -const ddotseq = "⩷"; -const de = "°"; -const deg = "°"; -const delta = "δ"; -const demptyv = "⦱"; -const dfisht = "⥿"; -const dfr = "𝔡"; -const dharl = "⇃"; -const dharr = "⇂"; -const diam = "⋄"; -const diamond = "⋄"; -const diamondsuit = "♦"; -const diams = "♦"; -const die = "¨"; -const digamma = "ϝ"; -const disin = "⋲"; -const div = "÷"; -const divid = "÷"; -const divide = "÷"; -const divideontimes = "⋇"; -const divonx = "⋇"; -const djcy = "ђ"; -const dlcorn = "⌞"; -const dlcrop = "⌍"; -const dollar = "$"; -const dopf = "𝕕"; -const dot = "˙"; -const doteq = "≐"; -const doteqdot = "≑"; -const dotminus = "∸"; -const dotplus = "∔"; -const dotsquare = "⊡"; -const doublebarwedge = "⌆"; -const downarrow = "↓"; -const downdownarrows = "⇊"; -const downharpoonleft = "⇃"; -const downharpoonright = "⇂"; -const drbkarow = "⤐"; -const drcorn = "⌟"; -const drcrop = "⌌"; -const dscr = "𝒹"; -const dscy = "ѕ"; -const dsol = "⧶"; -const dstrok = "đ"; -const dtdot = "⋱"; -const dtri = "▿"; -const dtrif = "▾"; -const duarr = "⇵"; -const duhar = "⥯"; -const dwangle = "⦦"; -const dzcy = "џ"; -const dzigrarr = "⟿"; -const eDDot = "⩷"; -const eDot = "≑"; -const eacut = "é"; -const eacute = "é"; -const easter = "⩮"; -const ecaron = "ě"; -const ecir = "ê"; -const ecirc = "ê"; -const ecolon = "≕"; -const ecy = "э"; -const edot = "ė"; -const ee = "ⅇ"; -const efDot = "≒"; -const efr = "𝔢"; -const eg = "⪚"; -const egrav = "è"; -const egrave = "è"; -const egs = "⪖"; -const egsdot = "⪘"; -const el = "⪙"; -const elinters = "⏧"; -const ell = "ℓ"; -const els = "⪕"; -const elsdot = "⪗"; -const emacr = "ē"; -const empty = "∅"; -const emptyset = "∅"; -const emptyv = "∅"; -const emsp13 = " "; -const emsp14 = " "; -const emsp = " "; -const eng = "ŋ"; -const ensp = " "; -const eogon = "ę"; -const eopf = "𝕖"; -const epar = "⋕"; -const eparsl = "⧣"; -const eplus = "⩱"; -const epsi = "ε"; -const epsilon = "ε"; -const epsiv = "ϵ"; -const eqcirc = "≖"; -const eqcolon = "≕"; -const eqsim = "≂"; -const eqslantgtr = "⪖"; -const eqslantless = "⪕"; -const equals = "="; -const equest = "≟"; -const equiv = "≡"; -const equivDD = "⩸"; -const eqvparsl = "⧥"; -const erDot = "≓"; -const erarr = "⥱"; -const escr = "ℯ"; -const esdot = "≐"; -const esim = "≂"; -const eta = "η"; -const et = "ð"; -const eth = "ð"; -const eum = "ë"; -const euml = "ë"; -const euro = "€"; -const excl = "!"; -const exist = "∃"; -const expectation = "ℰ"; -const exponentiale = "ⅇ"; -const fallingdotseq = "≒"; -const fcy = "ф"; -const female = "♀"; -const ffilig = "ffi"; -const fflig = "ff"; -const ffllig = "ffl"; -const ffr = "𝔣"; -const filig = "fi"; -const fjlig = "fj"; -const flat = "♭"; -const fllig = "fl"; -const fltns = "▱"; -const fnof = "ƒ"; -const fopf = "𝕗"; -const forall = "∀"; -const fork = "⋔"; -const forkv = "⫙"; -const fpartint = "⨍"; -const frac1 = "¼"; -const frac12 = "½"; -const frac13 = "⅓"; -const frac14 = "¼"; -const frac15 = "⅕"; -const frac16 = "⅙"; -const frac18 = "⅛"; -const frac23 = "⅔"; -const frac25 = "⅖"; -const frac3 = "¾"; -const frac34 = "¾"; -const frac35 = "⅗"; -const frac38 = "⅜"; -const frac45 = "⅘"; -const frac56 = "⅚"; -const frac58 = "⅝"; -const frac78 = "⅞"; -const frasl = "⁄"; -const frown = "⌢"; -const fscr = "𝒻"; -const gE = "≧"; -const gEl = "⪌"; -const gacute = "ǵ"; -const gamma = "γ"; -const gammad = "ϝ"; -const gap = "⪆"; -const gbreve = "ğ"; -const gcirc = "ĝ"; -const gcy = "г"; -const gdot = "ġ"; -const ge = "≥"; -const gel = "⋛"; -const geq = "≥"; -const geqq = "≧"; -const geqslant = "⩾"; -const ges = "⩾"; -const gescc = "⪩"; -const gesdot = "⪀"; -const gesdoto = "⪂"; -const gesdotol = "⪄"; -const gesl = "⋛︀"; -const gesles = "⪔"; -const gfr = "𝔤"; -const gg = "≫"; -const ggg = "⋙"; -const gimel = "ℷ"; -const gjcy = "ѓ"; -const gl = "≷"; -const glE = "⪒"; -const gla = "⪥"; -const glj = "⪤"; -const gnE = "≩"; -const gnap = "⪊"; -const gnapprox = "⪊"; -const gne = "⪈"; -const gneq = "⪈"; -const gneqq = "≩"; -const gnsim = "⋧"; -const gopf = "𝕘"; -const grave = "`"; -const gscr = "ℊ"; -const gsim = "≳"; -const gsime = "⪎"; -const gsiml = "⪐"; -const g = ">"; -const gt = ">"; -const gtcc = "⪧"; -const gtcir = "⩺"; -const gtdot = "⋗"; -const gtlPar = "⦕"; -const gtquest = "⩼"; -const gtrapprox = "⪆"; -const gtrarr = "⥸"; -const gtrdot = "⋗"; -const gtreqless = "⋛"; -const gtreqqless = "⪌"; -const gtrless = "≷"; -const gtrsim = "≳"; -const gvertneqq = "≩︀"; -const gvnE = "≩︀"; -const hArr = "⇔"; -const hairsp = " "; -const half = "½"; -const hamilt = "ℋ"; -const hardcy = "ъ"; -const harr = "↔"; -const harrcir = "⥈"; -const harrw = "↭"; -const hbar = "ℏ"; -const hcirc = "ĥ"; -const hearts = "♥"; -const heartsuit = "♥"; -const hellip = "…"; -const hercon = "⊹"; -const hfr = "𝔥"; -const hksearow = "⤥"; -const hkswarow = "⤦"; -const hoarr = "⇿"; -const homtht = "∻"; -const hookleftarrow = "↩"; -const hookrightarrow = "↪"; -const hopf = "𝕙"; -const horbar = "―"; -const hscr = "𝒽"; -const hslash = "ℏ"; -const hstrok = "ħ"; -const hybull = "⁃"; -const hyphen = "‐"; -const iacut = "í"; -const iacute = "í"; -const ic = ""; -const icir = "î"; -const icirc = "î"; -const icy = "и"; -const iecy = "е"; -const iexc = "¡"; -const iexcl = "¡"; -const iff = "⇔"; -const ifr = "𝔦"; -const igrav = "ì"; -const igrave = "ì"; -const ii = "ⅈ"; -const iiiint = "⨌"; -const iiint = "∭"; -const iinfin = "⧜"; -const iiota = "℩"; -const ijlig = "ij"; -const imacr = "ī"; -const image$1 = "ℑ"; -const imagline = "ℐ"; -const imagpart = "ℑ"; -const imath = "ı"; -const imof = "⊷"; -const imped = "Ƶ"; -const incare = "℅"; -const infin = "∞"; -const infintie = "⧝"; -const inodot = "ı"; -const int$1 = "∫"; -const intcal = "⊺"; -const integers = "ℤ"; -const intercal = "⊺"; -const intlarhk = "⨗"; -const intprod = "⨼"; -const iocy = "ё"; -const iogon = "į"; -const iopf = "𝕚"; -const iota = "ι"; -const iprod = "⨼"; -const iques = "¿"; -const iquest = "¿"; -const iscr = "𝒾"; -const isin = "∈"; -const isinE = "⋹"; -const isindot = "⋵"; -const isins = "⋴"; -const isinsv = "⋳"; -const isinv = "∈"; -const it = ""; -const itilde = "ĩ"; -const iukcy = "і"; -const ium = "ï"; -const iuml = "ï"; -const jcirc = "ĵ"; -const jcy = "й"; -const jfr = "𝔧"; -const jmath = "ȷ"; -const jopf = "𝕛"; -const jscr = "𝒿"; -const jsercy = "ј"; -const jukcy = "є"; -const kappa = "κ"; -const kappav = "ϰ"; -const kcedil = "ķ"; -const kcy = "к"; -const kfr = "𝔨"; -const kgreen = "ĸ"; -const khcy = "х"; -const kjcy = "ќ"; -const kopf = "𝕜"; -const kscr = "𝓀"; -const lAarr = "⇚"; -const lArr = "⇐"; -const lAtail = "⤛"; -const lBarr = "⤎"; -const lE = "≦"; -const lEg = "⪋"; -const lHar = "⥢"; -const lacute = "ĺ"; -const laemptyv = "⦴"; -const lagran = "ℒ"; -const lambda = "λ"; -const lang = "⟨"; -const langd = "⦑"; -const langle = "⟨"; -const lap = "⪅"; -const laqu = "«"; -const laquo = "«"; -const larr = "←"; -const larrb = "⇤"; -const larrbfs = "⤟"; -const larrfs = "⤝"; -const larrhk = "↩"; -const larrlp = "↫"; -const larrpl = "⤹"; -const larrsim = "⥳"; -const larrtl = "↢"; -const lat = "⪫"; -const latail = "⤙"; -const late = "⪭"; -const lates = "⪭︀"; -const lbarr = "⤌"; -const lbbrk = "❲"; -const lbrace = "{"; -const lbrack = "["; -const lbrke = "⦋"; -const lbrksld = "⦏"; -const lbrkslu = "⦍"; -const lcaron = "ľ"; -const lcedil = "ļ"; -const lceil = "⌈"; -const lcub = "{"; -const lcy = "л"; -const ldca = "⤶"; -const ldquo = "“"; -const ldquor = "„"; -const ldrdhar = "⥧"; -const ldrushar = "⥋"; -const ldsh = "↲"; -const le = "≤"; -const leftarrow = "←"; -const leftarrowtail = "↢"; -const leftharpoondown = "↽"; -const leftharpoonup = "↼"; -const leftleftarrows = "⇇"; -const leftrightarrow = "↔"; -const leftrightarrows = "⇆"; -const leftrightharpoons = "⇋"; -const leftrightsquigarrow = "↭"; -const leftthreetimes = "⋋"; -const leg = "⋚"; -const leq = "≤"; -const leqq = "≦"; -const leqslant = "⩽"; -const les = "⩽"; -const lescc = "⪨"; -const lesdot = "⩿"; -const lesdoto = "⪁"; -const lesdotor = "⪃"; -const lesg = "⋚︀"; -const lesges = "⪓"; -const lessapprox = "⪅"; -const lessdot = "⋖"; -const lesseqgtr = "⋚"; -const lesseqqgtr = "⪋"; -const lessgtr = "≶"; -const lesssim = "≲"; -const lfisht = "⥼"; -const lfloor = "⌊"; -const lfr = "𝔩"; -const lg = "≶"; -const lgE = "⪑"; -const lhard = "↽"; -const lharu = "↼"; -const lharul = "⥪"; -const lhblk = "▄"; -const ljcy = "љ"; -const ll = "≪"; -const llarr = "⇇"; -const llcorner = "⌞"; -const llhard = "⥫"; -const lltri = "◺"; -const lmidot = "ŀ"; -const lmoust = "⎰"; -const lmoustache = "⎰"; -const lnE = "≨"; -const lnap = "⪉"; -const lnapprox = "⪉"; -const lne = "⪇"; -const lneq = "⪇"; -const lneqq = "≨"; -const lnsim = "⋦"; -const loang = "⟬"; -const loarr = "⇽"; -const lobrk = "⟦"; -const longleftarrow = "⟵"; -const longleftrightarrow = "⟷"; -const longmapsto = "⟼"; -const longrightarrow = "⟶"; -const looparrowleft = "↫"; -const looparrowright = "↬"; -const lopar = "⦅"; -const lopf = "𝕝"; -const loplus = "⨭"; -const lotimes = "⨴"; -const lowast = "∗"; -const lowbar = "_"; -const loz = "◊"; -const lozenge = "◊"; -const lozf = "⧫"; -const lpar = "("; -const lparlt = "⦓"; -const lrarr = "⇆"; -const lrcorner = "⌟"; -const lrhar = "⇋"; -const lrhard = "⥭"; -const lrm = ""; -const lrtri = "⊿"; -const lsaquo = "‹"; -const lscr = "𝓁"; -const lsh = "↰"; -const lsim = "≲"; -const lsime = "⪍"; -const lsimg = "⪏"; -const lsqb = "["; -const lsquo = "‘"; -const lsquor = "‚"; -const lstrok = "ł"; -const l = "<"; -const lt$1 = "<"; -const ltcc = "⪦"; -const ltcir = "⩹"; -const ltdot = "⋖"; -const lthree = "⋋"; -const ltimes = "⋉"; -const ltlarr = "⥶"; -const ltquest = "⩻"; -const ltrPar = "⦖"; -const ltri = "◃"; -const ltrie = "⊴"; -const ltrif = "◂"; -const lurdshar = "⥊"; -const luruhar = "⥦"; -const lvertneqq = "≨︀"; -const lvnE = "≨︀"; -const mDDot = "∺"; -const mac = "¯"; -const macr = "¯"; -const male = "♂"; -const malt = "✠"; -const maltese = "✠"; -const map$1 = "↦"; -const mapsto = "↦"; -const mapstodown = "↧"; -const mapstoleft = "↤"; -const mapstoup = "↥"; -const marker = "▮"; -const mcomma = "⨩"; -const mcy = "м"; -const mdash = "—"; -const measuredangle = "∡"; -const mfr = "𝔪"; -const mho = "℧"; -const micr = "µ"; -const micro = "µ"; -const mid = "∣"; -const midast = "*"; -const midcir = "⫰"; -const middo = "·"; -const middot = "·"; -const minus = "−"; -const minusb = "⊟"; -const minusd = "∸"; -const minusdu = "⨪"; -const mlcp = "⫛"; -const mldr = "…"; -const mnplus = "∓"; -const models = "⊧"; -const mopf = "𝕞"; -const mp = "∓"; -const mscr = "𝓂"; -const mstpos = "∾"; -const mu = "μ"; -const multimap = "⊸"; -const mumap = "⊸"; -const nGg = "⋙̸"; -const nGt = "≫⃒"; -const nGtv = "≫̸"; -const nLeftarrow = "⇍"; -const nLeftrightarrow = "⇎"; -const nLl = "⋘̸"; -const nLt = "≪⃒"; -const nLtv = "≪̸"; -const nRightarrow = "⇏"; -const nVDash = "⊯"; -const nVdash = "⊮"; -const nabla = "∇"; -const nacute = "ń"; -const nang = "∠⃒"; -const nap = "≉"; -const napE = "⩰̸"; -const napid = "≋̸"; -const napos = "ʼn"; -const napprox = "≉"; -const natur = "♮"; -const natural = "♮"; -const naturals = "ℕ"; -const nbs = " "; -const nbsp = " "; -const nbump = "≎̸"; -const nbumpe = "≏̸"; -const ncap = "⩃"; -const ncaron = "ň"; -const ncedil = "ņ"; -const ncong = "≇"; -const ncongdot = "⩭̸"; -const ncup = "⩂"; -const ncy = "н"; -const ndash = "–"; -const ne = "≠"; -const neArr = "⇗"; -const nearhk = "⤤"; -const nearr = "↗"; -const nearrow = "↗"; -const nedot = "≐̸"; -const nequiv = "≢"; -const nesear = "⤨"; -const nesim = "≂̸"; -const nexist = "∄"; -const nexists = "∄"; -const nfr = "𝔫"; -const ngE = "≧̸"; -const nge = "≱"; -const ngeq = "≱"; -const ngeqq = "≧̸"; -const ngeqslant = "⩾̸"; -const nges = "⩾̸"; -const ngsim = "≵"; -const ngt = "≯"; -const ngtr = "≯"; -const nhArr = "⇎"; -const nharr = "↮"; -const nhpar = "⫲"; -const ni = "∋"; -const nis = "⋼"; -const nisd = "⋺"; -const niv = "∋"; -const njcy = "њ"; -const nlArr = "⇍"; -const nlE = "≦̸"; -const nlarr = "↚"; -const nldr = "‥"; -const nle = "≰"; -const nleftarrow = "↚"; -const nleftrightarrow = "↮"; -const nleq = "≰"; -const nleqq = "≦̸"; -const nleqslant = "⩽̸"; -const nles = "⩽̸"; -const nless = "≮"; -const nlsim = "≴"; -const nlt = "≮"; -const nltri = "⋪"; -const nltrie = "⋬"; -const nmid = "∤"; -const nopf = "𝕟"; -const no = "¬"; -const not = "¬"; -const notin = "∉"; -const notinE = "⋹̸"; -const notindot = "⋵̸"; -const notinva = "∉"; -const notinvb = "⋷"; -const notinvc = "⋶"; -const notni = "∌"; -const notniva = "∌"; -const notnivb = "⋾"; -const notnivc = "⋽"; -const npar = "∦"; -const nparallel = "∦"; -const nparsl = "⫽⃥"; -const npart = "∂̸"; -const npolint = "⨔"; -const npr = "⊀"; -const nprcue = "⋠"; -const npre = "⪯̸"; -const nprec = "⊀"; -const npreceq = "⪯̸"; -const nrArr = "⇏"; -const nrarr = "↛"; -const nrarrc = "⤳̸"; -const nrarrw = "↝̸"; -const nrightarrow = "↛"; -const nrtri = "⋫"; -const nrtrie = "⋭"; -const nsc = "⊁"; -const nsccue = "⋡"; -const nsce = "⪰̸"; -const nscr = "𝓃"; -const nshortmid = "∤"; -const nshortparallel = "∦"; -const nsim = "≁"; -const nsime = "≄"; -const nsimeq = "≄"; -const nsmid = "∤"; -const nspar = "∦"; -const nsqsube = "⋢"; -const nsqsupe = "⋣"; -const nsub = "⊄"; -const nsubE = "⫅̸"; -const nsube = "⊈"; -const nsubset = "⊂⃒"; -const nsubseteq = "⊈"; -const nsubseteqq = "⫅̸"; -const nsucc = "⊁"; -const nsucceq = "⪰̸"; -const nsup = "⊅"; -const nsupE = "⫆̸"; -const nsupe = "⊉"; -const nsupset = "⊃⃒"; -const nsupseteq = "⊉"; -const nsupseteqq = "⫆̸"; -const ntgl = "≹"; -const ntild = "ñ"; -const ntilde = "ñ"; -const ntlg = "≸"; -const ntriangleleft = "⋪"; -const ntrianglelefteq = "⋬"; -const ntriangleright = "⋫"; -const ntrianglerighteq = "⋭"; -const nu = "ν"; -const num = "#"; -const numero = "№"; -const numsp = " "; -const nvDash = "⊭"; -const nvHarr = "⤄"; -const nvap = "≍⃒"; -const nvdash = "⊬"; -const nvge = "≥⃒"; -const nvgt = ">⃒"; -const nvinfin = "⧞"; -const nvlArr = "⤂"; -const nvle = "≤⃒"; -const nvlt = "<⃒"; -const nvltrie = "⊴⃒"; -const nvrArr = "⤃"; -const nvrtrie = "⊵⃒"; -const nvsim = "∼⃒"; -const nwArr = "⇖"; -const nwarhk = "⤣"; -const nwarr = "↖"; -const nwarrow = "↖"; -const nwnear = "⤧"; -const oS = "Ⓢ"; -const oacut = "ó"; -const oacute = "ó"; -const oast = "⊛"; -const ocir = "ô"; -const ocirc = "ô"; -const ocy = "о"; -const odash = "⊝"; -const odblac = "ő"; -const odiv = "⨸"; -const odot = "⊙"; -const odsold = "⦼"; -const oelig = "œ"; -const ofcir = "⦿"; -const ofr = "𝔬"; -const ogon = "˛"; -const ograv = "ò"; -const ograve = "ò"; -const ogt = "⧁"; -const ohbar = "⦵"; -const ohm = "Ω"; -const oint = "∮"; -const olarr = "↺"; -const olcir = "⦾"; -const olcross = "⦻"; -const oline = "‾"; -const olt = "⧀"; -const omacr = "ō"; -const omega = "ω"; -const omicron = "ο"; -const omid = "⦶"; -const ominus = "⊖"; -const oopf = "𝕠"; -const opar = "⦷"; -const operp = "⦹"; -const oplus = "⊕"; -const or = "∨"; -const orarr = "↻"; -const ord = "º"; -const order = "ℴ"; -const orderof = "ℴ"; -const ordf = "ª"; -const ordm = "º"; -const origof = "⊶"; -const oror = "⩖"; -const orslope = "⩗"; -const orv = "⩛"; -const oscr = "ℴ"; -const oslas = "ø"; -const oslash = "ø"; -const osol = "⊘"; -const otild = "õ"; -const otilde = "õ"; -const otimes = "⊗"; -const otimesas = "⨶"; -const oum = "ö"; -const ouml = "ö"; -const ovbar = "⌽"; -const par = "¶"; -const para = "¶"; -const parallel = "∥"; -const parsim = "⫳"; -const parsl = "⫽"; -const part = "∂"; -const pcy = "п"; -const percnt = "%"; -const period = "."; -const permil = "‰"; -const perp = "⊥"; -const pertenk = "‱"; -const pfr = "𝔭"; -const phi = "φ"; -const phiv = "ϕ"; -const phmmat = "ℳ"; -const phone = "☎"; -const pi = "π"; -const pitchfork = "⋔"; -const piv = "ϖ"; -const planck = "ℏ"; -const planckh = "ℎ"; -const plankv = "ℏ"; -const plus = "+"; -const plusacir = "⨣"; -const plusb = "⊞"; -const pluscir = "⨢"; -const plusdo = "∔"; -const plusdu = "⨥"; -const pluse = "⩲"; -const plusm = "±"; -const plusmn = "±"; -const plussim = "⨦"; -const plustwo = "⨧"; -const pm = "±"; -const pointint = "⨕"; -const popf = "𝕡"; -const poun = "£"; -const pound = "£"; -const pr = "≺"; -const prE = "⪳"; -const prap = "⪷"; -const prcue = "≼"; -const pre = "⪯"; -const prec = "≺"; -const precapprox = "⪷"; -const preccurlyeq = "≼"; -const preceq = "⪯"; -const precnapprox = "⪹"; -const precneqq = "⪵"; -const precnsim = "⋨"; -const precsim = "≾"; -const prime = "′"; -const primes = "ℙ"; -const prnE = "⪵"; -const prnap = "⪹"; -const prnsim = "⋨"; -const prod = "∏"; -const profalar = "⌮"; -const profline = "⌒"; -const profsurf = "⌓"; -const prop = "∝"; -const propto = "∝"; -const prsim = "≾"; -const prurel = "⊰"; -const pscr = "𝓅"; -const psi = "ψ"; -const puncsp = " "; -const qfr = "𝔮"; -const qint = "⨌"; -const qopf = "𝕢"; -const qprime = "⁗"; -const qscr = "𝓆"; -const quaternions = "ℍ"; -const quatint = "⨖"; -const quest = "?"; -const questeq = "≟"; -const quo = "\""; -const quot = "\""; -const rAarr = "⇛"; -const rArr = "⇒"; -const rAtail = "⤜"; -const rBarr = "⤏"; -const rHar = "⥤"; -const race = "∽̱"; -const racute = "ŕ"; -const radic = "√"; -const raemptyv = "⦳"; -const rang = "⟩"; -const rangd = "⦒"; -const range = "⦥"; -const rangle = "⟩"; -const raqu = "»"; -const raquo = "»"; -const rarr = "→"; -const rarrap = "⥵"; -const rarrb = "⇥"; -const rarrbfs = "⤠"; -const rarrc = "⤳"; -const rarrfs = "⤞"; -const rarrhk = "↪"; -const rarrlp = "↬"; -const rarrpl = "⥅"; -const rarrsim = "⥴"; -const rarrtl = "↣"; -const rarrw = "↝"; -const ratail = "⤚"; -const ratio = "∶"; -const rationals = "ℚ"; -const rbarr = "⤍"; -const rbbrk = "❳"; -const rbrace = "}"; -const rbrack = "]"; -const rbrke = "⦌"; -const rbrksld = "⦎"; -const rbrkslu = "⦐"; -const rcaron = "ř"; -const rcedil = "ŗ"; -const rceil = "⌉"; -const rcub = "}"; -const rcy = "р"; -const rdca = "⤷"; -const rdldhar = "⥩"; -const rdquo = "”"; -const rdquor = "”"; -const rdsh = "↳"; -const real = "ℜ"; -const realine = "ℛ"; -const realpart = "ℜ"; -const reals = "ℝ"; -const rect = "▭"; -const re$4 = "®"; -const reg = "®"; -const rfisht = "⥽"; -const rfloor = "⌋"; -const rfr = "𝔯"; -const rhard = "⇁"; -const rharu = "⇀"; -const rharul = "⥬"; -const rho = "ρ"; -const rhov = "ϱ"; -const rightarrow = "→"; -const rightarrowtail = "↣"; -const rightharpoondown = "⇁"; -const rightharpoonup = "⇀"; -const rightleftarrows = "⇄"; -const rightleftharpoons = "⇌"; -const rightrightarrows = "⇉"; -const rightsquigarrow = "↝"; -const rightthreetimes = "⋌"; -const ring = "˚"; -const risingdotseq = "≓"; -const rlarr = "⇄"; -const rlhar = "⇌"; -const rlm = ""; -const rmoust = "⎱"; -const rmoustache = "⎱"; -const rnmid = "⫮"; -const roang = "⟭"; -const roarr = "⇾"; -const robrk = "⟧"; -const ropar = "⦆"; -const ropf = "𝕣"; -const roplus = "⨮"; -const rotimes = "⨵"; -const rpar = ")"; -const rpargt = "⦔"; -const rppolint = "⨒"; -const rrarr = "⇉"; -const rsaquo = "›"; -const rscr = "𝓇"; -const rsh = "↱"; -const rsqb = "]"; -const rsquo = "’"; -const rsquor = "’"; -const rthree = "⋌"; -const rtimes = "⋊"; -const rtri = "▹"; -const rtrie = "⊵"; -const rtrif = "▸"; -const rtriltri = "⧎"; -const ruluhar = "⥨"; -const rx = "℞"; -const sacute = "ś"; -const sbquo = "‚"; -const sc = "≻"; -const scE = "⪴"; -const scap = "⪸"; -const scaron = "š"; -const sccue = "≽"; -const sce = "⪰"; -const scedil = "ş"; -const scirc = "ŝ"; -const scnE = "⪶"; -const scnap = "⪺"; -const scnsim = "⋩"; -const scpolint = "⨓"; -const scsim = "≿"; -const scy = "с"; -const sdot = "⋅"; -const sdotb = "⊡"; -const sdote = "⩦"; -const seArr = "⇘"; -const searhk = "⤥"; -const searr = "↘"; -const searrow = "↘"; -const sec = "§"; -const sect = "§"; -const semi = ";"; -const seswar = "⤩"; -const setminus = "∖"; -const setmn = "∖"; -const sext = "✶"; -const sfr = "𝔰"; -const sfrown = "⌢"; -const sharp = "♯"; -const shchcy = "щ"; -const shcy = "ш"; -const shortmid = "∣"; -const shortparallel = "∥"; -const sh = ""; -const shy = ""; -const sigma = "σ"; -const sigmaf = "ς"; -const sigmav = "ς"; -const sim = "∼"; -const simdot = "⩪"; -const sime = "≃"; -const simeq = "≃"; -const simg = "⪞"; -const simgE = "⪠"; -const siml = "⪝"; -const simlE = "⪟"; -const simne = "≆"; -const simplus = "⨤"; -const simrarr = "⥲"; -const slarr = "←"; -const smallsetminus = "∖"; -const smashp = "⨳"; -const smeparsl = "⧤"; -const smid = "∣"; -const smile = "⌣"; -const smt = "⪪"; -const smte = "⪬"; -const smtes = "⪬︀"; -const softcy = "ь"; -const sol = "/"; -const solb = "⧄"; -const solbar = "⌿"; -const sopf = "𝕤"; -const spades = "♠"; -const spadesuit = "♠"; -const spar = "∥"; -const sqcap = "⊓"; -const sqcaps = "⊓︀"; -const sqcup = "⊔"; -const sqcups = "⊔︀"; -const sqsub = "⊏"; -const sqsube = "⊑"; -const sqsubset = "⊏"; -const sqsubseteq = "⊑"; -const sqsup = "⊐"; -const sqsupe = "⊒"; -const sqsupset = "⊐"; -const sqsupseteq = "⊒"; -const squ = "□"; -const square = "□"; -const squarf = "▪"; -const squf = "▪"; -const srarr = "→"; -const sscr = "𝓈"; -const ssetmn = "∖"; -const ssmile = "⌣"; -const sstarf = "⋆"; -const star = "☆"; -const starf = "★"; -const straightepsilon = "ϵ"; -const straightphi = "ϕ"; -const strns = "¯"; -const sub = "⊂"; -const subE = "⫅"; -const subdot = "⪽"; -const sube = "⊆"; -const subedot = "⫃"; -const submult = "⫁"; -const subnE = "⫋"; -const subne = "⊊"; -const subplus = "⪿"; -const subrarr = "⥹"; -const subset = "⊂"; -const subseteq = "⊆"; -const subseteqq = "⫅"; -const subsetneq = "⊊"; -const subsetneqq = "⫋"; -const subsim = "⫇"; -const subsub = "⫕"; -const subsup = "⫓"; -const succ = "≻"; -const succapprox = "⪸"; -const succcurlyeq = "≽"; -const succeq = "⪰"; -const succnapprox = "⪺"; -const succneqq = "⪶"; -const succnsim = "⋩"; -const succsim = "≿"; -const sum = "∑"; -const sung = "♪"; -const sup = "⊃"; -const sup1 = "¹"; -const sup2 = "²"; -const sup3 = "³"; -const supE = "⫆"; -const supdot = "⪾"; -const supdsub = "⫘"; -const supe = "⊇"; -const supedot = "⫄"; -const suphsol = "⟉"; -const suphsub = "⫗"; -const suplarr = "⥻"; -const supmult = "⫂"; -const supnE = "⫌"; -const supne = "⊋"; -const supplus = "⫀"; -const supset = "⊃"; -const supseteq = "⊇"; -const supseteqq = "⫆"; -const supsetneq = "⊋"; -const supsetneqq = "⫌"; -const supsim = "⫈"; -const supsub = "⫔"; -const supsup = "⫖"; -const swArr = "⇙"; -const swarhk = "⤦"; -const swarr = "↙"; -const swarrow = "↙"; -const swnwar = "⤪"; -const szli = "ß"; -const szlig = "ß"; -const target = "⌖"; -const tau = "τ"; -const tbrk = "⎴"; -const tcaron = "ť"; -const tcedil = "ţ"; -const tcy = "т"; -const tdot = "⃛"; -const telrec = "⌕"; -const tfr = "𝔱"; -const there4 = "∴"; -const therefore = "∴"; -const theta = "θ"; -const thetasym = "ϑ"; -const thetav = "ϑ"; -const thickapprox = "≈"; -const thicksim = "∼"; -const thinsp = " "; -const thkap = "≈"; -const thksim = "∼"; -const thor = "þ"; -const thorn = "þ"; -const tilde = "˜"; -const time = "×"; -const times = "×"; -const timesb = "⊠"; -const timesbar = "⨱"; -const timesd = "⨰"; -const tint = "∭"; -const toea = "⤨"; -const top = "⊤"; -const topbot = "⌶"; -const topcir = "⫱"; -const topf = "𝕥"; -const topfork = "⫚"; -const tosa = "⤩"; -const tprime = "‴"; -const trade = "™"; -const triangle = "▵"; -const triangledown = "▿"; -const triangleleft = "◃"; -const trianglelefteq = "⊴"; -const triangleq = "≜"; -const triangleright = "▹"; -const trianglerighteq = "⊵"; -const tridot = "◬"; -const trie = "≜"; -const triminus = "⨺"; -const triplus = "⨹"; -const trisb = "⧍"; -const tritime = "⨻"; -const trpezium = "⏢"; -const tscr = "𝓉"; -const tscy = "ц"; -const tshcy = "ћ"; -const tstrok = "ŧ"; -const twixt = "≬"; -const twoheadleftarrow = "↞"; -const twoheadrightarrow = "↠"; -const uArr = "⇑"; -const uHar = "⥣"; -const uacut = "ú"; -const uacute = "ú"; -const uarr = "↑"; -const ubrcy = "ў"; -const ubreve = "ŭ"; -const ucir = "û"; -const ucirc = "û"; -const ucy = "у"; -const udarr = "⇅"; -const udblac = "ű"; -const udhar = "⥮"; -const ufisht = "⥾"; -const ufr = "𝔲"; -const ugrav = "ù"; -const ugrave = "ù"; -const uharl = "↿"; -const uharr = "↾"; -const uhblk = "▀"; -const ulcorn = "⌜"; -const ulcorner = "⌜"; -const ulcrop = "⌏"; -const ultri = "◸"; -const umacr = "ū"; -const um = "¨"; -const uml = "¨"; -const uogon = "ų"; -const uopf = "𝕦"; -const uparrow = "↑"; -const updownarrow = "↕"; -const upharpoonleft = "↿"; -const upharpoonright = "↾"; -const uplus = "⊎"; -const upsi = "υ"; -const upsih = "ϒ"; -const upsilon = "υ"; -const upuparrows = "⇈"; -const urcorn = "⌝"; -const urcorner = "⌝"; -const urcrop = "⌎"; -const uring = "ů"; -const urtri = "◹"; -const uscr = "𝓊"; -const utdot = "⋰"; -const utilde = "ũ"; -const utri = "▵"; -const utrif = "▴"; -const uuarr = "⇈"; -const uum = "ü"; -const uuml = "ü"; -const uwangle = "⦧"; -const vArr = "⇕"; -const vBar = "⫨"; -const vBarv = "⫩"; -const vDash = "⊨"; -const vangrt = "⦜"; -const varepsilon = "ϵ"; -const varkappa = "ϰ"; -const varnothing = "∅"; -const varphi = "ϕ"; -const varpi = "ϖ"; -const varpropto = "∝"; -const varr = "↕"; -const varrho = "ϱ"; -const varsigma = "ς"; -const varsubsetneq = "⊊︀"; -const varsubsetneqq = "⫋︀"; -const varsupsetneq = "⊋︀"; -const varsupsetneqq = "⫌︀"; -const vartheta = "ϑ"; -const vartriangleleft = "⊲"; -const vartriangleright = "⊳"; -const vcy = "в"; -const vdash = "⊢"; -const vee = "∨"; -const veebar = "⊻"; -const veeeq = "≚"; -const vellip = "⋮"; -const verbar = "|"; -const vert = "|"; -const vfr = "𝔳"; -const vltri = "⊲"; -const vnsub = "⊂⃒"; -const vnsup = "⊃⃒"; -const vopf = "𝕧"; -const vprop = "∝"; -const vrtri = "⊳"; -const vscr = "𝓋"; -const vsubnE = "⫋︀"; -const vsubne = "⊊︀"; -const vsupnE = "⫌︀"; -const vsupne = "⊋︀"; -const vzigzag = "⦚"; -const wcirc = "ŵ"; -const wedbar = "⩟"; -const wedge = "∧"; -const wedgeq = "≙"; -const weierp = "℘"; -const wfr = "𝔴"; -const wopf = "𝕨"; -const wp = "℘"; -const wr = "≀"; -const wreath = "≀"; -const wscr = "𝓌"; -const xcap = "⋂"; -const xcirc = "◯"; -const xcup = "⋃"; -const xdtri = "▽"; -const xfr = "𝔵"; -const xhArr = "⟺"; -const xharr = "⟷"; -const xi = "ξ"; -const xlArr = "⟸"; -const xlarr = "⟵"; -const xmap = "⟼"; -const xnis = "⋻"; -const xodot = "⨀"; -const xopf = "𝕩"; -const xoplus = "⨁"; -const xotime = "⨂"; -const xrArr = "⟹"; -const xrarr = "⟶"; -const xscr = "𝓍"; -const xsqcup = "⨆"; -const xuplus = "⨄"; -const xutri = "△"; -const xvee = "⋁"; -const xwedge = "⋀"; -const yacut = "ý"; -const yacute = "ý"; -const yacy = "я"; -const ycirc = "ŷ"; -const ycy = "ы"; -const ye = "¥"; -const yen = "¥"; -const yfr = "𝔶"; -const yicy = "ї"; -const yopf = "𝕪"; -const yscr = "𝓎"; -const yucy = "ю"; -const yum = "ÿ"; -const yuml = "ÿ"; -const zacute = "ź"; -const zcaron = "ž"; -const zcy = "з"; -const zdot = "ż"; -const zeetrf = "ℨ"; -const zeta = "ζ"; -const zfr = "𝔷"; -const zhcy = "ж"; -const zigrarr = "⇝"; -const zopf = "𝕫"; -const zscr = "𝓏"; -const zwj = ""; -const zwnj = ""; -var require$$0 = { - AEli: AEli, - AElig: AElig, - AM: AM, - AMP: AMP, - Aacut: Aacut, - Aacute: Aacute, - Abreve: Abreve, - Acir: Acir, - Acirc: Acirc, - Acy: Acy, - Afr: Afr, - Agrav: Agrav, - Agrave: Agrave, - Alpha: Alpha, - Amacr: Amacr, - And: And, - Aogon: Aogon, - Aopf: Aopf, - ApplyFunction: ApplyFunction, - Arin: Arin, - Aring: Aring, - Ascr: Ascr, - Assign: Assign, - Atild: Atild, - Atilde: Atilde, - Aum: Aum, - Auml: Auml, - Backslash: Backslash, - Barv: Barv, - Barwed: Barwed, - Bcy: Bcy, - Because: Because, - Bernoullis: Bernoullis, - Beta: Beta, - Bfr: Bfr, - Bopf: Bopf, - Breve: Breve, - Bscr: Bscr, - Bumpeq: Bumpeq, - CHcy: CHcy, - COP: COP, - COPY: COPY, - Cacute: Cacute, - Cap: Cap, - CapitalDifferentialD: CapitalDifferentialD, - Cayleys: Cayleys, - Ccaron: Ccaron, - Ccedi: Ccedi, - Ccedil: Ccedil, - Ccirc: Ccirc, - Cconint: Cconint, - Cdot: Cdot, - Cedilla: Cedilla, - CenterDot: CenterDot, - Cfr: Cfr, - Chi: Chi, - CircleDot: CircleDot, - CircleMinus: CircleMinus, - CirclePlus: CirclePlus, - CircleTimes: CircleTimes, - ClockwiseContourIntegral: ClockwiseContourIntegral, - CloseCurlyDoubleQuote: CloseCurlyDoubleQuote, - CloseCurlyQuote: CloseCurlyQuote, - Colon: Colon, - Colone: Colone, - Congruent: Congruent, - Conint: Conint, - ContourIntegral: ContourIntegral, - Copf: Copf, - Coproduct: Coproduct, - CounterClockwiseContourIntegral: CounterClockwiseContourIntegral, - Cross: Cross, - Cscr: Cscr, - Cup: Cup, - CupCap: CupCap, - DD: DD, - DDotrahd: DDotrahd, - DJcy: DJcy, - DScy: DScy, - DZcy: DZcy, - Dagger: Dagger, - Darr: Darr, - Dashv: Dashv, - Dcaron: Dcaron, - Dcy: Dcy, - Del: Del, - Delta: Delta, - Dfr: Dfr, - DiacriticalAcute: DiacriticalAcute, - DiacriticalDot: DiacriticalDot, - DiacriticalDoubleAcute: DiacriticalDoubleAcute, - DiacriticalGrave: DiacriticalGrave, - DiacriticalTilde: DiacriticalTilde, - Diamond: Diamond, - DifferentialD: DifferentialD, - Dopf: Dopf, - Dot: Dot, - DotDot: DotDot, - DotEqual: DotEqual, - DoubleContourIntegral: DoubleContourIntegral, - DoubleDot: DoubleDot, - DoubleDownArrow: DoubleDownArrow, - DoubleLeftArrow: DoubleLeftArrow, - DoubleLeftRightArrow: DoubleLeftRightArrow, - DoubleLeftTee: DoubleLeftTee, - DoubleLongLeftArrow: DoubleLongLeftArrow, - DoubleLongLeftRightArrow: DoubleLongLeftRightArrow, - DoubleLongRightArrow: DoubleLongRightArrow, - DoubleRightArrow: DoubleRightArrow, - DoubleRightTee: DoubleRightTee, - DoubleUpArrow: DoubleUpArrow, - DoubleUpDownArrow: DoubleUpDownArrow, - DoubleVerticalBar: DoubleVerticalBar, - DownArrow: DownArrow, - DownArrowBar: DownArrowBar, - DownArrowUpArrow: DownArrowUpArrow, - DownBreve: DownBreve, - DownLeftRightVector: DownLeftRightVector, - DownLeftTeeVector: DownLeftTeeVector, - DownLeftVector: DownLeftVector, - DownLeftVectorBar: DownLeftVectorBar, - DownRightTeeVector: DownRightTeeVector, - DownRightVector: DownRightVector, - DownRightVectorBar: DownRightVectorBar, - DownTee: DownTee, - DownTeeArrow: DownTeeArrow, - Downarrow: Downarrow, - Dscr: Dscr, - Dstrok: Dstrok, - ENG: ENG, - ET: ET, - ETH: ETH, - Eacut: Eacut, - Eacute: Eacute, - Ecaron: Ecaron, - Ecir: Ecir, - Ecirc: Ecirc, - Ecy: Ecy, - Edot: Edot, - Efr: Efr, - Egrav: Egrav, - Egrave: Egrave, - Element: Element, - Emacr: Emacr, - EmptySmallSquare: EmptySmallSquare, - EmptyVerySmallSquare: EmptyVerySmallSquare, - Eogon: Eogon, - Eopf: Eopf, - Epsilon: Epsilon, - Equal: Equal, - EqualTilde: EqualTilde, - Equilibrium: Equilibrium, - Escr: Escr, - Esim: Esim, - Eta: Eta, - Eum: Eum, - Euml: Euml, - Exists: Exists, - ExponentialE: ExponentialE, - Fcy: Fcy, - Ffr: Ffr, - FilledSmallSquare: FilledSmallSquare, - FilledVerySmallSquare: FilledVerySmallSquare, - Fopf: Fopf, - ForAll: ForAll, - Fouriertrf: Fouriertrf, - Fscr: Fscr, - GJcy: GJcy, - G: G, - GT: GT, - Gamma: Gamma, - Gammad: Gammad, - Gbreve: Gbreve, - Gcedil: Gcedil, - Gcirc: Gcirc, - Gcy: Gcy, - Gdot: Gdot, - Gfr: Gfr, - Gg: Gg, - Gopf: Gopf, - GreaterEqual: GreaterEqual, - GreaterEqualLess: GreaterEqualLess, - GreaterFullEqual: GreaterFullEqual, - GreaterGreater: GreaterGreater, - GreaterLess: GreaterLess, - GreaterSlantEqual: GreaterSlantEqual, - GreaterTilde: GreaterTilde, - Gscr: Gscr, - Gt: Gt, - HARDcy: HARDcy, - Hacek: Hacek, - Hat: Hat, - Hcirc: Hcirc, - Hfr: Hfr, - HilbertSpace: HilbertSpace, - Hopf: Hopf, - HorizontalLine: HorizontalLine, - Hscr: Hscr, - Hstrok: Hstrok, - HumpDownHump: HumpDownHump, - HumpEqual: HumpEqual, - IEcy: IEcy, - IJlig: IJlig, - IOcy: IOcy, - Iacut: Iacut, - Iacute: Iacute, - Icir: Icir, - Icirc: Icirc, - Icy: Icy, - Idot: Idot, - Ifr: Ifr, - Igrav: Igrav, - Igrave: Igrave, - Im: Im, - Imacr: Imacr, - ImaginaryI: ImaginaryI, - Implies: Implies, - Int: Int, - Integral: Integral, - Intersection: Intersection, - InvisibleComma: InvisibleComma, - InvisibleTimes: InvisibleTimes, - Iogon: Iogon, - Iopf: Iopf, - Iota: Iota, - Iscr: Iscr, - Itilde: Itilde, - Iukcy: Iukcy, - Ium: Ium, - Iuml: Iuml, - Jcirc: Jcirc, - Jcy: Jcy, - Jfr: Jfr, - Jopf: Jopf, - Jscr: Jscr, - Jsercy: Jsercy, - Jukcy: Jukcy, - KHcy: KHcy, - KJcy: KJcy, - Kappa: Kappa, - Kcedil: Kcedil, - Kcy: Kcy, - Kfr: Kfr, - Kopf: Kopf, - Kscr: Kscr, - LJcy: LJcy, - L: L, - LT: LT, - Lacute: Lacute, - Lambda: Lambda, - Lang: Lang, - Laplacetrf: Laplacetrf, - Larr: Larr, - Lcaron: Lcaron, - Lcedil: Lcedil, - Lcy: Lcy, - LeftAngleBracket: LeftAngleBracket, - LeftArrow: LeftArrow, - LeftArrowBar: LeftArrowBar, - LeftArrowRightArrow: LeftArrowRightArrow, - LeftCeiling: LeftCeiling, - LeftDoubleBracket: LeftDoubleBracket, - LeftDownTeeVector: LeftDownTeeVector, - LeftDownVector: LeftDownVector, - LeftDownVectorBar: LeftDownVectorBar, - LeftFloor: LeftFloor, - LeftRightArrow: LeftRightArrow, - LeftRightVector: LeftRightVector, - LeftTee: LeftTee, - LeftTeeArrow: LeftTeeArrow, - LeftTeeVector: LeftTeeVector, - LeftTriangle: LeftTriangle, - LeftTriangleBar: LeftTriangleBar, - LeftTriangleEqual: LeftTriangleEqual, - LeftUpDownVector: LeftUpDownVector, - LeftUpTeeVector: LeftUpTeeVector, - LeftUpVector: LeftUpVector, - LeftUpVectorBar: LeftUpVectorBar, - LeftVector: LeftVector, - LeftVectorBar: LeftVectorBar, - Leftarrow: Leftarrow, - Leftrightarrow: Leftrightarrow, - LessEqualGreater: LessEqualGreater, - LessFullEqual: LessFullEqual, - LessGreater: LessGreater, - LessLess: LessLess, - LessSlantEqual: LessSlantEqual, - LessTilde: LessTilde, - Lfr: Lfr, - Ll: Ll, - Lleftarrow: Lleftarrow, - Lmidot: Lmidot, - LongLeftArrow: LongLeftArrow, - LongLeftRightArrow: LongLeftRightArrow, - LongRightArrow: LongRightArrow, - Longleftarrow: Longleftarrow, - Longleftrightarrow: Longleftrightarrow, - Longrightarrow: Longrightarrow, - Lopf: Lopf, - LowerLeftArrow: LowerLeftArrow, - LowerRightArrow: LowerRightArrow, - Lscr: Lscr, - Lsh: Lsh, - Lstrok: Lstrok, - Lt: Lt, - "Map": "⤅", - Mcy: Mcy, - MediumSpace: MediumSpace, - Mellintrf: Mellintrf, - Mfr: Mfr, - MinusPlus: MinusPlus, - Mopf: Mopf, - Mscr: Mscr, - Mu: Mu, - NJcy: NJcy, - Nacute: Nacute, - Ncaron: Ncaron, - Ncedil: Ncedil, - Ncy: Ncy, - NegativeMediumSpace: NegativeMediumSpace, - NegativeThickSpace: NegativeThickSpace, - NegativeThinSpace: NegativeThinSpace, - NegativeVeryThinSpace: NegativeVeryThinSpace, - NestedGreaterGreater: NestedGreaterGreater, - NestedLessLess: NestedLessLess, - NewLine: NewLine, - Nfr: Nfr, - NoBreak: NoBreak, - NonBreakingSpace: NonBreakingSpace, - Nopf: Nopf, - Not: Not, - NotCongruent: NotCongruent, - NotCupCap: NotCupCap, - NotDoubleVerticalBar: NotDoubleVerticalBar, - NotElement: NotElement, - NotEqual: NotEqual, - NotEqualTilde: NotEqualTilde, - NotExists: NotExists, - NotGreater: NotGreater, - NotGreaterEqual: NotGreaterEqual, - NotGreaterFullEqual: NotGreaterFullEqual, - NotGreaterGreater: NotGreaterGreater, - NotGreaterLess: NotGreaterLess, - NotGreaterSlantEqual: NotGreaterSlantEqual, - NotGreaterTilde: NotGreaterTilde, - NotHumpDownHump: NotHumpDownHump, - NotHumpEqual: NotHumpEqual, - NotLeftTriangle: NotLeftTriangle, - NotLeftTriangleBar: NotLeftTriangleBar, - NotLeftTriangleEqual: NotLeftTriangleEqual, - NotLess: NotLess, - NotLessEqual: NotLessEqual, - NotLessGreater: NotLessGreater, - NotLessLess: NotLessLess, - NotLessSlantEqual: NotLessSlantEqual, - NotLessTilde: NotLessTilde, - NotNestedGreaterGreater: NotNestedGreaterGreater, - NotNestedLessLess: NotNestedLessLess, - NotPrecedes: NotPrecedes, - NotPrecedesEqual: NotPrecedesEqual, - NotPrecedesSlantEqual: NotPrecedesSlantEqual, - NotReverseElement: NotReverseElement, - NotRightTriangle: NotRightTriangle, - NotRightTriangleBar: NotRightTriangleBar, - NotRightTriangleEqual: NotRightTriangleEqual, - NotSquareSubset: NotSquareSubset, - NotSquareSubsetEqual: NotSquareSubsetEqual, - NotSquareSuperset: NotSquareSuperset, - NotSquareSupersetEqual: NotSquareSupersetEqual, - NotSubset: NotSubset, - NotSubsetEqual: NotSubsetEqual, - NotSucceeds: NotSucceeds, - NotSucceedsEqual: NotSucceedsEqual, - NotSucceedsSlantEqual: NotSucceedsSlantEqual, - NotSucceedsTilde: NotSucceedsTilde, - NotSuperset: NotSuperset, - NotSupersetEqual: NotSupersetEqual, - NotTilde: NotTilde, - NotTildeEqual: NotTildeEqual, - NotTildeFullEqual: NotTildeFullEqual, - NotTildeTilde: NotTildeTilde, - NotVerticalBar: NotVerticalBar, - Nscr: Nscr, - Ntild: Ntild, - Ntilde: Ntilde, - Nu: Nu, - OElig: OElig, - Oacut: Oacut, - Oacute: Oacute, - Ocir: Ocir, - Ocirc: Ocirc, - Ocy: Ocy, - Odblac: Odblac, - Ofr: Ofr, - Ograv: Ograv, - Ograve: Ograve, - Omacr: Omacr, - Omega: Omega, - Omicron: Omicron, - Oopf: Oopf, - OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, - OpenCurlyQuote: OpenCurlyQuote, - Or: Or, - Oscr: Oscr, - Oslas: Oslas, - Oslash: Oslash, - Otild: Otild, - Otilde: Otilde, - Otimes: Otimes, - Oum: Oum, - Ouml: Ouml, - OverBar: OverBar, - OverBrace: OverBrace, - OverBracket: OverBracket, - OverParenthesis: OverParenthesis, - PartialD: PartialD, - Pcy: Pcy, - Pfr: Pfr, - Phi: Phi, - Pi: Pi, - PlusMinus: PlusMinus, - Poincareplane: Poincareplane, - Popf: Popf, - Pr: Pr, - Precedes: Precedes, - PrecedesEqual: PrecedesEqual, - PrecedesSlantEqual: PrecedesSlantEqual, - PrecedesTilde: PrecedesTilde, - Prime: Prime, - Product: Product, - Proportion: Proportion, - Proportional: Proportional, - Pscr: Pscr, - Psi: Psi, - QUO: QUO, - QUOT: QUOT, - Qfr: Qfr, - Qopf: Qopf, - Qscr: Qscr, - RBarr: RBarr, - RE: RE, - REG: REG, - Racute: Racute, - Rang: Rang, - Rarr: Rarr, - Rarrtl: Rarrtl, - Rcaron: Rcaron, - Rcedil: Rcedil, - Rcy: Rcy, - Re: Re, - ReverseElement: ReverseElement, - ReverseEquilibrium: ReverseEquilibrium, - ReverseUpEquilibrium: ReverseUpEquilibrium, - Rfr: Rfr, - Rho: Rho, - RightAngleBracket: RightAngleBracket, - RightArrow: RightArrow, - RightArrowBar: RightArrowBar, - RightArrowLeftArrow: RightArrowLeftArrow, - RightCeiling: RightCeiling, - RightDoubleBracket: RightDoubleBracket, - RightDownTeeVector: RightDownTeeVector, - RightDownVector: RightDownVector, - RightDownVectorBar: RightDownVectorBar, - RightFloor: RightFloor, - RightTee: RightTee, - RightTeeArrow: RightTeeArrow, - RightTeeVector: RightTeeVector, - RightTriangle: RightTriangle, - RightTriangleBar: RightTriangleBar, - RightTriangleEqual: RightTriangleEqual, - RightUpDownVector: RightUpDownVector, - RightUpTeeVector: RightUpTeeVector, - RightUpVector: RightUpVector, - RightUpVectorBar: RightUpVectorBar, - RightVector: RightVector, - RightVectorBar: RightVectorBar, - Rightarrow: Rightarrow, - Ropf: Ropf, - RoundImplies: RoundImplies, - Rrightarrow: Rrightarrow, - Rscr: Rscr, - Rsh: Rsh, - RuleDelayed: RuleDelayed, - SHCHcy: SHCHcy, - SHcy: SHcy, - SOFTcy: SOFTcy, - Sacute: Sacute, - Sc: Sc, - Scaron: Scaron, - Scedil: Scedil, - Scirc: Scirc, - Scy: Scy, - Sfr: Sfr, - ShortDownArrow: ShortDownArrow, - ShortLeftArrow: ShortLeftArrow, - ShortRightArrow: ShortRightArrow, - ShortUpArrow: ShortUpArrow, - Sigma: Sigma, - SmallCircle: SmallCircle, - Sopf: Sopf, - Sqrt: Sqrt, - Square: Square, - SquareIntersection: SquareIntersection, - SquareSubset: SquareSubset, - SquareSubsetEqual: SquareSubsetEqual, - SquareSuperset: SquareSuperset, - SquareSupersetEqual: SquareSupersetEqual, - SquareUnion: SquareUnion, - Sscr: Sscr, - Star: Star, - Sub: Sub, - Subset: Subset, - SubsetEqual: SubsetEqual, - Succeeds: Succeeds, - SucceedsEqual: SucceedsEqual, - SucceedsSlantEqual: SucceedsSlantEqual, - SucceedsTilde: SucceedsTilde, - SuchThat: SuchThat, - Sum: Sum, - Sup: Sup, - Superset: Superset, - SupersetEqual: SupersetEqual, - Supset: Supset, - THOR: THOR, - THORN: THORN, - TRADE: TRADE, - TSHcy: TSHcy, - TScy: TScy, - Tab: Tab, - Tau: Tau, - Tcaron: Tcaron, - Tcedil: Tcedil, - Tcy: Tcy, - Tfr: Tfr, - Therefore: Therefore, - Theta: Theta, - ThickSpace: ThickSpace, - ThinSpace: ThinSpace, - Tilde: Tilde, - TildeEqual: TildeEqual, - TildeFullEqual: TildeFullEqual, - TildeTilde: TildeTilde, - Topf: Topf, - TripleDot: TripleDot, - Tscr: Tscr, - Tstrok: Tstrok, - Uacut: Uacut, - Uacute: Uacute, - Uarr: Uarr, - Uarrocir: Uarrocir, - Ubrcy: Ubrcy, - Ubreve: Ubreve, - Ucir: Ucir, - Ucirc: Ucirc, - Ucy: Ucy, - Udblac: Udblac, - Ufr: Ufr, - Ugrav: Ugrav, - Ugrave: Ugrave, - Umacr: Umacr, - UnderBar: UnderBar, - UnderBrace: UnderBrace, - UnderBracket: UnderBracket, - UnderParenthesis: UnderParenthesis, - Union: Union, - UnionPlus: UnionPlus, - Uogon: Uogon, - Uopf: Uopf, - UpArrow: UpArrow, - UpArrowBar: UpArrowBar, - UpArrowDownArrow: UpArrowDownArrow, - UpDownArrow: UpDownArrow, - UpEquilibrium: UpEquilibrium, - UpTee: UpTee, - UpTeeArrow: UpTeeArrow, - Uparrow: Uparrow, - Updownarrow: Updownarrow, - UpperLeftArrow: UpperLeftArrow, - UpperRightArrow: UpperRightArrow, - Upsi: Upsi, - Upsilon: Upsilon, - Uring: Uring, - Uscr: Uscr, - Utilde: Utilde, - Uum: Uum, - Uuml: Uuml, - VDash: VDash, - Vbar: Vbar, - Vcy: Vcy, - Vdash: Vdash, - Vdashl: Vdashl, - Vee: Vee, - Verbar: Verbar, - Vert: Vert, - VerticalBar: VerticalBar, - VerticalLine: VerticalLine, - VerticalSeparator: VerticalSeparator, - VerticalTilde: VerticalTilde, - VeryThinSpace: VeryThinSpace, - Vfr: Vfr, - Vopf: Vopf, - Vscr: Vscr, - Vvdash: Vvdash, - Wcirc: Wcirc, - Wedge: Wedge, - Wfr: Wfr, - Wopf: Wopf, - Wscr: Wscr, - Xfr: Xfr, - Xi: Xi, - Xopf: Xopf, - Xscr: Xscr, - YAcy: YAcy, - YIcy: YIcy, - YUcy: YUcy, - Yacut: Yacut, - Yacute: Yacute, - Ycirc: Ycirc, - Ycy: Ycy, - Yfr: Yfr, - Yopf: Yopf, - Yscr: Yscr, - Yuml: Yuml, - ZHcy: ZHcy, - Zacute: Zacute, - Zcaron: Zcaron, - Zcy: Zcy, - Zdot: Zdot, - ZeroWidthSpace: ZeroWidthSpace, - Zeta: Zeta, - Zfr: Zfr, - Zopf: Zopf, - Zscr: Zscr, - aacut: aacut, - aacute: aacute, - abreve: abreve, - ac: ac, - acE: acE, - acd: acd, - acir: acir, - acirc: acirc, - acut: acut, - acute: acute, - acy: acy, - aeli: aeli, - aelig: aelig, - af: af, - afr: afr, - agrav: agrav, - agrave: agrave, - alefsym: alefsym, - aleph: aleph, - alpha: alpha, - amacr: amacr, - amalg: amalg, - am: am, - amp: amp, - and: and, - andand: andand, - andd: andd, - andslope: andslope, - andv: andv, - ang: ang, - ange: ange, - angle: angle, - angmsd: angmsd, - angmsdaa: angmsdaa, - angmsdab: angmsdab, - angmsdac: angmsdac, - angmsdad: angmsdad, - angmsdae: angmsdae, - angmsdaf: angmsdaf, - angmsdag: angmsdag, - angmsdah: angmsdah, - angrt: angrt, - angrtvb: angrtvb, - angrtvbd: angrtvbd, - angsph: angsph, - angst: angst, - angzarr: angzarr, - aogon: aogon, - aopf: aopf, - ap: ap, - apE: apE, - apacir: apacir, - ape: ape, - apid: apid, - apos: apos, - approx: approx, - approxeq: approxeq, - arin: arin, - aring: aring, - ascr: ascr, - ast: ast, - asymp: asymp, - asympeq: asympeq, - atild: atild, - atilde: atilde, - aum: aum, - auml: auml, - awconint: awconint, - awint: awint, - bNot: bNot, - backcong: backcong, - backepsilon: backepsilon, - backprime: backprime, - backsim: backsim, - backsimeq: backsimeq, - barvee: barvee, - barwed: barwed, - barwedge: barwedge, - bbrk: bbrk, - bbrktbrk: bbrktbrk, - bcong: bcong, - bcy: bcy, - bdquo: bdquo, - becaus: becaus, - because: because, - bemptyv: bemptyv, - bepsi: bepsi, - bernou: bernou, - beta: beta, - beth: beth, - between: between, - bfr: bfr, - bigcap: bigcap, - bigcirc: bigcirc, - bigcup: bigcup, - bigodot: bigodot, - bigoplus: bigoplus, - bigotimes: bigotimes, - bigsqcup: bigsqcup, - bigstar: bigstar, - bigtriangledown: bigtriangledown, - bigtriangleup: bigtriangleup, - biguplus: biguplus, - bigvee: bigvee, - bigwedge: bigwedge, - bkarow: bkarow, - blacklozenge: blacklozenge, - blacksquare: blacksquare, - blacktriangle: blacktriangle, - blacktriangledown: blacktriangledown, - blacktriangleleft: blacktriangleleft, - blacktriangleright: blacktriangleright, - blank: blank, - blk12: blk12, - blk14: blk14, - blk34: blk34, - block: block, - bne: bne, - bnequiv: bnequiv, - bnot: bnot, - bopf: bopf, - bot: bot, - bottom: bottom, - bowtie: bowtie, - boxDL: boxDL, - boxDR: boxDR, - boxDl: boxDl, - boxDr: boxDr, - boxH: boxH, - boxHD: boxHD, - boxHU: boxHU, - boxHd: boxHd, - boxHu: boxHu, - boxUL: boxUL, - boxUR: boxUR, - boxUl: boxUl, - boxUr: boxUr, - boxV: boxV, - boxVH: boxVH, - boxVL: boxVL, - boxVR: boxVR, - boxVh: boxVh, - boxVl: boxVl, - boxVr: boxVr, - boxbox: boxbox, - boxdL: boxdL, - boxdR: boxdR, - boxdl: boxdl, - boxdr: boxdr, - boxh: boxh, - boxhD: boxhD, - boxhU: boxhU, - boxhd: boxhd, - boxhu: boxhu, - boxminus: boxminus, - boxplus: boxplus, - boxtimes: boxtimes, - boxuL: boxuL, - boxuR: boxuR, - boxul: boxul, - boxur: boxur, - boxv: boxv, - boxvH: boxvH, - boxvL: boxvL, - boxvR: boxvR, - boxvh: boxvh, - boxvl: boxvl, - boxvr: boxvr, - bprime: bprime, - breve: breve, - brvba: brvba, - brvbar: brvbar, - bscr: bscr, - bsemi: bsemi, - bsim: bsim, - bsime: bsime, - bsol: bsol, - bsolb: bsolb, - bsolhsub: bsolhsub, - bull: bull, - bullet: bullet, - bump: bump, - bumpE: bumpE, - bumpe: bumpe, - bumpeq: bumpeq, - cacute: cacute, - cap: cap, - capand: capand, - capbrcup: capbrcup, - capcap: capcap, - capcup: capcup, - capdot: capdot, - caps: caps, - caret: caret, - caron: caron, - ccaps: ccaps, - ccaron: ccaron, - ccedi: ccedi, - ccedil: ccedil, - ccirc: ccirc, - ccups: ccups, - ccupssm: ccupssm, - cdot: cdot, - cedi: cedi, - cedil: cedil, - cemptyv: cemptyv, - cen: cen, - cent: cent, - centerdot: centerdot, - cfr: cfr, - chcy: chcy, - check: check$1, - checkmark: checkmark, - chi: chi, - cir: cir, - cirE: cirE, - circ: circ, - circeq: circeq, - circlearrowleft: circlearrowleft, - circlearrowright: circlearrowright, - circledR: circledR, - circledS: circledS, - circledast: circledast, - circledcirc: circledcirc, - circleddash: circleddash, - cire: cire, - cirfnint: cirfnint, - cirmid: cirmid, - cirscir: cirscir, - clubs: clubs, - clubsuit: clubsuit, - colon: colon, - colone: colone, - coloneq: coloneq, - comma: comma, - commat: commat, - comp: comp, - compfn: compfn, - complement: complement, - complexes: complexes, - cong: cong, - congdot: congdot, - conint: conint, - copf: copf, - coprod: coprod, - cop: cop, - copy: copy, - copysr: copysr, - crarr: crarr, - cross: cross, - cscr: cscr, - csub: csub, - csube: csube, - csup: csup, - csupe: csupe, - ctdot: ctdot, - cudarrl: cudarrl, - cudarrr: cudarrr, - cuepr: cuepr, - cuesc: cuesc, - cularr: cularr, - cularrp: cularrp, - cup: cup, - cupbrcap: cupbrcap, - cupcap: cupcap, - cupcup: cupcup, - cupdot: cupdot, - cupor: cupor, - cups: cups, - curarr: curarr, - curarrm: curarrm, - curlyeqprec: curlyeqprec, - curlyeqsucc: curlyeqsucc, - curlyvee: curlyvee, - curlywedge: curlywedge, - curre: curre, - curren: curren, - curvearrowleft: curvearrowleft, - curvearrowright: curvearrowright, - cuvee: cuvee, - cuwed: cuwed, - cwconint: cwconint, - cwint: cwint, - cylcty: cylcty, - dArr: dArr, - dHar: dHar, - dagger: dagger, - daleth: daleth, - darr: darr, - dash: dash, - dashv: dashv, - dbkarow: dbkarow, - dblac: dblac, - dcaron: dcaron, - dcy: dcy, - dd: dd, - ddagger: ddagger, - ddarr: ddarr, - ddotseq: ddotseq, - de: de, - deg: deg, - delta: delta, - demptyv: demptyv, - dfisht: dfisht, - dfr: dfr, - dharl: dharl, - dharr: dharr, - diam: diam, - diamond: diamond, - diamondsuit: diamondsuit, - diams: diams, - die: die, - digamma: digamma, - disin: disin, - div: div, - divid: divid, - divide: divide, - divideontimes: divideontimes, - divonx: divonx, - djcy: djcy, - dlcorn: dlcorn, - dlcrop: dlcrop, - dollar: dollar, - dopf: dopf, - dot: dot, - doteq: doteq, - doteqdot: doteqdot, - dotminus: dotminus, - dotplus: dotplus, - dotsquare: dotsquare, - doublebarwedge: doublebarwedge, - downarrow: downarrow, - downdownarrows: downdownarrows, - downharpoonleft: downharpoonleft, - downharpoonright: downharpoonright, - drbkarow: drbkarow, - drcorn: drcorn, - drcrop: drcrop, - dscr: dscr, - dscy: dscy, - dsol: dsol, - dstrok: dstrok, - dtdot: dtdot, - dtri: dtri, - dtrif: dtrif, - duarr: duarr, - duhar: duhar, - dwangle: dwangle, - dzcy: dzcy, - dzigrarr: dzigrarr, - eDDot: eDDot, - eDot: eDot, - eacut: eacut, - eacute: eacute, - easter: easter, - ecaron: ecaron, - ecir: ecir, - ecirc: ecirc, - ecolon: ecolon, - ecy: ecy, - edot: edot, - ee: ee, - efDot: efDot, - efr: efr, - eg: eg, - egrav: egrav, - egrave: egrave, - egs: egs, - egsdot: egsdot, - el: el, - elinters: elinters, - ell: ell, - els: els, - elsdot: elsdot, - emacr: emacr, - empty: empty, - emptyset: emptyset, - emptyv: emptyv, - emsp13: emsp13, - emsp14: emsp14, - emsp: emsp, - eng: eng, - ensp: ensp, - eogon: eogon, - eopf: eopf, - epar: epar, - eparsl: eparsl, - eplus: eplus, - epsi: epsi, - epsilon: epsilon, - epsiv: epsiv, - eqcirc: eqcirc, - eqcolon: eqcolon, - eqsim: eqsim, - eqslantgtr: eqslantgtr, - eqslantless: eqslantless, - equals: equals, - equest: equest, - equiv: equiv, - equivDD: equivDD, - eqvparsl: eqvparsl, - erDot: erDot, - erarr: erarr, - escr: escr, - esdot: esdot, - esim: esim, - eta: eta, - et: et, - eth: eth, - eum: eum, - euml: euml, - euro: euro, - excl: excl, - exist: exist, - expectation: expectation, - exponentiale: exponentiale, - fallingdotseq: fallingdotseq, - fcy: fcy, - female: female, - ffilig: ffilig, - fflig: fflig, - ffllig: ffllig, - ffr: ffr, - filig: filig, - fjlig: fjlig, - flat: flat, - fllig: fllig, - fltns: fltns, - fnof: fnof, - fopf: fopf, - forall: forall, - fork: fork, - forkv: forkv, - fpartint: fpartint, - frac1: frac1, - frac12: frac12, - frac13: frac13, - frac14: frac14, - frac15: frac15, - frac16: frac16, - frac18: frac18, - frac23: frac23, - frac25: frac25, - frac3: frac3, - frac34: frac34, - frac35: frac35, - frac38: frac38, - frac45: frac45, - frac56: frac56, - frac58: frac58, - frac78: frac78, - frasl: frasl, - frown: frown, - fscr: fscr, - gE: gE, - gEl: gEl, - gacute: gacute, - gamma: gamma, - gammad: gammad, - gap: gap, - gbreve: gbreve, - gcirc: gcirc, - gcy: gcy, - gdot: gdot, - ge: ge, - gel: gel, - geq: geq, - geqq: geqq, - geqslant: geqslant, - ges: ges, - gescc: gescc, - gesdot: gesdot, - gesdoto: gesdoto, - gesdotol: gesdotol, - gesl: gesl, - gesles: gesles, - gfr: gfr, - gg: gg, - ggg: ggg, - gimel: gimel, - gjcy: gjcy, - gl: gl, - glE: glE, - gla: gla, - glj: glj, - gnE: gnE, - gnap: gnap, - gnapprox: gnapprox, - gne: gne, - gneq: gneq, - gneqq: gneqq, - gnsim: gnsim, - gopf: gopf, - grave: grave, - gscr: gscr, - gsim: gsim, - gsime: gsime, - gsiml: gsiml, - g: g, - gt: gt, - gtcc: gtcc, - gtcir: gtcir, - gtdot: gtdot, - gtlPar: gtlPar, - gtquest: gtquest, - gtrapprox: gtrapprox, - gtrarr: gtrarr, - gtrdot: gtrdot, - gtreqless: gtreqless, - gtreqqless: gtreqqless, - gtrless: gtrless, - gtrsim: gtrsim, - gvertneqq: gvertneqq, - gvnE: gvnE, - hArr: hArr, - hairsp: hairsp, - half: half, - hamilt: hamilt, - hardcy: hardcy, - harr: harr, - harrcir: harrcir, - harrw: harrw, - hbar: hbar, - hcirc: hcirc, - hearts: hearts, - heartsuit: heartsuit, - hellip: hellip, - hercon: hercon, - hfr: hfr, - hksearow: hksearow, - hkswarow: hkswarow, - hoarr: hoarr, - homtht: homtht, - hookleftarrow: hookleftarrow, - hookrightarrow: hookrightarrow, - hopf: hopf, - horbar: horbar, - hscr: hscr, - hslash: hslash, - hstrok: hstrok, - hybull: hybull, - hyphen: hyphen, - iacut: iacut, - iacute: iacute, - ic: ic, - icir: icir, - icirc: icirc, - icy: icy, - iecy: iecy, - iexc: iexc, - iexcl: iexcl, - iff: iff, - ifr: ifr, - igrav: igrav, - igrave: igrave, - ii: ii, - iiiint: iiiint, - iiint: iiint, - iinfin: iinfin, - iiota: iiota, - ijlig: ijlig, - imacr: imacr, - image: image$1, - imagline: imagline, - imagpart: imagpart, - imath: imath, - imof: imof, - imped: imped, - "in": "∈", - incare: incare, - infin: infin, - infintie: infintie, - inodot: inodot, - int: int$1, - intcal: intcal, - integers: integers, - intercal: intercal, - intlarhk: intlarhk, - intprod: intprod, - iocy: iocy, - iogon: iogon, - iopf: iopf, - iota: iota, - iprod: iprod, - iques: iques, - iquest: iquest, - iscr: iscr, - isin: isin, - isinE: isinE, - isindot: isindot, - isins: isins, - isinsv: isinsv, - isinv: isinv, - it: it, - itilde: itilde, - iukcy: iukcy, - ium: ium, - iuml: iuml, - jcirc: jcirc, - jcy: jcy, - jfr: jfr, - jmath: jmath, - jopf: jopf, - jscr: jscr, - jsercy: jsercy, - jukcy: jukcy, - kappa: kappa, - kappav: kappav, - kcedil: kcedil, - kcy: kcy, - kfr: kfr, - kgreen: kgreen, - khcy: khcy, - kjcy: kjcy, - kopf: kopf, - kscr: kscr, - lAarr: lAarr, - lArr: lArr, - lAtail: lAtail, - lBarr: lBarr, - lE: lE, - lEg: lEg, - lHar: lHar, - lacute: lacute, - laemptyv: laemptyv, - lagran: lagran, - lambda: lambda, - lang: lang, - langd: langd, - langle: langle, - lap: lap, - laqu: laqu, - laquo: laquo, - larr: larr, - larrb: larrb, - larrbfs: larrbfs, - larrfs: larrfs, - larrhk: larrhk, - larrlp: larrlp, - larrpl: larrpl, - larrsim: larrsim, - larrtl: larrtl, - lat: lat, - latail: latail, - late: late, - lates: lates, - lbarr: lbarr, - lbbrk: lbbrk, - lbrace: lbrace, - lbrack: lbrack, - lbrke: lbrke, - lbrksld: lbrksld, - lbrkslu: lbrkslu, - lcaron: lcaron, - lcedil: lcedil, - lceil: lceil, - lcub: lcub, - lcy: lcy, - ldca: ldca, - ldquo: ldquo, - ldquor: ldquor, - ldrdhar: ldrdhar, - ldrushar: ldrushar, - ldsh: ldsh, - le: le, - leftarrow: leftarrow, - leftarrowtail: leftarrowtail, - leftharpoondown: leftharpoondown, - leftharpoonup: leftharpoonup, - leftleftarrows: leftleftarrows, - leftrightarrow: leftrightarrow, - leftrightarrows: leftrightarrows, - leftrightharpoons: leftrightharpoons, - leftrightsquigarrow: leftrightsquigarrow, - leftthreetimes: leftthreetimes, - leg: leg, - leq: leq, - leqq: leqq, - leqslant: leqslant, - les: les, - lescc: lescc, - lesdot: lesdot, - lesdoto: lesdoto, - lesdotor: lesdotor, - lesg: lesg, - lesges: lesges, - lessapprox: lessapprox, - lessdot: lessdot, - lesseqgtr: lesseqgtr, - lesseqqgtr: lesseqqgtr, - lessgtr: lessgtr, - lesssim: lesssim, - lfisht: lfisht, - lfloor: lfloor, - lfr: lfr, - lg: lg, - lgE: lgE, - lhard: lhard, - lharu: lharu, - lharul: lharul, - lhblk: lhblk, - ljcy: ljcy, - ll: ll, - llarr: llarr, - llcorner: llcorner, - llhard: llhard, - lltri: lltri, - lmidot: lmidot, - lmoust: lmoust, - lmoustache: lmoustache, - lnE: lnE, - lnap: lnap, - lnapprox: lnapprox, - lne: lne, - lneq: lneq, - lneqq: lneqq, - lnsim: lnsim, - loang: loang, - loarr: loarr, - lobrk: lobrk, - longleftarrow: longleftarrow, - longleftrightarrow: longleftrightarrow, - longmapsto: longmapsto, - longrightarrow: longrightarrow, - looparrowleft: looparrowleft, - looparrowright: looparrowright, - lopar: lopar, - lopf: lopf, - loplus: loplus, - lotimes: lotimes, - lowast: lowast, - lowbar: lowbar, - loz: loz, - lozenge: lozenge, - lozf: lozf, - lpar: lpar, - lparlt: lparlt, - lrarr: lrarr, - lrcorner: lrcorner, - lrhar: lrhar, - lrhard: lrhard, - lrm: lrm, - lrtri: lrtri, - lsaquo: lsaquo, - lscr: lscr, - lsh: lsh, - lsim: lsim, - lsime: lsime, - lsimg: lsimg, - lsqb: lsqb, - lsquo: lsquo, - lsquor: lsquor, - lstrok: lstrok, - l: l, - lt: lt$1, - ltcc: ltcc, - ltcir: ltcir, - ltdot: ltdot, - lthree: lthree, - ltimes: ltimes, - ltlarr: ltlarr, - ltquest: ltquest, - ltrPar: ltrPar, - ltri: ltri, - ltrie: ltrie, - ltrif: ltrif, - lurdshar: lurdshar, - luruhar: luruhar, - lvertneqq: lvertneqq, - lvnE: lvnE, - mDDot: mDDot, - mac: mac, - macr: macr, - male: male, - malt: malt, - maltese: maltese, - map: map$1, - mapsto: mapsto, - mapstodown: mapstodown, - mapstoleft: mapstoleft, - mapstoup: mapstoup, - marker: marker, - mcomma: mcomma, - mcy: mcy, - mdash: mdash, - measuredangle: measuredangle, - mfr: mfr, - mho: mho, - micr: micr, - micro: micro, - mid: mid, - midast: midast, - midcir: midcir, - middo: middo, - middot: middot, - minus: minus, - minusb: minusb, - minusd: minusd, - minusdu: minusdu, - mlcp: mlcp, - mldr: mldr, - mnplus: mnplus, - models: models, - mopf: mopf, - mp: mp, - mscr: mscr, - mstpos: mstpos, - mu: mu, - multimap: multimap, - mumap: mumap, - nGg: nGg, - nGt: nGt, - nGtv: nGtv, - nLeftarrow: nLeftarrow, - nLeftrightarrow: nLeftrightarrow, - nLl: nLl, - nLt: nLt, - nLtv: nLtv, - nRightarrow: nRightarrow, - nVDash: nVDash, - nVdash: nVdash, - nabla: nabla, - nacute: nacute, - nang: nang, - nap: nap, - napE: napE, - napid: napid, - napos: napos, - napprox: napprox, - natur: natur, - natural: natural, - naturals: naturals, - nbs: nbs, - nbsp: nbsp, - nbump: nbump, - nbumpe: nbumpe, - ncap: ncap, - ncaron: ncaron, - ncedil: ncedil, - ncong: ncong, - ncongdot: ncongdot, - ncup: ncup, - ncy: ncy, - ndash: ndash, - ne: ne, - neArr: neArr, - nearhk: nearhk, - nearr: nearr, - nearrow: nearrow, - nedot: nedot, - nequiv: nequiv, - nesear: nesear, - nesim: nesim, - nexist: nexist, - nexists: nexists, - nfr: nfr, - ngE: ngE, - nge: nge, - ngeq: ngeq, - ngeqq: ngeqq, - ngeqslant: ngeqslant, - nges: nges, - ngsim: ngsim, - ngt: ngt, - ngtr: ngtr, - nhArr: nhArr, - nharr: nharr, - nhpar: nhpar, - ni: ni, - nis: nis, - nisd: nisd, - niv: niv, - njcy: njcy, - nlArr: nlArr, - nlE: nlE, - nlarr: nlarr, - nldr: nldr, - nle: nle, - nleftarrow: nleftarrow, - nleftrightarrow: nleftrightarrow, - nleq: nleq, - nleqq: nleqq, - nleqslant: nleqslant, - nles: nles, - nless: nless, - nlsim: nlsim, - nlt: nlt, - nltri: nltri, - nltrie: nltrie, - nmid: nmid, - nopf: nopf, - no: no, - not: not, - notin: notin, - notinE: notinE, - notindot: notindot, - notinva: notinva, - notinvb: notinvb, - notinvc: notinvc, - notni: notni, - notniva: notniva, - notnivb: notnivb, - notnivc: notnivc, - npar: npar, - nparallel: nparallel, - nparsl: nparsl, - npart: npart, - npolint: npolint, - npr: npr, - nprcue: nprcue, - npre: npre, - nprec: nprec, - npreceq: npreceq, - nrArr: nrArr, - nrarr: nrarr, - nrarrc: nrarrc, - nrarrw: nrarrw, - nrightarrow: nrightarrow, - nrtri: nrtri, - nrtrie: nrtrie, - nsc: nsc, - nsccue: nsccue, - nsce: nsce, - nscr: nscr, - nshortmid: nshortmid, - nshortparallel: nshortparallel, - nsim: nsim, - nsime: nsime, - nsimeq: nsimeq, - nsmid: nsmid, - nspar: nspar, - nsqsube: nsqsube, - nsqsupe: nsqsupe, - nsub: nsub, - nsubE: nsubE, - nsube: nsube, - nsubset: nsubset, - nsubseteq: nsubseteq, - nsubseteqq: nsubseteqq, - nsucc: nsucc, - nsucceq: nsucceq, - nsup: nsup, - nsupE: nsupE, - nsupe: nsupe, - nsupset: nsupset, - nsupseteq: nsupseteq, - nsupseteqq: nsupseteqq, - ntgl: ntgl, - ntild: ntild, - ntilde: ntilde, - ntlg: ntlg, - ntriangleleft: ntriangleleft, - ntrianglelefteq: ntrianglelefteq, - ntriangleright: ntriangleright, - ntrianglerighteq: ntrianglerighteq, - nu: nu, - num: num, - numero: numero, - numsp: numsp, - nvDash: nvDash, - nvHarr: nvHarr, - nvap: nvap, - nvdash: nvdash, - nvge: nvge, - nvgt: nvgt, - nvinfin: nvinfin, - nvlArr: nvlArr, - nvle: nvle, - nvlt: nvlt, - nvltrie: nvltrie, - nvrArr: nvrArr, - nvrtrie: nvrtrie, - nvsim: nvsim, - nwArr: nwArr, - nwarhk: nwarhk, - nwarr: nwarr, - nwarrow: nwarrow, - nwnear: nwnear, - oS: oS, - oacut: oacut, - oacute: oacute, - oast: oast, - ocir: ocir, - ocirc: ocirc, - ocy: ocy, - odash: odash, - odblac: odblac, - odiv: odiv, - odot: odot, - odsold: odsold, - oelig: oelig, - ofcir: ofcir, - ofr: ofr, - ogon: ogon, - ograv: ograv, - ograve: ograve, - ogt: ogt, - ohbar: ohbar, - ohm: ohm, - oint: oint, - olarr: olarr, - olcir: olcir, - olcross: olcross, - oline: oline, - olt: olt, - omacr: omacr, - omega: omega, - omicron: omicron, - omid: omid, - ominus: ominus, - oopf: oopf, - opar: opar, - operp: operp, - oplus: oplus, - or: or, - orarr: orarr, - ord: ord, - order: order, - orderof: orderof, - ordf: ordf, - ordm: ordm, - origof: origof, - oror: oror, - orslope: orslope, - orv: orv, - oscr: oscr, - oslas: oslas, - oslash: oslash, - osol: osol, - otild: otild, - otilde: otilde, - otimes: otimes, - otimesas: otimesas, - oum: oum, - ouml: ouml, - ovbar: ovbar, - par: par, - para: para, - parallel: parallel, - parsim: parsim, - parsl: parsl, - part: part, - pcy: pcy, - percnt: percnt, - period: period, - permil: permil, - perp: perp, - pertenk: pertenk, - pfr: pfr, - phi: phi, - phiv: phiv, - phmmat: phmmat, - phone: phone, - pi: pi, - pitchfork: pitchfork, - piv: piv, - planck: planck, - planckh: planckh, - plankv: plankv, - plus: plus, - plusacir: plusacir, - plusb: plusb, - pluscir: pluscir, - plusdo: plusdo, - plusdu: plusdu, - pluse: pluse, - plusm: plusm, - plusmn: plusmn, - plussim: plussim, - plustwo: plustwo, - pm: pm, - pointint: pointint, - popf: popf, - poun: poun, - pound: pound, - pr: pr, - prE: prE, - prap: prap, - prcue: prcue, - pre: pre, - prec: prec, - precapprox: precapprox, - preccurlyeq: preccurlyeq, - preceq: preceq, - precnapprox: precnapprox, - precneqq: precneqq, - precnsim: precnsim, - precsim: precsim, - prime: prime, - primes: primes, - prnE: prnE, - prnap: prnap, - prnsim: prnsim, - prod: prod, - profalar: profalar, - profline: profline, - profsurf: profsurf, - prop: prop, - propto: propto, - prsim: prsim, - prurel: prurel, - pscr: pscr, - psi: psi, - puncsp: puncsp, - qfr: qfr, - qint: qint, - qopf: qopf, - qprime: qprime, - qscr: qscr, - quaternions: quaternions, - quatint: quatint, - quest: quest, - questeq: questeq, - quo: quo, - quot: quot, - rAarr: rAarr, - rArr: rArr, - rAtail: rAtail, - rBarr: rBarr, - rHar: rHar, - race: race, - racute: racute, - radic: radic, - raemptyv: raemptyv, - rang: rang, - rangd: rangd, - range: range, - rangle: rangle, - raqu: raqu, - raquo: raquo, - rarr: rarr, - rarrap: rarrap, - rarrb: rarrb, - rarrbfs: rarrbfs, - rarrc: rarrc, - rarrfs: rarrfs, - rarrhk: rarrhk, - rarrlp: rarrlp, - rarrpl: rarrpl, - rarrsim: rarrsim, - rarrtl: rarrtl, - rarrw: rarrw, - ratail: ratail, - ratio: ratio, - rationals: rationals, - rbarr: rbarr, - rbbrk: rbbrk, - rbrace: rbrace, - rbrack: rbrack, - rbrke: rbrke, - rbrksld: rbrksld, - rbrkslu: rbrkslu, - rcaron: rcaron, - rcedil: rcedil, - rceil: rceil, - rcub: rcub, - rcy: rcy, - rdca: rdca, - rdldhar: rdldhar, - rdquo: rdquo, - rdquor: rdquor, - rdsh: rdsh, - real: real, - realine: realine, - realpart: realpart, - reals: reals, - rect: rect, - re: re$4, - reg: reg, - rfisht: rfisht, - rfloor: rfloor, - rfr: rfr, - rhard: rhard, - rharu: rharu, - rharul: rharul, - rho: rho, - rhov: rhov, - rightarrow: rightarrow, - rightarrowtail: rightarrowtail, - rightharpoondown: rightharpoondown, - rightharpoonup: rightharpoonup, - rightleftarrows: rightleftarrows, - rightleftharpoons: rightleftharpoons, - rightrightarrows: rightrightarrows, - rightsquigarrow: rightsquigarrow, - rightthreetimes: rightthreetimes, - ring: ring, - risingdotseq: risingdotseq, - rlarr: rlarr, - rlhar: rlhar, - rlm: rlm, - rmoust: rmoust, - rmoustache: rmoustache, - rnmid: rnmid, - roang: roang, - roarr: roarr, - robrk: robrk, - ropar: ropar, - ropf: ropf, - roplus: roplus, - rotimes: rotimes, - rpar: rpar, - rpargt: rpargt, - rppolint: rppolint, - rrarr: rrarr, - rsaquo: rsaquo, - rscr: rscr, - rsh: rsh, - rsqb: rsqb, - rsquo: rsquo, - rsquor: rsquor, - rthree: rthree, - rtimes: rtimes, - rtri: rtri, - rtrie: rtrie, - rtrif: rtrif, - rtriltri: rtriltri, - ruluhar: ruluhar, - rx: rx, - sacute: sacute, - sbquo: sbquo, - sc: sc, - scE: scE, - scap: scap, - scaron: scaron, - sccue: sccue, - sce: sce, - scedil: scedil, - scirc: scirc, - scnE: scnE, - scnap: scnap, - scnsim: scnsim, - scpolint: scpolint, - scsim: scsim, - scy: scy, - sdot: sdot, - sdotb: sdotb, - sdote: sdote, - seArr: seArr, - searhk: searhk, - searr: searr, - searrow: searrow, - sec: sec, - sect: sect, - semi: semi, - seswar: seswar, - setminus: setminus, - setmn: setmn, - sext: sext, - sfr: sfr, - sfrown: sfrown, - sharp: sharp, - shchcy: shchcy, - shcy: shcy, - shortmid: shortmid, - shortparallel: shortparallel, - sh: sh, - shy: shy, - sigma: sigma, - sigmaf: sigmaf, - sigmav: sigmav, - sim: sim, - simdot: simdot, - sime: sime, - simeq: simeq, - simg: simg, - simgE: simgE, - siml: siml, - simlE: simlE, - simne: simne, - simplus: simplus, - simrarr: simrarr, - slarr: slarr, - smallsetminus: smallsetminus, - smashp: smashp, - smeparsl: smeparsl, - smid: smid, - smile: smile, - smt: smt, - smte: smte, - smtes: smtes, - softcy: softcy, - sol: sol, - solb: solb, - solbar: solbar, - sopf: sopf, - spades: spades, - spadesuit: spadesuit, - spar: spar, - sqcap: sqcap, - sqcaps: sqcaps, - sqcup: sqcup, - sqcups: sqcups, - sqsub: sqsub, - sqsube: sqsube, - sqsubset: sqsubset, - sqsubseteq: sqsubseteq, - sqsup: sqsup, - sqsupe: sqsupe, - sqsupset: sqsupset, - sqsupseteq: sqsupseteq, - squ: squ, - square: square, - squarf: squarf, - squf: squf, - srarr: srarr, - sscr: sscr, - ssetmn: ssetmn, - ssmile: ssmile, - sstarf: sstarf, - star: star, - starf: starf, - straightepsilon: straightepsilon, - straightphi: straightphi, - strns: strns, - sub: sub, - subE: subE, - subdot: subdot, - sube: sube, - subedot: subedot, - submult: submult, - subnE: subnE, - subne: subne, - subplus: subplus, - subrarr: subrarr, - subset: subset, - subseteq: subseteq, - subseteqq: subseteqq, - subsetneq: subsetneq, - subsetneqq: subsetneqq, - subsim: subsim, - subsub: subsub, - subsup: subsup, - succ: succ, - succapprox: succapprox, - succcurlyeq: succcurlyeq, - succeq: succeq, - succnapprox: succnapprox, - succneqq: succneqq, - succnsim: succnsim, - succsim: succsim, - sum: sum, - sung: sung, - sup: sup, - sup1: sup1, - sup2: sup2, - sup3: sup3, - supE: supE, - supdot: supdot, - supdsub: supdsub, - supe: supe, - supedot: supedot, - suphsol: suphsol, - suphsub: suphsub, - suplarr: suplarr, - supmult: supmult, - supnE: supnE, - supne: supne, - supplus: supplus, - supset: supset, - supseteq: supseteq, - supseteqq: supseteqq, - supsetneq: supsetneq, - supsetneqq: supsetneqq, - supsim: supsim, - supsub: supsub, - supsup: supsup, - swArr: swArr, - swarhk: swarhk, - swarr: swarr, - swarrow: swarrow, - swnwar: swnwar, - szli: szli, - szlig: szlig, - target: target, - tau: tau, - tbrk: tbrk, - tcaron: tcaron, - tcedil: tcedil, - tcy: tcy, - tdot: tdot, - telrec: telrec, - tfr: tfr, - there4: there4, - therefore: therefore, - theta: theta, - thetasym: thetasym, - thetav: thetav, - thickapprox: thickapprox, - thicksim: thicksim, - thinsp: thinsp, - thkap: thkap, - thksim: thksim, - thor: thor, - thorn: thorn, - tilde: tilde, - time: time, - times: times, - timesb: timesb, - timesbar: timesbar, - timesd: timesd, - tint: tint, - toea: toea, - top: top, - topbot: topbot, - topcir: topcir, - topf: topf, - topfork: topfork, - tosa: tosa, - tprime: tprime, - trade: trade, - triangle: triangle, - triangledown: triangledown, - triangleleft: triangleleft, - trianglelefteq: trianglelefteq, - triangleq: triangleq, - triangleright: triangleright, - trianglerighteq: trianglerighteq, - tridot: tridot, - trie: trie, - triminus: triminus, - triplus: triplus, - trisb: trisb, - tritime: tritime, - trpezium: trpezium, - tscr: tscr, - tscy: tscy, - tshcy: tshcy, - tstrok: tstrok, - twixt: twixt, - twoheadleftarrow: twoheadleftarrow, - twoheadrightarrow: twoheadrightarrow, - uArr: uArr, - uHar: uHar, - uacut: uacut, - uacute: uacute, - uarr: uarr, - ubrcy: ubrcy, - ubreve: ubreve, - ucir: ucir, - ucirc: ucirc, - ucy: ucy, - udarr: udarr, - udblac: udblac, - udhar: udhar, - ufisht: ufisht, - ufr: ufr, - ugrav: ugrav, - ugrave: ugrave, - uharl: uharl, - uharr: uharr, - uhblk: uhblk, - ulcorn: ulcorn, - ulcorner: ulcorner, - ulcrop: ulcrop, - ultri: ultri, - umacr: umacr, - um: um, - uml: uml, - uogon: uogon, - uopf: uopf, - uparrow: uparrow, - updownarrow: updownarrow, - upharpoonleft: upharpoonleft, - upharpoonright: upharpoonright, - uplus: uplus, - upsi: upsi, - upsih: upsih, - upsilon: upsilon, - upuparrows: upuparrows, - urcorn: urcorn, - urcorner: urcorner, - urcrop: urcrop, - uring: uring, - urtri: urtri, - uscr: uscr, - utdot: utdot, - utilde: utilde, - utri: utri, - utrif: utrif, - uuarr: uuarr, - uum: uum, - uuml: uuml, - uwangle: uwangle, - vArr: vArr, - vBar: vBar, - vBarv: vBarv, - vDash: vDash, - vangrt: vangrt, - varepsilon: varepsilon, - varkappa: varkappa, - varnothing: varnothing, - varphi: varphi, - varpi: varpi, - varpropto: varpropto, - varr: varr, - varrho: varrho, - varsigma: varsigma, - varsubsetneq: varsubsetneq, - varsubsetneqq: varsubsetneqq, - varsupsetneq: varsupsetneq, - varsupsetneqq: varsupsetneqq, - vartheta: vartheta, - vartriangleleft: vartriangleleft, - vartriangleright: vartriangleright, - vcy: vcy, - vdash: vdash, - vee: vee, - veebar: veebar, - veeeq: veeeq, - vellip: vellip, - verbar: verbar, - vert: vert, - vfr: vfr, - vltri: vltri, - vnsub: vnsub, - vnsup: vnsup, - vopf: vopf, - vprop: vprop, - vrtri: vrtri, - vscr: vscr, - vsubnE: vsubnE, - vsubne: vsubne, - vsupnE: vsupnE, - vsupne: vsupne, - vzigzag: vzigzag, - wcirc: wcirc, - wedbar: wedbar, - wedge: wedge, - wedgeq: wedgeq, - weierp: weierp, - wfr: wfr, - wopf: wopf, - wp: wp, - wr: wr, - wreath: wreath, - wscr: wscr, - xcap: xcap, - xcirc: xcirc, - xcup: xcup, - xdtri: xdtri, - xfr: xfr, - xhArr: xhArr, - xharr: xharr, - xi: xi, - xlArr: xlArr, - xlarr: xlarr, - xmap: xmap, - xnis: xnis, - xodot: xodot, - xopf: xopf, - xoplus: xoplus, - xotime: xotime, - xrArr: xrArr, - xrarr: xrarr, - xscr: xscr, - xsqcup: xsqcup, - xuplus: xuplus, - xutri: xutri, - xvee: xvee, - xwedge: xwedge, - yacut: yacut, - yacute: yacute, - yacy: yacy, - ycirc: ycirc, - ycy: ycy, - ye: ye, - yen: yen, - yfr: yfr, - yicy: yicy, - yopf: yopf, - yscr: yscr, - yucy: yucy, - yum: yum, - yuml: yuml, - zacute: zacute, - zcaron: zcaron, - zcy: zcy, - zdot: zdot, - zeetrf: zeetrf, - zeta: zeta, - zfr: zfr, - zhcy: zhcy, - zigrarr: zigrarr, - zopf: zopf, - zscr: zscr, - zwj: zwj, - zwnj: zwnj -}; - -var characterEntities = require$$0; - -var decodeEntity_1 = decodeEntity; - -var own$5 = {}.hasOwnProperty; - -function decodeEntity(characters) { - return own$5.call(characterEntities, characters) - ? characterEntities[characters] - : false -} - -var association_1 = association$3; - -var decode = decodeEntity_1; +/** + * @typedef {import('mdast').Association} Association + */ -var characterEscape = /\\([!-/:-@[-`{-~])/g; -var characterReference = /&(#(\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; +const characterEscape = /\\([!-/:-@[-`{-~])/g; +const characterReference = /&(#(\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; -// The `label` of an association is the string value: character escapes and -// references work, and casing is intact. -// The `identifier` is used to match one association to another: controversially, -// character escapes and references don’t work in this matching: `©` does -// not match `©`, and `\+` does not match `+`. -// But casing is ignored (and whitespace) is trimmed and collapsed: ` A\nb` -// matches `a b`. -// So, we do prefer the label when figuring out how we’re going to serialize: -// it has whitespace, casing, and we can ignore most useless character escapes -// and all character references. -function association$3(node) { +/** + * The `label` of an association is the string value: character escapes and + * references work, and casing is intact. + * The `identifier` is used to match one association to another: controversially, + * character escapes and references don’t work in this matching: `©` does + * not match `©`, and `\+` does not match `+`. + * But casing is ignored (and whitespace) is trimmed and collapsed: ` A\nb` + * matches `a b`. + * So, we do prefer the label when figuring out how we’re going to serialize: + * it has whitespace, casing, and we can ignore most useless character escapes + * and all character references. + * + * @param {Association} node + * @returns {string} + */ +function association(node) { if (node.label || !node.identifier) { return node.label || '' } @@ -48479,14 +44114,26 @@ function association$3(node) { .replace(characterReference, decodeIfPossible) } +/** + * @param {string} $0 + * @param {string} $1 + * @returns {string} + */ function decodeIfPossible($0, $1) { - return decode($1) || $0 + return decodeEntity($1) || $0 } -var checkQuote_1 = checkQuote$3; +/** + * @typedef {import('../types.js').Context} Context + * @typedef {import('../types.js').Options} Options + */ -function checkQuote$3(context) { - var marker = context.options.quote || '"'; +/** + * @param {Context} context + * @returns {Exclude<Options['quote'], undefined>} + */ +function checkQuote(context) { + const marker = context.options.quote || '"'; if (marker !== '"' && marker !== "'") { throw new Error( @@ -48499,19 +44146,22 @@ function checkQuote$3(context) { return marker } -var definition_1 = definition; - -var association$2 = association_1; -var checkQuote$2 = checkQuote_1; -var safe$5 = safe_1; +/** + * @typedef {import('mdast').Definition} Definition + * @typedef {import('../types.js').Handle} Handle + */ +/** + * @type {Handle} + * @param {Definition} node + */ function definition(node, _, context) { - var marker = checkQuote$2(context); - var suffix = marker === '"' ? 'Quote' : 'Apostrophe'; - var exit = context.enter('definition'); - var subexit = context.enter('label'); - var value = - '[' + safe$5(context, association$2(node), {before: '[', after: ']'}) + ']: '; + const marker = checkQuote(context); + const suffix = marker === '"' ? 'Quote' : 'Apostrophe'; + const exit = context.enter('definition'); + let subexit = context.enter('label'); + let value = + '[' + safe(context, association(node), {before: '[', after: ']'}) + ']: '; subexit(); @@ -48522,11 +44172,11 @@ function definition(node, _, context) { /[ \t\r\n]/.test(node.url) ) { subexit = context.enter('destinationLiteral'); - value += '<' + safe$5(context, node.url, {before: '<', after: '>'}) + '>'; + value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'; } else { // No whitespace, raw is prettier. subexit = context.enter('destinationRaw'); - value += safe$5(context, node.url, {before: ' ', after: ' '}); + value += safe(context, node.url, {before: ' ', after: ' '}); } subexit(); @@ -48536,7 +44186,7 @@ function definition(node, _, context) { value += ' ' + marker + - safe$5(context, node.title, {before: marker, after: marker}) + + safe(context, node.title, {before: marker, after: marker}) + marker; subexit(); } @@ -48546,10 +44196,17 @@ function definition(node, _, context) { return value } -var checkEmphasis_1 = checkEmphasis$1; +/** + * @typedef {import('../types.js').Context} Context + * @typedef {import('../types.js').Options} Options + */ -function checkEmphasis$1(context) { - var marker = context.options.emphasis || '*'; +/** + * @param {Context} context + * @returns {Exclude<Options['emphasis'], undefined>} + */ +function checkEmphasis(context) { + const marker = context.options.emphasis || '*'; if (marker !== '*' && marker !== '_') { throw new Error( @@ -48562,22 +44219,34 @@ function checkEmphasis$1(context) { return marker } -var containerPhrasing$1 = phrasing$6; +/** + * @typedef {import('../types.js').Node} Node + * @typedef {import('../types.js').Parent} Parent + * @typedef {import('../types.js').SafeOptions} SafeOptions + * @typedef {import('../types.js').Context} Context + */ -function phrasing$6(parent, context, safeOptions) { - var children = parent.children || []; - var results = []; - var index = -1; - var before = safeOptions.before; - var after; - var handle; - var child; +/** + * @param {Parent} parent + * @param {Context} context + * @param {SafeOptions} safeOptions + * @returns {string} + */ +function containerPhrasing(parent, context, safeOptions) { + const children = parent.children || []; + /** @type {Array.<string>} */ + const results = []; + let index = -1; + let before = safeOptions.before; while (++index < children.length) { - child = children[index]; + const child = children[index]; + /** @type {string} */ + let after; if (index + 1 < children.length) { - handle = context.handle.handlers[children[index + 1].type]; + // @ts-expect-error: hush, it’s actually a `zwitch`. + let handle = context.handle.handlers[children[index + 1].type]; if (handle && handle.peek) handle = handle.peek; after = handle ? handle(children[index + 1], parent, context, { @@ -48607,12 +44276,7 @@ function phrasing$6(parent, context, safeOptions) { before = ' '; } - results.push( - context.handle(child, parent, context, { - before: before, - after: after - }) - ); + results.push(context.handle(child, parent, context, {before, after})); before = results[results.length - 1].slice(-1); } @@ -48620,91 +44284,86 @@ function phrasing$6(parent, context, safeOptions) { return results.join('') } -var emphasis_1 = emphasis; -emphasis.peek = emphasisPeek; +/** + * @typedef {import('mdast').Emphasis} Emphasis + * @typedef {import('../types.js').Handle} Handle + */ -var checkEmphasis = checkEmphasis_1; -var phrasing$5 = containerPhrasing$1; +emphasis.peek = emphasisPeek; // To do: there are cases where emphasis cannot “form” depending on the // previous or next character of sequences. // There’s no way around that though, except for injecting zero-width stuff. // Do we need to safeguard against that? +/** + * @type {Handle} + * @param {Emphasis} node + */ function emphasis(node, _, context) { - var marker = checkEmphasis(context); - var exit = context.enter('emphasis'); - var value = phrasing$5(node, context, {before: marker, after: marker}); + const marker = checkEmphasis(context); + const exit = context.enter('emphasis'); + const value = containerPhrasing(node, context, { + before: marker, + after: marker + }); exit(); return marker + value + marker } -function emphasisPeek(node, _, context) { +/** + * @type {Handle} + * @param {Emphasis} _ + */ +function emphasisPeek(_, _1, context) { return context.options.emphasis || '*' } -var mdastUtilToString = toString$3; - -// Get the text content of a node. -// Prefer the node’s plain-text fields, otherwise serialize its children, -// and if the given value is an array, serialize the nodes in it. -function toString$3(node) { - return ( - (node && - (node.value || - node.alt || - node.title || - ('children' in node && all$1(node.children)) || - ('length' in node && all$1(node)))) || - '' - ) -} - -function all$1(values) { - var result = []; - var index = -1; - - while (++index < values.length) { - result[index] = toString$3(values[index]); - } - - return result.join('') -} - -var formatHeadingAsSetext_1 = formatHeadingAsSetext$2; - -var toString$2 = mdastUtilToString; +/** + * @typedef {import('mdast').Heading} Heading + * @typedef {import('../types.js').Context} Context + */ -function formatHeadingAsSetext$2(node, context) { - return ( - context.options.setext && (!node.depth || node.depth < 3) && toString$2(node) +/** + * @param {Heading} node + * @param {Context} context + * @returns {boolean} + */ +function formatHeadingAsSetext(node, context) { + return Boolean( + context.options.setext && (!node.depth || node.depth < 3) && toString(node) ) } -var heading_1 = heading; - -var repeat$3 = repeatString; -var formatHeadingAsSetext$1 = formatHeadingAsSetext_1; -var phrasing$4 = containerPhrasing$1; +/** + * @typedef {import('mdast').Heading} Heading + * @typedef {import('../types.js').Handle} Handle + * @typedef {import('../types.js').Exit} Exit + */ +/** + * @type {Handle} + * @param {Heading} node + */ function heading(node, _, context) { - var rank = Math.max(Math.min(6, node.depth || 1), 1); - var exit; - var subexit; - var value; - var sequence; + const rank = Math.max(Math.min(6, node.depth || 1), 1); + /** @type {Exit} */ + let exit; + /** @type {Exit} */ + let subexit; + /** @type {string} */ + let value; - if (formatHeadingAsSetext$1(node, context)) { + if (formatHeadingAsSetext(node, context)) { exit = context.enter('headingSetext'); subexit = context.enter('phrasing'); - value = phrasing$4(node, context, {before: '\n', after: '\n'}); + value = containerPhrasing(node, context, {before: '\n', after: '\n'}); subexit(); exit(); return ( value + '\n' + - repeat$3( - rank === 1 ? '=' : '-', + (rank === 1 ? '=' : '-').repeat( // The whole size… value.length - // Minus the position of the character after the last EOL (or @@ -48714,10 +44373,10 @@ function heading(node, _, context) { ) } - sequence = repeat$3('#', rank); + const sequence = '#'.repeat(rank); exit = context.enter('headingAtx'); subexit = context.enter('phrasing'); - value = phrasing$4(node, context, {before: '# ', after: '\n'}); + value = containerPhrasing(node, context, {before: '# ', after: '\n'}); value = value ? sequence + ' ' + value : sequence; if (context.options.closeAtx) { value += ' ' + sequence; @@ -48729,29 +44388,45 @@ function heading(node, _, context) { return value } -var html_1 = html; +/** + * @typedef {import('mdast').HTML} HTML + * @typedef {import('../types.js').Handle} Handle + */ + html.peek = htmlPeek; +/** + * @type {Handle} + * @param {HTML} node + */ function html(node) { return node.value || '' } +/** + * @type {Handle} + */ function htmlPeek() { return '<' } -var image_1 = image; -image.peek = imagePeek; +/** + * @typedef {import('mdast').Image} Image + * @typedef {import('../types.js').Handle} Handle + */ -var checkQuote$1 = checkQuote_1; -var safe$4 = safe_1; +image.peek = imagePeek; +/** + * @type {Handle} + * @param {Image} node + */ function image(node, _, context) { - var quote = checkQuote$1(context); - var suffix = quote === '"' ? 'Quote' : 'Apostrophe'; - var exit = context.enter('image'); - var subexit = context.enter('label'); - var value = '![' + safe$4(context, node.alt, {before: '[', after: ']'}) + ']('; + const quote = checkQuote(context); + const suffix = quote === '"' ? 'Quote' : 'Apostrophe'; + const exit = context.enter('image'); + let subexit = context.enter('label'); + let value = '![' + safe(context, node.alt, {before: '[', after: ']'}) + ']('; subexit(); @@ -48762,11 +44437,11 @@ function image(node, _, context) { /[ \t\r\n]/.test(node.url) ) { subexit = context.enter('destinationLiteral'); - value += '<' + safe$4(context, node.url, {before: '<', after: '>'}) + '>'; + value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'; } else { // No whitespace, raw is prettier. subexit = context.enter('destinationRaw'); - value += safe$4(context, node.url, { + value += safe(context, node.url, { before: '(', after: node.title ? ' ' : ')' }); @@ -48779,7 +44454,7 @@ function image(node, _, context) { value += ' ' + quote + - safe$4(context, node.title, {before: quote, after: quote}) + + safe(context, node.title, {before: quote, after: quote}) + quote; subexit(); } @@ -48790,31 +44465,37 @@ function image(node, _, context) { return value } +/** + * @type {Handle} + */ function imagePeek() { return '!' } -var imageReference_1 = imageReference; -imageReference.peek = imageReferencePeek; +/** + * @typedef {import('mdast').ImageReference} ImageReference + * @typedef {import('../types.js').Handle} Handle + */ -var association$1 = association_1; -var safe$3 = safe_1; +imageReference.peek = imageReferencePeek; +/** + * @type {Handle} + * @param {ImageReference} node + */ function imageReference(node, _, context) { - var type = node.referenceType; - var exit = context.enter('imageReference'); - var subexit = context.enter('label'); - var alt = safe$3(context, node.alt, {before: '[', after: ']'}); - var value = '![' + alt + ']'; - var reference; - var stack; + const type = node.referenceType; + const exit = context.enter('imageReference'); + let subexit = context.enter('label'); + const alt = safe(context, node.alt, {before: '[', after: ']'}); + let value = '![' + alt + ']'; subexit(); // Hide the fact that we’re in phrasing, because escapes don’t work. - stack = context.stack; + const stack = context.stack; context.stack = []; subexit = context.enter('reference'); - reference = safe$3(context, association$1(node), {before: '[', after: ']'}); + const reference = safe(context, association(node), {before: '[', after: ']'}); subexit(); context.stack = stack; exit(); @@ -48828,23 +44509,28 @@ function imageReference(node, _, context) { return value } +/** + * @type {Handle} + */ function imageReferencePeek() { return '!' } -var inlineCode_1 = inlineCode$1; -inlineCode$1.peek = inlineCodePeek$1; +/** + * @typedef {import('mdast').InlineCode} InlineCode + * @typedef {import('../types.js').Handle} Handle + */ -var patternCompile$1 = patternCompile_1; +inlineCode.peek = inlineCodePeek; -function inlineCode$1(node, parent, context) { - var value = node.value || ''; - var sequence = '`'; - var index = -1; - var pattern; - var expression; - var match; - var position; +/** + * @type {Handle} + * @param {InlineCode} node + */ +function inlineCode(node, _, context) { + let value = node.value || ''; + let sequence = '`'; + let index = -1; // If there is a single grave accent on its own in the code, use a fence of // two. @@ -48857,8 +44543,7 @@ function inlineCode$1(node, parent, context) { // first or last character are a space, eol, or tick, then pad with spaces. if ( /[^ \r\n]/.test(value) && - (/[ \r\n`]/.test(value.charAt(0)) || - /[ \r\n`]/.test(value.charAt(value.length - 1))) + ((/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value)) || /^`|`$/.test(value)) ) { value = ' ' + value + ' '; } @@ -48871,17 +44556,18 @@ function inlineCode$1(node, parent, context) { // transformed to spaces when going from markdown to HTML anyway, we can swap // them out. while (++index < context.unsafe.length) { - pattern = context.unsafe[index]; + const pattern = context.unsafe[index]; + const expression = patternCompile(pattern); + /** @type {RegExpExecArray|null} */ + let match; // Only look for `atBreak`s. // Btw: note that `atBreak` patterns will always start the regex at LF or // CR. if (!pattern.atBreak) continue - expression = patternCompile$1(pattern); - while ((match = expression.exec(value))) { - position = match.index; + let position = match.index; // Support CRLF (patterns only look for one of the characters). if ( @@ -48898,59 +44584,75 @@ function inlineCode$1(node, parent, context) { return sequence + value + sequence } -function inlineCodePeek$1() { +/** + * @type {Handle} + */ +function inlineCodePeek() { return '`' } -var formatLinkAsAutolink_1 = formatLinkAsAutolink$1; - -var toString$1 = mdastUtilToString; +/** + * @typedef {import('mdast').Link} Link + * @typedef {import('../types.js').Context} Context + */ -function formatLinkAsAutolink$1(node, context) { - var raw = toString$1(node); +/** + * @param {Link} node + * @param {Context} context + * @returns {boolean} + */ +function formatLinkAsAutolink(node, context) { + const raw = toString(node); - return ( + return Boolean( !context.options.resourceLink && - // If there’s a url… - node.url && - // And there’s a no title… - !node.title && - // And the content of `node` is a single text node… - node.children && - node.children.length === 1 && - node.children[0].type === 'text' && - // And if the url is the same as the content… - (raw === node.url || 'mailto:' + raw === node.url) && - // And that starts w/ a protocol… - /^[a-z][a-z+.-]+:/i.test(node.url) && - // And that doesn’t contain ASCII control codes (character escapes and - // references don’t work) or angle brackets… - !/[\0- <>\u007F]/.test(node.url) + // If there’s a url… + node.url && + // And there’s a no title… + !node.title && + // And the content of `node` is a single text node… + node.children && + node.children.length === 1 && + node.children[0].type === 'text' && + // And if the url is the same as the content… + (raw === node.url || 'mailto:' + raw === node.url) && + // And that starts w/ a protocol… + /^[a-z][a-z+.-]+:/i.test(node.url) && + // And that doesn’t contain ASCII control codes (character escapes and + // references don’t work) or angle brackets… + !/[\0- <>\u007F]/.test(node.url) ) } -var link_1 = link; -link.peek = linkPeek; +/** + * @typedef {import('mdast').Link} Link + * @typedef {import('../types.js').Handle} Handle + * @typedef {import('../types.js').Exit} Exit + */ -var checkQuote = checkQuote_1; -var formatLinkAsAutolink = formatLinkAsAutolink_1; -var phrasing$3 = containerPhrasing$1; -var safe$2 = safe_1; +link.peek = linkPeek; +/** + * @type {Handle} + * @param {Link} node + */ function link(node, _, context) { - var quote = checkQuote(context); - var suffix = quote === '"' ? 'Quote' : 'Apostrophe'; - var exit; - var subexit; - var value; - var stack; + const quote = checkQuote(context); + const suffix = quote === '"' ? 'Quote' : 'Apostrophe'; + /** @type {Exit} */ + let exit; + /** @type {Exit} */ + let subexit; + /** @type {string} */ + let value; if (formatLinkAsAutolink(node, context)) { // Hide the fact that we’re in phrasing, because escapes don’t work. - stack = context.stack; + const stack = context.stack; context.stack = []; exit = context.enter('autolink'); - value = '<' + phrasing$3(node, context, {before: '<', after: '>'}) + '>'; + value = + '<' + containerPhrasing(node, context, {before: '<', after: '>'}) + '>'; exit(); context.stack = stack; return value @@ -48958,7 +44660,8 @@ function link(node, _, context) { exit = context.enter('link'); subexit = context.enter('label'); - value = '[' + phrasing$3(node, context, {before: '[', after: ']'}) + ']('; + value = + '[' + containerPhrasing(node, context, {before: '[', after: ']'}) + ']('; subexit(); if ( @@ -48968,11 +44671,11 @@ function link(node, _, context) { /[ \t\r\n]/.test(node.url) ) { subexit = context.enter('destinationLiteral'); - value += '<' + safe$2(context, node.url, {before: '<', after: '>'}) + '>'; + value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'; } else { // No whitespace, raw is prettier. subexit = context.enter('destinationRaw'); - value += safe$2(context, node.url, { + value += safe(context, node.url, { before: '(', after: node.title ? ' ' : ')' }); @@ -48985,7 +44688,7 @@ function link(node, _, context) { value += ' ' + quote + - safe$2(context, node.title, {before: quote, after: quote}) + + safe(context, node.title, {before: quote, after: quote}) + quote; subexit(); } @@ -48996,32 +44699,38 @@ function link(node, _, context) { return value } +/** + * @type {Handle} + * @param {Link} node + */ function linkPeek(node, _, context) { return formatLinkAsAutolink(node, context) ? '<' : '[' } -var linkReference_1 = linkReference; -linkReference.peek = linkReferencePeek; +/** + * @typedef {import('mdast').LinkReference} LinkReference + * @typedef {import('../types.js').Handle} Handle + */ -var association = association_1; -var phrasing$2 = containerPhrasing$1; -var safe$1 = safe_1; +linkReference.peek = linkReferencePeek; +/** + * @type {Handle} + * @param {LinkReference} node + */ function linkReference(node, _, context) { - var type = node.referenceType; - var exit = context.enter('linkReference'); - var subexit = context.enter('label'); - var text = phrasing$2(node, context, {before: '[', after: ']'}); - var value = '[' + text + ']'; - var reference; - var stack; + const type = node.referenceType; + const exit = context.enter('linkReference'); + let subexit = context.enter('label'); + const text = containerPhrasing(node, context, {before: '[', after: ']'}); + let value = '[' + text + ']'; subexit(); // Hide the fact that we’re in phrasing, because escapes don’t work. - stack = context.stack; + const stack = context.stack; context.stack = []; subexit = context.enter('reference'); - reference = safe$1(context, association(node), {before: '[', after: ']'}); + const reference = safe(context, association(node), {before: '[', after: ']'}); subexit(); context.stack = stack; exit(); @@ -49035,25 +44744,40 @@ function linkReference(node, _, context) { return value } +/** + * @type {Handle} + */ function linkReferencePeek() { return '[' } -var list_1 = list; - -var flow$2 = containerFlow$1; +/** + * @typedef {import('mdast').List} List + * @typedef {import('../types.js').Handle} Handle + */ +/** + * @type {Handle} + * @param {List} node + */ function list(node, _, context) { - var exit = context.enter('list'); - var value = flow$2(node, context); + const exit = context.enter('list'); + const value = containerFlow(node, context); exit(); return value } -var checkBullet_1 = checkBullet$2; +/** + * @typedef {import('../types.js').Context} Context + * @typedef {import('../types.js').Options} Options + */ -function checkBullet$2(context) { - var marker = context.options.bullet || '*'; +/** + * @param {Context} context + * @returns {Exclude<Options['bullet'], undefined>} + */ +function checkBullet(context) { + const marker = context.options.bullet || '*'; if (marker !== '*' && marker !== '+' && marker !== '-') { throw new Error( @@ -49066,11 +44790,20 @@ function checkBullet$2(context) { return marker } -var checkListItemIndent_1 = checkListItemIndent$2; +/** + * @typedef {import('../types.js').Context} Context + * @typedef {import('../types.js').Options} Options + */ -function checkListItemIndent$2(context) { - var style = context.options.listItemIndent || 'tab'; +/** + * @param {Context} context + * @returns {Exclude<Options['listItemIndent'], undefined>} + */ +function checkListItemIndent(context) { + const style = context.options.listItemIndent || 'tab'; + // To do: remove in a major. + // @ts-expect-error: deprecated. if (style === 1 || style === '1') { return 'one' } @@ -49086,79 +44819,102 @@ function checkListItemIndent$2(context) { return style } -var listItem_1 = listItem$1; - -var repeat$2 = repeatString; -var checkBullet$1 = checkBullet_1; -var checkListItemIndent$1 = checkListItemIndent_1; -var flow$1 = containerFlow$1; -var indentLines$1 = indentLines_1; +/** + * @typedef {import('mdast').ListItem} ListItem + * @typedef {import('mdast').List} List + * @typedef {import('../util/indent-lines.js').Map} Map + * @typedef {import('../types.js').Options} Options + * @typedef {import('../types.js').Handle} Handle + */ -function listItem$1(node, parent, context) { - var bullet = checkBullet$1(context); - var listItemIndent = checkListItemIndent$1(context); - var size; - var value; - var exit; +/** + * @type {Handle} + * @param {ListItem} node + */ +function listItem(node, parent, context) { + const listItemIndent = checkListItemIndent(context); + /** @type {string} */ + let bullet = checkBullet(context); - if (parent && parent.ordered) { + if (parent && parent.type === 'list' && parent.ordered) { bullet = - (parent.start > -1 ? parent.start : 1) + + (typeof parent.start === 'number' && parent.start > -1 + ? parent.start + : 1) + (context.options.incrementListMarker === false ? 0 : parent.children.indexOf(node)) + '.'; } - size = bullet.length + 1; + let size = bullet.length + 1; if ( listItemIndent === 'tab' || - (listItemIndent === 'mixed' && ((parent && parent.spread) || node.spread)) + (listItemIndent === 'mixed' && + ((parent && 'spread' in parent && parent.spread) || node.spread)) ) { size = Math.ceil(size / 4) * 4; } - exit = context.enter('listItem'); - value = indentLines$1(flow$1(node, context), map); + const exit = context.enter('listItem'); + const value = indentLines(containerFlow(node, context), map); exit(); return value + /** @type {Map} */ function map(line, index, blank) { if (index) { - return (blank ? '' : repeat$2(' ', size)) + line + return (blank ? '' : ' '.repeat(size)) + line } - return (blank ? bullet : bullet + repeat$2(' ', size - bullet.length)) + line + return (blank ? bullet : bullet + ' '.repeat(size - bullet.length)) + line } } -var paragraph_1 = paragraph; - -var phrasing$1 = containerPhrasing$1; +/** + * @typedef {import('mdast').Paragraph} Paragraph + * @typedef {import('../types.js').Handle} Handle + */ +/** + * @type {Handle} + * @param {Paragraph} node + */ function paragraph(node, _, context) { - var exit = context.enter('paragraph'); - var subexit = context.enter('phrasing'); - var value = phrasing$1(node, context, {before: '\n', after: '\n'}); + const exit = context.enter('paragraph'); + const subexit = context.enter('phrasing'); + const value = containerPhrasing(node, context, {before: '\n', after: '\n'}); subexit(); exit(); return value } -var root_1 = root; - -var flow = containerFlow$1; +/** + * @typedef {import('mdast').Root} Root + * @typedef {import('../types.js').Handle} Handle + */ +/** + * @type {Handle} + * @param {Root} node + */ function root(node, _, context) { - return flow(node, context) + return containerFlow(node, context) } -var checkStrong_1 = checkStrong$1; +/** + * @typedef {import('../types.js').Context} Context + * @typedef {import('../types.js').Options} Options + */ -function checkStrong$1(context) { - var marker = context.options.strong || '*'; +/** + * @param {Context} context + * @returns {Exclude<Options['strong'], undefined>} + */ +function checkStrong(context) { + const marker = context.options.strong || '*'; if (marker !== '*' && marker !== '_') { throw new Error( @@ -49171,40 +44927,64 @@ function checkStrong$1(context) { return marker } -var strong_1 = strong; -strong.peek = strongPeek; +/** + * @typedef {import('mdast').Strong} Strong + * @typedef {import('../types.js').Handle} Handle + */ -var checkStrong = checkStrong_1; -var phrasing = containerPhrasing$1; +strong.peek = strongPeek; // To do: there are cases where emphasis cannot “form” depending on the // previous or next character of sequences. // There’s no way around that though, except for injecting zero-width stuff. // Do we need to safeguard against that? +/** + * @type {Handle} + * @param {Strong} node + */ function strong(node, _, context) { - var marker = checkStrong(context); - var exit = context.enter('strong'); - var value = phrasing(node, context, {before: marker, after: marker}); + const marker = checkStrong(context); + const exit = context.enter('strong'); + const value = containerPhrasing(node, context, { + before: marker, + after: marker + }); exit(); return marker + marker + value + marker + marker } -function strongPeek(node, _, context) { +/** + * @type {Handle} + * @param {Strong} _ + */ +function strongPeek(_, _1, context) { return context.options.strong || '*' } -var text_1 = text$1; - -var safe = safe_1; +/** + * @typedef {import('mdast').Text} Text + * @typedef {import('../types.js').Handle} Handle + */ -function text$1(node, parent, context, safeOptions) { +/** + * @type {Handle} + * @param {Text} node + */ +function text$1(node, _, context, safeOptions) { return safe(context, node.value, safeOptions) } -var checkRuleRepeat = checkRule$2; +/** + * @typedef {import('../types.js').Context} Context + * @typedef {import('../types.js').Options} Options + */ -function checkRule$2(context) { - var repetition = context.options.ruleRepetition || 3; +/** + * @param {Context} context + * @returns {Exclude<Options['ruleRepetition'], undefined>} + */ +function checkRuleRepetition(context) { + const repetition = context.options.ruleRepetition || 3; if (repetition < 3) { throw new Error( @@ -49217,10 +44997,17 @@ function checkRule$2(context) { return repetition } -var checkRule_1 = checkRule$1; +/** + * @typedef {import('../types.js').Context} Context + * @typedef {import('../types.js').Options} Options + */ -function checkRule$1(context) { - var marker = context.options.rule || '*'; +/** + * @param {Context} context + * @returns {Exclude<Options['rule'], undefined>} + */ +function checkRule(context) { + const marker = context.options.rule || '*'; if (marker !== '*' && marker !== '-' && marker !== '_') { throw new Error( @@ -49233,47 +45020,54 @@ function checkRule$1(context) { return marker } -var thematicBreak_1 = thematicBreak; - -var repeat$1 = repeatString; -var checkRepeat = checkRuleRepeat; -var checkRule = checkRule_1; +/** + * @typedef {import('../types.js').Handle} Handle + * @typedef {import('mdast').ThematicBreak} ThematicBreak + */ -function thematicBreak(node, parent, context) { - var value = repeat$1( - checkRule(context) + (context.options.ruleSpaces ? ' ' : ''), - checkRepeat(context) - ); +/** + * @type {Handle} + * @param {ThematicBreak} _ + */ +function thematicBreak(_, _1, context) { + const value = ( + checkRule(context) + (context.options.ruleSpaces ? ' ' : '') + ).repeat(checkRuleRepetition(context)); return context.options.ruleSpaces ? value.slice(0, -1) : value } -handle.blockquote = blockquote_1; -handle.break = _break; -handle.code = code_1; -handle.definition = definition_1; -handle.emphasis = emphasis_1; -handle.hardBreak = _break; -handle.heading = heading_1; -handle.html = html_1; -handle.image = image_1; -handle.imageReference = imageReference_1; -handle.inlineCode = inlineCode_1; -handle.link = link_1; -handle.linkReference = linkReference_1; -handle.list = list_1; -handle.listItem = listItem_1; -handle.paragraph = paragraph_1; -handle.root = root_1; -handle.strong = strong_1; -handle.text = text_1; -handle.thematicBreak = thematicBreak_1; - -var join = [joinDefaults]; - -var formatCodeAsIndented = formatCodeAsIndented_1; -var formatHeadingAsSetext = formatHeadingAsSetext_1; +const handle = { + blockquote, + break: hardBreak, + code: code$1, + definition, + emphasis, + hardBreak, + heading, + html, + image, + imageReference, + inlineCode, + link, + linkReference, + list, + listItem, + paragraph, + root, + strong, + text: text$1, + thematicBreak +}; +/** + * @typedef {import('./types.js').Join} Join + */ + +/** @type {Array.<Join>} */ +const join = [joinDefaults]; + +/** @type {Join} */ function joinDefaults(left, right, parent, context) { if ( // Two lists with the same marker. @@ -49291,7 +45085,7 @@ function joinDefaults(left, right, parent, context) { // Join children of a list or an item. // In which case, `parent` has a `spread` field. - if (typeof parent.spread === 'boolean') { + if ('spread' in parent && typeof parent.spread === 'boolean') { if ( left.type === 'paragraph' && // Two paragraphs. @@ -49307,7 +45101,12 @@ function joinDefaults(left, right, parent, context) { } } -var unsafe = [ +/** + * @typedef {import('./types.js').Unsafe} Unsafe + */ + +/** @type {Array.<Unsafe>} */ +const unsafe = [ { character: '\t', inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde'] @@ -49418,44 +45217,49 @@ var unsafe = [ {atBreak: true, character: '~'} ]; -var lib = toMarkdown$1; - -var zwitch = zwitch$1; -var configure = configure_1; -var defaultHandlers = handle; -var defaultJoin = join; -var defaultUnsafe = unsafe; +/** + * @typedef {import('./types.js').Node} Node + * @typedef {import('./types.js').Options} Options + * @typedef {import('./types.js').Context} Context + * @typedef {import('./types.js').Handle} Handle + * @typedef {import('./types.js').Join} Join + * @typedef {import('./types.js').Unsafe} Unsafe + */ -function toMarkdown$1(tree, options) { - var settings = options || {}; - var context = { - enter: enter, +/** + * @param {Node} tree + * @param {Options} [options] + * @returns {string} + */ +function toMarkdown(tree, options = {}) { + /** @type {Context} */ + // @ts-expect-error: we’ll add `handle` later. + const context = { + enter, stack: [], unsafe: [], join: [], handlers: {}, options: {} }; - var result; - configure(context, { - unsafe: defaultUnsafe, - join: defaultJoin, - handlers: defaultHandlers - }); - configure(context, settings); + configure(context, {unsafe, join, handlers: handle}); + configure(context, options); if (context.options.tightDefinitions) { - context.join = [joinDefinition].concat(context.join); + configure(context, {join: [joinDefinition]}); } + /** @type {Handle} */ context.handle = zwitch('type', { - invalid: invalid, - unknown: unknown, + invalid, + // @ts-expect-error: hush. + unknown, + // @ts-expect-error: hush. handlers: context.handlers }); - result = context.handle(tree, null, context, {before: '\n', after: '\n'}); + let result = context.handle(tree, null, context, {before: '\n', after: '\n'}); if ( result && @@ -49467,6 +45271,7 @@ function toMarkdown$1(tree, options) { return result + /** @type {Context['enter']} */ function enter(name) { context.stack.push(name); return exit @@ -49477,14 +45282,23 @@ function toMarkdown$1(tree, options) { } } +/** + * @type {Handle} + * @param {unknown} value + */ function invalid(value) { throw new Error('Cannot handle value `' + value + '`, expected node') } +/** + * @type {Handle} + * @param {Node} node + */ function unknown(node) { throw new Error('Cannot handle unknown node `' + node.type + '`') } +/** @type {Join} */ function joinDefinition(left, right) { // No blank line between adjacent definitions. if (left.type === 'definition' && left.type === right.type) { @@ -49492,38 +45306,36 @@ function joinDefinition(left, right) { } } -var mdastUtilToMarkdown = lib; - -var remarkStringify = stringify$1; - -var toMarkdown = mdastUtilToMarkdown; - -function stringify$1(options) { - var self = this; +/** + * @typedef {import('mdast').Root|import('mdast').Content} Node + * @typedef {import('mdast-util-to-markdown').Options} Options + */ - this.Compiler = compile; +/** @type {import('unified').Plugin<[Options]|void[], Node, string>} */ +function remarkStringify(options) { + /** @type {import('unified').CompilerFunction<Node, string>} */ + const compiler = (tree) => { + // Assume options. + const settings = /** @type {Options} */ (this.data('settings')); - function compile(tree) { return toMarkdown( tree, - Object.assign({}, self.data('settings'), options, { + Object.assign({}, settings, options, { // Note: this option is not in the readme. // The goal is for it to be set by plugins on `data` instead of being // passed by users. - extensions: self.data('toMarkdownExtensions') || [] + extensions: this.data('toMarkdownExtensions') || [] }) ) - } -} + }; -var unified = unified_1; -var parse$1 = remarkParse; -var stringify = remarkStringify; + Object.assign(this, {Compiler: compiler}); +} -var remark = unified().use(parse$1).use(stringify).freeze(); +const remark = unified().use(remarkParse).use(remarkStringify).freeze(); const name$1 = "remark"; -const version$1 = "13.0.0"; +const version$1 = "14.0.1"; const description$1 = "Markdown processor powered by plugins part of the unified collective"; const license = "MIT"; const keywords = [ @@ -49552,21 +45364,32 @@ const author = "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"; const contributors = [ "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" ]; +const sideEffects = false; +const type = "module"; +const main$1 = "index.js"; +const types = "index.d.ts"; const files = [ - "index.js", - "types/index.d.ts" + "index.d.ts", + "index.js" ]; -const types$1 = "types/index.d.ts"; const dependencies$1 = { - "remark-parse": "^9.0.0", - "remark-stringify": "^9.0.0", - unified: "^9.1.0" + "@types/mdast": "^3.0.0", + "remark-parse": "^10.0.0", + "remark-stringify": "^10.0.0", + unified: "^10.0.0" }; const scripts$1 = { - test: "tape test.js" + test: "node --conditions development test.js", + build: "rimraf \"*.d.ts\" && tsc && type-coverage" }; const xo = false; -var require$$3 = { +const typeCoverage = { + atLeast: 100, + detail: true, + strict: true, + ignoreCatch: true +}; +var proc = { name: name$1, version: version$1, description: description$1, @@ -49578,11 +45401,15 @@ var require$$3 = { funding: funding, author: author, contributors: contributors, + sideEffects: sideEffects, + type: type, + main: main$1, + types: types, files: files, - types: types$1, dependencies: dependencies$1, scripts: scripts$1, - xo: xo + xo: xo, + typeCoverage: typeCoverage }; const name = "node-lint-md-cli-rollup"; @@ -49597,17 +45424,17 @@ const devDependencies = { }; const dependencies = { "markdown-extensions": "^1.1.1", - remark: "^13.0.0", + remark: "^14.0.0", "remark-gfm": "^2.0.0", "remark-preset-lint-node": "^3.0.0", - "unified-args": "^8.1.0" + "unified-args": "^9.0.0" }; const main = "dist/index.js"; const scripts = { build: "npx rollup -c", - "build-node": "npm run build && npx shx cp dist/index.js ../lint-md.js" + "build-node": "npm run build && npx shx cp dist/index.mjs ../lint-md.mjs" }; -var require$$4 = { +var cli = { name: name, description: description, version: version, @@ -49708,7 +45535,7 @@ function location(file) { * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test */ -const convert$2 = +const convert = /** * @type {( * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) & @@ -49728,15 +45555,15 @@ const convert$2 = */ function (test) { if (test === undefined || test === null) { - return ok$1 + return ok } if (typeof test === 'string') { - return typeFactory$1(test) + return typeFactory(test) } if (typeof test === 'object') { - return Array.isArray(test) ? anyFactory$1(test) : propsFactory(test) + return Array.isArray(test) ? anyFactory(test) : propsFactory(test) } if (typeof test === 'function') { @@ -49750,13 +45577,13 @@ const convert$2 = * @param {Array.<Type|Props|TestFunctionAnything>} tests * @returns {AssertAnything} */ -function anyFactory$1(tests) { +function anyFactory(tests) { /** @type {Array.<AssertAnything>} */ const checks = []; let index = -1; while (++index < tests.length) { - checks[index] = convert$2(tests[index]); + checks[index] = convert(tests[index]); } return castFactory(any) @@ -49811,7 +45638,7 @@ function propsFactory(check) { * @param {Type} check * @returns {AssertAnything} */ -function typeFactory$1(check) { +function typeFactory(check) { return castFactory(type) /** @@ -49843,7 +45670,7 @@ function castFactory(check) { } // Utility to return true. -function ok$1() { +function ok() { return true } @@ -49851,7 +45678,7 @@ function ok$1() { * @param {string} d * @returns {string} */ -function color$3(d) { +function color$2(d) { return '\u001B[33m' + d + '\u001B[39m' } @@ -49864,17 +45691,17 @@ function color$3(d) { /** * Continue traversing as normal */ -const CONTINUE$3 = true; +const CONTINUE$2 = true; /** * Do not traverse this node’s children */ -const SKIP$3 = 'skip'; +const SKIP$2 = 'skip'; /** * Stop traversing immediately */ -const EXIT$3 = false; +const EXIT$2 = false; -const visitParents$3 = +const visitParents$2 = /** * @type {( * (<T extends Node>(tree: Node, test: T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>>, visitor: Visitor<T>, reverse?: boolean) => void) & @@ -49899,7 +45726,7 @@ const visitParents$3 = test = null; } - var is = convert$2(test); + var is = convert(test); var step = reverse ? -1 : 1; factory(tree, null, [])(); @@ -49926,7 +45753,7 @@ const visitParents$3 = Object.defineProperty(visit, 'name', { value: 'node (' + - color$3(value.type + (name ? '<' + name + '>' : '')) + + color$2(value.type + (name ? '<' + name + '>' : '')) + ')' }); } @@ -49946,12 +45773,12 @@ const visitParents$3 = if (!test || is(node, index, parents[parents.length - 1] || null)) { result = toResult$2(visitor(node, parents)); - if (result[0] === EXIT$3) { + if (result[0] === EXIT$2) { return result } } - if (node.children && result[0] !== SKIP$3) { + if (node.children && result[0] !== SKIP$2) { // @ts-ignore looks like a parent. offset = (reverse ? node.children.length : -1) + step; // @ts-ignore looks like a parent. @@ -49961,7 +45788,7 @@ const visitParents$3 = while (offset > -1 && offset < node.children.length) { subresult = factory(node.children[offset], offset, grandparents)(); - if (subresult[0] === EXIT$3) { + if (subresult[0] === EXIT$2) { return subresult } @@ -49986,7 +45813,7 @@ function toResult$2(value) { } if (typeof value === 'number') { - return [CONTINUE$3, value] + return [CONTINUE$2, value] } return [value] @@ -49999,7 +45826,7 @@ function toResult$2(value) { * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult */ -const visit$3 = +const visit$1 = /** * @type {( * (<T extends Node>(tree: Node, test: T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>>, visitor: Visitor<T>, reverse?: boolean) => void) & @@ -50023,7 +45850,7 @@ const visit$3 = test = null; } - visitParents$3(tree, test, overload, reverse); + visitParents$2(tree, test, overload, reverse); /** * @param {Node} node @@ -50113,7 +45940,7 @@ const visit$3 = * @property {boolean} state */ -const own$4 = {}.hasOwnProperty; +const own$2 = {}.hasOwnProperty; /** * @type {import('unified').Plugin<[Options]>} @@ -50155,7 +45982,7 @@ function messageControl(options) { /** @type {Mark[]} */ const globals = []; - visit$3(tree, options.test, visitor); + visit$1(tree, options.test, visitor); file.messages = file.messages.filter((m) => filter(m)); @@ -50323,7 +46150,7 @@ function messageControl(options) { // Toggle all known rules. if (!ruleId) { for (ruleId in scope) { - if (own$4.call(scope, ruleId)) { + if (own$2.call(scope, ruleId)) { toggle(point, state, ruleId); } } @@ -50390,7 +46217,7 @@ function detectGaps(tree, file) { let gap; // Find all gaps. - visit$3(tree, one); + visit$1(tree, one); // Get the end of the document. // This detects if the last node was the last node. @@ -50608,92 +46435,6 @@ function lintMessageControl() { } /** - * @typedef {(error?: Error|null|undefined, ...output: any[]) => void} Callback - * @typedef {(...input: any[]) => any} Middleware - * - * @typedef {(...input: any[]) => void} Run Call all middleware. - * @typedef {(fn: Middleware) => Pipeline} Use Add `fn` (middleware) to the list. - * @typedef {{run: Run, use: Use}} Pipeline - */ - -/** - * Wrap `middleware`. - * Can be sync or async; return a promise, receive a callback, or return new - * values and errors. - * - * @param {Middleware} middleware - * @param {Callback} callback - */ -function wrap(middleware, callback) { - /** @type {boolean} */ - let called; - - return wrapped - - /** - * Call `middleware`. - * @param {any[]} parameters - * @returns {void} - */ - function wrapped(...parameters) { - const fnExpectsCallback = middleware.length > parameters.length; - /** @type {any} */ - let result; - - if (fnExpectsCallback) { - parameters.push(done); - } - - try { - result = middleware(...parameters); - } catch (error) { - /** @type {Error} */ - const exception = error; - - // Well, this is quite the pickle. - // `middleware` received a callback and called it synchronously, but that - // threw an error. - // The only thing left to do is to throw the thing instead. - if (fnExpectsCallback && called) { - throw exception - } - - return done(exception) - } - - if (!fnExpectsCallback) { - if (result instanceof Promise) { - result.then(then, done); - } else if (result instanceof Error) { - done(result); - } else { - then(result); - } - } - } - - /** - * Call `callback`, only once. - * @type {Callback} - */ - function done(error, ...output) { - if (!called) { - called = true; - callback(error, ...output); - } - } - - /** - * Call `done` with one value. - * - * @param {any} [value] - */ - function then(value) { - done(null, value); - } -} - -/** * @typedef {import('unist').Node} Node * @typedef {import('vfile').VFile} VFile * @@ -50708,13 +46449,13 @@ function wrap(middleware, callback) { * @returns {void} */ -const primitives = new Set(['string', 'number', 'boolean']); +const primitives$G = new Set(['string', 'number', 'boolean']); /** * @param {string} id * @param {Rule} rule */ -function lintRule(id, rule) { +function lintRule$G(id, rule) { const parts = id.split(':'); // Possibly useful if externalised later. /* c8 ignore next */ @@ -50727,7 +46468,7 @@ function lintRule(id, rule) { /** @type {import('unified').Plugin<[unknown]|void[]>} */ function plugin(raw) { - const [severity, options] = coerce$2(ruleId, raw); + const [severity, options] = coerce$H(ruleId, raw); if (!severity) return @@ -50766,7 +46507,7 @@ function lintRule(id, rule) { * @param {unknown} value * @returns {SeverityTuple} */ -function coerce$2(name, value) { +function coerce$H(name, value) { /** @type {unknown[]} */ let result; @@ -50778,7 +46519,7 @@ function coerce$2(name, value) { Array.isArray(value) && // `isArray(unknown)` is turned into `any[]`: // type-coverage:ignore-next-line - primitives.has(typeof value[0]) + primitives$G.has(typeof value[0]) ) { // `isArray(unknown)` is turned into `any[]`: // type-coverage:ignore-next-line @@ -50873,7 +46614,7 @@ function coerce$2(name, value) { * ``` */ -const remarkLintFinalNewline = lintRule( +const remarkLintFinalNewline = lintRule$G( 'remark-lint:final-newline', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (_, file) => { @@ -50888,6 +46629,134 @@ const remarkLintFinalNewline = lintRule( var remarkLintFinalNewline$1 = remarkLintFinalNewline; +/** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$F = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$F(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$G(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$G(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$F.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + var pluralize = {exports: {}}; /* global define */ @@ -51397,7 +47266,7 @@ var plural = pluralize.exports; * @param {string} d * @returns {string} */ -function color$2(d) { +function color$1(d) { return '\u001B[33m' + d + '\u001B[39m' } @@ -51410,15 +47279,15 @@ function color$2(d) { /** * Continue traversing as normal */ -const CONTINUE$2 = true; +const CONTINUE$1 = true; /** * Do not traverse this node’s children */ -const SKIP$2 = 'skip'; +const SKIP$1 = 'skip'; /** * Stop traversing immediately */ -const EXIT$2 = false; +const EXIT$1 = false; /** * Visit children of tree which pass a test @@ -51428,7 +47297,7 @@ const EXIT$2 = false; * @param visitor Function to run for each node * @param reverse Visit the tree in reverse order, defaults to false */ -const visitParents$2 = +const visitParents$1 = /** * @type {( * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: Visitor<import('./complex-types').Matches<import('./complex-types').InclusiveDescendant<Tree>, Check>>, reverse?: boolean) => void) & @@ -51450,7 +47319,7 @@ const visitParents$2 = test = null; } - const is = convert$2(test); + const is = convert(test); const step = reverse ? -1 : 1; factory(tree, null, [])(); @@ -51478,7 +47347,7 @@ const visitParents$2 = Object.defineProperty(visit, 'name', { value: 'node (' + - color$2(value.type + (name ? '<' + name + '>' : '')) + + color$1(value.type + (name ? '<' + name + '>' : '')) + ')' }); } @@ -51498,13 +47367,13 @@ const visitParents$2 = if (!test || is(node, index, parents[parents.length - 1] || null)) { result = toResult$1(visitor(node, parents)); - if (result[0] === EXIT$2) { + if (result[0] === EXIT$1) { return result } } // @ts-expect-error looks like a parent. - if (node.children && result[0] !== SKIP$2) { + if (node.children && result[0] !== SKIP$1) { // @ts-expect-error looks like a parent. offset = (reverse ? node.children.length : -1) + step; // @ts-expect-error looks like a parent. @@ -51515,7 +47384,7 @@ const visitParents$2 = // @ts-expect-error looks like a parent. subresult = factory(node.children[offset], offset, grandparents)(); - if (subresult[0] === EXIT$2) { + if (subresult[0] === EXIT$1) { return subresult } @@ -51540,7 +47409,7 @@ function toResult$1(value) { } if (typeof value === 'number') { - return [CONTINUE$2, value] + return [CONTINUE$1, value] } return [value] @@ -51561,7 +47430,7 @@ function toResult$1(value) { * @param visitor Function to run for each node * @param reverse Fisit the tree in reverse, defaults to false */ -const visit$2 = +const visit = /** * @type {( * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: Visitor<import('unist-util-visit-parents/complex-types').Matches<import('unist-util-visit-parents/complex-types').InclusiveDescendant<Tree>, Check>>, reverse?: boolean) => void) & @@ -51582,7 +47451,7 @@ const visit$2 = test = null; } - visitParents$2(tree, test, overload, reverse); + visitParents$1(tree, test, overload, reverse); /** * @param {Node} node @@ -51638,11 +47507,11 @@ const visit$2 = * 4:2: Incorrect indentation before bullet: remove 1 space */ -const remarkLintListItemBulletIndent = lintRule( +const remarkLintListItemBulletIndent = lintRule$F( 'remark-lint:list-item-bullet-indent', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { - visit$2(tree, 'list', (list, _, grandparent) => { + visit(tree, 'list', (list, _, grandparent) => { let index = -1; while (++index < list.children.length) { @@ -51677,6 +47546,134 @@ const remarkLintListItemBulletIndent = lintRule( var remarkLintListItemBulletIndent$1 = remarkLintListItemBulletIndent; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$E = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$E(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$F(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$F(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$E.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @typedef {import('unist').Position} Position * @typedef {import('unist').Point} Point * @@ -51690,15 +47687,15 @@ var remarkLintListItemBulletIndent$1 = remarkLintListItemBulletIndent; * @property {PositionLike} [position] */ -var pointStart = point$2('start'); -var pointEnd = point$2('end'); +var pointStart = point('start'); +var pointEnd = point('end'); /** * Get the positional info of `node`. * * @param {'start'|'end'} type */ -function point$2(type) { +function point(type) { return point /** @@ -51868,7 +47865,7 @@ function generated(node) { * 1:1: Incorrect list-item indent style `💩`: use either `'tab-size'`, `'space'`, or `'mixed'` */ -const remarkLintListItemIndent = lintRule( +const remarkLintListItemIndent = lintRule$E( 'remark-lint:list-item-indent', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'tab-size') => { @@ -51882,7 +47879,7 @@ const remarkLintListItemIndent = lintRule( ); } - visit$2(tree, 'list', (node) => { + visit(tree, 'list', (node) => { if (generated(node)) return const spread = node.spread; @@ -51926,59 +47923,131 @@ const remarkLintListItemIndent = lintRule( var remarkLintListItemIndent$1 = remarkLintListItemIndent; /** - * @typedef Options - * @property {boolean} [includeImageAlt=true] - */ - -/** - * Get the text content of a node. - * Prefer the node’s plain-text fields, otherwise serialize its children, - * and if the given value is an array, serialize the nodes in it. + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile * - * @param {unknown} node - * @param {Options} [options] - * @returns {string} + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} */ -function toString(node, options) { - var {includeImageAlt = true} = options || {}; - return one(node, includeImageAlt) -} + +const primitives$D = new Set(['string', 'number', 'boolean']); /** - * @param {unknown} node - * @param {boolean} includeImageAlt - * @returns {string} + * @param {string} id + * @param {Rule} rule */ -function one(node, includeImageAlt) { - return ( - (node && - typeof node === 'object' && - // @ts-ignore looks like a literal. - (node.value || - // @ts-ignore looks like an image. - (includeImageAlt ? node.alt : '') || - // @ts-ignore looks like a parent. - ('children' in node && all(node.children, includeImageAlt)) || - (Array.isArray(node) && all(node, includeImageAlt)))) || - '' - ) +function lintRule$D(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$E(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } } /** - * @param {Array.<unknown>} values - * @param {boolean} includeImageAlt - * @returns {string} + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} */ -function all(values, includeImageAlt) { - /** @type {Array.<string>} */ - var result = []; - var index = -1; +function coerce$E(name, value) { + /** @type {unknown[]} */ + let result; - while (++index < values.length) { - result[index] = one(values[index], includeImageAlt); + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$D.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; } - return result.join('') + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result } /** @@ -52023,11 +48092,11 @@ function all(values, includeImageAlt) { // See: <https://en.wikipedia.org/wiki/URI_scheme#Generic_syntax>. const protocol = /^[a-z][a-z+.-]+:\/?/i; -const remarkLintNoAutoLinkWithoutProtocol = lintRule( +const remarkLintNoAutoLinkWithoutProtocol = lintRule$D( 'remark-lint:no-auto-link-without-protocol', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { - visit$2(tree, 'link', (node) => { + visit(tree, 'link', (node) => { if ( !generated(node) && pointStart(node).column === pointStart(node.children[0]).column - 1 && @@ -52044,6 +48113,134 @@ const remarkLintNoAutoLinkWithoutProtocol = lintRule( var remarkLintNoAutoLinkWithoutProtocol$1 = remarkLintNoAutoLinkWithoutProtocol; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$C = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$C(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$D(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$D(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$C.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -52100,14 +48297,14 @@ var remarkLintNoAutoLinkWithoutProtocol$1 = remarkLintNoAutoLinkWithoutProtocol; * 3:1: Missing marker in block quote */ -const remarkLintNoBlockquoteWithoutMarker = lintRule( +const remarkLintNoBlockquoteWithoutMarker = lintRule$C( 'remark-lint:no-blockquote-without-marker', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { const value = String(file); const loc = location(file); - visit$2(tree, 'blockquote', (node) => { + visit(tree, 'blockquote', (node) => { let index = -1; while (++index < node.children.length) { @@ -52141,6 +48338,134 @@ const remarkLintNoBlockquoteWithoutMarker = lintRule( var remarkLintNoBlockquoteWithoutMarker$1 = remarkLintNoBlockquoteWithoutMarker; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$B = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$B(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$C(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$C(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$B.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -52176,11 +48501,11 @@ var remarkLintNoBlockquoteWithoutMarker$1 = remarkLintNoBlockquoteWithoutMarker; * 1:1-1:19: Don’t use literal URLs without angle brackets */ -const remarkLintNoLiteralUrls = lintRule( +const remarkLintNoLiteralUrls = lintRule$B( 'remark-lint:no-literal-urls', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { - visit$2(tree, 'link', (node) => { + visit(tree, 'link', (node) => { const value = toString(node); if ( @@ -52199,6 +48524,134 @@ const remarkLintNoLiteralUrls = lintRule( var remarkLintNoLiteralUrls$1 = remarkLintNoLiteralUrls; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$A = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$A(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$B(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$B(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$A.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -52255,7 +48708,7 @@ var remarkLintNoLiteralUrls$1 = remarkLintNoLiteralUrls; * 1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'` */ -const remarkLintOrderedListMarkerStyle = lintRule( +const remarkLintOrderedListMarkerStyle = lintRule$A( 'remark-lint:ordered-list-marker-style', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'consistent') => { @@ -52269,7 +48722,7 @@ const remarkLintOrderedListMarkerStyle = lintRule( ); } - visit$2(tree, 'list', (node) => { + visit(tree, 'list', (node) => { let index = -1; if (!node.ordered) return @@ -52302,6 +48755,134 @@ const remarkLintOrderedListMarkerStyle = lintRule( var remarkLintOrderedListMarkerStyle$1 = remarkLintOrderedListMarkerStyle; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$z = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$z(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$A(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$A(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$z.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -52327,13 +48908,13 @@ var remarkLintOrderedListMarkerStyle$1 = remarkLintOrderedListMarkerStyle; * 1:12-2:1: Use two spaces for hard line breaks */ -const remarkLintHardBreakSpaces = lintRule( +const remarkLintHardBreakSpaces = lintRule$z( 'remark-lint:hard-break-spaces', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { const value = String(file); - visit$2(tree, 'break', (node) => { + visit(tree, 'break', (node) => { if (!generated(node)) { const slice = value .slice(pointStart(node).offset, pointEnd(node).offset) @@ -52350,71 +48931,132 @@ const remarkLintHardBreakSpaces = lintRule( var remarkLintHardBreakSpaces$1 = remarkLintHardBreakSpaces; -var own$3 = {}.hasOwnProperty; - /** * @typedef {import('unist').Node} Node - * @typedef {import('unist').Position} Position - * @typedef {import('unist').Point} Point + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} */ +const primitives$y = new Set(['string', 'number', 'boolean']); + /** - * Stringify one point, a position (start and end points), or a node’s - * positional information. - * - * @param {Node|Position|Point} [value] - * @returns {string} + * @param {string} id + * @param {Rule} rule */ -function stringifyPosition$1(value) { - // Nothing. - if (!value || typeof value !== 'object') { - return '' - } +function lintRule$y(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; - // Node. - if (own$3.call(value, 'position') || own$3.call(value, 'type')) { - // @ts-ignore looks like a node. - return position$3(value.position) - } + Object.defineProperty(plugin, 'name', {value: id}); - // Position. - if (own$3.call(value, 'start') || own$3.call(value, 'end')) { - // @ts-ignore looks like a position. - return position$3(value) - } + return plugin - // Point. - if (own$3.call(value, 'line') || own$3.call(value, 'column')) { - // @ts-ignore looks like a point. - return point$1(value) - } + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$z(ruleId, raw); - // ? - return '' -} + if (!severity) return -/** - * @param {Point} point - * @returns {string} - */ -function point$1(point) { - return index$1(point && point.line) + ':' + index$1(point && point.column) -} + const fatal = severity === 2; -/** - * @param {Position} pos - * @returns {string} - */ -function position$3(pos) { - return point$1(pos && pos.start) + '-' + point$1(pos && pos.end) + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } } /** - * @param {number} value - * @returns {number} + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} */ -function index$1(value) { - return value && typeof value === 'number' ? value : 1 +function coerce$z(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$y.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result } /** @@ -52443,14 +49085,14 @@ function index$1(value) { * 2:1-2:11: Do not use definitions with the same identifier (1:1) */ -const remarkLintNoDuplicateDefinitions = lintRule( +const remarkLintNoDuplicateDefinitions = lintRule$y( 'remark-lint:no-duplicate-definitions', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { /** @type {Record<string, string>} */ const map = Object.create(null); - visit$2(tree, (node) => { + visit(tree, (node) => { if ( (node.type === 'definition' || node.type === 'footnoteDefinition') && !generated(node) @@ -52476,6 +49118,134 @@ const remarkLintNoDuplicateDefinitions = lintRule( var remarkLintNoDuplicateDefinitions$1 = remarkLintNoDuplicateDefinitions; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$x = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$x(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$y(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$y(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$x.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @typedef {import('mdast').Heading} Heading * @typedef {'atx'|'atx-closed'|'setext'} Style */ @@ -52584,11 +49354,11 @@ function consolidate(depth, relative) { * #·· */ -const remarkLintNoHeadingContentIndent = lintRule( +const remarkLintNoHeadingContentIndent = lintRule$x( 'remark-lint:no-heading-content-indent', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { - visit$2(tree, 'heading', (node) => { + visit(tree, 'heading', (node) => { if (generated(node)) { return } @@ -52641,6 +49411,134 @@ const remarkLintNoHeadingContentIndent = lintRule( var remarkLintNoHeadingContentIndent$1 = remarkLintNoHeadingContentIndent; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$w = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$w(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$x(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$x(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$w.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -52667,13 +49565,13 @@ var remarkLintNoHeadingContentIndent$1 = remarkLintNoHeadingContentIndent; * 1:7-1:38: Don’t pad `link` with inner spaces */ -const remarkLintNoInlinePadding = lintRule( +const remarkLintNoInlinePadding = lintRule$w( 'remark-lint:no-inline-padding', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { // Note: `emphasis`, `strong`, `delete` (GFM) can’t have padding anymore // since CM. - visit$2(tree, (node) => { + visit(tree, (node) => { if ( (node.type === 'link' || node.type === 'linkReference') && !generated(node) @@ -52691,6 +49589,134 @@ const remarkLintNoInlinePadding = lintRule( var remarkLintNoInlinePadding$1 = remarkLintNoInlinePadding; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$v = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$v(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$w(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$w(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$v.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -52724,11 +49750,11 @@ var remarkLintNoInlinePadding$1 = remarkLintNoInlinePadding; * 1:1-1:7: Use the trailing [] on reference images */ -const remarkLintNoShortcutReferenceImage = lintRule( +const remarkLintNoShortcutReferenceImage = lintRule$v( 'remark-lint:no-shortcut-reference-image', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { - visit$2(tree, 'imageReference', (node) => { + visit(tree, 'imageReference', (node) => { if (!generated(node) && node.referenceType === 'shortcut') { file.message('Use the trailing [] on reference images', node); } @@ -52739,6 +49765,134 @@ const remarkLintNoShortcutReferenceImage = lintRule( var remarkLintNoShortcutReferenceImage$1 = remarkLintNoShortcutReferenceImage; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$u = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$u(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$v(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$v(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$u.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -52772,11 +49926,11 @@ var remarkLintNoShortcutReferenceImage$1 = remarkLintNoShortcutReferenceImage; * 1:1-1:6: Use the trailing `[]` on reference links */ -const remarkLintNoShortcutReferenceLink = lintRule( +const remarkLintNoShortcutReferenceLink = lintRule$u( 'remark-lint:no-shortcut-reference-link', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { - visit$2(tree, 'linkReference', (node) => { + visit(tree, 'linkReference', (node) => { if (!generated(node) && node.referenceType === 'shortcut') { file.message('Use the trailing `[]` on reference links', node); } @@ -52787,24 +49941,131 @@ const remarkLintNoShortcutReferenceLink = lintRule( var remarkLintNoShortcutReferenceLink$1 = remarkLintNoShortcutReferenceLink; /** - * Normalize an identifier (such as used in definitions). + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile * - * @param {string} value - * @returns {string} + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} */ -function normalizeIdentifier(value) { - return ( - value // Collapse Markdown whitespace. - .replace(/[\t\n\r ]+/g, ' ') // Trim. - .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase - // counterpart is uppercased will result in a different uppercase - // character. - // Hence, to get that form, we perform both lower- and uppercase. - // Upper case makes sure keys will not interact with default prototypal - // methods: no method is uppercase. - .toLowerCase() - .toUpperCase() - ) + +const primitives$t = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$t(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$u(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$u(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$t.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result } /** @@ -52875,7 +50136,7 @@ function normalizeIdentifier(value) { * 17:23-17:26: Found reference to undefined definition */ -const remarkLintNoUndefinedReferences = lintRule( +const remarkLintNoUndefinedReferences = lintRule$t( 'remark-lint:no-undefined-references', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = {}) => { @@ -52888,7 +50149,7 @@ const remarkLintNoUndefinedReferences = lintRule( /** @type {Record<string, boolean>} */ const map = Object.create(null); - visit$2(tree, (node) => { + visit(tree, (node) => { if ( (node.type === 'definition' || node.type === 'footnoteDefinition') && !generated(node) @@ -52897,7 +50158,7 @@ const remarkLintNoUndefinedReferences = lintRule( } }); - visit$2(tree, (node) => { + visit(tree, (node) => { // CM specifiers that references only form when defined. // Still, they could be added by plugins, so let’s keep it. /* c8 ignore next 10 */ @@ -52924,14 +50185,14 @@ const remarkLintNoUndefinedReferences = lintRule( /** @type {Range[]} */ let ranges = []; - visit$2(node, (child) => { + visit(node, (child) => { // Ignore the node itself. if (child === node) return // Can’t have links in links, so reset ranges. if (child.type === 'link' || child.type === 'linkReference') { ranges = []; - return SKIP$2 + return SKIP$1 } // Enter non-text. @@ -52942,7 +50203,7 @@ const remarkLintNoUndefinedReferences = lintRule( // Bail if there’s no positional info. if (typeof start !== 'number' || typeof end !== 'number') { - return EXIT$2 + return EXIT$1 } const source = contents.slice(start, end); @@ -53040,7 +50301,7 @@ const remarkLintNoUndefinedReferences = lintRule( handleRange(ranges[index]); } - return SKIP$2 + return SKIP$1 /** * @param {Range} range @@ -53076,6 +50337,134 @@ const remarkLintNoUndefinedReferences = lintRule( var remarkLintNoUndefinedReferences$1 = remarkLintNoUndefinedReferences; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$s = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$s(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$t(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$t(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$s.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2016 Titus Wormer * @license MIT @@ -53101,16 +50490,16 @@ var remarkLintNoUndefinedReferences$1 = remarkLintNoUndefinedReferences; * 1:1-1:27: Found unused definition */ -const own$2 = {}.hasOwnProperty; +const own$1 = {}.hasOwnProperty; -const remarkLintNoUnusedDefinitions = lintRule( +const remarkLintNoUnusedDefinitions = lintRule$s( 'remark-lint:no-unused-definitions', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { /** @type {Record<string, {node: DefinitionContent, used: boolean}>} */ const map = Object.create(null); - visit$2(tree, (node) => { + visit(tree, (node) => { if ( (node.type === 'definition' || node.type === 'footnoteDefinition') && !generated(node) @@ -53119,7 +50508,7 @@ const remarkLintNoUnusedDefinitions = lintRule( } }); - visit$2(tree, (node) => { + visit(tree, (node) => { if ( node.type === 'imageReference' || node.type === 'linkReference' || @@ -53137,7 +50526,7 @@ const remarkLintNoUnusedDefinitions = lintRule( let identifier; for (identifier in map) { - if (own$2.call(map, identifier)) { + if (own$1.call(map, identifier)) { const entry = map[identifier]; if (!entry.used) { @@ -53156,35 +50545,162 @@ var remarkLintNoUnusedDefinitions$1 = remarkLintNoUnusedDefinitions; * mistakes or stuff that fails across vendors. */ -/** @type {Preset} */ -const remarkPresetLintRecommended = { - plugins: [ - remarkLint, - // Unix compatibility. - remarkLintFinalNewline$1, - // Rendering across vendors differs greatly if using other styles. - remarkLintListItemBulletIndent$1, - [remarkLintListItemIndent$1, 'tab-size'], - // Differs or unsupported across vendors. - remarkLintNoAutoLinkWithoutProtocol$1, - remarkLintNoBlockquoteWithoutMarker$1, - remarkLintNoLiteralUrls$1, - [remarkLintOrderedListMarkerStyle$1, '.'], - // Mistakes. - remarkLintHardBreakSpaces$1, - remarkLintNoDuplicateDefinitions$1, - remarkLintNoHeadingContentIndent$1, - remarkLintNoInlinePadding$1, - remarkLintNoShortcutReferenceImage$1, - remarkLintNoShortcutReferenceLink$1, - remarkLintNoUndefinedReferences$1, - remarkLintNoUnusedDefinitions$1 - ] -}; +const plugins$1 = [ + remarkLint, + // Unix compatibility. + remarkLintFinalNewline$1, + // Rendering across vendors differs greatly if using other styles. + remarkLintListItemBulletIndent$1, + [remarkLintListItemIndent$1, 'tab-size'], + // Differs or unsupported across vendors. + remarkLintNoAutoLinkWithoutProtocol$1, + remarkLintNoBlockquoteWithoutMarker$1, + remarkLintNoLiteralUrls$1, + [remarkLintOrderedListMarkerStyle$1, '.'], + // Mistakes. + remarkLintHardBreakSpaces$1, + remarkLintNoDuplicateDefinitions$1, + remarkLintNoHeadingContentIndent$1, + remarkLintNoInlinePadding$1, + remarkLintNoShortcutReferenceImage$1, + remarkLintNoShortcutReferenceLink$1, + remarkLintNoUndefinedReferences$1, + remarkLintNoUnusedDefinitions$1 +]; + +const remarkPresetLintRecommended = {plugins: plugins$1}; var remarkPresetLintRecommended$1 = remarkPresetLintRecommended; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$r = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$r(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$s(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$s(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$r.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -53234,11 +50750,11 @@ var remarkPresetLintRecommended$1 = remarkPresetLintRecommended; * 9:3: Add 1 space between block quote and content */ -const remarkLintBlockquoteIndentation = lintRule( +const remarkLintBlockquoteIndentation = lintRule$r( 'remark-lint:blockquote-indentation', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'consistent') => { - visit$2(tree, 'blockquote', (node) => { + visit(tree, 'blockquote', (node) => { if (generated(node) || node.children.length === 0) { return } @@ -53277,6 +50793,134 @@ function check(node) { } /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$q = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$q(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$r(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$r(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$q.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -53355,7 +50999,7 @@ function check(node) { * 1:1: Incorrect checked checkbox marker `💩`: use either `'x'`, or `'X'` */ -const remarkLintCheckboxCharacterStyle = lintRule( +const remarkLintCheckboxCharacterStyle = lintRule$q( 'remark-lint:checkbox-character-style', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'consistent') => { @@ -53386,7 +51030,7 @@ const remarkLintCheckboxCharacterStyle = lintRule( ); } - visit$2(tree, 'listItem', (node) => { + visit(tree, 'listItem', (node) => { const head = node.children[0]; const point = pointStart(head); @@ -53439,6 +51083,134 @@ const remarkLintCheckboxCharacterStyle = lintRule( var remarkLintCheckboxCharacterStyle$1 = remarkLintCheckboxCharacterStyle; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$p = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$p(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$q(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$q(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$p.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -53470,14 +51242,14 @@ var remarkLintCheckboxCharacterStyle$1 = remarkLintCheckboxCharacterStyle; * 4:7-4:10: Checkboxes should be followed by a single character */ -const remarkLintCheckboxContentIndent = lintRule( +const remarkLintCheckboxContentIndent = lintRule$p( 'remark-lint:checkbox-content-indent', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { const value = String(file); const loc = location(file); - visit$2(tree, 'listItem', (node) => { + visit(tree, 'listItem', (node) => { const head = node.children[0]; const point = pointStart(head); @@ -53519,6 +51291,134 @@ const remarkLintCheckboxContentIndent = lintRule( var remarkLintCheckboxContentIndent$1 = remarkLintCheckboxContentIndent; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$o = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$o(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$p(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$p(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$o.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -53621,7 +51521,7 @@ var remarkLintCheckboxContentIndent$1 = remarkLintCheckboxContentIndent; * 1:1: Incorrect code block style `💩`: use either `'consistent'`, `'fenced'`, or `'indented'` */ -const remarkLintCodeBlockStyle = lintRule( +const remarkLintCodeBlockStyle = lintRule$o( 'remark-lint:code-block-style', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'consistent') => { @@ -53639,7 +51539,7 @@ const remarkLintCodeBlockStyle = lintRule( ); } - visit$2(tree, 'code', (node) => { + visit(tree, 'code', (node) => { if (generated(node)) { return } @@ -53664,6 +51564,134 @@ const remarkLintCodeBlockStyle = lintRule( var remarkLintCodeBlockStyle$1 = remarkLintCodeBlockStyle; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$n = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$n(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$o(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$o(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$n.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -53689,13 +51717,13 @@ var remarkLintCodeBlockStyle$1 = remarkLintCodeBlockStyle; const label = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/; -const remarkLintDefinitionSpacing = lintRule( +const remarkLintDefinitionSpacing = lintRule$n( 'remark-lint:definition-spacing', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { const value = String(file); - visit$2(tree, (node) => { + visit(tree, (node) => { if (node.type === 'definition' || node.type === 'footnoteDefinition') { const start = pointStart(node).offset; const end = pointEnd(node).offset; @@ -53718,6 +51746,134 @@ const remarkLintDefinitionSpacing = lintRule( var remarkLintDefinitionSpacing$1 = remarkLintDefinitionSpacing; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$m = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$m(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$n(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$n(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$m.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -53801,7 +51957,7 @@ var remarkLintDefinitionSpacing$1 = remarkLintDefinitionSpacing; const fence = /^ {0,3}([~`])\1{2,}/; -const remarkLintFencedCodeFlag = lintRule( +const remarkLintFencedCodeFlag = lintRule$m( 'remark-lint:fenced-code-flag', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option) => { @@ -53822,7 +51978,7 @@ const remarkLintFencedCodeFlag = lintRule( } } - visit$2(tree, 'code', (node) => { + visit(tree, 'code', (node) => { if (!generated(node)) { if (node.lang) { if (allowed.length > 0 && !allowed.includes(node.lang)) { @@ -53846,6 +52002,134 @@ const remarkLintFencedCodeFlag = lintRule( var remarkLintFencedCodeFlag$1 = remarkLintFencedCodeFlag; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$l = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$l(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$m(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$m(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$l.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -53936,7 +52220,7 @@ var remarkLintFencedCodeFlag$1 = remarkLintFencedCodeFlag; * 1:1: Incorrect fenced code marker `💩`: use either `'consistent'`, `` '`' ``, or `'~'` */ -const remarkLintFencedCodeMarker = lintRule( +const remarkLintFencedCodeMarker = lintRule$l( 'remark-lint:fenced-code-marker', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'consistent') => { @@ -53950,7 +52234,7 @@ const remarkLintFencedCodeMarker = lintRule( ); } - visit$2(tree, 'code', (node) => { + visit(tree, 'code', (node) => { const start = pointStart(node).offset; if (typeof start === 'number') { @@ -53980,6 +52264,134 @@ const remarkLintFencedCodeMarker = lintRule( var remarkLintFencedCodeMarker$1 = remarkLintFencedCodeMarker; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$k = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$k(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$l(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$l(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$k.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54007,7 +52419,7 @@ var remarkLintFencedCodeMarker$1 = remarkLintFencedCodeMarker; * {"name": "readme.mkd", "setting": "mkd"} */ -const remarkLintFileExtension = lintRule( +const remarkLintFileExtension = lintRule$k( 'remark-lint:file-extension', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (_, file, option = 'md') => { @@ -54022,6 +52434,134 @@ const remarkLintFileExtension = lintRule( var remarkLintFileExtension$1 = remarkLintFileExtension; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$j = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$j(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$k(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$k(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$j.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54063,13 +52603,13 @@ var remarkLintFileExtension$1 = remarkLintFileExtension; * [example-2]: http://example.com/two/ */ -const remarkLintFinalDefinition = lintRule( +const remarkLintFinalDefinition = lintRule$j( 'remark-lint:final-definition', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { let last = 0; - visit$2( + visit( tree, (node) => { // Ignore generated and HTML comment nodes. @@ -54104,6 +52644,134 @@ const remarkLintFinalDefinition = lintRule( var remarkLintFinalDefinition$1 = remarkLintFinalDefinition; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$i = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$i(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$j(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$j(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$i.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54195,13 +52863,13 @@ var remarkLintFinalDefinition$1 = remarkLintFinalDefinition; * 1:1-1:14: First heading level should be `2` */ -const re$3 = /<h([1-6])/; +const re = /<h([1-6])/; -const remarkLintFirstHeadingLevel = lintRule( +const remarkLintFirstHeadingLevel = lintRule$i( 'remark-lint:first-heading-level', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 1) => { - visit$2(tree, (node) => { + visit(tree, (node) => { if (!generated(node)) { /** @type {Depth|undefined} */ let rank; @@ -54217,7 +52885,7 @@ const remarkLintFirstHeadingLevel = lintRule( file.message('First heading level should be `' + option + '`', node); } - return EXIT$2 + return EXIT$1 } } }); @@ -54231,12 +52899,140 @@ var remarkLintFirstHeadingLevel$1 = remarkLintFirstHeadingLevel; * @returns {Depth|undefined} */ function infer(node) { - const results = node.value.match(re$3); + const results = node.value.match(re); // @ts-expect-error: can be castes fine. return results ? Number(results[1]) : undefined } /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$h = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$h(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$i(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$i(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$h.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54314,7 +53110,7 @@ function infer(node) { * 1:1: Incorrect heading style type `💩`: use either `'consistent'`, `'atx'`, `'atx-closed'`, or `'setext'` */ -const remarkLintHeadingStyle = lintRule( +const remarkLintHeadingStyle = lintRule$h( 'remark-lint:heading-style', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'consistent') => { @@ -54331,7 +53127,7 @@ const remarkLintHeadingStyle = lintRule( ); } - visit$2(tree, 'heading', (node) => { + visit(tree, 'heading', (node) => { if (!generated(node)) { if (option === 'consistent') { // Funky nodes perhaps cannot be detected. @@ -54348,6 +53144,134 @@ const remarkLintHeadingStyle = lintRule( var remarkLintHeadingStyle$1 = remarkLintHeadingStyle; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$g = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$g(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$h(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$h(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$g.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54445,14 +53369,14 @@ var remarkLintHeadingStyle$1 = remarkLintHeadingStyle; * 4:12: Line must be at most 10 characters */ -const remarkLintMaximumLineLength = lintRule( +const remarkLintMaximumLineLength = lintRule$g( 'remark-lint:maximum-line-length', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 80) => { const value = String(file); const lines = value.split(/\r?\n/); - visit$2(tree, (node) => { + visit(tree, (node) => { if ( (node.type === 'heading' || node.type === 'table' || @@ -54474,7 +53398,7 @@ const remarkLintMaximumLineLength = lintRule( // the wrap. // However, when they do, and there’s whitespace after it, they are not // allowed. - visit$2(tree, (node, pos, parent_) => { + visit(tree, (node, pos, parent_) => { const parent = /** @type {Parent} */ (parent_); if ( @@ -54539,6 +53463,134 @@ const remarkLintMaximumLineLength = lintRule( var remarkLintMaximumLineLength$1 = remarkLintMaximumLineLength; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$f = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$f(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$g(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$g(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$f.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54584,11 +53636,11 @@ var remarkLintMaximumLineLength$1 = remarkLintMaximumLineLength; * 4:5: Remove 2 lines after node */ -const remarkLintNoConsecutiveBlankLines = lintRule( +const remarkLintNoConsecutiveBlankLines = lintRule$f( 'remark-lint:no-consecutive-blank-lines', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { - visit$2(tree, (node) => { + visit(tree, (node) => { if (!generated(node) && 'children' in node) { const head = node.children[0]; @@ -54649,6 +53701,134 @@ const remarkLintNoConsecutiveBlankLines = lintRule( var remarkLintNoConsecutiveBlankLines$1 = remarkLintNoConsecutiveBlankLines; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$e = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$e(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$f(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$f(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$e.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54680,7 +53860,7 @@ var remarkLintNoConsecutiveBlankLines$1 = remarkLintNoConsecutiveBlankLines; * 1:1: Do not start file names with `an` */ -const remarkLintNoFileNameArticles = lintRule( +const remarkLintNoFileNameArticles = lintRule$e( 'remark-lint:no-file-name-articles', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (_, file) => { @@ -54695,6 +53875,134 @@ const remarkLintNoFileNameArticles = lintRule( var remarkLintNoFileNameArticles$1 = remarkLintNoFileNameArticles; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$d = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$d(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$e(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$e(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$d.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54711,7 +54019,7 @@ var remarkLintNoFileNameArticles$1 = remarkLintNoFileNameArticles; * 1:1: Do not use consecutive dashes in a file name */ -const remarkLintNoFileNameConsecutiveDashes = lintRule( +const remarkLintNoFileNameConsecutiveDashes = lintRule$d( 'remark-lint:no-file-name-consecutive-dashes', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (_, file) => { @@ -54724,6 +54032,134 @@ const remarkLintNoFileNameConsecutiveDashes = lintRule( var remarkLintNoFileNameConsecutiveDashes$1 = remarkLintNoFileNameConsecutiveDashes; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$c = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$c(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$d(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$d(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$c.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54745,7 +54181,7 @@ var remarkLintNoFileNameConsecutiveDashes$1 = remarkLintNoFileNameConsecutiveDas * 1:1: Do not use initial or final dashes in a file name */ -const remarkLintNofileNameOuterDashes = lintRule( +const remarkLintNofileNameOuterDashes = lintRule$c( 'remark-lint:no-file-name-outer-dashes', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (_, file) => { @@ -54758,6 +54194,134 @@ const remarkLintNofileNameOuterDashes = lintRule( var remarkLintNofileNameOuterDashes$1 = remarkLintNofileNameOuterDashes; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$b = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$b(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$c(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$c(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$b.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -54808,11 +54372,11 @@ var remarkLintNofileNameOuterDashes$1 = remarkLintNofileNameOuterDashes; * 8:4: Remove 3 spaces before this heading */ -const remarkLintNoHeadingIndent = lintRule( +const remarkLintNoHeadingIndent = lintRule$b( 'remark-lint:no-heading-indent', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { - visit$2(tree, 'heading', (node, _, parent) => { + visit(tree, 'heading', (node, _, parent) => { // Note: it’s rather complex to detect what the expected indent is in block // quotes and lists, so let’s only do directly in root for now. if (generated(node) || (parent && parent.type !== 'root')) { @@ -54837,71 +54401,132 @@ const remarkLintNoHeadingIndent = lintRule( var remarkLintNoHeadingIndent$1 = remarkLintNoHeadingIndent; -var own$1 = {}.hasOwnProperty; - /** * @typedef {import('unist').Node} Node - * @typedef {import('unist').Position} Position - * @typedef {import('unist').Point} Point + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} */ +const primitives$a = new Set(['string', 'number', 'boolean']); + /** - * Stringify one point, a position (start and end points), or a node’s - * positional information. - * - * @param {Node|Position|Point} [value] - * @returns {string} + * @param {string} id + * @param {Rule} rule */ -function stringifyPosition(value) { - // Nothing. - if (!value || typeof value !== 'object') { - return '' - } +function lintRule$a(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; - // Node. - if (own$1.call(value, 'position') || own$1.call(value, 'type')) { - // @ts-ignore looks like a node. - return position$2(value.position) - } + Object.defineProperty(plugin, 'name', {value: id}); - // Position. - if (own$1.call(value, 'start') || own$1.call(value, 'end')) { - // @ts-ignore looks like a position. - return position$2(value) - } + return plugin - // Point. - if (own$1.call(value, 'line') || own$1.call(value, 'column')) { - // @ts-ignore looks like a point. - return point(value) - } + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$b(ruleId, raw); - // ? - return '' -} + if (!severity) return -/** - * @param {Point} point - * @returns {string} - */ -function point(point) { - return index(point && point.line) + ':' + index(point && point.column) -} + const fatal = severity === 2; -/** - * @param {Position} pos - * @returns {string} - */ -function position$2(pos) { - return point(pos && pos.start) + '-' + point(pos && pos.end) + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } } /** - * @param {number} value - * @returns {number} + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} */ -function index(value) { - return value && typeof value === 'number' ? value : 1 +function coerce$b(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$a.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result } /** @@ -54934,14 +54559,14 @@ function index(value) { * 3:1-3:6: Don’t use multiple top level headings (1:1) */ -const remarkLintNoMultipleToplevelHeadings = lintRule( +const remarkLintNoMultipleToplevelHeadings = lintRule$a( 'remark-lint:no-multiple-toplevel-headings', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 1) => { /** @type {string|undefined} */ let duplicate; - visit$2(tree, 'heading', (node) => { + visit(tree, 'heading', (node) => { if (!generated(node) && node.depth === option) { if (duplicate) { file.message( @@ -54949,7 +54574,7 @@ const remarkLintNoMultipleToplevelHeadings = lintRule( node ); } else { - duplicate = stringifyPosition(pointStart(node)); + duplicate = stringifyPosition$1(pointStart(node)); } } }); @@ -54959,6 +54584,134 @@ const remarkLintNoMultipleToplevelHeadings = lintRule( var remarkLintNoMultipleToplevelHeadings$1 = remarkLintNoMultipleToplevelHeadings; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$9 = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$9(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$a(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$a(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$9.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -55032,11 +54785,11 @@ const flags = new Set([ 'zsh' ]); -const remarkLintNoShellDollars = lintRule( +const remarkLintNoShellDollars = lintRule$9( 'remark-lint:no-shell-dollars', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { - visit$2(tree, 'code', (node) => { + visit(tree, 'code', (node) => { // Check both known shell code and unknown code. if (!generated(node) && node.lang && flags.has(node.lang)) { const lines = node.value @@ -55065,6 +54818,134 @@ const remarkLintNoShellDollars = lintRule( var remarkLintNoShellDollars$1 = remarkLintNoShellDollars; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$8 = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$8(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$9(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$9(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$8.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -55130,14 +55011,14 @@ var remarkLintNoShellDollars$1 = remarkLintNoShellDollars; * 3:6: Do not indent table rows */ -const remarkLintNoTableIndentation = lintRule( +const remarkLintNoTableIndentation = lintRule$8( 'remark-lint:no-table-indentation', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { const value = String(file); const loc = location(value); - visit$2(tree, 'table', (node, _, parent) => { + visit(tree, 'table', (node, _, parent) => { const end = pointEnd(node).line; let line = pointStart(node).line; let column = 0; @@ -55184,7 +55065,7 @@ const remarkLintNoTableIndentation = lintRule( line++; } - return SKIP$2 + return SKIP$1 }); } ); @@ -55192,6 +55073,134 @@ const remarkLintNoTableIndentation = lintRule( var remarkLintNoTableIndentation$1 = remarkLintNoTableIndentation; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$7 = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$7(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$8(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$8(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$7.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -55246,7 +55255,7 @@ var remarkLintNoTableIndentation$1 = remarkLintNoTableIndentation; * 13:41: Use spaces instead of tabs */ -const remarkLintNoTabs = lintRule( +const remarkLintNoTabs = lintRule$7( 'remark-lint:no-tabs', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (_, file) => { @@ -55432,7 +55441,7 @@ function toThunk(obj, ctx) { return obj; } - if (isObject$1(obj) || Array.isArray(obj)) { + if (isObject(obj) || Array.isArray(obj)) { return objectToThunk.call(ctx, obj); } @@ -55566,7 +55575,7 @@ function isGeneratorFunction(obj) { * @api private */ -function isObject$1(val) { +function isObject(val) { return val && Object == val.constructor; } @@ -55601,7 +55610,7 @@ var co = co_1; * Export `wrapped` */ -var wrapped_1 = wrapped$2; +var wrapped_1 = wrapped$1; /** * Wrap a function to support @@ -55612,7 +55621,7 @@ var wrapped_1 = wrapped$2; * @api public */ -function wrapped$2(fn) { +function wrapped$1(fn) { function wrap() { var args = sliced(arguments); var last = args[args.length - 1]; @@ -55702,15 +55711,15 @@ function promise(value) { return value && 'function' == typeof value.then; } -var wrapped$1 = wrapped_1; +var wrapped = wrapped_1; -var unifiedLintRule$1 = factory$3; +var unifiedLintRule = factory; -function factory$3(id, rule) { +function factory(id, rule) { var parts = id.split(':'); var source = parts[0]; var ruleId = parts[1]; - var fn = wrapped$1(rule); + var fn = wrapped(rule); /* istanbul ignore if - possibly useful if externalised later. */ if (!ruleId) { @@ -55723,7 +55732,7 @@ function factory$3(id, rule) { return attacher function attacher(raw) { - var config = coerce$1(ruleId, raw); + var config = coerce$7(ruleId, raw); var severity = config[0]; var options = config[1]; var fatal = severity === 2; @@ -55763,7 +55772,7 @@ function factory$3(id, rule) { } // Coerce a value to a severity--options tuple. -function coerce$1(name, value) { +function coerce$7(name, value) { var def = 1; var result; var level; @@ -55817,9 +55826,9 @@ function coerce$1(name, value) { return result } -var rule$1 = unifiedLintRule$1; +var rule = unifiedLintRule; -var remarkLintNoTrailingSpaces = rule$1('remark-lint:no-trailing-spaces', noTrailingSpaces); +var remarkLintNoTrailingSpaces = rule('remark-lint:no-trailing-spaces', noTrailingSpaces); /** * Lines that are just space characters are not present in @@ -55842,4480 +55851,177 @@ function noTrailingSpaces(ast, file) { } } -function* getLinksRecursively(node) { - if (node.url) { - yield node; - } - for (const child of node.children || []) { - yield* getLinksRecursively(child); - } -} - -function validateLinks(tree, vfile) { - const currentFileURL = url.pathToFileURL(require$$0__default$2['default'].join(vfile.cwd, vfile.path)); - let previousDefinitionLabel; - for (const node of getLinksRecursively(tree)) { - if (node.url[0] !== "#") { - const targetURL = new URL(node.url, currentFileURL); - if (targetURL.protocol === "file:" && !require$$0__default$3['default'].existsSync(targetURL)) { - vfile.message("Broken link", node); - } else if (targetURL.pathname === currentFileURL.pathname) { - const expected = node.url.includes("#") - ? node.url.slice(node.url.indexOf("#")) - : "#"; - vfile.message( - `Self-reference must start with hash (expected "${expected}", got "${node.url}")`, - node - ); - } - } - if (node.type === "definition") { - if (previousDefinitionLabel && previousDefinitionLabel > node.label) { - vfile.message( - `Unordered reference ("${node.label}" should be before "${previousDefinitionLabel}")`, - node - ); - } - previousDefinitionLabel = node.label; - } - } -} - -const remarkLintNodejsLinks = lintRule( - "remark-lint:nodejs-links", - validateLinks -); - -/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ -function isNothing(subject) { - return (typeof subject === 'undefined') || (subject === null); -} - - -function isObject(subject) { - return (typeof subject === 'object') && (subject !== null); -} - - -function toArray(sequence) { - if (Array.isArray(sequence)) return sequence; - else if (isNothing(sequence)) return []; - - return [ sequence ]; -} - - -function extend(target, source) { - var index, length, key, sourceKeys; - - if (source) { - sourceKeys = Object.keys(source); - - for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index]; - target[key] = source[key]; - } - } - - return target; -} - - -function repeat(string, count) { - var result = '', cycle; - - for (cycle = 0; cycle < count; cycle += 1) { - result += string; - } - - return result; -} - - -function isNegativeZero(number) { - return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); -} - - -var isNothing_1 = isNothing; -var isObject_1 = isObject; -var toArray_1 = toArray; -var repeat_1 = repeat; -var isNegativeZero_1 = isNegativeZero; -var extend_1 = extend; - -var common = { - isNothing: isNothing_1, - isObject: isObject_1, - toArray: toArray_1, - repeat: repeat_1, - isNegativeZero: isNegativeZero_1, - extend: extend_1 -}; - -// YAML error class. http://stackoverflow.com/questions/8458984 - - -function formatError(exception, compact) { - var where = '', message = exception.reason || '(unknown reason)'; - - if (!exception.mark) return message; - - if (exception.mark.name) { - where += 'in "' + exception.mark.name + '" '; - } - - where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; - - if (!compact && exception.mark.snippet) { - where += '\n\n' + exception.mark.snippet; - } - - return message + ' ' + where; -} - - -function YAMLException$1(reason, mark) { - // Super constructor - Error.call(this); - - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = formatError(this, false); - - // Include stack trace in error object - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; - } -} - - -// Inherit from Error -YAMLException$1.prototype = Object.create(Error.prototype); -YAMLException$1.prototype.constructor = YAMLException$1; - - -YAMLException$1.prototype.toString = function toString(compact) { - return this.name + ': ' + formatError(this, compact); -}; - - -var exception = YAMLException$1; - -// get snippet for a single line, respecting maxLength -function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { - var head = ''; - var tail = ''; - var maxHalfLength = Math.floor(maxLineLength / 2) - 1; - - if (position - lineStart > maxHalfLength) { - head = ' ... '; - lineStart = position - maxHalfLength + head.length; - } - - if (lineEnd - position > maxHalfLength) { - tail = ' ...'; - lineEnd = position + maxHalfLength - tail.length; - } - - return { - str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, - pos: position - lineStart + head.length // relative position - }; -} - - -function padStart(string, max) { - return common.repeat(' ', max - string.length) + string; -} - - -function makeSnippet(mark, options) { - options = Object.create(options || null); - - if (!mark.buffer) return null; - - if (!options.maxLength) options.maxLength = 79; - if (typeof options.indent !== 'number') options.indent = 1; - if (typeof options.linesBefore !== 'number') options.linesBefore = 3; - if (typeof options.linesAfter !== 'number') options.linesAfter = 2; - - var re = /\r?\n|\r|\0/g; - var lineStarts = [ 0 ]; - var lineEnds = []; - var match; - var foundLineNo = -1; - - while ((match = re.exec(mark.buffer))) { - lineEnds.push(match.index); - lineStarts.push(match.index + match[0].length); - - if (mark.position <= match.index && foundLineNo < 0) { - foundLineNo = lineStarts.length - 2; - } - } - - if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; - - var result = '', i, line; - var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; - var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); - - for (i = 1; i <= options.linesBefore; i++) { - if (foundLineNo - i < 0) break; - line = getLine( - mark.buffer, - lineStarts[foundLineNo - i], - lineEnds[foundLineNo - i], - mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), - maxLineLength - ); - result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n' + result; - } - - line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); - result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n'; - result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; - - for (i = 1; i <= options.linesAfter; i++) { - if (foundLineNo + i >= lineEnds.length) break; - line = getLine( - mark.buffer, - lineStarts[foundLineNo + i], - lineEnds[foundLineNo + i], - mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), - maxLineLength - ); - result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n'; - } - - return result.replace(/\n$/, ''); -} - - -var snippet = makeSnippet; - -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'multi', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'representName', - 'defaultStyle', - 'styleAliases' -]; - -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; - -function compileStyleAliases(map) { - var result = {}; - - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } - - return result; -} - -function Type$1(tag, options) { - options = options || {}; - - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); - } - }); - - // TODO: Add tag format check. - this.options = options; // keep original options in case user wants to extend this type later - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.representName = options['representName'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.multi = options['multi'] || false; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); - } -} - -var type = Type$1; - -/*eslint-disable max-len*/ - - - - - -function compileList(schema, name) { - var result = []; - - schema[name].forEach(function (currentType) { - var newIndex = result.length; - - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && - previousType.kind === currentType.kind && - previousType.multi === currentType.multi) { - - newIndex = previousIndex; - } - }); - - result[newIndex] = currentType; - }); - - return result; -} - - -function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {}, - multi: { - scalar: [], - sequence: [], - mapping: [], - fallback: [] - } - }, index, length; - - function collectType(type) { - if (type.multi) { - result.multi[type.kind].push(type); - result.multi['fallback'].push(type); - } else { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; - } - } - - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); - } - return result; -} - - -function Schema$1(definition) { - return this.extend(definition); -} - - -Schema$1.prototype.extend = function extend(definition) { - var implicit = []; - var explicit = []; - - if (definition instanceof type) { - // Schema.extend(type) - explicit.push(definition); - - } else if (Array.isArray(definition)) { - // Schema.extend([ type1, type2, ... ]) - explicit = explicit.concat(definition); - - } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { - // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) - if (definition.implicit) implicit = implicit.concat(definition.implicit); - if (definition.explicit) explicit = explicit.concat(definition.explicit); - - } else { - throw new exception('Schema.extend argument should be a Type, [ Type ], ' + - 'or a schema definition ({ implicit: [...], explicit: [...] })'); - } - - implicit.forEach(function (type$1) { - if (!(type$1 instanceof type)) { - throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } - - if (type$1.loadKind && type$1.loadKind !== 'scalar') { - throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); - } - - if (type$1.multi) { - throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); - } - }); - - explicit.forEach(function (type$1) { - if (!(type$1 instanceof type)) { - throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } - }); - - var result = Object.create(Schema$1.prototype); - - result.implicit = (this.implicit || []).concat(implicit); - result.explicit = (this.explicit || []).concat(explicit); - - result.compiledImplicit = compileList(result, 'implicit'); - result.compiledExplicit = compileList(result, 'explicit'); - result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); - - return result; -}; - - -var schema = Schema$1; - -var str = new type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } -}); - -var seq = new type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } -}); - -var map = new type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } -}); - -var failsafe = new schema({ - explicit: [ - str, - seq, - map - ] -}); - -function resolveYamlNull(data) { - if (data === null) return true; - - var max = data.length; - - return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); -} - -function constructYamlNull() { - return null; -} - -function isNull(object) { - return object === null; -} - -var _null = new type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; }, - empty: function () { return ''; } - }, - defaultStyle: 'lowercase' -}); - -function resolveYamlBoolean(data) { - if (data === null) return false; - - var max = data.length; - - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); -} - -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; -} - -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} - -var bool = new type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' -}); - -function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); -} - -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); -} - -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); -} - -function resolveYamlInteger(data) { - if (data === null) return false; - - var max = data.length, - index = 0, - hasDigits = false, - ch; - - if (!max) return false; - - ch = data[index]; - - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; - } - - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; - - // base 2, base 8, base 16 - - if (ch === 'b') { - // base 2 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - - if (ch === 'x') { - // base 16 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - - if (ch === 'o') { - // base 8 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - } - - // base 10 (except 0) - - // value should not start with `_`; - if (ch === '_') return false; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - hasDigits = true; - } - - // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; - - return true; -} - -function constructYamlInteger(data) { - var value = data, sign = 1, ch; - - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); - } - - ch = value[0]; - - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; - } - - if (value === '0') return 0; - - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); - if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); - } - - return sign * parseInt(value, 10); -} - -function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); -} - -var int = new type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } -}); - -var YAML_FLOAT_PATTERN = new RegExp( - // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + - // .2e4, .2 - // special case, seems not from spec - '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // .inf - '|[-+]?\\.(?:inf|Inf|INF)' + - // .nan - '|\\.(?:nan|NaN|NAN))$'); - -function resolveYamlFloat(data) { - if (data === null) return false; - - if (!YAML_FLOAT_PATTERN.test(data) || - // Quick hack to not allow integers end with `_` - // Probably should update regexp & check speed - data[data.length - 1] === '_') { - return false; - } - - return true; -} - -function constructYamlFloat(data) { - var value, sign; - - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); - } - - if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - - } else if (value === '.nan') { - return NaN; - } - return sign * parseFloat(value, 10); -} - - -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; - -function representYamlFloat(object, style) { - var res; - - if (isNaN(object)) { - switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; - } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; - } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; - } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } - - res = object.toString(10); - - // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack - - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; -} - -function isFloat(object) { - return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); -} - -var float = new type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' -}); - -var json = failsafe.extend({ - implicit: [ - _null, - bool, - int, - float - ] -}); - -var core = json; - -var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day - -var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute - -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; -} - -function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - - if (match === null) throw new Error('Date resolve error'); - - // match: [1] year [2] month [3] day - - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); - - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); - } - - // match: [4] hour [5] minute [6] second [7] fraction - - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); - - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; - } - fraction = +fraction; - } - - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute - - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; - } - - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - - if (delta) date.setTime(date.getTime() - delta); - - return date; -} - -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); -} - -var timestamp = new type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); - -function resolveYamlMerge(data) { - return data === '<<' || data === null; -} - -var merge = new type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge -}); - -/*eslint-disable no-bitwise*/ - - - - - -// [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - - -function resolveYamlBinary(data) { - if (data === null) return false; - - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; - - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); - - // Skip CR/LF - if (code > 64) continue; - - // Fail on illegal characters - if (code < 0) return false; - - bitlen += 6; - } - - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; -} - -function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; - - // Collect by 6*4 bits (3 bytes) - - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } - - bits = (bits << 6) | map.indexOf(input.charAt(idx)); - } - - // Dump tail - - tailbits = (max % 4) * 6; - - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } - - return new Uint8Array(result); -} - -function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; - - // Convert every three bytes to 4 ASCII characters. - - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } - - bits = (bits << 8) + object[idx]; - } - - // Dump tail - - tail = max % 3; - - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; - } - - return result; -} - -function isBinary(obj) { - return Object.prototype.toString.call(obj) === '[object Uint8Array]'; -} - -var binary = new type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); - -var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; -var _toString$2 = Object.prototype.toString; - -function resolveYamlOmap(data) { - if (data === null) return true; - - var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; - - if (_toString$2.call(pair) !== '[object Object]') return false; - - for (pairKey in pair) { - if (_hasOwnProperty$3.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; - } - } - - if (!pairHasKey) return false; - - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; - } - - return true; -} - -function constructYamlOmap(data) { - return data !== null ? data : []; -} - -var omap = new type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap -}); - -var _toString$1 = Object.prototype.toString; - -function resolveYamlPairs(data) { - if (data === null) return true; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - if (_toString$1.call(pair) !== '[object Object]') return false; - - keys = Object.keys(pair); - - if (keys.length !== 1) return false; - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return true; -} - -function constructYamlPairs(data) { - if (data === null) return []; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - keys = Object.keys(pair); - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return result; -} - -var pairs = new type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs -}); - -var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; - -function resolveYamlSet(data) { - if (data === null) return true; - - var key, object = data; - - for (key in object) { - if (_hasOwnProperty$2.call(object, key)) { - if (object[key] !== null) return false; - } - } - - return true; -} - -function constructYamlSet(data) { - return data !== null ? data : {}; -} - -var set = new type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); - -var _default = core.extend({ - implicit: [ - timestamp, - merge - ], - explicit: [ - binary, - omap, - pairs, - set - ] -}); - -/*eslint-disable max-len,no-use-before-define*/ - - - - - - - -var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; - - -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; - - -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; - - -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - - -function _class(obj) { return Object.prototype.toString.call(obj); } - -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); -} - -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); -} - -function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); -} - -function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; -} - -function fromHexCode(c) { - var lc; - - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - /*eslint-disable no-bitwise*/ - lc = c | 0x20; - - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; - } - - return -1; -} - -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; -} - -function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - return -1; -} - -function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; -} - -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode( - ((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00 - ); -} - -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); -} - - -function State$1(input, options) { - this.input = input; - - this.filename = options['filename'] || null; - this.schema = options['schema'] || _default; - this.onWarning = options['onWarning'] || null; - // (Hidden) Remove? makes the loader to expect YAML 1.1 documents - // if such documents have no explicit %YAML directive - this.legacy = options['legacy'] || false; - - this.json = options['json'] || false; - this.listener = options['listener'] || null; - - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; - - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; - - // position of first leading tab in the current line, - // used to make sure there are no tabs in the indentation - this.firstTabInLine = -1; - - this.documents = []; - - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ - -} - - -function generateError(state, message) { - var mark = { - name: state.filename, - buffer: state.input.slice(0, -1), // omit trailing \0 - position: state.position, - line: state.line, - column: state.position - state.lineStart - }; - - mark.snippet = snippet(mark); - - return new exception(message, mark); -} - -function throwError(state, message) { - throw generateError(state, message); -} - -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); - } -} - - -var directiveHandlers = { - - YAML: function handleYamlDirective(state, name, args) { - - var match, major, minor; - - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } - - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); - } - - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); - - if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); - } - - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); - - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } - - state.version = args[0]; - state.checkLineBreaks = (minor < 2); - - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); - } - }, - - TAG: function handleTagDirective(state, name, args) { - - var handle, prefix; - - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } - - handle = args[0]; - prefix = args[1]; - - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); - } - - if (_hasOwnProperty$1.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); - } - - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } - - try { - prefix = decodeURIComponent(prefix); - } catch (err) { - throwError(state, 'tag prefix is malformed: ' + prefix); - } - - state.tagMap[handle] = prefix; - } -}; - - -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; - - if (start < end) { - _result = state.input.slice(start, end); - - if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); - if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } - - state.result += _result; - } -} - -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; - - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } - - sourceKeys = Object.keys(source); - - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; - - if (!_hasOwnProperty$1.call(destination, key)) { - destination[key] = source[key]; - overridableKeys[key] = true; - } - } -} - -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, - startLine, startLineStart, startPos) { - - var index, quantity; - - // The output is a plain object here, so keys can only be strings. - // We need to convert keyNode to a string, but doing so can hang the process - // (deeply nested arrays that explode exponentially using aliases). - if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); - - for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { - if (Array.isArray(keyNode[index])) { - throwError(state, 'nested arrays are not supported inside keys'); - } - - if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { - keyNode[index] = '[object Object]'; - } - } - } - - // Avoid code execution in load() via toString property - // (still use its own toString for arrays, timestamps, - // and whatever user schema extensions happen to have @@toStringTag) - if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; - } - - - keyNode = String(keyNode); - - if (_result === null) { - _result = {}; - } - - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); - } - } else { - if (!state.json && - !_hasOwnProperty$1.call(overridableKeys, keyNode) && - _hasOwnProperty$1.call(_result, keyNode)) { - state.line = startLine || state.line; - state.lineStart = startLineStart || state.lineStart; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); - } - - // used for this specific key only because Object.defineProperty is slow - if (keyNode === '__proto__') { - Object.defineProperty(_result, keyNode, { - configurable: true, - enumerable: true, - writable: true, - value: valueNode - }); - } else { - _result[keyNode] = valueNode; - } - delete overridableKeys[keyNode]; - } - - return _result; -} - -function readLineBreak(state) { - var ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); - } - - state.line += 1; - state.lineStart = state.position; - state.firstTabInLine = -1; -} - -function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { - state.firstTabInLine = state.position; - } - ch = state.input.charCodeAt(++state.position); - } - - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); - } - - if (is_EOL(ch)) { - readLineBreak(state); - - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; - - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } - - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } - - return lineBreaks; -} - -function testDocumentSeparator(state) { - var _position = state.position, - ch; - - ch = state.input.charCodeAt(_position); - - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { - - _position += 3; - - ch = state.input.charCodeAt(_position); - - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } - - return false; -} - -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); - } -} - - -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; - - ch = state.input.charCodeAt(state.position); - - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; - } - - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } - } - - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; - - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } - - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); - - if (is_WS_OR_EOL(preceding)) { - break; - } - - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; - - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); - - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; - } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; - } - } - - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } - - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; - } - - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, captureEnd, false); - - if (state.result) { - return true; - } - - state.kind = _kind; - state.result = _result; - return false; -} - -function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x27/* ' */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a single quoted scalar'); -} - -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x22/* " */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; - - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); - - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; - - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; - - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); - - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; - - } else { - throwError(state, 'expected hexadecimal character'); - } - } - - state.result += charFromCodepoint(hexResult); - - state.position++; - - } else { - throwError(state, 'unknown escape sequence'); - } - - captureStart = captureEnd = state.position; - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a double quoted scalar'); -} - -function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _lineStart, - _pos, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = Object.create(null), - keyNode, - keyTag, - valueNode, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(++state.position); - - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } else if (ch === 0x2C/* , */) { - // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 - throwError(state, "expected the node content, but found ','"); - } - - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; - - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); - } - } - - _line = state.line; // Save the current line. - _lineStart = state.lineStart; - _pos = state.position; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; - } - - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); - } else { - _result.push(keyNode); - } - - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } - - throwError(state, 'unexpected end of the stream within a flow collection'); -} - -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } - - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } - - } else { - break; - } - } - - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); - } - } - - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; - - ch = state.input.charCodeAt(state.position); - - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } - - if (is_EOL(ch)) { - emptyLines++; - continue; - } - - // End of the scalar. - if (state.lineIndent < textIndent) { - - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; - } - } - - // Break this `while` cycle and go to the funciton's epilogue. - break; - } - - // Folded style: use fancy rules to handle line breaks. - if (folding) { - - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); - - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; - } - - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } - - // Literal style: just add exact number of line breaks between content lines. - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } - - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; - - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, state.position, false); - } - - return true; -} - -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; - - // there is a leading tab before this token, so it can't be a block sequence/mapping; - // it can still be flow sequence/mapping or a scalar - if (state.firstTabInLine !== -1) return false; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - if (state.firstTabInLine !== -1) { - state.position = state.firstTabInLine; - throwError(state, 'tab characters must not be used in indentation'); - } - - if (ch !== 0x2D/* - */) { - break; - } - - following = state.input.charCodeAt(state.position + 1); - - if (!is_WS_OR_EOL(following)) { - break; - } - - detected = true; - state.position++; - - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; -} - -function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _keyLine, - _keyLineStart, - _keyPos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = Object.create(null), - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; - - // there is a leading tab before this token, so it can't be a block sequence/mapping; - // it can still be flow sequence/mapping or a scalar - if (state.firstTabInLine !== -1) return false; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - if (!atExplicitKey && state.firstTabInLine !== -1) { - state.position = state.firstTabInLine; - throwError(state, 'tab characters must not be used in indentation'); - } - - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { - - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = true; - allowCompact = true; - - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; - - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); - } - - state.position += 1; - ch = following; - - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else { - _keyLine = state.line; - _keyLineStart = state.lineStart; - _keyPos = state.position; - - if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { - // Neither implicit nor explicit notation. - // Reading is done. Go to the epilogue. - break; - } - - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); - - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); - - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } - - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; - - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - } - - // - // Common reading code for both explicit and implicit notations. - // - if (state.line === _line || state.lineIndent > nodeIndent) { - if (atExplicitKey) { - _keyLine = state.line; - _keyLineStart = state.lineStart; - _keyPos = state.position; - } - - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; - } else { - valueNode = state.result; - } - } - - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; - } - - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); - } - - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - // - // Epilogue. - // - - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - } - - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; - } - - return detected; -} - -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x21/* ! */) return false; - - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } - - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); - - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); - - } else { - tagHandle = '!'; - } - - _position = state.position; - - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); - - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); - } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); - - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } - - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } - - ch = state.input.charCodeAt(++state.position); - } - - tagName = state.input.slice(_position, state.position); - - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); - } - } - - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } - - try { - tagName = decodeURIComponent(tagName); - } catch (err) { - throwError(state, 'tag name is malformed: ' + tagName); - } - - if (isVerbatim) { - state.tag = tagName; - - } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; - - } else if (tagHandle === '!') { - state.tag = '!' + tagName; - - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; - - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); - } - - return true; -} - -function readAnchorProperty(state) { - var _position, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x26/* & */) return false; - - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); - } - - state.anchor = state.input.slice(_position, state.position); - return true; -} - -function readAlias(state) { - var _position, alias, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x2A/* * */) return false; - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); - } - - alias = state.input.slice(_position, state.position); - - if (!_hasOwnProperty$1.call(state.anchorMap, alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } - - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; -} - -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent - atNewLine = false, - hasContent = false, - typeIndex, - typeQuantity, - typeList, - type, - flowIndent, - blockIndent; - - if (state.listener !== null) { - state.listener('open', state); - } - - state.tag = null; - state.anchor = null; - state.kind = null; - state.result = null; - - allowBlockStyles = allowBlockScalars = allowBlockCollections = - CONTEXT_BLOCK_OUT === nodeContext || - CONTEXT_BLOCK_IN === nodeContext; - - if (allowToSeek) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } - - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; - - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } - - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } - - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } - - blockIndent = state.position - state.lineStart; - - if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || - readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || - readSingleQuotedScalar(state, flowIndent) || - readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; +/** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ - } else if (readAlias(state)) { - hasContent = true; +const primitives$6 = new Set(['string', 'number', 'boolean']); - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$6(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; + Object.defineProperty(plugin, 'name', {value: id}); - if (state.tag === null) { - state.tag = '?'; - } - } + return plugin - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$6(ruleId, raw); - if (state.tag === null) { - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } + if (!severity) return - } else if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "!<?> [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"'); - } + const fatal = severity === 2; - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; + return (tree, file, next) => { + let index = file.messages.length - 1; - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (state.tag !== '!') { - if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; - } else { - // looking for multi type - type = null; - typeList = state.typeMap.multi[state.kind || 'fallback']; + wrap(rule, (error) => { + const messages = file.messages; - for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { - if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { - type = typeList[typeIndex]; - break; + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} } - } - } - - if (!type) { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } - - if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result, state.tag); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } - - if (state.listener !== null) { - state.listener('close', state); - } - return state.tag !== null || state.anchor !== null || hasContent; -} - -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; - - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = Object.create(null); - state.anchorMap = Object.create(null); - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } - - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; - - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } - - if (is_EOL(ch)) break; - - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveArgs.push(state.input.slice(_position, state.position)); - } - - if (ch !== 0) readLineBreak(state); - - if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); - } - } - - skipSeparationSpace(state, true, -1); - - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); - } - - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); - - if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); - } - - state.documents.push(state.result); - - if (state.position === state.lineStart && testDocumentSeparator(state)) { - - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - return; - } - - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } -} - - -function loadDocuments(input, options) { - input = String(input); - options = options || {}; - - if (input.length !== 0) { - - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; - } - - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } - - var state = new State$1(input, options); - - var nullpos = input.indexOf('\0'); - - if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); - } - - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; - - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } - - while (state.position < (state.length - 1)) { - readDocument(state); - } - - return state.documents; -} - - -function loadAll$1(input, iterator, options) { - if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; - } - - var documents = loadDocuments(input, options); - - if (typeof iterator !== 'function') { - return documents; - } - - for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); - } -} - - -function load$1(input, options) { - var documents = loadDocuments(input, options); - - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - throw new exception('expected a single document in the stream, but found more'); -} - - -var loadAll_1 = loadAll$1; -var load_1 = load$1; - -var loader = { - loadAll: loadAll_1, - load: load_1 -}; - -/*eslint-disable no-use-before-define*/ - - - - - -var _toString = Object.prototype.toString; -var _hasOwnProperty = Object.prototype.hasOwnProperty; - -var CHAR_BOM = 0xFEFF; -var CHAR_TAB = 0x09; /* Tab */ -var CHAR_LINE_FEED = 0x0A; /* LF */ -var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ -var CHAR_SPACE = 0x20; /* Space */ -var CHAR_EXCLAMATION = 0x21; /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22; /* " */ -var CHAR_SHARP = 0x23; /* # */ -var CHAR_PERCENT = 0x25; /* % */ -var CHAR_AMPERSAND = 0x26; /* & */ -var CHAR_SINGLE_QUOTE = 0x27; /* ' */ -var CHAR_ASTERISK = 0x2A; /* * */ -var CHAR_COMMA = 0x2C; /* , */ -var CHAR_MINUS = 0x2D; /* - */ -var CHAR_COLON = 0x3A; /* : */ -var CHAR_EQUALS = 0x3D; /* = */ -var CHAR_GREATER_THAN = 0x3E; /* > */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - -var ESCAPE_SEQUENCES = {}; - -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; - -var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; - -var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; - -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; - - if (map === null) return {}; - - result = {}; - keys = Object.keys(map); - - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); - - if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); - } - type = schema.compiledTypeMap['fallback'][tag]; - - if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; - } - - result[tag] = style; - } - - return result; -} - -function encodeHex(character) { - var string, handle, length; - - string = character.toString(16).toUpperCase(); - - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); - } - - return '\\' + handle + common.repeat('0', length - string.length) + string; -} - - -var QUOTING_TYPE_SINGLE = 1, - QUOTING_TYPE_DOUBLE = 2; - -function State(options) { - this.schema = options['schema'] || _default; - this.indent = Math.max(1, (options['indent'] || 2)); - this.noArrayIndent = options['noArrayIndent'] || false; - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; - this.condenseFlow = options['condenseFlow'] || false; - this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; - this.forceQuotes = options['forceQuotes'] || false; - this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; - - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; - - this.tag = null; - this.result = ''; - - this.duplicates = []; - this.usedDuplicates = null; -} - -// Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; - - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; - } - - if (line.length && line !== '\n') result += ind; - - result += line; - } - - return result; -} - -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); -} - -function testImplicitResolving(state, str) { - var index, length, type; - - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; - - if (type.resolve(str)) { - return true; - } - } - return false; -} - -// [33] s-white ::= s-space | s-tab -function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; -} - -// Returns true if the character can be printed without escaping. -// From YAML 1.2: "any allowed characters known to be non-printable -// should also be escaped. [However,] This isn’t mandatory" -// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) - || (0x10000 <= c && c <= 0x10FFFF); -} - -// [34] ns-char ::= nb-char - s-white -// [27] nb-char ::= c-printable - b-char - c-byte-order-mark -// [26] b-char ::= b-line-feed | b-carriage-return -// Including s-white (for some reason, examples doesn't match specs in this aspect) -// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark -function isNsCharOrWhitespace(c) { - return isPrintable(c) - && c !== CHAR_BOM - // - b-char - && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED; -} - -// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out -// c = flow-in ⇒ ns-plain-safe-in -// c = block-key ⇒ ns-plain-safe-out -// c = flow-key ⇒ ns-plain-safe-in -// [128] ns-plain-safe-out ::= ns-char -// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator -// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) -// | ( /* An ns-char preceding */ “#” ) -// | ( “:” /* Followed by an ns-plain-safe(c) */ ) -function isPlainSafe(c, prev, inblock) { - var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); - var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); - return ( - // ns-plain-safe - inblock ? // c = flow-in - cIsNsCharOrWhitespace - : cIsNsCharOrWhitespace - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - ) - // ns-plain-char - && c !== CHAR_SHARP // false on '#' - && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' - || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' - || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' -} - -// Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c) { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part - return isPrintable(c) && c !== CHAR_BOM - && !isWhitespace(c) // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS - && c !== CHAR_QUESTION - && c !== CHAR_COLON - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” - && c !== CHAR_SHARP - && c !== CHAR_AMPERSAND - && c !== CHAR_ASTERISK - && c !== CHAR_EXCLAMATION - && c !== CHAR_VERTICAL_LINE - && c !== CHAR_EQUALS - && c !== CHAR_GREATER_THAN - && c !== CHAR_SINGLE_QUOTE - && c !== CHAR_DOUBLE_QUOTE - // | “%” | “@” | “`”) - && c !== CHAR_PERCENT - && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT; -} - -// Simplified test for values allowed as the last character in plain style. -function isPlainSafeLast(c) { - // just not whitespace or colon, it will be checked to be plain character later - return !isWhitespace(c) && c !== CHAR_COLON; -} - -// Same as 'string'.codePointAt(pos), but works in older browsers. -function codePointAt(string, pos) { - var first = string.charCodeAt(pos), second; - if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { - second = string.charCodeAt(pos + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } - } - return first; -} - -// Determines whether block indentation indicator is required. -function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); -} - -var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; - -// Determines which scalar styles are possible and returns the preferred style. -// lineWidth = -1 => no limit. -// Pre-conditions: str.length > 0. -// Post-conditions: -// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. -// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). -// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, - testAmbiguousType, quotingType, forceQuotes, inblock) { - - var i; - var char = 0; - var prevChar = null; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst(codePointAt(string, 0)) - && isPlainSafeLast(codePointAt(string, string.length - 1)); - - if (singleLineOnly || forceQuotes) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char, prevChar, inblock); - prevChar = char; - } - } else { - // Case: block styles permitted. - for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' '); - previousLineBreak = i; + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); } - } else if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char, prevChar, inblock); - prevChar = char; - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || (shouldTrackWidth && - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); - } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - if (plain && !forceQuotes && !testAmbiguousType(string)) { - return STYLE_PLAIN; - } - return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; - } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; - } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - if (!forceQuotes) { - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; - } - return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; -} -// Note: line breaking/folding is implemented for only the folded style. -// NB. We drop the last trailing newline (if any) of a returned block scalar -// since the dumper adds its own newline. This always works: -// • No ending newline => unaffected; already using strip "-" chomping. -// • Ending newline => removed then restored. -// Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar(state, string, level, iskey, inblock) { - state.dump = (function () { - if (string.length === 0) { - return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; - } - if (!state.noCompatMode) { - if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { - return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); - } - } - - var indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower bound. - // This behaves better than a constant minimum width which disallows narrower options, - // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); - - // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey - // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); - } - - switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, - testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { - - case STYLE_PLAIN: - return string; - case STYLE_SINGLE: - return "'" + string.replace(/'/g, "''") + "'"; - case STYLE_LITERAL: - return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)); - case STYLE_FOLDED: - return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); - case STYLE_DOUBLE: - return '"' + escapeString(string) + '"'; - default: - throw new exception('impossible error: invalid scalar style'); + next(); + })(tree, file, options); } - }()); -} - -// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; - - // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); - - return indentIndicator + chomp + '\n'; -} - -// (See the note for writeScalar.) -function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; -} - -// Note: a long line without a suitable break point will exceed the width limit. -// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string, width) { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; - - // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); - // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; - - // rest of the lines - var match; - while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2]; - moreIndented = (line[0] === ' '); - result += prefix - + (!prevMoreIndented && !moreIndented && line !== '' - ? '\n' : '') - + foldLine(line, width); - prevMoreIndented = moreIndented; } - - return result; } -// Greedy line breaking. -// Picks the longest line under the limit each time, -// otherwise settles for the shortest line over the limit. -// NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine(line, width) { - if (line === '' || line[0] === ' ') return line; - - // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - var match; - // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0; - var result = ''; - - // Invariants: 0 <= start <= length-1. - // 0 <= curr <= next <= max(0, length-2). curr - start <= width. - // Inside the loop: - // A match implies length >= 2, so curr and next are <= length-2. - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 - } - curr = next; - } +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$6(name, value) { + /** @type {unknown[]} */ + let result; - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += '\n'; - // Insert a break if the remainder is too long and there is a break available. - if (line.length - start > width && curr > start) { - result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$6.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; } else { - result += line.slice(start); - } - - return result.slice(1); // drop extra \n joiner -} - -// Escapes a double-quoted string. -function escapeString(string) { - var result = ''; - var char = 0; - var escapeSeq; - - for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - escapeSeq = ESCAPE_SEQUENCES[char]; - - if (!escapeSeq && isPrintable(char)) { - result += string[i]; - if (char >= 0x10000) result += string[i + 1]; - } else { - result += escapeSeq || encodeHex(char); - } - } - - return result; -} - -function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length, - value; - - for (index = 0, length = object.length; index < length; index += 1) { - value = object[index]; - - if (state.replacer) { - value = state.replacer.call(object, String(index), value); - } - - // Write only valid elements, put null instead of invalid elements. - if (writeNode(state, level, value, false, false) || - (typeof value === 'undefined' && - writeNode(state, level, null, false, false))) { - - if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = '[' + _result + ']'; -} - -function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length, - value; - - for (index = 0, length = object.length; index < length; index += 1) { - value = object[index]; - - if (state.replacer) { - value = state.replacer.call(object, String(index), value); - } - - // Write only valid elements, put null instead of invalid elements. - if (writeNode(state, level + 1, value, true, true, false, true) || - (typeof value === 'undefined' && - writeNode(state, level + 1, null, true, true, false, true))) { - - if (!compact || _result !== '') { - _result += generateNextLine(state, level); - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; - } else { - _result += '- '; - } - - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. -} - -function writeFlowMapping(state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer; - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - - pairBuffer = ''; - if (_result !== '') pairBuffer += ', '; - - if (state.condenseFlow) pairBuffer += '"'; - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (state.replacer) { - objectValue = state.replacer.call(object, objectKey, objectValue); - } - - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } - - if (state.dump.length > 1024) pairBuffer += '? '; - - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); - - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = '{' + _result + '}'; -} - -function writeBlockMapping(state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer; - - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new exception('sortKeys must be a boolean or a function'); + result = [1, value]; } - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; - - if (!compact || _result !== '') { - pairBuffer += generateNextLine(state, level); - } - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (state.replacer) { - objectValue = state.replacer.call(object, objectKey, objectValue); - } - - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } - - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); - - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; - } - } - - pairBuffer += state.dump; - - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } - - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } + let level = result[0]; - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; } else { - pairBuffer += ': '; - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. -} - -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; - - typeList = explicit ? state.explicitTypes : state.implicitTypes; - - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; - - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { - - if (explicit) { - if (type.multi && type.representName) { - state.tag = type.representName(object); - } else { - state.tag = type.tag; - } - } else { - state.tag = '?'; - } - - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; - - if (_toString.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); - } else if (_hasOwnProperty.call(type.represent, style)) { - _result = type.represent[style](object, style); - } else { - throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); - } - - state.dump = _result; - } - - return true; + level = 1; + result = [level, result]; } } - return false; -} - -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode(state, level, object, block, compact, iskey, isblockseq) { - state.tag = null; - state.dump = object; - - if (!detectType(state, object, false)) { - detectType(state, object, true); - } - - var type = _toString.call(state.dump); - var inblock = block; - var tagStr; - - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); - } - - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; - - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } - - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } - - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === '[object Object]') { - if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object Array]') { - if (block && (state.dump.length !== 0)) { - if (state.noArrayIndent && !isblockseq && level > 0) { - writeBlockSequence(state, level - 1, state.dump, compact); - } else { - writeBlockSequence(state, level, state.dump, compact); - } - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowSequence(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object String]') { - if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey, inblock); - } - } else if (type === '[object Undefined]') { - return false; - } else { - if (state.skipInvalid) return false; - throw new exception('unacceptable kind of an object to dump ' + type); - } - - if (state.tag !== null && state.tag !== '?') { - // Need to encode all characters except those allowed by the spec: - // - // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ - // [36] ns-hex-digit ::= ns-dec-digit - // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ - // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ - // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” - // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” - // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” - // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” - // - // Also need to encode '!' because it has special meaning (end of tag prefix). - // - tagStr = encodeURI( - state.tag[0] === '!' ? state.tag.slice(1) : state.tag - ).replace(/!/g, '%21'); - - if (state.tag[0] === '!') { - tagStr = '!' + tagStr; - } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { - tagStr = '!!' + tagStr.slice(18); - } else { - tagStr = '!<' + tagStr + '>'; - } - - state.dump = tagStr + ' ' + state.dump; - } + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) } - return true; -} - -function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; - - inspectNode(object, objects, duplicatesIndexes); + result[0] = level; - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); + // @ts-expect-error: it’s now a valid tuple. + return result } -function inspectNode(object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length; - - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); - - if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); - } - } else { - objectKeyList = Object.keys(object); - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); - } - } - } +function* getLinksRecursively(node) { + if (node.url) { + yield node; } -} - -function dump$1(input, options) { - options = options || {}; - - var state = new State(options); - - if (!state.noRefs) getDuplicateReferences(input, state); - - var value = input; - - if (state.replacer) { - value = state.replacer.call({ '': value }, '', value); + for (const child of node.children || []) { + yield* getLinksRecursively(child); } - - if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; - - return ''; } -var dump_1 = dump$1; - -var dumper = { - dump: dump_1 -}; - -function renamed(from, to) { - return function () { - throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + - 'Use yaml.' + to + ' instead, which is now safe by default.'); - }; -} - - -var Type = type; -var Schema = schema; -var FAILSAFE_SCHEMA = failsafe; -var JSON_SCHEMA = json; -var CORE_SCHEMA = core; -var DEFAULT_SCHEMA = _default; -var load = loader.load; -var loadAll = loader.loadAll; -var dump = dumper.dump; -var YAMLException = exception; - -// Re-export all types in case user wants to create custom schema -var types = { - binary: binary, - float: float, - map: map, - null: _null, - pairs: pairs, - set: set, - timestamp: timestamp, - bool: bool, - int: int, - merge: merge, - omap: omap, - seq: seq, - str: str -}; - -// Removed functions from JS-YAML 3.0.x -var safeLoad = renamed('safeLoad', 'load'); -var safeLoadAll = renamed('safeLoadAll', 'loadAll'); -var safeDump = renamed('safeDump', 'dump'); - -var jsYaml = { - Type: Type, - Schema: Schema, - FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, - JSON_SCHEMA: JSON_SCHEMA, - CORE_SCHEMA: CORE_SCHEMA, - DEFAULT_SCHEMA: DEFAULT_SCHEMA, - load: load, - loadAll: loadAll, - dump: dump, - YAMLException: YAMLException, - types: types, - safeLoad: safeLoad, - safeLoadAll: safeLoadAll, - safeDump: safeDump -}; - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -const SEMVER_SPEC_VERSION = '2.0.0'; - -const MAX_LENGTH$2 = 256; -const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991; - -// Max safe segment length for coercion. -const MAX_SAFE_COMPONENT_LENGTH = 16; - -var constants = { - SEMVER_SPEC_VERSION, - MAX_LENGTH: MAX_LENGTH$2, - MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1, - MAX_SAFE_COMPONENT_LENGTH -}; - -var re$2 = {exports: {}}; - -const debug$1 = ( - typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG) -) ? (...args) => console.error('SEMVER', ...args) - : () => {}; - -var debug_1 = debug$1; - -(function (module, exports) { -const { MAX_SAFE_COMPONENT_LENGTH } = constants; -const debug = debug_1; -exports = module.exports = {}; - -// The actual regexps go on exports.re -const re = exports.re = []; -const src = exports.src = []; -const t = exports.t = {}; -let R = 0; - -const createToken = (name, value, isGlobal) => { - const index = R++; - debug(index, value); - t[name] = index; - src[index] = value; - re[index] = new RegExp(value, isGlobal ? 'g' : undefined); -}; - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*'); -createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+'); - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*'); - -// ## Main Version -// Three dot-separated numeric identifiers. - -createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})`); - -createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})`); - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`); - -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`); - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] -}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); - -createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] -}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+'); - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] -}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -createToken('FULLPLAIN', `v?${src[t.MAINVERSION] -}${src[t.PRERELEASE]}?${ - src[t.BUILD]}?`); - -createToken('FULL', `^${src[t.FULLPLAIN]}$`); - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] -}${src[t.PRERELEASELOOSE]}?${ - src[t.BUILD]}?`); - -createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`); - -createToken('GTLT', '((?:<|>)?=?)'); - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); -createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); - -createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:${src[t.PRERELEASE]})?${ - src[t.BUILD]}?` + - `)?)?`); - -createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:${src[t.PRERELEASELOOSE]})?${ - src[t.BUILD]}?` + - `)?)?`); - -createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); -createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -createToken('COERCE', `${'(^|[^\\d])' + - '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:$|[^\\d])`); -createToken('COERCERTL', src[t.COERCE], true); - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -createToken('LONETILDE', '(?:~>?)'); - -createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true); -exports.tildeTrimReplace = '$1~'; - -createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); -createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -createToken('LONECARET', '(?:\\^)'); - -createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true); -exports.caretTrimReplace = '$1^'; - -createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); -createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); -createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] -}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); -exports.comparatorTrimReplace = '$1$2$3'; - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAIN]})` + - `\\s*$`); - -createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAINLOOSE]})` + - `\\s*$`); - -// Star ranges basically just allow anything at all. -createToken('STAR', '(<|>)?=?\\s*\\*'); -// >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$'); -createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$'); -}(re$2, re$2.exports)); - -// parse out just the options we care about so we always get a consistent -// obj with keys in a consistent order. -const opts = ['includePrerelease', 'loose', 'rtl']; -const parseOptions$2 = options => - !options ? {} - : typeof options !== 'object' ? { loose: true } - : opts.filter(k => options[k]).reduce((options, k) => { - options[k] = true; - return options - }, {}); -var parseOptions_1 = parseOptions$2; - -const numeric = /^[0-9]+$/; -const compareIdentifiers$1 = (a, b) => { - const anum = numeric.test(a); - const bnum = numeric.test(b); - - if (anum && bnum) { - a = +a; - b = +b; - } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -}; - -const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a); - -var identifiers = { - compareIdentifiers: compareIdentifiers$1, - rcompareIdentifiers -}; - -const debug = debug_1; -const { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER } = constants; -const { re: re$1, t: t$1 } = re$2.exports; - -const parseOptions$1 = parseOptions_1; -const { compareIdentifiers } = identifiers; -class SemVer$2 { - constructor (version, options) { - options = parseOptions$1(options); - - if (version instanceof SemVer$2) { - if (version.loose === !!options.loose && - version.includePrerelease === !!options.includePrerelease) { - return version - } else { - version = version.version; - } - } else if (typeof version !== 'string') { - throw new TypeError(`Invalid Version: ${version}`) - } - - if (version.length > MAX_LENGTH$1) { - throw new TypeError( - `version is longer than ${MAX_LENGTH$1} characters` - ) - } - - debug('SemVer', version, options); - this.options = options; - this.loose = !!options.loose; - // this isn't actually relevant for versions, but keep it so that we - // don't run into trouble passing this.options around. - this.includePrerelease = !!options.includePrerelease; - - const m = version.trim().match(options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL]); - - if (!m) { - throw new TypeError(`Invalid Version: ${version}`) - } - - this.raw = version; - - // these are actually numbers - this.major = +m[1]; - this.minor = +m[2]; - this.patch = +m[3]; - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = []; - } else { - this.prerelease = m[4].split('.').map((id) => { - if (/^[0-9]+$/.test(id)) { - const num = +id; - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }); - } - - this.build = m[5] ? m[5].split('.') : []; - this.format(); - } - - format () { - this.version = `${this.major}.${this.minor}.${this.patch}`; - if (this.prerelease.length) { - this.version += `-${this.prerelease.join('.')}`; - } - return this.version - } - - toString () { - return this.version - } - - compare (other) { - debug('SemVer.compare', this.version, this.options, other); - if (!(other instanceof SemVer$2)) { - if (typeof other === 'string' && other === this.version) { - return 0 - } - other = new SemVer$2(other, this.options); - } - - if (other.version === this.version) { - return 0 - } - - return this.compareMain(other) || this.comparePre(other) - } - - compareMain (other) { - if (!(other instanceof SemVer$2)) { - other = new SemVer$2(other, this.options); - } - - return ( - compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) - ) - } - - comparePre (other) { - if (!(other instanceof SemVer$2)) { - other = new SemVer$2(other, this.options); - } - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } - - let i = 0; - do { - const a = this.prerelease[i]; - const b = other.prerelease[i]; - debug('prerelease compare', i, a, b); - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) +function validateLinks(tree, vfile) { + const currentFileURL = pathToFileURL(path$b.join(vfile.cwd, vfile.path)); + let previousDefinitionLabel; + for (const node of getLinksRecursively(tree)) { + if (node.url[0] !== "#") { + const targetURL = new URL(node.url, currentFileURL); + if (targetURL.protocol === "file:" && !require$$0$3.existsSync(targetURL)) { + vfile.message("Broken link", node); + } else if (targetURL.pathname === currentFileURL.pathname) { + const expected = node.url.includes("#") + ? node.url.slice(node.url.indexOf("#")) + : "#"; + vfile.message( + `Self-reference must start with hash (expected "${expected}", got "${node.url}")`, + node + ); } - } while (++i) - } - - compareBuild (other) { - if (!(other instanceof SemVer$2)) { - other = new SemVer$2(other, this.options); } - - let i = 0; - do { - const a = this.build[i]; - const b = other.build[i]; - debug('prerelease compare', i, a, b); - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) + if (node.type === "definition") { + if (previousDefinitionLabel && previousDefinitionLabel > node.label) { + vfile.message( + `Unordered reference ("${node.label}" should be before "${previousDefinitionLabel}")`, + node + ); } - } while (++i) - } - - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - inc (release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0; - this.patch = 0; - this.minor = 0; - this.major++; - this.inc('pre', identifier); - break - case 'preminor': - this.prerelease.length = 0; - this.patch = 0; - this.minor++; - this.inc('pre', identifier); - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0; - this.inc('patch', identifier); - this.inc('pre', identifier); - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier); - } - this.inc('pre', identifier); - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if ( - this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0 - ) { - this.major++; - } - this.minor = 0; - this.patch = 0; - this.prerelease = []; - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++; - } - this.patch = 0; - this.prerelease = []; - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++; - } - this.prerelease = []; - break - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0]; - } else { - let i = this.prerelease.length; - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++; - i = -2; - } - } - if (i === -1) { - // didn't increment anything - this.prerelease.push(0); - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0]; - } - } else { - this.prerelease = [identifier, 0]; - } - } - break - - default: - throw new Error(`invalid increment argument: ${release}`) + previousDefinitionLabel = node.label; } - this.format(); - this.raw = this.version; - return this } } -var semver = SemVer$2; - -const {MAX_LENGTH} = constants; -const { re, t } = re$2.exports; -const SemVer$1 = semver; - -const parseOptions = parseOptions_1; -const parse = (version, options) => { - options = parseOptions(options); - - if (version instanceof SemVer$1) { - return version - } - - if (typeof version !== 'string') { - return null - } - - if (version.length > MAX_LENGTH) { - return null - } - - const r = options.loose ? re[t.LOOSE] : re[t.FULL]; - if (!r.test(version)) { - return null - } - - try { - return new SemVer$1(version, options) - } catch (er) { - return null - } -}; - -var parse_1 = parse; - -const SemVer = semver; -const compare$1 = (a, b, loose) => - new SemVer(a, loose).compare(new SemVer(b, loose)); - -var compare_1 = compare$1; - -const compare = compare_1; -const lt = (a, b, loose) => compare(a, b, loose) < 0; -var lt_1 = lt; +const remarkLintNodejsLinks = lintRule$6( + "remark-lint:nodejs-links", + validateLinks +); const allowedKeys = [ "added", @@ -60529,7 +56235,7 @@ function validateMeta(node, file, meta) { } function validateYAMLComments(tree, file) { - visit$2(tree, "html", function visitor(node) { + visit(tree, "html", function visitor(node) { if (node.value.startsWith("<!--YAML\n")) file.message( "Expected `<!-- YAML`, found `<!--YAML`. Please add a space", @@ -60546,134 +56252,118 @@ function validateYAMLComments(tree, file) { }); } -const remarkLintNodejsYamlComments = lintRule( +const remarkLintNodejsYamlComments = lintRule$6( "remark-lint:nodejs-yaml-comments", validateYAMLComments ); -var escapeStringRegexp$2 = string => { +function escapeStringRegexp(string) { if (typeof string !== 'string') { throw new TypeError('Expected a string'); } // Escape characters with special meaning either inside or outside character sets. - // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. + // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. return string .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') .replace(/-/g, '\\x2d'); -}; - -var start$2 = factory$2('start'); -var end = factory$2('end'); - -var unistUtilPosition = position$1; - -position$1.start = start$2; -position$1.end = end; - -function position$1(node) { - return {start: start$2(node), end: end(node)} } -function factory$2(type) { - point.displayName = type; - - return point - - function point(node) { - var point = (node && node.position && node.position[type]) || {}; - - return { - line: point.line || null, - column: point.column || null, - offset: isNaN(point.offset) ? null : point.offset - } - } -} - -var wrapped = wrapped_1; - -var unifiedLintRule = factory$1; +/** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ -function factory$1(id, rule) { - var parts = id.split(':'); - var source = parts[0]; - var ruleId = parts[1]; - var fn = wrapped(rule); +const primitives$5 = new Set(['string', 'number', 'boolean']); - /* istanbul ignore if - possibly useful if externalised later. */ - if (!ruleId) { - ruleId = source; - source = null; - } +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$5(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; - attacher.displayName = id; + Object.defineProperty(plugin, 'name', {value: id}); - return attacher + return plugin - function attacher(raw) { - var config = coerce(ruleId, raw); - var severity = config[0]; - var options = config[1]; - var fatal = severity === 2; + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$5(ruleId, raw); - return severity ? transformer : undefined + if (!severity) return - function transformer(tree, file, next) { - var index = file.messages.length; + const fatal = severity === 2; - fn(tree, file, options, done); + return (tree, file, next) => { + let index = file.messages.length - 1; - function done(err) { - var messages = file.messages; - var message; + wrap(rule, (error) => { + const messages = file.messages; // Add the error, if not already properly added. - /* istanbul ignore if - only happens for incorrect plugins */ - if (err && messages.indexOf(err) === -1) { + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { try { - file.fail(err); - } catch (_) {} + file.fail(error); + } catch {} } - while (index < messages.length) { - message = messages[index]; - message.ruleId = ruleId; - message.source = source; - message.fatal = fatal; - - index++; + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); } next(); - } + })(tree, file, options); } } } -// Coerce a value to a severity--options tuple. -function coerce(name, value) { - var def = 1; - var result; - var level; +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$5(name, value) { + /** @type {unknown[]} */ + let result; - /* istanbul ignore if - Handled by unified in v6.0.0 */ if (typeof value === 'boolean') { result = [value]; - } else if (value == null) { - result = [def]; + } else if (value === null || value === undefined) { + result = [1]; } else if ( - typeof value === 'object' && - (typeof value[0] === 'number' || - typeof value[0] === 'boolean' || - typeof value[0] === 'string') + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$5.has(typeof value[0]) ) { - result = value.concat(); + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; } else { result = [1, value]; } - level = result[0]; + let level = result[0]; if (typeof level === 'boolean') { level = level ? 1 : 0; @@ -60690,7 +56380,7 @@ function coerce(name, value) { } } - if (level < 0 || level > 2) { + if (typeof level !== 'number' || level < 0 || level > 2) { throw new Error( 'Incorrect severity `' + level + @@ -60703,285 +56393,24 @@ function coerce(name, value) { result[0] = level; + // @ts-expect-error: it’s now a valid tuple. return result } -var convert_1 = convert$1; - -function convert$1(test) { - if (test == null) { - return ok - } - - if (typeof test === 'string') { - return typeFactory(test) - } - - if (typeof test === 'object') { - return 'length' in test ? anyFactory(test) : allFactory(test) - } - - if (typeof test === 'function') { - return test - } - - throw new Error('Expected function, string, or object as test') -} - -// Utility assert each property in `test` is represented in `node`, and each -// values are strictly equal. -function allFactory(test) { - return all - - function all(node) { - var key; - - for (key in test) { - if (node[key] !== test[key]) return false - } - - return true - } -} - -function anyFactory(tests) { - var checks = []; - var index = -1; - - while (++index < tests.length) { - checks[index] = convert$1(tests[index]); - } - - return any - - function any() { - var index = -1; - - while (++index < checks.length) { - if (checks[index].apply(this, arguments)) { - return true - } - } - - return false - } -} - -// Utility to convert a string into a function which checks a given node’s type -// for said string. -function typeFactory(test) { - return type - - function type(node) { - return Boolean(node && node.type === test) - } -} - -// Utility to return true. -function ok() { - return true -} - -var color_1 = color$1; -function color$1(d) { - return '\u001B[33m' + d + '\u001B[39m' -} - -var unistUtilVisitParents = visitParents$1; - -var convert = convert_1; -var color = color_1; - -var CONTINUE$1 = true; -var SKIP$1 = 'skip'; -var EXIT$1 = false; - -visitParents$1.CONTINUE = CONTINUE$1; -visitParents$1.SKIP = SKIP$1; -visitParents$1.EXIT = EXIT$1; - -function visitParents$1(tree, test, visitor, reverse) { - var step; - var is; - - if (typeof test === 'function' && typeof visitor !== 'function') { - reverse = visitor; - visitor = test; - test = null; - } - - is = convert(test); - step = reverse ? -1 : 1; - - factory(tree, null, [])(); - - function factory(node, index, parents) { - var value = typeof node === 'object' && node !== null ? node : {}; - var name; - - if (typeof value.type === 'string') { - name = - typeof value.tagName === 'string' - ? value.tagName - : typeof value.name === 'string' - ? value.name - : undefined; - - visit.displayName = - 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')'; - } - - return visit - - function visit() { - var grandparents = parents.concat(node); - var result = []; - var subresult; - var offset; - - if (!test || is(node, index, parents[parents.length - 1] || null)) { - result = toResult(visitor(node, parents)); - - if (result[0] === EXIT$1) { - return result - } - } - - if (node.children && result[0] !== SKIP$1) { - offset = (reverse ? node.children.length : -1) + step; - - while (offset > -1 && offset < node.children.length) { - subresult = factory(node.children[offset], offset, grandparents)(); - - if (subresult[0] === EXIT$1) { - return subresult - } - - offset = - typeof subresult[1] === 'number' ? subresult[1] : offset + step; - } - } - - return result - } - } -} - -function toResult(value) { - if (value !== null && typeof value === 'object' && 'length' in value) { - return value - } - - if (typeof value === 'number') { - return [CONTINUE$1, value] - } - - return [value] -} - -var unistUtilVisit = visit$1; - -var visitParents = unistUtilVisitParents; - -var CONTINUE = visitParents.CONTINUE; -var SKIP = visitParents.SKIP; -var EXIT = visitParents.EXIT; - -visit$1.CONTINUE = CONTINUE; -visit$1.SKIP = SKIP; -visit$1.EXIT = EXIT; - -function visit$1(tree, test, visitor, reverse) { - if (typeof test === 'function' && typeof visitor !== 'function') { - reverse = visitor; - visitor = test; - test = null; - } - - visitParents(tree, test, overload, reverse); - - function overload(node, parents) { - var parent = parents[parents.length - 1]; - var index = parent ? parent.children.indexOf(node) : null; - return visitor(node, index, parent) - } -} - -var vfileLocation$1 = factory; - -function factory(file) { - var value = String(file); - var indices = []; - var search = /\r?\n|\r/g; - - while (search.exec(value)) { - indices.push(search.lastIndex); - } - - indices.push(value.length + 1); - - return { - toPoint: offsetToPoint, - toPosition: offsetToPoint, - toOffset: pointToOffset - } - - // Get the line and column-based `point` for `offset` in the bound indices. - function offsetToPoint(offset) { - var index = -1; - - if (offset > -1 && offset < indices[indices.length - 1]) { - while (++index < indices.length) { - if (indices[index] > offset) { - return { - line: index + 1, - column: offset - (indices[index - 1] || 0) + 1, - offset: offset - } - } - } - } - - return {} - } - - // Get the `offset` for a line and column-based `point` in the bound - // indices. - function pointToOffset(point) { - var line = point && point.line; - var column = point && point.column; - var offset; - - if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { - offset = (indices[line - 2] || 0) + column - 1 || 0; - } - - return offset > -1 && offset < indices[indices.length - 1] ? offset : -1 - } -} - -const escapeStringRegexp$1 = escapeStringRegexp$2; -const position = unistUtilPosition; -const rule = unifiedLintRule; -const visit = unistUtilVisit; -const vfileLocation = vfileLocation$1; - -const start$1 = position.start; - -var remarkLintProhibitedStrings = rule('remark-lint:prohibited-strings', prohibitedStrings); +const remarkLintProhibitedStrings = lintRule$5('remark-lint:prohibited-strings', prohibitedStrings); function testProhibited (val, content) { let regexpFlags = 'g'; let no = val.no; if (!no) { - no = escapeStringRegexp$1(val.yes); + no = escapeStringRegexp(val.yes); regexpFlags += 'i'; } let regexpString = '(?<!\\.|@[a-zA-Z0-9/-]*)'; - const ignoreNextTo = val.ignoreNextTo ? escapeStringRegexp$1(val.ignoreNextTo) : ''; + const ignoreNextTo = val.ignoreNextTo ? escapeStringRegexp(val.ignoreNextTo) : ''; const replaceCaptureGroups = !!val.replaceCaptureGroups; // If it starts with a letter, make sure it is a word break. @@ -61022,13 +56451,13 @@ function testProhibited (val, content) { } function prohibitedStrings (ast, file, strings) { - const location = vfileLocation(file); + const myLocation = location(file); visit(ast, 'text', checkText); function checkText (node) { const content = node.value; - const initial = start$1(node).offset; + const initial = pointStart(node).offset; strings.forEach((val) => { const results = testProhibited(val, content); @@ -61036,8 +56465,8 @@ function prohibitedStrings (ast, file, strings) { results.forEach(({ result, index, yes }) => { const message = val.yes ? `Use "${yes}" instead of "${result}"` : `Do not use "${result}"`; file.message(message, { - start: location.toPoint(initial + index), - end: location.toPoint(initial + index + [...result].length) + start: myLocation.toPoint(initial + index), + end: myLocation.toPoint(initial + index + [...result].length) }); }); } @@ -61046,6 +56475,134 @@ function prohibitedStrings (ast, file, strings) { } /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$4 = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$4(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$4(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$4(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$4.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -61107,7 +56664,7 @@ function prohibitedStrings (ast, file, strings) { * 1:1: Incorrect preferred rule style: provide a correct markdown rule or `'consistent'` */ -const remarkLintRuleStyle = lintRule( +const remarkLintRuleStyle = lintRule$4( 'remark-lint:rule-style', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'consistent') => { @@ -61119,7 +56676,7 @@ const remarkLintRuleStyle = lintRule( ); } - visit$2(tree, 'thematicBreak', (node) => { + visit(tree, 'thematicBreak', (node) => { const initial = pointStart(node).offset; const final = pointEnd(node).offset; @@ -61139,6 +56696,134 @@ const remarkLintRuleStyle = lintRule( var remarkLintRuleStyle$1 = remarkLintRuleStyle; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$3 = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$3(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$3(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$3(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$3.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -61198,7 +56883,7 @@ var remarkLintRuleStyle$1 = remarkLintRuleStyle; * 1:1: Incorrect strong marker `💩`: use either `'consistent'`, `'*'`, or `'_'` */ -const remarkLintStrongMarker = lintRule( +const remarkLintStrongMarker = lintRule$3( 'remark-lint:strong-marker', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'consistent') => { @@ -61212,7 +56897,7 @@ const remarkLintStrongMarker = lintRule( ); } - visit$2(tree, 'strong', (node) => { + visit(tree, 'strong', (node) => { const start = pointStart(node).offset; if (typeof start === 'number') { @@ -61231,6 +56916,134 @@ const remarkLintStrongMarker = lintRule( var remarkLintStrongMarker$1 = remarkLintStrongMarker; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$2 = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$2(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$2(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$2(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$2.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -61402,7 +57215,7 @@ var remarkLintStrongMarker$1 = remarkLintStrongMarker; * | Echo | Foxtrot | */ -const remarkLintTableCellPadding = lintRule( +const remarkLintTableCellPadding = lintRule$2( 'remark-lint:table-cell-padding', /** @type {import('unified-lint-rule').Rule<Root, Options>} */ (tree, file, option = 'consistent') => { @@ -61418,7 +57231,7 @@ const remarkLintTableCellPadding = lintRule( ); } - visit$2(tree, 'table', (node) => { + visit(tree, 'table', (node) => { const rows = node.children; // To do: fix types to always have `align` defined. /* c8 ignore next */ @@ -61487,7 +57300,7 @@ const remarkLintTableCellPadding = lintRule( checkSide('end', entries[index], style, sizes); } - return SKIP$2 + return SKIP$1 }); /** @@ -61568,6 +57381,134 @@ function size(node) { } /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives$1 = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule$1(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce$1(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce$1(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives$1.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -61609,13 +57550,13 @@ function size(node) { const reasonStart = 'Missing initial pipe in table fence'; const reasonEnd = 'Missing final pipe in table fence'; -const remarkLintTablePipes = lintRule( +const remarkLintTablePipes = lintRule$1( 'remark-lint:table-pipes', /** @type {import('unified-lint-rule').Rule<Root, void>} */ (tree, file) => { const value = String(file); - visit$2(tree, 'table', (node) => { + visit(tree, 'table', (node) => { let index = -1; while (++index < node.children.length) { @@ -61644,6 +57585,134 @@ const remarkLintTablePipes = lintRule( var remarkLintTablePipes$1 = remarkLintTablePipes; /** + * @typedef {import('unist').Node} Node + * @typedef {import('vfile').VFile} VFile + * + * @typedef {0|1|2} Severity + * @typedef {'warn'|'on'|'off'|'error'} Label + * @typedef {[Severity, ...unknown[]]} SeverityTuple + * + * @callback Rule + * @param {Node} tree + * @param {VFile} file + * @param {unknown} options + * @returns {void} + */ + +const primitives = new Set(['string', 'number', 'boolean']); + +/** + * @param {string} id + * @param {Rule} rule + */ +function lintRule(id, rule) { + const parts = id.split(':'); + // Possibly useful if externalised later. + /* c8 ignore next */ + const source = parts[1] ? parts[0] : undefined; + const ruleId = parts[1]; + + Object.defineProperty(plugin, 'name', {value: id}); + + return plugin + + /** @type {import('unified').Plugin<[unknown]|void[]>} */ + function plugin(raw) { + const [severity, options] = coerce(ruleId, raw); + + if (!severity) return + + const fatal = severity === 2; + + return (tree, file, next) => { + let index = file.messages.length - 1; + + wrap(rule, (error) => { + const messages = file.messages; + + // Add the error, if not already properly added. + // Only happens for incorrect plugins. + /* c8 ignore next 6 */ + // @ts-expect-error: errors could be `messages`. + if (error && !messages.includes(error)) { + try { + file.fail(error); + } catch {} + } + + while (++index < messages.length) { + Object.assign(messages[index], {ruleId, source, fatal}); + } + + next(); + })(tree, file, options); + } + } +} + +/** + * Coerce a value to a severity--options tuple. + * + * @param {string} name + * @param {unknown} value + * @returns {SeverityTuple} + */ +function coerce(name, value) { + /** @type {unknown[]} */ + let result; + + if (typeof value === 'boolean') { + result = [value]; + } else if (value === null || value === undefined) { + result = [1]; + } else if ( + Array.isArray(value) && + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + primitives.has(typeof value[0]) + ) { + // `isArray(unknown)` is turned into `any[]`: + // type-coverage:ignore-next-line + result = [...value]; + } else { + result = [1, value]; + } + + let level = result[0]; + + if (typeof level === 'boolean') { + level = level ? 1 : 0; + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0; + } else if (level === 'on' || level === 'warn') { + level = 1; + } else if (level === 'error') { + level = 2; + } else { + level = 1; + result = [level, result]; + } + } + + if (typeof level !== 'number' || level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level; + + // @ts-expect-error: it’s now a valid tuple. + return result +} + +/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT @@ -61734,7 +57803,7 @@ const remarkLintUnorderedListMarkerStyle = lintRule( ); } - visit$2(tree, 'list', (node) => { + visit(tree, 'list', (node) => { if (node.ordered) return let index = -1; @@ -61766,10 +57835,10 @@ const remarkLintUnorderedListMarkerStyle = lintRule( var remarkLintUnorderedListMarkerStyle$1 = remarkLintUnorderedListMarkerStyle; -// @see https://github.com/nodejs/node/blob/master/doc/guides/doc-style-guide.md +// @see https://github.com/nodejs/node/blob/HEAD/doc/guides/doc-style-guide.md // Add in rules alphabetically -const remarkPresetLintNode = [ +const plugins = [ // Leave preset at the top so it can be overridden remarkPresetLintRecommended$1, [remarkLintBlockquoteIndentation$1, 2], @@ -61844,343 +57913,7 @@ const remarkPresetLintNode = [ [remarkLintUnorderedListMarkerStyle$1, "*"], ]; -var remarkPresetLintNode$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - 'default': remarkPresetLintNode -}); - -var require$$5 = /*@__PURE__*/getAugmentedNamespace(remarkPresetLintNode$1); - -/** - * Like `Array#splice`, but smarter for giant arrays. - * - * `Array#splice` takes all items to be inserted as individual argument which - * causes a stack overflow in V8 when trying to insert 100k items for instance. - * - * Otherwise, this does not return the removed items, and takes `items` as an - * array instead of rest parameters. - * - * @template {unknown} T - * @param {T[]} list - * @param {number} start - * @param {number} remove - * @param {T[]} items - * @returns {void} - */ -function splice(list, start, remove, items) { - const end = list.length; - let chunkStart = 0; - /** @type {unknown[]} */ - - let parameters; // Make start between zero and `end` (included). - - if (start < 0) { - start = -start > end ? 0 : end + start; - } else { - start = start > end ? end : start; - } - - remove = remove > 0 ? remove : 0; // No need to chunk the items if there’s only a couple (10k) items. - - if (items.length < 10000) { - parameters = Array.from(items); - parameters.unshift(start, remove) // @ts-expect-error Hush, it’s fine. - ;[].splice.apply(list, parameters); - } else { - // Delete `remove` items starting from `start` - if (remove) [].splice.apply(list, [start, remove]); // Insert the items in chunks to not cause stack overflows. - - while (chunkStart < items.length) { - parameters = items.slice(chunkStart, chunkStart + 10000); - parameters.unshift(start, 0) // @ts-expect-error Hush, it’s fine. - ;[].splice.apply(list, parameters); - chunkStart += 10000; - start += 10000; - } - } -} - -/** - * @typedef {import('micromark-util-types').NormalizedExtension} NormalizedExtension - * @typedef {import('micromark-util-types').Extension} Extension - * @typedef {import('micromark-util-types').Construct} Construct - * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension - */ - -const hasOwnProperty = {}.hasOwnProperty; - -/** - * Combine several syntax extensions into one. - * - * @param {Extension[]} extensions List of syntax extensions. - * @returns {NormalizedExtension} A single combined extension. - */ -function combineExtensions(extensions) { - /** @type {NormalizedExtension} */ - const all = {}; - let index = -1; - - while (++index < extensions.length) { - syntaxExtension(all, extensions[index]); - } - - return all -} - -/** - * Merge `extension` into `all`. - * - * @param {NormalizedExtension} all Extension to merge into. - * @param {Extension} extension Extension to merge. - * @returns {void} - */ -function syntaxExtension(all, extension) { - /** @type {string} */ - let hook; - - for (hook in extension) { - const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined; - const left = maybe || (all[hook] = {}); - const right = extension[hook]; - /** @type {string} */ - let code; - - for (code in right) { - if (!hasOwnProperty.call(left, code)) left[code] = []; - const value = right[code]; - constructs( - // @ts-expect-error Looks like a list. - left[code], - Array.isArray(value) ? value : value ? [value] : [] - ); - } - } -} - -/** - * Merge `list` into `existing` (both lists of constructs). - * Mutates `existing`. - * - * @param {unknown[]} existing - * @param {unknown[]} list - * @returns {void} - */ -function constructs(existing, list) { - let index = -1; - /** @type {unknown[]} */ - const before = []; - - while (++index < list.length) { -(list[index].add === 'after' ? existing : before).push(list[index]); - } - - splice(existing, 0, 0, before); -} - -/** - * Combine several HTML extensions into one. - * - * @param {HtmlExtension[]} htmlExtensions List of HTML extensions. - * @returns {HtmlExtension} A single combined extension. - */ -function combineHtmlExtensions(htmlExtensions) { - /** @type {HtmlExtension} */ - const handlers = {}; - let index = -1; - - while (++index < htmlExtensions.length) { - htmlExtension(handlers, htmlExtensions[index]); - } - - return handlers -} - -/** - * Merge `extension` into `all`. - * - * @param {HtmlExtension} all Extension to merge into. - * @param {HtmlExtension} extension Extension to merge. - * @returns {void} - */ -function htmlExtension(all, extension) { - /** @type {string} */ - let hook; - - for (hook in extension) { - const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined; - const left = maybe || (all[hook] = {}); - const right = extension[hook]; - /** @type {string} */ - let type; - - if (right) { - for (type in right) { - left[type] = right[type]; - } - } - } -} - -// This module is generated by `script/`. -// -// CommonMark handles attention (emphasis, strong) markers based on what comes -// before or after them. -// One such difference is if those characters are Unicode punctuation. -// This script is generated from the Unicode data. -const unicodePunctuationRegex = - /[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; - -/** - * @typedef {import('micromark-util-types').Code} Code - */ -/** - * Check whether the character code represents an ASCII alpha (`a` through `z`, - * case insensitive). - * - * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. - * - * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) - * to U+005A (`Z`). - * - * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) - * to U+007A (`z`). - */ - -const asciiAlpha = regexCheck(/[A-Za-z]/); -/** - * Check whether the character code represents an ASCII digit (`0` through `9`). - * - * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to - * U+0039 (`9`). - */ - -const asciiDigit = regexCheck(/\d/); -/** - * Check whether the character code represents an ASCII alphanumeric (`a` - * through `z`, case insensitive, or `0` through `9`). - * - * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha - * (see `asciiAlpha`). - */ - -const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); -/** - * Check whether a character code is an ASCII control character. - * - * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) - * to U+001F (US), or U+007F (DEL). - * - * @param {Code} code - * @returns {code is number} - */ - -function asciiControl(code) { - return ( - // Special whitespace codes (which have negative values), C0 and Control - // character DEL - code !== null && (code < 32 || code === 127) - ) -} -/** - * Check whether a character code is a markdown line ending (see - * `markdownLineEnding`) or markdown space (see `markdownSpace`). - * - * @param {Code} code - * @returns {code is number} - */ - -function markdownLineEndingOrSpace(code) { - return code !== null && (code < 0 || code === 32) -} -/** - * Check whether a character code is a markdown line ending. - * - * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN - * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). - * - * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE - * RETURN (CR) are replaced by these virtual characters depending on whether - * they occurred together. - * - * @param {Code} code - * @returns {code is number} - */ - -function markdownLineEnding(code) { - return code !== null && code < -2 -} -/** - * Check whether a character code is a markdown space. - * - * A **markdown space** is the concrete character U+0020 SPACE (SP) and the - * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). - * - * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is - * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL - * SPACE (VS) characters, depending on the column at which the tab occurred. - * - * @param {Code} code - * @returns {code is number} - */ - -function markdownSpace(code) { - return code === -2 || code === -1 || code === 32 -} -/** - * Check whether the character code represents Unicode whitespace. - * - * Note that this does handle micromark specific markdown whitespace characters. - * See `markdownLineEndingOrSpace` to check that. - * - * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, - * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), - * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). - * - * See: - * **\[UNICODE]**: - * [The Unicode Standard](https://www.unicode.org/versions/). - * Unicode Consortium. - */ - -const unicodeWhitespace = regexCheck(/\s/); -/** - * Check whether the character code represents Unicode punctuation. - * - * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, - * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` - * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` - * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII - * punctuation (see `asciiPunctuation`). - * - * See: - * **\[UNICODE]**: - * [The Unicode Standard](https://www.unicode.org/versions/). - * Unicode Consortium. - */ -// Size note: removing ASCII from the regex and using `asciiPunctuation` here -// In fact adds to the bundle size. - -const unicodePunctuation = regexCheck(unicodePunctuationRegex); -/** - * Create a code check from a regex. - * - * @param {RegExp} regex - * @returns {(code: Code) => code is number} - */ - -function regexCheck(regex) { - return check - /** - * Check whether a code matches the bound regex. - * - * @param {Code} code Character code - * @returns {code is number} Whether the character code matches the bound regex - */ - - function check(code) { - return code !== null && regex.test(String.fromCharCode(code)) - } -} +const remarkPresetLintNode = { plugins }; /** * @typedef {import('micromark-util-types').Extension} Extension @@ -63007,67 +58740,6 @@ const gfmStrikethroughHtml = { }; /** - * @typedef {import('micromark-util-types').Code} Code - */ - -/** - * Classify whether a character code represents whitespace, punctuation, or - * something else. - * - * Used for attention (emphasis, strong), whose sequences can open or close - * based on the class of surrounding characters. - * - * Note that eof (`null`) is seen as whitespace. - * - * @param {Code} code - * @returns {number|undefined} - */ -function classifyCharacter(code) { - if ( - code === null || - markdownLineEndingOrSpace(code) || - unicodeWhitespace(code) - ) { - return 1 - } - - if (unicodePunctuation(code)) { - return 2 - } -} - -/** - * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext - * @typedef {import('micromark-util-types').Event} Event - * @typedef {import('micromark-util-types').Resolver} Resolver - */ - -/** - * Call all `resolveAll`s. - * - * @param {{resolveAll?: Resolver}[]} constructs - * @param {Event[]} events - * @param {TokenizeContext} context - * @returns {Event[]} - */ -function resolveAll(constructs, events, context) { - /** @type {Resolver[]} */ - const called = []; - let index = -1; - - while (++index < constructs.length) { - const resolve = constructs[index].resolveAll; - - if (resolve && !called.includes(resolve)) { - events = resolve(events, context); - called.push(resolve); - } - } - - return events -} - -/** * @typedef {import('micromark-util-types').Extension} Extension * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Tokenizer} Tokenizer @@ -63388,45 +59060,6 @@ function replace$1($0, $1) { } /** - * @typedef {import('micromark-util-types').Effects} Effects - * @typedef {import('micromark-util-types').State} State - */ -/** - * @param {Effects} effects - * @param {State} ok - * @param {string} type - * @param {number} [max=Infinity] - * @returns {State} - */ - -function factorySpace(effects, ok, type, max) { - const limit = max ? max - 1 : Number.POSITIVE_INFINITY; - let size = 0; - return start - /** @type {State} */ - - function start(code) { - if (markdownSpace(code)) { - effects.enter(type); - return prefix(code) - } - - return ok(code) - } - /** @type {State} */ - - function prefix(code) { - if (markdownSpace(code) && size++ < limit) { - effects.consume(code); - return prefix - } - - effects.exit(type); - return ok(code) - } -} - -/** * @typedef {import('micromark-util-types').Extension} Extension * @typedef {import('micromark-util-types').Resolver} Resolver * @typedef {import('micromark-util-types').Tokenizer} Tokenizer @@ -64233,7 +59866,7 @@ function spaceThenNonSpace(effects, ok, nok) { * @param {Options} [options] * @returns {Extension} */ -function gfm$1(options) { +function gfm(options) { return combineExtensions([ gfmAutolinkLiteral, gfmStrikethrough(options), @@ -64277,16 +59910,149 @@ function ccount(value, character) { return count } -function escapeStringRegexp(string) { - if (typeof string !== 'string') { - throw new TypeError('Expected a string'); - } +/** + * @param {string} d + * @returns {string} + */ +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} - // Escape characters with special meaning either inside or outside character sets. - // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. - return string - .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') - .replace(/-/g, '\\x2d'); +/** + * @typedef {import('unist').Node} Node + * @typedef {import('unist').Parent} Parent + * @typedef {import('unist-util-is').Test} Test + */ + +/** + * Continue traversing as normal + */ +const CONTINUE = true; +/** + * Do not traverse this node’s children + */ +const SKIP = 'skip'; +/** + * Stop traversing immediately + */ +const EXIT = false; + +const visitParents = + /** + * @type {( + * (<T extends Node>(tree: Node, test: T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>>, visitor: Visitor<T>, reverse?: boolean) => void) & + * ((tree: Node, test: Test, visitor: Visitor<Node>, reverse?: boolean) => void) & + * ((tree: Node, visitor: Visitor<Node>, reverse?: boolean) => void) + * )} + */ + ( + /** + * Visit children of tree which pass a test + * + * @param {Node} tree Abstract syntax tree to walk + * @param {Test} test test Test node + * @param {Visitor<Node>} visitor Function to run for each node + * @param {boolean} [reverse] Fisit the tree in reverse, defaults to false + */ + function (tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor; + // @ts-ignore no visitor given, so `visitor` is test. + visitor = test; + test = null; + } + + var is = convert(test); + var step = reverse ? -1 : 1; + + factory(tree, null, [])(); + + /** + * @param {Node} node + * @param {number?} index + * @param {Array.<Parent>} parents + */ + function factory(node, index, parents) { + /** @type {Object.<string, unknown>} */ + var value = typeof node === 'object' && node !== null ? node : {}; + /** @type {string} */ + var name; + + if (typeof value.type === 'string') { + name = + typeof value.tagName === 'string' + ? value.tagName + : typeof value.name === 'string' + ? value.name + : undefined; + + Object.defineProperty(visit, 'name', { + value: + 'node (' + + color(value.type + (name ? '<' + name + '>' : '')) + + ')' + }); + } + + return visit + + function visit() { + /** @type {ActionTuple} */ + var result = []; + /** @type {ActionTuple} */ + var subresult; + /** @type {number} */ + var offset; + /** @type {Array.<Parent>} */ + var grandparents; + + if (!test || is(node, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(node, parents)); + + if (result[0] === EXIT) { + return result + } + } + + if (node.children && result[0] !== SKIP) { + // @ts-ignore looks like a parent. + offset = (reverse ? node.children.length : -1) + step; + // @ts-ignore looks like a parent. + grandparents = parents.concat(node); + + // @ts-ignore looks like a parent. + while (offset > -1 && offset < node.children.length) { + subresult = factory(node.children[offset], offset, grandparents)(); + + if (subresult[0] === EXIT) { + return subresult + } + + offset = + typeof subresult[1] === 'number' ? subresult[1] : offset + step; + } + } + + return result + } + } + } + ); + +/** + * @param {VisitorResult} value + * @returns {ActionTuple} + */ +function toResult(value) { + if (Array.isArray(value)) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] } /** @@ -64364,12 +60130,12 @@ const findAndReplace = settings = {}; } - const ignored = convert$2(settings.ignore || []); + const ignored = convert(settings.ignore || []); const pairs = toPairs(schema); let pairIndex = -1; while (++pairIndex < pairs.length) { - visitParents$3(tree, 'text', visitor); + visitParents(tree, 'text', visitor); } return tree @@ -64526,7 +60292,6 @@ function toFunction(replace) { } /** - * @typedef {import('mdast').Link} Link * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension * @typedef {import('mdast-util-from-markdown').Transform} FromMarkdownTransform * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle @@ -64579,6 +60344,7 @@ const gfmAutolinkLiteralToMarkdown = { /** @type {FromMarkdownHandle} */ function enterLiteralAutolink(token) { + // @ts-expect-error: `null` is fine. this.enter({type: 'link', title: null, url: '', children: []}, token); } @@ -64595,8 +60361,7 @@ function exitLiteralAutolinkHttp(token) { /** @type {FromMarkdownHandle} */ function exitLiteralAutolinkWww(token) { this.config.exit.data.call(this, token); - const node = /** @type {Link} */ (this.stack[this.stack.length - 1]); - node.url = 'http://' + this.sliceSerialize(token); + this.stack[this.stack.length - 1].url = 'http://' + this.sliceSerialize(token); } /** @type {FromMarkdownHandle} */ @@ -64614,8 +60379,8 @@ function transformGfmAutolinkLiterals(tree) { findAndReplace( tree, [ - [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl], - [/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g, findEmail] + [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/i, findUrl], + [/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/, findEmail] ], {ignore: ['link', 'linkReference']} ); @@ -64654,6 +60419,7 @@ function findUrl(_, protocol, domain, path, match) { if (!parts[0]) return false /** @type {PhrasingContent} */ + // @ts-expect-error: `null` is fine. const result = { type: 'link', title: null, @@ -64683,6 +60449,7 @@ function findEmail(_, atext, label, match) { return { type: 'link', + // @ts-expect-error: `null` is fine. title: null, url: 'mailto:' + atext + '@' + label, children: [{type: 'text', value: atext + '@' + label}] @@ -64761,71 +60528,6 @@ function previous(match, email) { } /** - * @typedef {import('../types.js').Node} Node - * @typedef {import('../types.js').Parent} Parent - * @typedef {import('../types.js').SafeOptions} SafeOptions - * @typedef {import('../types.js').Context} Context - */ - -/** - * @param {Parent} parent - * @param {Context} context - * @param {SafeOptions} safeOptions - * @returns {string} - */ -function containerPhrasing(parent, context, safeOptions) { - const children = parent.children || []; - /** @type {Array.<string>} */ - const results = []; - let index = -1; - let before = safeOptions.before; - - while (++index < children.length) { - const child = children[index]; - /** @type {string} */ - let after; - - if (index + 1 < children.length) { - // @ts-expect-error: hush, it’s actually a `zwitch`. - let handle = context.handle.handlers[children[index + 1].type]; - if (handle && handle.peek) handle = handle.peek; - after = handle - ? handle(children[index + 1], parent, context, { - before: '', - after: '' - }).charAt(0) - : ''; - } else { - after = safeOptions.after; - } - - // In some cases, html (text) can be found in phrasing right after an eol. - // When we’d serialize that, in most cases that would be seen as html - // (flow). - // As we can’t escape or so to prevent it from happening, we take a somewhat - // reasonable approach: replace that eol with a space. - // See: <https://github.com/syntax-tree/mdast-util-to-markdown/issues/15> - if ( - results.length > 0 && - (before === '\r' || before === '\n') && - child.type === 'html' - ) { - results[results.length - 1] = results[results.length - 1].replace( - /(\r?\n|\r)$/, - ' ' - ); - before = ' '; - } - - results.push(context.handle(child, parent, context, {before, after})); - - before = results[results.length - 1].slice(-1); - } - - return results.join('') -} - -/** * @typedef {import('mdast').Delete} Delete * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle @@ -64875,107 +60577,6 @@ function peekDelete() { } /** - * @typedef {import('../types.js').Unsafe} Unsafe - */ - -/** - * @param {Unsafe} pattern - * @returns {RegExp} - */ -function patternCompile(pattern) { - if (!pattern._compiled) { - const before = - (pattern.atBreak ? '[\\r\\n][\\t ]*' : '') + - (pattern.before ? '(?:' + pattern.before + ')' : ''); - - pattern._compiled = new RegExp( - (before ? '(' + before + ')' : '') + - (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') + - pattern.character + - (pattern.after ? '(?:' + pattern.after + ')' : ''), - 'g' - ); - } - - return pattern._compiled -} - -/** - * @typedef {import('mdast').InlineCode} InlineCode - * @typedef {import('../types.js').Handle} Handle - */ - -inlineCode.peek = inlineCodePeek; - -/** - * @type {Handle} - * @param {InlineCode} node - */ -function inlineCode(node, _, context) { - let value = node.value || ''; - let sequence = '`'; - let index = -1; - - // If there is a single grave accent on its own in the code, use a fence of - // two. - // If there are two in a row, use one. - while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) { - sequence += '`'; - } - - // If this is not just spaces or eols (tabs don’t count), and either the - // first or last character are a space, eol, or tick, then pad with spaces. - if ( - /[^ \r\n]/.test(value) && - ((/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value)) || /^`|`$/.test(value)) - ) { - value = ' ' + value + ' '; - } - - // We have a potential problem: certain characters after eols could result in - // blocks being seen. - // For example, if someone injected the string `'\n# b'`, then that would - // result in an ATX heading. - // We can’t escape characters in `inlineCode`, but because eols are - // transformed to spaces when going from markdown to HTML anyway, we can swap - // them out. - while (++index < context.unsafe.length) { - const pattern = context.unsafe[index]; - const expression = patternCompile(pattern); - /** @type {RegExpExecArray|null} */ - let match; - - // Only look for `atBreak`s. - // Btw: note that `atBreak` patterns will always start the regex at LF or - // CR. - if (!pattern.atBreak) continue - - while ((match = expression.exec(value))) { - let position = match.index; - - // Support CRLF (patterns only look for one of the characters). - if ( - value.charCodeAt(position) === 10 /* `\n` */ && - value.charCodeAt(position - 1) === 13 /* `\r` */ - ) { - position--; - } - - value = value.slice(0, position) + ' ' + value.slice(match.index + 1); - } - } - - return sequence + value + sequence -} - -/** - * @type {Handle} - */ -function inlineCodePeek() { - return '`' -} - -/** * @typedef MarkdownTableOptions * @property {string|null|Array.<string|null|undefined>} [align] * @property {boolean} [padding=true] @@ -65471,216 +61072,6 @@ function gfmTableToMarkdown(options) { } /** - * @typedef {import('../types.js').Context} Context - * @typedef {import('../types.js').Options} Options - */ - -/** - * @param {Context} context - * @returns {Exclude<Options['bullet'], undefined>} - */ -function checkBullet(context) { - const marker = context.options.bullet || '*'; - - if (marker !== '*' && marker !== '+' && marker !== '-') { - throw new Error( - 'Cannot serialize items with `' + - marker + - '` for `options.bullet`, expected `*`, `+`, or `-`' - ) - } - - return marker -} - -/** - * @typedef {import('../types.js').Context} Context - * @typedef {import('../types.js').Options} Options - */ - -/** - * @param {Context} context - * @returns {Exclude<Options['listItemIndent'], undefined>} - */ -function checkListItemIndent(context) { - const style = context.options.listItemIndent || 'tab'; - - // To do: remove in a major. - // @ts-expect-error: deprecated. - if (style === 1 || style === '1') { - return 'one' - } - - if (style !== 'tab' && style !== 'one' && style !== 'mixed') { - throw new Error( - 'Cannot serialize items with `' + - style + - '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`' - ) - } - - return style -} - -/** - * @typedef {import('../types.js').Node} Node - * @typedef {import('../types.js').Parent} Parent - * @typedef {import('../types.js').Join} Join - * @typedef {import('../types.js').Context} Context - */ - -/** - * @param {Parent} parent - * @param {Context} context - * @returns {string} - */ -function containerFlow(parent, context) { - const children = parent.children || []; - /** @type {Array.<string>} */ - const results = []; - let index = -1; - - while (++index < children.length) { - const child = children[index]; - - results.push( - context.handle(child, parent, context, {before: '\n', after: '\n'}) - ); - - if (index < children.length - 1) { - results.push(between(child, children[index + 1])); - } - } - - return results.join('') - - /** - * @param {Node} left - * @param {Node} right - * @returns {string} - */ - function between(left, right) { - let index = context.join.length; - /** @type {ReturnType<Join>} */ - let result; - - while (index--) { - result = context.join[index](left, right, parent, context); - - if (result === true || result === 1) { - break - } - - if (typeof result === 'number') { - return '\n'.repeat(1 + result) - } - - if (result === false) { - return '\n\n<!---->\n\n' - } - } - - return '\n\n' - } -} - -/** - * @callback Map - * @param {string} value - * @param {number} line - * @param {boolean} blank - * @returns {string} - */ - -const eol = /\r?\n|\r/g; - -/** - * @param {string} value - * @param {Map} map - * @returns {string} - */ -function indentLines(value, map) { - /** @type {Array.<string>} */ - const result = []; - let start = 0; - let line = 0; - /** @type {RegExpExecArray|null} */ - let match; - - while ((match = eol.exec(value))) { - one(value.slice(start, match.index)); - result.push(match[0]); - start = match.index + match[0].length; - line++; - } - - one(value.slice(start)); - - return result.join('') - - /** - * @param {string} value - */ - function one(value) { - result.push(map(value, line, !value)); - } -} - -/** - * @typedef {import('mdast').ListItem} ListItem - * @typedef {import('mdast').List} List - * @typedef {import('../util/indent-lines.js').Map} Map - * @typedef {import('../types.js').Options} Options - * @typedef {import('../types.js').Handle} Handle - */ - -/** - * @type {Handle} - * @param {ListItem} node - */ -function listItem(node, parent, context) { - const listItemIndent = checkListItemIndent(context); - /** @type {string} */ - let bullet = checkBullet(context); - - if (parent && parent.type === 'list' && parent.ordered) { - bullet = - (typeof parent.start === 'number' && parent.start > -1 - ? parent.start - : 1) + - (context.options.incrementListMarker === false - ? 0 - : parent.children.indexOf(node)) + - '.'; - } - - let size = bullet.length + 1; - - if ( - listItemIndent === 'tab' || - (listItemIndent === 'mixed' && - ((parent && 'spread' in parent && parent.spread) || node.spread)) - ) { - size = Math.ceil(size / 4) * 4; - } - - const exit = context.enter('listItem'); - const value = indentLines(containerFlow(node, context), map); - exit(); - - return value - - /** @type {Map} */ - function map(line, index, blank) { - if (index) { - return (blank ? '' : ' '.repeat(size)) + line - } - - return (blank ? bullet : bullet + ' '.repeat(size - bullet.length)) + line - } -} - -/** * @typedef {import('mdast').ListItem} ListItem * @typedef {import('mdast').Paragraph} Paragraph * @typedef {import('mdast').BlockContent} BlockContent @@ -65829,7 +61220,7 @@ function gfmToMarkdown(options) { function remarkGfm(options = {}) { const data = this.data(); - add('micromarkExtensions', gfm$1(options)); + add('micromarkExtensions', gfm(options)); add('fromMarkdownExtensions', gfmFromMarkdown); add('toMarkdownExtensions', gfmToMarkdown(options)); @@ -65848,26 +61239,10 @@ function remarkGfm(options = {}) { } } -var remarkGfm$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - 'default': remarkGfm -}); - -var require$$6 = /*@__PURE__*/getAugmentedNamespace(remarkGfm$1); - // To aid in future maintenance, this layout closely matches remark-cli/cli.js. -// https://github.com/remarkjs/remark/blob/master/packages/remark-cli/cli.js - -const start = unifiedArgs; -const extensions = markdownExtensions; -const processor = remark; -const proc = require$$3; -const cli = require$$4; -const lintNode = require$$5; -const gfm = require$$6; - -start({ - processor: processor().use(gfm).use(lintNode), + +args({ + processor: remark().use(remarkGfm).use(remarkPresetLintNode), name: proc.name, description: cli.description, version: [ @@ -65879,8 +61254,6 @@ start({ packageField: proc.name + 'Config', rcName: '.' + proc.name + 'rc', ignoreName: '.' + proc.name + 'ignore', - extensions: extensions, + extensions: markdownExtensions, detectConfig: false, }); - -module.exports = cliEntry; diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index baf5c94d62..3cfe12696f 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -579,11 +579,11 @@ } }, "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -740,19 +740,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/hast-util-from-parse5/node_modules/vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "dependencies": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/hast-util-is-element": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-2.1.1.tgz", @@ -799,15 +786,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/hast-util-to-html/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/hast-util-whitespace": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.0.tgz", @@ -1184,26 +1162,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mdast-util-find-and-replace/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/mdast-util-find-and-replace/node_modules/unist-util-visit-parents": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-4.1.1.tgz", @@ -2133,51 +2091,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-checkbox-character-style": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-4.0.0.tgz", @@ -2209,51 +2122,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-checkbox-content-indent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-checkbox-content-indent/-/remark-lint-checkbox-content-indent-4.0.0.tgz", @@ -2286,64 +2154,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-checkbox-content-indent/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-checkbox-content-indent/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-checkbox-content-indent/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-checkbox-content-indent/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-checkbox-content-indent/node_modules/vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "dependencies": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-code-block-style": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-3.0.0.tgz", @@ -2376,51 +2186,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-code-block-style/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-code-block-style/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-code-block-style/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-definition-spacing": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-definition-spacing/-/remark-lint-definition-spacing-3.0.0.tgz", @@ -2452,51 +2217,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-definition-spacing/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-definition-spacing/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-definition-spacing/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-definition-spacing/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-fenced-code-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-flag/-/remark-lint-fenced-code-flag-3.0.0.tgz", @@ -2529,51 +2249,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-fenced-code-flag/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-fenced-code-flag/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-fenced-code-flag/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-fenced-code-flag/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-fenced-code-marker": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-3.0.0.tgz", @@ -2605,51 +2280,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-file-extension": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/remark-lint-file-extension/-/remark-lint-file-extension-2.0.0.tgz", @@ -2711,51 +2341,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-final-definition/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-final-definition/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-final-definition/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-final-definition/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/remark-lint-final-newline/-/remark-lint-final-newline-2.0.0.tgz", @@ -2816,42 +2401,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-first-heading-level/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-first-heading-level/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-first-heading-level/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-hard-break-spaces": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-hard-break-spaces/-/remark-lint-hard-break-spaces-3.0.0.tgz", @@ -2884,51 +2433,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-hard-break-spaces/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-hard-break-spaces/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-hard-break-spaces/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-hard-break-spaces/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-heading-style": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-3.0.0.tgz", @@ -2961,42 +2465,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-heading-style/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-heading-style/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-list-item-bullet-indent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-list-item-bullet-indent/-/remark-lint-list-item-bullet-indent-4.0.0.tgz", @@ -3028,42 +2496,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-list-item-bullet-indent/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-list-item-bullet-indent/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-list-item-bullet-indent/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-list-item-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-list-item-indent/-/remark-lint-list-item-indent-3.0.0.tgz", @@ -3097,51 +2529,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-list-item-indent/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-list-item-indent/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-list-item-indent/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-list-item-indent/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-maximum-line-length": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-maximum-line-length/-/remark-lint-maximum-line-length-3.0.0.tgz", @@ -3174,51 +2561,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-maximum-line-length/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-maximum-line-length/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-maximum-line-length/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-maximum-line-length/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-auto-link-without-protocol": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-auto-link-without-protocol/-/remark-lint-no-auto-link-without-protocol-3.0.0.tgz", @@ -3252,51 +2594,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-auto-link-without-protocol/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-auto-link-without-protocol/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-auto-link-without-protocol/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-auto-link-without-protocol/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-blockquote-without-marker": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-marker/-/remark-lint-no-blockquote-without-marker-5.0.0.tgz", @@ -3330,64 +2627,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-blockquote-without-marker/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-blockquote-without-marker/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-blockquote-without-marker/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-blockquote-without-marker/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-blockquote-without-marker/node_modules/vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "dependencies": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-consecutive-blank-lines": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-consecutive-blank-lines/-/remark-lint-no-consecutive-blank-lines-4.0.0.tgz", @@ -3422,51 +2661,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-consecutive-blank-lines/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-consecutive-blank-lines/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-consecutive-blank-lines/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-consecutive-blank-lines/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-duplicate-definitions": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-definitions/-/remark-lint-no-duplicate-definitions-3.0.0.tgz", @@ -3500,51 +2694,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-file-name-articles": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-articles/-/remark-lint-no-file-name-articles-2.0.0.tgz", @@ -3666,51 +2815,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-heading-content-indent/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-heading-content-indent/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-heading-content-indent/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-heading-content-indent/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-heading-indent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-heading-indent/-/remark-lint-no-heading-indent-4.0.0.tgz", @@ -3744,51 +2848,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-heading-indent/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-heading-indent/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-heading-indent/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-heading-indent/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-inline-padding": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-inline-padding/-/remark-lint-no-inline-padding-4.0.0.tgz", @@ -3821,42 +2880,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-inline-padding/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-inline-padding/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-inline-padding/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-literal-urls": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-literal-urls/-/remark-lint-no-literal-urls-3.0.0.tgz", @@ -3890,51 +2913,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-literal-urls/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-literal-urls/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-literal-urls/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-literal-urls/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-multiple-toplevel-headings": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-3.0.0.tgz", @@ -3968,51 +2946,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-shell-dollars": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-shell-dollars/-/remark-lint-no-shell-dollars-3.0.0.tgz", @@ -4044,42 +2977,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-shell-dollars/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-shell-dollars/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-shell-dollars/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-shortcut-reference-image": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-image/-/remark-lint-no-shortcut-reference-image-3.0.0.tgz", @@ -4111,42 +3008,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-shortcut-reference-image/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-shortcut-reference-image/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-shortcut-reference-image/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-shortcut-reference-link": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-link/-/remark-lint-no-shortcut-reference-link-3.0.0.tgz", @@ -4178,42 +3039,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-shortcut-reference-link/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-shortcut-reference-link/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-shortcut-reference-link/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-table-indentation": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-table-indentation/-/remark-lint-no-table-indentation-4.0.0.tgz", @@ -4246,64 +3071,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-table-indentation/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-table-indentation/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-table-indentation/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-table-indentation/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-table-indentation/node_modules/vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "dependencies": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-tabs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-tabs/-/remark-lint-no-tabs-3.0.0.tgz", @@ -4334,19 +3101,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-tabs/node_modules/vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "dependencies": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-trailing-spaces": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/remark-lint-no-trailing-spaces/-/remark-lint-no-trailing-spaces-2.0.1.tgz", @@ -4389,64 +3143,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-undefined-references/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-undefined-references/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-undefined-references/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-undefined-references/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-undefined-references/node_modules/vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "dependencies": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-no-unused-definitions": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-unused-definitions/-/remark-lint-no-unused-definitions-3.0.0.tgz", @@ -4478,42 +3174,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-no-unused-definitions/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-unused-definitions/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-no-unused-definitions/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-ordered-list-marker-style": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-style/-/remark-lint-ordered-list-marker-style-3.0.0.tgz", @@ -4546,63 +3206,33 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", + "node_modules/remark-lint-prohibited-strings": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remark-lint-prohibited-strings/-/remark-lint-prohibited-strings-3.0.0.tgz", + "integrity": "sha512-Aw21KVeoOiDte6dNfeTfTgjKV19yWXpPjLxfJ3ShC22/r97gkGdOo4dnuwyEEAfKhr3uimtSf3rRQyGSudY5tQ==", "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" + "escape-string-regexp": "^5.0.0", + "unified-lint-rule": "^2.0.0", + "unist-util-position": "^4.0.1", + "unist-util-visit": "^4.0.0", + "vfile-location": "^4.0.1" } }, - "node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", + "node_modules/remark-lint-prohibited-strings/node_modules/unified-lint-rule": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unified-lint-rule/-/unified-lint-rule-2.0.1.tgz", + "integrity": "sha512-2RzZuuuWW+ifftM0zd/ZEng0Hb5lah+Zi+ZL/ybj8BrLO/TH2aQAMYvG+iC95aCg2FkWu/pcvVvHqsh2UMmzPg==", "dependencies": { "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" + "trough": "^2.0.0", + "unified": "^10.0.0", + "vfile": "^5.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-prohibited-strings": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-prohibited-strings/-/remark-lint-prohibited-strings-2.0.0.tgz", - "integrity": "sha512-N94RTdAT4qmYNBczNZEZbnpGvtl9GiLPO/xdG569IpbbtNFh5l+Nf5Mx5B1VeJMC8/hAR7wShag03Zf29MOO6Q==", - "dependencies": { - "escape-string-regexp": "^4.0.0", - "unified-lint-rule": "^1.0.2", - "unist-util-position": "^3.1.0", - "unist-util-visit": "^2.0.0", - "vfile-location": "^3.0.1" - } - }, "node_modules/remark-lint-rule-style": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-3.0.0.tgz", @@ -4634,51 +3264,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-rule-style/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-rule-style/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-rule-style/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-strong-marker": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-3.0.0.tgz", @@ -4710,51 +3295,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-strong-marker/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-strong-marker/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-strong-marker/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-table-cell-padding": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-4.0.0.tgz", @@ -4787,51 +3327,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-table-cell-padding/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-table-pipes": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-table-pipes/-/remark-lint-table-pipes-4.0.0.tgz", @@ -4863,51 +3358,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-table-pipes/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-table-pipes/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-table-pipes/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-table-pipes/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-lint-unordered-list-marker-style": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-unordered-list-marker-style/-/remark-lint-unordered-list-marker-style-3.0.0.tgz", @@ -4940,51 +3390,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-lint-unordered-list-marker-style/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-unordered-list-marker-style/node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-unordered-list-marker-style/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-lint-unordered-list-marker-style/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-parse": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-10.0.0.tgz", @@ -5000,9 +3405,9 @@ } }, "node_modules/remark-preset-lint-node": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-3.0.0.tgz", - "integrity": "sha512-H1YwlVi/K0xmFT2JaVqnySNHdW/gqd9EQRbGVcH2mkxLNLdO+FIawkSU+UVYIhsm63pKAkHFW8HEtdoEAkNxOg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-3.0.1.tgz", + "integrity": "sha512-L7yhho9q9vmpsfMHO2gRKFNj36106iFM4KpodE+3k3rGg5dcmhV+zcsftNh5NGzbKKKYsGQj9C5XxCR/0NwKDg==", "dependencies": { "js-yaml": "^4.0.0", "remark-lint-blockquote-indentation": "^3.0.0", @@ -5028,7 +3433,7 @@ "remark-lint-no-table-indentation": "^4.0.0", "remark-lint-no-tabs": "^3.0.0", "remark-lint-no-trailing-spaces": "^2.0.1", - "remark-lint-prohibited-strings": "^2.0.0", + "remark-lint-prohibited-strings": "^3.0.0", "remark-lint-rule-style": "^3.0.0", "remark-lint-strong-marker": "^3.0.0", "remark-lint-table-cell-padding": "^4.0.0", @@ -5058,42 +3463,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-preset-lint-node/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-preset-lint-node/node_modules/unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-preset-lint-node/node_modules/unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-preset-lint-recommended": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/remark-preset-lint-recommended/-/remark-preset-lint-recommended-6.0.0.tgz", @@ -5180,15 +3549,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-preset-lint-recommended/node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-preset-lint-recommended/node_modules/unist-util-visit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-3.1.0.tgz", @@ -5216,19 +3576,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-preset-lint-recommended/node_modules/vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "dependencies": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-stringify": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-10.0.0.tgz", @@ -5265,9 +3612,9 @@ } }, "node_modules/rollup": { - "version": "2.52.7", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.52.7.tgz", - "integrity": "sha512-55cSH4CCU6MaPr9TAOyrIC+7qFCHscL7tkNsm1MBfIJRRqRbCEY0mmeFn4Wg8FKsHtEH8r389Fz38r/o+kgXLg==", + "version": "2.56.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.2.tgz", + "integrity": "sha512-s8H00ZsRi29M2/lGdm1u8DJpJ9ML8SUOpVVBd33XNeEeL3NVaTiUcSBHzBdF3eAyR0l7VSpsuoVUGrRHq7aPwQ==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -5576,18 +3923,18 @@ } }, "node_modules/unist-util-is": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.4.tgz", - "integrity": "sha512-3dF39j/u423v4BBQrk1AQ2Ve1FxY5W3JKwXxVFzBODQ6WEvccguhgp802qQLKSnxPODE6WuRZtV+ohlUg4meBA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", + "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" } }, "node_modules/unist-util-position": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.1.0.tgz", - "integrity": "sha512-w+PkwCbYSFw8vpgWD0v7zRCl1FpY3fjDSQ3/N/wNd9Ffa4gPi8+4keqt99N3XW6F99t/mUzp2xAhNmfKWp95QA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", + "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" @@ -5606,13 +3953,13 @@ } }, "node_modules/unist-util-visit": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", - "integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", + "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", "dependencies": { "@types/unist": "^2.0.0", - "unist-util-is": "^4.0.0", - "unist-util-visit-parents": "^3.0.0" + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.0.0" }, "funding": { "type": "opencollective", @@ -5620,12 +3967,12 @@ } }, "node_modules/unist-util-visit-parents": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz", - "integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", + "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", "dependencies": { "@types/unist": "^2.0.0", - "unist-util-is": "^4.0.0" + "unist-util-is": "^5.0.0" }, "funding": { "type": "opencollective", @@ -5653,9 +4000,13 @@ } }, "node_modules/vfile-location": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.2.0.tgz", - "integrity": "sha512-aLEIZKv/oxuCDZ8lkJGhuhztf/BW4M+iHdCwglA/eWc+vtuRFJj8EtgceYFX4LRjOhCAAiNHsKGssC6onJ+jbA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", + "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", + "dependencies": { + "@types/unist": "^2.0.0", + "vfile": "^5.0.0" + }, "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" @@ -6209,9 +4560,9 @@ } }, "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==" }, "estree-walker": { "version": "2.0.2", @@ -6323,17 +4674,6 @@ "vfile": "^5.0.0", "vfile-location": "^4.0.0", "web-namespaces": "^2.0.0" - }, - "dependencies": { - "vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "requires": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - } - } } }, "hast-util-is-element": { @@ -6368,13 +4708,6 @@ "space-separated-tokens": "^2.0.0", "stringify-entities": "^4.0.0", "unist-util-is": "^5.0.0" - }, - "dependencies": { - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - } } }, "hast-util-whitespace": { @@ -6637,16 +4970,6 @@ "unist-util-visit-parents": "^4.0.0" }, "dependencies": { - "escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==" - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, "unist-util-visit-parents": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-4.1.1.tgz", @@ -7229,35 +5552,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7283,35 +5577,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7338,44 +5603,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } - }, - "vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "requires": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - } } } }, @@ -7402,35 +5629,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7456,35 +5654,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7511,35 +5680,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7565,35 +5705,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7643,35 +5754,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7720,30 +5802,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7770,35 +5828,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7825,30 +5854,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7874,30 +5879,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7925,35 +5906,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -7980,35 +5932,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8036,35 +5959,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8092,44 +5986,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } - }, - "vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "requires": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - } } } }, @@ -8158,35 +6014,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8214,35 +6041,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8340,35 +6138,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8396,35 +6165,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8451,30 +6191,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8502,35 +6218,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8558,35 +6245,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8612,30 +6270,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8661,30 +6295,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8710,30 +6320,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8760,44 +6346,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } - }, - "vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "requires": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - } } } }, @@ -8822,15 +6370,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "requires": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - } } } }, @@ -8867,44 +6406,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } - }, - "vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "requires": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - } } } }, @@ -8930,30 +6431,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -8980,48 +6457,32 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, "remark-lint-prohibited-strings": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-prohibited-strings/-/remark-lint-prohibited-strings-2.0.0.tgz", - "integrity": "sha512-N94RTdAT4qmYNBczNZEZbnpGvtl9GiLPO/xdG569IpbbtNFh5l+Nf5Mx5B1VeJMC8/hAR7wShag03Zf29MOO6Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remark-lint-prohibited-strings/-/remark-lint-prohibited-strings-3.0.0.tgz", + "integrity": "sha512-Aw21KVeoOiDte6dNfeTfTgjKV19yWXpPjLxfJ3ShC22/r97gkGdOo4dnuwyEEAfKhr3uimtSf3rRQyGSudY5tQ==", "requires": { - "escape-string-regexp": "^4.0.0", - "unified-lint-rule": "^1.0.2", - "unist-util-position": "^3.1.0", - "unist-util-visit": "^2.0.0", - "vfile-location": "^3.0.1" + "escape-string-regexp": "^5.0.0", + "unified-lint-rule": "^2.0.0", + "unist-util-position": "^4.0.1", + "unist-util-visit": "^4.0.0", + "vfile-location": "^4.0.1" + }, + "dependencies": { + "unified-lint-rule": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unified-lint-rule/-/unified-lint-rule-2.0.1.tgz", + "integrity": "sha512-2RzZuuuWW+ifftM0zd/ZEng0Hb5lah+Zi+ZL/ybj8BrLO/TH2aQAMYvG+iC95aCg2FkWu/pcvVvHqsh2UMmzPg==", + "requires": { + "@types/unist": "^2.0.0", + "trough": "^2.0.0", + "unified": "^10.0.0", + "vfile": "^5.0.0" + } + } } }, "remark-lint-rule-style": { @@ -9046,35 +6507,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -9100,35 +6532,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -9155,35 +6558,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -9209,35 +6583,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -9264,35 +6609,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -9307,9 +6623,9 @@ } }, "remark-preset-lint-node": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-3.0.0.tgz", - "integrity": "sha512-H1YwlVi/K0xmFT2JaVqnySNHdW/gqd9EQRbGVcH2mkxLNLdO+FIawkSU+UVYIhsm63pKAkHFW8HEtdoEAkNxOg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-3.0.1.tgz", + "integrity": "sha512-L7yhho9q9vmpsfMHO2gRKFNj36106iFM4KpodE+3k3rGg5dcmhV+zcsftNh5NGzbKKKYsGQj9C5XxCR/0NwKDg==", "requires": { "js-yaml": "^4.0.0", "remark-lint-blockquote-indentation": "^3.0.0", @@ -9335,7 +6651,7 @@ "remark-lint-no-table-indentation": "^4.0.0", "remark-lint-no-tabs": "^3.0.0", "remark-lint-no-trailing-spaces": "^2.0.1", - "remark-lint-prohibited-strings": "^2.0.0", + "remark-lint-prohibited-strings": "^3.0.0", "remark-lint-rule-style": "^3.0.0", "remark-lint-strong-marker": "^3.0.0", "remark-lint-table-cell-padding": "^4.0.0", @@ -9357,30 +6673,6 @@ "unified": "^10.0.0", "vfile": "^5.0.0" } - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-visit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", - "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", - "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } } } }, @@ -9450,11 +6742,6 @@ "vfile-message": "^3.0.0" } }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, "unist-util-visit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-3.1.0.tgz", @@ -9473,15 +6760,6 @@ "@types/unist": "^2.0.0", "unist-util-is": "^5.0.0" } - }, - "vfile-location": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", - "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", - "requires": { - "@types/unist": "^2.0.0", - "vfile": "^5.0.0" - } } } }, @@ -9511,9 +6789,9 @@ } }, "rollup": { - "version": "2.52.7", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.52.7.tgz", - "integrity": "sha512-55cSH4CCU6MaPr9TAOyrIC+7qFCHscL7tkNsm1MBfIJRRqRbCEY0mmeFn4Wg8FKsHtEH8r389Fz38r/o+kgXLg==", + "version": "2.56.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.2.tgz", + "integrity": "sha512-s8H00ZsRi29M2/lGdm1u8DJpJ9ML8SUOpVVBd33XNeEeL3NVaTiUcSBHzBdF3eAyR0l7VSpsuoVUGrRHq7aPwQ==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -9726,14 +7004,14 @@ } }, "unist-util-is": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.4.tgz", - "integrity": "sha512-3dF39j/u423v4BBQrk1AQ2Ve1FxY5W3JKwXxVFzBODQ6WEvccguhgp802qQLKSnxPODE6WuRZtV+ohlUg4meBA==" + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", + "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" }, "unist-util-position": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.1.0.tgz", - "integrity": "sha512-w+PkwCbYSFw8vpgWD0v7zRCl1FpY3fjDSQ3/N/wNd9Ffa4gPi8+4keqt99N3XW6F99t/mUzp2xAhNmfKWp95QA==" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", + "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" }, "unist-util-stringify-position": { "version": "3.0.0", @@ -9744,22 +7022,22 @@ } }, "unist-util-visit": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", - "integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.0.0.tgz", + "integrity": "sha512-3HWTvrtU10/E7qgPznBfiOyG0TXj9W8c1GSfaI8L9GkaG1pLePiQPZ7E35a0R3ToQ/zcy4Im6aZ9WBgOTnv1MQ==", "requires": { "@types/unist": "^2.0.0", - "unist-util-is": "^4.0.0", - "unist-util-visit-parents": "^3.0.0" + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.0.0" } }, "unist-util-visit-parents": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz", - "integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.0.0.tgz", + "integrity": "sha512-CVaLOYPM/EaFTYMytbaju3Tw4QI3DHnHFnL358FkEu0hZOzSm/hqBdVwOQDR60jF5ZzhB1tlZlRH0ll/yekZIQ==", "requires": { "@types/unist": "^2.0.0", - "unist-util-is": "^4.0.0" + "unist-util-is": "^5.0.0" } }, "util-deprecate": { @@ -9779,9 +7057,13 @@ } }, "vfile-location": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.2.0.tgz", - "integrity": "sha512-aLEIZKv/oxuCDZ8lkJGhuhztf/BW4M+iHdCwglA/eWc+vtuRFJj8EtgceYFX4LRjOhCAAiNHsKGssC6onJ+jbA==" + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-4.0.1.tgz", + "integrity": "sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==", + "requires": { + "@types/unist": "^2.0.0", + "vfile": "^5.0.0" + } }, "vfile-message": { "version": "3.0.2", diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json index 0602d902c2..56ad44b391 100644 --- a/tools/node-lint-md-cli-rollup/package.json +++ b/tools/node-lint-md-cli-rollup/package.json @@ -19,6 +19,6 @@ "main": "dist/index.js", "scripts": { "build": "npx rollup -c", - "build-node": "npm run build && npx shx cp dist/index.js ../lint-md.js" + "build-node": "npm run build && npx shx cp dist/index.mjs ../lint-md.mjs" } } diff --git a/tools/node-lint-md-cli-rollup/rollup.config.js b/tools/node-lint-md-cli-rollup/rollup.config.js index 531103d729..0a2b2098e6 100644 --- a/tools/node-lint-md-cli-rollup/rollup.config.js +++ b/tools/node-lint-md-cli-rollup/rollup.config.js @@ -7,22 +7,18 @@ const json = require('@rollup/plugin-json'); module.exports = { input: 'src/cli-entry.mjs', output: { - file: 'dist/index.js', - format: 'cjs', + file: 'dist/index.mjs', + format: 'es', sourcemap: false, exports: 'none', }, external: [ - 'stream', - 'path', - 'module', - 'util', - 'tty', - 'os', - 'fs', - 'fsevents', - 'events', - 'assert', + 'node:events', + 'node:fs', + 'node:path', + 'node:process', + 'node:stream', + 'node:url', ], plugins: [ { @@ -47,7 +43,7 @@ module.exports = { json({ preferConst: true }), - nodeResolve(), // tells Rollup how to find date-fns in node_modules + nodeResolve({ exportConditions: ['node'] }), commonjs(), { name: 'banner', diff --git a/vcbuild.bat b/vcbuild.bat index 202b0ecb7e..f5f3fa4226 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -674,7 +674,7 @@ for /D %%D IN (doc\*) do ( set "lint_md_files="%%F" !lint_md_files!" ) ) -%node_exe% tools\lint-md.js -q -f %lint_md_files% +%node_exe% tools\lint-md.mjs -q -f %lint_md_files% ENDLOCAL goto exit |