xref: /third_party/node/tools/lint-md/lint-md.mjs (revision 1cb0ef41)
1import fs from 'fs';
2import path$2 from 'path';
3import { pathToFileURL } from 'url';
4import path$1 from 'node:path';
5import process$1 from 'node:process';
6import { fileURLToPath } from 'node:url';
7import fs$1 from 'node:fs';
8import os from 'node:os';
9import tty from 'node:tty';
10
11function bail(error) {
12  if (error) {
13    throw error
14  }
15}
16
17var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
18
19function getDefaultExportFromCjs (x) {
20	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
21}
22
23var hasOwn = Object.prototype.hasOwnProperty;
24var toStr = Object.prototype.toString;
25var defineProperty = Object.defineProperty;
26var gOPD = Object.getOwnPropertyDescriptor;
27var isArray = function isArray(arr) {
28	if (typeof Array.isArray === 'function') {
29		return Array.isArray(arr);
30	}
31	return toStr.call(arr) === '[object Array]';
32};
33var isPlainObject$1 = function isPlainObject(obj) {
34	if (!obj || toStr.call(obj) !== '[object Object]') {
35		return false;
36	}
37	var hasOwnConstructor = hasOwn.call(obj, 'constructor');
38	var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
39	if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
40		return false;
41	}
42	var key;
43	for (key in obj) {  }
44	return typeof key === 'undefined' || hasOwn.call(obj, key);
45};
46var setProperty = function setProperty(target, options) {
47	if (defineProperty && options.name === '__proto__') {
48		defineProperty(target, options.name, {
49			enumerable: true,
50			configurable: true,
51			value: options.newValue,
52			writable: true
53		});
54	} else {
55		target[options.name] = options.newValue;
56	}
57};
58var getProperty = function getProperty(obj, name) {
59	if (name === '__proto__') {
60		if (!hasOwn.call(obj, name)) {
61			return void 0;
62		} else if (gOPD) {
63			return gOPD(obj, name).value;
64		}
65	}
66	return obj[name];
67};
68var extend$1 = function extend() {
69	var options, name, src, copy, copyIsArray, clone;
70	var target = arguments[0];
71	var i = 1;
72	var length = arguments.length;
73	var deep = false;
74	if (typeof target === 'boolean') {
75		deep = target;
76		target = arguments[1] || {};
77		i = 2;
78	}
79	if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
80		target = {};
81	}
82	for (; i < length; ++i) {
83		options = arguments[i];
84		if (options != null) {
85			for (name in options) {
86				src = getProperty(target, name);
87				copy = getProperty(options, name);
88				if (target !== copy) {
89					if (deep && copy && (isPlainObject$1(copy) || (copyIsArray = isArray(copy)))) {
90						if (copyIsArray) {
91							copyIsArray = false;
92							clone = src && isArray(src) ? src : [];
93						} else {
94							clone = src && isPlainObject$1(src) ? src : {};
95						}
96						setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
97					} else if (typeof copy !== 'undefined') {
98						setProperty(target, { name: name, newValue: copy });
99					}
100				}
101			}
102		}
103	}
104	return target;
105};
106var extend$2 = getDefaultExportFromCjs(extend$1);
107
108function ok$B() {}
109
110function isPlainObject(value) {
111	if (typeof value !== 'object' || value === null) {
112		return false;
113	}
114	const prototype = Object.getPrototypeOf(value);
115	return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
116}
117
118function trough() {
119  const fns = [];
120  const pipeline = {run, use};
121  return pipeline
122  function run(...values) {
123    let middlewareIndex = -1;
124    const callback = values.pop();
125    if (typeof callback !== 'function') {
126      throw new TypeError('Expected function as last argument, not ' + callback)
127    }
128    next(null, ...values);
129    function next(error, ...output) {
130      const fn = fns[++middlewareIndex];
131      let index = -1;
132      if (error) {
133        callback(error);
134        return
135      }
136      while (++index < values.length) {
137        if (output[index] === null || output[index] === undefined) {
138          output[index] = values[index];
139        }
140      }
141      values = output;
142      if (fn) {
143        wrap(fn, next)(...output);
144      } else {
145        callback(null, ...output);
146      }
147    }
148  }
149  function use(middelware) {
150    if (typeof middelware !== 'function') {
151      throw new TypeError(
152        'Expected `middelware` to be a function, not ' + middelware
153      )
154    }
155    fns.push(middelware);
156    return pipeline
157  }
158}
159function wrap(middleware, callback) {
160  let called;
161  return wrapped
162  function wrapped(...parameters) {
163    const fnExpectsCallback = middleware.length > parameters.length;
164    let result;
165    if (fnExpectsCallback) {
166      parameters.push(done);
167    }
168    try {
169      result = middleware.apply(this, parameters);
170    } catch (error) {
171      const exception =  (error);
172      if (fnExpectsCallback && called) {
173        throw exception
174      }
175      return done(exception)
176    }
177    if (!fnExpectsCallback) {
178      if (result instanceof Promise) {
179        result.then(then, done);
180      } else if (result instanceof Error) {
181        done(result);
182      } else {
183        then(result);
184      }
185    }
186  }
187  function done(error, ...output) {
188    if (!called) {
189      called = true;
190      callback(error, ...output);
191    }
192  }
193  function then(value) {
194    done(null, value);
195  }
196}
197
198function stringifyPosition$2(value) {
199  if (!value || typeof value !== 'object') {
200    return ''
201  }
202  if ('position' in value || 'type' in value) {
203    return position$2(value.position)
204  }
205  if ('start' in value || 'end' in value) {
206    return position$2(value)
207  }
208  if ('line' in value || 'column' in value) {
209    return point$4(value)
210  }
211  return ''
212}
213function point$4(point) {
214  return index$2(point && point.line) + ':' + index$2(point && point.column)
215}
216function position$2(pos) {
217  return point$4(pos && pos.start) + '-' + point$4(pos && pos.end)
218}
219function index$2(value) {
220  return value && typeof value === 'number' ? value : 1
221}
222
223let VFileMessage$1 = class VFileMessage extends Error {
224  constructor(causeOrReason, optionsOrParentOrPlace, origin) {
225    super();
226    if (typeof optionsOrParentOrPlace === 'string') {
227      origin = optionsOrParentOrPlace;
228      optionsOrParentOrPlace = undefined;
229    }
230    let reason = '';
231    let options = {};
232    let legacyCause = false;
233    if (optionsOrParentOrPlace) {
234      if (
235        'line' in optionsOrParentOrPlace &&
236        'column' in optionsOrParentOrPlace
237      ) {
238        options = {place: optionsOrParentOrPlace};
239      }
240      else if (
241        'start' in optionsOrParentOrPlace &&
242        'end' in optionsOrParentOrPlace
243      ) {
244        options = {place: optionsOrParentOrPlace};
245      }
246      else if ('type' in optionsOrParentOrPlace) {
247        options = {
248          ancestors: [optionsOrParentOrPlace],
249          place: optionsOrParentOrPlace.position
250        };
251      }
252      else {
253        options = {...optionsOrParentOrPlace};
254      }
255    }
256    if (typeof causeOrReason === 'string') {
257      reason = causeOrReason;
258    }
259    else if (!options.cause && causeOrReason) {
260      legacyCause = true;
261      reason = causeOrReason.message;
262      options.cause = causeOrReason;
263    }
264    if (!options.ruleId && !options.source && typeof origin === 'string') {
265      const index = origin.indexOf(':');
266      if (index === -1) {
267        options.ruleId = origin;
268      } else {
269        options.source = origin.slice(0, index);
270        options.ruleId = origin.slice(index + 1);
271      }
272    }
273    if (!options.place && options.ancestors && options.ancestors) {
274      const parent = options.ancestors[options.ancestors.length - 1];
275      if (parent) {
276        options.place = parent.position;
277      }
278    }
279    const start =
280      options.place && 'start' in options.place
281        ? options.place.start
282        : options.place;
283    this.ancestors = options.ancestors || undefined;
284    this.cause = options.cause || undefined;
285    this.column = start ? start.column : undefined;
286    this.fatal = undefined;
287    this.file;
288    this.message = reason;
289    this.line = start ? start.line : undefined;
290    this.name = stringifyPosition$2(options.place) || '1:1';
291    this.place = options.place || undefined;
292    this.reason = this.message;
293    this.ruleId = options.ruleId || undefined;
294    this.source = options.source || undefined;
295    this.stack =
296      legacyCause && options.cause && typeof options.cause.stack === 'string'
297        ? options.cause.stack
298        : '';
299    this.actual;
300    this.expected;
301    this.note;
302    this.url;
303  }
304};
305VFileMessage$1.prototype.file = '';
306VFileMessage$1.prototype.name = '';
307VFileMessage$1.prototype.reason = '';
308VFileMessage$1.prototype.message = '';
309VFileMessage$1.prototype.stack = '';
310VFileMessage$1.prototype.column = undefined;
311VFileMessage$1.prototype.line = undefined;
312VFileMessage$1.prototype.ancestors = undefined;
313VFileMessage$1.prototype.cause = undefined;
314VFileMessage$1.prototype.fatal = undefined;
315VFileMessage$1.prototype.place = undefined;
316VFileMessage$1.prototype.ruleId = undefined;
317VFileMessage$1.prototype.source = undefined;
318
319function isUrl$1(fileUrlOrPath) {
320  return Boolean(
321    fileUrlOrPath !== null &&
322      typeof fileUrlOrPath === 'object' &&
323      'href' in fileUrlOrPath &&
324      fileUrlOrPath.href &&
325      'protocol' in fileUrlOrPath &&
326      fileUrlOrPath.protocol &&
327      fileUrlOrPath.auth === undefined
328  )
329}
330
331const order$1 =  ([
332  'history',
333  'path',
334  'basename',
335  'stem',
336  'extname',
337  'dirname'
338]);
339let VFile$1 = class VFile {
340  constructor(value) {
341    let options;
342    if (!value) {
343      options = {};
344    } else if (isUrl$1(value)) {
345      options = {path: value};
346    } else if (typeof value === 'string' || isUint8Array$3(value)) {
347      options = {value};
348    } else {
349      options = value;
350    }
351    this.cwd = process$1.cwd();
352    this.data = {};
353    this.history = [];
354    this.messages = [];
355    this.value;
356    this.map;
357    this.result;
358    this.stored;
359    let index = -1;
360    while (++index < order$1.length) {
361      const prop = order$1[index];
362      if (
363        prop in options &&
364        options[prop] !== undefined &&
365        options[prop] !== null
366      ) {
367        this[prop] = prop === 'history' ? [...options[prop]] : options[prop];
368      }
369    }
370    let prop;
371    for (prop in options) {
372      if (!order$1.includes(prop)) {
373        this[prop] = options[prop];
374      }
375    }
376  }
377  get basename() {
378    return typeof this.path === 'string' ? path$1.basename(this.path) : undefined
379  }
380  set basename(basename) {
381    assertNonEmpty$1(basename, 'basename');
382    assertPart$1(basename, 'basename');
383    this.path = path$1.join(this.dirname || '', basename);
384  }
385  get dirname() {
386    return typeof this.path === 'string' ? path$1.dirname(this.path) : undefined
387  }
388  set dirname(dirname) {
389    assertPath$1(this.basename, 'dirname');
390    this.path = path$1.join(dirname || '', this.basename);
391  }
392  get extname() {
393    return typeof this.path === 'string' ? path$1.extname(this.path) : undefined
394  }
395  set extname(extname) {
396    assertPart$1(extname, 'extname');
397    assertPath$1(this.dirname, 'extname');
398    if (extname) {
399      if (extname.codePointAt(0) !== 46 ) {
400        throw new Error('`extname` must start with `.`')
401      }
402      if (extname.includes('.', 1)) {
403        throw new Error('`extname` cannot contain multiple dots')
404      }
405    }
406    this.path = path$1.join(this.dirname, this.stem + (extname || ''));
407  }
408  get path() {
409    return this.history[this.history.length - 1]
410  }
411  set path(path) {
412    if (isUrl$1(path)) {
413      path = fileURLToPath(path);
414    }
415    assertNonEmpty$1(path, 'path');
416    if (this.path !== path) {
417      this.history.push(path);
418    }
419  }
420  get stem() {
421    return typeof this.path === 'string'
422      ? path$1.basename(this.path, this.extname)
423      : undefined
424  }
425  set stem(stem) {
426    assertNonEmpty$1(stem, 'stem');
427    assertPart$1(stem, 'stem');
428    this.path = path$1.join(this.dirname || '', stem + (this.extname || ''));
429  }
430  fail(causeOrReason, optionsOrParentOrPlace, origin) {
431    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
432    message.fatal = true;
433    throw message
434  }
435  info(causeOrReason, optionsOrParentOrPlace, origin) {
436    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
437    message.fatal = undefined;
438    return message
439  }
440  message(causeOrReason, optionsOrParentOrPlace, origin) {
441    const message = new VFileMessage$1(
442      causeOrReason,
443      optionsOrParentOrPlace,
444      origin
445    );
446    if (this.path) {
447      message.name = this.path + ':' + message.name;
448      message.file = this.path;
449    }
450    message.fatal = false;
451    this.messages.push(message);
452    return message
453  }
454  toString(encoding) {
455    if (this.value === undefined) {
456      return ''
457    }
458    if (typeof this.value === 'string') {
459      return this.value
460    }
461    const decoder = new TextDecoder(encoding || undefined);
462    return decoder.decode(this.value)
463  }
464};
465function assertPart$1(part, name) {
466  if (part && part.includes(path$1.sep)) {
467    throw new Error(
468      '`' + name + '` cannot be a path: did not expect `' + path$1.sep + '`'
469    )
470  }
471}
472function assertNonEmpty$1(part, name) {
473  if (!part) {
474    throw new Error('`' + name + '` cannot be empty')
475  }
476}
477function assertPath$1(path, name) {
478  if (!path) {
479    throw new Error('Setting `' + name + '` requires `path` to be set too')
480  }
481}
482function isUint8Array$3(value) {
483  return Boolean(
484    value &&
485      typeof value === 'object' &&
486      'byteLength' in value &&
487      'byteOffset' in value
488  )
489}
490
491const CallableInstance =
492  (
493    (
494      function (property) {
495        const self = this;
496        const constr = self.constructor;
497        const proto =  (
498          constr.prototype
499        );
500        const func = proto[property];
501        const apply = function () {
502          return func.apply(apply, arguments)
503        };
504        Object.setPrototypeOf(apply, proto);
505        const names = Object.getOwnPropertyNames(func);
506        for (const p of names) {
507          const descriptor = Object.getOwnPropertyDescriptor(func, p);
508          if (descriptor) Object.defineProperty(apply, p, descriptor);
509        }
510        return apply
511      }
512    )
513  );
514
515const own$6 = {}.hasOwnProperty;
516class Processor extends CallableInstance {
517  constructor() {
518    super('copy');
519    this.Compiler = undefined;
520    this.Parser = undefined;
521    this.attachers = [];
522    this.compiler = undefined;
523    this.freezeIndex = -1;
524    this.frozen = undefined;
525    this.namespace = {};
526    this.parser = undefined;
527    this.transformers = trough();
528  }
529  copy() {
530    const destination =
531       (
532        new Processor()
533      );
534    let index = -1;
535    while (++index < this.attachers.length) {
536      const attacher = this.attachers[index];
537      destination.use(...attacher);
538    }
539    destination.data(extend$2(true, {}, this.namespace));
540    return destination
541  }
542  data(key, value) {
543    if (typeof key === 'string') {
544      if (arguments.length === 2) {
545        assertUnfrozen('data', this.frozen);
546        this.namespace[key] = value;
547        return this
548      }
549      return (own$6.call(this.namespace, key) && this.namespace[key]) || undefined
550    }
551    if (key) {
552      assertUnfrozen('data', this.frozen);
553      this.namespace = key;
554      return this
555    }
556    return this.namespace
557  }
558  freeze() {
559    if (this.frozen) {
560      return this
561    }
562    const self =  ( (this));
563    while (++this.freezeIndex < this.attachers.length) {
564      const [attacher, ...options] = this.attachers[this.freezeIndex];
565      if (options[0] === false) {
566        continue
567      }
568      if (options[0] === true) {
569        options[0] = undefined;
570      }
571      const transformer = attacher.call(self, ...options);
572      if (typeof transformer === 'function') {
573        this.transformers.use(transformer);
574      }
575    }
576    this.frozen = true;
577    this.freezeIndex = Number.POSITIVE_INFINITY;
578    return this
579  }
580  parse(file) {
581    this.freeze();
582    const realFile = vfile(file);
583    const parser = this.parser || this.Parser;
584    assertParser('parse', parser);
585    return parser(String(realFile), realFile)
586  }
587  process(file, done) {
588    const self = this;
589    this.freeze();
590    assertParser('process', this.parser || this.Parser);
591    assertCompiler('process', this.compiler || this.Compiler);
592    return done ? executor(undefined, done) : new Promise(executor)
593    function executor(resolve, reject) {
594      const realFile = vfile(file);
595      const parseTree =
596         (
597           (self.parse(realFile))
598        );
599      self.run(parseTree, realFile, function (error, tree, file) {
600        if (error || !tree || !file) {
601          return realDone(error)
602        }
603        const compileTree =
604           (
605             (tree)
606          );
607        const compileResult = self.stringify(compileTree, file);
608        if (looksLikeAValue(compileResult)) {
609          file.value = compileResult;
610        } else {
611          file.result = compileResult;
612        }
613        realDone(error,  (file));
614      });
615      function realDone(error, file) {
616        if (error || !file) {
617          reject(error);
618        } else if (resolve) {
619          resolve(file);
620        } else {
621          done(undefined, file);
622        }
623      }
624    }
625  }
626  processSync(file) {
627    let complete = false;
628    let result;
629    this.freeze();
630    assertParser('processSync', this.parser || this.Parser);
631    assertCompiler('processSync', this.compiler || this.Compiler);
632    this.process(file, realDone);
633    assertDone('processSync', 'process', complete);
634    return result
635    function realDone(error, file) {
636      complete = true;
637      bail(error);
638      result = file;
639    }
640  }
641  run(tree, file, done) {
642    assertNode(tree);
643    this.freeze();
644    const transformers = this.transformers;
645    if (!done && typeof file === 'function') {
646      done = file;
647      file = undefined;
648    }
649    return done ? executor(undefined, done) : new Promise(executor)
650    function executor(resolve, reject) {
651      const realFile = vfile(file);
652      transformers.run(tree, realFile, realDone);
653      function realDone(error, outputTree, file) {
654        const resultingTree =
655           (
656            outputTree || tree
657          );
658        if (error) {
659          reject(error);
660        } else if (resolve) {
661          resolve(resultingTree);
662        } else {
663          done(undefined, resultingTree, file);
664        }
665      }
666    }
667  }
668  runSync(tree, file) {
669    let complete = false;
670    let result;
671    this.run(tree, file, realDone);
672    assertDone('runSync', 'run', complete);
673    return result
674    function realDone(error, tree) {
675      bail(error);
676      result = tree;
677      complete = true;
678    }
679  }
680  stringify(tree, file) {
681    this.freeze();
682    const realFile = vfile(file);
683    const compiler = this.compiler || this.Compiler;
684    assertCompiler('stringify', compiler);
685    assertNode(tree);
686    return compiler(tree, realFile)
687  }
688  use(value, ...parameters) {
689    const attachers = this.attachers;
690    const namespace = this.namespace;
691    assertUnfrozen('use', this.frozen);
692    if (value === null || value === undefined) ; else if (typeof value === 'function') {
693      addPlugin(value, parameters);
694    } else if (typeof value === 'object') {
695      if (Array.isArray(value)) {
696        addList(value);
697      } else {
698        addPreset(value);
699      }
700    } else {
701      throw new TypeError('Expected usable value, not `' + value + '`')
702    }
703    return this
704    function add(value) {
705      if (typeof value === 'function') {
706        addPlugin(value, []);
707      } else if (typeof value === 'object') {
708        if (Array.isArray(value)) {
709          const [plugin, ...parameters] =
710             (value);
711          addPlugin(plugin, parameters);
712        } else {
713          addPreset(value);
714        }
715      } else {
716        throw new TypeError('Expected usable value, not `' + value + '`')
717      }
718    }
719    function addPreset(result) {
720      if (!('plugins' in result) && !('settings' in result)) {
721        throw new Error(
722          'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'
723        )
724      }
725      addList(result.plugins);
726      if (result.settings) {
727        namespace.settings = extend$2(true, namespace.settings, result.settings);
728      }
729    }
730    function addList(plugins) {
731      let index = -1;
732      if (plugins === null || plugins === undefined) ; else if (Array.isArray(plugins)) {
733        while (++index < plugins.length) {
734          const thing = plugins[index];
735          add(thing);
736        }
737      } else {
738        throw new TypeError('Expected a list of plugins, not `' + plugins + '`')
739      }
740    }
741    function addPlugin(plugin, parameters) {
742      let index = -1;
743      let entryIndex = -1;
744      while (++index < attachers.length) {
745        if (attachers[index][0] === plugin) {
746          entryIndex = index;
747          break
748        }
749      }
750      if (entryIndex === -1) {
751        attachers.push([plugin, ...parameters]);
752      }
753      else if (parameters.length > 0) {
754        let [primary, ...rest] = parameters;
755        const currentPrimary = attachers[entryIndex][1];
756        if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
757          primary = extend$2(true, currentPrimary, primary);
758        }
759        attachers[entryIndex] = [plugin, primary, ...rest];
760      }
761    }
762  }
763}
764const unified = new Processor().freeze();
765function assertParser(name, value) {
766  if (typeof value !== 'function') {
767    throw new TypeError('Cannot `' + name + '` without `parser`')
768  }
769}
770function assertCompiler(name, value) {
771  if (typeof value !== 'function') {
772    throw new TypeError('Cannot `' + name + '` without `compiler`')
773  }
774}
775function assertUnfrozen(name, frozen) {
776  if (frozen) {
777    throw new Error(
778      'Cannot call `' +
779        name +
780        '` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'
781    )
782  }
783}
784function assertNode(node) {
785  if (!isPlainObject(node) || typeof node.type !== 'string') {
786    throw new TypeError('Expected node, got `' + node + '`')
787  }
788}
789function assertDone(name, asyncName, complete) {
790  if (!complete) {
791    throw new Error(
792      '`' + name + '` finished async. Use `' + asyncName + '` instead'
793    )
794  }
795}
796function vfile(value) {
797  return looksLikeAVFile$1(value) ? value : new VFile$1(value)
798}
799function looksLikeAVFile$1(value) {
800  return Boolean(
801    value &&
802      typeof value === 'object' &&
803      'message' in value &&
804      'messages' in value
805  )
806}
807function looksLikeAValue(value) {
808  return typeof value === 'string' || isUint8Array$2(value)
809}
810function isUint8Array$2(value) {
811  return Boolean(
812    value &&
813      typeof value === 'object' &&
814      'byteLength' in value &&
815      'byteOffset' in value
816  )
817}
818
819const emptyOptions$3 = {};
820function toString$2(value, options) {
821  const settings = options || emptyOptions$3;
822  const includeImageAlt =
823    typeof settings.includeImageAlt === 'boolean'
824      ? settings.includeImageAlt
825      : true;
826  const includeHtml =
827    typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true;
828  return one$2(value, includeImageAlt, includeHtml)
829}
830function one$2(value, includeImageAlt, includeHtml) {
831  if (node$2(value)) {
832    if ('value' in value) {
833      return value.type === 'html' && !includeHtml ? '' : value.value
834    }
835    if (includeImageAlt && 'alt' in value && value.alt) {
836      return value.alt
837    }
838    if ('children' in value) {
839      return all$2(value.children, includeImageAlt, includeHtml)
840    }
841  }
842  if (Array.isArray(value)) {
843    return all$2(value, includeImageAlt, includeHtml)
844  }
845  return ''
846}
847function all$2(values, includeImageAlt, includeHtml) {
848  const result = [];
849  let index = -1;
850  while (++index < values.length) {
851    result[index] = one$2(values[index], includeImageAlt, includeHtml);
852  }
853  return result.join('')
854}
855function node$2(value) {
856  return Boolean(value && typeof value === 'object')
857}
858
859const characterEntities = {
860  AElig: 'Æ',
861  AMP: '&',
862  Aacute: 'Á',
863  Abreve: 'Ă',
864  Acirc: 'Â',
865  Acy: 'А',
866  Afr: '�',
867  Agrave: 'À',
868  Alpha: 'Α',
869  Amacr: 'Ā',
870  And: '⩓',
871  Aogon: 'Ą',
872  Aopf: '�',
873  ApplyFunction: '⁡',
874  Aring: 'Å',
875  Ascr: '�',
876  Assign: '≔',
877  Atilde: 'Ã',
878  Auml: 'Ä',
879  Backslash: '∖',
880  Barv: '⫧',
881  Barwed: '⌆',
882  Bcy: 'Б',
883  Because: '∵',
884  Bernoullis: 'ℬ',
885  Beta: 'Β',
886  Bfr: '�',
887  Bopf: '�',
888  Breve: '˘',
889  Bscr: 'ℬ',
890  Bumpeq: '≎',
891  CHcy: 'Ч',
892  COPY: '©',
893  Cacute: 'Ć',
894  Cap: '⋒',
895  CapitalDifferentialD: 'ⅅ',
896  Cayleys: 'ℭ',
897  Ccaron: 'Č',
898  Ccedil: 'Ç',
899  Ccirc: 'Ĉ',
900  Cconint: '∰',
901  Cdot: 'Ċ',
902  Cedilla: '¸',
903  CenterDot: '·',
904  Cfr: 'ℭ',
905  Chi: 'Χ',
906  CircleDot: '⊙',
907  CircleMinus: '⊖',
908  CirclePlus: '⊕',
909  CircleTimes: '⊗',
910  ClockwiseContourIntegral: '∲',
911  CloseCurlyDoubleQuote: '”',
912  CloseCurlyQuote: '’',
913  Colon: '∷',
914  Colone: '⩴',
915  Congruent: '≡',
916  Conint: '∯',
917  ContourIntegral: '∮',
918  Copf: 'ℂ',
919  Coproduct: '∐',
920  CounterClockwiseContourIntegral: '∳',
921  Cross: '⨯',
922  Cscr: '�',
923  Cup: '⋓',
924  CupCap: '≍',
925  DD: 'ⅅ',
926  DDotrahd: '⤑',
927  DJcy: 'Ђ',
928  DScy: 'Ѕ',
929  DZcy: 'Џ',
930  Dagger: '‡',
931  Darr: '↡',
932  Dashv: '⫤',
933  Dcaron: 'Ď',
934  Dcy: 'Д',
935  Del: '∇',
936  Delta: 'Δ',
937  Dfr: '�',
938  DiacriticalAcute: '´',
939  DiacriticalDot: '˙',
940  DiacriticalDoubleAcute: '˝',
941  DiacriticalGrave: '`',
942  DiacriticalTilde: '˜',
943  Diamond: '⋄',
944  DifferentialD: 'ⅆ',
945  Dopf: '�',
946  Dot: '¨',
947  DotDot: '⃜',
948  DotEqual: '≐',
949  DoubleContourIntegral: '∯',
950  DoubleDot: '¨',
951  DoubleDownArrow: '⇓',
952  DoubleLeftArrow: '⇐',
953  DoubleLeftRightArrow: '⇔',
954  DoubleLeftTee: '⫤',
955  DoubleLongLeftArrow: '⟸',
956  DoubleLongLeftRightArrow: '⟺',
957  DoubleLongRightArrow: '⟹',
958  DoubleRightArrow: '⇒',
959  DoubleRightTee: '⊨',
960  DoubleUpArrow: '⇑',
961  DoubleUpDownArrow: '⇕',
962  DoubleVerticalBar: '∥',
963  DownArrow: '↓',
964  DownArrowBar: '⤓',
965  DownArrowUpArrow: '⇵',
966  DownBreve: '̑',
967  DownLeftRightVector: '⥐',
968  DownLeftTeeVector: '⥞',
969  DownLeftVector: '↽',
970  DownLeftVectorBar: '⥖',
971  DownRightTeeVector: '⥟',
972  DownRightVector: '⇁',
973  DownRightVectorBar: '⥗',
974  DownTee: '⊤',
975  DownTeeArrow: '↧',
976  Downarrow: '⇓',
977  Dscr: '�',
978  Dstrok: 'Đ',
979  ENG: 'Ŋ',
980  ETH: 'Ð',
981  Eacute: 'É',
982  Ecaron: 'Ě',
983  Ecirc: 'Ê',
984  Ecy: 'Э',
985  Edot: 'Ė',
986  Efr: '�',
987  Egrave: 'È',
988  Element: '∈',
989  Emacr: 'Ē',
990  EmptySmallSquare: '◻',
991  EmptyVerySmallSquare: '▫',
992  Eogon: 'Ę',
993  Eopf: '�',
994  Epsilon: 'Ε',
995  Equal: '⩵',
996  EqualTilde: '≂',
997  Equilibrium: '⇌',
998  Escr: 'ℰ',
999  Esim: '⩳',
1000  Eta: 'Η',
1001  Euml: 'Ë',
1002  Exists: '∃',
1003  ExponentialE: 'ⅇ',
1004  Fcy: 'Ф',
1005  Ffr: '�',
1006  FilledSmallSquare: '◼',
1007  FilledVerySmallSquare: '▪',
1008  Fopf: '�',
1009  ForAll: '∀',
1010  Fouriertrf: 'ℱ',
1011  Fscr: 'ℱ',
1012  GJcy: 'Ѓ',
1013  GT: '>',
1014  Gamma: 'Γ',
1015  Gammad: 'Ϝ',
1016  Gbreve: 'Ğ',
1017  Gcedil: 'Ģ',
1018  Gcirc: 'Ĝ',
1019  Gcy: 'Г',
1020  Gdot: 'Ġ',
1021  Gfr: '�',
1022  Gg: '⋙',
1023  Gopf: '�',
1024  GreaterEqual: '≥',
1025  GreaterEqualLess: '⋛',
1026  GreaterFullEqual: '≧',
1027  GreaterGreater: '⪢',
1028  GreaterLess: '≷',
1029  GreaterSlantEqual: '⩾',
1030  GreaterTilde: '≳',
1031  Gscr: '�',
1032  Gt: '≫',
1033  HARDcy: 'Ъ',
1034  Hacek: 'ˇ',
1035  Hat: '^',
1036  Hcirc: 'Ĥ',
1037  Hfr: 'ℌ',
1038  HilbertSpace: 'ℋ',
1039  Hopf: 'ℍ',
1040  HorizontalLine: '─',
1041  Hscr: 'ℋ',
1042  Hstrok: 'Ħ',
1043  HumpDownHump: '≎',
1044  HumpEqual: '≏',
1045  IEcy: 'Е',
1046  IJlig: 'IJ',
1047  IOcy: 'Ё',
1048  Iacute: 'Í',
1049  Icirc: 'Î',
1050  Icy: 'И',
1051  Idot: 'İ',
1052  Ifr: 'ℑ',
1053  Igrave: 'Ì',
1054  Im: 'ℑ',
1055  Imacr: 'Ī',
1056  ImaginaryI: 'ⅈ',
1057  Implies: '⇒',
1058  Int: '∬',
1059  Integral: '∫',
1060  Intersection: '⋂',
1061  InvisibleComma: '⁣',
1062  InvisibleTimes: '⁢',
1063  Iogon: 'Į',
1064  Iopf: '�',
1065  Iota: 'Ι',
1066  Iscr: 'ℐ',
1067  Itilde: 'Ĩ',
1068  Iukcy: 'І',
1069  Iuml: 'Ï',
1070  Jcirc: 'Ĵ',
1071  Jcy: 'Й',
1072  Jfr: '�',
1073  Jopf: '�',
1074  Jscr: '�',
1075  Jsercy: 'Ј',
1076  Jukcy: 'Є',
1077  KHcy: 'Х',
1078  KJcy: 'Ќ',
1079  Kappa: 'Κ',
1080  Kcedil: 'Ķ',
1081  Kcy: 'К',
1082  Kfr: '�',
1083  Kopf: '�',
1084  Kscr: '�',
1085  LJcy: 'Љ',
1086  LT: '<',
1087  Lacute: 'Ĺ',
1088  Lambda: 'Λ',
1089  Lang: '⟪',
1090  Laplacetrf: 'ℒ',
1091  Larr: '↞',
1092  Lcaron: 'Ľ',
1093  Lcedil: 'Ļ',
1094  Lcy: 'Л',
1095  LeftAngleBracket: '⟨',
1096  LeftArrow: '←',
1097  LeftArrowBar: '⇤',
1098  LeftArrowRightArrow: '⇆',
1099  LeftCeiling: '⌈',
1100  LeftDoubleBracket: '⟦',
1101  LeftDownTeeVector: '⥡',
1102  LeftDownVector: '⇃',
1103  LeftDownVectorBar: '⥙',
1104  LeftFloor: '⌊',
1105  LeftRightArrow: '↔',
1106  LeftRightVector: '⥎',
1107  LeftTee: '⊣',
1108  LeftTeeArrow: '↤',
1109  LeftTeeVector: '⥚',
1110  LeftTriangle: '⊲',
1111  LeftTriangleBar: '⧏',
1112  LeftTriangleEqual: '⊴',
1113  LeftUpDownVector: '⥑',
1114  LeftUpTeeVector: '⥠',
1115  LeftUpVector: '↿',
1116  LeftUpVectorBar: '⥘',
1117  LeftVector: '↼',
1118  LeftVectorBar: '⥒',
1119  Leftarrow: '⇐',
1120  Leftrightarrow: '⇔',
1121  LessEqualGreater: '⋚',
1122  LessFullEqual: '≦',
1123  LessGreater: '≶',
1124  LessLess: '⪡',
1125  LessSlantEqual: '⩽',
1126  LessTilde: '≲',
1127  Lfr: '�',
1128  Ll: '⋘',
1129  Lleftarrow: '⇚',
1130  Lmidot: 'Ŀ',
1131  LongLeftArrow: '⟵',
1132  LongLeftRightArrow: '⟷',
1133  LongRightArrow: '⟶',
1134  Longleftarrow: '⟸',
1135  Longleftrightarrow: '⟺',
1136  Longrightarrow: '⟹',
1137  Lopf: '�',
1138  LowerLeftArrow: '↙',
1139  LowerRightArrow: '↘',
1140  Lscr: 'ℒ',
1141  Lsh: '↰',
1142  Lstrok: 'Ł',
1143  Lt: '≪',
1144  Map: '⤅',
1145  Mcy: 'М',
1146  MediumSpace: ' ',
1147  Mellintrf: 'ℳ',
1148  Mfr: '�',
1149  MinusPlus: '∓',
1150  Mopf: '�',
1151  Mscr: 'ℳ',
1152  Mu: 'Μ',
1153  NJcy: 'Њ',
1154  Nacute: 'Ń',
1155  Ncaron: 'Ň',
1156  Ncedil: 'Ņ',
1157  Ncy: 'Н',
1158  NegativeMediumSpace: '​',
1159  NegativeThickSpace: '​',
1160  NegativeThinSpace: '​',
1161  NegativeVeryThinSpace: '​',
1162  NestedGreaterGreater: '≫',
1163  NestedLessLess: '≪',
1164  NewLine: '\n',
1165  Nfr: '�',
1166  NoBreak: '⁠',
1167  NonBreakingSpace: ' ',
1168  Nopf: 'ℕ',
1169  Not: '⫬',
1170  NotCongruent: '≢',
1171  NotCupCap: '≭',
1172  NotDoubleVerticalBar: '∦',
1173  NotElement: '∉',
1174  NotEqual: '≠',
1175  NotEqualTilde: '≂̸',
1176  NotExists: '∄',
1177  NotGreater: '≯',
1178  NotGreaterEqual: '≱',
1179  NotGreaterFullEqual: '≧̸',
1180  NotGreaterGreater: '≫̸',
1181  NotGreaterLess: '≹',
1182  NotGreaterSlantEqual: '⩾̸',
1183  NotGreaterTilde: '≵',
1184  NotHumpDownHump: '≎̸',
1185  NotHumpEqual: '≏̸',
1186  NotLeftTriangle: '⋪',
1187  NotLeftTriangleBar: '⧏̸',
1188  NotLeftTriangleEqual: '⋬',
1189  NotLess: '≮',
1190  NotLessEqual: '≰',
1191  NotLessGreater: '≸',
1192  NotLessLess: '≪̸',
1193  NotLessSlantEqual: '⩽̸',
1194  NotLessTilde: '≴',
1195  NotNestedGreaterGreater: '⪢̸',
1196  NotNestedLessLess: '⪡̸',
1197  NotPrecedes: '⊀',
1198  NotPrecedesEqual: '⪯̸',
1199  NotPrecedesSlantEqual: '⋠',
1200  NotReverseElement: '∌',
1201  NotRightTriangle: '⋫',
1202  NotRightTriangleBar: '⧐̸',
1203  NotRightTriangleEqual: '⋭',
1204  NotSquareSubset: '⊏̸',
1205  NotSquareSubsetEqual: '⋢',
1206  NotSquareSuperset: '⊐̸',
1207  NotSquareSupersetEqual: '⋣',
1208  NotSubset: '⊂⃒',
1209  NotSubsetEqual: '⊈',
1210  NotSucceeds: '⊁',
1211  NotSucceedsEqual: '⪰̸',
1212  NotSucceedsSlantEqual: '⋡',
1213  NotSucceedsTilde: '≿̸',
1214  NotSuperset: '⊃⃒',
1215  NotSupersetEqual: '⊉',
1216  NotTilde: '≁',
1217  NotTildeEqual: '≄',
1218  NotTildeFullEqual: '≇',
1219  NotTildeTilde: '≉',
1220  NotVerticalBar: '∤',
1221  Nscr: '�',
1222  Ntilde: 'Ñ',
1223  Nu: 'Ν',
1224  OElig: 'Œ',
1225  Oacute: 'Ó',
1226  Ocirc: 'Ô',
1227  Ocy: 'О',
1228  Odblac: 'Ő',
1229  Ofr: '�',
1230  Ograve: 'Ò',
1231  Omacr: 'Ō',
1232  Omega: 'Ω',
1233  Omicron: 'Ο',
1234  Oopf: '�',
1235  OpenCurlyDoubleQuote: '“',
1236  OpenCurlyQuote: '‘',
1237  Or: '⩔',
1238  Oscr: '�',
1239  Oslash: 'Ø',
1240  Otilde: 'Õ',
1241  Otimes: '⨷',
1242  Ouml: 'Ö',
1243  OverBar: '‾',
1244  OverBrace: '⏞',
1245  OverBracket: '⎴',
1246  OverParenthesis: '⏜',
1247  PartialD: '∂',
1248  Pcy: 'П',
1249  Pfr: '�',
1250  Phi: 'Φ',
1251  Pi: 'Π',
1252  PlusMinus: '±',
1253  Poincareplane: 'ℌ',
1254  Popf: 'ℙ',
1255  Pr: '⪻',
1256  Precedes: '≺',
1257  PrecedesEqual: '⪯',
1258  PrecedesSlantEqual: '≼',
1259  PrecedesTilde: '≾',
1260  Prime: '″',
1261  Product: '∏',
1262  Proportion: '∷',
1263  Proportional: '∝',
1264  Pscr: '�',
1265  Psi: 'Ψ',
1266  QUOT: '"',
1267  Qfr: '�',
1268  Qopf: 'ℚ',
1269  Qscr: '�',
1270  RBarr: '⤐',
1271  REG: '®',
1272  Racute: 'Ŕ',
1273  Rang: '⟫',
1274  Rarr: '↠',
1275  Rarrtl: '⤖',
1276  Rcaron: 'Ř',
1277  Rcedil: 'Ŗ',
1278  Rcy: 'Р',
1279  Re: 'ℜ',
1280  ReverseElement: '∋',
1281  ReverseEquilibrium: '⇋',
1282  ReverseUpEquilibrium: '⥯',
1283  Rfr: 'ℜ',
1284  Rho: 'Ρ',
1285  RightAngleBracket: '⟩',
1286  RightArrow: '→',
1287  RightArrowBar: '⇥',
1288  RightArrowLeftArrow: '⇄',
1289  RightCeiling: '⌉',
1290  RightDoubleBracket: '⟧',
1291  RightDownTeeVector: '⥝',
1292  RightDownVector: '⇂',
1293  RightDownVectorBar: '⥕',
1294  RightFloor: '⌋',
1295  RightTee: '⊢',
1296  RightTeeArrow: '↦',
1297  RightTeeVector: '⥛',
1298  RightTriangle: '⊳',
1299  RightTriangleBar: '⧐',
1300  RightTriangleEqual: '⊵',
1301  RightUpDownVector: '⥏',
1302  RightUpTeeVector: '⥜',
1303  RightUpVector: '↾',
1304  RightUpVectorBar: '⥔',
1305  RightVector: '⇀',
1306  RightVectorBar: '⥓',
1307  Rightarrow: '⇒',
1308  Ropf: 'ℝ',
1309  RoundImplies: '⥰',
1310  Rrightarrow: '⇛',
1311  Rscr: 'ℛ',
1312  Rsh: '↱',
1313  RuleDelayed: '⧴',
1314  SHCHcy: 'Щ',
1315  SHcy: 'Ш',
1316  SOFTcy: 'Ь',
1317  Sacute: 'Ś',
1318  Sc: '⪼',
1319  Scaron: 'Š',
1320  Scedil: 'Ş',
1321  Scirc: 'Ŝ',
1322  Scy: 'С',
1323  Sfr: '�',
1324  ShortDownArrow: '↓',
1325  ShortLeftArrow: '←',
1326  ShortRightArrow: '→',
1327  ShortUpArrow: '↑',
1328  Sigma: 'Σ',
1329  SmallCircle: '∘',
1330  Sopf: '�',
1331  Sqrt: '√',
1332  Square: '□',
1333  SquareIntersection: '⊓',
1334  SquareSubset: '⊏',
1335  SquareSubsetEqual: '⊑',
1336  SquareSuperset: '⊐',
1337  SquareSupersetEqual: '⊒',
1338  SquareUnion: '⊔',
1339  Sscr: '�',
1340  Star: '⋆',
1341  Sub: '⋐',
1342  Subset: '⋐',
1343  SubsetEqual: '⊆',
1344  Succeeds: '≻',
1345  SucceedsEqual: '⪰',
1346  SucceedsSlantEqual: '≽',
1347  SucceedsTilde: '≿',
1348  SuchThat: '∋',
1349  Sum: '∑',
1350  Sup: '⋑',
1351  Superset: '⊃',
1352  SupersetEqual: '⊇',
1353  Supset: '⋑',
1354  THORN: 'Þ',
1355  TRADE: '™',
1356  TSHcy: 'Ћ',
1357  TScy: 'Ц',
1358  Tab: '\t',
1359  Tau: 'Τ',
1360  Tcaron: 'Ť',
1361  Tcedil: 'Ţ',
1362  Tcy: 'Т',
1363  Tfr: '�',
1364  Therefore: '∴',
1365  Theta: 'Θ',
1366  ThickSpace: '  ',
1367  ThinSpace: ' ',
1368  Tilde: '∼',
1369  TildeEqual: '≃',
1370  TildeFullEqual: '≅',
1371  TildeTilde: '≈',
1372  Topf: '�',
1373  TripleDot: '⃛',
1374  Tscr: '�',
1375  Tstrok: 'Ŧ',
1376  Uacute: 'Ú',
1377  Uarr: '↟',
1378  Uarrocir: '⥉',
1379  Ubrcy: 'Ў',
1380  Ubreve: 'Ŭ',
1381  Ucirc: 'Û',
1382  Ucy: 'У',
1383  Udblac: 'Ű',
1384  Ufr: '�',
1385  Ugrave: 'Ù',
1386  Umacr: 'Ū',
1387  UnderBar: '_',
1388  UnderBrace: '⏟',
1389  UnderBracket: '⎵',
1390  UnderParenthesis: '⏝',
1391  Union: '⋃',
1392  UnionPlus: '⊎',
1393  Uogon: 'Ų',
1394  Uopf: '�',
1395  UpArrow: '↑',
1396  UpArrowBar: '⤒',
1397  UpArrowDownArrow: '⇅',
1398  UpDownArrow: '↕',
1399  UpEquilibrium: '⥮',
1400  UpTee: '⊥',
1401  UpTeeArrow: '↥',
1402  Uparrow: '⇑',
1403  Updownarrow: '⇕',
1404  UpperLeftArrow: '↖',
1405  UpperRightArrow: '↗',
1406  Upsi: 'ϒ',
1407  Upsilon: 'Υ',
1408  Uring: 'Ů',
1409  Uscr: '�',
1410  Utilde: 'Ũ',
1411  Uuml: 'Ü',
1412  VDash: '⊫',
1413  Vbar: '⫫',
1414  Vcy: 'В',
1415  Vdash: '⊩',
1416  Vdashl: '⫦',
1417  Vee: '⋁',
1418  Verbar: '‖',
1419  Vert: '‖',
1420  VerticalBar: '∣',
1421  VerticalLine: '|',
1422  VerticalSeparator: '❘',
1423  VerticalTilde: '≀',
1424  VeryThinSpace: ' ',
1425  Vfr: '�',
1426  Vopf: '�',
1427  Vscr: '�',
1428  Vvdash: '⊪',
1429  Wcirc: 'Ŵ',
1430  Wedge: '⋀',
1431  Wfr: '�',
1432  Wopf: '�',
1433  Wscr: '�',
1434  Xfr: '�',
1435  Xi: 'Ξ',
1436  Xopf: '�',
1437  Xscr: '�',
1438  YAcy: 'Я',
1439  YIcy: 'Ї',
1440  YUcy: 'Ю',
1441  Yacute: 'Ý',
1442  Ycirc: 'Ŷ',
1443  Ycy: 'Ы',
1444  Yfr: '�',
1445  Yopf: '�',
1446  Yscr: '�',
1447  Yuml: 'Ÿ',
1448  ZHcy: 'Ж',
1449  Zacute: 'Ź',
1450  Zcaron: 'Ž',
1451  Zcy: 'З',
1452  Zdot: 'Ż',
1453  ZeroWidthSpace: '​',
1454  Zeta: 'Ζ',
1455  Zfr: 'ℨ',
1456  Zopf: 'ℤ',
1457  Zscr: '�',
1458  aacute: 'á',
1459  abreve: 'ă',
1460  ac: '∾',
1461  acE: '∾̳',
1462  acd: '∿',
1463  acirc: 'â',
1464  acute: '´',
1465  acy: 'а',
1466  aelig: 'æ',
1467  af: '⁡',
1468  afr: '�',
1469  agrave: 'à',
1470  alefsym: 'ℵ',
1471  aleph: 'ℵ',
1472  alpha: 'α',
1473  amacr: 'ā',
1474  amalg: '⨿',
1475  amp: '&',
1476  and: '∧',
1477  andand: '⩕',
1478  andd: '⩜',
1479  andslope: '⩘',
1480  andv: '⩚',
1481  ang: '∠',
1482  ange: '⦤',
1483  angle: '∠',
1484  angmsd: '∡',
1485  angmsdaa: '⦨',
1486  angmsdab: '⦩',
1487  angmsdac: '⦪',
1488  angmsdad: '⦫',
1489  angmsdae: '⦬',
1490  angmsdaf: '⦭',
1491  angmsdag: '⦮',
1492  angmsdah: '⦯',
1493  angrt: '∟',
1494  angrtvb: '⊾',
1495  angrtvbd: '⦝',
1496  angsph: '∢',
1497  angst: 'Å',
1498  angzarr: '⍼',
1499  aogon: 'ą',
1500  aopf: '�',
1501  ap: '≈',
1502  apE: '⩰',
1503  apacir: '⩯',
1504  ape: '≊',
1505  apid: '≋',
1506  apos: "'",
1507  approx: '≈',
1508  approxeq: '≊',
1509  aring: 'å',
1510  ascr: '�',
1511  ast: '*',
1512  asymp: '≈',
1513  asympeq: '≍',
1514  atilde: 'ã',
1515  auml: 'ä',
1516  awconint: '∳',
1517  awint: '⨑',
1518  bNot: '⫭',
1519  backcong: '≌',
1520  backepsilon: '϶',
1521  backprime: '‵',
1522  backsim: '∽',
1523  backsimeq: '⋍',
1524  barvee: '⊽',
1525  barwed: '⌅',
1526  barwedge: '⌅',
1527  bbrk: '⎵',
1528  bbrktbrk: '⎶',
1529  bcong: '≌',
1530  bcy: 'б',
1531  bdquo: '„',
1532  becaus: '∵',
1533  because: '∵',
1534  bemptyv: '⦰',
1535  bepsi: '϶',
1536  bernou: 'ℬ',
1537  beta: 'β',
1538  beth: 'ℶ',
1539  between: '≬',
1540  bfr: '�',
1541  bigcap: '⋂',
1542  bigcirc: '◯',
1543  bigcup: '⋃',
1544  bigodot: '⨀',
1545  bigoplus: '⨁',
1546  bigotimes: '⨂',
1547  bigsqcup: '⨆',
1548  bigstar: '★',
1549  bigtriangledown: '▽',
1550  bigtriangleup: '△',
1551  biguplus: '⨄',
1552  bigvee: '⋁',
1553  bigwedge: '⋀',
1554  bkarow: '⤍',
1555  blacklozenge: '⧫',
1556  blacksquare: '▪',
1557  blacktriangle: '▴',
1558  blacktriangledown: '▾',
1559  blacktriangleleft: '◂',
1560  blacktriangleright: '▸',
1561  blank: '␣',
1562  blk12: '▒',
1563  blk14: '░',
1564  blk34: '▓',
1565  block: '█',
1566  bne: '=⃥',
1567  bnequiv: '≡⃥',
1568  bnot: '⌐',
1569  bopf: '�',
1570  bot: '⊥',
1571  bottom: '⊥',
1572  bowtie: '⋈',
1573  boxDL: '╗',
1574  boxDR: '╔',
1575  boxDl: '╖',
1576  boxDr: '╓',
1577  boxH: '═',
1578  boxHD: '╦',
1579  boxHU: '╩',
1580  boxHd: '╤',
1581  boxHu: '╧',
1582  boxUL: '╝',
1583  boxUR: '╚',
1584  boxUl: '╜',
1585  boxUr: '╙',
1586  boxV: '║',
1587  boxVH: '╬',
1588  boxVL: '╣',
1589  boxVR: '╠',
1590  boxVh: '╫',
1591  boxVl: '╢',
1592  boxVr: '╟',
1593  boxbox: '⧉',
1594  boxdL: '╕',
1595  boxdR: '╒',
1596  boxdl: '┐',
1597  boxdr: '┌',
1598  boxh: '─',
1599  boxhD: '╥',
1600  boxhU: '╨',
1601  boxhd: '┬',
1602  boxhu: '┴',
1603  boxminus: '⊟',
1604  boxplus: '⊞',
1605  boxtimes: '⊠',
1606  boxuL: '╛',
1607  boxuR: '╘',
1608  boxul: '┘',
1609  boxur: '└',
1610  boxv: '│',
1611  boxvH: '╪',
1612  boxvL: '╡',
1613  boxvR: '╞',
1614  boxvh: '┼',
1615  boxvl: '┤',
1616  boxvr: '├',
1617  bprime: '‵',
1618  breve: '˘',
1619  brvbar: '¦',
1620  bscr: '�',
1621  bsemi: '⁏',
1622  bsim: '∽',
1623  bsime: '⋍',
1624  bsol: '\\',
1625  bsolb: '⧅',
1626  bsolhsub: '⟈',
1627  bull: '•',
1628  bullet: '•',
1629  bump: '≎',
1630  bumpE: '⪮',
1631  bumpe: '≏',
1632  bumpeq: '≏',
1633  cacute: 'ć',
1634  cap: '∩',
1635  capand: '⩄',
1636  capbrcup: '⩉',
1637  capcap: '⩋',
1638  capcup: '⩇',
1639  capdot: '⩀',
1640  caps: '∩︀',
1641  caret: '⁁',
1642  caron: 'ˇ',
1643  ccaps: '⩍',
1644  ccaron: 'č',
1645  ccedil: 'ç',
1646  ccirc: 'ĉ',
1647  ccups: '⩌',
1648  ccupssm: '⩐',
1649  cdot: 'ċ',
1650  cedil: '¸',
1651  cemptyv: '⦲',
1652  cent: '¢',
1653  centerdot: '·',
1654  cfr: '�',
1655  chcy: 'ч',
1656  check: '✓',
1657  checkmark: '✓',
1658  chi: 'χ',
1659  cir: '○',
1660  cirE: '⧃',
1661  circ: 'ˆ',
1662  circeq: '≗',
1663  circlearrowleft: '↺',
1664  circlearrowright: '↻',
1665  circledR: '®',
1666  circledS: 'Ⓢ',
1667  circledast: '⊛',
1668  circledcirc: '⊚',
1669  circleddash: '⊝',
1670  cire: '≗',
1671  cirfnint: '⨐',
1672  cirmid: '⫯',
1673  cirscir: '⧂',
1674  clubs: '♣',
1675  clubsuit: '♣',
1676  colon: ':',
1677  colone: '≔',
1678  coloneq: '≔',
1679  comma: ',',
1680  commat: '@',
1681  comp: '∁',
1682  compfn: '∘',
1683  complement: '∁',
1684  complexes: 'ℂ',
1685  cong: '≅',
1686  congdot: '⩭',
1687  conint: '∮',
1688  copf: '�',
1689  coprod: '∐',
1690  copy: '©',
1691  copysr: '℗',
1692  crarr: '↵',
1693  cross: '✗',
1694  cscr: '�',
1695  csub: '⫏',
1696  csube: '⫑',
1697  csup: '⫐',
1698  csupe: '⫒',
1699  ctdot: '⋯',
1700  cudarrl: '⤸',
1701  cudarrr: '⤵',
1702  cuepr: '⋞',
1703  cuesc: '⋟',
1704  cularr: '↶',
1705  cularrp: '⤽',
1706  cup: '∪',
1707  cupbrcap: '⩈',
1708  cupcap: '⩆',
1709  cupcup: '⩊',
1710  cupdot: '⊍',
1711  cupor: '⩅',
1712  cups: '∪︀',
1713  curarr: '↷',
1714  curarrm: '⤼',
1715  curlyeqprec: '⋞',
1716  curlyeqsucc: '⋟',
1717  curlyvee: '⋎',
1718  curlywedge: '⋏',
1719  curren: '¤',
1720  curvearrowleft: '↶',
1721  curvearrowright: '↷',
1722  cuvee: '⋎',
1723  cuwed: '⋏',
1724  cwconint: '∲',
1725  cwint: '∱',
1726  cylcty: '⌭',
1727  dArr: '⇓',
1728  dHar: '⥥',
1729  dagger: '†',
1730  daleth: 'ℸ',
1731  darr: '↓',
1732  dash: '‐',
1733  dashv: '⊣',
1734  dbkarow: '⤏',
1735  dblac: '˝',
1736  dcaron: 'ď',
1737  dcy: 'д',
1738  dd: 'ⅆ',
1739  ddagger: '‡',
1740  ddarr: '⇊',
1741  ddotseq: '⩷',
1742  deg: '°',
1743  delta: 'δ',
1744  demptyv: '⦱',
1745  dfisht: '⥿',
1746  dfr: '�',
1747  dharl: '⇃',
1748  dharr: '⇂',
1749  diam: '⋄',
1750  diamond: '⋄',
1751  diamondsuit: '♦',
1752  diams: '♦',
1753  die: '¨',
1754  digamma: 'ϝ',
1755  disin: '⋲',
1756  div: '÷',
1757  divide: '÷',
1758  divideontimes: '⋇',
1759  divonx: '⋇',
1760  djcy: 'ђ',
1761  dlcorn: '⌞',
1762  dlcrop: '⌍',
1763  dollar: '$',
1764  dopf: '�',
1765  dot: '˙',
1766  doteq: '≐',
1767  doteqdot: '≑',
1768  dotminus: '∸',
1769  dotplus: '∔',
1770  dotsquare: '⊡',
1771  doublebarwedge: '⌆',
1772  downarrow: '↓',
1773  downdownarrows: '⇊',
1774  downharpoonleft: '⇃',
1775  downharpoonright: '⇂',
1776  drbkarow: '⤐',
1777  drcorn: '⌟',
1778  drcrop: '⌌',
1779  dscr: '�',
1780  dscy: 'ѕ',
1781  dsol: '⧶',
1782  dstrok: 'đ',
1783  dtdot: '⋱',
1784  dtri: '▿',
1785  dtrif: '▾',
1786  duarr: '⇵',
1787  duhar: '⥯',
1788  dwangle: '⦦',
1789  dzcy: 'џ',
1790  dzigrarr: '⟿',
1791  eDDot: '⩷',
1792  eDot: '≑',
1793  eacute: 'é',
1794  easter: '⩮',
1795  ecaron: 'ě',
1796  ecir: '≖',
1797  ecirc: 'ê',
1798  ecolon: '≕',
1799  ecy: 'э',
1800  edot: 'ė',
1801  ee: 'ⅇ',
1802  efDot: '≒',
1803  efr: '�',
1804  eg: '⪚',
1805  egrave: 'è',
1806  egs: '⪖',
1807  egsdot: '⪘',
1808  el: '⪙',
1809  elinters: '⏧',
1810  ell: 'ℓ',
1811  els: '⪕',
1812  elsdot: '⪗',
1813  emacr: 'ē',
1814  empty: '∅',
1815  emptyset: '∅',
1816  emptyv: '∅',
1817  emsp13: ' ',
1818  emsp14: ' ',
1819  emsp: ' ',
1820  eng: 'ŋ',
1821  ensp: ' ',
1822  eogon: 'ę',
1823  eopf: '�',
1824  epar: '⋕',
1825  eparsl: '⧣',
1826  eplus: '⩱',
1827  epsi: 'ε',
1828  epsilon: 'ε',
1829  epsiv: 'ϵ',
1830  eqcirc: '≖',
1831  eqcolon: '≕',
1832  eqsim: '≂',
1833  eqslantgtr: '⪖',
1834  eqslantless: '⪕',
1835  equals: '=',
1836  equest: '≟',
1837  equiv: '≡',
1838  equivDD: '⩸',
1839  eqvparsl: '⧥',
1840  erDot: '≓',
1841  erarr: '⥱',
1842  escr: 'ℯ',
1843  esdot: '≐',
1844  esim: '≂',
1845  eta: 'η',
1846  eth: 'ð',
1847  euml: 'ë',
1848  euro: '€',
1849  excl: '!',
1850  exist: '∃',
1851  expectation: 'ℰ',
1852  exponentiale: 'ⅇ',
1853  fallingdotseq: '≒',
1854  fcy: 'ф',
1855  female: '♀',
1856  ffilig: 'ffi',
1857  fflig: 'ff',
1858  ffllig: 'ffl',
1859  ffr: '�',
1860  filig: 'fi',
1861  fjlig: 'fj',
1862  flat: '♭',
1863  fllig: 'fl',
1864  fltns: '▱',
1865  fnof: 'ƒ',
1866  fopf: '�',
1867  forall: '∀',
1868  fork: '⋔',
1869  forkv: '⫙',
1870  fpartint: '⨍',
1871  frac12: '½',
1872  frac13: '⅓',
1873  frac14: '¼',
1874  frac15: '⅕',
1875  frac16: '⅙',
1876  frac18: '⅛',
1877  frac23: '⅔',
1878  frac25: '⅖',
1879  frac34: '¾',
1880  frac35: '⅗',
1881  frac38: '⅜',
1882  frac45: '⅘',
1883  frac56: '⅚',
1884  frac58: '⅝',
1885  frac78: '⅞',
1886  frasl: '⁄',
1887  frown: '⌢',
1888  fscr: '�',
1889  gE: '≧',
1890  gEl: '⪌',
1891  gacute: 'ǵ',
1892  gamma: 'γ',
1893  gammad: 'ϝ',
1894  gap: '⪆',
1895  gbreve: 'ğ',
1896  gcirc: 'ĝ',
1897  gcy: 'г',
1898  gdot: 'ġ',
1899  ge: '≥',
1900  gel: '⋛',
1901  geq: '≥',
1902  geqq: '≧',
1903  geqslant: '⩾',
1904  ges: '⩾',
1905  gescc: '⪩',
1906  gesdot: '⪀',
1907  gesdoto: '⪂',
1908  gesdotol: '⪄',
1909  gesl: '⋛︀',
1910  gesles: '⪔',
1911  gfr: '�',
1912  gg: '≫',
1913  ggg: '⋙',
1914  gimel: 'ℷ',
1915  gjcy: 'ѓ',
1916  gl: '≷',
1917  glE: '⪒',
1918  gla: '⪥',
1919  glj: '⪤',
1920  gnE: '≩',
1921  gnap: '⪊',
1922  gnapprox: '⪊',
1923  gne: '⪈',
1924  gneq: '⪈',
1925  gneqq: '≩',
1926  gnsim: '⋧',
1927  gopf: '�',
1928  grave: '`',
1929  gscr: 'ℊ',
1930  gsim: '≳',
1931  gsime: '⪎',
1932  gsiml: '⪐',
1933  gt: '>',
1934  gtcc: '⪧',
1935  gtcir: '⩺',
1936  gtdot: '⋗',
1937  gtlPar: '⦕',
1938  gtquest: '⩼',
1939  gtrapprox: '⪆',
1940  gtrarr: '⥸',
1941  gtrdot: '⋗',
1942  gtreqless: '⋛',
1943  gtreqqless: '⪌',
1944  gtrless: '≷',
1945  gtrsim: '≳',
1946  gvertneqq: '≩︀',
1947  gvnE: '≩︀',
1948  hArr: '⇔',
1949  hairsp: ' ',
1950  half: '½',
1951  hamilt: 'ℋ',
1952  hardcy: 'ъ',
1953  harr: '↔',
1954  harrcir: '⥈',
1955  harrw: '↭',
1956  hbar: 'ℏ',
1957  hcirc: 'ĥ',
1958  hearts: '♥',
1959  heartsuit: '♥',
1960  hellip: '…',
1961  hercon: '⊹',
1962  hfr: '�',
1963  hksearow: '⤥',
1964  hkswarow: '⤦',
1965  hoarr: '⇿',
1966  homtht: '∻',
1967  hookleftarrow: '↩',
1968  hookrightarrow: '↪',
1969  hopf: '�',
1970  horbar: '―',
1971  hscr: '�',
1972  hslash: 'ℏ',
1973  hstrok: 'ħ',
1974  hybull: '⁃',
1975  hyphen: '‐',
1976  iacute: 'í',
1977  ic: '⁣',
1978  icirc: 'î',
1979  icy: 'и',
1980  iecy: 'е',
1981  iexcl: '¡',
1982  iff: '⇔',
1983  ifr: '�',
1984  igrave: 'ì',
1985  ii: 'ⅈ',
1986  iiiint: '⨌',
1987  iiint: '∭',
1988  iinfin: '⧜',
1989  iiota: '℩',
1990  ijlig: 'ij',
1991  imacr: 'ī',
1992  image: 'ℑ',
1993  imagline: 'ℐ',
1994  imagpart: 'ℑ',
1995  imath: 'ı',
1996  imof: '⊷',
1997  imped: 'Ƶ',
1998  in: '∈',
1999  incare: '℅',
2000  infin: '∞',
2001  infintie: '⧝',
2002  inodot: 'ı',
2003  int: '∫',
2004  intcal: '⊺',
2005  integers: 'ℤ',
2006  intercal: '⊺',
2007  intlarhk: '⨗',
2008  intprod: '⨼',
2009  iocy: 'ё',
2010  iogon: 'į',
2011  iopf: '�',
2012  iota: 'ι',
2013  iprod: '⨼',
2014  iquest: '¿',
2015  iscr: '�',
2016  isin: '∈',
2017  isinE: '⋹',
2018  isindot: '⋵',
2019  isins: '⋴',
2020  isinsv: '⋳',
2021  isinv: '∈',
2022  it: '⁢',
2023  itilde: 'ĩ',
2024  iukcy: 'і',
2025  iuml: 'ï',
2026  jcirc: 'ĵ',
2027  jcy: 'й',
2028  jfr: '�',
2029  jmath: 'ȷ',
2030  jopf: '�',
2031  jscr: '�',
2032  jsercy: 'ј',
2033  jukcy: 'є',
2034  kappa: 'κ',
2035  kappav: 'ϰ',
2036  kcedil: 'ķ',
2037  kcy: 'к',
2038  kfr: '�',
2039  kgreen: 'ĸ',
2040  khcy: 'х',
2041  kjcy: 'ќ',
2042  kopf: '�',
2043  kscr: '�',
2044  lAarr: '⇚',
2045  lArr: '⇐',
2046  lAtail: '⤛',
2047  lBarr: '⤎',
2048  lE: '≦',
2049  lEg: '⪋',
2050  lHar: '⥢',
2051  lacute: 'ĺ',
2052  laemptyv: '⦴',
2053  lagran: 'ℒ',
2054  lambda: 'λ',
2055  lang: '⟨',
2056  langd: '⦑',
2057  langle: '⟨',
2058  lap: '⪅',
2059  laquo: '«',
2060  larr: '←',
2061  larrb: '⇤',
2062  larrbfs: '⤟',
2063  larrfs: '⤝',
2064  larrhk: '↩',
2065  larrlp: '↫',
2066  larrpl: '⤹',
2067  larrsim: '⥳',
2068  larrtl: '↢',
2069  lat: '⪫',
2070  latail: '⤙',
2071  late: '⪭',
2072  lates: '⪭︀',
2073  lbarr: '⤌',
2074  lbbrk: '❲',
2075  lbrace: '{',
2076  lbrack: '[',
2077  lbrke: '⦋',
2078  lbrksld: '⦏',
2079  lbrkslu: '⦍',
2080  lcaron: 'ľ',
2081  lcedil: 'ļ',
2082  lceil: '⌈',
2083  lcub: '{',
2084  lcy: 'л',
2085  ldca: '⤶',
2086  ldquo: '“',
2087  ldquor: '„',
2088  ldrdhar: '⥧',
2089  ldrushar: '⥋',
2090  ldsh: '↲',
2091  le: '≤',
2092  leftarrow: '←',
2093  leftarrowtail: '↢',
2094  leftharpoondown: '↽',
2095  leftharpoonup: '↼',
2096  leftleftarrows: '⇇',
2097  leftrightarrow: '↔',
2098  leftrightarrows: '⇆',
2099  leftrightharpoons: '⇋',
2100  leftrightsquigarrow: '↭',
2101  leftthreetimes: '⋋',
2102  leg: '⋚',
2103  leq: '≤',
2104  leqq: '≦',
2105  leqslant: '⩽',
2106  les: '⩽',
2107  lescc: '⪨',
2108  lesdot: '⩿',
2109  lesdoto: '⪁',
2110  lesdotor: '⪃',
2111  lesg: '⋚︀',
2112  lesges: '⪓',
2113  lessapprox: '⪅',
2114  lessdot: '⋖',
2115  lesseqgtr: '⋚',
2116  lesseqqgtr: '⪋',
2117  lessgtr: '≶',
2118  lesssim: '≲',
2119  lfisht: '⥼',
2120  lfloor: '⌊',
2121  lfr: '�',
2122  lg: '≶',
2123  lgE: '⪑',
2124  lhard: '↽',
2125  lharu: '↼',
2126  lharul: '⥪',
2127  lhblk: '▄',
2128  ljcy: 'љ',
2129  ll: '≪',
2130  llarr: '⇇',
2131  llcorner: '⌞',
2132  llhard: '⥫',
2133  lltri: '◺',
2134  lmidot: 'ŀ',
2135  lmoust: '⎰',
2136  lmoustache: '⎰',
2137  lnE: '≨',
2138  lnap: '⪉',
2139  lnapprox: '⪉',
2140  lne: '⪇',
2141  lneq: '⪇',
2142  lneqq: '≨',
2143  lnsim: '⋦',
2144  loang: '⟬',
2145  loarr: '⇽',
2146  lobrk: '⟦',
2147  longleftarrow: '⟵',
2148  longleftrightarrow: '⟷',
2149  longmapsto: '⟼',
2150  longrightarrow: '⟶',
2151  looparrowleft: '↫',
2152  looparrowright: '↬',
2153  lopar: '⦅',
2154  lopf: '�',
2155  loplus: '⨭',
2156  lotimes: '⨴',
2157  lowast: '∗',
2158  lowbar: '_',
2159  loz: '◊',
2160  lozenge: '◊',
2161  lozf: '⧫',
2162  lpar: '(',
2163  lparlt: '⦓',
2164  lrarr: '⇆',
2165  lrcorner: '⌟',
2166  lrhar: '⇋',
2167  lrhard: '⥭',
2168  lrm: '‎',
2169  lrtri: '⊿',
2170  lsaquo: '‹',
2171  lscr: '�',
2172  lsh: '↰',
2173  lsim: '≲',
2174  lsime: '⪍',
2175  lsimg: '⪏',
2176  lsqb: '[',
2177  lsquo: '‘',
2178  lsquor: '‚',
2179  lstrok: 'ł',
2180  lt: '<',
2181  ltcc: '⪦',
2182  ltcir: '⩹',
2183  ltdot: '⋖',
2184  lthree: '⋋',
2185  ltimes: '⋉',
2186  ltlarr: '⥶',
2187  ltquest: '⩻',
2188  ltrPar: '⦖',
2189  ltri: '◃',
2190  ltrie: '⊴',
2191  ltrif: '◂',
2192  lurdshar: '⥊',
2193  luruhar: '⥦',
2194  lvertneqq: '≨︀',
2195  lvnE: '≨︀',
2196  mDDot: '∺',
2197  macr: '¯',
2198  male: '♂',
2199  malt: '✠',
2200  maltese: '✠',
2201  map: '↦',
2202  mapsto: '↦',
2203  mapstodown: '↧',
2204  mapstoleft: '↤',
2205  mapstoup: '↥',
2206  marker: '▮',
2207  mcomma: '⨩',
2208  mcy: 'м',
2209  mdash: '—',
2210  measuredangle: '∡',
2211  mfr: '�',
2212  mho: '℧',
2213  micro: 'µ',
2214  mid: '∣',
2215  midast: '*',
2216  midcir: '⫰',
2217  middot: '·',
2218  minus: '−',
2219  minusb: '⊟',
2220  minusd: '∸',
2221  minusdu: '⨪',
2222  mlcp: '⫛',
2223  mldr: '…',
2224  mnplus: '∓',
2225  models: '⊧',
2226  mopf: '�',
2227  mp: '∓',
2228  mscr: '�',
2229  mstpos: '∾',
2230  mu: 'μ',
2231  multimap: '⊸',
2232  mumap: '⊸',
2233  nGg: '⋙̸',
2234  nGt: '≫⃒',
2235  nGtv: '≫̸',
2236  nLeftarrow: '⇍',
2237  nLeftrightarrow: '⇎',
2238  nLl: '⋘̸',
2239  nLt: '≪⃒',
2240  nLtv: '≪̸',
2241  nRightarrow: '⇏',
2242  nVDash: '⊯',
2243  nVdash: '⊮',
2244  nabla: '∇',
2245  nacute: 'ń',
2246  nang: '∠⃒',
2247  nap: '≉',
2248  napE: '⩰̸',
2249  napid: '≋̸',
2250  napos: 'ʼn',
2251  napprox: '≉',
2252  natur: '♮',
2253  natural: '♮',
2254  naturals: 'ℕ',
2255  nbsp: ' ',
2256  nbump: '≎̸',
2257  nbumpe: '≏̸',
2258  ncap: '⩃',
2259  ncaron: 'ň',
2260  ncedil: 'ņ',
2261  ncong: '≇',
2262  ncongdot: '⩭̸',
2263  ncup: '⩂',
2264  ncy: 'н',
2265  ndash: '–',
2266  ne: '≠',
2267  neArr: '⇗',
2268  nearhk: '⤤',
2269  nearr: '↗',
2270  nearrow: '↗',
2271  nedot: '≐̸',
2272  nequiv: '≢',
2273  nesear: '⤨',
2274  nesim: '≂̸',
2275  nexist: '∄',
2276  nexists: '∄',
2277  nfr: '�',
2278  ngE: '≧̸',
2279  nge: '≱',
2280  ngeq: '≱',
2281  ngeqq: '≧̸',
2282  ngeqslant: '⩾̸',
2283  nges: '⩾̸',
2284  ngsim: '≵',
2285  ngt: '≯',
2286  ngtr: '≯',
2287  nhArr: '⇎',
2288  nharr: '↮',
2289  nhpar: '⫲',
2290  ni: '∋',
2291  nis: '⋼',
2292  nisd: '⋺',
2293  niv: '∋',
2294  njcy: 'њ',
2295  nlArr: '⇍',
2296  nlE: '≦̸',
2297  nlarr: '↚',
2298  nldr: '‥',
2299  nle: '≰',
2300  nleftarrow: '↚',
2301  nleftrightarrow: '↮',
2302  nleq: '≰',
2303  nleqq: '≦̸',
2304  nleqslant: '⩽̸',
2305  nles: '⩽̸',
2306  nless: '≮',
2307  nlsim: '≴',
2308  nlt: '≮',
2309  nltri: '⋪',
2310  nltrie: '⋬',
2311  nmid: '∤',
2312  nopf: '�',
2313  not: '¬',
2314  notin: '∉',
2315  notinE: '⋹̸',
2316  notindot: '⋵̸',
2317  notinva: '∉',
2318  notinvb: '⋷',
2319  notinvc: '⋶',
2320  notni: '∌',
2321  notniva: '∌',
2322  notnivb: '⋾',
2323  notnivc: '⋽',
2324  npar: '∦',
2325  nparallel: '∦',
2326  nparsl: '⫽⃥',
2327  npart: '∂̸',
2328  npolint: '⨔',
2329  npr: '⊀',
2330  nprcue: '⋠',
2331  npre: '⪯̸',
2332  nprec: '⊀',
2333  npreceq: '⪯̸',
2334  nrArr: '⇏',
2335  nrarr: '↛',
2336  nrarrc: '⤳̸',
2337  nrarrw: '↝̸',
2338  nrightarrow: '↛',
2339  nrtri: '⋫',
2340  nrtrie: '⋭',
2341  nsc: '⊁',
2342  nsccue: '⋡',
2343  nsce: '⪰̸',
2344  nscr: '�',
2345  nshortmid: '∤',
2346  nshortparallel: '∦',
2347  nsim: '≁',
2348  nsime: '≄',
2349  nsimeq: '≄',
2350  nsmid: '∤',
2351  nspar: '∦',
2352  nsqsube: '⋢',
2353  nsqsupe: '⋣',
2354  nsub: '⊄',
2355  nsubE: '⫅̸',
2356  nsube: '⊈',
2357  nsubset: '⊂⃒',
2358  nsubseteq: '⊈',
2359  nsubseteqq: '⫅̸',
2360  nsucc: '⊁',
2361  nsucceq: '⪰̸',
2362  nsup: '⊅',
2363  nsupE: '⫆̸',
2364  nsupe: '⊉',
2365  nsupset: '⊃⃒',
2366  nsupseteq: '⊉',
2367  nsupseteqq: '⫆̸',
2368  ntgl: '≹',
2369  ntilde: 'ñ',
2370  ntlg: '≸',
2371  ntriangleleft: '⋪',
2372  ntrianglelefteq: '⋬',
2373  ntriangleright: '⋫',
2374  ntrianglerighteq: '⋭',
2375  nu: 'ν',
2376  num: '#',
2377  numero: '№',
2378  numsp: ' ',
2379  nvDash: '⊭',
2380  nvHarr: '⤄',
2381  nvap: '≍⃒',
2382  nvdash: '⊬',
2383  nvge: '≥⃒',
2384  nvgt: '>⃒',
2385  nvinfin: '⧞',
2386  nvlArr: '⤂',
2387  nvle: '≤⃒',
2388  nvlt: '<⃒',
2389  nvltrie: '⊴⃒',
2390  nvrArr: '⤃',
2391  nvrtrie: '⊵⃒',
2392  nvsim: '∼⃒',
2393  nwArr: '⇖',
2394  nwarhk: '⤣',
2395  nwarr: '↖',
2396  nwarrow: '↖',
2397  nwnear: '⤧',
2398  oS: 'Ⓢ',
2399  oacute: 'ó',
2400  oast: '⊛',
2401  ocir: '⊚',
2402  ocirc: 'ô',
2403  ocy: 'о',
2404  odash: '⊝',
2405  odblac: 'ő',
2406  odiv: '⨸',
2407  odot: '⊙',
2408  odsold: '⦼',
2409  oelig: 'œ',
2410  ofcir: '⦿',
2411  ofr: '�',
2412  ogon: '˛',
2413  ograve: 'ò',
2414  ogt: '⧁',
2415  ohbar: '⦵',
2416  ohm: 'Ω',
2417  oint: '∮',
2418  olarr: '↺',
2419  olcir: '⦾',
2420  olcross: '⦻',
2421  oline: '‾',
2422  olt: '⧀',
2423  omacr: 'ō',
2424  omega: 'ω',
2425  omicron: 'ο',
2426  omid: '⦶',
2427  ominus: '⊖',
2428  oopf: '�',
2429  opar: '⦷',
2430  operp: '⦹',
2431  oplus: '⊕',
2432  or: '∨',
2433  orarr: '↻',
2434  ord: '⩝',
2435  order: 'ℴ',
2436  orderof: 'ℴ',
2437  ordf: 'ª',
2438  ordm: 'º',
2439  origof: '⊶',
2440  oror: '⩖',
2441  orslope: '⩗',
2442  orv: '⩛',
2443  oscr: 'ℴ',
2444  oslash: 'ø',
2445  osol: '⊘',
2446  otilde: 'õ',
2447  otimes: '⊗',
2448  otimesas: '⨶',
2449  ouml: 'ö',
2450  ovbar: '⌽',
2451  par: '∥',
2452  para: '¶',
2453  parallel: '∥',
2454  parsim: '⫳',
2455  parsl: '⫽',
2456  part: '∂',
2457  pcy: 'п',
2458  percnt: '%',
2459  period: '.',
2460  permil: '‰',
2461  perp: '⊥',
2462  pertenk: '‱',
2463  pfr: '�',
2464  phi: 'φ',
2465  phiv: 'ϕ',
2466  phmmat: 'ℳ',
2467  phone: '☎',
2468  pi: 'π',
2469  pitchfork: '⋔',
2470  piv: 'ϖ',
2471  planck: 'ℏ',
2472  planckh: 'ℎ',
2473  plankv: 'ℏ',
2474  plus: '+',
2475  plusacir: '⨣',
2476  plusb: '⊞',
2477  pluscir: '⨢',
2478  plusdo: '∔',
2479  plusdu: '⨥',
2480  pluse: '⩲',
2481  plusmn: '±',
2482  plussim: '⨦',
2483  plustwo: '⨧',
2484  pm: '±',
2485  pointint: '⨕',
2486  popf: '�',
2487  pound: '£',
2488  pr: '≺',
2489  prE: '⪳',
2490  prap: '⪷',
2491  prcue: '≼',
2492  pre: '⪯',
2493  prec: '≺',
2494  precapprox: '⪷',
2495  preccurlyeq: '≼',
2496  preceq: '⪯',
2497  precnapprox: '⪹',
2498  precneqq: '⪵',
2499  precnsim: '⋨',
2500  precsim: '≾',
2501  prime: '′',
2502  primes: 'ℙ',
2503  prnE: '⪵',
2504  prnap: '⪹',
2505  prnsim: '⋨',
2506  prod: '∏',
2507  profalar: '⌮',
2508  profline: '⌒',
2509  profsurf: '⌓',
2510  prop: '∝',
2511  propto: '∝',
2512  prsim: '≾',
2513  prurel: '⊰',
2514  pscr: '�',
2515  psi: 'ψ',
2516  puncsp: ' ',
2517  qfr: '�',
2518  qint: '⨌',
2519  qopf: '�',
2520  qprime: '⁗',
2521  qscr: '�',
2522  quaternions: 'ℍ',
2523  quatint: '⨖',
2524  quest: '?',
2525  questeq: '≟',
2526  quot: '"',
2527  rAarr: '⇛',
2528  rArr: '⇒',
2529  rAtail: '⤜',
2530  rBarr: '⤏',
2531  rHar: '⥤',
2532  race: '∽̱',
2533  racute: 'ŕ',
2534  radic: '√',
2535  raemptyv: '⦳',
2536  rang: '⟩',
2537  rangd: '⦒',
2538  range: '⦥',
2539  rangle: '⟩',
2540  raquo: '»',
2541  rarr: '→',
2542  rarrap: '⥵',
2543  rarrb: '⇥',
2544  rarrbfs: '⤠',
2545  rarrc: '⤳',
2546  rarrfs: '⤞',
2547  rarrhk: '↪',
2548  rarrlp: '↬',
2549  rarrpl: '⥅',
2550  rarrsim: '⥴',
2551  rarrtl: '↣',
2552  rarrw: '↝',
2553  ratail: '⤚',
2554  ratio: '∶',
2555  rationals: 'ℚ',
2556  rbarr: '⤍',
2557  rbbrk: '❳',
2558  rbrace: '}',
2559  rbrack: ']',
2560  rbrke: '⦌',
2561  rbrksld: '⦎',
2562  rbrkslu: '⦐',
2563  rcaron: 'ř',
2564  rcedil: 'ŗ',
2565  rceil: '⌉',
2566  rcub: '}',
2567  rcy: 'р',
2568  rdca: '⤷',
2569  rdldhar: '⥩',
2570  rdquo: '”',
2571  rdquor: '”',
2572  rdsh: '↳',
2573  real: 'ℜ',
2574  realine: 'ℛ',
2575  realpart: 'ℜ',
2576  reals: 'ℝ',
2577  rect: '▭',
2578  reg: '®',
2579  rfisht: '⥽',
2580  rfloor: '⌋',
2581  rfr: '�',
2582  rhard: '⇁',
2583  rharu: '⇀',
2584  rharul: '⥬',
2585  rho: 'ρ',
2586  rhov: 'ϱ',
2587  rightarrow: '→',
2588  rightarrowtail: '↣',
2589  rightharpoondown: '⇁',
2590  rightharpoonup: '⇀',
2591  rightleftarrows: '⇄',
2592  rightleftharpoons: '⇌',
2593  rightrightarrows: '⇉',
2594  rightsquigarrow: '↝',
2595  rightthreetimes: '⋌',
2596  ring: '˚',
2597  risingdotseq: '≓',
2598  rlarr: '⇄',
2599  rlhar: '⇌',
2600  rlm: '‏',
2601  rmoust: '⎱',
2602  rmoustache: '⎱',
2603  rnmid: '⫮',
2604  roang: '⟭',
2605  roarr: '⇾',
2606  robrk: '⟧',
2607  ropar: '⦆',
2608  ropf: '�',
2609  roplus: '⨮',
2610  rotimes: '⨵',
2611  rpar: ')',
2612  rpargt: '⦔',
2613  rppolint: '⨒',
2614  rrarr: '⇉',
2615  rsaquo: '›',
2616  rscr: '�',
2617  rsh: '↱',
2618  rsqb: ']',
2619  rsquo: '’',
2620  rsquor: '’',
2621  rthree: '⋌',
2622  rtimes: '⋊',
2623  rtri: '▹',
2624  rtrie: '⊵',
2625  rtrif: '▸',
2626  rtriltri: '⧎',
2627  ruluhar: '⥨',
2628  rx: '℞',
2629  sacute: 'ś',
2630  sbquo: '‚',
2631  sc: '≻',
2632  scE: '⪴',
2633  scap: '⪸',
2634  scaron: 'š',
2635  sccue: '≽',
2636  sce: '⪰',
2637  scedil: 'ş',
2638  scirc: 'ŝ',
2639  scnE: '⪶',
2640  scnap: '⪺',
2641  scnsim: '⋩',
2642  scpolint: '⨓',
2643  scsim: '≿',
2644  scy: 'с',
2645  sdot: '⋅',
2646  sdotb: '⊡',
2647  sdote: '⩦',
2648  seArr: '⇘',
2649  searhk: '⤥',
2650  searr: '↘',
2651  searrow: '↘',
2652  sect: '§',
2653  semi: ';',
2654  seswar: '⤩',
2655  setminus: '∖',
2656  setmn: '∖',
2657  sext: '✶',
2658  sfr: '�',
2659  sfrown: '⌢',
2660  sharp: '♯',
2661  shchcy: 'щ',
2662  shcy: 'ш',
2663  shortmid: '∣',
2664  shortparallel: '∥',
2665  shy: '­',
2666  sigma: 'σ',
2667  sigmaf: 'ς',
2668  sigmav: 'ς',
2669  sim: '∼',
2670  simdot: '⩪',
2671  sime: '≃',
2672  simeq: '≃',
2673  simg: '⪞',
2674  simgE: '⪠',
2675  siml: '⪝',
2676  simlE: '⪟',
2677  simne: '≆',
2678  simplus: '⨤',
2679  simrarr: '⥲',
2680  slarr: '←',
2681  smallsetminus: '∖',
2682  smashp: '⨳',
2683  smeparsl: '⧤',
2684  smid: '∣',
2685  smile: '⌣',
2686  smt: '⪪',
2687  smte: '⪬',
2688  smtes: '⪬︀',
2689  softcy: 'ь',
2690  sol: '/',
2691  solb: '⧄',
2692  solbar: '⌿',
2693  sopf: '�',
2694  spades: '♠',
2695  spadesuit: '♠',
2696  spar: '∥',
2697  sqcap: '⊓',
2698  sqcaps: '⊓︀',
2699  sqcup: '⊔',
2700  sqcups: '⊔︀',
2701  sqsub: '⊏',
2702  sqsube: '⊑',
2703  sqsubset: '⊏',
2704  sqsubseteq: '⊑',
2705  sqsup: '⊐',
2706  sqsupe: '⊒',
2707  sqsupset: '⊐',
2708  sqsupseteq: '⊒',
2709  squ: '□',
2710  square: '□',
2711  squarf: '▪',
2712  squf: '▪',
2713  srarr: '→',
2714  sscr: '�',
2715  ssetmn: '∖',
2716  ssmile: '⌣',
2717  sstarf: '⋆',
2718  star: '☆',
2719  starf: '★',
2720  straightepsilon: 'ϵ',
2721  straightphi: 'ϕ',
2722  strns: '¯',
2723  sub: '⊂',
2724  subE: '⫅',
2725  subdot: '⪽',
2726  sube: '⊆',
2727  subedot: '⫃',
2728  submult: '⫁',
2729  subnE: '⫋',
2730  subne: '⊊',
2731  subplus: '⪿',
2732  subrarr: '⥹',
2733  subset: '⊂',
2734  subseteq: '⊆',
2735  subseteqq: '⫅',
2736  subsetneq: '⊊',
2737  subsetneqq: '⫋',
2738  subsim: '⫇',
2739  subsub: '⫕',
2740  subsup: '⫓',
2741  succ: '≻',
2742  succapprox: '⪸',
2743  succcurlyeq: '≽',
2744  succeq: '⪰',
2745  succnapprox: '⪺',
2746  succneqq: '⪶',
2747  succnsim: '⋩',
2748  succsim: '≿',
2749  sum: '∑',
2750  sung: '♪',
2751  sup1: '¹',
2752  sup2: '²',
2753  sup3: '³',
2754  sup: '⊃',
2755  supE: '⫆',
2756  supdot: '⪾',
2757  supdsub: '⫘',
2758  supe: '⊇',
2759  supedot: '⫄',
2760  suphsol: '⟉',
2761  suphsub: '⫗',
2762  suplarr: '⥻',
2763  supmult: '⫂',
2764  supnE: '⫌',
2765  supne: '⊋',
2766  supplus: '⫀',
2767  supset: '⊃',
2768  supseteq: '⊇',
2769  supseteqq: '⫆',
2770  supsetneq: '⊋',
2771  supsetneqq: '⫌',
2772  supsim: '⫈',
2773  supsub: '⫔',
2774  supsup: '⫖',
2775  swArr: '⇙',
2776  swarhk: '⤦',
2777  swarr: '↙',
2778  swarrow: '↙',
2779  swnwar: '⤪',
2780  szlig: 'ß',
2781  target: '⌖',
2782  tau: 'τ',
2783  tbrk: '⎴',
2784  tcaron: 'ť',
2785  tcedil: 'ţ',
2786  tcy: 'т',
2787  tdot: '⃛',
2788  telrec: '⌕',
2789  tfr: '�',
2790  there4: '∴',
2791  therefore: '∴',
2792  theta: 'θ',
2793  thetasym: 'ϑ',
2794  thetav: 'ϑ',
2795  thickapprox: '≈',
2796  thicksim: '∼',
2797  thinsp: ' ',
2798  thkap: '≈',
2799  thksim: '∼',
2800  thorn: 'þ',
2801  tilde: '˜',
2802  times: '×',
2803  timesb: '⊠',
2804  timesbar: '⨱',
2805  timesd: '⨰',
2806  tint: '∭',
2807  toea: '⤨',
2808  top: '⊤',
2809  topbot: '⌶',
2810  topcir: '⫱',
2811  topf: '�',
2812  topfork: '⫚',
2813  tosa: '⤩',
2814  tprime: '‴',
2815  trade: '™',
2816  triangle: '▵',
2817  triangledown: '▿',
2818  triangleleft: '◃',
2819  trianglelefteq: '⊴',
2820  triangleq: '≜',
2821  triangleright: '▹',
2822  trianglerighteq: '⊵',
2823  tridot: '◬',
2824  trie: '≜',
2825  triminus: '⨺',
2826  triplus: '⨹',
2827  trisb: '⧍',
2828  tritime: '⨻',
2829  trpezium: '⏢',
2830  tscr: '�',
2831  tscy: 'ц',
2832  tshcy: 'ћ',
2833  tstrok: 'ŧ',
2834  twixt: '≬',
2835  twoheadleftarrow: '↞',
2836  twoheadrightarrow: '↠',
2837  uArr: '⇑',
2838  uHar: '⥣',
2839  uacute: 'ú',
2840  uarr: '↑',
2841  ubrcy: 'ў',
2842  ubreve: 'ŭ',
2843  ucirc: 'û',
2844  ucy: 'у',
2845  udarr: '⇅',
2846  udblac: 'ű',
2847  udhar: '⥮',
2848  ufisht: '⥾',
2849  ufr: '�',
2850  ugrave: 'ù',
2851  uharl: '↿',
2852  uharr: '↾',
2853  uhblk: '▀',
2854  ulcorn: '⌜',
2855  ulcorner: '⌜',
2856  ulcrop: '⌏',
2857  ultri: '◸',
2858  umacr: 'ū',
2859  uml: '¨',
2860  uogon: 'ų',
2861  uopf: '�',
2862  uparrow: '↑',
2863  updownarrow: '↕',
2864  upharpoonleft: '↿',
2865  upharpoonright: '↾',
2866  uplus: '⊎',
2867  upsi: 'υ',
2868  upsih: 'ϒ',
2869  upsilon: 'υ',
2870  upuparrows: '⇈',
2871  urcorn: '⌝',
2872  urcorner: '⌝',
2873  urcrop: '⌎',
2874  uring: 'ů',
2875  urtri: '◹',
2876  uscr: '�',
2877  utdot: '⋰',
2878  utilde: 'ũ',
2879  utri: '▵',
2880  utrif: '▴',
2881  uuarr: '⇈',
2882  uuml: 'ü',
2883  uwangle: '⦧',
2884  vArr: '⇕',
2885  vBar: '⫨',
2886  vBarv: '⫩',
2887  vDash: '⊨',
2888  vangrt: '⦜',
2889  varepsilon: 'ϵ',
2890  varkappa: 'ϰ',
2891  varnothing: '∅',
2892  varphi: 'ϕ',
2893  varpi: 'ϖ',
2894  varpropto: '∝',
2895  varr: '↕',
2896  varrho: 'ϱ',
2897  varsigma: 'ς',
2898  varsubsetneq: '⊊︀',
2899  varsubsetneqq: '⫋︀',
2900  varsupsetneq: '⊋︀',
2901  varsupsetneqq: '⫌︀',
2902  vartheta: 'ϑ',
2903  vartriangleleft: '⊲',
2904  vartriangleright: '⊳',
2905  vcy: 'в',
2906  vdash: '⊢',
2907  vee: '∨',
2908  veebar: '⊻',
2909  veeeq: '≚',
2910  vellip: '⋮',
2911  verbar: '|',
2912  vert: '|',
2913  vfr: '�',
2914  vltri: '⊲',
2915  vnsub: '⊂⃒',
2916  vnsup: '⊃⃒',
2917  vopf: '�',
2918  vprop: '∝',
2919  vrtri: '⊳',
2920  vscr: '�',
2921  vsubnE: '⫋︀',
2922  vsubne: '⊊︀',
2923  vsupnE: '⫌︀',
2924  vsupne: '⊋︀',
2925  vzigzag: '⦚',
2926  wcirc: 'ŵ',
2927  wedbar: '⩟',
2928  wedge: '∧',
2929  wedgeq: '≙',
2930  weierp: '℘',
2931  wfr: '�',
2932  wopf: '�',
2933  wp: '℘',
2934  wr: '≀',
2935  wreath: '≀',
2936  wscr: '�',
2937  xcap: '⋂',
2938  xcirc: '◯',
2939  xcup: '⋃',
2940  xdtri: '▽',
2941  xfr: '�',
2942  xhArr: '⟺',
2943  xharr: '⟷',
2944  xi: 'ξ',
2945  xlArr: '⟸',
2946  xlarr: '⟵',
2947  xmap: '⟼',
2948  xnis: '⋻',
2949  xodot: '⨀',
2950  xopf: '�',
2951  xoplus: '⨁',
2952  xotime: '⨂',
2953  xrArr: '⟹',
2954  xrarr: '⟶',
2955  xscr: '�',
2956  xsqcup: '⨆',
2957  xuplus: '⨄',
2958  xutri: '△',
2959  xvee: '⋁',
2960  xwedge: '⋀',
2961  yacute: 'ý',
2962  yacy: 'я',
2963  ycirc: 'ŷ',
2964  ycy: 'ы',
2965  yen: '¥',
2966  yfr: '�',
2967  yicy: 'ї',
2968  yopf: '�',
2969  yscr: '�',
2970  yucy: 'ю',
2971  yuml: 'ÿ',
2972  zacute: 'ź',
2973  zcaron: 'ž',
2974  zcy: 'з',
2975  zdot: 'ż',
2976  zeetrf: 'ℨ',
2977  zeta: 'ζ',
2978  zfr: '�',
2979  zhcy: 'ж',
2980  zigrarr: '⇝',
2981  zopf: '�',
2982  zscr: '�',
2983  zwj: '‍',
2984  zwnj: '‌'
2985};
2986
2987const own$5 = {}.hasOwnProperty;
2988function decodeNamedCharacterReference(value) {
2989  return own$5.call(characterEntities, value) ? characterEntities[value] : false
2990}
2991
2992function splice(list, start, remove, items) {
2993  const end = list.length;
2994  let chunkStart = 0;
2995  let parameters;
2996  if (start < 0) {
2997    start = -start > end ? 0 : end + start;
2998  } else {
2999    start = start > end ? end : start;
3000  }
3001  remove = remove > 0 ? remove : 0;
3002  if (items.length < 10000) {
3003    parameters = Array.from(items);
3004    parameters.unshift(start, remove);
3005    list.splice(...parameters);
3006  } else {
3007    if (remove) list.splice(start, remove);
3008    while (chunkStart < items.length) {
3009      parameters = items.slice(chunkStart, chunkStart + 10000);
3010      parameters.unshift(start, 0);
3011      list.splice(...parameters);
3012      chunkStart += 10000;
3013      start += 10000;
3014    }
3015  }
3016}
3017function push(list, items) {
3018  if (list.length > 0) {
3019    splice(list, list.length, 0, items);
3020    return list
3021  }
3022  return items
3023}
3024
3025const hasOwnProperty = {}.hasOwnProperty;
3026function combineExtensions(extensions) {
3027  const all = {};
3028  let index = -1;
3029  while (++index < extensions.length) {
3030    syntaxExtension(all, extensions[index]);
3031  }
3032  return all
3033}
3034function syntaxExtension(all, extension) {
3035  let hook;
3036  for (hook in extension) {
3037    const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined;
3038    const left = maybe || (all[hook] = {});
3039    const right = extension[hook];
3040    let code;
3041    if (right) {
3042      for (code in right) {
3043        if (!hasOwnProperty.call(left, code)) left[code] = [];
3044        const value = right[code];
3045        constructs(
3046          left[code],
3047          Array.isArray(value) ? value : value ? [value] : []
3048        );
3049      }
3050    }
3051  }
3052}
3053function constructs(existing, list) {
3054  let index = -1;
3055  const before = [];
3056  while (++index < list.length) {
3057(list[index].add === 'after' ? existing : before).push(list[index]);
3058  }
3059  splice(existing, 0, 0, before);
3060}
3061
3062function decodeNumericCharacterReference(value, base) {
3063  const code = Number.parseInt(value, base);
3064  if (
3065    code < 9 ||
3066    code === 11 ||
3067    (code > 13 && code < 32) ||
3068    (code > 126 && code < 160) ||
3069    (code > 55_295 && code < 57_344) ||
3070    (code > 64_975 && code < 65_008)  ||
3071    (code & 65_535) === 65_535 ||
3072    (code & 65_535) === 65_534  ||
3073    code > 1_114_111
3074  ) {
3075    return '\uFFFD'
3076  }
3077  return String.fromCharCode(code)
3078}
3079
3080function normalizeIdentifier$1(value) {
3081  return (
3082    value
3083      .replace(/[\t\n\r ]+/g, ' ')
3084      .replace(/^ | $/g, '')
3085      .toLowerCase()
3086      .toUpperCase()
3087  )
3088}
3089
3090const unicodePunctuationInternal = regexCheck(/\p{P}/u);
3091const asciiAlpha = regexCheck(/[A-Za-z]/);
3092const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
3093const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
3094function asciiControl(code) {
3095  return (
3096    code !== null && (code < 32 || code === 127)
3097  )
3098}
3099const asciiDigit = regexCheck(/\d/);
3100const asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
3101const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
3102function markdownLineEnding(code) {
3103  return code !== null && code < -2
3104}
3105function markdownLineEndingOrSpace(code) {
3106  return code !== null && (code < 0 || code === 32)
3107}
3108function markdownSpace(code) {
3109  return code === -2 || code === -1 || code === 32
3110}
3111function unicodePunctuation(code) {
3112  return asciiPunctuation(code) || unicodePunctuationInternal(code)
3113}
3114const unicodeWhitespace = regexCheck(/\s/);
3115function regexCheck(regex) {
3116  return check
3117  function check(code) {
3118    return code !== null && code > -1 && regex.test(String.fromCharCode(code))
3119  }
3120}
3121
3122function factorySpace(effects, ok, type, max) {
3123  const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
3124  let size = 0;
3125  return start
3126  function start(code) {
3127    if (markdownSpace(code)) {
3128      effects.enter(type);
3129      return prefix(code)
3130    }
3131    return ok(code)
3132  }
3133  function prefix(code) {
3134    if (markdownSpace(code) && size++ < limit) {
3135      effects.consume(code);
3136      return prefix
3137    }
3138    effects.exit(type);
3139    return ok(code)
3140  }
3141}
3142
3143const content$1 = {
3144  tokenize: initializeContent
3145};
3146function initializeContent(effects) {
3147  const contentStart = effects.attempt(
3148    this.parser.constructs.contentInitial,
3149    afterContentStartConstruct,
3150    paragraphInitial
3151  );
3152  let previous;
3153  return contentStart
3154  function afterContentStartConstruct(code) {
3155    if (code === null) {
3156      effects.consume(code);
3157      return
3158    }
3159    effects.enter('lineEnding');
3160    effects.consume(code);
3161    effects.exit('lineEnding');
3162    return factorySpace(effects, contentStart, 'linePrefix')
3163  }
3164  function paragraphInitial(code) {
3165    effects.enter('paragraph');
3166    return lineStart(code)
3167  }
3168  function lineStart(code) {
3169    const token = effects.enter('chunkText', {
3170      contentType: 'text',
3171      previous
3172    });
3173    if (previous) {
3174      previous.next = token;
3175    }
3176    previous = token;
3177    return data(code)
3178  }
3179  function data(code) {
3180    if (code === null) {
3181      effects.exit('chunkText');
3182      effects.exit('paragraph');
3183      effects.consume(code);
3184      return
3185    }
3186    if (markdownLineEnding(code)) {
3187      effects.consume(code);
3188      effects.exit('chunkText');
3189      return lineStart
3190    }
3191    effects.consume(code);
3192    return data
3193  }
3194}
3195
3196const document$1 = {
3197  tokenize: initializeDocument
3198};
3199const containerConstruct = {
3200  tokenize: tokenizeContainer
3201};
3202function initializeDocument(effects) {
3203  const self = this;
3204  const stack = [];
3205  let continued = 0;
3206  let childFlow;
3207  let childToken;
3208  let lineStartOffset;
3209  return start
3210  function start(code) {
3211    if (continued < stack.length) {
3212      const item = stack[continued];
3213      self.containerState = item[1];
3214      return effects.attempt(
3215        item[0].continuation,
3216        documentContinue,
3217        checkNewContainers
3218      )(code)
3219    }
3220    return checkNewContainers(code)
3221  }
3222  function documentContinue(code) {
3223    continued++;
3224    if (self.containerState._closeFlow) {
3225      self.containerState._closeFlow = undefined;
3226      if (childFlow) {
3227        closeFlow();
3228      }
3229      const indexBeforeExits = self.events.length;
3230      let indexBeforeFlow = indexBeforeExits;
3231      let point;
3232      while (indexBeforeFlow--) {
3233        if (
3234          self.events[indexBeforeFlow][0] === 'exit' &&
3235          self.events[indexBeforeFlow][1].type === 'chunkFlow'
3236        ) {
3237          point = self.events[indexBeforeFlow][1].end;
3238          break
3239        }
3240      }
3241      exitContainers(continued);
3242      let index = indexBeforeExits;
3243      while (index < self.events.length) {
3244        self.events[index][1].end = Object.assign({}, point);
3245        index++;
3246      }
3247      splice(
3248        self.events,
3249        indexBeforeFlow + 1,
3250        0,
3251        self.events.slice(indexBeforeExits)
3252      );
3253      self.events.length = index;
3254      return checkNewContainers(code)
3255    }
3256    return start(code)
3257  }
3258  function checkNewContainers(code) {
3259    if (continued === stack.length) {
3260      if (!childFlow) {
3261        return documentContinued(code)
3262      }
3263      if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
3264        return flowStart(code)
3265      }
3266      self.interrupt = Boolean(
3267        childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack
3268      );
3269    }
3270    self.containerState = {};
3271    return effects.check(
3272      containerConstruct,
3273      thereIsANewContainer,
3274      thereIsNoNewContainer
3275    )(code)
3276  }
3277  function thereIsANewContainer(code) {
3278    if (childFlow) closeFlow();
3279    exitContainers(continued);
3280    return documentContinued(code)
3281  }
3282  function thereIsNoNewContainer(code) {
3283    self.parser.lazy[self.now().line] = continued !== stack.length;
3284    lineStartOffset = self.now().offset;
3285    return flowStart(code)
3286  }
3287  function documentContinued(code) {
3288    self.containerState = {};
3289    return effects.attempt(
3290      containerConstruct,
3291      containerContinue,
3292      flowStart
3293    )(code)
3294  }
3295  function containerContinue(code) {
3296    continued++;
3297    stack.push([self.currentConstruct, self.containerState]);
3298    return documentContinued(code)
3299  }
3300  function flowStart(code) {
3301    if (code === null) {
3302      if (childFlow) closeFlow();
3303      exitContainers(0);
3304      effects.consume(code);
3305      return
3306    }
3307    childFlow = childFlow || self.parser.flow(self.now());
3308    effects.enter('chunkFlow', {
3309      contentType: 'flow',
3310      previous: childToken,
3311      _tokenizer: childFlow
3312    });
3313    return flowContinue(code)
3314  }
3315  function flowContinue(code) {
3316    if (code === null) {
3317      writeToChild(effects.exit('chunkFlow'), true);
3318      exitContainers(0);
3319      effects.consume(code);
3320      return
3321    }
3322    if (markdownLineEnding(code)) {
3323      effects.consume(code);
3324      writeToChild(effects.exit('chunkFlow'));
3325      continued = 0;
3326      self.interrupt = undefined;
3327      return start
3328    }
3329    effects.consume(code);
3330    return flowContinue
3331  }
3332  function writeToChild(token, eof) {
3333    const stream = self.sliceStream(token);
3334    if (eof) stream.push(null);
3335    token.previous = childToken;
3336    if (childToken) childToken.next = token;
3337    childToken = token;
3338    childFlow.defineSkip(token.start);
3339    childFlow.write(stream);
3340    if (self.parser.lazy[token.start.line]) {
3341      let index = childFlow.events.length;
3342      while (index--) {
3343        if (
3344          childFlow.events[index][1].start.offset < lineStartOffset &&
3345          (!childFlow.events[index][1].end ||
3346            childFlow.events[index][1].end.offset > lineStartOffset)
3347        ) {
3348          return
3349        }
3350      }
3351      const indexBeforeExits = self.events.length;
3352      let indexBeforeFlow = indexBeforeExits;
3353      let seen;
3354      let point;
3355      while (indexBeforeFlow--) {
3356        if (
3357          self.events[indexBeforeFlow][0] === 'exit' &&
3358          self.events[indexBeforeFlow][1].type === 'chunkFlow'
3359        ) {
3360          if (seen) {
3361            point = self.events[indexBeforeFlow][1].end;
3362            break
3363          }
3364          seen = true;
3365        }
3366      }
3367      exitContainers(continued);
3368      index = indexBeforeExits;
3369      while (index < self.events.length) {
3370        self.events[index][1].end = Object.assign({}, point);
3371        index++;
3372      }
3373      splice(
3374        self.events,
3375        indexBeforeFlow + 1,
3376        0,
3377        self.events.slice(indexBeforeExits)
3378      );
3379      self.events.length = index;
3380    }
3381  }
3382  function exitContainers(size) {
3383    let index = stack.length;
3384    while (index-- > size) {
3385      const entry = stack[index];
3386      self.containerState = entry[1];
3387      entry[0].exit.call(self, effects);
3388    }
3389    stack.length = size;
3390  }
3391  function closeFlow() {
3392    childFlow.write([null]);
3393    childToken = undefined;
3394    childFlow = undefined;
3395    self.containerState._closeFlow = undefined;
3396  }
3397}
3398function tokenizeContainer(effects, ok, nok) {
3399  return factorySpace(
3400    effects,
3401    effects.attempt(this.parser.constructs.document, ok, nok),
3402    'linePrefix',
3403    this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4
3404  )
3405}
3406
3407function classifyCharacter(code) {
3408  if (
3409    code === null ||
3410    markdownLineEndingOrSpace(code) ||
3411    unicodeWhitespace(code)
3412  ) {
3413    return 1
3414  }
3415  if (unicodePunctuation(code)) {
3416    return 2
3417  }
3418}
3419
3420function resolveAll(constructs, events, context) {
3421  const called = [];
3422  let index = -1;
3423  while (++index < constructs.length) {
3424    const resolve = constructs[index].resolveAll;
3425    if (resolve && !called.includes(resolve)) {
3426      events = resolve(events, context);
3427      called.push(resolve);
3428    }
3429  }
3430  return events
3431}
3432
3433const attention = {
3434  name: 'attention',
3435  tokenize: tokenizeAttention,
3436  resolveAll: resolveAllAttention
3437};
3438function resolveAllAttention(events, context) {
3439  let index = -1;
3440  let open;
3441  let group;
3442  let text;
3443  let openingSequence;
3444  let closingSequence;
3445  let use;
3446  let nextEvents;
3447  let offset;
3448  while (++index < events.length) {
3449    if (
3450      events[index][0] === 'enter' &&
3451      events[index][1].type === 'attentionSequence' &&
3452      events[index][1]._close
3453    ) {
3454      open = index;
3455      while (open--) {
3456        if (
3457          events[open][0] === 'exit' &&
3458          events[open][1].type === 'attentionSequence' &&
3459          events[open][1]._open &&
3460          context.sliceSerialize(events[open][1]).charCodeAt(0) ===
3461            context.sliceSerialize(events[index][1]).charCodeAt(0)
3462        ) {
3463          if (
3464            (events[open][1]._close || events[index][1]._open) &&
3465            (events[index][1].end.offset - events[index][1].start.offset) % 3 &&
3466            !(
3467              (events[open][1].end.offset -
3468                events[open][1].start.offset +
3469                events[index][1].end.offset -
3470                events[index][1].start.offset) %
3471              3
3472            )
3473          ) {
3474            continue
3475          }
3476          use =
3477            events[open][1].end.offset - events[open][1].start.offset > 1 &&
3478            events[index][1].end.offset - events[index][1].start.offset > 1
3479              ? 2
3480              : 1;
3481          const start = Object.assign({}, events[open][1].end);
3482          const end = Object.assign({}, events[index][1].start);
3483          movePoint(start, -use);
3484          movePoint(end, use);
3485          openingSequence = {
3486            type: use > 1 ? 'strongSequence' : 'emphasisSequence',
3487            start,
3488            end: Object.assign({}, events[open][1].end)
3489          };
3490          closingSequence = {
3491            type: use > 1 ? 'strongSequence' : 'emphasisSequence',
3492            start: Object.assign({}, events[index][1].start),
3493            end
3494          };
3495          text = {
3496            type: use > 1 ? 'strongText' : 'emphasisText',
3497            start: Object.assign({}, events[open][1].end),
3498            end: Object.assign({}, events[index][1].start)
3499          };
3500          group = {
3501            type: use > 1 ? 'strong' : 'emphasis',
3502            start: Object.assign({}, openingSequence.start),
3503            end: Object.assign({}, closingSequence.end)
3504          };
3505          events[open][1].end = Object.assign({}, openingSequence.start);
3506          events[index][1].start = Object.assign({}, closingSequence.end);
3507          nextEvents = [];
3508          if (events[open][1].end.offset - events[open][1].start.offset) {
3509            nextEvents = push(nextEvents, [
3510              ['enter', events[open][1], context],
3511              ['exit', events[open][1], context]
3512            ]);
3513          }
3514          nextEvents = push(nextEvents, [
3515            ['enter', group, context],
3516            ['enter', openingSequence, context],
3517            ['exit', openingSequence, context],
3518            ['enter', text, context]
3519          ]);
3520          nextEvents = push(
3521            nextEvents,
3522            resolveAll(
3523              context.parser.constructs.insideSpan.null,
3524              events.slice(open + 1, index),
3525              context
3526            )
3527          );
3528          nextEvents = push(nextEvents, [
3529            ['exit', text, context],
3530            ['enter', closingSequence, context],
3531            ['exit', closingSequence, context],
3532            ['exit', group, context]
3533          ]);
3534          if (events[index][1].end.offset - events[index][1].start.offset) {
3535            offset = 2;
3536            nextEvents = push(nextEvents, [
3537              ['enter', events[index][1], context],
3538              ['exit', events[index][1], context]
3539            ]);
3540          } else {
3541            offset = 0;
3542          }
3543          splice(events, open - 1, index - open + 3, nextEvents);
3544          index = open + nextEvents.length - offset - 2;
3545          break
3546        }
3547      }
3548    }
3549  }
3550  index = -1;
3551  while (++index < events.length) {
3552    if (events[index][1].type === 'attentionSequence') {
3553      events[index][1].type = 'data';
3554    }
3555  }
3556  return events
3557}
3558function tokenizeAttention(effects, ok) {
3559  const attentionMarkers = this.parser.constructs.attentionMarkers.null;
3560  const previous = this.previous;
3561  const before = classifyCharacter(previous);
3562  let marker;
3563  return start
3564  function start(code) {
3565    marker = code;
3566    effects.enter('attentionSequence');
3567    return inside(code)
3568  }
3569  function inside(code) {
3570    if (code === marker) {
3571      effects.consume(code);
3572      return inside
3573    }
3574    const token = effects.exit('attentionSequence');
3575    const after = classifyCharacter(code);
3576    const open =
3577      !after || (after === 2 && before) || attentionMarkers.includes(code);
3578    const close =
3579      !before || (before === 2 && after) || attentionMarkers.includes(previous);
3580    token._open = Boolean(marker === 42 ? open : open && (before || !close));
3581    token._close = Boolean(marker === 42 ? close : close && (after || !open));
3582    return ok(code)
3583  }
3584}
3585function movePoint(point, offset) {
3586  point.column += offset;
3587  point.offset += offset;
3588  point._bufferIndex += offset;
3589}
3590
3591const autolink = {
3592  name: 'autolink',
3593  tokenize: tokenizeAutolink
3594};
3595function tokenizeAutolink(effects, ok, nok) {
3596  let size = 0;
3597  return start
3598  function start(code) {
3599    effects.enter('autolink');
3600    effects.enter('autolinkMarker');
3601    effects.consume(code);
3602    effects.exit('autolinkMarker');
3603    effects.enter('autolinkProtocol');
3604    return open
3605  }
3606  function open(code) {
3607    if (asciiAlpha(code)) {
3608      effects.consume(code);
3609      return schemeOrEmailAtext
3610    }
3611    return emailAtext(code)
3612  }
3613  function schemeOrEmailAtext(code) {
3614    if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {
3615      size = 1;
3616      return schemeInsideOrEmailAtext(code)
3617    }
3618    return emailAtext(code)
3619  }
3620  function schemeInsideOrEmailAtext(code) {
3621    if (code === 58) {
3622      effects.consume(code);
3623      size = 0;
3624      return urlInside
3625    }
3626    if (
3627      (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) &&
3628      size++ < 32
3629    ) {
3630      effects.consume(code);
3631      return schemeInsideOrEmailAtext
3632    }
3633    size = 0;
3634    return emailAtext(code)
3635  }
3636  function urlInside(code) {
3637    if (code === 62) {
3638      effects.exit('autolinkProtocol');
3639      effects.enter('autolinkMarker');
3640      effects.consume(code);
3641      effects.exit('autolinkMarker');
3642      effects.exit('autolink');
3643      return ok
3644    }
3645    if (code === null || code === 32 || code === 60 || asciiControl(code)) {
3646      return nok(code)
3647    }
3648    effects.consume(code);
3649    return urlInside
3650  }
3651  function emailAtext(code) {
3652    if (code === 64) {
3653      effects.consume(code);
3654      return emailAtSignOrDot
3655    }
3656    if (asciiAtext(code)) {
3657      effects.consume(code);
3658      return emailAtext
3659    }
3660    return nok(code)
3661  }
3662  function emailAtSignOrDot(code) {
3663    return asciiAlphanumeric(code) ? emailLabel(code) : nok(code)
3664  }
3665  function emailLabel(code) {
3666    if (code === 46) {
3667      effects.consume(code);
3668      size = 0;
3669      return emailAtSignOrDot
3670    }
3671    if (code === 62) {
3672      effects.exit('autolinkProtocol').type = 'autolinkEmail';
3673      effects.enter('autolinkMarker');
3674      effects.consume(code);
3675      effects.exit('autolinkMarker');
3676      effects.exit('autolink');
3677      return ok
3678    }
3679    return emailValue(code)
3680  }
3681  function emailValue(code) {
3682    if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {
3683      const next = code === 45 ? emailValue : emailLabel;
3684      effects.consume(code);
3685      return next
3686    }
3687    return nok(code)
3688  }
3689}
3690
3691const blankLine = {
3692  tokenize: tokenizeBlankLine,
3693  partial: true
3694};
3695function tokenizeBlankLine(effects, ok, nok) {
3696  return start
3697  function start(code) {
3698    return markdownSpace(code)
3699      ? factorySpace(effects, after, 'linePrefix')(code)
3700      : after(code)
3701  }
3702  function after(code) {
3703    return code === null || markdownLineEnding(code) ? ok(code) : nok(code)
3704  }
3705}
3706
3707const blockQuote = {
3708  name: 'blockQuote',
3709  tokenize: tokenizeBlockQuoteStart,
3710  continuation: {
3711    tokenize: tokenizeBlockQuoteContinuation
3712  },
3713  exit: exit$1
3714};
3715function tokenizeBlockQuoteStart(effects, ok, nok) {
3716  const self = this;
3717  return start
3718  function start(code) {
3719    if (code === 62) {
3720      const state = self.containerState;
3721      if (!state.open) {
3722        effects.enter('blockQuote', {
3723          _container: true
3724        });
3725        state.open = true;
3726      }
3727      effects.enter('blockQuotePrefix');
3728      effects.enter('blockQuoteMarker');
3729      effects.consume(code);
3730      effects.exit('blockQuoteMarker');
3731      return after
3732    }
3733    return nok(code)
3734  }
3735  function after(code) {
3736    if (markdownSpace(code)) {
3737      effects.enter('blockQuotePrefixWhitespace');
3738      effects.consume(code);
3739      effects.exit('blockQuotePrefixWhitespace');
3740      effects.exit('blockQuotePrefix');
3741      return ok
3742    }
3743    effects.exit('blockQuotePrefix');
3744    return ok(code)
3745  }
3746}
3747function tokenizeBlockQuoteContinuation(effects, ok, nok) {
3748  const self = this;
3749  return contStart
3750  function contStart(code) {
3751    if (markdownSpace(code)) {
3752      return factorySpace(
3753        effects,
3754        contBefore,
3755        'linePrefix',
3756        self.parser.constructs.disable.null.includes('codeIndented')
3757          ? undefined
3758          : 4
3759      )(code)
3760    }
3761    return contBefore(code)
3762  }
3763  function contBefore(code) {
3764    return effects.attempt(blockQuote, ok, nok)(code)
3765  }
3766}
3767function exit$1(effects) {
3768  effects.exit('blockQuote');
3769}
3770
3771const characterEscape = {
3772  name: 'characterEscape',
3773  tokenize: tokenizeCharacterEscape
3774};
3775function tokenizeCharacterEscape(effects, ok, nok) {
3776  return start
3777  function start(code) {
3778    effects.enter('characterEscape');
3779    effects.enter('escapeMarker');
3780    effects.consume(code);
3781    effects.exit('escapeMarker');
3782    return inside
3783  }
3784  function inside(code) {
3785    if (asciiPunctuation(code)) {
3786      effects.enter('characterEscapeValue');
3787      effects.consume(code);
3788      effects.exit('characterEscapeValue');
3789      effects.exit('characterEscape');
3790      return ok
3791    }
3792    return nok(code)
3793  }
3794}
3795
3796const characterReference = {
3797  name: 'characterReference',
3798  tokenize: tokenizeCharacterReference
3799};
3800function tokenizeCharacterReference(effects, ok, nok) {
3801  const self = this;
3802  let size = 0;
3803  let max;
3804  let test;
3805  return start
3806  function start(code) {
3807    effects.enter('characterReference');
3808    effects.enter('characterReferenceMarker');
3809    effects.consume(code);
3810    effects.exit('characterReferenceMarker');
3811    return open
3812  }
3813  function open(code) {
3814    if (code === 35) {
3815      effects.enter('characterReferenceMarkerNumeric');
3816      effects.consume(code);
3817      effects.exit('characterReferenceMarkerNumeric');
3818      return numeric
3819    }
3820    effects.enter('characterReferenceValue');
3821    max = 31;
3822    test = asciiAlphanumeric;
3823    return value(code)
3824  }
3825  function numeric(code) {
3826    if (code === 88 || code === 120) {
3827      effects.enter('characterReferenceMarkerHexadecimal');
3828      effects.consume(code);
3829      effects.exit('characterReferenceMarkerHexadecimal');
3830      effects.enter('characterReferenceValue');
3831      max = 6;
3832      test = asciiHexDigit;
3833      return value
3834    }
3835    effects.enter('characterReferenceValue');
3836    max = 7;
3837    test = asciiDigit;
3838    return value(code)
3839  }
3840  function value(code) {
3841    if (code === 59 && size) {
3842      const token = effects.exit('characterReferenceValue');
3843      if (
3844        test === asciiAlphanumeric &&
3845        !decodeNamedCharacterReference(self.sliceSerialize(token))
3846      ) {
3847        return nok(code)
3848      }
3849      effects.enter('characterReferenceMarker');
3850      effects.consume(code);
3851      effects.exit('characterReferenceMarker');
3852      effects.exit('characterReference');
3853      return ok
3854    }
3855    if (test(code) && size++ < max) {
3856      effects.consume(code);
3857      return value
3858    }
3859    return nok(code)
3860  }
3861}
3862
3863const nonLazyContinuation = {
3864  tokenize: tokenizeNonLazyContinuation,
3865  partial: true
3866};
3867const codeFenced = {
3868  name: 'codeFenced',
3869  tokenize: tokenizeCodeFenced,
3870  concrete: true
3871};
3872function tokenizeCodeFenced(effects, ok, nok) {
3873  const self = this;
3874  const closeStart = {
3875    tokenize: tokenizeCloseStart,
3876    partial: true
3877  };
3878  let initialPrefix = 0;
3879  let sizeOpen = 0;
3880  let marker;
3881  return start
3882  function start(code) {
3883    return beforeSequenceOpen(code)
3884  }
3885  function beforeSequenceOpen(code) {
3886    const tail = self.events[self.events.length - 1];
3887    initialPrefix =
3888      tail && tail[1].type === 'linePrefix'
3889        ? tail[2].sliceSerialize(tail[1], true).length
3890        : 0;
3891    marker = code;
3892    effects.enter('codeFenced');
3893    effects.enter('codeFencedFence');
3894    effects.enter('codeFencedFenceSequence');
3895    return sequenceOpen(code)
3896  }
3897  function sequenceOpen(code) {
3898    if (code === marker) {
3899      sizeOpen++;
3900      effects.consume(code);
3901      return sequenceOpen
3902    }
3903    if (sizeOpen < 3) {
3904      return nok(code)
3905    }
3906    effects.exit('codeFencedFenceSequence');
3907    return markdownSpace(code)
3908      ? factorySpace(effects, infoBefore, 'whitespace')(code)
3909      : infoBefore(code)
3910  }
3911  function infoBefore(code) {
3912    if (code === null || markdownLineEnding(code)) {
3913      effects.exit('codeFencedFence');
3914      return self.interrupt
3915        ? ok(code)
3916        : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)
3917    }
3918    effects.enter('codeFencedFenceInfo');
3919    effects.enter('chunkString', {
3920      contentType: 'string'
3921    });
3922    return info(code)
3923  }
3924  function info(code) {
3925    if (code === null || markdownLineEnding(code)) {
3926      effects.exit('chunkString');
3927      effects.exit('codeFencedFenceInfo');
3928      return infoBefore(code)
3929    }
3930    if (markdownSpace(code)) {
3931      effects.exit('chunkString');
3932      effects.exit('codeFencedFenceInfo');
3933      return factorySpace(effects, metaBefore, 'whitespace')(code)
3934    }
3935    if (code === 96 && code === marker) {
3936      return nok(code)
3937    }
3938    effects.consume(code);
3939    return info
3940  }
3941  function metaBefore(code) {
3942    if (code === null || markdownLineEnding(code)) {
3943      return infoBefore(code)
3944    }
3945    effects.enter('codeFencedFenceMeta');
3946    effects.enter('chunkString', {
3947      contentType: 'string'
3948    });
3949    return meta(code)
3950  }
3951  function meta(code) {
3952    if (code === null || markdownLineEnding(code)) {
3953      effects.exit('chunkString');
3954      effects.exit('codeFencedFenceMeta');
3955      return infoBefore(code)
3956    }
3957    if (code === 96 && code === marker) {
3958      return nok(code)
3959    }
3960    effects.consume(code);
3961    return meta
3962  }
3963  function atNonLazyBreak(code) {
3964    return effects.attempt(closeStart, after, contentBefore)(code)
3965  }
3966  function contentBefore(code) {
3967    effects.enter('lineEnding');
3968    effects.consume(code);
3969    effects.exit('lineEnding');
3970    return contentStart
3971  }
3972  function contentStart(code) {
3973    return initialPrefix > 0 && markdownSpace(code)
3974      ? factorySpace(
3975          effects,
3976          beforeContentChunk,
3977          'linePrefix',
3978          initialPrefix + 1
3979        )(code)
3980      : beforeContentChunk(code)
3981  }
3982  function beforeContentChunk(code) {
3983    if (code === null || markdownLineEnding(code)) {
3984      return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)
3985    }
3986    effects.enter('codeFlowValue');
3987    return contentChunk(code)
3988  }
3989  function contentChunk(code) {
3990    if (code === null || markdownLineEnding(code)) {
3991      effects.exit('codeFlowValue');
3992      return beforeContentChunk(code)
3993    }
3994    effects.consume(code);
3995    return contentChunk
3996  }
3997  function after(code) {
3998    effects.exit('codeFenced');
3999    return ok(code)
4000  }
4001  function tokenizeCloseStart(effects, ok, nok) {
4002    let size = 0;
4003    return startBefore
4004    function startBefore(code) {
4005      effects.enter('lineEnding');
4006      effects.consume(code);
4007      effects.exit('lineEnding');
4008      return start
4009    }
4010    function start(code) {
4011      effects.enter('codeFencedFence');
4012      return markdownSpace(code)
4013        ? factorySpace(
4014            effects,
4015            beforeSequenceClose,
4016            'linePrefix',
4017            self.parser.constructs.disable.null.includes('codeIndented')
4018              ? undefined
4019              : 4
4020          )(code)
4021        : beforeSequenceClose(code)
4022    }
4023    function beforeSequenceClose(code) {
4024      if (code === marker) {
4025        effects.enter('codeFencedFenceSequence');
4026        return sequenceClose(code)
4027      }
4028      return nok(code)
4029    }
4030    function sequenceClose(code) {
4031      if (code === marker) {
4032        size++;
4033        effects.consume(code);
4034        return sequenceClose
4035      }
4036      if (size >= sizeOpen) {
4037        effects.exit('codeFencedFenceSequence');
4038        return markdownSpace(code)
4039          ? factorySpace(effects, sequenceCloseAfter, 'whitespace')(code)
4040          : sequenceCloseAfter(code)
4041      }
4042      return nok(code)
4043    }
4044    function sequenceCloseAfter(code) {
4045      if (code === null || markdownLineEnding(code)) {
4046        effects.exit('codeFencedFence');
4047        return ok(code)
4048      }
4049      return nok(code)
4050    }
4051  }
4052}
4053function tokenizeNonLazyContinuation(effects, ok, nok) {
4054  const self = this;
4055  return start
4056  function start(code) {
4057    if (code === null) {
4058      return nok(code)
4059    }
4060    effects.enter('lineEnding');
4061    effects.consume(code);
4062    effects.exit('lineEnding');
4063    return lineStart
4064  }
4065  function lineStart(code) {
4066    return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
4067  }
4068}
4069
4070const codeIndented = {
4071  name: 'codeIndented',
4072  tokenize: tokenizeCodeIndented
4073};
4074const furtherStart = {
4075  tokenize: tokenizeFurtherStart,
4076  partial: true
4077};
4078function tokenizeCodeIndented(effects, ok, nok) {
4079  const self = this;
4080  return start
4081  function start(code) {
4082    effects.enter('codeIndented');
4083    return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code)
4084  }
4085  function afterPrefix(code) {
4086    const tail = self.events[self.events.length - 1];
4087    return tail &&
4088      tail[1].type === 'linePrefix' &&
4089      tail[2].sliceSerialize(tail[1], true).length >= 4
4090      ? atBreak(code)
4091      : nok(code)
4092  }
4093  function atBreak(code) {
4094    if (code === null) {
4095      return after(code)
4096    }
4097    if (markdownLineEnding(code)) {
4098      return effects.attempt(furtherStart, atBreak, after)(code)
4099    }
4100    effects.enter('codeFlowValue');
4101    return inside(code)
4102  }
4103  function inside(code) {
4104    if (code === null || markdownLineEnding(code)) {
4105      effects.exit('codeFlowValue');
4106      return atBreak(code)
4107    }
4108    effects.consume(code);
4109    return inside
4110  }
4111  function after(code) {
4112    effects.exit('codeIndented');
4113    return ok(code)
4114  }
4115}
4116function tokenizeFurtherStart(effects, ok, nok) {
4117  const self = this;
4118  return furtherStart
4119  function furtherStart(code) {
4120    if (self.parser.lazy[self.now().line]) {
4121      return nok(code)
4122    }
4123    if (markdownLineEnding(code)) {
4124      effects.enter('lineEnding');
4125      effects.consume(code);
4126      effects.exit('lineEnding');
4127      return furtherStart
4128    }
4129    return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code)
4130  }
4131  function afterPrefix(code) {
4132    const tail = self.events[self.events.length - 1];
4133    return tail &&
4134      tail[1].type === 'linePrefix' &&
4135      tail[2].sliceSerialize(tail[1], true).length >= 4
4136      ? ok(code)
4137      : markdownLineEnding(code)
4138      ? furtherStart(code)
4139      : nok(code)
4140  }
4141}
4142
4143const codeText = {
4144  name: 'codeText',
4145  tokenize: tokenizeCodeText,
4146  resolve: resolveCodeText,
4147  previous: previous$1
4148};
4149function resolveCodeText(events) {
4150  let tailExitIndex = events.length - 4;
4151  let headEnterIndex = 3;
4152  let index;
4153  let enter;
4154  if (
4155    (events[headEnterIndex][1].type === 'lineEnding' ||
4156      events[headEnterIndex][1].type === 'space') &&
4157    (events[tailExitIndex][1].type === 'lineEnding' ||
4158      events[tailExitIndex][1].type === 'space')
4159  ) {
4160    index = headEnterIndex;
4161    while (++index < tailExitIndex) {
4162      if (events[index][1].type === 'codeTextData') {
4163        events[headEnterIndex][1].type = 'codeTextPadding';
4164        events[tailExitIndex][1].type = 'codeTextPadding';
4165        headEnterIndex += 2;
4166        tailExitIndex -= 2;
4167        break
4168      }
4169    }
4170  }
4171  index = headEnterIndex - 1;
4172  tailExitIndex++;
4173  while (++index <= tailExitIndex) {
4174    if (enter === undefined) {
4175      if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') {
4176        enter = index;
4177      }
4178    } else if (
4179      index === tailExitIndex ||
4180      events[index][1].type === 'lineEnding'
4181    ) {
4182      events[enter][1].type = 'codeTextData';
4183      if (index !== enter + 2) {
4184        events[enter][1].end = events[index - 1][1].end;
4185        events.splice(enter + 2, index - enter - 2);
4186        tailExitIndex -= index - enter - 2;
4187        index = enter + 2;
4188      }
4189      enter = undefined;
4190    }
4191  }
4192  return events
4193}
4194function previous$1(code) {
4195  return (
4196    code !== 96 ||
4197    this.events[this.events.length - 1][1].type === 'characterEscape'
4198  )
4199}
4200function tokenizeCodeText(effects, ok, nok) {
4201  let sizeOpen = 0;
4202  let size;
4203  let token;
4204  return start
4205  function start(code) {
4206    effects.enter('codeText');
4207    effects.enter('codeTextSequence');
4208    return sequenceOpen(code)
4209  }
4210  function sequenceOpen(code) {
4211    if (code === 96) {
4212      effects.consume(code);
4213      sizeOpen++;
4214      return sequenceOpen
4215    }
4216    effects.exit('codeTextSequence');
4217    return between(code)
4218  }
4219  function between(code) {
4220    if (code === null) {
4221      return nok(code)
4222    }
4223    if (code === 32) {
4224      effects.enter('space');
4225      effects.consume(code);
4226      effects.exit('space');
4227      return between
4228    }
4229    if (code === 96) {
4230      token = effects.enter('codeTextSequence');
4231      size = 0;
4232      return sequenceClose(code)
4233    }
4234    if (markdownLineEnding(code)) {
4235      effects.enter('lineEnding');
4236      effects.consume(code);
4237      effects.exit('lineEnding');
4238      return between
4239    }
4240    effects.enter('codeTextData');
4241    return data(code)
4242  }
4243  function data(code) {
4244    if (
4245      code === null ||
4246      code === 32 ||
4247      code === 96 ||
4248      markdownLineEnding(code)
4249    ) {
4250      effects.exit('codeTextData');
4251      return between(code)
4252    }
4253    effects.consume(code);
4254    return data
4255  }
4256  function sequenceClose(code) {
4257    if (code === 96) {
4258      effects.consume(code);
4259      size++;
4260      return sequenceClose
4261    }
4262    if (size === sizeOpen) {
4263      effects.exit('codeTextSequence');
4264      effects.exit('codeText');
4265      return ok(code)
4266    }
4267    token.type = 'codeTextData';
4268    return data(code)
4269  }
4270}
4271
4272function subtokenize(events) {
4273  const jumps = {};
4274  let index = -1;
4275  let event;
4276  let lineIndex;
4277  let otherIndex;
4278  let otherEvent;
4279  let parameters;
4280  let subevents;
4281  let more;
4282  while (++index < events.length) {
4283    while (index in jumps) {
4284      index = jumps[index];
4285    }
4286    event = events[index];
4287    if (
4288      index &&
4289      event[1].type === 'chunkFlow' &&
4290      events[index - 1][1].type === 'listItemPrefix'
4291    ) {
4292      subevents = event[1]._tokenizer.events;
4293      otherIndex = 0;
4294      if (
4295        otherIndex < subevents.length &&
4296        subevents[otherIndex][1].type === 'lineEndingBlank'
4297      ) {
4298        otherIndex += 2;
4299      }
4300      if (
4301        otherIndex < subevents.length &&
4302        subevents[otherIndex][1].type === 'content'
4303      ) {
4304        while (++otherIndex < subevents.length) {
4305          if (subevents[otherIndex][1].type === 'content') {
4306            break
4307          }
4308          if (subevents[otherIndex][1].type === 'chunkText') {
4309            subevents[otherIndex][1]._isInFirstContentOfListItem = true;
4310            otherIndex++;
4311          }
4312        }
4313      }
4314    }
4315    if (event[0] === 'enter') {
4316      if (event[1].contentType) {
4317        Object.assign(jumps, subcontent(events, index));
4318        index = jumps[index];
4319        more = true;
4320      }
4321    }
4322    else if (event[1]._container) {
4323      otherIndex = index;
4324      lineIndex = undefined;
4325      while (otherIndex--) {
4326        otherEvent = events[otherIndex];
4327        if (
4328          otherEvent[1].type === 'lineEnding' ||
4329          otherEvent[1].type === 'lineEndingBlank'
4330        ) {
4331          if (otherEvent[0] === 'enter') {
4332            if (lineIndex) {
4333              events[lineIndex][1].type = 'lineEndingBlank';
4334            }
4335            otherEvent[1].type = 'lineEnding';
4336            lineIndex = otherIndex;
4337          }
4338        } else {
4339          break
4340        }
4341      }
4342      if (lineIndex) {
4343        event[1].end = Object.assign({}, events[lineIndex][1].start);
4344        parameters = events.slice(lineIndex, index);
4345        parameters.unshift(event);
4346        splice(events, lineIndex, index - lineIndex + 1, parameters);
4347      }
4348    }
4349  }
4350  return !more
4351}
4352function subcontent(events, eventIndex) {
4353  const token = events[eventIndex][1];
4354  const context = events[eventIndex][2];
4355  let startPosition = eventIndex - 1;
4356  const startPositions = [];
4357  const tokenizer =
4358    token._tokenizer || context.parser[token.contentType](token.start);
4359  const childEvents = tokenizer.events;
4360  const jumps = [];
4361  const gaps = {};
4362  let stream;
4363  let previous;
4364  let index = -1;
4365  let current = token;
4366  let adjust = 0;
4367  let start = 0;
4368  const breaks = [start];
4369  while (current) {
4370    while (events[++startPosition][1] !== current) {
4371    }
4372    startPositions.push(startPosition);
4373    if (!current._tokenizer) {
4374      stream = context.sliceStream(current);
4375      if (!current.next) {
4376        stream.push(null);
4377      }
4378      if (previous) {
4379        tokenizer.defineSkip(current.start);
4380      }
4381      if (current._isInFirstContentOfListItem) {
4382        tokenizer._gfmTasklistFirstContentOfListItem = true;
4383      }
4384      tokenizer.write(stream);
4385      if (current._isInFirstContentOfListItem) {
4386        tokenizer._gfmTasklistFirstContentOfListItem = undefined;
4387      }
4388    }
4389    previous = current;
4390    current = current.next;
4391  }
4392  current = token;
4393  while (++index < childEvents.length) {
4394    if (
4395      childEvents[index][0] === 'exit' &&
4396      childEvents[index - 1][0] === 'enter' &&
4397      childEvents[index][1].type === childEvents[index - 1][1].type &&
4398      childEvents[index][1].start.line !== childEvents[index][1].end.line
4399    ) {
4400      start = index + 1;
4401      breaks.push(start);
4402      current._tokenizer = undefined;
4403      current.previous = undefined;
4404      current = current.next;
4405    }
4406  }
4407  tokenizer.events = [];
4408  if (current) {
4409    current._tokenizer = undefined;
4410    current.previous = undefined;
4411  } else {
4412    breaks.pop();
4413  }
4414  index = breaks.length;
4415  while (index--) {
4416    const slice = childEvents.slice(breaks[index], breaks[index + 1]);
4417    const start = startPositions.pop();
4418    jumps.unshift([start, start + slice.length - 1]);
4419    splice(events, start, 2, slice);
4420  }
4421  index = -1;
4422  while (++index < jumps.length) {
4423    gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];
4424    adjust += jumps[index][1] - jumps[index][0] - 1;
4425  }
4426  return gaps
4427}
4428
4429const content = {
4430  tokenize: tokenizeContent,
4431  resolve: resolveContent
4432};
4433const continuationConstruct = {
4434  tokenize: tokenizeContinuation,
4435  partial: true
4436};
4437function resolveContent(events) {
4438  subtokenize(events);
4439  return events
4440}
4441function tokenizeContent(effects, ok) {
4442  let previous;
4443  return chunkStart
4444  function chunkStart(code) {
4445    effects.enter('content');
4446    previous = effects.enter('chunkContent', {
4447      contentType: 'content'
4448    });
4449    return chunkInside(code)
4450  }
4451  function chunkInside(code) {
4452    if (code === null) {
4453      return contentEnd(code)
4454    }
4455    if (markdownLineEnding(code)) {
4456      return effects.check(
4457        continuationConstruct,
4458        contentContinue,
4459        contentEnd
4460      )(code)
4461    }
4462    effects.consume(code);
4463    return chunkInside
4464  }
4465  function contentEnd(code) {
4466    effects.exit('chunkContent');
4467    effects.exit('content');
4468    return ok(code)
4469  }
4470  function contentContinue(code) {
4471    effects.consume(code);
4472    effects.exit('chunkContent');
4473    previous.next = effects.enter('chunkContent', {
4474      contentType: 'content',
4475      previous
4476    });
4477    previous = previous.next;
4478    return chunkInside
4479  }
4480}
4481function tokenizeContinuation(effects, ok, nok) {
4482  const self = this;
4483  return startLookahead
4484  function startLookahead(code) {
4485    effects.exit('chunkContent');
4486    effects.enter('lineEnding');
4487    effects.consume(code);
4488    effects.exit('lineEnding');
4489    return factorySpace(effects, prefixed, 'linePrefix')
4490  }
4491  function prefixed(code) {
4492    if (code === null || markdownLineEnding(code)) {
4493      return nok(code)
4494    }
4495    const tail = self.events[self.events.length - 1];
4496    if (
4497      !self.parser.constructs.disable.null.includes('codeIndented') &&
4498      tail &&
4499      tail[1].type === 'linePrefix' &&
4500      tail[2].sliceSerialize(tail[1], true).length >= 4
4501    ) {
4502      return ok(code)
4503    }
4504    return effects.interrupt(self.parser.constructs.flow, nok, ok)(code)
4505  }
4506}
4507
4508function factoryDestination(
4509  effects,
4510  ok,
4511  nok,
4512  type,
4513  literalType,
4514  literalMarkerType,
4515  rawType,
4516  stringType,
4517  max
4518) {
4519  const limit = max || Number.POSITIVE_INFINITY;
4520  let balance = 0;
4521  return start
4522  function start(code) {
4523    if (code === 60) {
4524      effects.enter(type);
4525      effects.enter(literalType);
4526      effects.enter(literalMarkerType);
4527      effects.consume(code);
4528      effects.exit(literalMarkerType);
4529      return enclosedBefore
4530    }
4531    if (code === null || code === 32 || code === 41 || asciiControl(code)) {
4532      return nok(code)
4533    }
4534    effects.enter(type);
4535    effects.enter(rawType);
4536    effects.enter(stringType);
4537    effects.enter('chunkString', {
4538      contentType: 'string'
4539    });
4540    return raw(code)
4541  }
4542  function enclosedBefore(code) {
4543    if (code === 62) {
4544      effects.enter(literalMarkerType);
4545      effects.consume(code);
4546      effects.exit(literalMarkerType);
4547      effects.exit(literalType);
4548      effects.exit(type);
4549      return ok
4550    }
4551    effects.enter(stringType);
4552    effects.enter('chunkString', {
4553      contentType: 'string'
4554    });
4555    return enclosed(code)
4556  }
4557  function enclosed(code) {
4558    if (code === 62) {
4559      effects.exit('chunkString');
4560      effects.exit(stringType);
4561      return enclosedBefore(code)
4562    }
4563    if (code === null || code === 60 || markdownLineEnding(code)) {
4564      return nok(code)
4565    }
4566    effects.consume(code);
4567    return code === 92 ? enclosedEscape : enclosed
4568  }
4569  function enclosedEscape(code) {
4570    if (code === 60 || code === 62 || code === 92) {
4571      effects.consume(code);
4572      return enclosed
4573    }
4574    return enclosed(code)
4575  }
4576  function raw(code) {
4577    if (
4578      !balance &&
4579      (code === null || code === 41 || markdownLineEndingOrSpace(code))
4580    ) {
4581      effects.exit('chunkString');
4582      effects.exit(stringType);
4583      effects.exit(rawType);
4584      effects.exit(type);
4585      return ok(code)
4586    }
4587    if (balance < limit && code === 40) {
4588      effects.consume(code);
4589      balance++;
4590      return raw
4591    }
4592    if (code === 41) {
4593      effects.consume(code);
4594      balance--;
4595      return raw
4596    }
4597    if (code === null || code === 32 || code === 40 || asciiControl(code)) {
4598      return nok(code)
4599    }
4600    effects.consume(code);
4601    return code === 92 ? rawEscape : raw
4602  }
4603  function rawEscape(code) {
4604    if (code === 40 || code === 41 || code === 92) {
4605      effects.consume(code);
4606      return raw
4607    }
4608    return raw(code)
4609  }
4610}
4611
4612function factoryLabel(effects, ok, nok, type, markerType, stringType) {
4613  const self = this;
4614  let size = 0;
4615  let seen;
4616  return start
4617  function start(code) {
4618    effects.enter(type);
4619    effects.enter(markerType);
4620    effects.consume(code);
4621    effects.exit(markerType);
4622    effects.enter(stringType);
4623    return atBreak
4624  }
4625  function atBreak(code) {
4626    if (
4627      size > 999 ||
4628      code === null ||
4629      code === 91 ||
4630      (code === 93 && !seen) ||
4631      (code === 94 &&
4632        !size &&
4633        '_hiddenFootnoteSupport' in self.parser.constructs)
4634    ) {
4635      return nok(code)
4636    }
4637    if (code === 93) {
4638      effects.exit(stringType);
4639      effects.enter(markerType);
4640      effects.consume(code);
4641      effects.exit(markerType);
4642      effects.exit(type);
4643      return ok
4644    }
4645    if (markdownLineEnding(code)) {
4646      effects.enter('lineEnding');
4647      effects.consume(code);
4648      effects.exit('lineEnding');
4649      return atBreak
4650    }
4651    effects.enter('chunkString', {
4652      contentType: 'string'
4653    });
4654    return labelInside(code)
4655  }
4656  function labelInside(code) {
4657    if (
4658      code === null ||
4659      code === 91 ||
4660      code === 93 ||
4661      markdownLineEnding(code) ||
4662      size++ > 999
4663    ) {
4664      effects.exit('chunkString');
4665      return atBreak(code)
4666    }
4667    effects.consume(code);
4668    if (!seen) seen = !markdownSpace(code);
4669    return code === 92 ? labelEscape : labelInside
4670  }
4671  function labelEscape(code) {
4672    if (code === 91 || code === 92 || code === 93) {
4673      effects.consume(code);
4674      size++;
4675      return labelInside
4676    }
4677    return labelInside(code)
4678  }
4679}
4680
4681function factoryTitle(effects, ok, nok, type, markerType, stringType) {
4682  let marker;
4683  return start
4684  function start(code) {
4685    if (code === 34 || code === 39 || code === 40) {
4686      effects.enter(type);
4687      effects.enter(markerType);
4688      effects.consume(code);
4689      effects.exit(markerType);
4690      marker = code === 40 ? 41 : code;
4691      return begin
4692    }
4693    return nok(code)
4694  }
4695  function begin(code) {
4696    if (code === marker) {
4697      effects.enter(markerType);
4698      effects.consume(code);
4699      effects.exit(markerType);
4700      effects.exit(type);
4701      return ok
4702    }
4703    effects.enter(stringType);
4704    return atBreak(code)
4705  }
4706  function atBreak(code) {
4707    if (code === marker) {
4708      effects.exit(stringType);
4709      return begin(marker)
4710    }
4711    if (code === null) {
4712      return nok(code)
4713    }
4714    if (markdownLineEnding(code)) {
4715      effects.enter('lineEnding');
4716      effects.consume(code);
4717      effects.exit('lineEnding');
4718      return factorySpace(effects, atBreak, 'linePrefix')
4719    }
4720    effects.enter('chunkString', {
4721      contentType: 'string'
4722    });
4723    return inside(code)
4724  }
4725  function inside(code) {
4726    if (code === marker || code === null || markdownLineEnding(code)) {
4727      effects.exit('chunkString');
4728      return atBreak(code)
4729    }
4730    effects.consume(code);
4731    return code === 92 ? escape : inside
4732  }
4733  function escape(code) {
4734    if (code === marker || code === 92) {
4735      effects.consume(code);
4736      return inside
4737    }
4738    return inside(code)
4739  }
4740}
4741
4742function factoryWhitespace(effects, ok) {
4743  let seen;
4744  return start
4745  function start(code) {
4746    if (markdownLineEnding(code)) {
4747      effects.enter('lineEnding');
4748      effects.consume(code);
4749      effects.exit('lineEnding');
4750      seen = true;
4751      return start
4752    }
4753    if (markdownSpace(code)) {
4754      return factorySpace(
4755        effects,
4756        start,
4757        seen ? 'linePrefix' : 'lineSuffix'
4758      )(code)
4759    }
4760    return ok(code)
4761  }
4762}
4763
4764const definition$1 = {
4765  name: 'definition',
4766  tokenize: tokenizeDefinition
4767};
4768const titleBefore = {
4769  tokenize: tokenizeTitleBefore,
4770  partial: true
4771};
4772function tokenizeDefinition(effects, ok, nok) {
4773  const self = this;
4774  let identifier;
4775  return start
4776  function start(code) {
4777    effects.enter('definition');
4778    return before(code)
4779  }
4780  function before(code) {
4781    return factoryLabel.call(
4782      self,
4783      effects,
4784      labelAfter,
4785      nok,
4786      'definitionLabel',
4787      'definitionLabelMarker',
4788      'definitionLabelString'
4789    )(code)
4790  }
4791  function labelAfter(code) {
4792    identifier = normalizeIdentifier$1(
4793      self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)
4794    );
4795    if (code === 58) {
4796      effects.enter('definitionMarker');
4797      effects.consume(code);
4798      effects.exit('definitionMarker');
4799      return markerAfter
4800    }
4801    return nok(code)
4802  }
4803  function markerAfter(code) {
4804    return markdownLineEndingOrSpace(code)
4805      ? factoryWhitespace(effects, destinationBefore)(code)
4806      : destinationBefore(code)
4807  }
4808  function destinationBefore(code) {
4809    return factoryDestination(
4810      effects,
4811      destinationAfter,
4812      nok,
4813      'definitionDestination',
4814      'definitionDestinationLiteral',
4815      'definitionDestinationLiteralMarker',
4816      'definitionDestinationRaw',
4817      'definitionDestinationString'
4818    )(code)
4819  }
4820  function destinationAfter(code) {
4821    return effects.attempt(titleBefore, after, after)(code)
4822  }
4823  function after(code) {
4824    return markdownSpace(code)
4825      ? factorySpace(effects, afterWhitespace, 'whitespace')(code)
4826      : afterWhitespace(code)
4827  }
4828  function afterWhitespace(code) {
4829    if (code === null || markdownLineEnding(code)) {
4830      effects.exit('definition');
4831      self.parser.defined.push(identifier);
4832      return ok(code)
4833    }
4834    return nok(code)
4835  }
4836}
4837function tokenizeTitleBefore(effects, ok, nok) {
4838  return titleBefore
4839  function titleBefore(code) {
4840    return markdownLineEndingOrSpace(code)
4841      ? factoryWhitespace(effects, beforeMarker)(code)
4842      : nok(code)
4843  }
4844  function beforeMarker(code) {
4845    return factoryTitle(
4846      effects,
4847      titleAfter,
4848      nok,
4849      'definitionTitle',
4850      'definitionTitleMarker',
4851      'definitionTitleString'
4852    )(code)
4853  }
4854  function titleAfter(code) {
4855    return markdownSpace(code)
4856      ? factorySpace(effects, titleAfterOptionalWhitespace, 'whitespace')(code)
4857      : titleAfterOptionalWhitespace(code)
4858  }
4859  function titleAfterOptionalWhitespace(code) {
4860    return code === null || markdownLineEnding(code) ? ok(code) : nok(code)
4861  }
4862}
4863
4864const hardBreakEscape = {
4865  name: 'hardBreakEscape',
4866  tokenize: tokenizeHardBreakEscape
4867};
4868function tokenizeHardBreakEscape(effects, ok, nok) {
4869  return start
4870  function start(code) {
4871    effects.enter('hardBreakEscape');
4872    effects.consume(code);
4873    return after
4874  }
4875  function after(code) {
4876    if (markdownLineEnding(code)) {
4877      effects.exit('hardBreakEscape');
4878      return ok(code)
4879    }
4880    return nok(code)
4881  }
4882}
4883
4884const headingAtx = {
4885  name: 'headingAtx',
4886  tokenize: tokenizeHeadingAtx,
4887  resolve: resolveHeadingAtx
4888};
4889function resolveHeadingAtx(events, context) {
4890  let contentEnd = events.length - 2;
4891  let contentStart = 3;
4892  let content;
4893  let text;
4894  if (events[contentStart][1].type === 'whitespace') {
4895    contentStart += 2;
4896  }
4897  if (
4898    contentEnd - 2 > contentStart &&
4899    events[contentEnd][1].type === 'whitespace'
4900  ) {
4901    contentEnd -= 2;
4902  }
4903  if (
4904    events[contentEnd][1].type === 'atxHeadingSequence' &&
4905    (contentStart === contentEnd - 1 ||
4906      (contentEnd - 4 > contentStart &&
4907        events[contentEnd - 2][1].type === 'whitespace'))
4908  ) {
4909    contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
4910  }
4911  if (contentEnd > contentStart) {
4912    content = {
4913      type: 'atxHeadingText',
4914      start: events[contentStart][1].start,
4915      end: events[contentEnd][1].end
4916    };
4917    text = {
4918      type: 'chunkText',
4919      start: events[contentStart][1].start,
4920      end: events[contentEnd][1].end,
4921      contentType: 'text'
4922    };
4923    splice(events, contentStart, contentEnd - contentStart + 1, [
4924      ['enter', content, context],
4925      ['enter', text, context],
4926      ['exit', text, context],
4927      ['exit', content, context]
4928    ]);
4929  }
4930  return events
4931}
4932function tokenizeHeadingAtx(effects, ok, nok) {
4933  let size = 0;
4934  return start
4935  function start(code) {
4936    effects.enter('atxHeading');
4937    return before(code)
4938  }
4939  function before(code) {
4940    effects.enter('atxHeadingSequence');
4941    return sequenceOpen(code)
4942  }
4943  function sequenceOpen(code) {
4944    if (code === 35 && size++ < 6) {
4945      effects.consume(code);
4946      return sequenceOpen
4947    }
4948    if (code === null || markdownLineEndingOrSpace(code)) {
4949      effects.exit('atxHeadingSequence');
4950      return atBreak(code)
4951    }
4952    return nok(code)
4953  }
4954  function atBreak(code) {
4955    if (code === 35) {
4956      effects.enter('atxHeadingSequence');
4957      return sequenceFurther(code)
4958    }
4959    if (code === null || markdownLineEnding(code)) {
4960      effects.exit('atxHeading');
4961      return ok(code)
4962    }
4963    if (markdownSpace(code)) {
4964      return factorySpace(effects, atBreak, 'whitespace')(code)
4965    }
4966    effects.enter('atxHeadingText');
4967    return data(code)
4968  }
4969  function sequenceFurther(code) {
4970    if (code === 35) {
4971      effects.consume(code);
4972      return sequenceFurther
4973    }
4974    effects.exit('atxHeadingSequence');
4975    return atBreak(code)
4976  }
4977  function data(code) {
4978    if (code === null || code === 35 || markdownLineEndingOrSpace(code)) {
4979      effects.exit('atxHeadingText');
4980      return atBreak(code)
4981    }
4982    effects.consume(code);
4983    return data
4984  }
4985}
4986
4987const htmlBlockNames = [
4988  'address',
4989  'article',
4990  'aside',
4991  'base',
4992  'basefont',
4993  'blockquote',
4994  'body',
4995  'caption',
4996  'center',
4997  'col',
4998  'colgroup',
4999  'dd',
5000  'details',
5001  'dialog',
5002  'dir',
5003  'div',
5004  'dl',
5005  'dt',
5006  'fieldset',
5007  'figcaption',
5008  'figure',
5009  'footer',
5010  'form',
5011  'frame',
5012  'frameset',
5013  'h1',
5014  'h2',
5015  'h3',
5016  'h4',
5017  'h5',
5018  'h6',
5019  'head',
5020  'header',
5021  'hr',
5022  'html',
5023  'iframe',
5024  'legend',
5025  'li',
5026  'link',
5027  'main',
5028  'menu',
5029  'menuitem',
5030  'nav',
5031  'noframes',
5032  'ol',
5033  'optgroup',
5034  'option',
5035  'p',
5036  'param',
5037  'search',
5038  'section',
5039  'summary',
5040  'table',
5041  'tbody',
5042  'td',
5043  'tfoot',
5044  'th',
5045  'thead',
5046  'title',
5047  'tr',
5048  'track',
5049  'ul'
5050];
5051const htmlRawNames = ['pre', 'script', 'style', 'textarea'];
5052
5053const htmlFlow = {
5054  name: 'htmlFlow',
5055  tokenize: tokenizeHtmlFlow,
5056  resolveTo: resolveToHtmlFlow,
5057  concrete: true
5058};
5059const blankLineBefore = {
5060  tokenize: tokenizeBlankLineBefore,
5061  partial: true
5062};
5063const nonLazyContinuationStart = {
5064  tokenize: tokenizeNonLazyContinuationStart,
5065  partial: true
5066};
5067function resolveToHtmlFlow(events) {
5068  let index = events.length;
5069  while (index--) {
5070    if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') {
5071      break
5072    }
5073  }
5074  if (index > 1 && events[index - 2][1].type === 'linePrefix') {
5075    events[index][1].start = events[index - 2][1].start;
5076    events[index + 1][1].start = events[index - 2][1].start;
5077    events.splice(index - 2, 2);
5078  }
5079  return events
5080}
5081function tokenizeHtmlFlow(effects, ok, nok) {
5082  const self = this;
5083  let marker;
5084  let closingTag;
5085  let buffer;
5086  let index;
5087  let markerB;
5088  return start
5089  function start(code) {
5090    return before(code)
5091  }
5092  function before(code) {
5093    effects.enter('htmlFlow');
5094    effects.enter('htmlFlowData');
5095    effects.consume(code);
5096    return open
5097  }
5098  function open(code) {
5099    if (code === 33) {
5100      effects.consume(code);
5101      return declarationOpen
5102    }
5103    if (code === 47) {
5104      effects.consume(code);
5105      closingTag = true;
5106      return tagCloseStart
5107    }
5108    if (code === 63) {
5109      effects.consume(code);
5110      marker = 3;
5111      return self.interrupt ? ok : continuationDeclarationInside
5112    }
5113    if (asciiAlpha(code)) {
5114      effects.consume(code);
5115      buffer = String.fromCharCode(code);
5116      return tagName
5117    }
5118    return nok(code)
5119  }
5120  function declarationOpen(code) {
5121    if (code === 45) {
5122      effects.consume(code);
5123      marker = 2;
5124      return commentOpenInside
5125    }
5126    if (code === 91) {
5127      effects.consume(code);
5128      marker = 5;
5129      index = 0;
5130      return cdataOpenInside
5131    }
5132    if (asciiAlpha(code)) {
5133      effects.consume(code);
5134      marker = 4;
5135      return self.interrupt ? ok : continuationDeclarationInside
5136    }
5137    return nok(code)
5138  }
5139  function commentOpenInside(code) {
5140    if (code === 45) {
5141      effects.consume(code);
5142      return self.interrupt ? ok : continuationDeclarationInside
5143    }
5144    return nok(code)
5145  }
5146  function cdataOpenInside(code) {
5147    const value = 'CDATA[';
5148    if (code === value.charCodeAt(index++)) {
5149      effects.consume(code);
5150      if (index === value.length) {
5151        return self.interrupt ? ok : continuation
5152      }
5153      return cdataOpenInside
5154    }
5155    return nok(code)
5156  }
5157  function tagCloseStart(code) {
5158    if (asciiAlpha(code)) {
5159      effects.consume(code);
5160      buffer = String.fromCharCode(code);
5161      return tagName
5162    }
5163    return nok(code)
5164  }
5165  function tagName(code) {
5166    if (
5167      code === null ||
5168      code === 47 ||
5169      code === 62 ||
5170      markdownLineEndingOrSpace(code)
5171    ) {
5172      const slash = code === 47;
5173      const name = buffer.toLowerCase();
5174      if (!slash && !closingTag && htmlRawNames.includes(name)) {
5175        marker = 1;
5176        return self.interrupt ? ok(code) : continuation(code)
5177      }
5178      if (htmlBlockNames.includes(buffer.toLowerCase())) {
5179        marker = 6;
5180        if (slash) {
5181          effects.consume(code);
5182          return basicSelfClosing
5183        }
5184        return self.interrupt ? ok(code) : continuation(code)
5185      }
5186      marker = 7;
5187      return self.interrupt && !self.parser.lazy[self.now().line]
5188        ? nok(code)
5189        : closingTag
5190        ? completeClosingTagAfter(code)
5191        : completeAttributeNameBefore(code)
5192    }
5193    if (code === 45 || asciiAlphanumeric(code)) {
5194      effects.consume(code);
5195      buffer += String.fromCharCode(code);
5196      return tagName
5197    }
5198    return nok(code)
5199  }
5200  function basicSelfClosing(code) {
5201    if (code === 62) {
5202      effects.consume(code);
5203      return self.interrupt ? ok : continuation
5204    }
5205    return nok(code)
5206  }
5207  function completeClosingTagAfter(code) {
5208    if (markdownSpace(code)) {
5209      effects.consume(code);
5210      return completeClosingTagAfter
5211    }
5212    return completeEnd(code)
5213  }
5214  function completeAttributeNameBefore(code) {
5215    if (code === 47) {
5216      effects.consume(code);
5217      return completeEnd
5218    }
5219    if (code === 58 || code === 95 || asciiAlpha(code)) {
5220      effects.consume(code);
5221      return completeAttributeName
5222    }
5223    if (markdownSpace(code)) {
5224      effects.consume(code);
5225      return completeAttributeNameBefore
5226    }
5227    return completeEnd(code)
5228  }
5229  function completeAttributeName(code) {
5230    if (
5231      code === 45 ||
5232      code === 46 ||
5233      code === 58 ||
5234      code === 95 ||
5235      asciiAlphanumeric(code)
5236    ) {
5237      effects.consume(code);
5238      return completeAttributeName
5239    }
5240    return completeAttributeNameAfter(code)
5241  }
5242  function completeAttributeNameAfter(code) {
5243    if (code === 61) {
5244      effects.consume(code);
5245      return completeAttributeValueBefore
5246    }
5247    if (markdownSpace(code)) {
5248      effects.consume(code);
5249      return completeAttributeNameAfter
5250    }
5251    return completeAttributeNameBefore(code)
5252  }
5253  function completeAttributeValueBefore(code) {
5254    if (
5255      code === null ||
5256      code === 60 ||
5257      code === 61 ||
5258      code === 62 ||
5259      code === 96
5260    ) {
5261      return nok(code)
5262    }
5263    if (code === 34 || code === 39) {
5264      effects.consume(code);
5265      markerB = code;
5266      return completeAttributeValueQuoted
5267    }
5268    if (markdownSpace(code)) {
5269      effects.consume(code);
5270      return completeAttributeValueBefore
5271    }
5272    return completeAttributeValueUnquoted(code)
5273  }
5274  function completeAttributeValueQuoted(code) {
5275    if (code === markerB) {
5276      effects.consume(code);
5277      markerB = null;
5278      return completeAttributeValueQuotedAfter
5279    }
5280    if (code === null || markdownLineEnding(code)) {
5281      return nok(code)
5282    }
5283    effects.consume(code);
5284    return completeAttributeValueQuoted
5285  }
5286  function completeAttributeValueUnquoted(code) {
5287    if (
5288      code === null ||
5289      code === 34 ||
5290      code === 39 ||
5291      code === 47 ||
5292      code === 60 ||
5293      code === 61 ||
5294      code === 62 ||
5295      code === 96 ||
5296      markdownLineEndingOrSpace(code)
5297    ) {
5298      return completeAttributeNameAfter(code)
5299    }
5300    effects.consume(code);
5301    return completeAttributeValueUnquoted
5302  }
5303  function completeAttributeValueQuotedAfter(code) {
5304    if (code === 47 || code === 62 || markdownSpace(code)) {
5305      return completeAttributeNameBefore(code)
5306    }
5307    return nok(code)
5308  }
5309  function completeEnd(code) {
5310    if (code === 62) {
5311      effects.consume(code);
5312      return completeAfter
5313    }
5314    return nok(code)
5315  }
5316  function completeAfter(code) {
5317    if (code === null || markdownLineEnding(code)) {
5318      return continuation(code)
5319    }
5320    if (markdownSpace(code)) {
5321      effects.consume(code);
5322      return completeAfter
5323    }
5324    return nok(code)
5325  }
5326  function continuation(code) {
5327    if (code === 45 && marker === 2) {
5328      effects.consume(code);
5329      return continuationCommentInside
5330    }
5331    if (code === 60 && marker === 1) {
5332      effects.consume(code);
5333      return continuationRawTagOpen
5334    }
5335    if (code === 62 && marker === 4) {
5336      effects.consume(code);
5337      return continuationClose
5338    }
5339    if (code === 63 && marker === 3) {
5340      effects.consume(code);
5341      return continuationDeclarationInside
5342    }
5343    if (code === 93 && marker === 5) {
5344      effects.consume(code);
5345      return continuationCdataInside
5346    }
5347    if (markdownLineEnding(code) && (marker === 6 || marker === 7)) {
5348      effects.exit('htmlFlowData');
5349      return effects.check(
5350        blankLineBefore,
5351        continuationAfter,
5352        continuationStart
5353      )(code)
5354    }
5355    if (code === null || markdownLineEnding(code)) {
5356      effects.exit('htmlFlowData');
5357      return continuationStart(code)
5358    }
5359    effects.consume(code);
5360    return continuation
5361  }
5362  function continuationStart(code) {
5363    return effects.check(
5364      nonLazyContinuationStart,
5365      continuationStartNonLazy,
5366      continuationAfter
5367    )(code)
5368  }
5369  function continuationStartNonLazy(code) {
5370    effects.enter('lineEnding');
5371    effects.consume(code);
5372    effects.exit('lineEnding');
5373    return continuationBefore
5374  }
5375  function continuationBefore(code) {
5376    if (code === null || markdownLineEnding(code)) {
5377      return continuationStart(code)
5378    }
5379    effects.enter('htmlFlowData');
5380    return continuation(code)
5381  }
5382  function continuationCommentInside(code) {
5383    if (code === 45) {
5384      effects.consume(code);
5385      return continuationDeclarationInside
5386    }
5387    return continuation(code)
5388  }
5389  function continuationRawTagOpen(code) {
5390    if (code === 47) {
5391      effects.consume(code);
5392      buffer = '';
5393      return continuationRawEndTag
5394    }
5395    return continuation(code)
5396  }
5397  function continuationRawEndTag(code) {
5398    if (code === 62) {
5399      const name = buffer.toLowerCase();
5400      if (htmlRawNames.includes(name)) {
5401        effects.consume(code);
5402        return continuationClose
5403      }
5404      return continuation(code)
5405    }
5406    if (asciiAlpha(code) && buffer.length < 8) {
5407      effects.consume(code);
5408      buffer += String.fromCharCode(code);
5409      return continuationRawEndTag
5410    }
5411    return continuation(code)
5412  }
5413  function continuationCdataInside(code) {
5414    if (code === 93) {
5415      effects.consume(code);
5416      return continuationDeclarationInside
5417    }
5418    return continuation(code)
5419  }
5420  function continuationDeclarationInside(code) {
5421    if (code === 62) {
5422      effects.consume(code);
5423      return continuationClose
5424    }
5425    if (code === 45 && marker === 2) {
5426      effects.consume(code);
5427      return continuationDeclarationInside
5428    }
5429    return continuation(code)
5430  }
5431  function continuationClose(code) {
5432    if (code === null || markdownLineEnding(code)) {
5433      effects.exit('htmlFlowData');
5434      return continuationAfter(code)
5435    }
5436    effects.consume(code);
5437    return continuationClose
5438  }
5439  function continuationAfter(code) {
5440    effects.exit('htmlFlow');
5441    return ok(code)
5442  }
5443}
5444function tokenizeNonLazyContinuationStart(effects, ok, nok) {
5445  const self = this;
5446  return start
5447  function start(code) {
5448    if (markdownLineEnding(code)) {
5449      effects.enter('lineEnding');
5450      effects.consume(code);
5451      effects.exit('lineEnding');
5452      return after
5453    }
5454    return nok(code)
5455  }
5456  function after(code) {
5457    return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
5458  }
5459}
5460function tokenizeBlankLineBefore(effects, ok, nok) {
5461  return start
5462  function start(code) {
5463    effects.enter('lineEnding');
5464    effects.consume(code);
5465    effects.exit('lineEnding');
5466    return effects.attempt(blankLine, ok, nok)
5467  }
5468}
5469
5470const htmlText = {
5471  name: 'htmlText',
5472  tokenize: tokenizeHtmlText
5473};
5474function tokenizeHtmlText(effects, ok, nok) {
5475  const self = this;
5476  let marker;
5477  let index;
5478  let returnState;
5479  return start
5480  function start(code) {
5481    effects.enter('htmlText');
5482    effects.enter('htmlTextData');
5483    effects.consume(code);
5484    return open
5485  }
5486  function open(code) {
5487    if (code === 33) {
5488      effects.consume(code);
5489      return declarationOpen
5490    }
5491    if (code === 47) {
5492      effects.consume(code);
5493      return tagCloseStart
5494    }
5495    if (code === 63) {
5496      effects.consume(code);
5497      return instruction
5498    }
5499    if (asciiAlpha(code)) {
5500      effects.consume(code);
5501      return tagOpen
5502    }
5503    return nok(code)
5504  }
5505  function declarationOpen(code) {
5506    if (code === 45) {
5507      effects.consume(code);
5508      return commentOpenInside
5509    }
5510    if (code === 91) {
5511      effects.consume(code);
5512      index = 0;
5513      return cdataOpenInside
5514    }
5515    if (asciiAlpha(code)) {
5516      effects.consume(code);
5517      return declaration
5518    }
5519    return nok(code)
5520  }
5521  function commentOpenInside(code) {
5522    if (code === 45) {
5523      effects.consume(code);
5524      return commentEnd
5525    }
5526    return nok(code)
5527  }
5528  function comment(code) {
5529    if (code === null) {
5530      return nok(code)
5531    }
5532    if (code === 45) {
5533      effects.consume(code);
5534      return commentClose
5535    }
5536    if (markdownLineEnding(code)) {
5537      returnState = comment;
5538      return lineEndingBefore(code)
5539    }
5540    effects.consume(code);
5541    return comment
5542  }
5543  function commentClose(code) {
5544    if (code === 45) {
5545      effects.consume(code);
5546      return commentEnd
5547    }
5548    return comment(code)
5549  }
5550  function commentEnd(code) {
5551    return code === 62
5552      ? end(code)
5553      : code === 45
5554      ? commentClose(code)
5555      : comment(code)
5556  }
5557  function cdataOpenInside(code) {
5558    const value = 'CDATA[';
5559    if (code === value.charCodeAt(index++)) {
5560      effects.consume(code);
5561      return index === value.length ? cdata : cdataOpenInside
5562    }
5563    return nok(code)
5564  }
5565  function cdata(code) {
5566    if (code === null) {
5567      return nok(code)
5568    }
5569    if (code === 93) {
5570      effects.consume(code);
5571      return cdataClose
5572    }
5573    if (markdownLineEnding(code)) {
5574      returnState = cdata;
5575      return lineEndingBefore(code)
5576    }
5577    effects.consume(code);
5578    return cdata
5579  }
5580  function cdataClose(code) {
5581    if (code === 93) {
5582      effects.consume(code);
5583      return cdataEnd
5584    }
5585    return cdata(code)
5586  }
5587  function cdataEnd(code) {
5588    if (code === 62) {
5589      return end(code)
5590    }
5591    if (code === 93) {
5592      effects.consume(code);
5593      return cdataEnd
5594    }
5595    return cdata(code)
5596  }
5597  function declaration(code) {
5598    if (code === null || code === 62) {
5599      return end(code)
5600    }
5601    if (markdownLineEnding(code)) {
5602      returnState = declaration;
5603      return lineEndingBefore(code)
5604    }
5605    effects.consume(code);
5606    return declaration
5607  }
5608  function instruction(code) {
5609    if (code === null) {
5610      return nok(code)
5611    }
5612    if (code === 63) {
5613      effects.consume(code);
5614      return instructionClose
5615    }
5616    if (markdownLineEnding(code)) {
5617      returnState = instruction;
5618      return lineEndingBefore(code)
5619    }
5620    effects.consume(code);
5621    return instruction
5622  }
5623  function instructionClose(code) {
5624    return code === 62 ? end(code) : instruction(code)
5625  }
5626  function tagCloseStart(code) {
5627    if (asciiAlpha(code)) {
5628      effects.consume(code);
5629      return tagClose
5630    }
5631    return nok(code)
5632  }
5633  function tagClose(code) {
5634    if (code === 45 || asciiAlphanumeric(code)) {
5635      effects.consume(code);
5636      return tagClose
5637    }
5638    return tagCloseBetween(code)
5639  }
5640  function tagCloseBetween(code) {
5641    if (markdownLineEnding(code)) {
5642      returnState = tagCloseBetween;
5643      return lineEndingBefore(code)
5644    }
5645    if (markdownSpace(code)) {
5646      effects.consume(code);
5647      return tagCloseBetween
5648    }
5649    return end(code)
5650  }
5651  function tagOpen(code) {
5652    if (code === 45 || asciiAlphanumeric(code)) {
5653      effects.consume(code);
5654      return tagOpen
5655    }
5656    if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
5657      return tagOpenBetween(code)
5658    }
5659    return nok(code)
5660  }
5661  function tagOpenBetween(code) {
5662    if (code === 47) {
5663      effects.consume(code);
5664      return end
5665    }
5666    if (code === 58 || code === 95 || asciiAlpha(code)) {
5667      effects.consume(code);
5668      return tagOpenAttributeName
5669    }
5670    if (markdownLineEnding(code)) {
5671      returnState = tagOpenBetween;
5672      return lineEndingBefore(code)
5673    }
5674    if (markdownSpace(code)) {
5675      effects.consume(code);
5676      return tagOpenBetween
5677    }
5678    return end(code)
5679  }
5680  function tagOpenAttributeName(code) {
5681    if (
5682      code === 45 ||
5683      code === 46 ||
5684      code === 58 ||
5685      code === 95 ||
5686      asciiAlphanumeric(code)
5687    ) {
5688      effects.consume(code);
5689      return tagOpenAttributeName
5690    }
5691    return tagOpenAttributeNameAfter(code)
5692  }
5693  function tagOpenAttributeNameAfter(code) {
5694    if (code === 61) {
5695      effects.consume(code);
5696      return tagOpenAttributeValueBefore
5697    }
5698    if (markdownLineEnding(code)) {
5699      returnState = tagOpenAttributeNameAfter;
5700      return lineEndingBefore(code)
5701    }
5702    if (markdownSpace(code)) {
5703      effects.consume(code);
5704      return tagOpenAttributeNameAfter
5705    }
5706    return tagOpenBetween(code)
5707  }
5708  function tagOpenAttributeValueBefore(code) {
5709    if (
5710      code === null ||
5711      code === 60 ||
5712      code === 61 ||
5713      code === 62 ||
5714      code === 96
5715    ) {
5716      return nok(code)
5717    }
5718    if (code === 34 || code === 39) {
5719      effects.consume(code);
5720      marker = code;
5721      return tagOpenAttributeValueQuoted
5722    }
5723    if (markdownLineEnding(code)) {
5724      returnState = tagOpenAttributeValueBefore;
5725      return lineEndingBefore(code)
5726    }
5727    if (markdownSpace(code)) {
5728      effects.consume(code);
5729      return tagOpenAttributeValueBefore
5730    }
5731    effects.consume(code);
5732    return tagOpenAttributeValueUnquoted
5733  }
5734  function tagOpenAttributeValueQuoted(code) {
5735    if (code === marker) {
5736      effects.consume(code);
5737      marker = undefined;
5738      return tagOpenAttributeValueQuotedAfter
5739    }
5740    if (code === null) {
5741      return nok(code)
5742    }
5743    if (markdownLineEnding(code)) {
5744      returnState = tagOpenAttributeValueQuoted;
5745      return lineEndingBefore(code)
5746    }
5747    effects.consume(code);
5748    return tagOpenAttributeValueQuoted
5749  }
5750  function tagOpenAttributeValueUnquoted(code) {
5751    if (
5752      code === null ||
5753      code === 34 ||
5754      code === 39 ||
5755      code === 60 ||
5756      code === 61 ||
5757      code === 96
5758    ) {
5759      return nok(code)
5760    }
5761    if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
5762      return tagOpenBetween(code)
5763    }
5764    effects.consume(code);
5765    return tagOpenAttributeValueUnquoted
5766  }
5767  function tagOpenAttributeValueQuotedAfter(code) {
5768    if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
5769      return tagOpenBetween(code)
5770    }
5771    return nok(code)
5772  }
5773  function end(code) {
5774    if (code === 62) {
5775      effects.consume(code);
5776      effects.exit('htmlTextData');
5777      effects.exit('htmlText');
5778      return ok
5779    }
5780    return nok(code)
5781  }
5782  function lineEndingBefore(code) {
5783    effects.exit('htmlTextData');
5784    effects.enter('lineEnding');
5785    effects.consume(code);
5786    effects.exit('lineEnding');
5787    return lineEndingAfter
5788  }
5789  function lineEndingAfter(code) {
5790    return markdownSpace(code)
5791      ? factorySpace(
5792          effects,
5793          lineEndingAfterPrefix,
5794          'linePrefix',
5795          self.parser.constructs.disable.null.includes('codeIndented')
5796            ? undefined
5797            : 4
5798        )(code)
5799      : lineEndingAfterPrefix(code)
5800  }
5801  function lineEndingAfterPrefix(code) {
5802    effects.enter('htmlTextData');
5803    return returnState(code)
5804  }
5805}
5806
5807const labelEnd = {
5808  name: 'labelEnd',
5809  tokenize: tokenizeLabelEnd,
5810  resolveTo: resolveToLabelEnd,
5811  resolveAll: resolveAllLabelEnd
5812};
5813const resourceConstruct = {
5814  tokenize: tokenizeResource
5815};
5816const referenceFullConstruct = {
5817  tokenize: tokenizeReferenceFull
5818};
5819const referenceCollapsedConstruct = {
5820  tokenize: tokenizeReferenceCollapsed
5821};
5822function resolveAllLabelEnd(events) {
5823  let index = -1;
5824  while (++index < events.length) {
5825    const token = events[index][1];
5826    if (
5827      token.type === 'labelImage' ||
5828      token.type === 'labelLink' ||
5829      token.type === 'labelEnd'
5830    ) {
5831      events.splice(index + 1, token.type === 'labelImage' ? 4 : 2);
5832      token.type = 'data';
5833      index++;
5834    }
5835  }
5836  return events
5837}
5838function resolveToLabelEnd(events, context) {
5839  let index = events.length;
5840  let offset = 0;
5841  let token;
5842  let open;
5843  let close;
5844  let media;
5845  while (index--) {
5846    token = events[index][1];
5847    if (open) {
5848      if (
5849        token.type === 'link' ||
5850        (token.type === 'labelLink' && token._inactive)
5851      ) {
5852        break
5853      }
5854      if (events[index][0] === 'enter' && token.type === 'labelLink') {
5855        token._inactive = true;
5856      }
5857    } else if (close) {
5858      if (
5859        events[index][0] === 'enter' &&
5860        (token.type === 'labelImage' || token.type === 'labelLink') &&
5861        !token._balanced
5862      ) {
5863        open = index;
5864        if (token.type !== 'labelLink') {
5865          offset = 2;
5866          break
5867        }
5868      }
5869    } else if (token.type === 'labelEnd') {
5870      close = index;
5871    }
5872  }
5873  const group = {
5874    type: events[open][1].type === 'labelLink' ? 'link' : 'image',
5875    start: Object.assign({}, events[open][1].start),
5876    end: Object.assign({}, events[events.length - 1][1].end)
5877  };
5878  const label = {
5879    type: 'label',
5880    start: Object.assign({}, events[open][1].start),
5881    end: Object.assign({}, events[close][1].end)
5882  };
5883  const text = {
5884    type: 'labelText',
5885    start: Object.assign({}, events[open + offset + 2][1].end),
5886    end: Object.assign({}, events[close - 2][1].start)
5887  };
5888  media = [
5889    ['enter', group, context],
5890    ['enter', label, context]
5891  ];
5892  media = push(media, events.slice(open + 1, open + offset + 3));
5893  media = push(media, [['enter', text, context]]);
5894  media = push(
5895    media,
5896    resolveAll(
5897      context.parser.constructs.insideSpan.null,
5898      events.slice(open + offset + 4, close - 3),
5899      context
5900    )
5901  );
5902  media = push(media, [
5903    ['exit', text, context],
5904    events[close - 2],
5905    events[close - 1],
5906    ['exit', label, context]
5907  ]);
5908  media = push(media, events.slice(close + 1));
5909  media = push(media, [['exit', group, context]]);
5910  splice(events, open, events.length, media);
5911  return events
5912}
5913function tokenizeLabelEnd(effects, ok, nok) {
5914  const self = this;
5915  let index = self.events.length;
5916  let labelStart;
5917  let defined;
5918  while (index--) {
5919    if (
5920      (self.events[index][1].type === 'labelImage' ||
5921        self.events[index][1].type === 'labelLink') &&
5922      !self.events[index][1]._balanced
5923    ) {
5924      labelStart = self.events[index][1];
5925      break
5926    }
5927  }
5928  return start
5929  function start(code) {
5930    if (!labelStart) {
5931      return nok(code)
5932    }
5933    if (labelStart._inactive) {
5934      return labelEndNok(code)
5935    }
5936    defined = self.parser.defined.includes(
5937      normalizeIdentifier$1(
5938        self.sliceSerialize({
5939          start: labelStart.end,
5940          end: self.now()
5941        })
5942      )
5943    );
5944    effects.enter('labelEnd');
5945    effects.enter('labelMarker');
5946    effects.consume(code);
5947    effects.exit('labelMarker');
5948    effects.exit('labelEnd');
5949    return after
5950  }
5951  function after(code) {
5952    if (code === 40) {
5953      return effects.attempt(
5954        resourceConstruct,
5955        labelEndOk,
5956        defined ? labelEndOk : labelEndNok
5957      )(code)
5958    }
5959    if (code === 91) {
5960      return effects.attempt(
5961        referenceFullConstruct,
5962        labelEndOk,
5963        defined ? referenceNotFull : labelEndNok
5964      )(code)
5965    }
5966    return defined ? labelEndOk(code) : labelEndNok(code)
5967  }
5968  function referenceNotFull(code) {
5969    return effects.attempt(
5970      referenceCollapsedConstruct,
5971      labelEndOk,
5972      labelEndNok
5973    )(code)
5974  }
5975  function labelEndOk(code) {
5976    return ok(code)
5977  }
5978  function labelEndNok(code) {
5979    labelStart._balanced = true;
5980    return nok(code)
5981  }
5982}
5983function tokenizeResource(effects, ok, nok) {
5984  return resourceStart
5985  function resourceStart(code) {
5986    effects.enter('resource');
5987    effects.enter('resourceMarker');
5988    effects.consume(code);
5989    effects.exit('resourceMarker');
5990    return resourceBefore
5991  }
5992  function resourceBefore(code) {
5993    return markdownLineEndingOrSpace(code)
5994      ? factoryWhitespace(effects, resourceOpen)(code)
5995      : resourceOpen(code)
5996  }
5997  function resourceOpen(code) {
5998    if (code === 41) {
5999      return resourceEnd(code)
6000    }
6001    return factoryDestination(
6002      effects,
6003      resourceDestinationAfter,
6004      resourceDestinationMissing,
6005      'resourceDestination',
6006      'resourceDestinationLiteral',
6007      'resourceDestinationLiteralMarker',
6008      'resourceDestinationRaw',
6009      'resourceDestinationString',
6010      32
6011    )(code)
6012  }
6013  function resourceDestinationAfter(code) {
6014    return markdownLineEndingOrSpace(code)
6015      ? factoryWhitespace(effects, resourceBetween)(code)
6016      : resourceEnd(code)
6017  }
6018  function resourceDestinationMissing(code) {
6019    return nok(code)
6020  }
6021  function resourceBetween(code) {
6022    if (code === 34 || code === 39 || code === 40) {
6023      return factoryTitle(
6024        effects,
6025        resourceTitleAfter,
6026        nok,
6027        'resourceTitle',
6028        'resourceTitleMarker',
6029        'resourceTitleString'
6030      )(code)
6031    }
6032    return resourceEnd(code)
6033  }
6034  function resourceTitleAfter(code) {
6035    return markdownLineEndingOrSpace(code)
6036      ? factoryWhitespace(effects, resourceEnd)(code)
6037      : resourceEnd(code)
6038  }
6039  function resourceEnd(code) {
6040    if (code === 41) {
6041      effects.enter('resourceMarker');
6042      effects.consume(code);
6043      effects.exit('resourceMarker');
6044      effects.exit('resource');
6045      return ok
6046    }
6047    return nok(code)
6048  }
6049}
6050function tokenizeReferenceFull(effects, ok, nok) {
6051  const self = this;
6052  return referenceFull
6053  function referenceFull(code) {
6054    return factoryLabel.call(
6055      self,
6056      effects,
6057      referenceFullAfter,
6058      referenceFullMissing,
6059      'reference',
6060      'referenceMarker',
6061      'referenceString'
6062    )(code)
6063  }
6064  function referenceFullAfter(code) {
6065    return self.parser.defined.includes(
6066      normalizeIdentifier$1(
6067        self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)
6068      )
6069    )
6070      ? ok(code)
6071      : nok(code)
6072  }
6073  function referenceFullMissing(code) {
6074    return nok(code)
6075  }
6076}
6077function tokenizeReferenceCollapsed(effects, ok, nok) {
6078  return referenceCollapsedStart
6079  function referenceCollapsedStart(code) {
6080    effects.enter('reference');
6081    effects.enter('referenceMarker');
6082    effects.consume(code);
6083    effects.exit('referenceMarker');
6084    return referenceCollapsedOpen
6085  }
6086  function referenceCollapsedOpen(code) {
6087    if (code === 93) {
6088      effects.enter('referenceMarker');
6089      effects.consume(code);
6090      effects.exit('referenceMarker');
6091      effects.exit('reference');
6092      return ok
6093    }
6094    return nok(code)
6095  }
6096}
6097
6098const labelStartImage = {
6099  name: 'labelStartImage',
6100  tokenize: tokenizeLabelStartImage,
6101  resolveAll: labelEnd.resolveAll
6102};
6103function tokenizeLabelStartImage(effects, ok, nok) {
6104  const self = this;
6105  return start
6106  function start(code) {
6107    effects.enter('labelImage');
6108    effects.enter('labelImageMarker');
6109    effects.consume(code);
6110    effects.exit('labelImageMarker');
6111    return open
6112  }
6113  function open(code) {
6114    if (code === 91) {
6115      effects.enter('labelMarker');
6116      effects.consume(code);
6117      effects.exit('labelMarker');
6118      effects.exit('labelImage');
6119      return after
6120    }
6121    return nok(code)
6122  }
6123  function after(code) {
6124    return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs
6125      ? nok(code)
6126      : ok(code)
6127  }
6128}
6129
6130const labelStartLink = {
6131  name: 'labelStartLink',
6132  tokenize: tokenizeLabelStartLink,
6133  resolveAll: labelEnd.resolveAll
6134};
6135function tokenizeLabelStartLink(effects, ok, nok) {
6136  const self = this;
6137  return start
6138  function start(code) {
6139    effects.enter('labelLink');
6140    effects.enter('labelMarker');
6141    effects.consume(code);
6142    effects.exit('labelMarker');
6143    effects.exit('labelLink');
6144    return after
6145  }
6146  function after(code) {
6147    return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs
6148      ? nok(code)
6149      : ok(code)
6150  }
6151}
6152
6153const lineEnding = {
6154  name: 'lineEnding',
6155  tokenize: tokenizeLineEnding
6156};
6157function tokenizeLineEnding(effects, ok) {
6158  return start
6159  function start(code) {
6160    effects.enter('lineEnding');
6161    effects.consume(code);
6162    effects.exit('lineEnding');
6163    return factorySpace(effects, ok, 'linePrefix')
6164  }
6165}
6166
6167const thematicBreak$1 = {
6168  name: 'thematicBreak',
6169  tokenize: tokenizeThematicBreak
6170};
6171function tokenizeThematicBreak(effects, ok, nok) {
6172  let size = 0;
6173  let marker;
6174  return start
6175  function start(code) {
6176    effects.enter('thematicBreak');
6177    return before(code)
6178  }
6179  function before(code) {
6180    marker = code;
6181    return atBreak(code)
6182  }
6183  function atBreak(code) {
6184    if (code === marker) {
6185      effects.enter('thematicBreakSequence');
6186      return sequence(code)
6187    }
6188    if (size >= 3 && (code === null || markdownLineEnding(code))) {
6189      effects.exit('thematicBreak');
6190      return ok(code)
6191    }
6192    return nok(code)
6193  }
6194  function sequence(code) {
6195    if (code === marker) {
6196      effects.consume(code);
6197      size++;
6198      return sequence
6199    }
6200    effects.exit('thematicBreakSequence');
6201    return markdownSpace(code)
6202      ? factorySpace(effects, atBreak, 'whitespace')(code)
6203      : atBreak(code)
6204  }
6205}
6206
6207const list$2 = {
6208  name: 'list',
6209  tokenize: tokenizeListStart,
6210  continuation: {
6211    tokenize: tokenizeListContinuation
6212  },
6213  exit: tokenizeListEnd
6214};
6215const listItemPrefixWhitespaceConstruct = {
6216  tokenize: tokenizeListItemPrefixWhitespace,
6217  partial: true
6218};
6219const indentConstruct = {
6220  tokenize: tokenizeIndent$1,
6221  partial: true
6222};
6223function tokenizeListStart(effects, ok, nok) {
6224  const self = this;
6225  const tail = self.events[self.events.length - 1];
6226  let initialSize =
6227    tail && tail[1].type === 'linePrefix'
6228      ? tail[2].sliceSerialize(tail[1], true).length
6229      : 0;
6230  let size = 0;
6231  return start
6232  function start(code) {
6233    const kind =
6234      self.containerState.type ||
6235      (code === 42 || code === 43 || code === 45
6236        ? 'listUnordered'
6237        : 'listOrdered');
6238    if (
6239      kind === 'listUnordered'
6240        ? !self.containerState.marker || code === self.containerState.marker
6241        : asciiDigit(code)
6242    ) {
6243      if (!self.containerState.type) {
6244        self.containerState.type = kind;
6245        effects.enter(kind, {
6246          _container: true
6247        });
6248      }
6249      if (kind === 'listUnordered') {
6250        effects.enter('listItemPrefix');
6251        return code === 42 || code === 45
6252          ? effects.check(thematicBreak$1, nok, atMarker)(code)
6253          : atMarker(code)
6254      }
6255      if (!self.interrupt || code === 49) {
6256        effects.enter('listItemPrefix');
6257        effects.enter('listItemValue');
6258        return inside(code)
6259      }
6260    }
6261    return nok(code)
6262  }
6263  function inside(code) {
6264    if (asciiDigit(code) && ++size < 10) {
6265      effects.consume(code);
6266      return inside
6267    }
6268    if (
6269      (!self.interrupt || size < 2) &&
6270      (self.containerState.marker
6271        ? code === self.containerState.marker
6272        : code === 41 || code === 46)
6273    ) {
6274      effects.exit('listItemValue');
6275      return atMarker(code)
6276    }
6277    return nok(code)
6278  }
6279  function atMarker(code) {
6280    effects.enter('listItemMarker');
6281    effects.consume(code);
6282    effects.exit('listItemMarker');
6283    self.containerState.marker = self.containerState.marker || code;
6284    return effects.check(
6285      blankLine,
6286      self.interrupt ? nok : onBlank,
6287      effects.attempt(
6288        listItemPrefixWhitespaceConstruct,
6289        endOfPrefix,
6290        otherPrefix
6291      )
6292    )
6293  }
6294  function onBlank(code) {
6295    self.containerState.initialBlankLine = true;
6296    initialSize++;
6297    return endOfPrefix(code)
6298  }
6299  function otherPrefix(code) {
6300    if (markdownSpace(code)) {
6301      effects.enter('listItemPrefixWhitespace');
6302      effects.consume(code);
6303      effects.exit('listItemPrefixWhitespace');
6304      return endOfPrefix
6305    }
6306    return nok(code)
6307  }
6308  function endOfPrefix(code) {
6309    self.containerState.size =
6310      initialSize +
6311      self.sliceSerialize(effects.exit('listItemPrefix'), true).length;
6312    return ok(code)
6313  }
6314}
6315function tokenizeListContinuation(effects, ok, nok) {
6316  const self = this;
6317  self.containerState._closeFlow = undefined;
6318  return effects.check(blankLine, onBlank, notBlank)
6319  function onBlank(code) {
6320    self.containerState.furtherBlankLines =
6321      self.containerState.furtherBlankLines ||
6322      self.containerState.initialBlankLine;
6323    return factorySpace(
6324      effects,
6325      ok,
6326      'listItemIndent',
6327      self.containerState.size + 1
6328    )(code)
6329  }
6330  function notBlank(code) {
6331    if (self.containerState.furtherBlankLines || !markdownSpace(code)) {
6332      self.containerState.furtherBlankLines = undefined;
6333      self.containerState.initialBlankLine = undefined;
6334      return notInCurrentItem(code)
6335    }
6336    self.containerState.furtherBlankLines = undefined;
6337    self.containerState.initialBlankLine = undefined;
6338    return effects.attempt(indentConstruct, ok, notInCurrentItem)(code)
6339  }
6340  function notInCurrentItem(code) {
6341    self.containerState._closeFlow = true;
6342    self.interrupt = undefined;
6343    return factorySpace(
6344      effects,
6345      effects.attempt(list$2, ok, nok),
6346      'linePrefix',
6347      self.parser.constructs.disable.null.includes('codeIndented')
6348        ? undefined
6349        : 4
6350    )(code)
6351  }
6352}
6353function tokenizeIndent$1(effects, ok, nok) {
6354  const self = this;
6355  return factorySpace(
6356    effects,
6357    afterPrefix,
6358    'listItemIndent',
6359    self.containerState.size + 1
6360  )
6361  function afterPrefix(code) {
6362    const tail = self.events[self.events.length - 1];
6363    return tail &&
6364      tail[1].type === 'listItemIndent' &&
6365      tail[2].sliceSerialize(tail[1], true).length === self.containerState.size
6366      ? ok(code)
6367      : nok(code)
6368  }
6369}
6370function tokenizeListEnd(effects) {
6371  effects.exit(this.containerState.type);
6372}
6373function tokenizeListItemPrefixWhitespace(effects, ok, nok) {
6374  const self = this;
6375  return factorySpace(
6376    effects,
6377    afterPrefix,
6378    'listItemPrefixWhitespace',
6379    self.parser.constructs.disable.null.includes('codeIndented')
6380      ? undefined
6381      : 4 + 1
6382  )
6383  function afterPrefix(code) {
6384    const tail = self.events[self.events.length - 1];
6385    return !markdownSpace(code) &&
6386      tail &&
6387      tail[1].type === 'listItemPrefixWhitespace'
6388      ? ok(code)
6389      : nok(code)
6390  }
6391}
6392
6393const setextUnderline = {
6394  name: 'setextUnderline',
6395  tokenize: tokenizeSetextUnderline,
6396  resolveTo: resolveToSetextUnderline
6397};
6398function resolveToSetextUnderline(events, context) {
6399  let index = events.length;
6400  let content;
6401  let text;
6402  let definition;
6403  while (index--) {
6404    if (events[index][0] === 'enter') {
6405      if (events[index][1].type === 'content') {
6406        content = index;
6407        break
6408      }
6409      if (events[index][1].type === 'paragraph') {
6410        text = index;
6411      }
6412    }
6413    else {
6414      if (events[index][1].type === 'content') {
6415        events.splice(index, 1);
6416      }
6417      if (!definition && events[index][1].type === 'definition') {
6418        definition = index;
6419      }
6420    }
6421  }
6422  const heading = {
6423    type: 'setextHeading',
6424    start: Object.assign({}, events[text][1].start),
6425    end: Object.assign({}, events[events.length - 1][1].end)
6426  };
6427  events[text][1].type = 'setextHeadingText';
6428  if (definition) {
6429    events.splice(text, 0, ['enter', heading, context]);
6430    events.splice(definition + 1, 0, ['exit', events[content][1], context]);
6431    events[content][1].end = Object.assign({}, events[definition][1].end);
6432  } else {
6433    events[content][1] = heading;
6434  }
6435  events.push(['exit', heading, context]);
6436  return events
6437}
6438function tokenizeSetextUnderline(effects, ok, nok) {
6439  const self = this;
6440  let marker;
6441  return start
6442  function start(code) {
6443    let index = self.events.length;
6444    let paragraph;
6445    while (index--) {
6446      if (
6447        self.events[index][1].type !== 'lineEnding' &&
6448        self.events[index][1].type !== 'linePrefix' &&
6449        self.events[index][1].type !== 'content'
6450      ) {
6451        paragraph = self.events[index][1].type === 'paragraph';
6452        break
6453      }
6454    }
6455    if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {
6456      effects.enter('setextHeadingLine');
6457      marker = code;
6458      return before(code)
6459    }
6460    return nok(code)
6461  }
6462  function before(code) {
6463    effects.enter('setextHeadingLineSequence');
6464    return inside(code)
6465  }
6466  function inside(code) {
6467    if (code === marker) {
6468      effects.consume(code);
6469      return inside
6470    }
6471    effects.exit('setextHeadingLineSequence');
6472    return markdownSpace(code)
6473      ? factorySpace(effects, after, 'lineSuffix')(code)
6474      : after(code)
6475  }
6476  function after(code) {
6477    if (code === null || markdownLineEnding(code)) {
6478      effects.exit('setextHeadingLine');
6479      return ok(code)
6480    }
6481    return nok(code)
6482  }
6483}
6484
6485const flow$1 = {
6486  tokenize: initializeFlow
6487};
6488function initializeFlow(effects) {
6489  const self = this;
6490  const initial = effects.attempt(
6491    blankLine,
6492    atBlankEnding,
6493    effects.attempt(
6494      this.parser.constructs.flowInitial,
6495      afterConstruct,
6496      factorySpace(
6497        effects,
6498        effects.attempt(
6499          this.parser.constructs.flow,
6500          afterConstruct,
6501          effects.attempt(content, afterConstruct)
6502        ),
6503        'linePrefix'
6504      )
6505    )
6506  );
6507  return initial
6508  function atBlankEnding(code) {
6509    if (code === null) {
6510      effects.consume(code);
6511      return
6512    }
6513    effects.enter('lineEndingBlank');
6514    effects.consume(code);
6515    effects.exit('lineEndingBlank');
6516    self.currentConstruct = undefined;
6517    return initial
6518  }
6519  function afterConstruct(code) {
6520    if (code === null) {
6521      effects.consume(code);
6522      return
6523    }
6524    effects.enter('lineEnding');
6525    effects.consume(code);
6526    effects.exit('lineEnding');
6527    self.currentConstruct = undefined;
6528    return initial
6529  }
6530}
6531
6532const resolver = {
6533  resolveAll: createResolver()
6534};
6535const string$1 = initializeFactory('string');
6536const text$3 = initializeFactory('text');
6537function initializeFactory(field) {
6538  return {
6539    tokenize: initializeText,
6540    resolveAll: createResolver(
6541      field === 'text' ? resolveAllLineSuffixes : undefined
6542    )
6543  }
6544  function initializeText(effects) {
6545    const self = this;
6546    const constructs = this.parser.constructs[field];
6547    const text = effects.attempt(constructs, start, notText);
6548    return start
6549    function start(code) {
6550      return atBreak(code) ? text(code) : notText(code)
6551    }
6552    function notText(code) {
6553      if (code === null) {
6554        effects.consume(code);
6555        return
6556      }
6557      effects.enter('data');
6558      effects.consume(code);
6559      return data
6560    }
6561    function data(code) {
6562      if (atBreak(code)) {
6563        effects.exit('data');
6564        return text(code)
6565      }
6566      effects.consume(code);
6567      return data
6568    }
6569    function atBreak(code) {
6570      if (code === null) {
6571        return true
6572      }
6573      const list = constructs[code];
6574      let index = -1;
6575      if (list) {
6576        while (++index < list.length) {
6577          const item = list[index];
6578          if (!item.previous || item.previous.call(self, self.previous)) {
6579            return true
6580          }
6581        }
6582      }
6583      return false
6584    }
6585  }
6586}
6587function createResolver(extraResolver) {
6588  return resolveAllText
6589  function resolveAllText(events, context) {
6590    let index = -1;
6591    let enter;
6592    while (++index <= events.length) {
6593      if (enter === undefined) {
6594        if (events[index] && events[index][1].type === 'data') {
6595          enter = index;
6596          index++;
6597        }
6598      } else if (!events[index] || events[index][1].type !== 'data') {
6599        if (index !== enter + 2) {
6600          events[enter][1].end = events[index - 1][1].end;
6601          events.splice(enter + 2, index - enter - 2);
6602          index = enter + 2;
6603        }
6604        enter = undefined;
6605      }
6606    }
6607    return extraResolver ? extraResolver(events, context) : events
6608  }
6609}
6610function resolveAllLineSuffixes(events, context) {
6611  let eventIndex = 0;
6612  while (++eventIndex <= events.length) {
6613    if (
6614      (eventIndex === events.length ||
6615        events[eventIndex][1].type === 'lineEnding') &&
6616      events[eventIndex - 1][1].type === 'data'
6617    ) {
6618      const data = events[eventIndex - 1][1];
6619      const chunks = context.sliceStream(data);
6620      let index = chunks.length;
6621      let bufferIndex = -1;
6622      let size = 0;
6623      let tabs;
6624      while (index--) {
6625        const chunk = chunks[index];
6626        if (typeof chunk === 'string') {
6627          bufferIndex = chunk.length;
6628          while (chunk.charCodeAt(bufferIndex - 1) === 32) {
6629            size++;
6630            bufferIndex--;
6631          }
6632          if (bufferIndex) break
6633          bufferIndex = -1;
6634        }
6635        else if (chunk === -2) {
6636          tabs = true;
6637          size++;
6638        } else if (chunk === -1) ; else {
6639          index++;
6640          break
6641        }
6642      }
6643      if (size) {
6644        const token = {
6645          type:
6646            eventIndex === events.length || tabs || size < 2
6647              ? 'lineSuffix'
6648              : 'hardBreakTrailing',
6649          start: {
6650            line: data.end.line,
6651            column: data.end.column - size,
6652            offset: data.end.offset - size,
6653            _index: data.start._index + index,
6654            _bufferIndex: index
6655              ? bufferIndex
6656              : data.start._bufferIndex + bufferIndex
6657          },
6658          end: Object.assign({}, data.end)
6659        };
6660        data.end = Object.assign({}, token.start);
6661        if (data.start.offset === data.end.offset) {
6662          Object.assign(data, token);
6663        } else {
6664          events.splice(
6665            eventIndex,
6666            0,
6667            ['enter', token, context],
6668            ['exit', token, context]
6669          );
6670          eventIndex += 2;
6671        }
6672      }
6673      eventIndex++;
6674    }
6675  }
6676  return events
6677}
6678
6679function createTokenizer(parser, initialize, from) {
6680  let point = Object.assign(
6681    from
6682      ? Object.assign({}, from)
6683      : {
6684          line: 1,
6685          column: 1,
6686          offset: 0
6687        },
6688    {
6689      _index: 0,
6690      _bufferIndex: -1
6691    }
6692  );
6693  const columnStart = {};
6694  const resolveAllConstructs = [];
6695  let chunks = [];
6696  let stack = [];
6697  const effects = {
6698    consume,
6699    enter,
6700    exit,
6701    attempt: constructFactory(onsuccessfulconstruct),
6702    check: constructFactory(onsuccessfulcheck),
6703    interrupt: constructFactory(onsuccessfulcheck, {
6704      interrupt: true
6705    })
6706  };
6707  const context = {
6708    previous: null,
6709    code: null,
6710    containerState: {},
6711    events: [],
6712    parser,
6713    sliceStream,
6714    sliceSerialize,
6715    now,
6716    defineSkip,
6717    write
6718  };
6719  let state = initialize.tokenize.call(context, effects);
6720  if (initialize.resolveAll) {
6721    resolveAllConstructs.push(initialize);
6722  }
6723  return context
6724  function write(slice) {
6725    chunks = push(chunks, slice);
6726    main();
6727    if (chunks[chunks.length - 1] !== null) {
6728      return []
6729    }
6730    addResult(initialize, 0);
6731    context.events = resolveAll(resolveAllConstructs, context.events, context);
6732    return context.events
6733  }
6734  function sliceSerialize(token, expandTabs) {
6735    return serializeChunks(sliceStream(token), expandTabs)
6736  }
6737  function sliceStream(token) {
6738    return sliceChunks(chunks, token)
6739  }
6740  function now() {
6741    const {line, column, offset, _index, _bufferIndex} = point;
6742    return {
6743      line,
6744      column,
6745      offset,
6746      _index,
6747      _bufferIndex
6748    }
6749  }
6750  function defineSkip(value) {
6751    columnStart[value.line] = value.column;
6752    accountForPotentialSkip();
6753  }
6754  function main() {
6755    let chunkIndex;
6756    while (point._index < chunks.length) {
6757      const chunk = chunks[point._index];
6758      if (typeof chunk === 'string') {
6759        chunkIndex = point._index;
6760        if (point._bufferIndex < 0) {
6761          point._bufferIndex = 0;
6762        }
6763        while (
6764          point._index === chunkIndex &&
6765          point._bufferIndex < chunk.length
6766        ) {
6767          go(chunk.charCodeAt(point._bufferIndex));
6768        }
6769      } else {
6770        go(chunk);
6771      }
6772    }
6773  }
6774  function go(code) {
6775    state = state(code);
6776  }
6777  function consume(code) {
6778    if (markdownLineEnding(code)) {
6779      point.line++;
6780      point.column = 1;
6781      point.offset += code === -3 ? 2 : 1;
6782      accountForPotentialSkip();
6783    } else if (code !== -1) {
6784      point.column++;
6785      point.offset++;
6786    }
6787    if (point._bufferIndex < 0) {
6788      point._index++;
6789    } else {
6790      point._bufferIndex++;
6791      if (point._bufferIndex === chunks[point._index].length) {
6792        point._bufferIndex = -1;
6793        point._index++;
6794      }
6795    }
6796    context.previous = code;
6797  }
6798  function enter(type, fields) {
6799    const token = fields || {};
6800    token.type = type;
6801    token.start = now();
6802    context.events.push(['enter', token, context]);
6803    stack.push(token);
6804    return token
6805  }
6806  function exit(type) {
6807    const token = stack.pop();
6808    token.end = now();
6809    context.events.push(['exit', token, context]);
6810    return token
6811  }
6812  function onsuccessfulconstruct(construct, info) {
6813    addResult(construct, info.from);
6814  }
6815  function onsuccessfulcheck(_, info) {
6816    info.restore();
6817  }
6818  function constructFactory(onreturn, fields) {
6819    return hook
6820    function hook(constructs, returnState, bogusState) {
6821      let listOfConstructs;
6822      let constructIndex;
6823      let currentConstruct;
6824      let info;
6825      return Array.isArray(constructs)
6826        ? handleListOfConstructs(constructs)
6827        : 'tokenize' in constructs
6828        ?
6829          handleListOfConstructs([constructs])
6830        : handleMapOfConstructs(constructs)
6831      function handleMapOfConstructs(map) {
6832        return start
6833        function start(code) {
6834          const def = code !== null && map[code];
6835          const all = code !== null && map.null;
6836          const list = [
6837            ...(Array.isArray(def) ? def : def ? [def] : []),
6838            ...(Array.isArray(all) ? all : all ? [all] : [])
6839          ];
6840          return handleListOfConstructs(list)(code)
6841        }
6842      }
6843      function handleListOfConstructs(list) {
6844        listOfConstructs = list;
6845        constructIndex = 0;
6846        if (list.length === 0) {
6847          return bogusState
6848        }
6849        return handleConstruct(list[constructIndex])
6850      }
6851      function handleConstruct(construct) {
6852        return start
6853        function start(code) {
6854          info = store();
6855          currentConstruct = construct;
6856          if (!construct.partial) {
6857            context.currentConstruct = construct;
6858          }
6859          if (
6860            construct.name &&
6861            context.parser.constructs.disable.null.includes(construct.name)
6862          ) {
6863            return nok()
6864          }
6865          return construct.tokenize.call(
6866            fields ? Object.assign(Object.create(context), fields) : context,
6867            effects,
6868            ok,
6869            nok
6870          )(code)
6871        }
6872      }
6873      function ok(code) {
6874        onreturn(currentConstruct, info);
6875        return returnState
6876      }
6877      function nok(code) {
6878        info.restore();
6879        if (++constructIndex < listOfConstructs.length) {
6880          return handleConstruct(listOfConstructs[constructIndex])
6881        }
6882        return bogusState
6883      }
6884    }
6885  }
6886  function addResult(construct, from) {
6887    if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
6888      resolveAllConstructs.push(construct);
6889    }
6890    if (construct.resolve) {
6891      splice(
6892        context.events,
6893        from,
6894        context.events.length - from,
6895        construct.resolve(context.events.slice(from), context)
6896      );
6897    }
6898    if (construct.resolveTo) {
6899      context.events = construct.resolveTo(context.events, context);
6900    }
6901  }
6902  function store() {
6903    const startPoint = now();
6904    const startPrevious = context.previous;
6905    const startCurrentConstruct = context.currentConstruct;
6906    const startEventsIndex = context.events.length;
6907    const startStack = Array.from(stack);
6908    return {
6909      restore,
6910      from: startEventsIndex
6911    }
6912    function restore() {
6913      point = startPoint;
6914      context.previous = startPrevious;
6915      context.currentConstruct = startCurrentConstruct;
6916      context.events.length = startEventsIndex;
6917      stack = startStack;
6918      accountForPotentialSkip();
6919    }
6920  }
6921  function accountForPotentialSkip() {
6922    if (point.line in columnStart && point.column < 2) {
6923      point.column = columnStart[point.line];
6924      point.offset += columnStart[point.line] - 1;
6925    }
6926  }
6927}
6928function sliceChunks(chunks, token) {
6929  const startIndex = token.start._index;
6930  const startBufferIndex = token.start._bufferIndex;
6931  const endIndex = token.end._index;
6932  const endBufferIndex = token.end._bufferIndex;
6933  let view;
6934  if (startIndex === endIndex) {
6935    view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
6936  } else {
6937    view = chunks.slice(startIndex, endIndex);
6938    if (startBufferIndex > -1) {
6939      const head = view[0];
6940      if (typeof head === 'string') {
6941        view[0] = head.slice(startBufferIndex);
6942      } else {
6943        view.shift();
6944      }
6945    }
6946    if (endBufferIndex > 0) {
6947      view.push(chunks[endIndex].slice(0, endBufferIndex));
6948    }
6949  }
6950  return view
6951}
6952function serializeChunks(chunks, expandTabs) {
6953  let index = -1;
6954  const result = [];
6955  let atTab;
6956  while (++index < chunks.length) {
6957    const chunk = chunks[index];
6958    let value;
6959    if (typeof chunk === 'string') {
6960      value = chunk;
6961    } else
6962      switch (chunk) {
6963        case -5: {
6964          value = '\r';
6965          break
6966        }
6967        case -4: {
6968          value = '\n';
6969          break
6970        }
6971        case -3: {
6972          value = '\r' + '\n';
6973          break
6974        }
6975        case -2: {
6976          value = expandTabs ? ' ' : '\t';
6977          break
6978        }
6979        case -1: {
6980          if (!expandTabs && atTab) continue
6981          value = ' ';
6982          break
6983        }
6984        default: {
6985          value = String.fromCharCode(chunk);
6986        }
6987      }
6988    atTab = chunk === -2;
6989    result.push(value);
6990  }
6991  return result.join('')
6992}
6993
6994const document = {
6995  [42]: list$2,
6996  [43]: list$2,
6997  [45]: list$2,
6998  [48]: list$2,
6999  [49]: list$2,
7000  [50]: list$2,
7001  [51]: list$2,
7002  [52]: list$2,
7003  [53]: list$2,
7004  [54]: list$2,
7005  [55]: list$2,
7006  [56]: list$2,
7007  [57]: list$2,
7008  [62]: blockQuote
7009};
7010const contentInitial = {
7011  [91]: definition$1
7012};
7013const flowInitial = {
7014  [-2]: codeIndented,
7015  [-1]: codeIndented,
7016  [32]: codeIndented
7017};
7018const flow = {
7019  [35]: headingAtx,
7020  [42]: thematicBreak$1,
7021  [45]: [setextUnderline, thematicBreak$1],
7022  [60]: htmlFlow,
7023  [61]: setextUnderline,
7024  [95]: thematicBreak$1,
7025  [96]: codeFenced,
7026  [126]: codeFenced
7027};
7028const string = {
7029  [38]: characterReference,
7030  [92]: characterEscape
7031};
7032const text$2 = {
7033  [-5]: lineEnding,
7034  [-4]: lineEnding,
7035  [-3]: lineEnding,
7036  [33]: labelStartImage,
7037  [38]: characterReference,
7038  [42]: attention,
7039  [60]: [autolink, htmlText],
7040  [91]: labelStartLink,
7041  [92]: [hardBreakEscape, characterEscape],
7042  [93]: labelEnd,
7043  [95]: attention,
7044  [96]: codeText
7045};
7046const insideSpan = {
7047  null: [attention, resolver]
7048};
7049const attentionMarkers = {
7050  null: [42, 95]
7051};
7052const disable = {
7053  null: []
7054};
7055
7056var defaultConstructs = /*#__PURE__*/Object.freeze({
7057  __proto__: null,
7058  attentionMarkers: attentionMarkers,
7059  contentInitial: contentInitial,
7060  disable: disable,
7061  document: document,
7062  flow: flow,
7063  flowInitial: flowInitial,
7064  insideSpan: insideSpan,
7065  string: string,
7066  text: text$2
7067});
7068
7069function parse$1(options) {
7070  const settings = options || {};
7071  const constructs =
7072    combineExtensions([defaultConstructs, ...(settings.extensions || [])]);
7073  const parser = {
7074    defined: [],
7075    lazy: {},
7076    constructs,
7077    content: create(content$1),
7078    document: create(document$1),
7079    flow: create(flow$1),
7080    string: create(string$1),
7081    text: create(text$3)
7082  };
7083  return parser
7084  function create(initial) {
7085    return creator
7086    function creator(from) {
7087      return createTokenizer(parser, initial, from)
7088    }
7089  }
7090}
7091
7092function postprocess(events) {
7093  while (!subtokenize(events)) {
7094  }
7095  return events
7096}
7097
7098const search = /[\0\t\n\r]/g;
7099function preprocess() {
7100  let column = 1;
7101  let buffer = '';
7102  let start = true;
7103  let atCarriageReturn;
7104  return preprocessor
7105  function preprocessor(value, encoding, end) {
7106    const chunks = [];
7107    let match;
7108    let next;
7109    let startPosition;
7110    let endPosition;
7111    let code;
7112    value =
7113      buffer +
7114      (typeof value === 'string'
7115        ? value.toString()
7116        : new TextDecoder(encoding || undefined).decode(value));
7117    startPosition = 0;
7118    buffer = '';
7119    if (start) {
7120      if (value.charCodeAt(0) === 65279) {
7121        startPosition++;
7122      }
7123      start = undefined;
7124    }
7125    while (startPosition < value.length) {
7126      search.lastIndex = startPosition;
7127      match = search.exec(value);
7128      endPosition =
7129        match && match.index !== undefined ? match.index : value.length;
7130      code = value.charCodeAt(endPosition);
7131      if (!match) {
7132        buffer = value.slice(startPosition);
7133        break
7134      }
7135      if (code === 10 && startPosition === endPosition && atCarriageReturn) {
7136        chunks.push(-3);
7137        atCarriageReturn = undefined;
7138      } else {
7139        if (atCarriageReturn) {
7140          chunks.push(-5);
7141          atCarriageReturn = undefined;
7142        }
7143        if (startPosition < endPosition) {
7144          chunks.push(value.slice(startPosition, endPosition));
7145          column += endPosition - startPosition;
7146        }
7147        switch (code) {
7148          case 0: {
7149            chunks.push(65533);
7150            column++;
7151            break
7152          }
7153          case 9: {
7154            next = Math.ceil(column / 4) * 4;
7155            chunks.push(-2);
7156            while (column++ < next) chunks.push(-1);
7157            break
7158          }
7159          case 10: {
7160            chunks.push(-4);
7161            column = 1;
7162            break
7163          }
7164          default: {
7165            atCarriageReturn = true;
7166            column = 1;
7167          }
7168        }
7169      }
7170      startPosition = endPosition + 1;
7171    }
7172    if (end) {
7173      if (atCarriageReturn) chunks.push(-5);
7174      if (buffer) chunks.push(buffer);
7175      chunks.push(null);
7176    }
7177    return chunks
7178  }
7179}
7180
7181const characterEscapeOrReference =
7182  /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
7183function decodeString(value) {
7184  return value.replace(characterEscapeOrReference, decode)
7185}
7186function decode($0, $1, $2) {
7187  if ($1) {
7188    return $1
7189  }
7190  const head = $2.charCodeAt(0);
7191  if (head === 35) {
7192    const head = $2.charCodeAt(1);
7193    const hex = head === 120 || head === 88;
7194    return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10)
7195  }
7196  return decodeNamedCharacterReference($2) || $0
7197}
7198
7199const own$4 = {}.hasOwnProperty;
7200function fromMarkdown(value, encoding, options) {
7201  if (typeof encoding !== 'string') {
7202    options = encoding;
7203    encoding = undefined;
7204  }
7205  return compiler(options)(
7206    postprocess(
7207      parse$1(options).document().write(preprocess()(value, encoding, true))
7208    )
7209  )
7210}
7211function compiler(options) {
7212  const config = {
7213    transforms: [],
7214    canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],
7215    enter: {
7216      autolink: opener(link),
7217      autolinkProtocol: onenterdata,
7218      autolinkEmail: onenterdata,
7219      atxHeading: opener(heading),
7220      blockQuote: opener(blockQuote),
7221      characterEscape: onenterdata,
7222      characterReference: onenterdata,
7223      codeFenced: opener(codeFlow),
7224      codeFencedFenceInfo: buffer,
7225      codeFencedFenceMeta: buffer,
7226      codeIndented: opener(codeFlow, buffer),
7227      codeText: opener(codeText, buffer),
7228      codeTextData: onenterdata,
7229      data: onenterdata,
7230      codeFlowValue: onenterdata,
7231      definition: opener(definition),
7232      definitionDestinationString: buffer,
7233      definitionLabelString: buffer,
7234      definitionTitleString: buffer,
7235      emphasis: opener(emphasis),
7236      hardBreakEscape: opener(hardBreak),
7237      hardBreakTrailing: opener(hardBreak),
7238      htmlFlow: opener(html, buffer),
7239      htmlFlowData: onenterdata,
7240      htmlText: opener(html, buffer),
7241      htmlTextData: onenterdata,
7242      image: opener(image),
7243      label: buffer,
7244      link: opener(link),
7245      listItem: opener(listItem),
7246      listItemValue: onenterlistitemvalue,
7247      listOrdered: opener(list, onenterlistordered),
7248      listUnordered: opener(list),
7249      paragraph: opener(paragraph),
7250      reference: onenterreference,
7251      referenceString: buffer,
7252      resourceDestinationString: buffer,
7253      resourceTitleString: buffer,
7254      setextHeading: opener(heading),
7255      strong: opener(strong),
7256      thematicBreak: opener(thematicBreak)
7257    },
7258    exit: {
7259      atxHeading: closer(),
7260      atxHeadingSequence: onexitatxheadingsequence,
7261      autolink: closer(),
7262      autolinkEmail: onexitautolinkemail,
7263      autolinkProtocol: onexitautolinkprotocol,
7264      blockQuote: closer(),
7265      characterEscapeValue: onexitdata,
7266      characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
7267      characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
7268      characterReferenceValue: onexitcharacterreferencevalue,
7269      codeFenced: closer(onexitcodefenced),
7270      codeFencedFence: onexitcodefencedfence,
7271      codeFencedFenceInfo: onexitcodefencedfenceinfo,
7272      codeFencedFenceMeta: onexitcodefencedfencemeta,
7273      codeFlowValue: onexitdata,
7274      codeIndented: closer(onexitcodeindented),
7275      codeText: closer(onexitcodetext),
7276      codeTextData: onexitdata,
7277      data: onexitdata,
7278      definition: closer(),
7279      definitionDestinationString: onexitdefinitiondestinationstring,
7280      definitionLabelString: onexitdefinitionlabelstring,
7281      definitionTitleString: onexitdefinitiontitlestring,
7282      emphasis: closer(),
7283      hardBreakEscape: closer(onexithardbreak),
7284      hardBreakTrailing: closer(onexithardbreak),
7285      htmlFlow: closer(onexithtmlflow),
7286      htmlFlowData: onexitdata,
7287      htmlText: closer(onexithtmltext),
7288      htmlTextData: onexitdata,
7289      image: closer(onexitimage),
7290      label: onexitlabel,
7291      labelText: onexitlabeltext,
7292      lineEnding: onexitlineending,
7293      link: closer(onexitlink),
7294      listItem: closer(),
7295      listOrdered: closer(),
7296      listUnordered: closer(),
7297      paragraph: closer(),
7298      referenceString: onexitreferencestring,
7299      resourceDestinationString: onexitresourcedestinationstring,
7300      resourceTitleString: onexitresourcetitlestring,
7301      resource: onexitresource,
7302      setextHeading: closer(onexitsetextheading),
7303      setextHeadingLineSequence: onexitsetextheadinglinesequence,
7304      setextHeadingText: onexitsetextheadingtext,
7305      strong: closer(),
7306      thematicBreak: closer()
7307    }
7308  };
7309  configure$1(config, (options || {}).mdastExtensions || []);
7310  const data = {};
7311  return compile
7312  function compile(events) {
7313    let tree = {
7314      type: 'root',
7315      children: []
7316    };
7317    const context = {
7318      stack: [tree],
7319      tokenStack: [],
7320      config,
7321      enter,
7322      exit,
7323      buffer,
7324      resume,
7325      data
7326    };
7327    const listStack = [];
7328    let index = -1;
7329    while (++index < events.length) {
7330      if (
7331        events[index][1].type === 'listOrdered' ||
7332        events[index][1].type === 'listUnordered'
7333      ) {
7334        if (events[index][0] === 'enter') {
7335          listStack.push(index);
7336        } else {
7337          const tail = listStack.pop();
7338          index = prepareList(events, tail, index);
7339        }
7340      }
7341    }
7342    index = -1;
7343    while (++index < events.length) {
7344      const handler = config[events[index][0]];
7345      if (own$4.call(handler, events[index][1].type)) {
7346        handler[events[index][1].type].call(
7347          Object.assign(
7348            {
7349              sliceSerialize: events[index][2].sliceSerialize
7350            },
7351            context
7352          ),
7353          events[index][1]
7354        );
7355      }
7356    }
7357    if (context.tokenStack.length > 0) {
7358      const tail = context.tokenStack[context.tokenStack.length - 1];
7359      const handler = tail[1] || defaultOnError;
7360      handler.call(context, undefined, tail[0]);
7361    }
7362    tree.position = {
7363      start: point$3(
7364        events.length > 0
7365          ? events[0][1].start
7366          : {
7367              line: 1,
7368              column: 1,
7369              offset: 0
7370            }
7371      ),
7372      end: point$3(
7373        events.length > 0
7374          ? events[events.length - 2][1].end
7375          : {
7376              line: 1,
7377              column: 1,
7378              offset: 0
7379            }
7380      )
7381    };
7382    index = -1;
7383    while (++index < config.transforms.length) {
7384      tree = config.transforms[index](tree) || tree;
7385    }
7386    return tree
7387  }
7388  function prepareList(events, start, length) {
7389    let index = start - 1;
7390    let containerBalance = -1;
7391    let listSpread = false;
7392    let listItem;
7393    let lineIndex;
7394    let firstBlankLineIndex;
7395    let atMarker;
7396    while (++index <= length) {
7397      const event = events[index];
7398      switch (event[1].type) {
7399        case 'listUnordered':
7400        case 'listOrdered':
7401        case 'blockQuote': {
7402          if (event[0] === 'enter') {
7403            containerBalance++;
7404          } else {
7405            containerBalance--;
7406          }
7407          atMarker = undefined;
7408          break
7409        }
7410        case 'lineEndingBlank': {
7411          if (event[0] === 'enter') {
7412            if (
7413              listItem &&
7414              !atMarker &&
7415              !containerBalance &&
7416              !firstBlankLineIndex
7417            ) {
7418              firstBlankLineIndex = index;
7419            }
7420            atMarker = undefined;
7421          }
7422          break
7423        }
7424        case 'linePrefix':
7425        case 'listItemValue':
7426        case 'listItemMarker':
7427        case 'listItemPrefix':
7428        case 'listItemPrefixWhitespace': {
7429          break
7430        }
7431        default: {
7432          atMarker = undefined;
7433        }
7434      }
7435      if (
7436        (!containerBalance &&
7437          event[0] === 'enter' &&
7438          event[1].type === 'listItemPrefix') ||
7439        (containerBalance === -1 &&
7440          event[0] === 'exit' &&
7441          (event[1].type === 'listUnordered' ||
7442            event[1].type === 'listOrdered'))
7443      ) {
7444        if (listItem) {
7445          let tailIndex = index;
7446          lineIndex = undefined;
7447          while (tailIndex--) {
7448            const tailEvent = events[tailIndex];
7449            if (
7450              tailEvent[1].type === 'lineEnding' ||
7451              tailEvent[1].type === 'lineEndingBlank'
7452            ) {
7453              if (tailEvent[0] === 'exit') continue
7454              if (lineIndex) {
7455                events[lineIndex][1].type = 'lineEndingBlank';
7456                listSpread = true;
7457              }
7458              tailEvent[1].type = 'lineEnding';
7459              lineIndex = tailIndex;
7460            } else if (
7461              tailEvent[1].type === 'linePrefix' ||
7462              tailEvent[1].type === 'blockQuotePrefix' ||
7463              tailEvent[1].type === 'blockQuotePrefixWhitespace' ||
7464              tailEvent[1].type === 'blockQuoteMarker' ||
7465              tailEvent[1].type === 'listItemIndent'
7466            ) ; else {
7467              break
7468            }
7469          }
7470          if (
7471            firstBlankLineIndex &&
7472            (!lineIndex || firstBlankLineIndex < lineIndex)
7473          ) {
7474            listItem._spread = true;
7475          }
7476          listItem.end = Object.assign(
7477            {},
7478            lineIndex ? events[lineIndex][1].start : event[1].end
7479          );
7480          events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);
7481          index++;
7482          length++;
7483        }
7484        if (event[1].type === 'listItemPrefix') {
7485          const item = {
7486            type: 'listItem',
7487            _spread: false,
7488            start: Object.assign({}, event[1].start),
7489            end: undefined
7490          };
7491          listItem = item;
7492          events.splice(index, 0, ['enter', item, event[2]]);
7493          index++;
7494          length++;
7495          firstBlankLineIndex = undefined;
7496          atMarker = true;
7497        }
7498      }
7499    }
7500    events[start][1]._spread = listSpread;
7501    return length
7502  }
7503  function opener(create, and) {
7504    return open
7505    function open(token) {
7506      enter.call(this, create(token), token);
7507      if (and) and.call(this, token);
7508    }
7509  }
7510  function buffer() {
7511    this.stack.push({
7512      type: 'fragment',
7513      children: []
7514    });
7515  }
7516  function enter(node, token, errorHandler) {
7517    const parent = this.stack[this.stack.length - 1];
7518    const siblings = parent.children;
7519    siblings.push(node);
7520    this.stack.push(node);
7521    this.tokenStack.push([token, errorHandler]);
7522    node.position = {
7523      start: point$3(token.start),
7524      end: undefined
7525    };
7526  }
7527  function closer(and) {
7528    return close
7529    function close(token) {
7530      if (and) and.call(this, token);
7531      exit.call(this, token);
7532    }
7533  }
7534  function exit(token, onExitError) {
7535    const node = this.stack.pop();
7536    const open = this.tokenStack.pop();
7537    if (!open) {
7538      throw new Error(
7539        'Cannot close `' +
7540          token.type +
7541          '` (' +
7542          stringifyPosition$2({
7543            start: token.start,
7544            end: token.end
7545          }) +
7546          '): it’s not open'
7547      )
7548    } else if (open[0].type !== token.type) {
7549      if (onExitError) {
7550        onExitError.call(this, token, open[0]);
7551      } else {
7552        const handler = open[1] || defaultOnError;
7553        handler.call(this, token, open[0]);
7554      }
7555    }
7556    node.position.end = point$3(token.end);
7557  }
7558  function resume() {
7559    return toString$2(this.stack.pop())
7560  }
7561  function onenterlistordered() {
7562    this.data.expectingFirstListItemValue = true;
7563  }
7564  function onenterlistitemvalue(token) {
7565    if (this.data.expectingFirstListItemValue) {
7566      const ancestor = this.stack[this.stack.length - 2];
7567      ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);
7568      this.data.expectingFirstListItemValue = undefined;
7569    }
7570  }
7571  function onexitcodefencedfenceinfo() {
7572    const data = this.resume();
7573    const node = this.stack[this.stack.length - 1];
7574    node.lang = data;
7575  }
7576  function onexitcodefencedfencemeta() {
7577    const data = this.resume();
7578    const node = this.stack[this.stack.length - 1];
7579    node.meta = data;
7580  }
7581  function onexitcodefencedfence() {
7582    if (this.data.flowCodeInside) return
7583    this.buffer();
7584    this.data.flowCodeInside = true;
7585  }
7586  function onexitcodefenced() {
7587    const data = this.resume();
7588    const node = this.stack[this.stack.length - 1];
7589    node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, '');
7590    this.data.flowCodeInside = undefined;
7591  }
7592  function onexitcodeindented() {
7593    const data = this.resume();
7594    const node = this.stack[this.stack.length - 1];
7595    node.value = data.replace(/(\r?\n|\r)$/g, '');
7596  }
7597  function onexitdefinitionlabelstring(token) {
7598    const label = this.resume();
7599    const node = this.stack[this.stack.length - 1];
7600    node.label = label;
7601    node.identifier = normalizeIdentifier$1(
7602      this.sliceSerialize(token)
7603    ).toLowerCase();
7604  }
7605  function onexitdefinitiontitlestring() {
7606    const data = this.resume();
7607    const node = this.stack[this.stack.length - 1];
7608    node.title = data;
7609  }
7610  function onexitdefinitiondestinationstring() {
7611    const data = this.resume();
7612    const node = this.stack[this.stack.length - 1];
7613    node.url = data;
7614  }
7615  function onexitatxheadingsequence(token) {
7616    const node = this.stack[this.stack.length - 1];
7617    if (!node.depth) {
7618      const depth = this.sliceSerialize(token).length;
7619      node.depth = depth;
7620    }
7621  }
7622  function onexitsetextheadingtext() {
7623    this.data.setextHeadingSlurpLineEnding = true;
7624  }
7625  function onexitsetextheadinglinesequence(token) {
7626    const node = this.stack[this.stack.length - 1];
7627    node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;
7628  }
7629  function onexitsetextheading() {
7630    this.data.setextHeadingSlurpLineEnding = undefined;
7631  }
7632  function onenterdata(token) {
7633    const node = this.stack[this.stack.length - 1];
7634    const siblings = node.children;
7635    let tail = siblings[siblings.length - 1];
7636    if (!tail || tail.type !== 'text') {
7637      tail = text();
7638      tail.position = {
7639        start: point$3(token.start),
7640        end: undefined
7641      };
7642      siblings.push(tail);
7643    }
7644    this.stack.push(tail);
7645  }
7646  function onexitdata(token) {
7647    const tail = this.stack.pop();
7648    tail.value += this.sliceSerialize(token);
7649    tail.position.end = point$3(token.end);
7650  }
7651  function onexitlineending(token) {
7652    const context = this.stack[this.stack.length - 1];
7653    if (this.data.atHardBreak) {
7654      const tail = context.children[context.children.length - 1];
7655      tail.position.end = point$3(token.end);
7656      this.data.atHardBreak = undefined;
7657      return
7658    }
7659    if (
7660      !this.data.setextHeadingSlurpLineEnding &&
7661      config.canContainEols.includes(context.type)
7662    ) {
7663      onenterdata.call(this, token);
7664      onexitdata.call(this, token);
7665    }
7666  }
7667  function onexithardbreak() {
7668    this.data.atHardBreak = true;
7669  }
7670  function onexithtmlflow() {
7671    const data = this.resume();
7672    const node = this.stack[this.stack.length - 1];
7673    node.value = data;
7674  }
7675  function onexithtmltext() {
7676    const data = this.resume();
7677    const node = this.stack[this.stack.length - 1];
7678    node.value = data;
7679  }
7680  function onexitcodetext() {
7681    const data = this.resume();
7682    const node = this.stack[this.stack.length - 1];
7683    node.value = data;
7684  }
7685  function onexitlink() {
7686    const node = this.stack[this.stack.length - 1];
7687    if (this.data.inReference) {
7688      const referenceType = this.data.referenceType || 'shortcut';
7689      node.type += 'Reference';
7690      node.referenceType = referenceType;
7691      delete node.url;
7692      delete node.title;
7693    } else {
7694      delete node.identifier;
7695      delete node.label;
7696    }
7697    this.data.referenceType = undefined;
7698  }
7699  function onexitimage() {
7700    const node = this.stack[this.stack.length - 1];
7701    if (this.data.inReference) {
7702      const referenceType = this.data.referenceType || 'shortcut';
7703      node.type += 'Reference';
7704      node.referenceType = referenceType;
7705      delete node.url;
7706      delete node.title;
7707    } else {
7708      delete node.identifier;
7709      delete node.label;
7710    }
7711    this.data.referenceType = undefined;
7712  }
7713  function onexitlabeltext(token) {
7714    const string = this.sliceSerialize(token);
7715    const ancestor = this.stack[this.stack.length - 2];
7716    ancestor.label = decodeString(string);
7717    ancestor.identifier = normalizeIdentifier$1(string).toLowerCase();
7718  }
7719  function onexitlabel() {
7720    const fragment = this.stack[this.stack.length - 1];
7721    const value = this.resume();
7722    const node = this.stack[this.stack.length - 1];
7723    this.data.inReference = true;
7724    if (node.type === 'link') {
7725      const children = fragment.children;
7726      node.children = children;
7727    } else {
7728      node.alt = value;
7729    }
7730  }
7731  function onexitresourcedestinationstring() {
7732    const data = this.resume();
7733    const node = this.stack[this.stack.length - 1];
7734    node.url = data;
7735  }
7736  function onexitresourcetitlestring() {
7737    const data = this.resume();
7738    const node = this.stack[this.stack.length - 1];
7739    node.title = data;
7740  }
7741  function onexitresource() {
7742    this.data.inReference = undefined;
7743  }
7744  function onenterreference() {
7745    this.data.referenceType = 'collapsed';
7746  }
7747  function onexitreferencestring(token) {
7748    const label = this.resume();
7749    const node = this.stack[this.stack.length - 1];
7750    node.label = label;
7751    node.identifier = normalizeIdentifier$1(
7752      this.sliceSerialize(token)
7753    ).toLowerCase();
7754    this.data.referenceType = 'full';
7755  }
7756  function onexitcharacterreferencemarker(token) {
7757    this.data.characterReferenceType = token.type;
7758  }
7759  function onexitcharacterreferencevalue(token) {
7760    const data = this.sliceSerialize(token);
7761    const type = this.data.characterReferenceType;
7762    let value;
7763    if (type) {
7764      value = decodeNumericCharacterReference(
7765        data,
7766        type === 'characterReferenceMarkerNumeric' ? 10 : 16
7767      );
7768      this.data.characterReferenceType = undefined;
7769    } else {
7770      const result = decodeNamedCharacterReference(data);
7771      value = result;
7772    }
7773    const tail = this.stack.pop();
7774    tail.value += value;
7775    tail.position.end = point$3(token.end);
7776  }
7777  function onexitautolinkprotocol(token) {
7778    onexitdata.call(this, token);
7779    const node = this.stack[this.stack.length - 1];
7780    node.url = this.sliceSerialize(token);
7781  }
7782  function onexitautolinkemail(token) {
7783    onexitdata.call(this, token);
7784    const node = this.stack[this.stack.length - 1];
7785    node.url = 'mailto:' + this.sliceSerialize(token);
7786  }
7787  function blockQuote() {
7788    return {
7789      type: 'blockquote',
7790      children: []
7791    }
7792  }
7793  function codeFlow() {
7794    return {
7795      type: 'code',
7796      lang: null,
7797      meta: null,
7798      value: ''
7799    }
7800  }
7801  function codeText() {
7802    return {
7803      type: 'inlineCode',
7804      value: ''
7805    }
7806  }
7807  function definition() {
7808    return {
7809      type: 'definition',
7810      identifier: '',
7811      label: null,
7812      title: null,
7813      url: ''
7814    }
7815  }
7816  function emphasis() {
7817    return {
7818      type: 'emphasis',
7819      children: []
7820    }
7821  }
7822  function heading() {
7823    return {
7824      type: 'heading',
7825      depth: 0,
7826      children: []
7827    }
7828  }
7829  function hardBreak() {
7830    return {
7831      type: 'break'
7832    }
7833  }
7834  function html() {
7835    return {
7836      type: 'html',
7837      value: ''
7838    }
7839  }
7840  function image() {
7841    return {
7842      type: 'image',
7843      title: null,
7844      url: '',
7845      alt: null
7846    }
7847  }
7848  function link() {
7849    return {
7850      type: 'link',
7851      title: null,
7852      url: '',
7853      children: []
7854    }
7855  }
7856  function list(token) {
7857    return {
7858      type: 'list',
7859      ordered: token.type === 'listOrdered',
7860      start: null,
7861      spread: token._spread,
7862      children: []
7863    }
7864  }
7865  function listItem(token) {
7866    return {
7867      type: 'listItem',
7868      spread: token._spread,
7869      checked: null,
7870      children: []
7871    }
7872  }
7873  function paragraph() {
7874    return {
7875      type: 'paragraph',
7876      children: []
7877    }
7878  }
7879  function strong() {
7880    return {
7881      type: 'strong',
7882      children: []
7883    }
7884  }
7885  function text() {
7886    return {
7887      type: 'text',
7888      value: ''
7889    }
7890  }
7891  function thematicBreak() {
7892    return {
7893      type: 'thematicBreak'
7894    }
7895  }
7896}
7897function point$3(d) {
7898  return {
7899    line: d.line,
7900    column: d.column,
7901    offset: d.offset
7902  }
7903}
7904function configure$1(combined, extensions) {
7905  let index = -1;
7906  while (++index < extensions.length) {
7907    const value = extensions[index];
7908    if (Array.isArray(value)) {
7909      configure$1(combined, value);
7910    } else {
7911      extension(combined, value);
7912    }
7913  }
7914}
7915function extension(combined, extension) {
7916  let key;
7917  for (key in extension) {
7918    if (own$4.call(extension, key)) {
7919      switch (key) {
7920        case 'canContainEols': {
7921          const right = extension[key];
7922          if (right) {
7923            combined[key].push(...right);
7924          }
7925          break
7926        }
7927        case 'transforms': {
7928          const right = extension[key];
7929          if (right) {
7930            combined[key].push(...right);
7931          }
7932          break
7933        }
7934        case 'enter':
7935        case 'exit': {
7936          const right = extension[key];
7937          if (right) {
7938            Object.assign(combined[key], right);
7939          }
7940          break
7941        }
7942      }
7943    }
7944  }
7945}
7946function defaultOnError(left, right) {
7947  if (left) {
7948    throw new Error(
7949      'Cannot close `' +
7950        left.type +
7951        '` (' +
7952        stringifyPosition$2({
7953          start: left.start,
7954          end: left.end
7955        }) +
7956        '): a different token (`' +
7957        right.type +
7958        '`, ' +
7959        stringifyPosition$2({
7960          start: right.start,
7961          end: right.end
7962        }) +
7963        ') is open'
7964    )
7965  } else {
7966    throw new Error(
7967      'Cannot close document, a token (`' +
7968        right.type +
7969        '`, ' +
7970        stringifyPosition$2({
7971          start: right.start,
7972          end: right.end
7973        }) +
7974        ') is still open'
7975    )
7976  }
7977}
7978
7979function remarkParse(options) {
7980  const self = this;
7981  self.parser = parser;
7982  function parser(doc) {
7983    return fromMarkdown(doc, {
7984      ...self.data('settings'),
7985      ...options,
7986      extensions: self.data('micromarkExtensions') || [],
7987      mdastExtensions: self.data('fromMarkdownExtensions') || []
7988    })
7989  }
7990}
7991
7992const own$3 = {}.hasOwnProperty;
7993function zwitch(key, options) {
7994  const settings = options || {};
7995  function one(value, ...parameters) {
7996    let fn = one.invalid;
7997    const handlers = one.handlers;
7998    if (value && own$3.call(value, key)) {
7999      const id = String(value[key]);
8000      fn = own$3.call(handlers, id) ? handlers[id] : one.unknown;
8001    }
8002    if (fn) {
8003      return fn.call(this, value, ...parameters)
8004    }
8005  }
8006  one.handlers = settings.handlers || {};
8007  one.invalid = settings.invalid;
8008  one.unknown = settings.unknown;
8009  return one
8010}
8011
8012const own$2 = {}.hasOwnProperty;
8013function configure(base, extension) {
8014  let index = -1;
8015  let key;
8016  if (extension.extensions) {
8017    while (++index < extension.extensions.length) {
8018      configure(base, extension.extensions[index]);
8019    }
8020  }
8021  for (key in extension) {
8022    if (own$2.call(extension, key)) {
8023      switch (key) {
8024        case 'extensions': {
8025          break
8026        }
8027        case 'unsafe': {
8028          list$1(base[key], extension[key]);
8029          break
8030        }
8031        case 'join': {
8032          list$1(base[key], extension[key]);
8033          break
8034        }
8035        case 'handlers': {
8036          map$4(base[key], extension[key]);
8037          break
8038        }
8039        default: {
8040          base.options[key] = extension[key];
8041        }
8042      }
8043    }
8044  }
8045  return base
8046}
8047function list$1(left, right) {
8048  if (right) {
8049    left.push(...right);
8050  }
8051}
8052function map$4(left, right) {
8053  if (right) {
8054    Object.assign(left, right);
8055  }
8056}
8057
8058function blockquote(node, _, state, info) {
8059  const exit = state.enter('blockquote');
8060  const tracker = state.createTracker(info);
8061  tracker.move('> ');
8062  tracker.shift(2);
8063  const value = state.indentLines(
8064    state.containerFlow(node, tracker.current()),
8065    map$3
8066  );
8067  exit();
8068  return value
8069}
8070function map$3(line, _, blank) {
8071  return '>' + (blank ? '' : ' ') + line
8072}
8073
8074function patternInScope(stack, pattern) {
8075  return (
8076    listInScope(stack, pattern.inConstruct, true) &&
8077    !listInScope(stack, pattern.notInConstruct, false)
8078  )
8079}
8080function listInScope(stack, list, none) {
8081  if (typeof list === 'string') {
8082    list = [list];
8083  }
8084  if (!list || list.length === 0) {
8085    return none
8086  }
8087  let index = -1;
8088  while (++index < list.length) {
8089    if (stack.includes(list[index])) {
8090      return true
8091    }
8092  }
8093  return false
8094}
8095
8096function hardBreak(_, _1, state, info) {
8097  let index = -1;
8098  while (++index < state.unsafe.length) {
8099    if (
8100      state.unsafe[index].character === '\n' &&
8101      patternInScope(state.stack, state.unsafe[index])
8102    ) {
8103      return /[ \t]/.test(info.before) ? '' : ' '
8104    }
8105  }
8106  return '\\\n'
8107}
8108
8109function longestStreak(value, substring) {
8110  const source = String(value);
8111  let index = source.indexOf(substring);
8112  let expected = index;
8113  let count = 0;
8114  let max = 0;
8115  if (typeof substring !== 'string') {
8116    throw new TypeError('Expected substring')
8117  }
8118  while (index !== -1) {
8119    if (index === expected) {
8120      if (++count > max) {
8121        max = count;
8122      }
8123    } else {
8124      count = 1;
8125    }
8126    expected = index + substring.length;
8127    index = source.indexOf(substring, expected);
8128  }
8129  return max
8130}
8131
8132function formatCodeAsIndented(node, state) {
8133  return Boolean(
8134    state.options.fences === false &&
8135      node.value &&
8136      !node.lang &&
8137      /[^ \r\n]/.test(node.value) &&
8138      !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value)
8139  )
8140}
8141
8142function checkFence(state) {
8143  const marker = state.options.fence || '`';
8144  if (marker !== '`' && marker !== '~') {
8145    throw new Error(
8146      'Cannot serialize code with `' +
8147        marker +
8148        '` for `options.fence`, expected `` ` `` or `~`'
8149    )
8150  }
8151  return marker
8152}
8153
8154function code$1(node, _, state, info) {
8155  const marker = checkFence(state);
8156  const raw = node.value || '';
8157  const suffix = marker === '`' ? 'GraveAccent' : 'Tilde';
8158  if (formatCodeAsIndented(node, state)) {
8159    const exit = state.enter('codeIndented');
8160    const value = state.indentLines(raw, map$2);
8161    exit();
8162    return value
8163  }
8164  const tracker = state.createTracker(info);
8165  const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
8166  const exit = state.enter('codeFenced');
8167  let value = tracker.move(sequence);
8168  if (node.lang) {
8169    const subexit = state.enter(`codeFencedLang${suffix}`);
8170    value += tracker.move(
8171      state.safe(node.lang, {
8172        before: value,
8173        after: ' ',
8174        encode: ['`'],
8175        ...tracker.current()
8176      })
8177    );
8178    subexit();
8179  }
8180  if (node.lang && node.meta) {
8181    const subexit = state.enter(`codeFencedMeta${suffix}`);
8182    value += tracker.move(' ');
8183    value += tracker.move(
8184      state.safe(node.meta, {
8185        before: value,
8186        after: '\n',
8187        encode: ['`'],
8188        ...tracker.current()
8189      })
8190    );
8191    subexit();
8192  }
8193  value += tracker.move('\n');
8194  if (raw) {
8195    value += tracker.move(raw + '\n');
8196  }
8197  value += tracker.move(sequence);
8198  exit();
8199  return value
8200}
8201function map$2(line, _, blank) {
8202  return (blank ? '' : '    ') + line
8203}
8204
8205function checkQuote(state) {
8206  const marker = state.options.quote || '"';
8207  if (marker !== '"' && marker !== "'") {
8208    throw new Error(
8209      'Cannot serialize title with `' +
8210        marker +
8211        '` for `options.quote`, expected `"`, or `\'`'
8212    )
8213  }
8214  return marker
8215}
8216
8217function definition(node, _, state, info) {
8218  const quote = checkQuote(state);
8219  const suffix = quote === '"' ? 'Quote' : 'Apostrophe';
8220  const exit = state.enter('definition');
8221  let subexit = state.enter('label');
8222  const tracker = state.createTracker(info);
8223  let value = tracker.move('[');
8224  value += tracker.move(
8225    state.safe(state.associationId(node), {
8226      before: value,
8227      after: ']',
8228      ...tracker.current()
8229    })
8230  );
8231  value += tracker.move(']: ');
8232  subexit();
8233  if (
8234    !node.url ||
8235    /[\0- \u007F]/.test(node.url)
8236  ) {
8237    subexit = state.enter('destinationLiteral');
8238    value += tracker.move('<');
8239    value += tracker.move(
8240      state.safe(node.url, {before: value, after: '>', ...tracker.current()})
8241    );
8242    value += tracker.move('>');
8243  } else {
8244    subexit = state.enter('destinationRaw');
8245    value += tracker.move(
8246      state.safe(node.url, {
8247        before: value,
8248        after: node.title ? ' ' : '\n',
8249        ...tracker.current()
8250      })
8251    );
8252  }
8253  subexit();
8254  if (node.title) {
8255    subexit = state.enter(`title${suffix}`);
8256    value += tracker.move(' ' + quote);
8257    value += tracker.move(
8258      state.safe(node.title, {
8259        before: value,
8260        after: quote,
8261        ...tracker.current()
8262      })
8263    );
8264    value += tracker.move(quote);
8265    subexit();
8266  }
8267  exit();
8268  return value
8269}
8270
8271function checkEmphasis(state) {
8272  const marker = state.options.emphasis || '*';
8273  if (marker !== '*' && marker !== '_') {
8274    throw new Error(
8275      'Cannot serialize emphasis with `' +
8276        marker +
8277        '` for `options.emphasis`, expected `*`, or `_`'
8278    )
8279  }
8280  return marker
8281}
8282
8283emphasis.peek = emphasisPeek;
8284function emphasis(node, _, state, info) {
8285  const marker = checkEmphasis(state);
8286  const exit = state.enter('emphasis');
8287  const tracker = state.createTracker(info);
8288  let value = tracker.move(marker);
8289  value += tracker.move(
8290    state.containerPhrasing(node, {
8291      before: value,
8292      after: marker,
8293      ...tracker.current()
8294    })
8295  );
8296  value += tracker.move(marker);
8297  exit();
8298  return value
8299}
8300function emphasisPeek(_, _1, state) {
8301  return state.options.emphasis || '*'
8302}
8303
8304const convert$A =
8305  (
8306    function (test) {
8307      if (test === null || test === undefined) {
8308        return ok$A
8309      }
8310      if (typeof test === 'function') {
8311        return castFactory$A(test)
8312      }
8313      if (typeof test === 'object') {
8314        return Array.isArray(test) ? anyFactory$A(test) : propsFactory$A(test)
8315      }
8316      if (typeof test === 'string') {
8317        return typeFactory$A(test)
8318      }
8319      throw new Error('Expected function, string, or object as test')
8320    }
8321  );
8322function anyFactory$A(tests) {
8323  const checks = [];
8324  let index = -1;
8325  while (++index < tests.length) {
8326    checks[index] = convert$A(tests[index]);
8327  }
8328  return castFactory$A(any)
8329  function any(...parameters) {
8330    let index = -1;
8331    while (++index < checks.length) {
8332      if (checks[index].apply(this, parameters)) return true
8333    }
8334    return false
8335  }
8336}
8337function propsFactory$A(check) {
8338  const checkAsRecord =  (check);
8339  return castFactory$A(all)
8340  function all(node) {
8341    const nodeAsRecord =  (
8342       (node)
8343    );
8344    let key;
8345    for (key in check) {
8346      if (nodeAsRecord[key] !== checkAsRecord[key]) return false
8347    }
8348    return true
8349  }
8350}
8351function typeFactory$A(check) {
8352  return castFactory$A(type)
8353  function type(node) {
8354    return node && node.type === check
8355  }
8356}
8357function castFactory$A(testFunction) {
8358  return check
8359  function check(value, index, parent) {
8360    return Boolean(
8361      looksLikeANode(value) &&
8362        testFunction.call(
8363          this,
8364          value,
8365          typeof index === 'number' ? index : undefined,
8366          parent || undefined
8367        )
8368    )
8369  }
8370}
8371function ok$A() {
8372  return true
8373}
8374function looksLikeANode(value) {
8375  return value !== null && typeof value === 'object' && 'type' in value
8376}
8377
8378function color$B(d) {
8379  return '\u001B[33m' + d + '\u001B[39m'
8380}
8381
8382const empty = [];
8383const CONTINUE$A = true;
8384const EXIT$A = false;
8385const SKIP$A = 'skip';
8386function visitParents$A(tree, test, visitor, reverse) {
8387  let check;
8388  if (typeof test === 'function' && typeof visitor !== 'function') {
8389    reverse = visitor;
8390    visitor = test;
8391  } else {
8392    check = test;
8393  }
8394  const is = convert$A(check);
8395  const step = reverse ? -1 : 1;
8396  factory(tree, undefined, [])();
8397  function factory(node, index, parents) {
8398    const value =  (
8399      node && typeof node === 'object' ? node : {}
8400    );
8401    if (typeof value.type === 'string') {
8402      const name =
8403        typeof value.tagName === 'string'
8404          ? value.tagName
8405          :
8406          typeof value.name === 'string'
8407          ? value.name
8408          : undefined;
8409      Object.defineProperty(visit, 'name', {
8410        value:
8411          'node (' + color$B(node.type + (name ? '<' + name + '>' : '')) + ')'
8412      });
8413    }
8414    return visit
8415    function visit() {
8416      let result = empty;
8417      let subresult;
8418      let offset;
8419      let grandparents;
8420      if (!test || is(node, index, parents[parents.length - 1] || undefined)) {
8421        result = toResult$A(visitor(node, parents));
8422        if (result[0] === EXIT$A) {
8423          return result
8424        }
8425      }
8426      if ('children' in node && node.children) {
8427        const nodeAsParent =  (node);
8428        if (nodeAsParent.children && result[0] !== SKIP$A) {
8429          offset = (reverse ? nodeAsParent.children.length : -1) + step;
8430          grandparents = parents.concat(nodeAsParent);
8431          while (offset > -1 && offset < nodeAsParent.children.length) {
8432            const child = nodeAsParent.children[offset];
8433            subresult = factory(child, offset, grandparents)();
8434            if (subresult[0] === EXIT$A) {
8435              return subresult
8436            }
8437            offset =
8438              typeof subresult[1] === 'number' ? subresult[1] : offset + step;
8439          }
8440        }
8441      }
8442      return result
8443    }
8444  }
8445}
8446function toResult$A(value) {
8447  if (Array.isArray(value)) {
8448    return value
8449  }
8450  if (typeof value === 'number') {
8451    return [CONTINUE$A, value]
8452  }
8453  return value === null || value === undefined ? empty : [value]
8454}
8455
8456function visit$A(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
8457  let reverse;
8458  let test;
8459  let visitor;
8460  if (
8461    typeof testOrVisitor === 'function' &&
8462    typeof visitorOrReverse !== 'function'
8463  ) {
8464    test = undefined;
8465    visitor = testOrVisitor;
8466    reverse = visitorOrReverse;
8467  } else {
8468    test = testOrVisitor;
8469    visitor = visitorOrReverse;
8470    reverse = maybeReverse;
8471  }
8472  visitParents$A(tree, test, overload, reverse);
8473  function overload(node, parents) {
8474    const parent = parents[parents.length - 1];
8475    const index = parent ? parent.children.indexOf(node) : undefined;
8476    return visitor(node, index, parent)
8477  }
8478}
8479
8480function formatHeadingAsSetext(node, state) {
8481  let literalWithBreak = false;
8482  visit$A(node, function (node) {
8483    if (
8484      ('value' in node && /\r?\n|\r/.test(node.value)) ||
8485      node.type === 'break'
8486    ) {
8487      literalWithBreak = true;
8488      return EXIT$A
8489    }
8490  });
8491  return Boolean(
8492    (!node.depth || node.depth < 3) &&
8493      toString$2(node) &&
8494      (state.options.setext || literalWithBreak)
8495  )
8496}
8497
8498function heading(node, _, state, info) {
8499  const rank = Math.max(Math.min(6, node.depth || 1), 1);
8500  const tracker = state.createTracker(info);
8501  if (formatHeadingAsSetext(node, state)) {
8502    const exit = state.enter('headingSetext');
8503    const subexit = state.enter('phrasing');
8504    const value = state.containerPhrasing(node, {
8505      ...tracker.current(),
8506      before: '\n',
8507      after: '\n'
8508    });
8509    subexit();
8510    exit();
8511    return (
8512      value +
8513      '\n' +
8514      (rank === 1 ? '=' : '-').repeat(
8515        value.length -
8516          (Math.max(value.lastIndexOf('\r'), value.lastIndexOf('\n')) + 1)
8517      )
8518    )
8519  }
8520  const sequence = '#'.repeat(rank);
8521  const exit = state.enter('headingAtx');
8522  const subexit = state.enter('phrasing');
8523  tracker.move(sequence + ' ');
8524  let value = state.containerPhrasing(node, {
8525    before: '# ',
8526    after: '\n',
8527    ...tracker.current()
8528  });
8529  if (/^[\t ]/.test(value)) {
8530    value =
8531      '&#x' +
8532      value.charCodeAt(0).toString(16).toUpperCase() +
8533      ';' +
8534      value.slice(1);
8535  }
8536  value = value ? sequence + ' ' + value : sequence;
8537  if (state.options.closeAtx) {
8538    value += ' ' + sequence;
8539  }
8540  subexit();
8541  exit();
8542  return value
8543}
8544
8545html.peek = htmlPeek;
8546function html(node) {
8547  return node.value || ''
8548}
8549function htmlPeek() {
8550  return '<'
8551}
8552
8553image.peek = imagePeek;
8554function image(node, _, state, info) {
8555  const quote = checkQuote(state);
8556  const suffix = quote === '"' ? 'Quote' : 'Apostrophe';
8557  const exit = state.enter('image');
8558  let subexit = state.enter('label');
8559  const tracker = state.createTracker(info);
8560  let value = tracker.move('![');
8561  value += tracker.move(
8562    state.safe(node.alt, {before: value, after: ']', ...tracker.current()})
8563  );
8564  value += tracker.move('](');
8565  subexit();
8566  if (
8567    (!node.url && node.title) ||
8568    /[\0- \u007F]/.test(node.url)
8569  ) {
8570    subexit = state.enter('destinationLiteral');
8571    value += tracker.move('<');
8572    value += tracker.move(
8573      state.safe(node.url, {before: value, after: '>', ...tracker.current()})
8574    );
8575    value += tracker.move('>');
8576  } else {
8577    subexit = state.enter('destinationRaw');
8578    value += tracker.move(
8579      state.safe(node.url, {
8580        before: value,
8581        after: node.title ? ' ' : ')',
8582        ...tracker.current()
8583      })
8584    );
8585  }
8586  subexit();
8587  if (node.title) {
8588    subexit = state.enter(`title${suffix}`);
8589    value += tracker.move(' ' + quote);
8590    value += tracker.move(
8591      state.safe(node.title, {
8592        before: value,
8593        after: quote,
8594        ...tracker.current()
8595      })
8596    );
8597    value += tracker.move(quote);
8598    subexit();
8599  }
8600  value += tracker.move(')');
8601  exit();
8602  return value
8603}
8604function imagePeek() {
8605  return '!'
8606}
8607
8608imageReference.peek = imageReferencePeek;
8609function imageReference(node, _, state, info) {
8610  const type = node.referenceType;
8611  const exit = state.enter('imageReference');
8612  let subexit = state.enter('label');
8613  const tracker = state.createTracker(info);
8614  let value = tracker.move('![');
8615  const alt = state.safe(node.alt, {
8616    before: value,
8617    after: ']',
8618    ...tracker.current()
8619  });
8620  value += tracker.move(alt + '][');
8621  subexit();
8622  const stack = state.stack;
8623  state.stack = [];
8624  subexit = state.enter('reference');
8625  const reference = state.safe(state.associationId(node), {
8626    before: value,
8627    after: ']',
8628    ...tracker.current()
8629  });
8630  subexit();
8631  state.stack = stack;
8632  exit();
8633  if (type === 'full' || !alt || alt !== reference) {
8634    value += tracker.move(reference + ']');
8635  } else if (type === 'shortcut') {
8636    value = value.slice(0, -1);
8637  } else {
8638    value += tracker.move(']');
8639  }
8640  return value
8641}
8642function imageReferencePeek() {
8643  return '!'
8644}
8645
8646inlineCode.peek = inlineCodePeek;
8647function inlineCode(node, _, state) {
8648  let value = node.value || '';
8649  let sequence = '`';
8650  let index = -1;
8651  while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) {
8652    sequence += '`';
8653  }
8654  if (
8655    /[^ \r\n]/.test(value) &&
8656    ((/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value)) || /^`|`$/.test(value))
8657  ) {
8658    value = ' ' + value + ' ';
8659  }
8660  while (++index < state.unsafe.length) {
8661    const pattern = state.unsafe[index];
8662    const expression = state.compilePattern(pattern);
8663    let match;
8664    if (!pattern.atBreak) continue
8665    while ((match = expression.exec(value))) {
8666      let position = match.index;
8667      if (
8668        value.charCodeAt(position) === 10  &&
8669        value.charCodeAt(position - 1) === 13
8670      ) {
8671        position--;
8672      }
8673      value = value.slice(0, position) + ' ' + value.slice(match.index + 1);
8674    }
8675  }
8676  return sequence + value + sequence
8677}
8678function inlineCodePeek() {
8679  return '`'
8680}
8681
8682function formatLinkAsAutolink(node, state) {
8683  const raw = toString$2(node);
8684  return Boolean(
8685    !state.options.resourceLink &&
8686      node.url &&
8687      !node.title &&
8688      node.children &&
8689      node.children.length === 1 &&
8690      node.children[0].type === 'text' &&
8691      (raw === node.url || 'mailto:' + raw === node.url) &&
8692      /^[a-z][a-z+.-]+:/i.test(node.url) &&
8693      !/[\0- <>\u007F]/.test(node.url)
8694  )
8695}
8696
8697link.peek = linkPeek;
8698function link(node, _, state, info) {
8699  const quote = checkQuote(state);
8700  const suffix = quote === '"' ? 'Quote' : 'Apostrophe';
8701  const tracker = state.createTracker(info);
8702  let exit;
8703  let subexit;
8704  if (formatLinkAsAutolink(node, state)) {
8705    const stack = state.stack;
8706    state.stack = [];
8707    exit = state.enter('autolink');
8708    let value = tracker.move('<');
8709    value += tracker.move(
8710      state.containerPhrasing(node, {
8711        before: value,
8712        after: '>',
8713        ...tracker.current()
8714      })
8715    );
8716    value += tracker.move('>');
8717    exit();
8718    state.stack = stack;
8719    return value
8720  }
8721  exit = state.enter('link');
8722  subexit = state.enter('label');
8723  let value = tracker.move('[');
8724  value += tracker.move(
8725    state.containerPhrasing(node, {
8726      before: value,
8727      after: '](',
8728      ...tracker.current()
8729    })
8730  );
8731  value += tracker.move('](');
8732  subexit();
8733  if (
8734    (!node.url && node.title) ||
8735    /[\0- \u007F]/.test(node.url)
8736  ) {
8737    subexit = state.enter('destinationLiteral');
8738    value += tracker.move('<');
8739    value += tracker.move(
8740      state.safe(node.url, {before: value, after: '>', ...tracker.current()})
8741    );
8742    value += tracker.move('>');
8743  } else {
8744    subexit = state.enter('destinationRaw');
8745    value += tracker.move(
8746      state.safe(node.url, {
8747        before: value,
8748        after: node.title ? ' ' : ')',
8749        ...tracker.current()
8750      })
8751    );
8752  }
8753  subexit();
8754  if (node.title) {
8755    subexit = state.enter(`title${suffix}`);
8756    value += tracker.move(' ' + quote);
8757    value += tracker.move(
8758      state.safe(node.title, {
8759        before: value,
8760        after: quote,
8761        ...tracker.current()
8762      })
8763    );
8764    value += tracker.move(quote);
8765    subexit();
8766  }
8767  value += tracker.move(')');
8768  exit();
8769  return value
8770}
8771function linkPeek(node, _, state) {
8772  return formatLinkAsAutolink(node, state) ? '<' : '['
8773}
8774
8775linkReference.peek = linkReferencePeek;
8776function linkReference(node, _, state, info) {
8777  const type = node.referenceType;
8778  const exit = state.enter('linkReference');
8779  let subexit = state.enter('label');
8780  const tracker = state.createTracker(info);
8781  let value = tracker.move('[');
8782  const text = state.containerPhrasing(node, {
8783    before: value,
8784    after: ']',
8785    ...tracker.current()
8786  });
8787  value += tracker.move(text + '][');
8788  subexit();
8789  const stack = state.stack;
8790  state.stack = [];
8791  subexit = state.enter('reference');
8792  const reference = state.safe(state.associationId(node), {
8793    before: value,
8794    after: ']',
8795    ...tracker.current()
8796  });
8797  subexit();
8798  state.stack = stack;
8799  exit();
8800  if (type === 'full' || !text || text !== reference) {
8801    value += tracker.move(reference + ']');
8802  } else if (type === 'shortcut') {
8803    value = value.slice(0, -1);
8804  } else {
8805    value += tracker.move(']');
8806  }
8807  return value
8808}
8809function linkReferencePeek() {
8810  return '['
8811}
8812
8813function checkBullet(state) {
8814  const marker = state.options.bullet || '*';
8815  if (marker !== '*' && marker !== '+' && marker !== '-') {
8816    throw new Error(
8817      'Cannot serialize items with `' +
8818        marker +
8819        '` for `options.bullet`, expected `*`, `+`, or `-`'
8820    )
8821  }
8822  return marker
8823}
8824
8825function checkBulletOther(state) {
8826  const bullet = checkBullet(state);
8827  const bulletOther = state.options.bulletOther;
8828  if (!bulletOther) {
8829    return bullet === '*' ? '-' : '*'
8830  }
8831  if (bulletOther !== '*' && bulletOther !== '+' && bulletOther !== '-') {
8832    throw new Error(
8833      'Cannot serialize items with `' +
8834        bulletOther +
8835        '` for `options.bulletOther`, expected `*`, `+`, or `-`'
8836    )
8837  }
8838  if (bulletOther === bullet) {
8839    throw new Error(
8840      'Expected `bullet` (`' +
8841        bullet +
8842        '`) and `bulletOther` (`' +
8843        bulletOther +
8844        '`) to be different'
8845    )
8846  }
8847  return bulletOther
8848}
8849
8850function checkBulletOrdered(state) {
8851  const marker = state.options.bulletOrdered || '.';
8852  if (marker !== '.' && marker !== ')') {
8853    throw new Error(
8854      'Cannot serialize items with `' +
8855        marker +
8856        '` for `options.bulletOrdered`, expected `.` or `)`'
8857    )
8858  }
8859  return marker
8860}
8861
8862function checkRule(state) {
8863  const marker = state.options.rule || '*';
8864  if (marker !== '*' && marker !== '-' && marker !== '_') {
8865    throw new Error(
8866      'Cannot serialize rules with `' +
8867        marker +
8868        '` for `options.rule`, expected `*`, `-`, or `_`'
8869    )
8870  }
8871  return marker
8872}
8873
8874function list(node, parent, state, info) {
8875  const exit = state.enter('list');
8876  const bulletCurrent = state.bulletCurrent;
8877  let bullet = node.ordered ? checkBulletOrdered(state) : checkBullet(state);
8878  const bulletOther = node.ordered
8879    ? bullet === '.'
8880      ? ')'
8881      : '.'
8882    : checkBulletOther(state);
8883  let useDifferentMarker =
8884    parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;
8885  if (!node.ordered) {
8886    const firstListItem = node.children ? node.children[0] : undefined;
8887    if (
8888      (bullet === '*' || bullet === '-') &&
8889      firstListItem &&
8890      (!firstListItem.children || !firstListItem.children[0]) &&
8891      state.stack[state.stack.length - 1] === 'list' &&
8892      state.stack[state.stack.length - 2] === 'listItem' &&
8893      state.stack[state.stack.length - 3] === 'list' &&
8894      state.stack[state.stack.length - 4] === 'listItem' &&
8895      state.indexStack[state.indexStack.length - 1] === 0 &&
8896      state.indexStack[state.indexStack.length - 2] === 0 &&
8897      state.indexStack[state.indexStack.length - 3] === 0
8898    ) {
8899      useDifferentMarker = true;
8900    }
8901    if (checkRule(state) === bullet && firstListItem) {
8902      let index = -1;
8903      while (++index < node.children.length) {
8904        const item = node.children[index];
8905        if (
8906          item &&
8907          item.type === 'listItem' &&
8908          item.children &&
8909          item.children[0] &&
8910          item.children[0].type === 'thematicBreak'
8911        ) {
8912          useDifferentMarker = true;
8913          break
8914        }
8915      }
8916    }
8917  }
8918  if (useDifferentMarker) {
8919    bullet = bulletOther;
8920  }
8921  state.bulletCurrent = bullet;
8922  const value = state.containerFlow(node, info);
8923  state.bulletLastUsed = bullet;
8924  state.bulletCurrent = bulletCurrent;
8925  exit();
8926  return value
8927}
8928
8929function checkListItemIndent(state) {
8930  const style = state.options.listItemIndent || 'one';
8931  if (style !== 'tab' && style !== 'one' && style !== 'mixed') {
8932    throw new Error(
8933      'Cannot serialize items with `' +
8934        style +
8935        '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`'
8936    )
8937  }
8938  return style
8939}
8940
8941function listItem(node, parent, state, info) {
8942  const listItemIndent = checkListItemIndent(state);
8943  let bullet = state.bulletCurrent || checkBullet(state);
8944  if (parent && parent.type === 'list' && parent.ordered) {
8945    bullet =
8946      (typeof parent.start === 'number' && parent.start > -1
8947        ? parent.start
8948        : 1) +
8949      (state.options.incrementListMarker === false
8950        ? 0
8951        : parent.children.indexOf(node)) +
8952      bullet;
8953  }
8954  let size = bullet.length + 1;
8955  if (
8956    listItemIndent === 'tab' ||
8957    (listItemIndent === 'mixed' &&
8958      ((parent && parent.type === 'list' && parent.spread) || node.spread))
8959  ) {
8960    size = Math.ceil(size / 4) * 4;
8961  }
8962  const tracker = state.createTracker(info);
8963  tracker.move(bullet + ' '.repeat(size - bullet.length));
8964  tracker.shift(size);
8965  const exit = state.enter('listItem');
8966  const value = state.indentLines(
8967    state.containerFlow(node, tracker.current()),
8968    map
8969  );
8970  exit();
8971  return value
8972  function map(line, index, blank) {
8973    if (index) {
8974      return (blank ? '' : ' '.repeat(size)) + line
8975    }
8976    return (blank ? bullet : bullet + ' '.repeat(size - bullet.length)) + line
8977  }
8978}
8979
8980function paragraph(node, _, state, info) {
8981  const exit = state.enter('paragraph');
8982  const subexit = state.enter('phrasing');
8983  const value = state.containerPhrasing(node, info);
8984  subexit();
8985  exit();
8986  return value
8987}
8988
8989const phrasing =
8990  (
8991    convert$A([
8992      'break',
8993      'delete',
8994      'emphasis',
8995      'footnote',
8996      'footnoteReference',
8997      'image',
8998      'imageReference',
8999      'inlineCode',
9000      'link',
9001      'linkReference',
9002      'strong',
9003      'text'
9004    ])
9005  );
9006
9007function root(node, _, state, info) {
9008  const hasPhrasing = node.children.some(function (d) {
9009    return phrasing(d)
9010  });
9011  const fn = hasPhrasing ? state.containerPhrasing : state.containerFlow;
9012  return fn.call(state, node, info)
9013}
9014
9015function checkStrong(state) {
9016  const marker = state.options.strong || '*';
9017  if (marker !== '*' && marker !== '_') {
9018    throw new Error(
9019      'Cannot serialize strong with `' +
9020        marker +
9021        '` for `options.strong`, expected `*`, or `_`'
9022    )
9023  }
9024  return marker
9025}
9026
9027strong.peek = strongPeek;
9028function strong(node, _, state, info) {
9029  const marker = checkStrong(state);
9030  const exit = state.enter('strong');
9031  const tracker = state.createTracker(info);
9032  let value = tracker.move(marker + marker);
9033  value += tracker.move(
9034    state.containerPhrasing(node, {
9035      before: value,
9036      after: marker,
9037      ...tracker.current()
9038    })
9039  );
9040  value += tracker.move(marker + marker);
9041  exit();
9042  return value
9043}
9044function strongPeek(_, _1, state) {
9045  return state.options.strong || '*'
9046}
9047
9048function text$1(node, _, state, info) {
9049  return state.safe(node.value, info)
9050}
9051
9052function checkRuleRepetition(state) {
9053  const repetition = state.options.ruleRepetition || 3;
9054  if (repetition < 3) {
9055    throw new Error(
9056      'Cannot serialize rules with repetition `' +
9057        repetition +
9058        '` for `options.ruleRepetition`, expected `3` or more'
9059    )
9060  }
9061  return repetition
9062}
9063
9064function thematicBreak(_, _1, state) {
9065  const value = (
9066    checkRule(state) + (state.options.ruleSpaces ? ' ' : '')
9067  ).repeat(checkRuleRepetition(state));
9068  return state.options.ruleSpaces ? value.slice(0, -1) : value
9069}
9070
9071const handle = {
9072  blockquote,
9073  break: hardBreak,
9074  code: code$1,
9075  definition,
9076  emphasis,
9077  hardBreak,
9078  heading,
9079  html,
9080  image,
9081  imageReference,
9082  inlineCode,
9083  link,
9084  linkReference,
9085  list,
9086  listItem,
9087  paragraph,
9088  root,
9089  strong,
9090  text: text$1,
9091  thematicBreak
9092};
9093
9094const join = [joinDefaults];
9095function joinDefaults(left, right, parent, state) {
9096  if (
9097    right.type === 'code' &&
9098    formatCodeAsIndented(right, state) &&
9099    (left.type === 'list' ||
9100      (left.type === right.type && formatCodeAsIndented(left, state)))
9101  ) {
9102    return false
9103  }
9104  if ('spread' in parent && typeof parent.spread === 'boolean') {
9105    if (
9106      left.type === 'paragraph' &&
9107      (left.type === right.type ||
9108        right.type === 'definition' ||
9109        (right.type === 'heading' && formatHeadingAsSetext(right, state)))
9110    ) {
9111      return
9112    }
9113    return parent.spread ? 1 : 0
9114  }
9115}
9116
9117const fullPhrasingSpans = [
9118  'autolink',
9119  'destinationLiteral',
9120  'destinationRaw',
9121  'reference',
9122  'titleQuote',
9123  'titleApostrophe'
9124];
9125const unsafe = [
9126  {character: '\t', after: '[\\r\\n]', inConstruct: 'phrasing'},
9127  {character: '\t', before: '[\\r\\n]', inConstruct: 'phrasing'},
9128  {
9129    character: '\t',
9130    inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']
9131  },
9132  {
9133    character: '\r',
9134    inConstruct: [
9135      'codeFencedLangGraveAccent',
9136      'codeFencedLangTilde',
9137      'codeFencedMetaGraveAccent',
9138      'codeFencedMetaTilde',
9139      'destinationLiteral',
9140      'headingAtx'
9141    ]
9142  },
9143  {
9144    character: '\n',
9145    inConstruct: [
9146      'codeFencedLangGraveAccent',
9147      'codeFencedLangTilde',
9148      'codeFencedMetaGraveAccent',
9149      'codeFencedMetaTilde',
9150      'destinationLiteral',
9151      'headingAtx'
9152    ]
9153  },
9154  {character: ' ', after: '[\\r\\n]', inConstruct: 'phrasing'},
9155  {character: ' ', before: '[\\r\\n]', inConstruct: 'phrasing'},
9156  {
9157    character: ' ',
9158    inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']
9159  },
9160  {
9161    character: '!',
9162    after: '\\[',
9163    inConstruct: 'phrasing',
9164    notInConstruct: fullPhrasingSpans
9165  },
9166  {character: '"', inConstruct: 'titleQuote'},
9167  {atBreak: true, character: '#'},
9168  {character: '#', inConstruct: 'headingAtx', after: '(?:[\r\n]|$)'},
9169  {character: '&', after: '[#A-Za-z]', inConstruct: 'phrasing'},
9170  {character: "'", inConstruct: 'titleApostrophe'},
9171  {character: '(', inConstruct: 'destinationRaw'},
9172  {
9173    before: '\\]',
9174    character: '(',
9175    inConstruct: 'phrasing',
9176    notInConstruct: fullPhrasingSpans
9177  },
9178  {atBreak: true, before: '\\d+', character: ')'},
9179  {character: ')', inConstruct: 'destinationRaw'},
9180  {atBreak: true, character: '*', after: '(?:[ \t\r\n*])'},
9181  {character: '*', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},
9182  {atBreak: true, character: '+', after: '(?:[ \t\r\n])'},
9183  {atBreak: true, character: '-', after: '(?:[ \t\r\n-])'},
9184  {atBreak: true, before: '\\d+', character: '.', after: '(?:[ \t\r\n]|$)'},
9185  {atBreak: true, character: '<', after: '[!/?A-Za-z]'},
9186  {
9187    character: '<',
9188    after: '[!/?A-Za-z]',
9189    inConstruct: 'phrasing',
9190    notInConstruct: fullPhrasingSpans
9191  },
9192  {character: '<', inConstruct: 'destinationLiteral'},
9193  {atBreak: true, character: '='},
9194  {atBreak: true, character: '>'},
9195  {character: '>', inConstruct: 'destinationLiteral'},
9196  {atBreak: true, character: '['},
9197  {character: '[', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},
9198  {character: '[', inConstruct: ['label', 'reference']},
9199  {character: '\\', after: '[\\r\\n]', inConstruct: 'phrasing'},
9200  {character: ']', inConstruct: ['label', 'reference']},
9201  {atBreak: true, character: '_'},
9202  {character: '_', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},
9203  {atBreak: true, character: '`'},
9204  {
9205    character: '`',
9206    inConstruct: ['codeFencedLangGraveAccent', 'codeFencedMetaGraveAccent']
9207  },
9208  {character: '`', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},
9209  {atBreak: true, character: '~'}
9210];
9211
9212function association(node) {
9213  if (node.label || !node.identifier) {
9214    return node.label || ''
9215  }
9216  return decodeString(node.identifier)
9217}
9218
9219function compilePattern(pattern) {
9220  if (!pattern._compiled) {
9221    const before =
9222      (pattern.atBreak ? '[\\r\\n][\\t ]*' : '') +
9223      (pattern.before ? '(?:' + pattern.before + ')' : '');
9224    pattern._compiled = new RegExp(
9225      (before ? '(' + before + ')' : '') +
9226        (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') +
9227        pattern.character +
9228        (pattern.after ? '(?:' + pattern.after + ')' : ''),
9229      'g'
9230    );
9231  }
9232  return pattern._compiled
9233}
9234
9235function containerPhrasing(parent, state, info) {
9236  const indexStack = state.indexStack;
9237  const children = parent.children || [];
9238  const results = [];
9239  let index = -1;
9240  let before = info.before;
9241  indexStack.push(-1);
9242  let tracker = state.createTracker(info);
9243  while (++index < children.length) {
9244    const child = children[index];
9245    let after;
9246    indexStack[indexStack.length - 1] = index;
9247    if (index + 1 < children.length) {
9248      let handle = state.handle.handlers[children[index + 1].type];
9249      if (handle && handle.peek) handle = handle.peek;
9250      after = handle
9251        ? handle(children[index + 1], parent, state, {
9252            before: '',
9253            after: '',
9254            ...tracker.current()
9255          }).charAt(0)
9256        : '';
9257    } else {
9258      after = info.after;
9259    }
9260    if (
9261      results.length > 0 &&
9262      (before === '\r' || before === '\n') &&
9263      child.type === 'html'
9264    ) {
9265      results[results.length - 1] = results[results.length - 1].replace(
9266        /(\r?\n|\r)$/,
9267        ' '
9268      );
9269      before = ' ';
9270      tracker = state.createTracker(info);
9271      tracker.move(results.join(''));
9272    }
9273    results.push(
9274      tracker.move(
9275        state.handle(child, parent, state, {
9276          ...tracker.current(),
9277          before,
9278          after
9279        })
9280      )
9281    );
9282    before = results[results.length - 1].slice(-1);
9283  }
9284  indexStack.pop();
9285  return results.join('')
9286}
9287
9288function containerFlow(parent, state, info) {
9289  const indexStack = state.indexStack;
9290  const children = parent.children || [];
9291  const tracker = state.createTracker(info);
9292  const results = [];
9293  let index = -1;
9294  indexStack.push(-1);
9295  while (++index < children.length) {
9296    const child = children[index];
9297    indexStack[indexStack.length - 1] = index;
9298    results.push(
9299      tracker.move(
9300        state.handle(child, parent, state, {
9301          before: '\n',
9302          after: '\n',
9303          ...tracker.current()
9304        })
9305      )
9306    );
9307    if (child.type !== 'list') {
9308      state.bulletLastUsed = undefined;
9309    }
9310    if (index < children.length - 1) {
9311      results.push(
9312        tracker.move(between(child, children[index + 1], parent, state))
9313      );
9314    }
9315  }
9316  indexStack.pop();
9317  return results.join('')
9318}
9319function between(left, right, parent, state) {
9320  let index = state.join.length;
9321  while (index--) {
9322    const result = state.join[index](left, right, parent, state);
9323    if (result === true || result === 1) {
9324      break
9325    }
9326    if (typeof result === 'number') {
9327      return '\n'.repeat(1 + result)
9328    }
9329    if (result === false) {
9330      return '\n\n<!---->\n\n'
9331    }
9332  }
9333  return '\n\n'
9334}
9335
9336const eol$1 = /\r?\n|\r/g;
9337function indentLines(value, map) {
9338  const result = [];
9339  let start = 0;
9340  let line = 0;
9341  let match;
9342  while ((match = eol$1.exec(value))) {
9343    one(value.slice(start, match.index));
9344    result.push(match[0]);
9345    start = match.index + match[0].length;
9346    line++;
9347  }
9348  one(value.slice(start));
9349  return result.join('')
9350  function one(value) {
9351    result.push(map(value, line, !value));
9352  }
9353}
9354
9355function safe(state, input, config) {
9356  const value = (config.before || '') + (input || '') + (config.after || '');
9357  const positions = [];
9358  const result = [];
9359  const infos = {};
9360  let index = -1;
9361  while (++index < state.unsafe.length) {
9362    const pattern = state.unsafe[index];
9363    if (!patternInScope(state.stack, pattern)) {
9364      continue
9365    }
9366    const expression = state.compilePattern(pattern);
9367    let match;
9368    while ((match = expression.exec(value))) {
9369      const before = 'before' in pattern || Boolean(pattern.atBreak);
9370      const after = 'after' in pattern;
9371      const position = match.index + (before ? match[1].length : 0);
9372      if (positions.includes(position)) {
9373        if (infos[position].before && !before) {
9374          infos[position].before = false;
9375        }
9376        if (infos[position].after && !after) {
9377          infos[position].after = false;
9378        }
9379      } else {
9380        positions.push(position);
9381        infos[position] = {before, after};
9382      }
9383    }
9384  }
9385  positions.sort(numerical);
9386  let start = config.before ? config.before.length : 0;
9387  const end = value.length - (config.after ? config.after.length : 0);
9388  index = -1;
9389  while (++index < positions.length) {
9390    const position = positions[index];
9391    if (position < start || position >= end) {
9392      continue
9393    }
9394    if (
9395      (position + 1 < end &&
9396        positions[index + 1] === position + 1 &&
9397        infos[position].after &&
9398        !infos[position + 1].before &&
9399        !infos[position + 1].after) ||
9400      (positions[index - 1] === position - 1 &&
9401        infos[position].before &&
9402        !infos[position - 1].before &&
9403        !infos[position - 1].after)
9404    ) {
9405      continue
9406    }
9407    if (start !== position) {
9408      result.push(escapeBackslashes(value.slice(start, position), '\\'));
9409    }
9410    start = position;
9411    if (
9412      /[!-/:-@[-`{-~]/.test(value.charAt(position)) &&
9413      (!config.encode || !config.encode.includes(value.charAt(position)))
9414    ) {
9415      result.push('\\');
9416    } else {
9417      result.push(
9418        '&#x' + value.charCodeAt(position).toString(16).toUpperCase() + ';'
9419      );
9420      start++;
9421    }
9422  }
9423  result.push(escapeBackslashes(value.slice(start, end), config.after));
9424  return result.join('')
9425}
9426function numerical(a, b) {
9427  return a - b
9428}
9429function escapeBackslashes(value, after) {
9430  const expression = /\\(?=[!-/:-@[-`{-~])/g;
9431  const positions = [];
9432  const results = [];
9433  const whole = value + after;
9434  let index = -1;
9435  let start = 0;
9436  let match;
9437  while ((match = expression.exec(whole))) {
9438    positions.push(match.index);
9439  }
9440  while (++index < positions.length) {
9441    if (start !== positions[index]) {
9442      results.push(value.slice(start, positions[index]));
9443    }
9444    results.push('\\');
9445    start = positions[index];
9446  }
9447  results.push(value.slice(start));
9448  return results.join('')
9449}
9450
9451function track(config) {
9452  const options = config || {};
9453  const now = options.now || {};
9454  let lineShift = options.lineShift || 0;
9455  let line = now.line || 1;
9456  let column = now.column || 1;
9457  return {move, current, shift}
9458  function current() {
9459    return {now: {line, column}, lineShift}
9460  }
9461  function shift(value) {
9462    lineShift += value;
9463  }
9464  function move(input) {
9465    const value = input || '';
9466    const chunks = value.split(/\r?\n|\r/g);
9467    const tail = chunks[chunks.length - 1];
9468    line += chunks.length - 1;
9469    column =
9470      chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift;
9471    return value
9472  }
9473}
9474
9475function toMarkdown(tree, options = {}) {
9476  const state = {
9477    enter,
9478    indentLines,
9479    associationId: association,
9480    containerPhrasing: containerPhrasingBound,
9481    containerFlow: containerFlowBound,
9482    createTracker: track,
9483    compilePattern,
9484    safe: safeBound,
9485    stack: [],
9486    unsafe: [...unsafe],
9487    join: [...join],
9488    handlers: {...handle},
9489    options: {},
9490    indexStack: [],
9491    handle: undefined
9492  };
9493  configure(state, options);
9494  if (state.options.tightDefinitions) {
9495    state.join.push(joinDefinition);
9496  }
9497  state.handle = zwitch('type', {
9498    invalid,
9499    unknown,
9500    handlers: state.handlers
9501  });
9502  let result = state.handle(tree, undefined, state, {
9503    before: '\n',
9504    after: '\n',
9505    now: {line: 1, column: 1},
9506    lineShift: 0
9507  });
9508  if (
9509    result &&
9510    result.charCodeAt(result.length - 1) !== 10 &&
9511    result.charCodeAt(result.length - 1) !== 13
9512  ) {
9513    result += '\n';
9514  }
9515  return result
9516  function enter(name) {
9517    state.stack.push(name);
9518    return exit
9519    function exit() {
9520      state.stack.pop();
9521    }
9522  }
9523}
9524function invalid(value) {
9525  throw new Error('Cannot handle value `' + value + '`, expected node')
9526}
9527function unknown(value) {
9528  const node =  (value);
9529  throw new Error('Cannot handle unknown node `' + node.type + '`')
9530}
9531function joinDefinition(left, right) {
9532  if (left.type === 'definition' && left.type === right.type) {
9533    return 0
9534  }
9535}
9536function containerPhrasingBound(parent, info) {
9537  return containerPhrasing(parent, this, info)
9538}
9539function containerFlowBound(parent, info) {
9540  return containerFlow(parent, this, info)
9541}
9542function safeBound(value, config) {
9543  return safe(this, value, config)
9544}
9545
9546function remarkStringify(options) {
9547  const self = this;
9548  self.compiler = compiler;
9549  function compiler(tree) {
9550    return toMarkdown(tree, {
9551      ...self.data('settings'),
9552      ...options,
9553      extensions: self.data('toMarkdownExtensions') || []
9554    })
9555  }
9556}
9557
9558function ccount(value, character) {
9559  const source = String(value);
9560  if (typeof character !== 'string') {
9561    throw new TypeError('Expected character')
9562  }
9563  let count = 0;
9564  let index = source.indexOf(character);
9565  while (index !== -1) {
9566    count++;
9567    index = source.indexOf(character, index + character.length);
9568  }
9569  return count
9570}
9571
9572function escapeStringRegexp(string) {
9573	if (typeof string !== 'string') {
9574		throw new TypeError('Expected a string');
9575	}
9576	return string
9577		.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
9578		.replace(/-/g, '\\x2d');
9579}
9580
9581function findAndReplace(tree, list, options) {
9582  const settings = options || {};
9583  const ignored = convert$A(settings.ignore || []);
9584  const pairs = toPairs(list);
9585  let pairIndex = -1;
9586  while (++pairIndex < pairs.length) {
9587    visitParents$A(tree, 'text', visitor);
9588  }
9589  function visitor(node, parents) {
9590    let index = -1;
9591    let grandparent;
9592    while (++index < parents.length) {
9593      const parent = parents[index];
9594      const siblings = grandparent ? grandparent.children : undefined;
9595      if (
9596        ignored(
9597          parent,
9598          siblings ? siblings.indexOf(parent) : undefined,
9599          grandparent
9600        )
9601      ) {
9602        return
9603      }
9604      grandparent = parent;
9605    }
9606    if (grandparent) {
9607      return handler(node, parents)
9608    }
9609  }
9610  function handler(node, parents) {
9611    const parent = parents[parents.length - 1];
9612    const find = pairs[pairIndex][0];
9613    const replace = pairs[pairIndex][1];
9614    let start = 0;
9615    const siblings = parent.children;
9616    const index = siblings.indexOf(node);
9617    let change = false;
9618    let nodes = [];
9619    find.lastIndex = 0;
9620    let match = find.exec(node.value);
9621    while (match) {
9622      const position = match.index;
9623      const matchObject = {
9624        index: match.index,
9625        input: match.input,
9626        stack: [...parents, node]
9627      };
9628      let value = replace(...match, matchObject);
9629      if (typeof value === 'string') {
9630        value = value.length > 0 ? {type: 'text', value} : undefined;
9631      }
9632      if (value === false) {
9633        find.lastIndex = position + 1;
9634      } else {
9635        if (start !== position) {
9636          nodes.push({
9637            type: 'text',
9638            value: node.value.slice(start, position)
9639          });
9640        }
9641        if (Array.isArray(value)) {
9642          nodes.push(...value);
9643        } else if (value) {
9644          nodes.push(value);
9645        }
9646        start = position + match[0].length;
9647        change = true;
9648      }
9649      if (!find.global) {
9650        break
9651      }
9652      match = find.exec(node.value);
9653    }
9654    if (change) {
9655      if (start < node.value.length) {
9656        nodes.push({type: 'text', value: node.value.slice(start)});
9657      }
9658      parent.children.splice(index, 1, ...nodes);
9659    } else {
9660      nodes = [node];
9661    }
9662    return index + nodes.length
9663  }
9664}
9665function toPairs(tupleOrList) {
9666  const result = [];
9667  if (!Array.isArray(tupleOrList)) {
9668    throw new TypeError('Expected find and replace tuple or list of tuples')
9669  }
9670  const list =
9671    !tupleOrList[0] || Array.isArray(tupleOrList[0])
9672      ? tupleOrList
9673      : [tupleOrList];
9674  let index = -1;
9675  while (++index < list.length) {
9676    const tuple = list[index];
9677    result.push([toExpression(tuple[0]), toFunction(tuple[1])]);
9678  }
9679  return result
9680}
9681function toExpression(find) {
9682  return typeof find === 'string' ? new RegExp(escapeStringRegexp(find), 'g') : find
9683}
9684function toFunction(replace) {
9685  return typeof replace === 'function'
9686    ? replace
9687    : function () {
9688        return replace
9689      }
9690}
9691
9692const inConstruct = 'phrasing';
9693const notInConstruct = ['autolink', 'link', 'image', 'label'];
9694function gfmAutolinkLiteralFromMarkdown() {
9695  return {
9696    transforms: [transformGfmAutolinkLiterals],
9697    enter: {
9698      literalAutolink: enterLiteralAutolink,
9699      literalAutolinkEmail: enterLiteralAutolinkValue,
9700      literalAutolinkHttp: enterLiteralAutolinkValue,
9701      literalAutolinkWww: enterLiteralAutolinkValue
9702    },
9703    exit: {
9704      literalAutolink: exitLiteralAutolink,
9705      literalAutolinkEmail: exitLiteralAutolinkEmail,
9706      literalAutolinkHttp: exitLiteralAutolinkHttp,
9707      literalAutolinkWww: exitLiteralAutolinkWww
9708    }
9709  }
9710}
9711function gfmAutolinkLiteralToMarkdown() {
9712  return {
9713    unsafe: [
9714      {
9715        character: '@',
9716        before: '[+\\-.\\w]',
9717        after: '[\\-.\\w]',
9718        inConstruct,
9719        notInConstruct
9720      },
9721      {
9722        character: '.',
9723        before: '[Ww]',
9724        after: '[\\-.\\w]',
9725        inConstruct,
9726        notInConstruct
9727      },
9728      {
9729        character: ':',
9730        before: '[ps]',
9731        after: '\\/',
9732        inConstruct,
9733        notInConstruct
9734      }
9735    ]
9736  }
9737}
9738function enterLiteralAutolink(token) {
9739  this.enter({type: 'link', title: null, url: '', children: []}, token);
9740}
9741function enterLiteralAutolinkValue(token) {
9742  this.config.enter.autolinkProtocol.call(this, token);
9743}
9744function exitLiteralAutolinkHttp(token) {
9745  this.config.exit.autolinkProtocol.call(this, token);
9746}
9747function exitLiteralAutolinkWww(token) {
9748  this.config.exit.data.call(this, token);
9749  const node = this.stack[this.stack.length - 1];
9750  ok$B(node.type === 'link');
9751  node.url = 'http://' + this.sliceSerialize(token);
9752}
9753function exitLiteralAutolinkEmail(token) {
9754  this.config.exit.autolinkEmail.call(this, token);
9755}
9756function exitLiteralAutolink(token) {
9757  this.exit(token);
9758}
9759function transformGfmAutolinkLiterals(tree) {
9760  findAndReplace(
9761    tree,
9762    [
9763      [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl],
9764      [/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g, findEmail]
9765    ],
9766    {ignore: ['link', 'linkReference']}
9767  );
9768}
9769function findUrl(_, protocol, domain, path, match) {
9770  let prefix = '';
9771  if (!previous(match)) {
9772    return false
9773  }
9774  if (/^w/i.test(protocol)) {
9775    domain = protocol + domain;
9776    protocol = '';
9777    prefix = 'http://';
9778  }
9779  if (!isCorrectDomain(domain)) {
9780    return false
9781  }
9782  const parts = splitUrl(domain + path);
9783  if (!parts[0]) return false
9784  const result = {
9785    type: 'link',
9786    title: null,
9787    url: prefix + protocol + parts[0],
9788    children: [{type: 'text', value: protocol + parts[0]}]
9789  };
9790  if (parts[1]) {
9791    return [result, {type: 'text', value: parts[1]}]
9792  }
9793  return result
9794}
9795function findEmail(_, atext, label, match) {
9796  if (
9797    !previous(match, true) ||
9798    /[-\d_]$/.test(label)
9799  ) {
9800    return false
9801  }
9802  return {
9803    type: 'link',
9804    title: null,
9805    url: 'mailto:' + atext + '@' + label,
9806    children: [{type: 'text', value: atext + '@' + label}]
9807  }
9808}
9809function isCorrectDomain(domain) {
9810  const parts = domain.split('.');
9811  if (
9812    parts.length < 2 ||
9813    (parts[parts.length - 1] &&
9814      (/_/.test(parts[parts.length - 1]) ||
9815        !/[a-zA-Z\d]/.test(parts[parts.length - 1]))) ||
9816    (parts[parts.length - 2] &&
9817      (/_/.test(parts[parts.length - 2]) ||
9818        !/[a-zA-Z\d]/.test(parts[parts.length - 2])))
9819  ) {
9820    return false
9821  }
9822  return true
9823}
9824function splitUrl(url) {
9825  const trailExec = /[!"&'),.:;<>?\]}]+$/.exec(url);
9826  if (!trailExec) {
9827    return [url, undefined]
9828  }
9829  url = url.slice(0, trailExec.index);
9830  let trail = trailExec[0];
9831  let closingParenIndex = trail.indexOf(')');
9832  const openingParens = ccount(url, '(');
9833  let closingParens = ccount(url, ')');
9834  while (closingParenIndex !== -1 && openingParens > closingParens) {
9835    url += trail.slice(0, closingParenIndex + 1);
9836    trail = trail.slice(closingParenIndex + 1);
9837    closingParenIndex = trail.indexOf(')');
9838    closingParens++;
9839  }
9840  return [url, trail]
9841}
9842function previous(match, email) {
9843  const code = match.input.charCodeAt(match.index - 1);
9844  return (
9845    (match.index === 0 ||
9846      unicodeWhitespace(code) ||
9847      unicodePunctuation(code)) &&
9848    (!email || code !== 47)
9849  )
9850}
9851
9852footnoteReference.peek = footnoteReferencePeek;
9853function gfmFootnoteFromMarkdown() {
9854  return {
9855    enter: {
9856      gfmFootnoteDefinition: enterFootnoteDefinition,
9857      gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,
9858      gfmFootnoteCall: enterFootnoteCall,
9859      gfmFootnoteCallString: enterFootnoteCallString
9860    },
9861    exit: {
9862      gfmFootnoteDefinition: exitFootnoteDefinition,
9863      gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,
9864      gfmFootnoteCall: exitFootnoteCall,
9865      gfmFootnoteCallString: exitFootnoteCallString
9866    }
9867  }
9868}
9869function gfmFootnoteToMarkdown() {
9870  return {
9871    unsafe: [{character: '[', inConstruct: ['phrasing', 'label', 'reference']}],
9872    handlers: {footnoteDefinition, footnoteReference}
9873  }
9874}
9875function enterFootnoteDefinition(token) {
9876  this.enter(
9877    {type: 'footnoteDefinition', identifier: '', label: '', children: []},
9878    token
9879  );
9880}
9881function enterFootnoteDefinitionLabelString() {
9882  this.buffer();
9883}
9884function exitFootnoteDefinitionLabelString(token) {
9885  const label = this.resume();
9886  const node = this.stack[this.stack.length - 1];
9887  ok$B(node.type === 'footnoteDefinition');
9888  node.label = label;
9889  node.identifier = normalizeIdentifier$1(
9890    this.sliceSerialize(token)
9891  ).toLowerCase();
9892}
9893function exitFootnoteDefinition(token) {
9894  this.exit(token);
9895}
9896function enterFootnoteCall(token) {
9897  this.enter({type: 'footnoteReference', identifier: '', label: ''}, token);
9898}
9899function enterFootnoteCallString() {
9900  this.buffer();
9901}
9902function exitFootnoteCallString(token) {
9903  const label = this.resume();
9904  const node = this.stack[this.stack.length - 1];
9905  ok$B(node.type === 'footnoteReference');
9906  node.label = label;
9907  node.identifier = normalizeIdentifier$1(
9908    this.sliceSerialize(token)
9909  ).toLowerCase();
9910}
9911function exitFootnoteCall(token) {
9912  this.exit(token);
9913}
9914function footnoteReference(node, _, state, info) {
9915  const tracker = state.createTracker(info);
9916  let value = tracker.move('[^');
9917  const exit = state.enter('footnoteReference');
9918  const subexit = state.enter('reference');
9919  value += tracker.move(
9920    state.safe(state.associationId(node), {
9921      ...tracker.current(),
9922      before: value,
9923      after: ']'
9924    })
9925  );
9926  subexit();
9927  exit();
9928  value += tracker.move(']');
9929  return value
9930}
9931function footnoteReferencePeek() {
9932  return '['
9933}
9934function footnoteDefinition(node, _, state, info) {
9935  const tracker = state.createTracker(info);
9936  let value = tracker.move('[^');
9937  const exit = state.enter('footnoteDefinition');
9938  const subexit = state.enter('label');
9939  value += tracker.move(
9940    state.safe(state.associationId(node), {
9941      ...tracker.current(),
9942      before: value,
9943      after: ']'
9944    })
9945  );
9946  subexit();
9947  value += tracker.move(
9948    ']:' + (node.children && node.children.length > 0 ? ' ' : '')
9949  );
9950  tracker.shift(4);
9951  value += tracker.move(
9952    state.indentLines(state.containerFlow(node, tracker.current()), map$1)
9953  );
9954  exit();
9955  return value
9956}
9957function map$1(line, index, blank) {
9958  if (index === 0) {
9959    return line
9960  }
9961  return (blank ? '' : '    ') + line
9962}
9963
9964const constructsWithoutStrikethrough = [
9965  'autolink',
9966  'destinationLiteral',
9967  'destinationRaw',
9968  'reference',
9969  'titleQuote',
9970  'titleApostrophe'
9971];
9972handleDelete.peek = peekDelete;
9973function gfmStrikethroughFromMarkdown() {
9974  return {
9975    canContainEols: ['delete'],
9976    enter: {strikethrough: enterStrikethrough},
9977    exit: {strikethrough: exitStrikethrough}
9978  }
9979}
9980function gfmStrikethroughToMarkdown() {
9981  return {
9982    unsafe: [
9983      {
9984        character: '~',
9985        inConstruct: 'phrasing',
9986        notInConstruct: constructsWithoutStrikethrough
9987      }
9988    ],
9989    handlers: {delete: handleDelete}
9990  }
9991}
9992function enterStrikethrough(token) {
9993  this.enter({type: 'delete', children: []}, token);
9994}
9995function exitStrikethrough(token) {
9996  this.exit(token);
9997}
9998function handleDelete(node, _, state, info) {
9999  const tracker = state.createTracker(info);
10000  const exit = state.enter('strikethrough');
10001  let value = tracker.move('~~');
10002  value += state.containerPhrasing(node, {
10003    ...tracker.current(),
10004    before: value,
10005    after: '~'
10006  });
10007  value += tracker.move('~~');
10008  exit();
10009  return value
10010}
10011function peekDelete() {
10012  return '~'
10013}
10014
10015function markdownTable(table, options = {}) {
10016  const align = (options.align || []).concat();
10017  const stringLength = options.stringLength || defaultStringLength;
10018  const alignments = [];
10019  const cellMatrix = [];
10020  const sizeMatrix = [];
10021  const longestCellByColumn = [];
10022  let mostCellsPerRow = 0;
10023  let rowIndex = -1;
10024  while (++rowIndex < table.length) {
10025    const row = [];
10026    const sizes = [];
10027    let columnIndex = -1;
10028    if (table[rowIndex].length > mostCellsPerRow) {
10029      mostCellsPerRow = table[rowIndex].length;
10030    }
10031    while (++columnIndex < table[rowIndex].length) {
10032      const cell = serialize(table[rowIndex][columnIndex]);
10033      if (options.alignDelimiters !== false) {
10034        const size = stringLength(cell);
10035        sizes[columnIndex] = size;
10036        if (
10037          longestCellByColumn[columnIndex] === undefined ||
10038          size > longestCellByColumn[columnIndex]
10039        ) {
10040          longestCellByColumn[columnIndex] = size;
10041        }
10042      }
10043      row.push(cell);
10044    }
10045    cellMatrix[rowIndex] = row;
10046    sizeMatrix[rowIndex] = sizes;
10047  }
10048  let columnIndex = -1;
10049  if (typeof align === 'object' && 'length' in align) {
10050    while (++columnIndex < mostCellsPerRow) {
10051      alignments[columnIndex] = toAlignment(align[columnIndex]);
10052    }
10053  } else {
10054    const code = toAlignment(align);
10055    while (++columnIndex < mostCellsPerRow) {
10056      alignments[columnIndex] = code;
10057    }
10058  }
10059  columnIndex = -1;
10060  const row = [];
10061  const sizes = [];
10062  while (++columnIndex < mostCellsPerRow) {
10063    const code = alignments[columnIndex];
10064    let before = '';
10065    let after = '';
10066    if (code === 99 ) {
10067      before = ':';
10068      after = ':';
10069    } else if (code === 108 ) {
10070      before = ':';
10071    } else if (code === 114 ) {
10072      after = ':';
10073    }
10074    let size =
10075      options.alignDelimiters === false
10076        ? 1
10077        : Math.max(
10078            1,
10079            longestCellByColumn[columnIndex] - before.length - after.length
10080          );
10081    const cell = before + '-'.repeat(size) + after;
10082    if (options.alignDelimiters !== false) {
10083      size = before.length + size + after.length;
10084      if (size > longestCellByColumn[columnIndex]) {
10085        longestCellByColumn[columnIndex] = size;
10086      }
10087      sizes[columnIndex] = size;
10088    }
10089    row[columnIndex] = cell;
10090  }
10091  cellMatrix.splice(1, 0, row);
10092  sizeMatrix.splice(1, 0, sizes);
10093  rowIndex = -1;
10094  const lines = [];
10095  while (++rowIndex < cellMatrix.length) {
10096    const row = cellMatrix[rowIndex];
10097    const sizes = sizeMatrix[rowIndex];
10098    columnIndex = -1;
10099    const line = [];
10100    while (++columnIndex < mostCellsPerRow) {
10101      const cell = row[columnIndex] || '';
10102      let before = '';
10103      let after = '';
10104      if (options.alignDelimiters !== false) {
10105        const size =
10106          longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0);
10107        const code = alignments[columnIndex];
10108        if (code === 114 ) {
10109          before = ' '.repeat(size);
10110        } else if (code === 99 ) {
10111          if (size % 2) {
10112            before = ' '.repeat(size / 2 + 0.5);
10113            after = ' '.repeat(size / 2 - 0.5);
10114          } else {
10115            before = ' '.repeat(size / 2);
10116            after = before;
10117          }
10118        } else {
10119          after = ' '.repeat(size);
10120        }
10121      }
10122      if (options.delimiterStart !== false && !columnIndex) {
10123        line.push('|');
10124      }
10125      if (
10126        options.padding !== false &&
10127        !(options.alignDelimiters === false && cell === '') &&
10128        (options.delimiterStart !== false || columnIndex)
10129      ) {
10130        line.push(' ');
10131      }
10132      if (options.alignDelimiters !== false) {
10133        line.push(before);
10134      }
10135      line.push(cell);
10136      if (options.alignDelimiters !== false) {
10137        line.push(after);
10138      }
10139      if (options.padding !== false) {
10140        line.push(' ');
10141      }
10142      if (
10143        options.delimiterEnd !== false ||
10144        columnIndex !== mostCellsPerRow - 1
10145      ) {
10146        line.push('|');
10147      }
10148    }
10149    lines.push(
10150      options.delimiterEnd === false
10151        ? line.join('').replace(/ +$/, '')
10152        : line.join('')
10153    );
10154  }
10155  return lines.join('\n')
10156}
10157function serialize(value) {
10158  return value === null || value === undefined ? '' : String(value)
10159}
10160function defaultStringLength(value) {
10161  return value.length
10162}
10163function toAlignment(value) {
10164  const code = typeof value === 'string' ? value.codePointAt(0) : 0;
10165  return code === 67  || code === 99
10166    ? 99
10167    : code === 76  || code === 108
10168    ? 108
10169    : code === 82  || code === 114
10170    ? 114
10171    : 0
10172}
10173
10174function gfmTableFromMarkdown() {
10175  return {
10176    enter: {
10177      table: enterTable,
10178      tableData: enterCell,
10179      tableHeader: enterCell,
10180      tableRow: enterRow
10181    },
10182    exit: {
10183      codeText: exitCodeText,
10184      table: exitTable,
10185      tableData: exit,
10186      tableHeader: exit,
10187      tableRow: exit
10188    }
10189  }
10190}
10191function enterTable(token) {
10192  const align = token._align;
10193  this.enter(
10194    {
10195      type: 'table',
10196      align: align.map(function (d) {
10197        return d === 'none' ? null : d
10198      }),
10199      children: []
10200    },
10201    token
10202  );
10203  this.data.inTable = true;
10204}
10205function exitTable(token) {
10206  this.exit(token);
10207  this.data.inTable = undefined;
10208}
10209function enterRow(token) {
10210  this.enter({type: 'tableRow', children: []}, token);
10211}
10212function exit(token) {
10213  this.exit(token);
10214}
10215function enterCell(token) {
10216  this.enter({type: 'tableCell', children: []}, token);
10217}
10218function exitCodeText(token) {
10219  let value = this.resume();
10220  if (this.data.inTable) {
10221    value = value.replace(/\\([\\|])/g, replace);
10222  }
10223  const node = this.stack[this.stack.length - 1];
10224  ok$B(node.type === 'inlineCode');
10225  node.value = value;
10226  this.exit(token);
10227}
10228function replace($0, $1) {
10229  return $1 === '|' ? $1 : $0
10230}
10231function gfmTableToMarkdown(options) {
10232  const settings = options || {};
10233  const padding = settings.tableCellPadding;
10234  const alignDelimiters = settings.tablePipeAlign;
10235  const stringLength = settings.stringLength;
10236  const around = padding ? ' ' : '|';
10237  return {
10238    unsafe: [
10239      {character: '\r', inConstruct: 'tableCell'},
10240      {character: '\n', inConstruct: 'tableCell'},
10241      {atBreak: true, character: '|', after: '[\t :-]'},
10242      {character: '|', inConstruct: 'tableCell'},
10243      {atBreak: true, character: ':', after: '-'},
10244      {atBreak: true, character: '-', after: '[:|-]'}
10245    ],
10246    handlers: {
10247      inlineCode: inlineCodeWithTable,
10248      table: handleTable,
10249      tableCell: handleTableCell,
10250      tableRow: handleTableRow
10251    }
10252  }
10253  function handleTable(node, _, state, info) {
10254    return serializeData(handleTableAsData(node, state, info), node.align)
10255  }
10256  function handleTableRow(node, _, state, info) {
10257    const row = handleTableRowAsData(node, state, info);
10258    const value = serializeData([row]);
10259    return value.slice(0, value.indexOf('\n'))
10260  }
10261  function handleTableCell(node, _, state, info) {
10262    const exit = state.enter('tableCell');
10263    const subexit = state.enter('phrasing');
10264    const value = state.containerPhrasing(node, {
10265      ...info,
10266      before: around,
10267      after: around
10268    });
10269    subexit();
10270    exit();
10271    return value
10272  }
10273  function serializeData(matrix, align) {
10274    return markdownTable(matrix, {
10275      align,
10276      alignDelimiters,
10277      padding,
10278      stringLength
10279    })
10280  }
10281  function handleTableAsData(node, state, info) {
10282    const children = node.children;
10283    let index = -1;
10284    const result = [];
10285    const subexit = state.enter('table');
10286    while (++index < children.length) {
10287      result[index] = handleTableRowAsData(children[index], state, info);
10288    }
10289    subexit();
10290    return result
10291  }
10292  function handleTableRowAsData(node, state, info) {
10293    const children = node.children;
10294    let index = -1;
10295    const result = [];
10296    const subexit = state.enter('tableRow');
10297    while (++index < children.length) {
10298      result[index] = handleTableCell(children[index], node, state, info);
10299    }
10300    subexit();
10301    return result
10302  }
10303  function inlineCodeWithTable(node, parent, state) {
10304    let value = handle.inlineCode(node, parent, state);
10305    if (state.stack.includes('tableCell')) {
10306      value = value.replace(/\|/g, '\\$&');
10307    }
10308    return value
10309  }
10310}
10311
10312function gfmTaskListItemFromMarkdown() {
10313  return {
10314    exit: {
10315      taskListCheckValueChecked: exitCheck,
10316      taskListCheckValueUnchecked: exitCheck,
10317      paragraph: exitParagraphWithTaskListItem
10318    }
10319  }
10320}
10321function gfmTaskListItemToMarkdown() {
10322  return {
10323    unsafe: [{atBreak: true, character: '-', after: '[:|-]'}],
10324    handlers: {listItem: listItemWithTaskListItem}
10325  }
10326}
10327function exitCheck(token) {
10328  const node = this.stack[this.stack.length - 2];
10329  ok$B(node.type === 'listItem');
10330  node.checked = token.type === 'taskListCheckValueChecked';
10331}
10332function exitParagraphWithTaskListItem(token) {
10333  const parent = this.stack[this.stack.length - 2];
10334  if (
10335    parent &&
10336    parent.type === 'listItem' &&
10337    typeof parent.checked === 'boolean'
10338  ) {
10339    const node = this.stack[this.stack.length - 1];
10340    ok$B(node.type === 'paragraph');
10341    const head = node.children[0];
10342    if (head && head.type === 'text') {
10343      const siblings = parent.children;
10344      let index = -1;
10345      let firstParaghraph;
10346      while (++index < siblings.length) {
10347        const sibling = siblings[index];
10348        if (sibling.type === 'paragraph') {
10349          firstParaghraph = sibling;
10350          break
10351        }
10352      }
10353      if (firstParaghraph === node) {
10354        head.value = head.value.slice(1);
10355        if (head.value.length === 0) {
10356          node.children.shift();
10357        } else if (
10358          node.position &&
10359          head.position &&
10360          typeof head.position.start.offset === 'number'
10361        ) {
10362          head.position.start.column++;
10363          head.position.start.offset++;
10364          node.position.start = Object.assign({}, head.position.start);
10365        }
10366      }
10367    }
10368  }
10369  this.exit(token);
10370}
10371function listItemWithTaskListItem(node, parent, state, info) {
10372  const head = node.children[0];
10373  const checkable =
10374    typeof node.checked === 'boolean' && head && head.type === 'paragraph';
10375  const checkbox = '[' + (node.checked ? 'x' : ' ') + '] ';
10376  const tracker = state.createTracker(info);
10377  if (checkable) {
10378    tracker.move(checkbox);
10379  }
10380  let value = handle.listItem(node, parent, state, {
10381    ...info,
10382    ...tracker.current()
10383  });
10384  if (checkable) {
10385    value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check);
10386  }
10387  return value
10388  function check($0) {
10389    return $0 + checkbox
10390  }
10391}
10392
10393function gfmFromMarkdown() {
10394  return [
10395    gfmAutolinkLiteralFromMarkdown(),
10396    gfmFootnoteFromMarkdown(),
10397    gfmStrikethroughFromMarkdown(),
10398    gfmTableFromMarkdown(),
10399    gfmTaskListItemFromMarkdown()
10400  ]
10401}
10402function gfmToMarkdown(options) {
10403  return {
10404    extensions: [
10405      gfmAutolinkLiteralToMarkdown(),
10406      gfmFootnoteToMarkdown(),
10407      gfmStrikethroughToMarkdown(),
10408      gfmTableToMarkdown(options),
10409      gfmTaskListItemToMarkdown()
10410    ]
10411  }
10412}
10413
10414const wwwPrefix = {
10415  tokenize: tokenizeWwwPrefix,
10416  partial: true
10417};
10418const domain = {
10419  tokenize: tokenizeDomain,
10420  partial: true
10421};
10422const path = {
10423  tokenize: tokenizePath,
10424  partial: true
10425};
10426const trail = {
10427  tokenize: tokenizeTrail,
10428  partial: true
10429};
10430const emailDomainDotTrail = {
10431  tokenize: tokenizeEmailDomainDotTrail,
10432  partial: true
10433};
10434const wwwAutolink = {
10435  tokenize: tokenizeWwwAutolink,
10436  previous: previousWww
10437};
10438const protocolAutolink = {
10439  tokenize: tokenizeProtocolAutolink,
10440  previous: previousProtocol
10441};
10442const emailAutolink = {
10443  tokenize: tokenizeEmailAutolink,
10444  previous: previousEmail
10445};
10446const text = {};
10447function gfmAutolinkLiteral() {
10448  return {
10449    text
10450  }
10451}
10452let code = 48;
10453while (code < 123) {
10454  text[code] = emailAutolink;
10455  code++;
10456  if (code === 58) code = 65;
10457  else if (code === 91) code = 97;
10458}
10459text[43] = emailAutolink;
10460text[45] = emailAutolink;
10461text[46] = emailAutolink;
10462text[95] = emailAutolink;
10463text[72] = [emailAutolink, protocolAutolink];
10464text[104] = [emailAutolink, protocolAutolink];
10465text[87] = [emailAutolink, wwwAutolink];
10466text[119] = [emailAutolink, wwwAutolink];
10467function tokenizeEmailAutolink(effects, ok, nok) {
10468  const self = this;
10469  let dot;
10470  let data;
10471  return start
10472  function start(code) {
10473    if (
10474      !gfmAtext(code) ||
10475      !previousEmail.call(self, self.previous) ||
10476      previousUnbalanced(self.events)
10477    ) {
10478      return nok(code)
10479    }
10480    effects.enter('literalAutolink');
10481    effects.enter('literalAutolinkEmail');
10482    return atext(code)
10483  }
10484  function atext(code) {
10485    if (gfmAtext(code)) {
10486      effects.consume(code);
10487      return atext
10488    }
10489    if (code === 64) {
10490      effects.consume(code);
10491      return emailDomain
10492    }
10493    return nok(code)
10494  }
10495  function emailDomain(code) {
10496    if (code === 46) {
10497      return effects.check(
10498        emailDomainDotTrail,
10499        emailDomainAfter,
10500        emailDomainDot
10501      )(code)
10502    }
10503    if (code === 45 || code === 95 || asciiAlphanumeric(code)) {
10504      data = true;
10505      effects.consume(code);
10506      return emailDomain
10507    }
10508    return emailDomainAfter(code)
10509  }
10510  function emailDomainDot(code) {
10511    effects.consume(code);
10512    dot = true;
10513    return emailDomain
10514  }
10515  function emailDomainAfter(code) {
10516    if (data && dot && asciiAlpha(self.previous)) {
10517      effects.exit('literalAutolinkEmail');
10518      effects.exit('literalAutolink');
10519      return ok(code)
10520    }
10521    return nok(code)
10522  }
10523}
10524function tokenizeWwwAutolink(effects, ok, nok) {
10525  const self = this;
10526  return wwwStart
10527  function wwwStart(code) {
10528    if (
10529      (code !== 87 && code !== 119) ||
10530      !previousWww.call(self, self.previous) ||
10531      previousUnbalanced(self.events)
10532    ) {
10533      return nok(code)
10534    }
10535    effects.enter('literalAutolink');
10536    effects.enter('literalAutolinkWww');
10537    return effects.check(
10538      wwwPrefix,
10539      effects.attempt(domain, effects.attempt(path, wwwAfter), nok),
10540      nok
10541    )(code)
10542  }
10543  function wwwAfter(code) {
10544    effects.exit('literalAutolinkWww');
10545    effects.exit('literalAutolink');
10546    return ok(code)
10547  }
10548}
10549function tokenizeProtocolAutolink(effects, ok, nok) {
10550  const self = this;
10551  let buffer = '';
10552  let seen = false;
10553  return protocolStart
10554  function protocolStart(code) {
10555    if (
10556      (code === 72 || code === 104) &&
10557      previousProtocol.call(self, self.previous) &&
10558      !previousUnbalanced(self.events)
10559    ) {
10560      effects.enter('literalAutolink');
10561      effects.enter('literalAutolinkHttp');
10562      buffer += String.fromCodePoint(code);
10563      effects.consume(code);
10564      return protocolPrefixInside
10565    }
10566    return nok(code)
10567  }
10568  function protocolPrefixInside(code) {
10569    if (asciiAlpha(code) && buffer.length < 5) {
10570      buffer += String.fromCodePoint(code);
10571      effects.consume(code);
10572      return protocolPrefixInside
10573    }
10574    if (code === 58) {
10575      const protocol = buffer.toLowerCase();
10576      if (protocol === 'http' || protocol === 'https') {
10577        effects.consume(code);
10578        return protocolSlashesInside
10579      }
10580    }
10581    return nok(code)
10582  }
10583  function protocolSlashesInside(code) {
10584    if (code === 47) {
10585      effects.consume(code);
10586      if (seen) {
10587        return afterProtocol
10588      }
10589      seen = true;
10590      return protocolSlashesInside
10591    }
10592    return nok(code)
10593  }
10594  function afterProtocol(code) {
10595    return code === null ||
10596      asciiControl(code) ||
10597      markdownLineEndingOrSpace(code) ||
10598      unicodeWhitespace(code) ||
10599      unicodePunctuation(code)
10600      ? nok(code)
10601      : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code)
10602  }
10603  function protocolAfter(code) {
10604    effects.exit('literalAutolinkHttp');
10605    effects.exit('literalAutolink');
10606    return ok(code)
10607  }
10608}
10609function tokenizeWwwPrefix(effects, ok, nok) {
10610  let size = 0;
10611  return wwwPrefixInside
10612  function wwwPrefixInside(code) {
10613    if ((code === 87 || code === 119) && size < 3) {
10614      size++;
10615      effects.consume(code);
10616      return wwwPrefixInside
10617    }
10618    if (code === 46 && size === 3) {
10619      effects.consume(code);
10620      return wwwPrefixAfter
10621    }
10622    return nok(code)
10623  }
10624  function wwwPrefixAfter(code) {
10625    return code === null ? nok(code) : ok(code)
10626  }
10627}
10628function tokenizeDomain(effects, ok, nok) {
10629  let underscoreInLastSegment;
10630  let underscoreInLastLastSegment;
10631  let seen;
10632  return domainInside
10633  function domainInside(code) {
10634    if (code === 46 || code === 95) {
10635      return effects.check(trail, domainAfter, domainAtPunctuation)(code)
10636    }
10637    if (
10638      code === null ||
10639      markdownLineEndingOrSpace(code) ||
10640      unicodeWhitespace(code) ||
10641      (code !== 45 && unicodePunctuation(code))
10642    ) {
10643      return domainAfter(code)
10644    }
10645    seen = true;
10646    effects.consume(code);
10647    return domainInside
10648  }
10649  function domainAtPunctuation(code) {
10650    if (code === 95) {
10651      underscoreInLastSegment = true;
10652    }
10653    else {
10654      underscoreInLastLastSegment = underscoreInLastSegment;
10655      underscoreInLastSegment = undefined;
10656    }
10657    effects.consume(code);
10658    return domainInside
10659  }
10660  function domainAfter(code) {
10661    if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {
10662      return nok(code)
10663    }
10664    return ok(code)
10665  }
10666}
10667function tokenizePath(effects, ok) {
10668  let sizeOpen = 0;
10669  let sizeClose = 0;
10670  return pathInside
10671  function pathInside(code) {
10672    if (code === 40) {
10673      sizeOpen++;
10674      effects.consume(code);
10675      return pathInside
10676    }
10677    if (code === 41 && sizeClose < sizeOpen) {
10678      return pathAtPunctuation(code)
10679    }
10680    if (
10681      code === 33 ||
10682      code === 34 ||
10683      code === 38 ||
10684      code === 39 ||
10685      code === 41 ||
10686      code === 42 ||
10687      code === 44 ||
10688      code === 46 ||
10689      code === 58 ||
10690      code === 59 ||
10691      code === 60 ||
10692      code === 63 ||
10693      code === 93 ||
10694      code === 95 ||
10695      code === 126
10696    ) {
10697      return effects.check(trail, ok, pathAtPunctuation)(code)
10698    }
10699    if (
10700      code === null ||
10701      markdownLineEndingOrSpace(code) ||
10702      unicodeWhitespace(code)
10703    ) {
10704      return ok(code)
10705    }
10706    effects.consume(code);
10707    return pathInside
10708  }
10709  function pathAtPunctuation(code) {
10710    if (code === 41) {
10711      sizeClose++;
10712    }
10713    effects.consume(code);
10714    return pathInside
10715  }
10716}
10717function tokenizeTrail(effects, ok, nok) {
10718  return trail
10719  function trail(code) {
10720    if (
10721      code === 33 ||
10722      code === 34 ||
10723      code === 39 ||
10724      code === 41 ||
10725      code === 42 ||
10726      code === 44 ||
10727      code === 46 ||
10728      code === 58 ||
10729      code === 59 ||
10730      code === 63 ||
10731      code === 95 ||
10732      code === 126
10733    ) {
10734      effects.consume(code);
10735      return trail
10736    }
10737    if (code === 38) {
10738      effects.consume(code);
10739      return trailCharRefStart
10740    }
10741    if (code === 93) {
10742      effects.consume(code);
10743      return trailBracketAfter
10744    }
10745    if (
10746      code === 60 ||
10747      code === null ||
10748      markdownLineEndingOrSpace(code) ||
10749      unicodeWhitespace(code)
10750    ) {
10751      return ok(code)
10752    }
10753    return nok(code)
10754  }
10755  function trailBracketAfter(code) {
10756    if (
10757      code === null ||
10758      code === 40 ||
10759      code === 91 ||
10760      markdownLineEndingOrSpace(code) ||
10761      unicodeWhitespace(code)
10762    ) {
10763      return ok(code)
10764    }
10765    return trail(code)
10766  }
10767  function trailCharRefStart(code) {
10768    return asciiAlpha(code) ? trailCharRefInside(code) : nok(code)
10769  }
10770  function trailCharRefInside(code) {
10771    if (code === 59) {
10772      effects.consume(code);
10773      return trail
10774    }
10775    if (asciiAlpha(code)) {
10776      effects.consume(code);
10777      return trailCharRefInside
10778    }
10779    return nok(code)
10780  }
10781}
10782function tokenizeEmailDomainDotTrail(effects, ok, nok) {
10783  return start
10784  function start(code) {
10785    effects.consume(code);
10786    return after
10787  }
10788  function after(code) {
10789    return asciiAlphanumeric(code) ? nok(code) : ok(code)
10790  }
10791}
10792function previousWww(code) {
10793  return (
10794    code === null ||
10795    code === 40 ||
10796    code === 42 ||
10797    code === 95 ||
10798    code === 91 ||
10799    code === 93 ||
10800    code === 126 ||
10801    markdownLineEndingOrSpace(code)
10802  )
10803}
10804function previousProtocol(code) {
10805  return !asciiAlpha(code)
10806}
10807function previousEmail(code) {
10808  return !(code === 47 || gfmAtext(code))
10809}
10810function gfmAtext(code) {
10811  return (
10812    code === 43 ||
10813    code === 45 ||
10814    code === 46 ||
10815    code === 95 ||
10816    asciiAlphanumeric(code)
10817  )
10818}
10819function previousUnbalanced(events) {
10820  let index = events.length;
10821  let result = false;
10822  while (index--) {
10823    const token = events[index][1];
10824    if (
10825      (token.type === 'labelLink' || token.type === 'labelImage') &&
10826      !token._balanced
10827    ) {
10828      result = true;
10829      break
10830    }
10831    if (token._gfmAutolinkLiteralWalkedInto) {
10832      result = false;
10833      break
10834    }
10835  }
10836  if (events.length > 0 && !result) {
10837    events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;
10838  }
10839  return result
10840}
10841
10842const indent = {
10843  tokenize: tokenizeIndent,
10844  partial: true
10845};
10846function gfmFootnote() {
10847  return {
10848    document: {
10849      [91]: {
10850        tokenize: tokenizeDefinitionStart,
10851        continuation: {
10852          tokenize: tokenizeDefinitionContinuation
10853        },
10854        exit: gfmFootnoteDefinitionEnd
10855      }
10856    },
10857    text: {
10858      [91]: {
10859        tokenize: tokenizeGfmFootnoteCall
10860      },
10861      [93]: {
10862        add: 'after',
10863        tokenize: tokenizePotentialGfmFootnoteCall,
10864        resolveTo: resolveToPotentialGfmFootnoteCall
10865      }
10866    }
10867  }
10868}
10869function tokenizePotentialGfmFootnoteCall(effects, ok, nok) {
10870  const self = this;
10871  let index = self.events.length;
10872  const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
10873  let labelStart;
10874  while (index--) {
10875    const token = self.events[index][1];
10876    if (token.type === 'labelImage') {
10877      labelStart = token;
10878      break
10879    }
10880    if (
10881      token.type === 'gfmFootnoteCall' ||
10882      token.type === 'labelLink' ||
10883      token.type === 'label' ||
10884      token.type === 'image' ||
10885      token.type === 'link'
10886    ) {
10887      break
10888    }
10889  }
10890  return start
10891  function start(code) {
10892    if (!labelStart || !labelStart._balanced) {
10893      return nok(code)
10894    }
10895    const id = normalizeIdentifier$1(
10896      self.sliceSerialize({
10897        start: labelStart.end,
10898        end: self.now()
10899      })
10900    );
10901    if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
10902      return nok(code)
10903    }
10904    effects.enter('gfmFootnoteCallLabelMarker');
10905    effects.consume(code);
10906    effects.exit('gfmFootnoteCallLabelMarker');
10907    return ok(code)
10908  }
10909}
10910function resolveToPotentialGfmFootnoteCall(events, context) {
10911  let index = events.length;
10912  while (index--) {
10913    if (
10914      events[index][1].type === 'labelImage' &&
10915      events[index][0] === 'enter'
10916    ) {
10917      events[index][1];
10918      break
10919    }
10920  }
10921  events[index + 1][1].type = 'data';
10922  events[index + 3][1].type = 'gfmFootnoteCallLabelMarker';
10923  const call = {
10924    type: 'gfmFootnoteCall',
10925    start: Object.assign({}, events[index + 3][1].start),
10926    end: Object.assign({}, events[events.length - 1][1].end)
10927  };
10928  const marker = {
10929    type: 'gfmFootnoteCallMarker',
10930    start: Object.assign({}, events[index + 3][1].end),
10931    end: Object.assign({}, events[index + 3][1].end)
10932  };
10933  marker.end.column++;
10934  marker.end.offset++;
10935  marker.end._bufferIndex++;
10936  const string = {
10937    type: 'gfmFootnoteCallString',
10938    start: Object.assign({}, marker.end),
10939    end: Object.assign({}, events[events.length - 1][1].start)
10940  };
10941  const chunk = {
10942    type: 'chunkString',
10943    contentType: 'string',
10944    start: Object.assign({}, string.start),
10945    end: Object.assign({}, string.end)
10946  };
10947  const replacement = [
10948    events[index + 1],
10949    events[index + 2],
10950    ['enter', call, context],
10951    events[index + 3],
10952    events[index + 4],
10953    ['enter', marker, context],
10954    ['exit', marker, context],
10955    ['enter', string, context],
10956    ['enter', chunk, context],
10957    ['exit', chunk, context],
10958    ['exit', string, context],
10959    events[events.length - 2],
10960    events[events.length - 1],
10961    ['exit', call, context]
10962  ];
10963  events.splice(index, events.length - index + 1, ...replacement);
10964  return events
10965}
10966function tokenizeGfmFootnoteCall(effects, ok, nok) {
10967  const self = this;
10968  const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
10969  let size = 0;
10970  let data;
10971  return start
10972  function start(code) {
10973    effects.enter('gfmFootnoteCall');
10974    effects.enter('gfmFootnoteCallLabelMarker');
10975    effects.consume(code);
10976    effects.exit('gfmFootnoteCallLabelMarker');
10977    return callStart
10978  }
10979  function callStart(code) {
10980    if (code !== 94) return nok(code)
10981    effects.enter('gfmFootnoteCallMarker');
10982    effects.consume(code);
10983    effects.exit('gfmFootnoteCallMarker');
10984    effects.enter('gfmFootnoteCallString');
10985    effects.enter('chunkString').contentType = 'string';
10986    return callData
10987  }
10988  function callData(code) {
10989    if (
10990      size > 999 ||
10991      (code === 93 && !data) ||
10992      code === null ||
10993      code === 91 ||
10994      markdownLineEndingOrSpace(code)
10995    ) {
10996      return nok(code)
10997    }
10998    if (code === 93) {
10999      effects.exit('chunkString');
11000      const token = effects.exit('gfmFootnoteCallString');
11001      if (!defined.includes(normalizeIdentifier$1(self.sliceSerialize(token)))) {
11002        return nok(code)
11003      }
11004      effects.enter('gfmFootnoteCallLabelMarker');
11005      effects.consume(code);
11006      effects.exit('gfmFootnoteCallLabelMarker');
11007      effects.exit('gfmFootnoteCall');
11008      return ok
11009    }
11010    if (!markdownLineEndingOrSpace(code)) {
11011      data = true;
11012    }
11013    size++;
11014    effects.consume(code);
11015    return code === 92 ? callEscape : callData
11016  }
11017  function callEscape(code) {
11018    if (code === 91 || code === 92 || code === 93) {
11019      effects.consume(code);
11020      size++;
11021      return callData
11022    }
11023    return callData(code)
11024  }
11025}
11026function tokenizeDefinitionStart(effects, ok, nok) {
11027  const self = this;
11028  const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
11029  let identifier;
11030  let size = 0;
11031  let data;
11032  return start
11033  function start(code) {
11034    effects.enter('gfmFootnoteDefinition')._container = true;
11035    effects.enter('gfmFootnoteDefinitionLabel');
11036    effects.enter('gfmFootnoteDefinitionLabelMarker');
11037    effects.consume(code);
11038    effects.exit('gfmFootnoteDefinitionLabelMarker');
11039    return labelAtMarker
11040  }
11041  function labelAtMarker(code) {
11042    if (code === 94) {
11043      effects.enter('gfmFootnoteDefinitionMarker');
11044      effects.consume(code);
11045      effects.exit('gfmFootnoteDefinitionMarker');
11046      effects.enter('gfmFootnoteDefinitionLabelString');
11047      effects.enter('chunkString').contentType = 'string';
11048      return labelInside
11049    }
11050    return nok(code)
11051  }
11052  function labelInside(code) {
11053    if (
11054      size > 999 ||
11055      (code === 93 && !data) ||
11056      code === null ||
11057      code === 91 ||
11058      markdownLineEndingOrSpace(code)
11059    ) {
11060      return nok(code)
11061    }
11062    if (code === 93) {
11063      effects.exit('chunkString');
11064      const token = effects.exit('gfmFootnoteDefinitionLabelString');
11065      identifier = normalizeIdentifier$1(self.sliceSerialize(token));
11066      effects.enter('gfmFootnoteDefinitionLabelMarker');
11067      effects.consume(code);
11068      effects.exit('gfmFootnoteDefinitionLabelMarker');
11069      effects.exit('gfmFootnoteDefinitionLabel');
11070      return labelAfter
11071    }
11072    if (!markdownLineEndingOrSpace(code)) {
11073      data = true;
11074    }
11075    size++;
11076    effects.consume(code);
11077    return code === 92 ? labelEscape : labelInside
11078  }
11079  function labelEscape(code) {
11080    if (code === 91 || code === 92 || code === 93) {
11081      effects.consume(code);
11082      size++;
11083      return labelInside
11084    }
11085    return labelInside(code)
11086  }
11087  function labelAfter(code) {
11088    if (code === 58) {
11089      effects.enter('definitionMarker');
11090      effects.consume(code);
11091      effects.exit('definitionMarker');
11092      if (!defined.includes(identifier)) {
11093        defined.push(identifier);
11094      }
11095      return factorySpace(
11096        effects,
11097        whitespaceAfter,
11098        'gfmFootnoteDefinitionWhitespace'
11099      )
11100    }
11101    return nok(code)
11102  }
11103  function whitespaceAfter(code) {
11104    return ok(code)
11105  }
11106}
11107function tokenizeDefinitionContinuation(effects, ok, nok) {
11108  return effects.check(blankLine, ok, effects.attempt(indent, ok, nok))
11109}
11110function gfmFootnoteDefinitionEnd(effects) {
11111  effects.exit('gfmFootnoteDefinition');
11112}
11113function tokenizeIndent(effects, ok, nok) {
11114  const self = this;
11115  return factorySpace(
11116    effects,
11117    afterPrefix,
11118    'gfmFootnoteDefinitionIndent',
11119    4 + 1
11120  )
11121  function afterPrefix(code) {
11122    const tail = self.events[self.events.length - 1];
11123    return tail &&
11124      tail[1].type === 'gfmFootnoteDefinitionIndent' &&
11125      tail[2].sliceSerialize(tail[1], true).length === 4
11126      ? ok(code)
11127      : nok(code)
11128  }
11129}
11130
11131function gfmStrikethrough(options) {
11132  const options_ = options || {};
11133  let single = options_.singleTilde;
11134  const tokenizer = {
11135    tokenize: tokenizeStrikethrough,
11136    resolveAll: resolveAllStrikethrough
11137  };
11138  if (single === null || single === undefined) {
11139    single = true;
11140  }
11141  return {
11142    text: {
11143      [126]: tokenizer
11144    },
11145    insideSpan: {
11146      null: [tokenizer]
11147    },
11148    attentionMarkers: {
11149      null: [126]
11150    }
11151  }
11152  function resolveAllStrikethrough(events, context) {
11153    let index = -1;
11154    while (++index < events.length) {
11155      if (
11156        events[index][0] === 'enter' &&
11157        events[index][1].type === 'strikethroughSequenceTemporary' &&
11158        events[index][1]._close
11159      ) {
11160        let open = index;
11161        while (open--) {
11162          if (
11163            events[open][0] === 'exit' &&
11164            events[open][1].type === 'strikethroughSequenceTemporary' &&
11165            events[open][1]._open &&
11166            events[index][1].end.offset - events[index][1].start.offset ===
11167              events[open][1].end.offset - events[open][1].start.offset
11168          ) {
11169            events[index][1].type = 'strikethroughSequence';
11170            events[open][1].type = 'strikethroughSequence';
11171            const strikethrough = {
11172              type: 'strikethrough',
11173              start: Object.assign({}, events[open][1].start),
11174              end: Object.assign({}, events[index][1].end)
11175            };
11176            const text = {
11177              type: 'strikethroughText',
11178              start: Object.assign({}, events[open][1].end),
11179              end: Object.assign({}, events[index][1].start)
11180            };
11181            const nextEvents = [
11182              ['enter', strikethrough, context],
11183              ['enter', events[open][1], context],
11184              ['exit', events[open][1], context],
11185              ['enter', text, context]
11186            ];
11187            const insideSpan = context.parser.constructs.insideSpan.null;
11188            if (insideSpan) {
11189              splice(
11190                nextEvents,
11191                nextEvents.length,
11192                0,
11193                resolveAll(insideSpan, events.slice(open + 1, index), context)
11194              );
11195            }
11196            splice(nextEvents, nextEvents.length, 0, [
11197              ['exit', text, context],
11198              ['enter', events[index][1], context],
11199              ['exit', events[index][1], context],
11200              ['exit', strikethrough, context]
11201            ]);
11202            splice(events, open - 1, index - open + 3, nextEvents);
11203            index = open + nextEvents.length - 2;
11204            break
11205          }
11206        }
11207      }
11208    }
11209    index = -1;
11210    while (++index < events.length) {
11211      if (events[index][1].type === 'strikethroughSequenceTemporary') {
11212        events[index][1].type = 'data';
11213      }
11214    }
11215    return events
11216  }
11217  function tokenizeStrikethrough(effects, ok, nok) {
11218    const previous = this.previous;
11219    const events = this.events;
11220    let size = 0;
11221    return start
11222    function start(code) {
11223      if (
11224        previous === 126 &&
11225        events[events.length - 1][1].type !== 'characterEscape'
11226      ) {
11227        return nok(code)
11228      }
11229      effects.enter('strikethroughSequenceTemporary');
11230      return more(code)
11231    }
11232    function more(code) {
11233      const before = classifyCharacter(previous);
11234      if (code === 126) {
11235        if (size > 1) return nok(code)
11236        effects.consume(code);
11237        size++;
11238        return more
11239      }
11240      if (size < 2 && !single) return nok(code)
11241      const token = effects.exit('strikethroughSequenceTemporary');
11242      const after = classifyCharacter(code);
11243      token._open = !after || (after === 2 && Boolean(before));
11244      token._close = !before || (before === 2 && Boolean(after));
11245      return ok(code)
11246    }
11247  }
11248}
11249
11250class EditMap {
11251  constructor() {
11252    this.map = [];
11253  }
11254  add(index, remove, add) {
11255    addImpl(this, index, remove, add);
11256  }
11257  consume(events) {
11258    this.map.sort(function (a, b) {
11259      return a[0] - b[0]
11260    });
11261    if (this.map.length === 0) {
11262      return
11263    }
11264    let index = this.map.length;
11265    const vecs = [];
11266    while (index > 0) {
11267      index -= 1;
11268      vecs.push(
11269        events.slice(this.map[index][0] + this.map[index][1]),
11270        this.map[index][2]
11271      );
11272      events.length = this.map[index][0];
11273    }
11274    vecs.push([...events]);
11275    events.length = 0;
11276    let slice = vecs.pop();
11277    while (slice) {
11278      events.push(...slice);
11279      slice = vecs.pop();
11280    }
11281    this.map.length = 0;
11282  }
11283}
11284function addImpl(editMap, at, remove, add) {
11285  let index = 0;
11286  if (remove === 0 && add.length === 0) {
11287    return
11288  }
11289  while (index < editMap.map.length) {
11290    if (editMap.map[index][0] === at) {
11291      editMap.map[index][1] += remove;
11292      editMap.map[index][2].push(...add);
11293      return
11294    }
11295    index += 1;
11296  }
11297  editMap.map.push([at, remove, add]);
11298}
11299
11300function gfmTableAlign(events, index) {
11301  let inDelimiterRow = false;
11302  const align = [];
11303  while (index < events.length) {
11304    const event = events[index];
11305    if (inDelimiterRow) {
11306      if (event[0] === 'enter') {
11307        if (event[1].type === 'tableContent') {
11308          align.push(
11309            events[index + 1][1].type === 'tableDelimiterMarker'
11310              ? 'left'
11311              : 'none'
11312          );
11313        }
11314      }
11315      else if (event[1].type === 'tableContent') {
11316        if (events[index - 1][1].type === 'tableDelimiterMarker') {
11317          const alignIndex = align.length - 1;
11318          align[alignIndex] = align[alignIndex] === 'left' ? 'center' : 'right';
11319        }
11320      }
11321      else if (event[1].type === 'tableDelimiterRow') {
11322        break
11323      }
11324    } else if (event[0] === 'enter' && event[1].type === 'tableDelimiterRow') {
11325      inDelimiterRow = true;
11326    }
11327    index += 1;
11328  }
11329  return align
11330}
11331
11332function gfmTable() {
11333  return {
11334    flow: {
11335      null: {
11336        tokenize: tokenizeTable,
11337        resolveAll: resolveTable
11338      }
11339    }
11340  }
11341}
11342function tokenizeTable(effects, ok, nok) {
11343  const self = this;
11344  let size = 0;
11345  let sizeB = 0;
11346  let seen;
11347  return start
11348  function start(code) {
11349    let index = self.events.length - 1;
11350    while (index > -1) {
11351      const type = self.events[index][1].type;
11352      if (
11353        type === 'lineEnding' ||
11354        type === 'linePrefix'
11355      )
11356        index--;
11357      else break
11358    }
11359    const tail = index > -1 ? self.events[index][1].type : null;
11360    const next =
11361      tail === 'tableHead' || tail === 'tableRow' ? bodyRowStart : headRowBefore;
11362    if (next === bodyRowStart && self.parser.lazy[self.now().line]) {
11363      return nok(code)
11364    }
11365    return next(code)
11366  }
11367  function headRowBefore(code) {
11368    effects.enter('tableHead');
11369    effects.enter('tableRow');
11370    return headRowStart(code)
11371  }
11372  function headRowStart(code) {
11373    if (code === 124) {
11374      return headRowBreak(code)
11375    }
11376    seen = true;
11377    sizeB += 1;
11378    return headRowBreak(code)
11379  }
11380  function headRowBreak(code) {
11381    if (code === null) {
11382      return nok(code)
11383    }
11384    if (markdownLineEnding(code)) {
11385      if (sizeB > 1) {
11386        sizeB = 0;
11387        self.interrupt = true;
11388        effects.exit('tableRow');
11389        effects.enter('lineEnding');
11390        effects.consume(code);
11391        effects.exit('lineEnding');
11392        return headDelimiterStart
11393      }
11394      return nok(code)
11395    }
11396    if (markdownSpace(code)) {
11397      return factorySpace(effects, headRowBreak, 'whitespace')(code)
11398    }
11399    sizeB += 1;
11400    if (seen) {
11401      seen = false;
11402      size += 1;
11403    }
11404    if (code === 124) {
11405      effects.enter('tableCellDivider');
11406      effects.consume(code);
11407      effects.exit('tableCellDivider');
11408      seen = true;
11409      return headRowBreak
11410    }
11411    effects.enter('data');
11412    return headRowData(code)
11413  }
11414  function headRowData(code) {
11415    if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {
11416      effects.exit('data');
11417      return headRowBreak(code)
11418    }
11419    effects.consume(code);
11420    return code === 92 ? headRowEscape : headRowData
11421  }
11422  function headRowEscape(code) {
11423    if (code === 92 || code === 124) {
11424      effects.consume(code);
11425      return headRowData
11426    }
11427    return headRowData(code)
11428  }
11429  function headDelimiterStart(code) {
11430    self.interrupt = false;
11431    if (self.parser.lazy[self.now().line]) {
11432      return nok(code)
11433    }
11434    effects.enter('tableDelimiterRow');
11435    seen = false;
11436    if (markdownSpace(code)) {
11437      return factorySpace(
11438        effects,
11439        headDelimiterBefore,
11440        'linePrefix',
11441        self.parser.constructs.disable.null.includes('codeIndented')
11442          ? undefined
11443          : 4
11444      )(code)
11445    }
11446    return headDelimiterBefore(code)
11447  }
11448  function headDelimiterBefore(code) {
11449    if (code === 45 || code === 58) {
11450      return headDelimiterValueBefore(code)
11451    }
11452    if (code === 124) {
11453      seen = true;
11454      effects.enter('tableCellDivider');
11455      effects.consume(code);
11456      effects.exit('tableCellDivider');
11457      return headDelimiterCellBefore
11458    }
11459    return headDelimiterNok(code)
11460  }
11461  function headDelimiterCellBefore(code) {
11462    if (markdownSpace(code)) {
11463      return factorySpace(effects, headDelimiterValueBefore, 'whitespace')(code)
11464    }
11465    return headDelimiterValueBefore(code)
11466  }
11467  function headDelimiterValueBefore(code) {
11468    if (code === 58) {
11469      sizeB += 1;
11470      seen = true;
11471      effects.enter('tableDelimiterMarker');
11472      effects.consume(code);
11473      effects.exit('tableDelimiterMarker');
11474      return headDelimiterLeftAlignmentAfter
11475    }
11476    if (code === 45) {
11477      sizeB += 1;
11478      return headDelimiterLeftAlignmentAfter(code)
11479    }
11480    if (code === null || markdownLineEnding(code)) {
11481      return headDelimiterCellAfter(code)
11482    }
11483    return headDelimiterNok(code)
11484  }
11485  function headDelimiterLeftAlignmentAfter(code) {
11486    if (code === 45) {
11487      effects.enter('tableDelimiterFiller');
11488      return headDelimiterFiller(code)
11489    }
11490    return headDelimiterNok(code)
11491  }
11492  function headDelimiterFiller(code) {
11493    if (code === 45) {
11494      effects.consume(code);
11495      return headDelimiterFiller
11496    }
11497    if (code === 58) {
11498      seen = true;
11499      effects.exit('tableDelimiterFiller');
11500      effects.enter('tableDelimiterMarker');
11501      effects.consume(code);
11502      effects.exit('tableDelimiterMarker');
11503      return headDelimiterRightAlignmentAfter
11504    }
11505    effects.exit('tableDelimiterFiller');
11506    return headDelimiterRightAlignmentAfter(code)
11507  }
11508  function headDelimiterRightAlignmentAfter(code) {
11509    if (markdownSpace(code)) {
11510      return factorySpace(effects, headDelimiterCellAfter, 'whitespace')(code)
11511    }
11512    return headDelimiterCellAfter(code)
11513  }
11514  function headDelimiterCellAfter(code) {
11515    if (code === 124) {
11516      return headDelimiterBefore(code)
11517    }
11518    if (code === null || markdownLineEnding(code)) {
11519      if (!seen || size !== sizeB) {
11520        return headDelimiterNok(code)
11521      }
11522      effects.exit('tableDelimiterRow');
11523      effects.exit('tableHead');
11524      return ok(code)
11525    }
11526    return headDelimiterNok(code)
11527  }
11528  function headDelimiterNok(code) {
11529    return nok(code)
11530  }
11531  function bodyRowStart(code) {
11532    effects.enter('tableRow');
11533    return bodyRowBreak(code)
11534  }
11535  function bodyRowBreak(code) {
11536    if (code === 124) {
11537      effects.enter('tableCellDivider');
11538      effects.consume(code);
11539      effects.exit('tableCellDivider');
11540      return bodyRowBreak
11541    }
11542    if (code === null || markdownLineEnding(code)) {
11543      effects.exit('tableRow');
11544      return ok(code)
11545    }
11546    if (markdownSpace(code)) {
11547      return factorySpace(effects, bodyRowBreak, 'whitespace')(code)
11548    }
11549    effects.enter('data');
11550    return bodyRowData(code)
11551  }
11552  function bodyRowData(code) {
11553    if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {
11554      effects.exit('data');
11555      return bodyRowBreak(code)
11556    }
11557    effects.consume(code);
11558    return code === 92 ? bodyRowEscape : bodyRowData
11559  }
11560  function bodyRowEscape(code) {
11561    if (code === 92 || code === 124) {
11562      effects.consume(code);
11563      return bodyRowData
11564    }
11565    return bodyRowData(code)
11566  }
11567}
11568function resolveTable(events, context) {
11569  let index = -1;
11570  let inFirstCellAwaitingPipe = true;
11571  let rowKind = 0;
11572  let lastCell = [0, 0, 0, 0];
11573  let cell = [0, 0, 0, 0];
11574  let afterHeadAwaitingFirstBodyRow = false;
11575  let lastTableEnd = 0;
11576  let currentTable;
11577  let currentBody;
11578  let currentCell;
11579  const map = new EditMap();
11580  while (++index < events.length) {
11581    const event = events[index];
11582    const token = event[1];
11583    if (event[0] === 'enter') {
11584      if (token.type === 'tableHead') {
11585        afterHeadAwaitingFirstBodyRow = false;
11586        if (lastTableEnd !== 0) {
11587          flushTableEnd(map, context, lastTableEnd, currentTable, currentBody);
11588          currentBody = undefined;
11589          lastTableEnd = 0;
11590        }
11591        currentTable = {
11592          type: 'table',
11593          start: Object.assign({}, token.start),
11594          end: Object.assign({}, token.end)
11595        };
11596        map.add(index, 0, [['enter', currentTable, context]]);
11597      } else if (
11598        token.type === 'tableRow' ||
11599        token.type === 'tableDelimiterRow'
11600      ) {
11601        inFirstCellAwaitingPipe = true;
11602        currentCell = undefined;
11603        lastCell = [0, 0, 0, 0];
11604        cell = [0, index + 1, 0, 0];
11605        if (afterHeadAwaitingFirstBodyRow) {
11606          afterHeadAwaitingFirstBodyRow = false;
11607          currentBody = {
11608            type: 'tableBody',
11609            start: Object.assign({}, token.start),
11610            end: Object.assign({}, token.end)
11611          };
11612          map.add(index, 0, [['enter', currentBody, context]]);
11613        }
11614        rowKind = token.type === 'tableDelimiterRow' ? 2 : currentBody ? 3 : 1;
11615      }
11616      else if (
11617        rowKind &&
11618        (token.type === 'data' ||
11619          token.type === 'tableDelimiterMarker' ||
11620          token.type === 'tableDelimiterFiller')
11621      ) {
11622        inFirstCellAwaitingPipe = false;
11623        if (cell[2] === 0) {
11624          if (lastCell[1] !== 0) {
11625            cell[0] = cell[1];
11626            currentCell = flushCell(
11627              map,
11628              context,
11629              lastCell,
11630              rowKind,
11631              undefined,
11632              currentCell
11633            );
11634            lastCell = [0, 0, 0, 0];
11635          }
11636          cell[2] = index;
11637        }
11638      } else if (token.type === 'tableCellDivider') {
11639        if (inFirstCellAwaitingPipe) {
11640          inFirstCellAwaitingPipe = false;
11641        } else {
11642          if (lastCell[1] !== 0) {
11643            cell[0] = cell[1];
11644            currentCell = flushCell(
11645              map,
11646              context,
11647              lastCell,
11648              rowKind,
11649              undefined,
11650              currentCell
11651            );
11652          }
11653          lastCell = cell;
11654          cell = [lastCell[1], index, 0, 0];
11655        }
11656      }
11657    }
11658    else if (token.type === 'tableHead') {
11659      afterHeadAwaitingFirstBodyRow = true;
11660      lastTableEnd = index;
11661    } else if (
11662      token.type === 'tableRow' ||
11663      token.type === 'tableDelimiterRow'
11664    ) {
11665      lastTableEnd = index;
11666      if (lastCell[1] !== 0) {
11667        cell[0] = cell[1];
11668        currentCell = flushCell(
11669          map,
11670          context,
11671          lastCell,
11672          rowKind,
11673          index,
11674          currentCell
11675        );
11676      } else if (cell[1] !== 0) {
11677        currentCell = flushCell(map, context, cell, rowKind, index, currentCell);
11678      }
11679      rowKind = 0;
11680    } else if (
11681      rowKind &&
11682      (token.type === 'data' ||
11683        token.type === 'tableDelimiterMarker' ||
11684        token.type === 'tableDelimiterFiller')
11685    ) {
11686      cell[3] = index;
11687    }
11688  }
11689  if (lastTableEnd !== 0) {
11690    flushTableEnd(map, context, lastTableEnd, currentTable, currentBody);
11691  }
11692  map.consume(context.events);
11693  index = -1;
11694  while (++index < context.events.length) {
11695    const event = context.events[index];
11696    if (event[0] === 'enter' && event[1].type === 'table') {
11697      event[1]._align = gfmTableAlign(context.events, index);
11698    }
11699  }
11700  return events
11701}
11702function flushCell(map, context, range, rowKind, rowEnd, previousCell) {
11703  const groupName =
11704    rowKind === 1
11705      ? 'tableHeader'
11706      : rowKind === 2
11707      ? 'tableDelimiter'
11708      : 'tableData';
11709  const valueName = 'tableContent';
11710  if (range[0] !== 0) {
11711    previousCell.end = Object.assign({}, getPoint(context.events, range[0]));
11712    map.add(range[0], 0, [['exit', previousCell, context]]);
11713  }
11714  const now = getPoint(context.events, range[1]);
11715  previousCell = {
11716    type: groupName,
11717    start: Object.assign({}, now),
11718    end: Object.assign({}, now)
11719  };
11720  map.add(range[1], 0, [['enter', previousCell, context]]);
11721  if (range[2] !== 0) {
11722    const relatedStart = getPoint(context.events, range[2]);
11723    const relatedEnd = getPoint(context.events, range[3]);
11724    const valueToken = {
11725      type: valueName,
11726      start: Object.assign({}, relatedStart),
11727      end: Object.assign({}, relatedEnd)
11728    };
11729    map.add(range[2], 0, [['enter', valueToken, context]]);
11730    if (rowKind !== 2) {
11731      const start = context.events[range[2]];
11732      const end = context.events[range[3]];
11733      start[1].end = Object.assign({}, end[1].end);
11734      start[1].type = 'chunkText';
11735      start[1].contentType = 'text';
11736      if (range[3] > range[2] + 1) {
11737        const a = range[2] + 1;
11738        const b = range[3] - range[2] - 1;
11739        map.add(a, b, []);
11740      }
11741    }
11742    map.add(range[3] + 1, 0, [['exit', valueToken, context]]);
11743  }
11744  if (rowEnd !== undefined) {
11745    previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));
11746    map.add(rowEnd, 0, [['exit', previousCell, context]]);
11747    previousCell = undefined;
11748  }
11749  return previousCell
11750}
11751function flushTableEnd(map, context, index, table, tableBody) {
11752  const exits = [];
11753  const related = getPoint(context.events, index);
11754  if (tableBody) {
11755    tableBody.end = Object.assign({}, related);
11756    exits.push(['exit', tableBody, context]);
11757  }
11758  table.end = Object.assign({}, related);
11759  exits.push(['exit', table, context]);
11760  map.add(index + 1, 0, exits);
11761}
11762function getPoint(events, index) {
11763  const event = events[index];
11764  const side = event[0] === 'enter' ? 'start' : 'end';
11765  return event[1][side]
11766}
11767
11768const tasklistCheck = {
11769  tokenize: tokenizeTasklistCheck
11770};
11771function gfmTaskListItem() {
11772  return {
11773    text: {
11774      [91]: tasklistCheck
11775    }
11776  }
11777}
11778function tokenizeTasklistCheck(effects, ok, nok) {
11779  const self = this;
11780  return open
11781  function open(code) {
11782    if (
11783      self.previous !== null ||
11784      !self._gfmTasklistFirstContentOfListItem
11785    ) {
11786      return nok(code)
11787    }
11788    effects.enter('taskListCheck');
11789    effects.enter('taskListCheckMarker');
11790    effects.consume(code);
11791    effects.exit('taskListCheckMarker');
11792    return inside
11793  }
11794  function inside(code) {
11795    if (markdownLineEndingOrSpace(code)) {
11796      effects.enter('taskListCheckValueUnchecked');
11797      effects.consume(code);
11798      effects.exit('taskListCheckValueUnchecked');
11799      return close
11800    }
11801    if (code === 88 || code === 120) {
11802      effects.enter('taskListCheckValueChecked');
11803      effects.consume(code);
11804      effects.exit('taskListCheckValueChecked');
11805      return close
11806    }
11807    return nok(code)
11808  }
11809  function close(code) {
11810    if (code === 93) {
11811      effects.enter('taskListCheckMarker');
11812      effects.consume(code);
11813      effects.exit('taskListCheckMarker');
11814      effects.exit('taskListCheck');
11815      return after
11816    }
11817    return nok(code)
11818  }
11819  function after(code) {
11820    if (markdownLineEnding(code)) {
11821      return ok(code)
11822    }
11823    if (markdownSpace(code)) {
11824      return effects.check(
11825        {
11826          tokenize: spaceThenNonSpace
11827        },
11828        ok,
11829        nok
11830      )(code)
11831    }
11832    return nok(code)
11833  }
11834}
11835function spaceThenNonSpace(effects, ok, nok) {
11836  return factorySpace(effects, after, 'whitespace')
11837  function after(code) {
11838    return code === null ? nok(code) : ok(code)
11839  }
11840}
11841
11842function gfm(options) {
11843  return combineExtensions([
11844    gfmAutolinkLiteral(),
11845    gfmFootnote(),
11846    gfmStrikethrough(options),
11847    gfmTable(),
11848    gfmTaskListItem()
11849  ])
11850}
11851
11852const emptyOptions$2 = {};
11853function remarkGfm(options) {
11854  const self =  (this);
11855  const settings = options || emptyOptions$2;
11856  const data = self.data();
11857  const micromarkExtensions =
11858    data.micromarkExtensions || (data.micromarkExtensions = []);
11859  const fromMarkdownExtensions =
11860    data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
11861  const toMarkdownExtensions =
11862    data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
11863  micromarkExtensions.push(gfm(settings));
11864  fromMarkdownExtensions.push(gfmFromMarkdown());
11865  toMarkdownExtensions.push(gfmToMarkdown(settings));
11866}
11867
11868function location(file) {
11869  const value = String(file);
11870  const indices = [];
11871  const search = /\r?\n|\r/g;
11872  while (search.test(value)) {
11873    indices.push(search.lastIndex);
11874  }
11875  indices.push(value.length + 1);
11876  return {toPoint, toOffset}
11877  function toPoint(offset) {
11878    let index = -1;
11879    if (
11880      typeof offset === 'number' &&
11881      offset > -1 &&
11882      offset < indices[indices.length - 1]
11883    ) {
11884      while (++index < indices.length) {
11885        if (indices[index] > offset) {
11886          return {
11887            line: index + 1,
11888            column: offset - (index > 0 ? indices[index - 1] : 0) + 1,
11889            offset
11890          }
11891        }
11892      }
11893    }
11894    return {line: undefined, column: undefined, offset: undefined}
11895  }
11896  function toOffset(point) {
11897    const line = point && point.line;
11898    const column = point && point.column;
11899    if (
11900      typeof line === 'number' &&
11901      typeof column === 'number' &&
11902      !Number.isNaN(line) &&
11903      !Number.isNaN(column) &&
11904      line - 1 in indices
11905    ) {
11906      const offset = (indices[line - 2] || 0) + column - 1 || 0;
11907      if (offset > -1 && offset < indices[indices.length - 1]) {
11908        return offset
11909      }
11910    }
11911    return -1
11912  }
11913}
11914
11915const convert$z =
11916  (
11917    function (test) {
11918      if (test === undefined || test === null) {
11919        return ok$z
11920      }
11921      if (typeof test === 'string') {
11922        return typeFactory$z(test)
11923      }
11924      if (typeof test === 'object') {
11925        return Array.isArray(test) ? anyFactory$z(test) : propsFactory$z(test)
11926      }
11927      if (typeof test === 'function') {
11928        return castFactory$z(test)
11929      }
11930      throw new Error('Expected function, string, or object as test')
11931    }
11932  );
11933function anyFactory$z(tests) {
11934  const checks = [];
11935  let index = -1;
11936  while (++index < tests.length) {
11937    checks[index] = convert$z(tests[index]);
11938  }
11939  return castFactory$z(any)
11940  function any(...parameters) {
11941    let index = -1;
11942    while (++index < checks.length) {
11943      if (checks[index].call(this, ...parameters)) return true
11944    }
11945    return false
11946  }
11947}
11948function propsFactory$z(check) {
11949  return castFactory$z(all)
11950  function all(node) {
11951    let key;
11952    for (key in check) {
11953      if (node[key] !== check[key]) return false
11954    }
11955    return true
11956  }
11957}
11958function typeFactory$z(check) {
11959  return castFactory$z(type)
11960  function type(node) {
11961    return node && node.type === check
11962  }
11963}
11964function castFactory$z(check) {
11965  return assertion
11966  function assertion(node, ...parameters) {
11967    return Boolean(
11968      node &&
11969        typeof node === 'object' &&
11970        'type' in node &&
11971        Boolean(check.call(this, node, ...parameters))
11972    )
11973  }
11974}
11975function ok$z() {
11976  return true
11977}
11978
11979function color$A(d) {
11980  return '\u001B[33m' + d + '\u001B[39m'
11981}
11982
11983const CONTINUE$z = true;
11984const SKIP$z = 'skip';
11985const EXIT$z = false;
11986const visitParents$z =
11987  (
11988    function (tree, test, visitor, reverse) {
11989      if (typeof test === 'function' && typeof visitor !== 'function') {
11990        reverse = visitor;
11991        visitor = test;
11992        test = null;
11993      }
11994      var is = convert$z(test);
11995      var step = reverse ? -1 : 1;
11996      factory(tree, null, [])();
11997      function factory(node, index, parents) {
11998        var value = typeof node === 'object' && node !== null ? node : {};
11999        var name;
12000        if (typeof value.type === 'string') {
12001          name =
12002            typeof value.tagName === 'string'
12003              ? value.tagName
12004              : typeof value.name === 'string'
12005              ? value.name
12006              : undefined;
12007          Object.defineProperty(visit, 'name', {
12008            value:
12009              'node (' +
12010              color$A(value.type + (name ? '<' + name + '>' : '')) +
12011              ')'
12012          });
12013        }
12014        return visit
12015        function visit() {
12016          var result = [];
12017          var subresult;
12018          var offset;
12019          var grandparents;
12020          if (!test || is(node, index, parents[parents.length - 1] || null)) {
12021            result = toResult$z(visitor(node, parents));
12022            if (result[0] === EXIT$z) {
12023              return result
12024            }
12025          }
12026          if (node.children && result[0] !== SKIP$z) {
12027            offset = (reverse ? node.children.length : -1) + step;
12028            grandparents = parents.concat(node);
12029            while (offset > -1 && offset < node.children.length) {
12030              subresult = factory(node.children[offset], offset, grandparents)();
12031              if (subresult[0] === EXIT$z) {
12032                return subresult
12033              }
12034              offset =
12035                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
12036            }
12037          }
12038          return result
12039        }
12040      }
12041    }
12042  );
12043function toResult$z(value) {
12044  if (Array.isArray(value)) {
12045    return value
12046  }
12047  if (typeof value === 'number') {
12048    return [CONTINUE$z, value]
12049  }
12050  return [value]
12051}
12052
12053const visit$z =
12054  (
12055    function (tree, test, visitor, reverse) {
12056      if (typeof test === 'function' && typeof visitor !== 'function') {
12057        reverse = visitor;
12058        visitor = test;
12059        test = null;
12060      }
12061      visitParents$z(tree, test, overload, reverse);
12062      function overload(node, parents) {
12063        var parent = parents[parents.length - 1];
12064        return visitor(
12065          node,
12066          parent ? parent.children.indexOf(node) : null,
12067          parent
12068        )
12069      }
12070    }
12071  );
12072
12073const own$1 = {}.hasOwnProperty;
12074function messageControl(options) {
12075  if (!options || typeof options !== 'object' || !options.name) {
12076    throw new Error(
12077      'Expected `name` in `options`, got `' + (options || {}).name + '`'
12078    )
12079  }
12080  if (!options.marker) {
12081    throw new Error(
12082      'Expected `marker` in `options`, got `' + options.marker + '`'
12083    )
12084  }
12085  const enable = 'enable' in options && options.enable ? options.enable : [];
12086  const disable = 'disable' in options && options.disable ? options.disable : [];
12087  let reset = options.reset;
12088  const sources =
12089    typeof options.source === 'string'
12090      ? [options.source]
12091      : options.source || [options.name];
12092  return transformer
12093  function transformer(tree, file) {
12094    const toOffset = location(file).toOffset;
12095    const initial = !reset;
12096    const gaps = detectGaps(tree, file);
12097    const scope = {};
12098    const globals = [];
12099    visit$z(tree, options.test, visitor);
12100    file.messages = file.messages.filter((m) => filter(m));
12101    function visitor(node, position, parent) {
12102      const mark = options.marker(node);
12103      if (!mark || mark.name !== options.name) {
12104        return
12105      }
12106      const ruleIds = mark.attributes.split(/\s/g);
12107      const point = mark.node.position && mark.node.position.start;
12108      const next =
12109        (parent && position !== null && parent.children[position + 1]) ||
12110        undefined;
12111      const tail = (next && next.position && next.position.end) || undefined;
12112      let index = -1;
12113      const verb = ruleIds.shift();
12114      if (verb !== 'enable' && verb !== 'disable' && verb !== 'ignore') {
12115        file.fail(
12116          'Unknown keyword `' +
12117            verb +
12118            '`: expected ' +
12119            "`'enable'`, `'disable'`, or `'ignore'`",
12120          mark.node
12121        );
12122      }
12123      if (ruleIds.length > 0) {
12124        while (++index < ruleIds.length) {
12125          const ruleId = ruleIds[index];
12126          if (isKnown(ruleId, verb, mark.node)) {
12127            toggle(point, verb === 'enable', ruleId);
12128            if (verb === 'ignore') {
12129              toggle(tail, true, ruleId);
12130            }
12131          }
12132        }
12133      } else if (verb === 'ignore') {
12134        toggle(point, false);
12135        toggle(tail, true);
12136      } else {
12137        toggle(point, verb === 'enable');
12138        reset = verb !== 'enable';
12139      }
12140    }
12141    function filter(message) {
12142      let gapIndex = gaps.length;
12143      if (!message.source || !sources.includes(message.source)) {
12144        return true
12145      }
12146      if (!message.line) {
12147        message.line = 1;
12148      }
12149      if (!message.column) {
12150        message.column = 1;
12151      }
12152      const offset = toOffset(message);
12153      while (gapIndex--) {
12154        if (gaps[gapIndex][0] <= offset && gaps[gapIndex][1] > offset) {
12155          return false
12156        }
12157      }
12158      return (
12159        (!message.ruleId ||
12160          check(message, scope[message.ruleId], message.ruleId)) &&
12161        check(message, globals)
12162      )
12163    }
12164    function isKnown(ruleId, verb, node) {
12165      const result = options.known ? options.known.includes(ruleId) : true;
12166      if (!result) {
12167        file.message(
12168          'Unknown rule: cannot ' + verb + " `'" + ruleId + "'`",
12169          node
12170        );
12171      }
12172      return result
12173    }
12174    function getState(ruleId) {
12175      const ranges = ruleId ? scope[ruleId] : globals;
12176      if (ranges && ranges.length > 0) {
12177        return ranges[ranges.length - 1].state
12178      }
12179      if (!ruleId) {
12180        return !reset
12181      }
12182      return reset ? enable.includes(ruleId) : !disable.includes(ruleId)
12183    }
12184    function toggle(point, state, ruleId) {
12185      let markers = ruleId ? scope[ruleId] : globals;
12186      if (!markers) {
12187        markers = [];
12188        scope[String(ruleId)] = markers;
12189      }
12190      const previousState = getState(ruleId);
12191      if (state !== previousState) {
12192        markers.push({state, point});
12193      }
12194      if (!ruleId) {
12195        for (ruleId in scope) {
12196          if (own$1.call(scope, ruleId)) {
12197            toggle(point, state, ruleId);
12198          }
12199        }
12200      }
12201    }
12202    function check(message, ranges, ruleId) {
12203      if (ranges && ranges.length > 0) {
12204        let index = ranges.length;
12205        while (index--) {
12206          const range = ranges[index];
12207          if (
12208            message.line &&
12209            message.column &&
12210            range.point &&
12211            range.point.line &&
12212            range.point.column &&
12213            (range.point.line < message.line ||
12214              (range.point.line === message.line &&
12215                range.point.column <= message.column))
12216          ) {
12217            return range.state === true
12218          }
12219        }
12220      }
12221      if (!ruleId) {
12222        return Boolean(initial || reset)
12223      }
12224      return reset ? enable.includes(ruleId) : !disable.includes(ruleId)
12225    }
12226  }
12227}
12228function detectGaps(tree, file) {
12229  const children = tree.children || [];
12230  const lastNode = children[children.length - 1];
12231  const gaps = [];
12232  let offset = 0;
12233  let gap;
12234  visit$z(tree, one);
12235  if (
12236    lastNode &&
12237    lastNode.position &&
12238    lastNode.position.end &&
12239    offset === lastNode.position.end.offset &&
12240    file.toString().slice(offset).trim() !== ''
12241  ) {
12242    update();
12243    update(
12244      tree &&
12245        tree.position &&
12246        tree.position.end &&
12247        tree.position.end.offset &&
12248        tree.position.end.offset - 1
12249    );
12250  }
12251  return gaps
12252  function one(node) {
12253    update(node.position && node.position.start && node.position.start.offset);
12254    if (!('children' in node)) {
12255      update(node.position && node.position.end && node.position.end.offset);
12256    }
12257  }
12258  function update(latest) {
12259    if (latest === null || latest === undefined) {
12260      gap = true;
12261    } else if (offset < latest) {
12262      if (gap) {
12263        gaps.push([offset, latest]);
12264        gap = undefined;
12265      }
12266      offset = latest;
12267    }
12268  }
12269}
12270
12271const commentExpression = /\s*([a-zA-Z\d-]+)(\s+([\s\S]*))?\s*/;
12272const esCommentExpression = new RegExp(
12273  '(\\s*\\/\\*' + commentExpression.source + '\\*\\/\\s*)'
12274);
12275const markerExpression = new RegExp(
12276  '(\\s*<!--' + commentExpression.source + '-->\\s*)'
12277);
12278function commentMarker(value) {
12279  if (
12280    isNode(value) &&
12281    (value.type === 'html' ||
12282      value.type === 'comment' ||
12283      value.type === 'mdxFlowExpression' ||
12284      value.type === 'mdxTextExpression')
12285  ) {
12286    let offset = 2;
12287    let match;
12288    if (value.type === 'comment') {
12289      match = value.value.match(commentExpression);
12290      offset = 1;
12291    } else if (value.type === 'html') {
12292      match = value.value.match(markerExpression);
12293    } else if (
12294      value.type === 'mdxFlowExpression' ||
12295      value.type === 'mdxTextExpression'
12296    ) {
12297      match = value.value.match(esCommentExpression);
12298    }
12299    if (match && match[0].length === value.value.length) {
12300      const parameters = parseParameters(match[offset + 1] || '');
12301      if (parameters) {
12302        return {
12303          name: match[offset],
12304          attributes: (match[offset + 2] || '').trim(),
12305          parameters,
12306          node: value
12307        }
12308      }
12309    }
12310  }
12311  return null
12312}
12313function parseParameters(value) {
12314  const parameters = {};
12315  return value
12316    .replace(
12317      /\s+([-\w]+)(?:=(?:"((?:\\[\s\S]|[^"])*)"|'((?:\\[\s\S]|[^'])*)'|((?:\\[\s\S]|[^"'\s])+)))?/gi,
12318      replacer
12319    )
12320    .replace(/\s+/g, '')
12321    ? null
12322    : parameters
12323  function replacer(_, $1, $2, $3, $4) {
12324    let value = $2 === undefined ? ($3 === undefined ? $4 : $3) : $2;
12325    const number = Number(value);
12326    if (value === 'true' || value === undefined) {
12327      value = true;
12328    } else if (value === 'false') {
12329      value = false;
12330    } else if (value.trim() && !Number.isNaN(number)) {
12331      value = number;
12332    }
12333    parameters[$1] = value;
12334    return ''
12335  }
12336}
12337function isNode(value) {
12338  return Boolean(value && typeof value === 'object' && 'type' in value)
12339}
12340
12341const test = [
12342  'html',
12343  'comment',
12344  'mdxFlowExpression',
12345  'mdxTextExpression'
12346];
12347function remarkMessageControl(options) {
12348  return messageControl(
12349    Object.assign({marker: commentMarker, test}, options)
12350  )
12351}
12352
12353function remarkLint() {
12354  this.use(lintMessageControl);
12355}
12356function lintMessageControl() {
12357  return remarkMessageControl({name: 'lint', source: 'remark-lint'})
12358}
12359
12360function lintRule(meta, rule) {
12361  const id = typeof meta === 'string' ? meta : meta.origin;
12362  const url = typeof meta === 'string' ? undefined : meta.url;
12363  const parts = id.split(':');
12364  const source = parts[1] ? parts[0] : undefined;
12365  const ruleId = parts[1];
12366  Object.defineProperty(plugin, 'name', {value: id});
12367  return plugin
12368  function plugin(config) {
12369    const [severity, options] = coerce$1(ruleId, config);
12370    if (!severity) return
12371    const fatal = severity === 2;
12372    return (tree, file, next) => {
12373      let index = file.messages.length - 1;
12374      wrap(rule, (error) => {
12375        const messages = file.messages;
12376        if (error && !messages.includes(error)) {
12377          try {
12378            file.fail(error);
12379          } catch {}
12380        }
12381        while (++index < messages.length) {
12382          Object.assign(messages[index], {ruleId, source, fatal, url});
12383        }
12384        next();
12385      })(tree, file, options);
12386    }
12387  }
12388}
12389function coerce$1(name, config) {
12390  if (!Array.isArray(config)) return [1, config]
12391  const [severity, ...options] = config;
12392  switch (severity) {
12393    case false:
12394    case 'off':
12395    case 0: {
12396      return [0, ...options]
12397    }
12398    case true:
12399    case 'on':
12400    case 'warn':
12401    case 1: {
12402      return [1, ...options]
12403    }
12404    case 'error':
12405    case 2: {
12406      return [2, ...options]
12407    }
12408    default: {
12409      if (typeof severity !== 'number') return [1, config]
12410      throw new Error(
12411        'Incorrect severity `' +
12412          severity +
12413          '` for `' +
12414          name +
12415          '`, ' +
12416          'expected 0, 1, or 2'
12417      )
12418    }
12419  }
12420}
12421
12422/**
12423 * ## When should I use this?
12424 *
12425 * You can use this package to check that fenced code markers are consistent.
12426 *
12427 * ## API
12428 *
12429 * There are no options.
12430 *
12431 * ## Recommendation
12432 *
12433 * Turn this rule on.
12434 * See [StackExchange](https://unix.stackexchange.com/questions/18743) for more
12435 * info.
12436 *
12437 * ## Fix
12438 *
12439 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
12440 * always adds final line endings.
12441 *
12442 * ## Example
12443 *
12444 * ##### `ok.md`
12445 *
12446 * ###### In
12447 *
12448 * > � **Note**: `␊` represents a line feed (`\n`).
12449 *
12450 * ```markdown
12451 * Alpha␊
12452 * ```
12453 *
12454 * ###### Out
12455 *
12456 * No messages.
12457 *
12458 * ##### `not-ok.md`
12459 *
12460 * ###### In
12461 *
12462 * > � **Note**: `␀` represents the end of the file.
12463 *
12464 * ```markdown
12465 * Bravo␀
12466 * ```
12467 *
12468 * ###### Out
12469 *
12470 * ```text
12471 * 1:1: Missing newline character at end of file
12472 * ```
12473 *
12474 * @module final-newline
12475 * @summary
12476 *   remark-lint rule to warn when files don’t end in a newline.
12477 * @author Titus Wormer
12478 * @copyright 2015 Titus Wormer
12479 * @license MIT
12480 */
12481const remarkLintFinalNewline = lintRule(
12482  {
12483    origin: 'remark-lint:final-newline',
12484    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-final-newline#readme'
12485  },
12486  (_, file) => {
12487    const value = String(file);
12488    const last = value.length - 1;
12489    if (last > -1 && value.charAt(last) !== '\n') {
12490      file.message('Missing newline character at end of file');
12491    }
12492  }
12493);
12494var remarkLintFinalNewline$1 = remarkLintFinalNewline;
12495
12496function commonjsRequire(path) {
12497	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.');
12498}
12499
12500var pluralize = {exports: {}};
12501
12502(function (module, exports) {
12503	(function (root, pluralize) {
12504	  if (typeof commonjsRequire === 'function' && 'object' === 'object' && 'object' === 'object') {
12505	    module.exports = pluralize();
12506	  } else {
12507	    root.pluralize = pluralize();
12508	  }
12509	})(commonjsGlobal, function () {
12510	  var pluralRules = [];
12511	  var singularRules = [];
12512	  var uncountables = {};
12513	  var irregularPlurals = {};
12514	  var irregularSingles = {};
12515	  function sanitizeRule (rule) {
12516	    if (typeof rule === 'string') {
12517	      return new RegExp('^' + rule + '$', 'i');
12518	    }
12519	    return rule;
12520	  }
12521	  function restoreCase (word, token) {
12522	    if (word === token) return token;
12523	    if (word === word.toLowerCase()) return token.toLowerCase();
12524	    if (word === word.toUpperCase()) return token.toUpperCase();
12525	    if (word[0] === word[0].toUpperCase()) {
12526	      return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
12527	    }
12528	    return token.toLowerCase();
12529	  }
12530	  function interpolate (str, args) {
12531	    return str.replace(/\$(\d{1,2})/g, function (match, index) {
12532	      return args[index] || '';
12533	    });
12534	  }
12535	  function replace (word, rule) {
12536	    return word.replace(rule[0], function (match, index) {
12537	      var result = interpolate(rule[1], arguments);
12538	      if (match === '') {
12539	        return restoreCase(word[index - 1], result);
12540	      }
12541	      return restoreCase(match, result);
12542	    });
12543	  }
12544	  function sanitizeWord (token, word, rules) {
12545	    if (!token.length || uncountables.hasOwnProperty(token)) {
12546	      return word;
12547	    }
12548	    var len = rules.length;
12549	    while (len--) {
12550	      var rule = rules[len];
12551	      if (rule[0].test(word)) return replace(word, rule);
12552	    }
12553	    return word;
12554	  }
12555	  function replaceWord (replaceMap, keepMap, rules) {
12556	    return function (word) {
12557	      var token = word.toLowerCase();
12558	      if (keepMap.hasOwnProperty(token)) {
12559	        return restoreCase(word, token);
12560	      }
12561	      if (replaceMap.hasOwnProperty(token)) {
12562	        return restoreCase(word, replaceMap[token]);
12563	      }
12564	      return sanitizeWord(token, word, rules);
12565	    };
12566	  }
12567	  function checkWord (replaceMap, keepMap, rules, bool) {
12568	    return function (word) {
12569	      var token = word.toLowerCase();
12570	      if (keepMap.hasOwnProperty(token)) return true;
12571	      if (replaceMap.hasOwnProperty(token)) return false;
12572	      return sanitizeWord(token, token, rules) === token;
12573	    };
12574	  }
12575	  function pluralize (word, count, inclusive) {
12576	    var pluralized = count === 1
12577	      ? pluralize.singular(word) : pluralize.plural(word);
12578	    return (inclusive ? count + ' ' : '') + pluralized;
12579	  }
12580	  pluralize.plural = replaceWord(
12581	    irregularSingles, irregularPlurals, pluralRules
12582	  );
12583	  pluralize.isPlural = checkWord(
12584	    irregularSingles, irregularPlurals, pluralRules
12585	  );
12586	  pluralize.singular = replaceWord(
12587	    irregularPlurals, irregularSingles, singularRules
12588	  );
12589	  pluralize.isSingular = checkWord(
12590	    irregularPlurals, irregularSingles, singularRules
12591	  );
12592	  pluralize.addPluralRule = function (rule, replacement) {
12593	    pluralRules.push([sanitizeRule(rule), replacement]);
12594	  };
12595	  pluralize.addSingularRule = function (rule, replacement) {
12596	    singularRules.push([sanitizeRule(rule), replacement]);
12597	  };
12598	  pluralize.addUncountableRule = function (word) {
12599	    if (typeof word === 'string') {
12600	      uncountables[word.toLowerCase()] = true;
12601	      return;
12602	    }
12603	    pluralize.addPluralRule(word, '$0');
12604	    pluralize.addSingularRule(word, '$0');
12605	  };
12606	  pluralize.addIrregularRule = function (single, plural) {
12607	    plural = plural.toLowerCase();
12608	    single = single.toLowerCase();
12609	    irregularSingles[single] = plural;
12610	    irregularPlurals[plural] = single;
12611	  };
12612	  [
12613	    ['I', 'we'],
12614	    ['me', 'us'],
12615	    ['he', 'they'],
12616	    ['she', 'they'],
12617	    ['them', 'them'],
12618	    ['myself', 'ourselves'],
12619	    ['yourself', 'yourselves'],
12620	    ['itself', 'themselves'],
12621	    ['herself', 'themselves'],
12622	    ['himself', 'themselves'],
12623	    ['themself', 'themselves'],
12624	    ['is', 'are'],
12625	    ['was', 'were'],
12626	    ['has', 'have'],
12627	    ['this', 'these'],
12628	    ['that', 'those'],
12629	    ['echo', 'echoes'],
12630	    ['dingo', 'dingoes'],
12631	    ['volcano', 'volcanoes'],
12632	    ['tornado', 'tornadoes'],
12633	    ['torpedo', 'torpedoes'],
12634	    ['genus', 'genera'],
12635	    ['viscus', 'viscera'],
12636	    ['stigma', 'stigmata'],
12637	    ['stoma', 'stomata'],
12638	    ['dogma', 'dogmata'],
12639	    ['lemma', 'lemmata'],
12640	    ['schema', 'schemata'],
12641	    ['anathema', 'anathemata'],
12642	    ['ox', 'oxen'],
12643	    ['axe', 'axes'],
12644	    ['die', 'dice'],
12645	    ['yes', 'yeses'],
12646	    ['foot', 'feet'],
12647	    ['eave', 'eaves'],
12648	    ['goose', 'geese'],
12649	    ['tooth', 'teeth'],
12650	    ['quiz', 'quizzes'],
12651	    ['human', 'humans'],
12652	    ['proof', 'proofs'],
12653	    ['carve', 'carves'],
12654	    ['valve', 'valves'],
12655	    ['looey', 'looies'],
12656	    ['thief', 'thieves'],
12657	    ['groove', 'grooves'],
12658	    ['pickaxe', 'pickaxes'],
12659	    ['passerby', 'passersby']
12660	  ].forEach(function (rule) {
12661	    return pluralize.addIrregularRule(rule[0], rule[1]);
12662	  });
12663	  [
12664	    [/s?$/i, 's'],
12665	    [/[^\u0000-\u007F]$/i, '$0'],
12666	    [/([^aeiou]ese)$/i, '$1'],
12667	    [/(ax|test)is$/i, '$1es'],
12668	    [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'],
12669	    [/(e[mn]u)s?$/i, '$1s'],
12670	    [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'],
12671	    [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1i'],
12672	    [/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'],
12673	    [/(seraph|cherub)(?:im)?$/i, '$1im'],
12674	    [/(her|at|gr)o$/i, '$1oes'],
12675	    [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, '$1a'],
12676	    [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, '$1a'],
12677	    [/sis$/i, 'ses'],
12678	    [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'],
12679	    [/([^aeiouy]|qu)y$/i, '$1ies'],
12680	    [/([^ch][ieo][ln])ey$/i, '$1ies'],
12681	    [/(x|ch|ss|sh|zz)$/i, '$1es'],
12682	    [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'],
12683	    [/\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'],
12684	    [/(pe)(?:rson|ople)$/i, '$1ople'],
12685	    [/(child)(?:ren)?$/i, '$1ren'],
12686	    [/eaux$/i, '$0'],
12687	    [/m[ae]n$/i, 'men'],
12688	    ['thou', 'you']
12689	  ].forEach(function (rule) {
12690	    return pluralize.addPluralRule(rule[0], rule[1]);
12691	  });
12692	  [
12693	    [/s$/i, ''],
12694	    [/(ss)$/i, '$1'],
12695	    [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, '$1fe'],
12696	    [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'],
12697	    [/ies$/i, 'y'],
12698	    [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'],
12699	    [/\b(mon|smil)ies$/i, '$1ey'],
12700	    [/\b((?:tit)?m|l)ice$/i, '$1ouse'],
12701	    [/(seraph|cherub)im$/i, '$1'],
12702	    [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, '$1'],
12703	    [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, '$1sis'],
12704	    [/(movie|twelve|abuse|e[mn]u)s$/i, '$1'],
12705	    [/(test)(?:is|es)$/i, '$1is'],
12706	    [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1us'],
12707	    [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, '$1um'],
12708	    [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, '$1on'],
12709	    [/(alumn|alg|vertebr)ae$/i, '$1a'],
12710	    [/(cod|mur|sil|vert|ind)ices$/i, '$1ex'],
12711	    [/(matr|append)ices$/i, '$1ix'],
12712	    [/(pe)(rson|ople)$/i, '$1rson'],
12713	    [/(child)ren$/i, '$1'],
12714	    [/(eau)x?$/i, '$1'],
12715	    [/men$/i, 'man']
12716	  ].forEach(function (rule) {
12717	    return pluralize.addSingularRule(rule[0], rule[1]);
12718	  });
12719	  [
12720	    'adulthood',
12721	    'advice',
12722	    'agenda',
12723	    'aid',
12724	    'aircraft',
12725	    'alcohol',
12726	    'ammo',
12727	    'analytics',
12728	    'anime',
12729	    'athletics',
12730	    'audio',
12731	    'bison',
12732	    'blood',
12733	    'bream',
12734	    'buffalo',
12735	    'butter',
12736	    'carp',
12737	    'cash',
12738	    'chassis',
12739	    'chess',
12740	    'clothing',
12741	    'cod',
12742	    'commerce',
12743	    'cooperation',
12744	    'corps',
12745	    'debris',
12746	    'diabetes',
12747	    'digestion',
12748	    'elk',
12749	    'energy',
12750	    'equipment',
12751	    'excretion',
12752	    'expertise',
12753	    'firmware',
12754	    'flounder',
12755	    'fun',
12756	    'gallows',
12757	    'garbage',
12758	    'graffiti',
12759	    'hardware',
12760	    'headquarters',
12761	    'health',
12762	    'herpes',
12763	    'highjinks',
12764	    'homework',
12765	    'housework',
12766	    'information',
12767	    'jeans',
12768	    'justice',
12769	    'kudos',
12770	    'labour',
12771	    'literature',
12772	    'machinery',
12773	    'mackerel',
12774	    'mail',
12775	    'media',
12776	    'mews',
12777	    'moose',
12778	    'music',
12779	    'mud',
12780	    'manga',
12781	    'news',
12782	    'only',
12783	    'personnel',
12784	    'pike',
12785	    'plankton',
12786	    'pliers',
12787	    'police',
12788	    'pollution',
12789	    'premises',
12790	    'rain',
12791	    'research',
12792	    'rice',
12793	    'salmon',
12794	    'scissors',
12795	    'series',
12796	    'sewage',
12797	    'shambles',
12798	    'shrimp',
12799	    'software',
12800	    'species',
12801	    'staff',
12802	    'swine',
12803	    'tennis',
12804	    'traffic',
12805	    'transportation',
12806	    'trout',
12807	    'tuna',
12808	    'wealth',
12809	    'welfare',
12810	    'whiting',
12811	    'wildebeest',
12812	    'wildlife',
12813	    'you',
12814	    /pok[eé]mon$/i,
12815	    /[^aeiou]ese$/i,
12816	    /deer$/i,
12817	    /fish$/i,
12818	    /measles$/i,
12819	    /o[iu]s$/i,
12820	    /pox$/i,
12821	    /sheep$/i
12822	  ].forEach(pluralize.addUncountableRule);
12823	  return pluralize;
12824	});
12825} (pluralize));
12826var pluralizeExports = pluralize.exports;
12827var plural = getDefaultExportFromCjs(pluralizeExports);
12828
12829const convert$y =
12830  (
12831    function (test) {
12832      if (test === undefined || test === null) {
12833        return ok$y
12834      }
12835      if (typeof test === 'string') {
12836        return typeFactory$y(test)
12837      }
12838      if (typeof test === 'object') {
12839        return Array.isArray(test) ? anyFactory$y(test) : propsFactory$y(test)
12840      }
12841      if (typeof test === 'function') {
12842        return castFactory$y(test)
12843      }
12844      throw new Error('Expected function, string, or object as test')
12845    }
12846  );
12847function anyFactory$y(tests) {
12848  const checks = [];
12849  let index = -1;
12850  while (++index < tests.length) {
12851    checks[index] = convert$y(tests[index]);
12852  }
12853  return castFactory$y(any)
12854  function any(...parameters) {
12855    let index = -1;
12856    while (++index < checks.length) {
12857      if (checks[index].call(this, ...parameters)) return true
12858    }
12859    return false
12860  }
12861}
12862function propsFactory$y(check) {
12863  return castFactory$y(all)
12864  function all(node) {
12865    let key;
12866    for (key in check) {
12867      if (node[key] !== check[key]) return false
12868    }
12869    return true
12870  }
12871}
12872function typeFactory$y(check) {
12873  return castFactory$y(type)
12874  function type(node) {
12875    return node && node.type === check
12876  }
12877}
12878function castFactory$y(check) {
12879  return assertion
12880  function assertion(node, ...parameters) {
12881    return Boolean(
12882      node &&
12883        typeof node === 'object' &&
12884        'type' in node &&
12885        Boolean(check.call(this, node, ...parameters))
12886    )
12887  }
12888}
12889function ok$y() {
12890  return true
12891}
12892
12893function color$z(d) {
12894  return '\u001B[33m' + d + '\u001B[39m'
12895}
12896
12897const CONTINUE$y = true;
12898const EXIT$y = false;
12899const SKIP$y = 'skip';
12900const visitParents$y =
12901  (
12902    function (tree, test, visitor, reverse) {
12903      if (typeof test === 'function' && typeof visitor !== 'function') {
12904        reverse = visitor;
12905        visitor = test;
12906        test = null;
12907      }
12908      const is = convert$y(test);
12909      const step = reverse ? -1 : 1;
12910      factory(tree, undefined, [])();
12911      function factory(node, index, parents) {
12912        const value = node && typeof node === 'object' ? node : {};
12913        if (typeof value.type === 'string') {
12914          const name =
12915            typeof value.tagName === 'string'
12916              ? value.tagName
12917              :
12918              typeof value.name === 'string'
12919              ? value.name
12920              : undefined;
12921          Object.defineProperty(visit, 'name', {
12922            value:
12923              'node (' + color$z(node.type + (name ? '<' + name + '>' : '')) + ')'
12924          });
12925        }
12926        return visit
12927        function visit() {
12928          let result = [];
12929          let subresult;
12930          let offset;
12931          let grandparents;
12932          if (!test || is(node, index, parents[parents.length - 1] || null)) {
12933            result = toResult$y(visitor(node, parents));
12934            if (result[0] === EXIT$y) {
12935              return result
12936            }
12937          }
12938          if (node.children && result[0] !== SKIP$y) {
12939            offset = (reverse ? node.children.length : -1) + step;
12940            grandparents = parents.concat(node);
12941            while (offset > -1 && offset < node.children.length) {
12942              subresult = factory(node.children[offset], offset, grandparents)();
12943              if (subresult[0] === EXIT$y) {
12944                return subresult
12945              }
12946              offset =
12947                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
12948            }
12949          }
12950          return result
12951        }
12952      }
12953    }
12954  );
12955function toResult$y(value) {
12956  if (Array.isArray(value)) {
12957    return value
12958  }
12959  if (typeof value === 'number') {
12960    return [CONTINUE$y, value]
12961  }
12962  return [value]
12963}
12964
12965const visit$y =
12966  (
12967    function (tree, test, visitor, reverse) {
12968      if (typeof test === 'function' && typeof visitor !== 'function') {
12969        reverse = visitor;
12970        visitor = test;
12971        test = null;
12972      }
12973      visitParents$y(tree, test, overload, reverse);
12974      function overload(node, parents) {
12975        const parent = parents[parents.length - 1];
12976        return visitor(
12977          node,
12978          parent ? parent.children.indexOf(node) : null,
12979          parent
12980        )
12981      }
12982    }
12983  );
12984
12985/**
12986 * ## When should I use this?
12987 *
12988 * You can use this package to check that list items are not indented.
12989 *
12990 * ## API
12991 *
12992 * There are no options.
12993 *
12994 * ## Recommendation
12995 *
12996 * There is no specific handling of indented list items (or anything else) in
12997 * markdown.
12998 * While it is possible to use an indent to align ordered lists on their marker:
12999 *
13000 * ```markdown
13001 *   1. One
13002 *  10. Ten
13003 * 100. Hundred
13004 * ```
13005 *
13006 * …such a style is uncommon and a bit hard to maintain: adding a 10th item
13007 * means 9 other items have to change (more arduous, while unlikely, would be
13008 * the 100th item).
13009 * Hence, it’s recommended to not indent items and to turn this rule on.
13010 *
13011 * ## Fix
13012 *
13013 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
13014 * formats all items without indent.
13015 *
13016 * @module list-item-bullet-indent
13017 * @summary
13018 *   remark-lint rule to warn when list items are indented.
13019 * @author Titus Wormer
13020 * @copyright 2015 Titus Wormer
13021 * @license MIT
13022 * @example
13023 *   {"name": "ok.md"}
13024 *
13025 *   Paragraph.
13026 *
13027 *   * List item
13028 *   * List item
13029 *
13030 * @example
13031 *   {"name": "not-ok.md", "label": "input"}
13032 *
13033 *   Paragraph.
13034 *
13035 *   ·* List item
13036 *   ·* List item
13037 *
13038 * @example
13039 *   {"name": "not-ok.md", "label": "output"}
13040 *
13041 *   3:2: Incorrect indentation before bullet: remove 1 space
13042 *   4:2: Incorrect indentation before bullet: remove 1 space
13043 */
13044const remarkLintListItemBulletIndent = lintRule(
13045  {
13046    origin: 'remark-lint:list-item-bullet-indent',
13047    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-list-item-bullet-indent#readme'
13048  },
13049  (tree, file) => {
13050    visit$y(tree, 'list', (list, _, grandparent) => {
13051      let index = -1;
13052      while (++index < list.children.length) {
13053        const item = list.children[index];
13054        if (
13055          grandparent &&
13056          grandparent.type === 'root' &&
13057          grandparent.position &&
13058          typeof grandparent.position.start.column === 'number' &&
13059          item.position &&
13060          typeof item.position.start.column === 'number'
13061        ) {
13062          const indent =
13063            item.position.start.column - grandparent.position.start.column;
13064          if (indent) {
13065            file.message(
13066              'Incorrect indentation before bullet: remove ' +
13067                indent +
13068                ' ' +
13069                plural('space', indent),
13070              item.position.start
13071            );
13072          }
13073        }
13074      }
13075    });
13076  }
13077);
13078var remarkLintListItemBulletIndent$1 = remarkLintListItemBulletIndent;
13079
13080const convert$x =
13081  (
13082    function (test) {
13083      if (test === undefined || test === null) {
13084        return ok$x
13085      }
13086      if (typeof test === 'string') {
13087        return typeFactory$x(test)
13088      }
13089      if (typeof test === 'object') {
13090        return Array.isArray(test) ? anyFactory$x(test) : propsFactory$x(test)
13091      }
13092      if (typeof test === 'function') {
13093        return castFactory$x(test)
13094      }
13095      throw new Error('Expected function, string, or object as test')
13096    }
13097  );
13098function anyFactory$x(tests) {
13099  const checks = [];
13100  let index = -1;
13101  while (++index < tests.length) {
13102    checks[index] = convert$x(tests[index]);
13103  }
13104  return castFactory$x(any)
13105  function any(...parameters) {
13106    let index = -1;
13107    while (++index < checks.length) {
13108      if (checks[index].call(this, ...parameters)) return true
13109    }
13110    return false
13111  }
13112}
13113function propsFactory$x(check) {
13114  return castFactory$x(all)
13115  function all(node) {
13116    let key;
13117    for (key in check) {
13118      if (node[key] !== check[key]) return false
13119    }
13120    return true
13121  }
13122}
13123function typeFactory$x(check) {
13124  return castFactory$x(type)
13125  function type(node) {
13126    return node && node.type === check
13127  }
13128}
13129function castFactory$x(check) {
13130  return assertion
13131  function assertion(node, ...parameters) {
13132    return Boolean(
13133      node &&
13134        typeof node === 'object' &&
13135        'type' in node &&
13136        Boolean(check.call(this, node, ...parameters))
13137    )
13138  }
13139}
13140function ok$x() {
13141  return true
13142}
13143
13144function color$y(d) {
13145  return '\u001B[33m' + d + '\u001B[39m'
13146}
13147
13148const CONTINUE$x = true;
13149const EXIT$x = false;
13150const SKIP$x = 'skip';
13151const visitParents$x =
13152  (
13153    function (tree, test, visitor, reverse) {
13154      if (typeof test === 'function' && typeof visitor !== 'function') {
13155        reverse = visitor;
13156        visitor = test;
13157        test = null;
13158      }
13159      const is = convert$x(test);
13160      const step = reverse ? -1 : 1;
13161      factory(tree, undefined, [])();
13162      function factory(node, index, parents) {
13163        const value = node && typeof node === 'object' ? node : {};
13164        if (typeof value.type === 'string') {
13165          const name =
13166            typeof value.tagName === 'string'
13167              ? value.tagName
13168              :
13169              typeof value.name === 'string'
13170              ? value.name
13171              : undefined;
13172          Object.defineProperty(visit, 'name', {
13173            value:
13174              'node (' + color$y(node.type + (name ? '<' + name + '>' : '')) + ')'
13175          });
13176        }
13177        return visit
13178        function visit() {
13179          let result = [];
13180          let subresult;
13181          let offset;
13182          let grandparents;
13183          if (!test || is(node, index, parents[parents.length - 1] || null)) {
13184            result = toResult$x(visitor(node, parents));
13185            if (result[0] === EXIT$x) {
13186              return result
13187            }
13188          }
13189          if (node.children && result[0] !== SKIP$x) {
13190            offset = (reverse ? node.children.length : -1) + step;
13191            grandparents = parents.concat(node);
13192            while (offset > -1 && offset < node.children.length) {
13193              subresult = factory(node.children[offset], offset, grandparents)();
13194              if (subresult[0] === EXIT$x) {
13195                return subresult
13196              }
13197              offset =
13198                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
13199            }
13200          }
13201          return result
13202        }
13203      }
13204    }
13205  );
13206function toResult$x(value) {
13207  if (Array.isArray(value)) {
13208    return value
13209  }
13210  if (typeof value === 'number') {
13211    return [CONTINUE$x, value]
13212  }
13213  return [value]
13214}
13215
13216const visit$x =
13217  (
13218    function (tree, test, visitor, reverse) {
13219      if (typeof test === 'function' && typeof visitor !== 'function') {
13220        reverse = visitor;
13221        visitor = test;
13222        test = null;
13223      }
13224      visitParents$x(tree, test, overload, reverse);
13225      function overload(node, parents) {
13226        const parent = parents[parents.length - 1];
13227        return visitor(
13228          node,
13229          parent ? parent.children.indexOf(node) : null,
13230          parent
13231        )
13232      }
13233    }
13234  );
13235
13236const pointStart = point$2('start');
13237const pointEnd = point$2('end');
13238function point$2(type) {
13239  return point
13240  function point(node) {
13241    const point = (node && node.position && node.position[type]) || {};
13242    return {
13243      line: point.line || null,
13244      column: point.column || null,
13245      offset: point.offset > -1 ? point.offset : null
13246    }
13247  }
13248}
13249
13250function generated(node) {
13251  return (
13252    !node ||
13253    !node.position ||
13254    !node.position.start ||
13255    !node.position.start.line ||
13256    !node.position.start.column ||
13257    !node.position.end ||
13258    !node.position.end.line ||
13259    !node.position.end.column
13260  )
13261}
13262
13263/**
13264 * ## When should I use this?
13265 *
13266 * You can use this package to check that the spacing between list item markers
13267 * and content is inconsistent.
13268 *
13269 * ## API
13270 *
13271 * The following options (default: `'tab-size'`) are accepted:
13272 *
13273 * *   `'space'`
13274 *     — prefer a single space
13275 * *   `'tab-size'`
13276 *     — prefer spaces the size of the next tab stop
13277 * *   `'mixed'`
13278 *     — prefer `'space'` for tight lists and `'tab-size'` for loose lists
13279 *
13280 * ## Recommendation
13281 *
13282 * First, some background.
13283 * The number of spaces that occur after list markers (`*`, `-`, and `+` for
13284 * unordered lists, or `.` and `)` for unordered lists) and before the content
13285 * on the first line, defines how much indentation can be used for further
13286 * lines.
13287 * At least one space is required and up to 4 spaces are allowed (if there is no
13288 * further content after the marker then it’s a blank line which is handled as
13289 * if there was one space; if there are 5 or more spaces and then content, it’s
13290 * also seen as one space and the rest is seen as indented code).
13291 *
13292 * There are two types of lists in markdown (other than ordered and unordered):
13293 * tight and loose lists.
13294 * Lists are tight by default but if there is a blank line between two list
13295 * items or between two blocks inside an item, that turns the whole list into a
13296 * loose list.
13297 * When turning markdown into HTML, paragraphs in tight lists are not wrapped
13298 * in `<p>` tags.
13299 *
13300 * Historically, how indentation of lists works in markdown has been a mess,
13301 * especially with how they interact with indented code.
13302 * CommonMark made that a *lot* better, but there remain (documented but
13303 * complex) edge cases and some behavior intuitive.
13304 * Due to this, the default of this list is `'tab-size'`, which worked the best
13305 * in most markdown parsers.
13306 * Currently, the situation between markdown parsers is better, so choosing
13307 * `'space'` (which seems to be the most common style used by authors) should
13308 * be okay.
13309 *
13310 * ## Fix
13311 *
13312 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
13313 * uses `'tab-size'` (named `'tab'` there) by default.
13314 * [`listItemIndent: '1'` (for `'space'`) or `listItemIndent: 'mixed'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionslistitemindent)
13315 * is supported.
13316 *
13317 * @module list-item-indent
13318 * @summary
13319 *   remark-lint rule to warn when spacing between list item markers and
13320 *   content is inconsistent.
13321 * @author Titus Wormer
13322 * @copyright 2015 Titus Wormer
13323 * @license MIT
13324 * @example
13325 *   {"name": "ok.md"}
13326 *
13327 *   *···List
13328 *   ····item.
13329 *
13330 *   Paragraph.
13331 *
13332 *   11.·List
13333 *   ····item.
13334 *
13335 *   Paragraph.
13336 *
13337 *   *···List
13338 *   ····item.
13339 *
13340 *   *···List
13341 *   ····item.
13342 *
13343 * @example
13344 *   {"name": "ok.md", "config": "mixed"}
13345 *
13346 *   *·List item.
13347 *
13348 *   Paragraph.
13349 *
13350 *   11.·List item
13351 *
13352 *   Paragraph.
13353 *
13354 *   *···List
13355 *   ····item.
13356 *
13357 *   *···List
13358 *   ····item.
13359 *
13360 * @example
13361 *   {"name": "ok.md", "config": "space"}
13362 *
13363 *   *·List item.
13364 *
13365 *   Paragraph.
13366 *
13367 *   11.·List item
13368 *
13369 *   Paragraph.
13370 *
13371 *   *·List
13372 *   ··item.
13373 *
13374 *   *·List
13375 *   ··item.
13376 *
13377 * @example
13378 *   {"name": "not-ok.md", "config": "space", "label": "input"}
13379 *
13380 *   *···List
13381 *   ····item.
13382 *
13383 * @example
13384 *   {"name": "not-ok.md", "config": "space", "label": "output"}
13385 *
13386 *    1:5: Incorrect list-item indent: remove 2 spaces
13387 *
13388 * @example
13389 *   {"name": "not-ok.md", "config": "tab-size", "label": "input"}
13390 *
13391 *   *·List
13392 *   ··item.
13393 *
13394 * @example
13395 *   {"name": "not-ok.md", "config": "tab-size", "label": "output"}
13396 *
13397 *    1:3: Incorrect list-item indent: add 2 spaces
13398 *
13399 * @example
13400 *   {"name": "not-ok.md", "config": "mixed", "label": "input"}
13401 *
13402 *   *···List item.
13403 *
13404 * @example
13405 *   {"name": "not-ok.md", "config": "mixed", "label": "output"}
13406 *
13407 *    1:5: Incorrect list-item indent: remove 2 spaces
13408 *
13409 * @example
13410 *   {"name": "not-ok.md", "config": "�", "label": "output", "positionless": true}
13411 *
13412 *    1:1: Incorrect list-item indent style `�`: use either `'tab-size'`, `'space'`, or `'mixed'`
13413 */
13414const remarkLintListItemIndent = lintRule(
13415  {
13416    origin: 'remark-lint:list-item-indent',
13417    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-list-item-indent#readme'
13418  },
13419  (tree, file, option = 'tab-size') => {
13420    const value = String(file);
13421    if (option !== 'tab-size' && option !== 'space' && option !== 'mixed') {
13422      file.fail(
13423        'Incorrect list-item indent style `' +
13424          option +
13425          "`: use either `'tab-size'`, `'space'`, or `'mixed'`"
13426      );
13427    }
13428    visit$x(tree, 'list', (node) => {
13429      if (generated(node)) return
13430      const spread = node.spread;
13431      let index = -1;
13432      while (++index < node.children.length) {
13433        const item = node.children[index];
13434        const head = item.children[0];
13435        const final = pointStart(head);
13436        const marker = value
13437          .slice(pointStart(item).offset, final.offset)
13438          .replace(/\[[x ]?]\s*$/i, '');
13439        const bulletSize = marker.replace(/\s+$/, '').length;
13440        const style =
13441          option === 'tab-size' || (option === 'mixed' && spread)
13442            ? Math.ceil(bulletSize / 4) * 4
13443            : bulletSize + 1;
13444        if (marker.length !== style) {
13445          const diff = style - marker.length;
13446          const abs = Math.abs(diff);
13447          file.message(
13448            'Incorrect list-item indent: ' +
13449              (diff > 0 ? 'add' : 'remove') +
13450              ' ' +
13451              abs +
13452              ' ' +
13453              plural('space', abs),
13454            final
13455          );
13456        }
13457      }
13458    });
13459  }
13460);
13461var remarkLintListItemIndent$1 = remarkLintListItemIndent;
13462
13463const convert$w =
13464  (
13465    function (test) {
13466      if (test === undefined || test === null) {
13467        return ok$w
13468      }
13469      if (typeof test === 'string') {
13470        return typeFactory$w(test)
13471      }
13472      if (typeof test === 'object') {
13473        return Array.isArray(test) ? anyFactory$w(test) : propsFactory$w(test)
13474      }
13475      if (typeof test === 'function') {
13476        return castFactory$w(test)
13477      }
13478      throw new Error('Expected function, string, or object as test')
13479    }
13480  );
13481function anyFactory$w(tests) {
13482  const checks = [];
13483  let index = -1;
13484  while (++index < tests.length) {
13485    checks[index] = convert$w(tests[index]);
13486  }
13487  return castFactory$w(any)
13488  function any(...parameters) {
13489    let index = -1;
13490    while (++index < checks.length) {
13491      if (checks[index].call(this, ...parameters)) return true
13492    }
13493    return false
13494  }
13495}
13496function propsFactory$w(check) {
13497  return castFactory$w(all)
13498  function all(node) {
13499    let key;
13500    for (key in check) {
13501      if (node[key] !== check[key]) return false
13502    }
13503    return true
13504  }
13505}
13506function typeFactory$w(check) {
13507  return castFactory$w(type)
13508  function type(node) {
13509    return node && node.type === check
13510  }
13511}
13512function castFactory$w(check) {
13513  return assertion
13514  function assertion(node, ...parameters) {
13515    return Boolean(
13516      node &&
13517        typeof node === 'object' &&
13518        'type' in node &&
13519        Boolean(check.call(this, node, ...parameters))
13520    )
13521  }
13522}
13523function ok$w() {
13524  return true
13525}
13526
13527function color$x(d) {
13528  return '\u001B[33m' + d + '\u001B[39m'
13529}
13530
13531const CONTINUE$w = true;
13532const EXIT$w = false;
13533const SKIP$w = 'skip';
13534const visitParents$w =
13535  (
13536    function (tree, test, visitor, reverse) {
13537      if (typeof test === 'function' && typeof visitor !== 'function') {
13538        reverse = visitor;
13539        visitor = test;
13540        test = null;
13541      }
13542      const is = convert$w(test);
13543      const step = reverse ? -1 : 1;
13544      factory(tree, undefined, [])();
13545      function factory(node, index, parents) {
13546        const value = node && typeof node === 'object' ? node : {};
13547        if (typeof value.type === 'string') {
13548          const name =
13549            typeof value.tagName === 'string'
13550              ? value.tagName
13551              :
13552              typeof value.name === 'string'
13553              ? value.name
13554              : undefined;
13555          Object.defineProperty(visit, 'name', {
13556            value:
13557              'node (' + color$x(node.type + (name ? '<' + name + '>' : '')) + ')'
13558          });
13559        }
13560        return visit
13561        function visit() {
13562          let result = [];
13563          let subresult;
13564          let offset;
13565          let grandparents;
13566          if (!test || is(node, index, parents[parents.length - 1] || null)) {
13567            result = toResult$w(visitor(node, parents));
13568            if (result[0] === EXIT$w) {
13569              return result
13570            }
13571          }
13572          if (node.children && result[0] !== SKIP$w) {
13573            offset = (reverse ? node.children.length : -1) + step;
13574            grandparents = parents.concat(node);
13575            while (offset > -1 && offset < node.children.length) {
13576              subresult = factory(node.children[offset], offset, grandparents)();
13577              if (subresult[0] === EXIT$w) {
13578                return subresult
13579              }
13580              offset =
13581                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
13582            }
13583          }
13584          return result
13585        }
13586      }
13587    }
13588  );
13589function toResult$w(value) {
13590  if (Array.isArray(value)) {
13591    return value
13592  }
13593  if (typeof value === 'number') {
13594    return [CONTINUE$w, value]
13595  }
13596  return [value]
13597}
13598
13599const visit$w =
13600  (
13601    function (tree, test, visitor, reverse) {
13602      if (typeof test === 'function' && typeof visitor !== 'function') {
13603        reverse = visitor;
13604        visitor = test;
13605        test = null;
13606      }
13607      visitParents$w(tree, test, overload, reverse);
13608      function overload(node, parents) {
13609        const parent = parents[parents.length - 1];
13610        return visitor(
13611          node,
13612          parent ? parent.children.indexOf(node) : null,
13613          parent
13614        )
13615      }
13616    }
13617  );
13618
13619/**
13620 * ## When should I use this?
13621 *
13622 * You can use this package to check that lines in block quotes start with `>`.
13623 *
13624 * ## API
13625 *
13626 * There are no options.
13627 *
13628 * ## Recommendation
13629 *
13630 * Rules around “lazy” lines are not straightforward and visually confusing,
13631 * so it’s recommended to start each line with a `>`.
13632 *
13633 * ## Fix
13634 *
13635 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
13636 * adds `>` markers to every line in a block quote.
13637 *
13638 * @module no-blockquote-without-marker
13639 * @summary
13640 *   remark-lint rule to warn when lines in block quotes start without `>`.
13641 * @author Titus Wormer
13642 * @copyright 2015 Titus Wormer
13643 * @license MIT
13644 * @example
13645 *   {"name": "ok.md"}
13646 *
13647 *   > Foo…
13648 *   > …bar…
13649 *   > …baz.
13650 *
13651 * @example
13652 *   {"name": "ok-tabs.md"}
13653 *
13654 *   >»Foo…
13655 *   >»…bar…
13656 *   >»…baz.
13657 *
13658 * @example
13659 *   {"name": "not-ok.md", "label": "input"}
13660 *
13661 *   > Foo…
13662 *   …bar…
13663 *   > …baz.
13664 *
13665 * @example
13666 *   {"name": "not-ok.md", "label": "output"}
13667 *
13668 *   2:1: Missing marker in block quote
13669 *
13670 * @example
13671 *   {"name": "not-ok-tabs.md", "label": "input"}
13672 *
13673 *   >»Foo…
13674 *   »…bar…
13675 *   …baz.
13676 *
13677 * @example
13678 *   {"name": "not-ok-tabs.md", "label": "output"}
13679 *
13680 *   2:1: Missing marker in block quote
13681 *   3:1: Missing marker in block quote
13682 */
13683const remarkLintNoBlockquoteWithoutMarker = lintRule(
13684  {
13685    origin: 'remark-lint:no-blockquote-without-marker',
13686    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-blockquote-without-marker#readme'
13687  },
13688  (tree, file) => {
13689    const value = String(file);
13690    const loc = location(file);
13691    visit$w(tree, 'blockquote', (node) => {
13692      let index = -1;
13693      while (++index < node.children.length) {
13694        const child = node.children[index];
13695        if (child.type === 'paragraph' && !generated(child)) {
13696          const end = pointEnd(child).line;
13697          const column = pointStart(child).column;
13698          let line = pointStart(child).line;
13699          while (++line <= end) {
13700            const offset = loc.toOffset({line, column});
13701            if (/>[\t ]+$/.test(value.slice(offset - 5, offset))) {
13702              continue
13703            }
13704            file.message('Missing marker in block quote', {
13705              line,
13706              column: column - 2
13707            });
13708          }
13709        }
13710      }
13711    });
13712  }
13713);
13714var remarkLintNoBlockquoteWithoutMarker$1 = remarkLintNoBlockquoteWithoutMarker;
13715
13716const convert$v =
13717  (
13718    function (test) {
13719      if (test === undefined || test === null) {
13720        return ok$v
13721      }
13722      if (typeof test === 'string') {
13723        return typeFactory$v(test)
13724      }
13725      if (typeof test === 'object') {
13726        return Array.isArray(test) ? anyFactory$v(test) : propsFactory$v(test)
13727      }
13728      if (typeof test === 'function') {
13729        return castFactory$v(test)
13730      }
13731      throw new Error('Expected function, string, or object as test')
13732    }
13733  );
13734function anyFactory$v(tests) {
13735  const checks = [];
13736  let index = -1;
13737  while (++index < tests.length) {
13738    checks[index] = convert$v(tests[index]);
13739  }
13740  return castFactory$v(any)
13741  function any(...parameters) {
13742    let index = -1;
13743    while (++index < checks.length) {
13744      if (checks[index].call(this, ...parameters)) return true
13745    }
13746    return false
13747  }
13748}
13749function propsFactory$v(check) {
13750  return castFactory$v(all)
13751  function all(node) {
13752    let key;
13753    for (key in check) {
13754      if (node[key] !== check[key]) return false
13755    }
13756    return true
13757  }
13758}
13759function typeFactory$v(check) {
13760  return castFactory$v(type)
13761  function type(node) {
13762    return node && node.type === check
13763  }
13764}
13765function castFactory$v(check) {
13766  return assertion
13767  function assertion(node, ...parameters) {
13768    return Boolean(
13769      node &&
13770        typeof node === 'object' &&
13771        'type' in node &&
13772        Boolean(check.call(this, node, ...parameters))
13773    )
13774  }
13775}
13776function ok$v() {
13777  return true
13778}
13779
13780function color$w(d) {
13781  return '\u001B[33m' + d + '\u001B[39m'
13782}
13783
13784const CONTINUE$v = true;
13785const EXIT$v = false;
13786const SKIP$v = 'skip';
13787const visitParents$v =
13788  (
13789    function (tree, test, visitor, reverse) {
13790      if (typeof test === 'function' && typeof visitor !== 'function') {
13791        reverse = visitor;
13792        visitor = test;
13793        test = null;
13794      }
13795      const is = convert$v(test);
13796      const step = reverse ? -1 : 1;
13797      factory(tree, undefined, [])();
13798      function factory(node, index, parents) {
13799        const value = node && typeof node === 'object' ? node : {};
13800        if (typeof value.type === 'string') {
13801          const name =
13802            typeof value.tagName === 'string'
13803              ? value.tagName
13804              :
13805              typeof value.name === 'string'
13806              ? value.name
13807              : undefined;
13808          Object.defineProperty(visit, 'name', {
13809            value:
13810              'node (' + color$w(node.type + (name ? '<' + name + '>' : '')) + ')'
13811          });
13812        }
13813        return visit
13814        function visit() {
13815          let result = [];
13816          let subresult;
13817          let offset;
13818          let grandparents;
13819          if (!test || is(node, index, parents[parents.length - 1] || null)) {
13820            result = toResult$v(visitor(node, parents));
13821            if (result[0] === EXIT$v) {
13822              return result
13823            }
13824          }
13825          if (node.children && result[0] !== SKIP$v) {
13826            offset = (reverse ? node.children.length : -1) + step;
13827            grandparents = parents.concat(node);
13828            while (offset > -1 && offset < node.children.length) {
13829              subresult = factory(node.children[offset], offset, grandparents)();
13830              if (subresult[0] === EXIT$v) {
13831                return subresult
13832              }
13833              offset =
13834                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
13835            }
13836          }
13837          return result
13838        }
13839      }
13840    }
13841  );
13842function toResult$v(value) {
13843  if (Array.isArray(value)) {
13844    return value
13845  }
13846  if (typeof value === 'number') {
13847    return [CONTINUE$v, value]
13848  }
13849  return [value]
13850}
13851
13852const visit$v =
13853  (
13854    function (tree, test, visitor, reverse) {
13855      if (typeof test === 'function' && typeof visitor !== 'function') {
13856        reverse = visitor;
13857        visitor = test;
13858        test = null;
13859      }
13860      visitParents$v(tree, test, overload, reverse);
13861      function overload(node, parents) {
13862        const parent = parents[parents.length - 1];
13863        return visitor(
13864          node,
13865          parent ? parent.children.indexOf(node) : null,
13866          parent
13867        )
13868      }
13869    }
13870  );
13871
13872const emptyOptions$1 = {};
13873function toString$1(value, options) {
13874  const settings = options || emptyOptions$1;
13875  const includeImageAlt =
13876    typeof settings.includeImageAlt === 'boolean'
13877      ? settings.includeImageAlt
13878      : true;
13879  const includeHtml =
13880    typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true;
13881  return one$1(value, includeImageAlt, includeHtml)
13882}
13883function one$1(value, includeImageAlt, includeHtml) {
13884  if (node$1(value)) {
13885    if ('value' in value) {
13886      return value.type === 'html' && !includeHtml ? '' : value.value
13887    }
13888    if (includeImageAlt && 'alt' in value && value.alt) {
13889      return value.alt
13890    }
13891    if ('children' in value) {
13892      return all$1(value.children, includeImageAlt, includeHtml)
13893    }
13894  }
13895  if (Array.isArray(value)) {
13896    return all$1(value, includeImageAlt, includeHtml)
13897  }
13898  return ''
13899}
13900function all$1(values, includeImageAlt, includeHtml) {
13901  const result = [];
13902  let index = -1;
13903  while (++index < values.length) {
13904    result[index] = one$1(values[index], includeImageAlt, includeHtml);
13905  }
13906  return result.join('')
13907}
13908function node$1(value) {
13909  return Boolean(value && typeof value === 'object')
13910}
13911
13912/**
13913 * ## When should I use this?
13914 *
13915 * You can use this package to check that autolink literal URLs are not used.
13916 *
13917 * ## API
13918 *
13919 * There are no options.
13920 *
13921 * ## Recommendation
13922 *
13923 * Autolink literal URLs (just a URL) are a feature enabled by GFM.
13924 * They don’t work everywhere.
13925 * Due to this, it’s recommended to instead use normal autolinks
13926 * (`<https://url>`) or links (`[text](url)`).
13927 *
13928 * ## Fix
13929 *
13930 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
13931 * never creates autolink literals and always uses normal autolinks (`<url>`).
13932 *
13933 * @module no-literal-urls
13934 * @summary
13935 *   remark-lint rule to warn for autolink literals.
13936 * @author Titus Wormer
13937 * @copyright 2015 Titus Wormer
13938 * @license MIT
13939 * @example
13940 *   {"name": "ok.md"}
13941 *
13942 *   <http://foo.bar/baz>
13943 *
13944 * @example
13945 *   {"name": "not-ok.md", "label": "input", "gfm": true}
13946 *
13947 *   http://foo.bar/baz
13948 *
13949 * @example
13950 *   {"name": "not-ok.md", "label": "output", "gfm": true}
13951 *
13952 *   1:1-1:19: Don’t use literal URLs without angle brackets
13953 */
13954const remarkLintNoLiteralUrls = lintRule(
13955  {
13956    origin: 'remark-lint:no-literal-urls',
13957    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls#readme'
13958  },
13959  (tree, file) => {
13960    visit$v(tree, 'link', (node) => {
13961      const value = toString$1(node);
13962      if (
13963        !generated(node) &&
13964        pointStart(node).column === pointStart(node.children[0]).column &&
13965        pointEnd(node).column ===
13966          pointEnd(node.children[node.children.length - 1]).column &&
13967        (node.url === 'mailto:' + value || node.url === value)
13968      ) {
13969        file.message('Don’t use literal URLs without angle brackets', node);
13970      }
13971    });
13972  }
13973);
13974var remarkLintNoLiteralUrls$1 = remarkLintNoLiteralUrls;
13975
13976const convert$u =
13977  (
13978    function (test) {
13979      if (test === undefined || test === null) {
13980        return ok$u
13981      }
13982      if (typeof test === 'string') {
13983        return typeFactory$u(test)
13984      }
13985      if (typeof test === 'object') {
13986        return Array.isArray(test) ? anyFactory$u(test) : propsFactory$u(test)
13987      }
13988      if (typeof test === 'function') {
13989        return castFactory$u(test)
13990      }
13991      throw new Error('Expected function, string, or object as test')
13992    }
13993  );
13994function anyFactory$u(tests) {
13995  const checks = [];
13996  let index = -1;
13997  while (++index < tests.length) {
13998    checks[index] = convert$u(tests[index]);
13999  }
14000  return castFactory$u(any)
14001  function any(...parameters) {
14002    let index = -1;
14003    while (++index < checks.length) {
14004      if (checks[index].call(this, ...parameters)) return true
14005    }
14006    return false
14007  }
14008}
14009function propsFactory$u(check) {
14010  return castFactory$u(all)
14011  function all(node) {
14012    let key;
14013    for (key in check) {
14014      if (node[key] !== check[key]) return false
14015    }
14016    return true
14017  }
14018}
14019function typeFactory$u(check) {
14020  return castFactory$u(type)
14021  function type(node) {
14022    return node && node.type === check
14023  }
14024}
14025function castFactory$u(check) {
14026  return assertion
14027  function assertion(node, ...parameters) {
14028    return Boolean(
14029      node &&
14030        typeof node === 'object' &&
14031        'type' in node &&
14032        Boolean(check.call(this, node, ...parameters))
14033    )
14034  }
14035}
14036function ok$u() {
14037  return true
14038}
14039
14040function color$v(d) {
14041  return '\u001B[33m' + d + '\u001B[39m'
14042}
14043
14044const CONTINUE$u = true;
14045const EXIT$u = false;
14046const SKIP$u = 'skip';
14047const visitParents$u =
14048  (
14049    function (tree, test, visitor, reverse) {
14050      if (typeof test === 'function' && typeof visitor !== 'function') {
14051        reverse = visitor;
14052        visitor = test;
14053        test = null;
14054      }
14055      const is = convert$u(test);
14056      const step = reverse ? -1 : 1;
14057      factory(tree, undefined, [])();
14058      function factory(node, index, parents) {
14059        const value = node && typeof node === 'object' ? node : {};
14060        if (typeof value.type === 'string') {
14061          const name =
14062            typeof value.tagName === 'string'
14063              ? value.tagName
14064              :
14065              typeof value.name === 'string'
14066              ? value.name
14067              : undefined;
14068          Object.defineProperty(visit, 'name', {
14069            value:
14070              'node (' + color$v(node.type + (name ? '<' + name + '>' : '')) + ')'
14071          });
14072        }
14073        return visit
14074        function visit() {
14075          let result = [];
14076          let subresult;
14077          let offset;
14078          let grandparents;
14079          if (!test || is(node, index, parents[parents.length - 1] || null)) {
14080            result = toResult$u(visitor(node, parents));
14081            if (result[0] === EXIT$u) {
14082              return result
14083            }
14084          }
14085          if (node.children && result[0] !== SKIP$u) {
14086            offset = (reverse ? node.children.length : -1) + step;
14087            grandparents = parents.concat(node);
14088            while (offset > -1 && offset < node.children.length) {
14089              subresult = factory(node.children[offset], offset, grandparents)();
14090              if (subresult[0] === EXIT$u) {
14091                return subresult
14092              }
14093              offset =
14094                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
14095            }
14096          }
14097          return result
14098        }
14099      }
14100    }
14101  );
14102function toResult$u(value) {
14103  if (Array.isArray(value)) {
14104    return value
14105  }
14106  if (typeof value === 'number') {
14107    return [CONTINUE$u, value]
14108  }
14109  return [value]
14110}
14111
14112const visit$u =
14113  (
14114    function (tree, test, visitor, reverse) {
14115      if (typeof test === 'function' && typeof visitor !== 'function') {
14116        reverse = visitor;
14117        visitor = test;
14118        test = null;
14119      }
14120      visitParents$u(tree, test, overload, reverse);
14121      function overload(node, parents) {
14122        const parent = parents[parents.length - 1];
14123        return visitor(
14124          node,
14125          parent ? parent.children.indexOf(node) : null,
14126          parent
14127        )
14128      }
14129    }
14130  );
14131
14132/**
14133 * ## When should I use this?
14134 *
14135 * You can use this package to check that ordered list markers are consistent.
14136 *
14137 * ## API
14138 *
14139 * The following options (default: `'consistent'`) are accepted:
14140 *
14141 * *   `'.'`
14142 *     — prefer dots
14143 * *   `')'`
14144 *     — prefer parens
14145 * *   `'consistent'`
14146 *     — detect the first used style and warn when further markers differ
14147 *
14148 * ## Recommendation
14149 *
14150 * Parens for list markers were not supported in markdown before CommonMark.
14151 * While they should work in most places now, not all markdown parsers follow
14152 * CommonMark.
14153 * Due to this, it’s recommended to prefer dots.
14154 *
14155 * ## Fix
14156 *
14157 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
14158 * formats ordered lists with dots by default.
14159 * Pass
14160 * [`bulletOrdered: ')'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsbulletordered)
14161 * to always use parens.
14162 *
14163 * @module ordered-list-marker-style
14164 * @summary
14165 *   remark-lint rule to warn when ordered list markers are inconsistent.
14166 * @author Titus Wormer
14167 * @copyright 2015 Titus Wormer
14168 * @license MIT
14169 * @example
14170 *   {"name": "ok.md"}
14171 *
14172 *   1.  Foo
14173 *
14174 *
14175 *   1.  Bar
14176 *
14177 *   Unordered lists are not affected by this rule.
14178 *
14179 *   * Foo
14180 *
14181 * @example
14182 *   {"name": "ok.md", "config": "."}
14183 *
14184 *   1.  Foo
14185 *
14186 *   2.  Bar
14187 *
14188 * @example
14189 *   {"name": "ok.md", "config": ")"}
14190 *
14191 *   1)  Foo
14192 *
14193 *   2)  Bar
14194 *
14195 * @example
14196 *   {"name": "not-ok.md", "label": "input"}
14197 *
14198 *   1.  Foo
14199 *
14200 *   2)  Bar
14201 *
14202 * @example
14203 *   {"name": "not-ok.md", "label": "output"}
14204 *
14205 *   3:1-3:8: Marker style should be `.`
14206 *
14207 * @example
14208 *   {"name": "not-ok.md", "label": "output", "config": "�", "positionless": true}
14209 *
14210 *   1:1: Incorrect ordered list item marker style `�`: use either `'.'` or `')'`
14211 */
14212const remarkLintOrderedListMarkerStyle = lintRule(
14213  {
14214    origin: 'remark-lint:ordered-list-marker-style',
14215    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-ordered-list-marker-style#readme'
14216  },
14217  (tree, file, option = 'consistent') => {
14218    const value = String(file);
14219    if (option !== 'consistent' && option !== '.' && option !== ')') {
14220      file.fail(
14221        'Incorrect ordered list item marker style `' +
14222          option +
14223          "`: use either `'.'` or `')'`"
14224      );
14225    }
14226    visit$u(tree, 'list', (node) => {
14227      let index = -1;
14228      if (!node.ordered) return
14229      while (++index < node.children.length) {
14230        const child = node.children[index];
14231        if (!generated(child)) {
14232          const marker =  (
14233            value
14234              .slice(
14235                pointStart(child).offset,
14236                pointStart(child.children[0]).offset
14237              )
14238              .replace(/\s|\d/g, '')
14239              .replace(/\[[x ]?]\s*$/i, '')
14240          );
14241          if (option === 'consistent') {
14242            option = marker;
14243          } else if (marker !== option) {
14244            file.message('Marker style should be `' + option + '`', child);
14245          }
14246        }
14247      }
14248    });
14249  }
14250);
14251var remarkLintOrderedListMarkerStyle$1 = remarkLintOrderedListMarkerStyle;
14252
14253const convert$t =
14254  (
14255    function (test) {
14256      if (test === undefined || test === null) {
14257        return ok$t
14258      }
14259      if (typeof test === 'string') {
14260        return typeFactory$t(test)
14261      }
14262      if (typeof test === 'object') {
14263        return Array.isArray(test) ? anyFactory$t(test) : propsFactory$t(test)
14264      }
14265      if (typeof test === 'function') {
14266        return castFactory$t(test)
14267      }
14268      throw new Error('Expected function, string, or object as test')
14269    }
14270  );
14271function anyFactory$t(tests) {
14272  const checks = [];
14273  let index = -1;
14274  while (++index < tests.length) {
14275    checks[index] = convert$t(tests[index]);
14276  }
14277  return castFactory$t(any)
14278  function any(...parameters) {
14279    let index = -1;
14280    while (++index < checks.length) {
14281      if (checks[index].call(this, ...parameters)) return true
14282    }
14283    return false
14284  }
14285}
14286function propsFactory$t(check) {
14287  return castFactory$t(all)
14288  function all(node) {
14289    let key;
14290    for (key in check) {
14291      if (node[key] !== check[key]) return false
14292    }
14293    return true
14294  }
14295}
14296function typeFactory$t(check) {
14297  return castFactory$t(type)
14298  function type(node) {
14299    return node && node.type === check
14300  }
14301}
14302function castFactory$t(check) {
14303  return assertion
14304  function assertion(node, ...parameters) {
14305    return Boolean(
14306      node &&
14307        typeof node === 'object' &&
14308        'type' in node &&
14309        Boolean(check.call(this, node, ...parameters))
14310    )
14311  }
14312}
14313function ok$t() {
14314  return true
14315}
14316
14317function color$u(d) {
14318  return '\u001B[33m' + d + '\u001B[39m'
14319}
14320
14321const CONTINUE$t = true;
14322const EXIT$t = false;
14323const SKIP$t = 'skip';
14324const visitParents$t =
14325  (
14326    function (tree, test, visitor, reverse) {
14327      if (typeof test === 'function' && typeof visitor !== 'function') {
14328        reverse = visitor;
14329        visitor = test;
14330        test = null;
14331      }
14332      const is = convert$t(test);
14333      const step = reverse ? -1 : 1;
14334      factory(tree, undefined, [])();
14335      function factory(node, index, parents) {
14336        const value = node && typeof node === 'object' ? node : {};
14337        if (typeof value.type === 'string') {
14338          const name =
14339            typeof value.tagName === 'string'
14340              ? value.tagName
14341              :
14342              typeof value.name === 'string'
14343              ? value.name
14344              : undefined;
14345          Object.defineProperty(visit, 'name', {
14346            value:
14347              'node (' + color$u(node.type + (name ? '<' + name + '>' : '')) + ')'
14348          });
14349        }
14350        return visit
14351        function visit() {
14352          let result = [];
14353          let subresult;
14354          let offset;
14355          let grandparents;
14356          if (!test || is(node, index, parents[parents.length - 1] || null)) {
14357            result = toResult$t(visitor(node, parents));
14358            if (result[0] === EXIT$t) {
14359              return result
14360            }
14361          }
14362          if (node.children && result[0] !== SKIP$t) {
14363            offset = (reverse ? node.children.length : -1) + step;
14364            grandparents = parents.concat(node);
14365            while (offset > -1 && offset < node.children.length) {
14366              subresult = factory(node.children[offset], offset, grandparents)();
14367              if (subresult[0] === EXIT$t) {
14368                return subresult
14369              }
14370              offset =
14371                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
14372            }
14373          }
14374          return result
14375        }
14376      }
14377    }
14378  );
14379function toResult$t(value) {
14380  if (Array.isArray(value)) {
14381    return value
14382  }
14383  if (typeof value === 'number') {
14384    return [CONTINUE$t, value]
14385  }
14386  return [value]
14387}
14388
14389const visit$t =
14390  (
14391    function (tree, test, visitor, reverse) {
14392      if (typeof test === 'function' && typeof visitor !== 'function') {
14393        reverse = visitor;
14394        visitor = test;
14395        test = null;
14396      }
14397      visitParents$t(tree, test, overload, reverse);
14398      function overload(node, parents) {
14399        const parent = parents[parents.length - 1];
14400        return visitor(
14401          node,
14402          parent ? parent.children.indexOf(node) : null,
14403          parent
14404        )
14405      }
14406    }
14407  );
14408
14409/**
14410 * ## When should I use this?
14411 *
14412 * You can use this package to check that hard breaks use two spaces and
14413 * not more.
14414 *
14415 * ## API
14416 *
14417 * There are no options.
14418 *
14419 * ## Recommendation
14420 *
14421 * Less than two spaces do not create a hard breaks and more than two spaces
14422 * have no effect.
14423 * Due to this, it’s recommended to turn this rule on.
14424 *
14425 * @module hard-break-spaces
14426 * @summary
14427 *   remark-lint rule to warn when more spaces are used than needed
14428 *   for hard breaks.
14429 * @author Titus Wormer
14430 * @copyright 2015 Titus Wormer
14431 * @license MIT
14432 * @example
14433 *   {"name": "ok.md"}
14434 *
14435 *   Lorem ipsum··
14436 *   dolor sit amet
14437 *
14438 * @example
14439 *   {"name": "not-ok.md", "label": "input"}
14440 *
14441 *   Lorem ipsum···
14442 *   dolor sit amet.
14443 *
14444 * @example
14445 *   {"name": "not-ok.md", "label": "output"}
14446 *
14447 *   1:12-2:1: Use two spaces for hard line breaks
14448 */
14449const remarkLintHardBreakSpaces = lintRule(
14450  {
14451    origin: 'remark-lint:hard-break-spaces',
14452    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-hard-break-spaces#readme'
14453  },
14454  (tree, file) => {
14455    const value = String(file);
14456    visit$t(tree, 'break', (node) => {
14457      if (!generated(node)) {
14458        const slice = value
14459          .slice(pointStart(node).offset, pointEnd(node).offset)
14460          .split('\n', 1)[0]
14461          .replace(/\r$/, '');
14462        if (slice.length > 2) {
14463          file.message('Use two spaces for hard line breaks', node);
14464        }
14465      }
14466    });
14467  }
14468);
14469var remarkLintHardBreakSpaces$1 = remarkLintHardBreakSpaces;
14470
14471function stringifyPosition$1(value) {
14472  if (!value || typeof value !== 'object') {
14473    return ''
14474  }
14475  if ('position' in value || 'type' in value) {
14476    return position$1(value.position)
14477  }
14478  if ('start' in value || 'end' in value) {
14479    return position$1(value)
14480  }
14481  if ('line' in value || 'column' in value) {
14482    return point$1(value)
14483  }
14484  return ''
14485}
14486function point$1(point) {
14487  return index$1(point && point.line) + ':' + index$1(point && point.column)
14488}
14489function position$1(pos) {
14490  return point$1(pos && pos.start) + '-' + point$1(pos && pos.end)
14491}
14492function index$1(value) {
14493  return value && typeof value === 'number' ? value : 1
14494}
14495
14496const convert$s =
14497  (
14498    function (test) {
14499      if (test === undefined || test === null) {
14500        return ok$s
14501      }
14502      if (typeof test === 'string') {
14503        return typeFactory$s(test)
14504      }
14505      if (typeof test === 'object') {
14506        return Array.isArray(test) ? anyFactory$s(test) : propsFactory$s(test)
14507      }
14508      if (typeof test === 'function') {
14509        return castFactory$s(test)
14510      }
14511      throw new Error('Expected function, string, or object as test')
14512    }
14513  );
14514function anyFactory$s(tests) {
14515  const checks = [];
14516  let index = -1;
14517  while (++index < tests.length) {
14518    checks[index] = convert$s(tests[index]);
14519  }
14520  return castFactory$s(any)
14521  function any(...parameters) {
14522    let index = -1;
14523    while (++index < checks.length) {
14524      if (checks[index].call(this, ...parameters)) return true
14525    }
14526    return false
14527  }
14528}
14529function propsFactory$s(check) {
14530  return castFactory$s(all)
14531  function all(node) {
14532    let key;
14533    for (key in check) {
14534      if (node[key] !== check[key]) return false
14535    }
14536    return true
14537  }
14538}
14539function typeFactory$s(check) {
14540  return castFactory$s(type)
14541  function type(node) {
14542    return node && node.type === check
14543  }
14544}
14545function castFactory$s(check) {
14546  return assertion
14547  function assertion(node, ...parameters) {
14548    return Boolean(
14549      node &&
14550        typeof node === 'object' &&
14551        'type' in node &&
14552        Boolean(check.call(this, node, ...parameters))
14553    )
14554  }
14555}
14556function ok$s() {
14557  return true
14558}
14559
14560function color$t(d) {
14561  return '\u001B[33m' + d + '\u001B[39m'
14562}
14563
14564const CONTINUE$s = true;
14565const EXIT$s = false;
14566const SKIP$s = 'skip';
14567const visitParents$s =
14568  (
14569    function (tree, test, visitor, reverse) {
14570      if (typeof test === 'function' && typeof visitor !== 'function') {
14571        reverse = visitor;
14572        visitor = test;
14573        test = null;
14574      }
14575      const is = convert$s(test);
14576      const step = reverse ? -1 : 1;
14577      factory(tree, undefined, [])();
14578      function factory(node, index, parents) {
14579        const value = node && typeof node === 'object' ? node : {};
14580        if (typeof value.type === 'string') {
14581          const name =
14582            typeof value.tagName === 'string'
14583              ? value.tagName
14584              :
14585              typeof value.name === 'string'
14586              ? value.name
14587              : undefined;
14588          Object.defineProperty(visit, 'name', {
14589            value:
14590              'node (' + color$t(node.type + (name ? '<' + name + '>' : '')) + ')'
14591          });
14592        }
14593        return visit
14594        function visit() {
14595          let result = [];
14596          let subresult;
14597          let offset;
14598          let grandparents;
14599          if (!test || is(node, index, parents[parents.length - 1] || null)) {
14600            result = toResult$s(visitor(node, parents));
14601            if (result[0] === EXIT$s) {
14602              return result
14603            }
14604          }
14605          if (node.children && result[0] !== SKIP$s) {
14606            offset = (reverse ? node.children.length : -1) + step;
14607            grandparents = parents.concat(node);
14608            while (offset > -1 && offset < node.children.length) {
14609              subresult = factory(node.children[offset], offset, grandparents)();
14610              if (subresult[0] === EXIT$s) {
14611                return subresult
14612              }
14613              offset =
14614                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
14615            }
14616          }
14617          return result
14618        }
14619      }
14620    }
14621  );
14622function toResult$s(value) {
14623  if (Array.isArray(value)) {
14624    return value
14625  }
14626  if (typeof value === 'number') {
14627    return [CONTINUE$s, value]
14628  }
14629  return [value]
14630}
14631
14632const visit$s =
14633  (
14634    function (tree, test, visitor, reverse) {
14635      if (typeof test === 'function' && typeof visitor !== 'function') {
14636        reverse = visitor;
14637        visitor = test;
14638        test = null;
14639      }
14640      visitParents$s(tree, test, overload, reverse);
14641      function overload(node, parents) {
14642        const parent = parents[parents.length - 1];
14643        return visitor(
14644          node,
14645          parent ? parent.children.indexOf(node) : null,
14646          parent
14647        )
14648      }
14649    }
14650  );
14651
14652/**
14653 * ## When should I use this?
14654 *
14655 * You can use this package to check that identifiers are defined once.
14656 *
14657 * ## API
14658 *
14659 * There are no options.
14660 *
14661 * ## Recommendation
14662 *
14663 * It’s a mistake when the same identifier is defined multiple times.
14664 *
14665 * @module no-duplicate-definitions
14666 * @summary
14667 *   remark-lint rule to warn when identifiers are defined multiple times.
14668 * @author Titus Wormer
14669 * @copyright 2015 Titus Wormer
14670 * @license MIT
14671 * @example
14672 *   {"name": "ok.md"}
14673 *
14674 *   [foo]: bar
14675 *   [baz]: qux
14676 *
14677 * @example
14678 *   {"name": "not-ok.md", "label": "input"}
14679 *
14680 *   [foo]: bar
14681 *   [foo]: qux
14682 *
14683 * @example
14684 *   {"name": "not-ok.md", "label": "output"}
14685 *
14686 *   2:1-2:11: Do not use definitions with the same identifier (1:1)
14687 */
14688const remarkLintNoDuplicateDefinitions = lintRule(
14689  {
14690    origin: 'remark-lint:no-duplicate-definitions',
14691    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-duplicate-definitions#readme'
14692  },
14693  (tree, file) => {
14694    const map = Object.create(null);
14695    visit$s(tree, (node) => {
14696      if (
14697        (node.type === 'definition' || node.type === 'footnoteDefinition') &&
14698        !generated(node)
14699      ) {
14700        const identifier = node.identifier;
14701        const duplicate = map[identifier];
14702        if (duplicate) {
14703          file.message(
14704            'Do not use definitions with the same identifier (' +
14705              duplicate +
14706              ')',
14707            node
14708          );
14709        }
14710        map[identifier] = stringifyPosition$1(pointStart(node));
14711      }
14712    });
14713  }
14714);
14715var remarkLintNoDuplicateDefinitions$1 = remarkLintNoDuplicateDefinitions;
14716
14717const convert$r =
14718  (
14719    function (test) {
14720      if (test === undefined || test === null) {
14721        return ok$r
14722      }
14723      if (typeof test === 'string') {
14724        return typeFactory$r(test)
14725      }
14726      if (typeof test === 'object') {
14727        return Array.isArray(test) ? anyFactory$r(test) : propsFactory$r(test)
14728      }
14729      if (typeof test === 'function') {
14730        return castFactory$r(test)
14731      }
14732      throw new Error('Expected function, string, or object as test')
14733    }
14734  );
14735function anyFactory$r(tests) {
14736  const checks = [];
14737  let index = -1;
14738  while (++index < tests.length) {
14739    checks[index] = convert$r(tests[index]);
14740  }
14741  return castFactory$r(any)
14742  function any(...parameters) {
14743    let index = -1;
14744    while (++index < checks.length) {
14745      if (checks[index].call(this, ...parameters)) return true
14746    }
14747    return false
14748  }
14749}
14750function propsFactory$r(check) {
14751  return castFactory$r(all)
14752  function all(node) {
14753    let key;
14754    for (key in check) {
14755      if (node[key] !== check[key]) return false
14756    }
14757    return true
14758  }
14759}
14760function typeFactory$r(check) {
14761  return castFactory$r(type)
14762  function type(node) {
14763    return node && node.type === check
14764  }
14765}
14766function castFactory$r(check) {
14767  return assertion
14768  function assertion(node, ...parameters) {
14769    return Boolean(
14770      node &&
14771        typeof node === 'object' &&
14772        'type' in node &&
14773        Boolean(check.call(this, node, ...parameters))
14774    )
14775  }
14776}
14777function ok$r() {
14778  return true
14779}
14780
14781function color$s(d) {
14782  return '\u001B[33m' + d + '\u001B[39m'
14783}
14784
14785const CONTINUE$r = true;
14786const EXIT$r = false;
14787const SKIP$r = 'skip';
14788const visitParents$r =
14789  (
14790    function (tree, test, visitor, reverse) {
14791      if (typeof test === 'function' && typeof visitor !== 'function') {
14792        reverse = visitor;
14793        visitor = test;
14794        test = null;
14795      }
14796      const is = convert$r(test);
14797      const step = reverse ? -1 : 1;
14798      factory(tree, undefined, [])();
14799      function factory(node, index, parents) {
14800        const value = node && typeof node === 'object' ? node : {};
14801        if (typeof value.type === 'string') {
14802          const name =
14803            typeof value.tagName === 'string'
14804              ? value.tagName
14805              :
14806              typeof value.name === 'string'
14807              ? value.name
14808              : undefined;
14809          Object.defineProperty(visit, 'name', {
14810            value:
14811              'node (' + color$s(node.type + (name ? '<' + name + '>' : '')) + ')'
14812          });
14813        }
14814        return visit
14815        function visit() {
14816          let result = [];
14817          let subresult;
14818          let offset;
14819          let grandparents;
14820          if (!test || is(node, index, parents[parents.length - 1] || null)) {
14821            result = toResult$r(visitor(node, parents));
14822            if (result[0] === EXIT$r) {
14823              return result
14824            }
14825          }
14826          if (node.children && result[0] !== SKIP$r) {
14827            offset = (reverse ? node.children.length : -1) + step;
14828            grandparents = parents.concat(node);
14829            while (offset > -1 && offset < node.children.length) {
14830              subresult = factory(node.children[offset], offset, grandparents)();
14831              if (subresult[0] === EXIT$r) {
14832                return subresult
14833              }
14834              offset =
14835                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
14836            }
14837          }
14838          return result
14839        }
14840      }
14841    }
14842  );
14843function toResult$r(value) {
14844  if (Array.isArray(value)) {
14845    return value
14846  }
14847  if (typeof value === 'number') {
14848    return [CONTINUE$r, value]
14849  }
14850  return [value]
14851}
14852
14853const visit$r =
14854  (
14855    function (tree, test, visitor, reverse) {
14856      if (typeof test === 'function' && typeof visitor !== 'function') {
14857        reverse = visitor;
14858        visitor = test;
14859        test = null;
14860      }
14861      visitParents$r(tree, test, overload, reverse);
14862      function overload(node, parents) {
14863        const parent = parents[parents.length - 1];
14864        return visitor(
14865          node,
14866          parent ? parent.children.indexOf(node) : null,
14867          parent
14868        )
14869      }
14870    }
14871  );
14872
14873function headingStyle(node, relative) {
14874  const last = node.children[node.children.length - 1];
14875  const depth = node.depth;
14876  const pos = node.position && node.position.end;
14877  const final = last && last.position && last.position.end;
14878  if (!pos) {
14879    return null
14880  }
14881  if (!last) {
14882    if (pos.column - 1 <= depth * 2) {
14883      return consolidate(depth, relative)
14884    }
14885    return 'atx-closed'
14886  }
14887  if (final && final.line + 1 === pos.line) {
14888    return 'setext'
14889  }
14890  if (final && final.column + depth < pos.column) {
14891    return 'atx-closed'
14892  }
14893  return consolidate(depth, relative)
14894}
14895function consolidate(depth, relative) {
14896  return depth < 3
14897    ? 'atx'
14898    : relative === 'atx' || relative === 'setext'
14899    ? relative
14900    : null
14901}
14902
14903/**
14904 * ## When should I use this?
14905 *
14906 * You can use this package to check that there is on space between `#`
14907 * characters and the content in headings.
14908 *
14909 * ## API
14910 *
14911 * There are no options.
14912 *
14913 * ## Recommendation
14914 *
14915 * One space is required and more than one space has no effect.
14916 * Due to this, it’s recommended to turn this rule on.
14917 *
14918 * ## Fix
14919 *
14920 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
14921 * formats headings with exactly one space.
14922 *
14923 * @module no-heading-content-indent
14924 * @summary
14925 *   remark-lint rule to warn when there are too many spaces between
14926 *   hashes and content in headings.
14927 * @author Titus Wormer
14928 * @copyright 2015 Titus Wormer
14929 * @license MIT
14930 * @example
14931 *   {"name": "ok.md"}
14932 *
14933 *   #·Foo
14934 *
14935 *   ## Bar·##
14936 *
14937 *     ##·Baz
14938 *
14939 *   Setext headings are not affected.
14940 *
14941 *   Baz
14942 *   ===
14943 *
14944 * @example
14945 *   {"name": "not-ok.md", "label": "input"}
14946 *
14947 *   #··Foo
14948 *
14949 *   ## Bar··##
14950 *
14951 *     ##··Baz
14952 *
14953 * @example
14954 *   {"name": "not-ok.md", "label": "output"}
14955 *
14956 *   1:4: Remove 1 space before this heading’s content
14957 *   3:7: Remove 1 space after this heading’s content
14958 *   5:7: Remove 1 space before this heading’s content
14959 *
14960 * @example
14961 *   {"name": "empty-heading.md"}
14962 *
14963 *   #··
14964 */
14965const remarkLintNoHeadingContentIndent = lintRule(
14966  {
14967    origin: 'remark-lint:no-heading-content-indent',
14968    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-content-indent#readme'
14969  },
14970  (tree, file) => {
14971    visit$r(tree, 'heading', (node) => {
14972      if (generated(node)) {
14973        return
14974      }
14975      const type = headingStyle(node, 'atx');
14976      if (type === 'atx' || type === 'atx-closed') {
14977        const head = pointStart(node.children[0]).column;
14978        if (!head) {
14979          return
14980        }
14981        const diff = head - pointStart(node).column - 1 - node.depth;
14982        if (diff) {
14983          file.message(
14984            'Remove ' +
14985              Math.abs(diff) +
14986              ' ' +
14987              plural('space', Math.abs(diff)) +
14988              ' before this heading’s content',
14989            pointStart(node.children[0])
14990          );
14991        }
14992      }
14993      if (type === 'atx-closed') {
14994        const final = pointEnd(node.children[node.children.length - 1]);
14995        const diff = pointEnd(node).column - final.column - 1 - node.depth;
14996        if (diff) {
14997          file.message(
14998            'Remove ' +
14999              diff +
15000              ' ' +
15001              plural('space', diff) +
15002              ' after this heading’s content',
15003            final
15004          );
15005        }
15006      }
15007    });
15008  }
15009);
15010var remarkLintNoHeadingContentIndent$1 = remarkLintNoHeadingContentIndent;
15011
15012const convert$q =
15013  (
15014    function (test) {
15015      if (test === undefined || test === null) {
15016        return ok$q
15017      }
15018      if (typeof test === 'string') {
15019        return typeFactory$q(test)
15020      }
15021      if (typeof test === 'object') {
15022        return Array.isArray(test) ? anyFactory$q(test) : propsFactory$q(test)
15023      }
15024      if (typeof test === 'function') {
15025        return castFactory$q(test)
15026      }
15027      throw new Error('Expected function, string, or object as test')
15028    }
15029  );
15030function anyFactory$q(tests) {
15031  const checks = [];
15032  let index = -1;
15033  while (++index < tests.length) {
15034    checks[index] = convert$q(tests[index]);
15035  }
15036  return castFactory$q(any)
15037  function any(...parameters) {
15038    let index = -1;
15039    while (++index < checks.length) {
15040      if (checks[index].call(this, ...parameters)) return true
15041    }
15042    return false
15043  }
15044}
15045function propsFactory$q(check) {
15046  return castFactory$q(all)
15047  function all(node) {
15048    let key;
15049    for (key in check) {
15050      if (node[key] !== check[key]) return false
15051    }
15052    return true
15053  }
15054}
15055function typeFactory$q(check) {
15056  return castFactory$q(type)
15057  function type(node) {
15058    return node && node.type === check
15059  }
15060}
15061function castFactory$q(check) {
15062  return assertion
15063  function assertion(node, ...parameters) {
15064    return Boolean(
15065      node &&
15066        typeof node === 'object' &&
15067        'type' in node &&
15068        Boolean(check.call(this, node, ...parameters))
15069    )
15070  }
15071}
15072function ok$q() {
15073  return true
15074}
15075
15076function color$r(d) {
15077  return '\u001B[33m' + d + '\u001B[39m'
15078}
15079
15080const CONTINUE$q = true;
15081const EXIT$q = false;
15082const SKIP$q = 'skip';
15083const visitParents$q =
15084  (
15085    function (tree, test, visitor, reverse) {
15086      if (typeof test === 'function' && typeof visitor !== 'function') {
15087        reverse = visitor;
15088        visitor = test;
15089        test = null;
15090      }
15091      const is = convert$q(test);
15092      const step = reverse ? -1 : 1;
15093      factory(tree, undefined, [])();
15094      function factory(node, index, parents) {
15095        const value = node && typeof node === 'object' ? node : {};
15096        if (typeof value.type === 'string') {
15097          const name =
15098            typeof value.tagName === 'string'
15099              ? value.tagName
15100              :
15101              typeof value.name === 'string'
15102              ? value.name
15103              : undefined;
15104          Object.defineProperty(visit, 'name', {
15105            value:
15106              'node (' + color$r(node.type + (name ? '<' + name + '>' : '')) + ')'
15107          });
15108        }
15109        return visit
15110        function visit() {
15111          let result = [];
15112          let subresult;
15113          let offset;
15114          let grandparents;
15115          if (!test || is(node, index, parents[parents.length - 1] || null)) {
15116            result = toResult$q(visitor(node, parents));
15117            if (result[0] === EXIT$q) {
15118              return result
15119            }
15120          }
15121          if (node.children && result[0] !== SKIP$q) {
15122            offset = (reverse ? node.children.length : -1) + step;
15123            grandparents = parents.concat(node);
15124            while (offset > -1 && offset < node.children.length) {
15125              subresult = factory(node.children[offset], offset, grandparents)();
15126              if (subresult[0] === EXIT$q) {
15127                return subresult
15128              }
15129              offset =
15130                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
15131            }
15132          }
15133          return result
15134        }
15135      }
15136    }
15137  );
15138function toResult$q(value) {
15139  if (Array.isArray(value)) {
15140    return value
15141  }
15142  if (typeof value === 'number') {
15143    return [CONTINUE$q, value]
15144  }
15145  return [value]
15146}
15147
15148const visit$q =
15149  (
15150    function (tree, test, visitor, reverse) {
15151      if (typeof test === 'function' && typeof visitor !== 'function') {
15152        reverse = visitor;
15153        visitor = test;
15154        test = null;
15155      }
15156      visitParents$q(tree, test, overload, reverse);
15157      function overload(node, parents) {
15158        const parent = parents[parents.length - 1];
15159        return visitor(
15160          node,
15161          parent ? parent.children.indexOf(node) : null,
15162          parent
15163        )
15164      }
15165    }
15166  );
15167
15168const emptyOptions = {};
15169function toString(value, options) {
15170  const settings = options || emptyOptions;
15171  const includeImageAlt =
15172    typeof settings.includeImageAlt === 'boolean'
15173      ? settings.includeImageAlt
15174      : true;
15175  const includeHtml =
15176    typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true;
15177  return one(value, includeImageAlt, includeHtml)
15178}
15179function one(value, includeImageAlt, includeHtml) {
15180  if (node(value)) {
15181    if ('value' in value) {
15182      return value.type === 'html' && !includeHtml ? '' : value.value
15183    }
15184    if (includeImageAlt && 'alt' in value && value.alt) {
15185      return value.alt
15186    }
15187    if ('children' in value) {
15188      return all(value.children, includeImageAlt, includeHtml)
15189    }
15190  }
15191  if (Array.isArray(value)) {
15192    return all(value, includeImageAlt, includeHtml)
15193  }
15194  return ''
15195}
15196function all(values, includeImageAlt, includeHtml) {
15197  const result = [];
15198  let index = -1;
15199  while (++index < values.length) {
15200    result[index] = one(values[index], includeImageAlt, includeHtml);
15201  }
15202  return result.join('')
15203}
15204function node(value) {
15205  return Boolean(value && typeof value === 'object')
15206}
15207
15208/**
15209 * ## When should I use this?
15210 *
15211 * You can use this package to check that inline constructs (links) are
15212 * not padded.
15213 * Historically, it was possible to pad emphasis, strong, and strikethrough
15214 * too, but this was removed in CommonMark, making this rule much less useful.
15215 *
15216 * ## API
15217 *
15218 * There are no options.
15219 *
15220 * @module no-inline-padding
15221 * @summary
15222 *   remark-lint rule to warn when inline constructs are padded.
15223 * @author Titus Wormer
15224 * @copyright 2015 Titus Wormer
15225 * @license MIT
15226 * @example
15227 *   {"name": "ok.md"}
15228 *
15229 *   Alpha [bravo](http://echo.fox/trot)
15230 *
15231 * @example
15232 *   {"name": "not-ok.md", "label": "input"}
15233 *
15234 *   Alpha [ bravo ](http://echo.fox/trot)
15235 *
15236 * @example
15237 *   {"name": "not-ok.md", "label": "output"}
15238 *
15239 *   1:7-1:38: Don’t pad `link` with inner spaces
15240 */
15241const remarkLintNoInlinePadding = lintRule(
15242  {
15243    origin: 'remark-lint:no-inline-padding',
15244    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-inline-padding#readme'
15245  },
15246  (tree, file) => {
15247    visit$q(tree, (node) => {
15248      if (
15249        (node.type === 'link' || node.type === 'linkReference') &&
15250        !generated(node)
15251      ) {
15252        const value = toString(node);
15253        if (value.charAt(0) === ' ' || value.charAt(value.length - 1) === ' ') {
15254          file.message('Don’t pad `' + node.type + '` with inner spaces', node);
15255        }
15256      }
15257    });
15258  }
15259);
15260var remarkLintNoInlinePadding$1 = remarkLintNoInlinePadding;
15261
15262const convert$p =
15263  (
15264    function (test) {
15265      if (test === undefined || test === null) {
15266        return ok$p
15267      }
15268      if (typeof test === 'string') {
15269        return typeFactory$p(test)
15270      }
15271      if (typeof test === 'object') {
15272        return Array.isArray(test) ? anyFactory$p(test) : propsFactory$p(test)
15273      }
15274      if (typeof test === 'function') {
15275        return castFactory$p(test)
15276      }
15277      throw new Error('Expected function, string, or object as test')
15278    }
15279  );
15280function anyFactory$p(tests) {
15281  const checks = [];
15282  let index = -1;
15283  while (++index < tests.length) {
15284    checks[index] = convert$p(tests[index]);
15285  }
15286  return castFactory$p(any)
15287  function any(...parameters) {
15288    let index = -1;
15289    while (++index < checks.length) {
15290      if (checks[index].call(this, ...parameters)) return true
15291    }
15292    return false
15293  }
15294}
15295function propsFactory$p(check) {
15296  return castFactory$p(all)
15297  function all(node) {
15298    let key;
15299    for (key in check) {
15300      if (node[key] !== check[key]) return false
15301    }
15302    return true
15303  }
15304}
15305function typeFactory$p(check) {
15306  return castFactory$p(type)
15307  function type(node) {
15308    return node && node.type === check
15309  }
15310}
15311function castFactory$p(check) {
15312  return assertion
15313  function assertion(node, ...parameters) {
15314    return Boolean(
15315      node &&
15316        typeof node === 'object' &&
15317        'type' in node &&
15318        Boolean(check.call(this, node, ...parameters))
15319    )
15320  }
15321}
15322function ok$p() {
15323  return true
15324}
15325
15326function color$q(d) {
15327  return '\u001B[33m' + d + '\u001B[39m'
15328}
15329
15330const CONTINUE$p = true;
15331const EXIT$p = false;
15332const SKIP$p = 'skip';
15333const visitParents$p =
15334  (
15335    function (tree, test, visitor, reverse) {
15336      if (typeof test === 'function' && typeof visitor !== 'function') {
15337        reverse = visitor;
15338        visitor = test;
15339        test = null;
15340      }
15341      const is = convert$p(test);
15342      const step = reverse ? -1 : 1;
15343      factory(tree, undefined, [])();
15344      function factory(node, index, parents) {
15345        const value = node && typeof node === 'object' ? node : {};
15346        if (typeof value.type === 'string') {
15347          const name =
15348            typeof value.tagName === 'string'
15349              ? value.tagName
15350              :
15351              typeof value.name === 'string'
15352              ? value.name
15353              : undefined;
15354          Object.defineProperty(visit, 'name', {
15355            value:
15356              'node (' + color$q(node.type + (name ? '<' + name + '>' : '')) + ')'
15357          });
15358        }
15359        return visit
15360        function visit() {
15361          let result = [];
15362          let subresult;
15363          let offset;
15364          let grandparents;
15365          if (!test || is(node, index, parents[parents.length - 1] || null)) {
15366            result = toResult$p(visitor(node, parents));
15367            if (result[0] === EXIT$p) {
15368              return result
15369            }
15370          }
15371          if (node.children && result[0] !== SKIP$p) {
15372            offset = (reverse ? node.children.length : -1) + step;
15373            grandparents = parents.concat(node);
15374            while (offset > -1 && offset < node.children.length) {
15375              subresult = factory(node.children[offset], offset, grandparents)();
15376              if (subresult[0] === EXIT$p) {
15377                return subresult
15378              }
15379              offset =
15380                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
15381            }
15382          }
15383          return result
15384        }
15385      }
15386    }
15387  );
15388function toResult$p(value) {
15389  if (Array.isArray(value)) {
15390    return value
15391  }
15392  if (typeof value === 'number') {
15393    return [CONTINUE$p, value]
15394  }
15395  return [value]
15396}
15397
15398const visit$p =
15399  (
15400    function (tree, test, visitor, reverse) {
15401      if (typeof test === 'function' && typeof visitor !== 'function') {
15402        reverse = visitor;
15403        visitor = test;
15404        test = null;
15405      }
15406      visitParents$p(tree, test, overload, reverse);
15407      function overload(node, parents) {
15408        const parent = parents[parents.length - 1];
15409        return visitor(
15410          node,
15411          parent ? parent.children.indexOf(node) : null,
15412          parent
15413        )
15414      }
15415    }
15416  );
15417
15418/**
15419 * ## When should I use this?
15420 *
15421 * You can use this package to check that collapsed or full reference images
15422 * are used.
15423 *
15424 * ## API
15425 *
15426 * There are no options.
15427 *
15428 * ## Recommendation
15429 *
15430 * Shortcut references use an implicit style that looks a lot like something
15431 * that could occur as plain text instead of syntax.
15432 * In some cases, plain text is intended instead of an image.
15433 * Due to this, it’s recommended to use collapsed (or full) references
15434 * instead.
15435 *
15436 * @module no-shortcut-reference-image
15437 * @summary
15438 *   remark-lint rule to warn when shortcut reference images are used.
15439 * @author Titus Wormer
15440 * @copyright 2015 Titus Wormer
15441 * @license MIT
15442 * @example
15443 *   {"name": "ok.md"}
15444 *
15445 *   ![foo][]
15446 *
15447 *   [foo]: http://foo.bar/baz.png
15448 *
15449 * @example
15450 *   {"name": "not-ok.md", "label": "input"}
15451 *
15452 *   ![foo]
15453 *
15454 *   [foo]: http://foo.bar/baz.png
15455 *
15456 * @example
15457 *   {"name": "not-ok.md", "label": "output"}
15458 *
15459 *   1:1-1:7: Use the trailing [] on reference images
15460 */
15461const remarkLintNoShortcutReferenceImage = lintRule(
15462  {
15463    origin: 'remark-lint:no-shortcut-reference-image',
15464    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-shortcut-reference-image#readme'
15465  },
15466  (tree, file) => {
15467    visit$p(tree, 'imageReference', (node) => {
15468      if (!generated(node) && node.referenceType === 'shortcut') {
15469        file.message('Use the trailing [] on reference images', node);
15470      }
15471    });
15472  }
15473);
15474var remarkLintNoShortcutReferenceImage$1 = remarkLintNoShortcutReferenceImage;
15475
15476const convert$o =
15477  (
15478    function (test) {
15479      if (test === undefined || test === null) {
15480        return ok$o
15481      }
15482      if (typeof test === 'string') {
15483        return typeFactory$o(test)
15484      }
15485      if (typeof test === 'object') {
15486        return Array.isArray(test) ? anyFactory$o(test) : propsFactory$o(test)
15487      }
15488      if (typeof test === 'function') {
15489        return castFactory$o(test)
15490      }
15491      throw new Error('Expected function, string, or object as test')
15492    }
15493  );
15494function anyFactory$o(tests) {
15495  const checks = [];
15496  let index = -1;
15497  while (++index < tests.length) {
15498    checks[index] = convert$o(tests[index]);
15499  }
15500  return castFactory$o(any)
15501  function any(...parameters) {
15502    let index = -1;
15503    while (++index < checks.length) {
15504      if (checks[index].call(this, ...parameters)) return true
15505    }
15506    return false
15507  }
15508}
15509function propsFactory$o(check) {
15510  return castFactory$o(all)
15511  function all(node) {
15512    let key;
15513    for (key in check) {
15514      if (node[key] !== check[key]) return false
15515    }
15516    return true
15517  }
15518}
15519function typeFactory$o(check) {
15520  return castFactory$o(type)
15521  function type(node) {
15522    return node && node.type === check
15523  }
15524}
15525function castFactory$o(check) {
15526  return assertion
15527  function assertion(node, ...parameters) {
15528    return Boolean(
15529      node &&
15530        typeof node === 'object' &&
15531        'type' in node &&
15532        Boolean(check.call(this, node, ...parameters))
15533    )
15534  }
15535}
15536function ok$o() {
15537  return true
15538}
15539
15540function color$p(d) {
15541  return '\u001B[33m' + d + '\u001B[39m'
15542}
15543
15544const CONTINUE$o = true;
15545const EXIT$o = false;
15546const SKIP$o = 'skip';
15547const visitParents$o =
15548  (
15549    function (tree, test, visitor, reverse) {
15550      if (typeof test === 'function' && typeof visitor !== 'function') {
15551        reverse = visitor;
15552        visitor = test;
15553        test = null;
15554      }
15555      const is = convert$o(test);
15556      const step = reverse ? -1 : 1;
15557      factory(tree, undefined, [])();
15558      function factory(node, index, parents) {
15559        const value = node && typeof node === 'object' ? node : {};
15560        if (typeof value.type === 'string') {
15561          const name =
15562            typeof value.tagName === 'string'
15563              ? value.tagName
15564              :
15565              typeof value.name === 'string'
15566              ? value.name
15567              : undefined;
15568          Object.defineProperty(visit, 'name', {
15569            value:
15570              'node (' + color$p(node.type + (name ? '<' + name + '>' : '')) + ')'
15571          });
15572        }
15573        return visit
15574        function visit() {
15575          let result = [];
15576          let subresult;
15577          let offset;
15578          let grandparents;
15579          if (!test || is(node, index, parents[parents.length - 1] || null)) {
15580            result = toResult$o(visitor(node, parents));
15581            if (result[0] === EXIT$o) {
15582              return result
15583            }
15584          }
15585          if (node.children && result[0] !== SKIP$o) {
15586            offset = (reverse ? node.children.length : -1) + step;
15587            grandparents = parents.concat(node);
15588            while (offset > -1 && offset < node.children.length) {
15589              subresult = factory(node.children[offset], offset, grandparents)();
15590              if (subresult[0] === EXIT$o) {
15591                return subresult
15592              }
15593              offset =
15594                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
15595            }
15596          }
15597          return result
15598        }
15599      }
15600    }
15601  );
15602function toResult$o(value) {
15603  if (Array.isArray(value)) {
15604    return value
15605  }
15606  if (typeof value === 'number') {
15607    return [CONTINUE$o, value]
15608  }
15609  return [value]
15610}
15611
15612const visit$o =
15613  (
15614    function (tree, test, visitor, reverse) {
15615      if (typeof test === 'function' && typeof visitor !== 'function') {
15616        reverse = visitor;
15617        visitor = test;
15618        test = null;
15619      }
15620      visitParents$o(tree, test, overload, reverse);
15621      function overload(node, parents) {
15622        const parent = parents[parents.length - 1];
15623        return visitor(
15624          node,
15625          parent ? parent.children.indexOf(node) : null,
15626          parent
15627        )
15628      }
15629    }
15630  );
15631
15632/**
15633 * ## When should I use this?
15634 *
15635 * You can use this package to check that collapsed or full reference links
15636 * are used.
15637 *
15638 * ## API
15639 *
15640 * There are no options.
15641 *
15642 * ## Recommendation
15643 *
15644 * Shortcut references use an implicit style that looks a lot like something
15645 * that could occur as plain text instead of syntax.
15646 * In some cases, plain text is intended instead of a link.
15647 * Due to this, it’s recommended to use collapsed (or full) references
15648 * instead.
15649 *
15650 * @module no-shortcut-reference-link
15651 * @summary
15652 *   remark-lint rule to warn when shortcut reference links are used.
15653 * @author Titus Wormer
15654 * @copyright 2015 Titus Wormer
15655 * @license MIT
15656 * @example
15657 *   {"name": "ok.md"}
15658 *
15659 *   [foo][]
15660 *
15661 *   [foo]: http://foo.bar/baz
15662 *
15663 * @example
15664 *   {"name": "not-ok.md", "label": "input"}
15665 *
15666 *   [foo]
15667 *
15668 *   [foo]: http://foo.bar/baz
15669 *
15670 * @example
15671 *   {"name": "not-ok.md", "label": "output"}
15672 *
15673 *   1:1-1:6: Use the trailing `[]` on reference links
15674 */
15675const remarkLintNoShortcutReferenceLink = lintRule(
15676  {
15677    origin: 'remark-lint:no-shortcut-reference-link',
15678    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-shortcut-reference-link#readme'
15679  },
15680  (tree, file) => {
15681    visit$o(tree, 'linkReference', (node) => {
15682      if (!generated(node) && node.referenceType === 'shortcut') {
15683        file.message('Use the trailing `[]` on reference links', node);
15684      }
15685    });
15686  }
15687);
15688var remarkLintNoShortcutReferenceLink$1 = remarkLintNoShortcutReferenceLink;
15689
15690function normalizeIdentifier(value) {
15691  return (
15692    value
15693      .replace(/[\t\n\r ]+/g, ' ')
15694      .replace(/^ | $/g, '')
15695      .toLowerCase()
15696      .toUpperCase()
15697  )
15698}
15699
15700const convert$n =
15701  (
15702    function (test) {
15703      if (test === undefined || test === null) {
15704        return ok$n
15705      }
15706      if (typeof test === 'string') {
15707        return typeFactory$n(test)
15708      }
15709      if (typeof test === 'object') {
15710        return Array.isArray(test) ? anyFactory$n(test) : propsFactory$n(test)
15711      }
15712      if (typeof test === 'function') {
15713        return castFactory$n(test)
15714      }
15715      throw new Error('Expected function, string, or object as test')
15716    }
15717  );
15718function anyFactory$n(tests) {
15719  const checks = [];
15720  let index = -1;
15721  while (++index < tests.length) {
15722    checks[index] = convert$n(tests[index]);
15723  }
15724  return castFactory$n(any)
15725  function any(...parameters) {
15726    let index = -1;
15727    while (++index < checks.length) {
15728      if (checks[index].call(this, ...parameters)) return true
15729    }
15730    return false
15731  }
15732}
15733function propsFactory$n(check) {
15734  return castFactory$n(all)
15735  function all(node) {
15736    let key;
15737    for (key in check) {
15738      if (node[key] !== check[key]) return false
15739    }
15740    return true
15741  }
15742}
15743function typeFactory$n(check) {
15744  return castFactory$n(type)
15745  function type(node) {
15746    return node && node.type === check
15747  }
15748}
15749function castFactory$n(check) {
15750  return assertion
15751  function assertion(node, ...parameters) {
15752    return Boolean(
15753      node &&
15754        typeof node === 'object' &&
15755        'type' in node &&
15756        Boolean(check.call(this, node, ...parameters))
15757    )
15758  }
15759}
15760function ok$n() {
15761  return true
15762}
15763
15764function color$o(d) {
15765  return '\u001B[33m' + d + '\u001B[39m'
15766}
15767
15768const CONTINUE$n = true;
15769const EXIT$n = false;
15770const SKIP$n = 'skip';
15771const visitParents$n =
15772  (
15773    function (tree, test, visitor, reverse) {
15774      if (typeof test === 'function' && typeof visitor !== 'function') {
15775        reverse = visitor;
15776        visitor = test;
15777        test = null;
15778      }
15779      const is = convert$n(test);
15780      const step = reverse ? -1 : 1;
15781      factory(tree, undefined, [])();
15782      function factory(node, index, parents) {
15783        const value = node && typeof node === 'object' ? node : {};
15784        if (typeof value.type === 'string') {
15785          const name =
15786            typeof value.tagName === 'string'
15787              ? value.tagName
15788              :
15789              typeof value.name === 'string'
15790              ? value.name
15791              : undefined;
15792          Object.defineProperty(visit, 'name', {
15793            value:
15794              'node (' + color$o(node.type + (name ? '<' + name + '>' : '')) + ')'
15795          });
15796        }
15797        return visit
15798        function visit() {
15799          let result = [];
15800          let subresult;
15801          let offset;
15802          let grandparents;
15803          if (!test || is(node, index, parents[parents.length - 1] || null)) {
15804            result = toResult$n(visitor(node, parents));
15805            if (result[0] === EXIT$n) {
15806              return result
15807            }
15808          }
15809          if (node.children && result[0] !== SKIP$n) {
15810            offset = (reverse ? node.children.length : -1) + step;
15811            grandparents = parents.concat(node);
15812            while (offset > -1 && offset < node.children.length) {
15813              subresult = factory(node.children[offset], offset, grandparents)();
15814              if (subresult[0] === EXIT$n) {
15815                return subresult
15816              }
15817              offset =
15818                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
15819            }
15820          }
15821          return result
15822        }
15823      }
15824    }
15825  );
15826function toResult$n(value) {
15827  if (Array.isArray(value)) {
15828    return value
15829  }
15830  if (typeof value === 'number') {
15831    return [CONTINUE$n, value]
15832  }
15833  return [value]
15834}
15835
15836const visit$n =
15837  (
15838    function (tree, test, visitor, reverse) {
15839      if (typeof test === 'function' && typeof visitor !== 'function') {
15840        reverse = visitor;
15841        visitor = test;
15842        test = null;
15843      }
15844      visitParents$n(tree, test, overload, reverse);
15845      function overload(node, parents) {
15846        const parent = parents[parents.length - 1];
15847        return visitor(
15848          node,
15849          parent ? parent.children.indexOf(node) : null,
15850          parent
15851        )
15852      }
15853    }
15854  );
15855
15856/**
15857 * ## When should I use this?
15858 *
15859 * You can use this package to check that referenced definitions are defined.
15860 *
15861 * ## API
15862 *
15863 * The following options (default: `undefined`) are accepted:
15864 *
15865 * *   `Object` with the following fields:
15866 *     *   `allow` (`Array<string | RegExp | { source: string }>`,
15867 *         default: `[]`)
15868 *         — text or regex that you want to be allowed between `[` and `]`
15869 *         even though it’s undefined; regex is provided via a `RegExp` object
15870 *         or via a `{source: string}` object where `source` is the source
15871 *         text of a case-insensitive regex
15872 *
15873 * ## Recommendation
15874 *
15875 * Shortcut references use an implicit syntax that could also occur as plain
15876 * text.
15877 * For example, it is reasonable to expect an author adding `[…]` to abbreviate
15878 * some text somewhere in a document:
15879 *
15880 * ```markdown
15881 * > Some […] quote.
15882 * ```
15883 *
15884 * This isn’t a problem, but it might become one when an author later adds a
15885 * definition:
15886 *
15887 * ```markdown
15888 * Some text. […][]
15889 *
15890 * […] #read-more "Read more"
15891 * ```
15892 *
15893 * The second author might expect only their newly added text to form a link,
15894 * but their changes also result in a link for the first author’s text.
15895 *
15896 * @module no-undefined-references
15897 * @summary
15898 *   remark-lint rule to warn when undefined definitions are referenced.
15899 * @author Titus Wormer
15900 * @copyright 2016 Titus Wormer
15901 * @license MIT
15902 * @example
15903 *   {"name": "ok.md"}
15904 *
15905 *   [foo][]
15906 *
15907 *   Just a [ bracket.
15908 *
15909 *   Typically, you’d want to use escapes (with a backslash: \\) to escape what
15910 *   could turn into a \[reference otherwise].
15911 *
15912 *   Just two braces can’t link: [].
15913 *
15914 *   [foo]: https://example.com
15915 *
15916 * @example
15917 *   {"name": "ok-allow.md", "config": {"allow": ["...", "…"]}}
15918 *
15919 *   > Eliding a portion of a quoted passage […] is acceptable.
15920 *
15921 * @example
15922 *   {"name": "ok-allow.md", "config": {"allow": ["a", {"source": "^b\\."}]}}
15923 *
15924 *   [foo][b.c]
15925 *
15926 *   [bar][a]
15927 *
15928 *   Matching is case-insensitive: [bar][B.C]
15929 *
15930 * @example
15931 *   {"name": "not-ok.md", "label": "input"}
15932 *
15933 *   [bar]
15934 *
15935 *   [baz][]
15936 *
15937 *   [text][qux]
15938 *
15939 *   Spread [over
15940 *   lines][]
15941 *
15942 *   > in [a
15943 *   > block quote][]
15944 *
15945 *   [asd][a
15946 *
15947 *   Can include [*emphasis*].
15948 *
15949 *   Multiple pairs: [a][b][c].
15950 *
15951 * @example
15952 *   {"name": "not-ok.md", "label": "output"}
15953 *
15954 *   1:1-1:6: Found reference to undefined definition
15955 *   3:1-3:8: Found reference to undefined definition
15956 *   5:1-5:12: Found reference to undefined definition
15957 *   7:8-8:9: Found reference to undefined definition
15958 *   10:6-11:17: Found reference to undefined definition
15959 *   13:1-13:6: Found reference to undefined definition
15960 *   15:13-15:25: Found reference to undefined definition
15961 *   17:17-17:23: Found reference to undefined definition
15962 *   17:23-17:26: Found reference to undefined definition
15963 *
15964 * @example
15965 *   {"name": "not-ok.md", "label": "input", "config": {"allow": ["a", {"source": "^b\\."}]}}
15966 *
15967 *   [foo][a.c]
15968 *
15969 *   [bar][b]
15970 *
15971 * @example
15972 *   {"name": "not-ok.md", "label": "output", "config": {"allow": ["a", {"source": "^b\\."}]}}
15973 *
15974 *   1:1-1:11: Found reference to undefined definition
15975 *   3:1-3:9: Found reference to undefined definition
15976 */
15977const remarkLintNoUndefinedReferences = lintRule(
15978  {
15979    origin: 'remark-lint:no-undefined-references',
15980    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-undefined-references#readme'
15981  },
15982  (tree, file, option = {}) => {
15983    const contents = String(file);
15984    const loc = location(file);
15985    const lineEnding = /(\r?\n|\r)[\t ]*(>[\t ]*)*/g;
15986    const map = Object.create(null);
15987    const allow = option.allow || [];
15988    const regexes = [];
15989    const strings = new Set();
15990    let index = -1;
15991    while (++index < allow.length) {
15992      const value = allow[index];
15993      if (typeof value === 'string') {
15994        strings.add(normalizeIdentifier(value));
15995      } else if (value instanceof RegExp) {
15996        regexes.push(value);
15997      } else {
15998        regexes.push(new RegExp(value.source, 'i'));
15999      }
16000    }
16001    visit$n(tree, (node) => {
16002      if (
16003        (node.type === 'definition' || node.type === 'footnoteDefinition') &&
16004        !generated(node)
16005      ) {
16006        map[normalizeIdentifier(node.identifier)] = true;
16007      }
16008    });
16009    visit$n(tree, (node) => {
16010      if (
16011        (node.type === 'imageReference' ||
16012          node.type === 'linkReference' ||
16013          node.type === 'footnoteReference') &&
16014        !generated(node) &&
16015        !(normalizeIdentifier(node.identifier) in map) &&
16016        !isAllowed(node.identifier)
16017      ) {
16018        file.message('Found reference to undefined definition', node);
16019      }
16020      if (node.type === 'paragraph' || node.type === 'heading') {
16021        findInPhrasing(node);
16022      }
16023    });
16024    function findInPhrasing(node) {
16025      let ranges = [];
16026      visit$n(node, (child) => {
16027        if (child === node) return
16028        if (child.type === 'link' || child.type === 'linkReference') {
16029          ranges = [];
16030          return SKIP$n
16031        }
16032        if (child.type !== 'text') return
16033        const start = pointStart(child).offset;
16034        const end = pointEnd(child).offset;
16035        if (typeof start !== 'number' || typeof end !== 'number') {
16036          return EXIT$n
16037        }
16038        const source = contents.slice(start, end);
16039        const lines = [[start, '']];
16040        let last = 0;
16041        lineEnding.lastIndex = 0;
16042        let match = lineEnding.exec(source);
16043        while (match) {
16044          const index = match.index;
16045          lines[lines.length - 1][1] = source.slice(last, index);
16046          last = index + match[0].length;
16047          lines.push([start + last, '']);
16048          match = lineEnding.exec(source);
16049        }
16050        lines[lines.length - 1][1] = source.slice(last);
16051        let lineIndex = -1;
16052        while (++lineIndex < lines.length) {
16053          const line = lines[lineIndex][1];
16054          let index = 0;
16055          while (index < line.length) {
16056            const code = line.charCodeAt(index);
16057            if (code === 92) {
16058              const next = line.charCodeAt(index + 1);
16059              index++;
16060              if (next === 91 || next === 93) {
16061                index++;
16062              }
16063            }
16064            else if (code === 91) {
16065              ranges.push([lines[lineIndex][0] + index]);
16066              index++;
16067            }
16068            else if (code === 93) {
16069              if (ranges.length === 0) {
16070                index++;
16071              } else if (line.charCodeAt(index + 1) === 91) {
16072                index++;
16073                let range = ranges.pop();
16074                if (range) {
16075                  range.push(lines[lineIndex][0] + index);
16076                  if (range.length === 4) {
16077                    handleRange(range);
16078                    range = [];
16079                  }
16080                  range.push(lines[lineIndex][0] + index);
16081                  ranges.push(range);
16082                  index++;
16083                }
16084              } else {
16085                index++;
16086                const range = ranges.pop();
16087                if (range) {
16088                  range.push(lines[lineIndex][0] + index);
16089                  handleRange(range);
16090                }
16091              }
16092            }
16093            else {
16094              index++;
16095            }
16096          }
16097        }
16098      });
16099      let index = -1;
16100      while (++index < ranges.length) {
16101        handleRange(ranges[index]);
16102      }
16103      return SKIP$n
16104      function handleRange(range) {
16105        if (range.length === 1) return
16106        if (range.length === 3) range.length = 2;
16107        if (range.length === 2 && range[0] + 2 === range[1]) return
16108        const offset = range.length === 4 && range[2] + 2 !== range[3] ? 2 : 0;
16109        const id = contents
16110          .slice(range[0 + offset] + 1, range[1 + offset] - 1)
16111          .replace(lineEnding, ' ');
16112        const pos = {
16113          start: loc.toPoint(range[0]),
16114          end: loc.toPoint(range[range.length - 1])
16115        };
16116        if (
16117          !generated({position: pos}) &&
16118          !(normalizeIdentifier(id) in map) &&
16119          !isAllowed(id)
16120        ) {
16121          file.message('Found reference to undefined definition', pos);
16122        }
16123      }
16124    }
16125    function isAllowed(id) {
16126      const normalized = normalizeIdentifier(id);
16127      return (
16128        strings.has(normalized) ||
16129        regexes.some((regex) => regex.test(normalized))
16130      )
16131    }
16132  }
16133);
16134var remarkLintNoUndefinedReferences$1 = remarkLintNoUndefinedReferences;
16135
16136const convert$m =
16137  (
16138    function (test) {
16139      if (test === undefined || test === null) {
16140        return ok$m
16141      }
16142      if (typeof test === 'string') {
16143        return typeFactory$m(test)
16144      }
16145      if (typeof test === 'object') {
16146        return Array.isArray(test) ? anyFactory$m(test) : propsFactory$m(test)
16147      }
16148      if (typeof test === 'function') {
16149        return castFactory$m(test)
16150      }
16151      throw new Error('Expected function, string, or object as test')
16152    }
16153  );
16154function anyFactory$m(tests) {
16155  const checks = [];
16156  let index = -1;
16157  while (++index < tests.length) {
16158    checks[index] = convert$m(tests[index]);
16159  }
16160  return castFactory$m(any)
16161  function any(...parameters) {
16162    let index = -1;
16163    while (++index < checks.length) {
16164      if (checks[index].call(this, ...parameters)) return true
16165    }
16166    return false
16167  }
16168}
16169function propsFactory$m(check) {
16170  return castFactory$m(all)
16171  function all(node) {
16172    let key;
16173    for (key in check) {
16174      if (node[key] !== check[key]) return false
16175    }
16176    return true
16177  }
16178}
16179function typeFactory$m(check) {
16180  return castFactory$m(type)
16181  function type(node) {
16182    return node && node.type === check
16183  }
16184}
16185function castFactory$m(check) {
16186  return assertion
16187  function assertion(node, ...parameters) {
16188    return Boolean(
16189      node &&
16190        typeof node === 'object' &&
16191        'type' in node &&
16192        Boolean(check.call(this, node, ...parameters))
16193    )
16194  }
16195}
16196function ok$m() {
16197  return true
16198}
16199
16200function color$n(d) {
16201  return '\u001B[33m' + d + '\u001B[39m'
16202}
16203
16204const CONTINUE$m = true;
16205const EXIT$m = false;
16206const SKIP$m = 'skip';
16207const visitParents$m =
16208  (
16209    function (tree, test, visitor, reverse) {
16210      if (typeof test === 'function' && typeof visitor !== 'function') {
16211        reverse = visitor;
16212        visitor = test;
16213        test = null;
16214      }
16215      const is = convert$m(test);
16216      const step = reverse ? -1 : 1;
16217      factory(tree, undefined, [])();
16218      function factory(node, index, parents) {
16219        const value = node && typeof node === 'object' ? node : {};
16220        if (typeof value.type === 'string') {
16221          const name =
16222            typeof value.tagName === 'string'
16223              ? value.tagName
16224              :
16225              typeof value.name === 'string'
16226              ? value.name
16227              : undefined;
16228          Object.defineProperty(visit, 'name', {
16229            value:
16230              'node (' + color$n(node.type + (name ? '<' + name + '>' : '')) + ')'
16231          });
16232        }
16233        return visit
16234        function visit() {
16235          let result = [];
16236          let subresult;
16237          let offset;
16238          let grandparents;
16239          if (!test || is(node, index, parents[parents.length - 1] || null)) {
16240            result = toResult$m(visitor(node, parents));
16241            if (result[0] === EXIT$m) {
16242              return result
16243            }
16244          }
16245          if (node.children && result[0] !== SKIP$m) {
16246            offset = (reverse ? node.children.length : -1) + step;
16247            grandparents = parents.concat(node);
16248            while (offset > -1 && offset < node.children.length) {
16249              subresult = factory(node.children[offset], offset, grandparents)();
16250              if (subresult[0] === EXIT$m) {
16251                return subresult
16252              }
16253              offset =
16254                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
16255            }
16256          }
16257          return result
16258        }
16259      }
16260    }
16261  );
16262function toResult$m(value) {
16263  if (Array.isArray(value)) {
16264    return value
16265  }
16266  if (typeof value === 'number') {
16267    return [CONTINUE$m, value]
16268  }
16269  return [value]
16270}
16271
16272const visit$m =
16273  (
16274    function (tree, test, visitor, reverse) {
16275      if (typeof test === 'function' && typeof visitor !== 'function') {
16276        reverse = visitor;
16277        visitor = test;
16278        test = null;
16279      }
16280      visitParents$m(tree, test, overload, reverse);
16281      function overload(node, parents) {
16282        const parent = parents[parents.length - 1];
16283        return visitor(
16284          node,
16285          parent ? parent.children.indexOf(node) : null,
16286          parent
16287        )
16288      }
16289    }
16290  );
16291
16292/**
16293 * ## When should I use this?
16294 *
16295 * You can use this package to check definitions are referenced.
16296 *
16297 * ## API
16298 *
16299 * There are no options.
16300 *
16301 * ## Recommendation
16302 *
16303 * Unused definitions do not contribute anything, so they can be removed.
16304 *
16305 * @module no-unused-definitions
16306 * @summary
16307 *   remark-lint rule to warn when unreferenced definitions are used.
16308 * @author Titus Wormer
16309 * @copyright 2016 Titus Wormer
16310 * @license MIT
16311 * @example
16312 *   {"name": "ok.md"}
16313 *
16314 *   [foo][]
16315 *
16316 *   [foo]: https://example.com
16317 *
16318 * @example
16319 *   {"name": "not-ok.md", "label": "input"}
16320 *
16321 *   [bar]: https://example.com
16322 *
16323 * @example
16324 *   {"name": "not-ok.md", "label": "output"}
16325 *
16326 *   1:1-1:27: Found unused definition
16327 */
16328const own = {}.hasOwnProperty;
16329const remarkLintNoUnusedDefinitions = lintRule(
16330  {
16331    origin: 'remark-lint:no-unused-definitions',
16332    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-unused-definitions#readme'
16333  },
16334  (tree, file) => {
16335    const map = Object.create(null);
16336    visit$m(tree, (node) => {
16337      if (
16338        (node.type === 'definition' || node.type === 'footnoteDefinition') &&
16339        !generated(node)
16340      ) {
16341        map[node.identifier.toUpperCase()] = {node, used: false};
16342      }
16343    });
16344    visit$m(tree, (node) => {
16345      if (
16346        node.type === 'imageReference' ||
16347        node.type === 'linkReference' ||
16348        node.type === 'footnoteReference'
16349      ) {
16350        const info = map[node.identifier.toUpperCase()];
16351        if (!generated(node) && info) {
16352          info.used = true;
16353        }
16354      }
16355    });
16356    let identifier;
16357    for (identifier in map) {
16358      if (own.call(map, identifier)) {
16359        const entry = map[identifier];
16360        if (!entry.used) {
16361          file.message('Found unused definition', entry.node);
16362        }
16363      }
16364    }
16365  }
16366);
16367var remarkLintNoUnusedDefinitions$1 = remarkLintNoUnusedDefinitions;
16368
16369const remarkPresetLintRecommended = {
16370  plugins: [
16371    remarkLint,
16372    remarkLintFinalNewline$1,
16373    remarkLintListItemBulletIndent$1,
16374    [remarkLintListItemIndent$1, 'tab-size'],
16375    remarkLintNoBlockquoteWithoutMarker$1,
16376    remarkLintNoLiteralUrls$1,
16377    [remarkLintOrderedListMarkerStyle$1, '.'],
16378    remarkLintHardBreakSpaces$1,
16379    remarkLintNoDuplicateDefinitions$1,
16380    remarkLintNoHeadingContentIndent$1,
16381    remarkLintNoInlinePadding$1,
16382    remarkLintNoShortcutReferenceImage$1,
16383    remarkLintNoShortcutReferenceLink$1,
16384    remarkLintNoUndefinedReferences$1,
16385    remarkLintNoUnusedDefinitions$1
16386  ]
16387};
16388var remarkPresetLintRecommended$1 = remarkPresetLintRecommended;
16389
16390const convert$l =
16391  (
16392    function (test) {
16393      if (test === undefined || test === null) {
16394        return ok$l
16395      }
16396      if (typeof test === 'string') {
16397        return typeFactory$l(test)
16398      }
16399      if (typeof test === 'object') {
16400        return Array.isArray(test) ? anyFactory$l(test) : propsFactory$l(test)
16401      }
16402      if (typeof test === 'function') {
16403        return castFactory$l(test)
16404      }
16405      throw new Error('Expected function, string, or object as test')
16406    }
16407  );
16408function anyFactory$l(tests) {
16409  const checks = [];
16410  let index = -1;
16411  while (++index < tests.length) {
16412    checks[index] = convert$l(tests[index]);
16413  }
16414  return castFactory$l(any)
16415  function any(...parameters) {
16416    let index = -1;
16417    while (++index < checks.length) {
16418      if (checks[index].call(this, ...parameters)) return true
16419    }
16420    return false
16421  }
16422}
16423function propsFactory$l(check) {
16424  return castFactory$l(all)
16425  function all(node) {
16426    let key;
16427    for (key in check) {
16428      if (node[key] !== check[key]) return false
16429    }
16430    return true
16431  }
16432}
16433function typeFactory$l(check) {
16434  return castFactory$l(type)
16435  function type(node) {
16436    return node && node.type === check
16437  }
16438}
16439function castFactory$l(check) {
16440  return assertion
16441  function assertion(node, ...parameters) {
16442    return Boolean(
16443      node &&
16444        typeof node === 'object' &&
16445        'type' in node &&
16446        Boolean(check.call(this, node, ...parameters))
16447    )
16448  }
16449}
16450function ok$l() {
16451  return true
16452}
16453
16454function color$m(d) {
16455  return '\u001B[33m' + d + '\u001B[39m'
16456}
16457
16458const CONTINUE$l = true;
16459const EXIT$l = false;
16460const SKIP$l = 'skip';
16461const visitParents$l =
16462  (
16463    function (tree, test, visitor, reverse) {
16464      if (typeof test === 'function' && typeof visitor !== 'function') {
16465        reverse = visitor;
16466        visitor = test;
16467        test = null;
16468      }
16469      const is = convert$l(test);
16470      const step = reverse ? -1 : 1;
16471      factory(tree, undefined, [])();
16472      function factory(node, index, parents) {
16473        const value = node && typeof node === 'object' ? node : {};
16474        if (typeof value.type === 'string') {
16475          const name =
16476            typeof value.tagName === 'string'
16477              ? value.tagName
16478              :
16479              typeof value.name === 'string'
16480              ? value.name
16481              : undefined;
16482          Object.defineProperty(visit, 'name', {
16483            value:
16484              'node (' + color$m(node.type + (name ? '<' + name + '>' : '')) + ')'
16485          });
16486        }
16487        return visit
16488        function visit() {
16489          let result = [];
16490          let subresult;
16491          let offset;
16492          let grandparents;
16493          if (!test || is(node, index, parents[parents.length - 1] || null)) {
16494            result = toResult$l(visitor(node, parents));
16495            if (result[0] === EXIT$l) {
16496              return result
16497            }
16498          }
16499          if (node.children && result[0] !== SKIP$l) {
16500            offset = (reverse ? node.children.length : -1) + step;
16501            grandparents = parents.concat(node);
16502            while (offset > -1 && offset < node.children.length) {
16503              subresult = factory(node.children[offset], offset, grandparents)();
16504              if (subresult[0] === EXIT$l) {
16505                return subresult
16506              }
16507              offset =
16508                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
16509            }
16510          }
16511          return result
16512        }
16513      }
16514    }
16515  );
16516function toResult$l(value) {
16517  if (Array.isArray(value)) {
16518    return value
16519  }
16520  if (typeof value === 'number') {
16521    return [CONTINUE$l, value]
16522  }
16523  return [value]
16524}
16525
16526const visit$l =
16527  (
16528    function (tree, test, visitor, reverse) {
16529      if (typeof test === 'function' && typeof visitor !== 'function') {
16530        reverse = visitor;
16531        visitor = test;
16532        test = null;
16533      }
16534      visitParents$l(tree, test, overload, reverse);
16535      function overload(node, parents) {
16536        const parent = parents[parents.length - 1];
16537        return visitor(
16538          node,
16539          parent ? parent.children.indexOf(node) : null,
16540          parent
16541        )
16542      }
16543    }
16544  );
16545
16546/**
16547 * ## When should I use this?
16548 *
16549 * You can use this package to check that the “indent” of block quotes is
16550 * consistent.
16551 * Indent here is the `>` (greater than) marker and the spaces before content.
16552 *
16553 * ## API
16554 *
16555 * The following options (default: `'consistent'`) are accepted:
16556 *
16557 * *   `number` (example: `2`)
16558 *     — preferred indent of `>` and spaces before content
16559 * *   `'consistent'`
16560 *     — detect the first used style and warn when further block quotes differ
16561 *
16562 * ## Recommendation
16563 *
16564 * CommonMark specifies that when block quotes are used the `>` markers can be
16565 * followed by an optional space.
16566 * No space at all arguably looks rather ugly:
16567 *
16568 * ```markdown
16569 * >Mars and
16570 * >Venus.
16571 * ```
16572 *
16573 * There is no specific handling of more that one space, so if 5 spaces were
16574 * used after `>`, then indented code kicks in:
16575 *
16576 * ```markdown
16577 * >     neptune()
16578 * ```
16579 *
16580 * Due to this, it’s recommended to configure this rule with `2`.
16581 *
16582 * @module blockquote-indentation
16583 * @summary
16584 *   remark-lint rule to warn when block quotes are indented too much or
16585 *   too little.
16586 * @author Titus Wormer
16587 * @copyright 2015 Titus Wormer
16588 * @license MIT
16589 * @example
16590 *   {"name": "ok.md", "config": 4}
16591 *
16592 *   >   Hello
16593 *
16594 *   Paragraph.
16595 *
16596 *   >   World
16597 * @example
16598 *   {"name": "ok.md", "config": 2}
16599 *
16600 *   > Hello
16601 *
16602 *   Paragraph.
16603 *
16604 *   > World
16605 *
16606 * @example
16607 *   {"name": "not-ok.md", "label": "input"}
16608 *
16609 *   >  Hello
16610 *
16611 *   Paragraph.
16612 *
16613 *   >   World
16614 *
16615 *   Paragraph.
16616 *
16617 *   > World
16618 *
16619 * @example
16620 *   {"name": "not-ok.md", "label": "output"}
16621 *
16622 *   5:5: Remove 1 space between block quote and content
16623 *   9:3: Add 1 space between block quote and content
16624 */
16625const remarkLintBlockquoteIndentation = lintRule(
16626  {
16627    origin: 'remark-lint:blockquote-indentation',
16628    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-blockquote-indentation#readme'
16629  },
16630  (tree, file, option = 'consistent') => {
16631    visit$l(tree, 'blockquote', (node) => {
16632      if (generated(node) || node.children.length === 0) {
16633        return
16634      }
16635      if (option === 'consistent') {
16636        option = check(node);
16637      } else {
16638        const diff = option - check(node);
16639        if (diff !== 0) {
16640          const abs = Math.abs(diff);
16641          file.message(
16642            (diff > 0 ? 'Add' : 'Remove') +
16643              ' ' +
16644              abs +
16645              ' ' +
16646              plural('space', abs) +
16647              ' between block quote and content',
16648            pointStart(node.children[0])
16649          );
16650        }
16651      }
16652    });
16653  }
16654);
16655var remarkLintBlockquoteIndentation$1 = remarkLintBlockquoteIndentation;
16656function check(node) {
16657  return pointStart(node.children[0]).column - pointStart(node).column
16658}
16659
16660const convert$k =
16661  (
16662    function (test) {
16663      if (test === undefined || test === null) {
16664        return ok$k
16665      }
16666      if (typeof test === 'string') {
16667        return typeFactory$k(test)
16668      }
16669      if (typeof test === 'object') {
16670        return Array.isArray(test) ? anyFactory$k(test) : propsFactory$k(test)
16671      }
16672      if (typeof test === 'function') {
16673        return castFactory$k(test)
16674      }
16675      throw new Error('Expected function, string, or object as test')
16676    }
16677  );
16678function anyFactory$k(tests) {
16679  const checks = [];
16680  let index = -1;
16681  while (++index < tests.length) {
16682    checks[index] = convert$k(tests[index]);
16683  }
16684  return castFactory$k(any)
16685  function any(...parameters) {
16686    let index = -1;
16687    while (++index < checks.length) {
16688      if (checks[index].call(this, ...parameters)) return true
16689    }
16690    return false
16691  }
16692}
16693function propsFactory$k(check) {
16694  return castFactory$k(all)
16695  function all(node) {
16696    let key;
16697    for (key in check) {
16698      if (node[key] !== check[key]) return false
16699    }
16700    return true
16701  }
16702}
16703function typeFactory$k(check) {
16704  return castFactory$k(type)
16705  function type(node) {
16706    return node && node.type === check
16707  }
16708}
16709function castFactory$k(check) {
16710  return assertion
16711  function assertion(node, ...parameters) {
16712    return Boolean(
16713      node &&
16714        typeof node === 'object' &&
16715        'type' in node &&
16716        Boolean(check.call(this, node, ...parameters))
16717    )
16718  }
16719}
16720function ok$k() {
16721  return true
16722}
16723
16724function color$l(d) {
16725  return '\u001B[33m' + d + '\u001B[39m'
16726}
16727
16728const CONTINUE$k = true;
16729const EXIT$k = false;
16730const SKIP$k = 'skip';
16731const visitParents$k =
16732  (
16733    function (tree, test, visitor, reverse) {
16734      if (typeof test === 'function' && typeof visitor !== 'function') {
16735        reverse = visitor;
16736        visitor = test;
16737        test = null;
16738      }
16739      const is = convert$k(test);
16740      const step = reverse ? -1 : 1;
16741      factory(tree, undefined, [])();
16742      function factory(node, index, parents) {
16743        const value = node && typeof node === 'object' ? node : {};
16744        if (typeof value.type === 'string') {
16745          const name =
16746            typeof value.tagName === 'string'
16747              ? value.tagName
16748              :
16749              typeof value.name === 'string'
16750              ? value.name
16751              : undefined;
16752          Object.defineProperty(visit, 'name', {
16753            value:
16754              'node (' + color$l(node.type + (name ? '<' + name + '>' : '')) + ')'
16755          });
16756        }
16757        return visit
16758        function visit() {
16759          let result = [];
16760          let subresult;
16761          let offset;
16762          let grandparents;
16763          if (!test || is(node, index, parents[parents.length - 1] || null)) {
16764            result = toResult$k(visitor(node, parents));
16765            if (result[0] === EXIT$k) {
16766              return result
16767            }
16768          }
16769          if (node.children && result[0] !== SKIP$k) {
16770            offset = (reverse ? node.children.length : -1) + step;
16771            grandparents = parents.concat(node);
16772            while (offset > -1 && offset < node.children.length) {
16773              subresult = factory(node.children[offset], offset, grandparents)();
16774              if (subresult[0] === EXIT$k) {
16775                return subresult
16776              }
16777              offset =
16778                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
16779            }
16780          }
16781          return result
16782        }
16783      }
16784    }
16785  );
16786function toResult$k(value) {
16787  if (Array.isArray(value)) {
16788    return value
16789  }
16790  if (typeof value === 'number') {
16791    return [CONTINUE$k, value]
16792  }
16793  return [value]
16794}
16795
16796const visit$k =
16797  (
16798    function (tree, test, visitor, reverse) {
16799      if (typeof test === 'function' && typeof visitor !== 'function') {
16800        reverse = visitor;
16801        visitor = test;
16802        test = null;
16803      }
16804      visitParents$k(tree, test, overload, reverse);
16805      function overload(node, parents) {
16806        const parent = parents[parents.length - 1];
16807        return visitor(
16808          node,
16809          parent ? parent.children.indexOf(node) : null,
16810          parent
16811        )
16812      }
16813    }
16814  );
16815
16816/**
16817 * ## When should I use this?
16818 *
16819 * You can use this package to check that the style of GFM tasklists is
16820 * consistent.
16821 *
16822 * ## API
16823 *
16824 * The following options (default: `'consistent'`) are accepted:
16825 *
16826 * *   `Object` with the following fields:
16827 *     *   `checked` (`'x'`, `'X'`, or `'consistent'`, default: `'consistent'`)
16828 *         — preferred character to use for checked checkboxes
16829 *     *   `unchecked` (`'·'` (a space), `'»'` (a tab), or `'consistent'`,
16830 *         default: `'consistent'`)
16831 *         — preferred character to use for unchecked checkboxes
16832 * *   `'consistent'`
16833 *     — detect the first used styles and warn when further checkboxes differ
16834 *
16835 * ## Recommendation
16836 *
16837 * It’s recommended to set `options.checked` to `'x'` (a lowercase X) as it
16838 * prevents an extra keyboard press and `options.unchecked` to `'·'` (a space)
16839 * to make all checkboxes align.
16840 *
16841 * ## Fix
16842 *
16843 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
16844 * formats checked checkboxes using `'x'` (lowercase X) and unchecked checkboxes
16845 * using `'·'` (a space).
16846 *
16847 * @module checkbox-character-style
16848 * @summary
16849 *   remark-lint rule to warn when list item checkboxes violate a given
16850 *   style.
16851 * @author Titus Wormer
16852 * @copyright 2015 Titus Wormer
16853 * @license MIT
16854 * @example
16855 *   {"name": "ok.md", "config": {"checked": "x"}, "gfm": true}
16856 *
16857 *   - [x] List item
16858 *   - [x] List item
16859 *
16860 * @example
16861 *   {"name": "ok.md", "config": {"checked": "X"}, "gfm": true}
16862 *
16863 *   - [X] List item
16864 *   - [X] List item
16865 *
16866 * @example
16867 *   {"name": "ok.md", "config": {"unchecked": " "}, "gfm": true}
16868 *
16869 *   - [ ] List item
16870 *   - [ ] List item
16871 *   - [ ]··
16872 *   - [ ]
16873 *
16874 * @example
16875 *   {"name": "ok.md", "config": {"unchecked": "\t"}, "gfm": true}
16876 *
16877 *   - [»] List item
16878 *   - [»] List item
16879 *
16880 * @example
16881 *   {"name": "not-ok.md", "label": "input", "gfm": true}
16882 *
16883 *   - [x] List item
16884 *   - [X] List item
16885 *   - [ ] List item
16886 *   - [»] List item
16887 *
16888 * @example
16889 *   {"name": "not-ok.md", "label": "output", "gfm": true}
16890 *
16891 *   2:5: Checked checkboxes should use `x` as a marker
16892 *   4:5: Unchecked checkboxes should use ` ` as a marker
16893 *
16894 * @example
16895 *   {"config": {"unchecked": "�"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
16896 *
16897 *   1:1: Incorrect unchecked checkbox marker `�`: use either `'\t'`, or `' '`
16898 *
16899 * @example
16900 *   {"config": {"checked": "�"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
16901 *
16902 *   1:1: Incorrect checked checkbox marker `�`: use either `'x'`, or `'X'`
16903 */
16904const remarkLintCheckboxCharacterStyle = lintRule(
16905  {
16906    origin: 'remark-lint:checkbox-character-style',
16907    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-checkbox-character-style#readme'
16908  },
16909  (tree, file, option = 'consistent') => {
16910    const value = String(file);
16911    let checked = 'consistent';
16912    let unchecked = 'consistent';
16913    if (typeof option === 'object') {
16914      checked = option.checked || 'consistent';
16915      unchecked = option.unchecked || 'consistent';
16916    }
16917    if (unchecked !== 'consistent' && unchecked !== ' ' && unchecked !== '\t') {
16918      file.fail(
16919        'Incorrect unchecked checkbox marker `' +
16920          unchecked +
16921          "`: use either `'\\t'`, or `' '`"
16922      );
16923    }
16924    if (checked !== 'consistent' && checked !== 'x' && checked !== 'X') {
16925      file.fail(
16926        'Incorrect checked checkbox marker `' +
16927          checked +
16928          "`: use either `'x'`, or `'X'`"
16929      );
16930    }
16931    visit$k(tree, 'listItem', (node) => {
16932      const head = node.children[0];
16933      const point = pointStart(head);
16934      if (
16935        typeof node.checked !== 'boolean' ||
16936        !head ||
16937        typeof point.offset !== 'number'
16938      ) {
16939        return
16940      }
16941      point.offset -= 2;
16942      point.column -= 2;
16943      const match = /\[([\t Xx])]/.exec(
16944        value.slice(point.offset - 2, point.offset + 1)
16945      );
16946      if (!match) return
16947      const style = node.checked ? checked : unchecked;
16948      if (style === 'consistent') {
16949        if (node.checked) {
16950          checked = match[1];
16951        } else {
16952          unchecked = match[1];
16953        }
16954      } else if (match[1] !== style) {
16955        file.message(
16956          (node.checked ? 'Checked' : 'Unchecked') +
16957            ' checkboxes should use `' +
16958            style +
16959            '` as a marker',
16960          point
16961        );
16962      }
16963    });
16964  }
16965);
16966var remarkLintCheckboxCharacterStyle$1 = remarkLintCheckboxCharacterStyle;
16967
16968const convert$j =
16969  (
16970    function (test) {
16971      if (test === undefined || test === null) {
16972        return ok$j
16973      }
16974      if (typeof test === 'string') {
16975        return typeFactory$j(test)
16976      }
16977      if (typeof test === 'object') {
16978        return Array.isArray(test) ? anyFactory$j(test) : propsFactory$j(test)
16979      }
16980      if (typeof test === 'function') {
16981        return castFactory$j(test)
16982      }
16983      throw new Error('Expected function, string, or object as test')
16984    }
16985  );
16986function anyFactory$j(tests) {
16987  const checks = [];
16988  let index = -1;
16989  while (++index < tests.length) {
16990    checks[index] = convert$j(tests[index]);
16991  }
16992  return castFactory$j(any)
16993  function any(...parameters) {
16994    let index = -1;
16995    while (++index < checks.length) {
16996      if (checks[index].call(this, ...parameters)) return true
16997    }
16998    return false
16999  }
17000}
17001function propsFactory$j(check) {
17002  return castFactory$j(all)
17003  function all(node) {
17004    let key;
17005    for (key in check) {
17006      if (node[key] !== check[key]) return false
17007    }
17008    return true
17009  }
17010}
17011function typeFactory$j(check) {
17012  return castFactory$j(type)
17013  function type(node) {
17014    return node && node.type === check
17015  }
17016}
17017function castFactory$j(check) {
17018  return assertion
17019  function assertion(node, ...parameters) {
17020    return Boolean(
17021      node &&
17022        typeof node === 'object' &&
17023        'type' in node &&
17024        Boolean(check.call(this, node, ...parameters))
17025    )
17026  }
17027}
17028function ok$j() {
17029  return true
17030}
17031
17032function color$k(d) {
17033  return '\u001B[33m' + d + '\u001B[39m'
17034}
17035
17036const CONTINUE$j = true;
17037const EXIT$j = false;
17038const SKIP$j = 'skip';
17039const visitParents$j =
17040  (
17041    function (tree, test, visitor, reverse) {
17042      if (typeof test === 'function' && typeof visitor !== 'function') {
17043        reverse = visitor;
17044        visitor = test;
17045        test = null;
17046      }
17047      const is = convert$j(test);
17048      const step = reverse ? -1 : 1;
17049      factory(tree, undefined, [])();
17050      function factory(node, index, parents) {
17051        const value = node && typeof node === 'object' ? node : {};
17052        if (typeof value.type === 'string') {
17053          const name =
17054            typeof value.tagName === 'string'
17055              ? value.tagName
17056              :
17057              typeof value.name === 'string'
17058              ? value.name
17059              : undefined;
17060          Object.defineProperty(visit, 'name', {
17061            value:
17062              'node (' + color$k(node.type + (name ? '<' + name + '>' : '')) + ')'
17063          });
17064        }
17065        return visit
17066        function visit() {
17067          let result = [];
17068          let subresult;
17069          let offset;
17070          let grandparents;
17071          if (!test || is(node, index, parents[parents.length - 1] || null)) {
17072            result = toResult$j(visitor(node, parents));
17073            if (result[0] === EXIT$j) {
17074              return result
17075            }
17076          }
17077          if (node.children && result[0] !== SKIP$j) {
17078            offset = (reverse ? node.children.length : -1) + step;
17079            grandparents = parents.concat(node);
17080            while (offset > -1 && offset < node.children.length) {
17081              subresult = factory(node.children[offset], offset, grandparents)();
17082              if (subresult[0] === EXIT$j) {
17083                return subresult
17084              }
17085              offset =
17086                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
17087            }
17088          }
17089          return result
17090        }
17091      }
17092    }
17093  );
17094function toResult$j(value) {
17095  if (Array.isArray(value)) {
17096    return value
17097  }
17098  if (typeof value === 'number') {
17099    return [CONTINUE$j, value]
17100  }
17101  return [value]
17102}
17103
17104const visit$j =
17105  (
17106    function (tree, test, visitor, reverse) {
17107      if (typeof test === 'function' && typeof visitor !== 'function') {
17108        reverse = visitor;
17109        visitor = test;
17110        test = null;
17111      }
17112      visitParents$j(tree, test, overload, reverse);
17113      function overload(node, parents) {
17114        const parent = parents[parents.length - 1];
17115        return visitor(
17116          node,
17117          parent ? parent.children.indexOf(node) : null,
17118          parent
17119        )
17120      }
17121    }
17122  );
17123
17124/**
17125 * ## When should I use this?
17126 *
17127 * You can use this package to check that the “indent” after a GFM tasklist
17128 * checkbox is a single space.
17129 *
17130 * ## API
17131 *
17132 * There are no accepted options.
17133 *
17134 * ## Recommendation
17135 *
17136 * GFM allows zero or more spaces and tabs after checkboxes.
17137 * No space at all arguably looks rather ugly:
17138 *
17139 * ```markdown
17140 * * [x]Pluto
17141 * ```
17142 *
17143 * More that one space is superfluous:
17144 *
17145 * ```markdown
17146 * * [x]   Jupiter
17147 * ```
17148 *
17149 * Due to this, it’s recommended to turn this rule on.
17150 *
17151 * ## Fix
17152 *
17153 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
17154 * formats checkboxes and the content after them with a single space between.
17155 *
17156 * @module checkbox-content-indent
17157 * @summary
17158 *   remark-lint rule to warn when GFM tasklist checkboxes are followed by
17159 *   more than one space.
17160 * @author Titus Wormer
17161 * @copyright 2015 Titus Wormer
17162 * @license MIT
17163 * @example
17164 *   {"name": "ok.md", "gfm": true}
17165 *
17166 *   - [ ] List item
17167 *   +  [x] List Item
17168 *   *   [X] List item
17169 *   -    [ ] List item
17170 *
17171 * @example
17172 *   {"name": "not-ok.md", "label": "input", "gfm": true}
17173 *
17174 *   - [ ] List item
17175 *   + [x]  List item
17176 *   * [X]   List item
17177 *   - [ ]    List item
17178 *
17179 * @example
17180 *   {"name": "not-ok.md", "label": "output", "gfm": true}
17181 *
17182 *   2:7-2:8: Checkboxes should be followed by a single character
17183 *   3:7-3:9: Checkboxes should be followed by a single character
17184 *   4:7-4:10: Checkboxes should be followed by a single character
17185 */
17186const remarkLintCheckboxContentIndent = lintRule(
17187  {
17188    origin: 'remark-lint:checkbox-content-indent',
17189    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-checkbox-content-indent#readme'
17190  },
17191  (tree, file) => {
17192    const value = String(file);
17193    const loc = location(file);
17194    visit$j(tree, 'listItem', (node) => {
17195      const head = node.children[0];
17196      const point = pointStart(head);
17197      if (
17198        typeof node.checked !== 'boolean' ||
17199        !head ||
17200        typeof point.offset !== 'number'
17201      ) {
17202        return
17203      }
17204      const match = /\[([\t xX])]/.exec(
17205        value.slice(point.offset - 4, point.offset + 1)
17206      );
17207      if (!match) return
17208      const initial = point.offset;
17209      let final = initial;
17210      while (/[\t ]/.test(value.charAt(final))) final++;
17211      if (final - initial > 0) {
17212        file.message('Checkboxes should be followed by a single character', {
17213          start: loc.toPoint(initial),
17214          end: loc.toPoint(final)
17215        });
17216      }
17217    });
17218  }
17219);
17220var remarkLintCheckboxContentIndent$1 = remarkLintCheckboxContentIndent;
17221
17222const convert$i =
17223  (
17224    function (test) {
17225      if (test === undefined || test === null) {
17226        return ok$i
17227      }
17228      if (typeof test === 'string') {
17229        return typeFactory$i(test)
17230      }
17231      if (typeof test === 'object') {
17232        return Array.isArray(test) ? anyFactory$i(test) : propsFactory$i(test)
17233      }
17234      if (typeof test === 'function') {
17235        return castFactory$i(test)
17236      }
17237      throw new Error('Expected function, string, or object as test')
17238    }
17239  );
17240function anyFactory$i(tests) {
17241  const checks = [];
17242  let index = -1;
17243  while (++index < tests.length) {
17244    checks[index] = convert$i(tests[index]);
17245  }
17246  return castFactory$i(any)
17247  function any(...parameters) {
17248    let index = -1;
17249    while (++index < checks.length) {
17250      if (checks[index].call(this, ...parameters)) return true
17251    }
17252    return false
17253  }
17254}
17255function propsFactory$i(check) {
17256  return castFactory$i(all)
17257  function all(node) {
17258    let key;
17259    for (key in check) {
17260      if (node[key] !== check[key]) return false
17261    }
17262    return true
17263  }
17264}
17265function typeFactory$i(check) {
17266  return castFactory$i(type)
17267  function type(node) {
17268    return node && node.type === check
17269  }
17270}
17271function castFactory$i(check) {
17272  return assertion
17273  function assertion(node, ...parameters) {
17274    return Boolean(
17275      node &&
17276        typeof node === 'object' &&
17277        'type' in node &&
17278        Boolean(check.call(this, node, ...parameters))
17279    )
17280  }
17281}
17282function ok$i() {
17283  return true
17284}
17285
17286function color$j(d) {
17287  return '\u001B[33m' + d + '\u001B[39m'
17288}
17289
17290const CONTINUE$i = true;
17291const EXIT$i = false;
17292const SKIP$i = 'skip';
17293const visitParents$i =
17294  (
17295    function (tree, test, visitor, reverse) {
17296      if (typeof test === 'function' && typeof visitor !== 'function') {
17297        reverse = visitor;
17298        visitor = test;
17299        test = null;
17300      }
17301      const is = convert$i(test);
17302      const step = reverse ? -1 : 1;
17303      factory(tree, undefined, [])();
17304      function factory(node, index, parents) {
17305        const value = node && typeof node === 'object' ? node : {};
17306        if (typeof value.type === 'string') {
17307          const name =
17308            typeof value.tagName === 'string'
17309              ? value.tagName
17310              :
17311              typeof value.name === 'string'
17312              ? value.name
17313              : undefined;
17314          Object.defineProperty(visit, 'name', {
17315            value:
17316              'node (' + color$j(node.type + (name ? '<' + name + '>' : '')) + ')'
17317          });
17318        }
17319        return visit
17320        function visit() {
17321          let result = [];
17322          let subresult;
17323          let offset;
17324          let grandparents;
17325          if (!test || is(node, index, parents[parents.length - 1] || null)) {
17326            result = toResult$i(visitor(node, parents));
17327            if (result[0] === EXIT$i) {
17328              return result
17329            }
17330          }
17331          if (node.children && result[0] !== SKIP$i) {
17332            offset = (reverse ? node.children.length : -1) + step;
17333            grandparents = parents.concat(node);
17334            while (offset > -1 && offset < node.children.length) {
17335              subresult = factory(node.children[offset], offset, grandparents)();
17336              if (subresult[0] === EXIT$i) {
17337                return subresult
17338              }
17339              offset =
17340                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
17341            }
17342          }
17343          return result
17344        }
17345      }
17346    }
17347  );
17348function toResult$i(value) {
17349  if (Array.isArray(value)) {
17350    return value
17351  }
17352  if (typeof value === 'number') {
17353    return [CONTINUE$i, value]
17354  }
17355  return [value]
17356}
17357
17358const visit$i =
17359  (
17360    function (tree, test, visitor, reverse) {
17361      if (typeof test === 'function' && typeof visitor !== 'function') {
17362        reverse = visitor;
17363        visitor = test;
17364        test = null;
17365      }
17366      visitParents$i(tree, test, overload, reverse);
17367      function overload(node, parents) {
17368        const parent = parents[parents.length - 1];
17369        return visitor(
17370          node,
17371          parent ? parent.children.indexOf(node) : null,
17372          parent
17373        )
17374      }
17375    }
17376  );
17377
17378/**
17379 * ## When should I use this?
17380 *
17381 * You can use this package to check that code blocks are consistent.
17382 *
17383 * ## API
17384 *
17385 * The following options (default: `'consistent'`) are accepted:
17386 *
17387 * *   `'fenced'`
17388 *     — prefer fenced code blocks:
17389 *     ````markdown
17390 *     ```js
17391 *     code()
17392 *     ```
17393 *     ````
17394 * *   `'indented'`
17395 *     — prefer indented code blocks:
17396 *     ```markdown
17397 *         code()
17398 *     ```
17399 * *   `'consistent'`
17400 *     — detect the first used style and warn when further code blocks differ
17401 *
17402 * ## Recommendation
17403 *
17404 * Indentation in markdown is complex, especially because lists and indented
17405 * code can interfere in unexpected ways.
17406 * Fenced code has more features than indented code: importantly, specifying a
17407 * programming language.
17408 * Since CommonMark took the idea of fenced code from GFM, fenced code became
17409 * widely supported.
17410 * Due to this, it’s recommended to configure this rule with `'fenced'`.
17411 *
17412 * ## Fix
17413 *
17414 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
17415 * formats code blocks as fenced code when they have a language flag and as
17416 * indented code otherwise.
17417 * Pass
17418 * [`fences: true`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsfences)
17419 * to always use fenced code.
17420 *
17421 * @module code-block-style
17422 * @summary
17423 *   remark-lint rule to warn when code blocks violate a given style.
17424 * @author Titus Wormer
17425 * @copyright 2015 Titus Wormer
17426 * @license MIT
17427 *
17428 * @example
17429 *   {"config": "indented", "name": "ok.md"}
17430 *
17431 *       alpha()
17432 *
17433 *   Paragraph.
17434 *
17435 *       bravo()
17436 *
17437 * @example
17438 *   {"config": "indented", "name": "not-ok.md", "label": "input"}
17439 *
17440 *   ```
17441 *   alpha()
17442 *   ```
17443 *
17444 *   Paragraph.
17445 *
17446 *   ```
17447 *   bravo()
17448 *   ```
17449 *
17450 * @example
17451 *   {"config": "indented", "name": "not-ok.md", "label": "output"}
17452 *
17453 *   1:1-3:4: Code blocks should be indented
17454 *   7:1-9:4: Code blocks should be indented
17455 *
17456 * @example
17457 *   {"config": "fenced", "name": "ok.md"}
17458 *
17459 *   ```
17460 *   alpha()
17461 *   ```
17462 *
17463 *   Paragraph.
17464 *
17465 *   ```
17466 *   bravo()
17467 *   ```
17468 *
17469 * @example
17470 *   {"config": "fenced", "name": "not-ok-fenced.md", "label": "input"}
17471 *
17472 *       alpha()
17473 *
17474 *   Paragraph.
17475 *
17476 *       bravo()
17477 *
17478 * @example
17479 *   {"config": "fenced", "name": "not-ok-fenced.md", "label": "output"}
17480 *
17481 *   1:1-1:12: Code blocks should be fenced
17482 *   5:1-5:12: Code blocks should be fenced
17483 *
17484 * @example
17485 *   {"name": "not-ok-consistent.md", "label": "input"}
17486 *
17487 *       alpha()
17488 *
17489 *   Paragraph.
17490 *
17491 *   ```
17492 *   bravo()
17493 *   ```
17494 *
17495 * @example
17496 *   {"name": "not-ok-consistent.md", "label": "output"}
17497 *
17498 *   5:1-7:4: Code blocks should be indented
17499 *
17500 * @example
17501 *   {"config": "�", "name": "not-ok-incorrect.md", "label": "output", "positionless": true}
17502 *
17503 *   1:1: Incorrect code block style `�`: use either `'consistent'`, `'fenced'`, or `'indented'`
17504 */
17505const remarkLintCodeBlockStyle = lintRule(
17506  {
17507    origin: 'remark-lint:code-block-style',
17508    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-code-block-style#readme'
17509  },
17510  (tree, file, option = 'consistent') => {
17511    const value = String(file);
17512    if (
17513      option !== 'consistent' &&
17514      option !== 'fenced' &&
17515      option !== 'indented'
17516    ) {
17517      file.fail(
17518        'Incorrect code block style `' +
17519          option +
17520          "`: use either `'consistent'`, `'fenced'`, or `'indented'`"
17521      );
17522    }
17523    visit$i(tree, 'code', (node) => {
17524      if (generated(node)) {
17525        return
17526      }
17527      const initial = pointStart(node).offset;
17528      const final = pointEnd(node).offset;
17529      const current =
17530        node.lang || /^\s*([~`])\1{2,}/.test(value.slice(initial, final))
17531          ? 'fenced'
17532          : 'indented';
17533      if (option === 'consistent') {
17534        option = current;
17535      } else if (option !== current) {
17536        file.message('Code blocks should be ' + option, node);
17537      }
17538    });
17539  }
17540);
17541var remarkLintCodeBlockStyle$1 = remarkLintCodeBlockStyle;
17542
17543const convert$h =
17544  (
17545    function (test) {
17546      if (test === undefined || test === null) {
17547        return ok$h
17548      }
17549      if (typeof test === 'string') {
17550        return typeFactory$h(test)
17551      }
17552      if (typeof test === 'object') {
17553        return Array.isArray(test) ? anyFactory$h(test) : propsFactory$h(test)
17554      }
17555      if (typeof test === 'function') {
17556        return castFactory$h(test)
17557      }
17558      throw new Error('Expected function, string, or object as test')
17559    }
17560  );
17561function anyFactory$h(tests) {
17562  const checks = [];
17563  let index = -1;
17564  while (++index < tests.length) {
17565    checks[index] = convert$h(tests[index]);
17566  }
17567  return castFactory$h(any)
17568  function any(...parameters) {
17569    let index = -1;
17570    while (++index < checks.length) {
17571      if (checks[index].call(this, ...parameters)) return true
17572    }
17573    return false
17574  }
17575}
17576function propsFactory$h(check) {
17577  return castFactory$h(all)
17578  function all(node) {
17579    let key;
17580    for (key in check) {
17581      if (node[key] !== check[key]) return false
17582    }
17583    return true
17584  }
17585}
17586function typeFactory$h(check) {
17587  return castFactory$h(type)
17588  function type(node) {
17589    return node && node.type === check
17590  }
17591}
17592function castFactory$h(check) {
17593  return assertion
17594  function assertion(node, ...parameters) {
17595    return Boolean(
17596      node &&
17597        typeof node === 'object' &&
17598        'type' in node &&
17599        Boolean(check.call(this, node, ...parameters))
17600    )
17601  }
17602}
17603function ok$h() {
17604  return true
17605}
17606
17607function color$i(d) {
17608  return '\u001B[33m' + d + '\u001B[39m'
17609}
17610
17611const CONTINUE$h = true;
17612const EXIT$h = false;
17613const SKIP$h = 'skip';
17614const visitParents$h =
17615  (
17616    function (tree, test, visitor, reverse) {
17617      if (typeof test === 'function' && typeof visitor !== 'function') {
17618        reverse = visitor;
17619        visitor = test;
17620        test = null;
17621      }
17622      const is = convert$h(test);
17623      const step = reverse ? -1 : 1;
17624      factory(tree, undefined, [])();
17625      function factory(node, index, parents) {
17626        const value = node && typeof node === 'object' ? node : {};
17627        if (typeof value.type === 'string') {
17628          const name =
17629            typeof value.tagName === 'string'
17630              ? value.tagName
17631              :
17632              typeof value.name === 'string'
17633              ? value.name
17634              : undefined;
17635          Object.defineProperty(visit, 'name', {
17636            value:
17637              'node (' + color$i(node.type + (name ? '<' + name + '>' : '')) + ')'
17638          });
17639        }
17640        return visit
17641        function visit() {
17642          let result = [];
17643          let subresult;
17644          let offset;
17645          let grandparents;
17646          if (!test || is(node, index, parents[parents.length - 1] || null)) {
17647            result = toResult$h(visitor(node, parents));
17648            if (result[0] === EXIT$h) {
17649              return result
17650            }
17651          }
17652          if (node.children && result[0] !== SKIP$h) {
17653            offset = (reverse ? node.children.length : -1) + step;
17654            grandparents = parents.concat(node);
17655            while (offset > -1 && offset < node.children.length) {
17656              subresult = factory(node.children[offset], offset, grandparents)();
17657              if (subresult[0] === EXIT$h) {
17658                return subresult
17659              }
17660              offset =
17661                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
17662            }
17663          }
17664          return result
17665        }
17666      }
17667    }
17668  );
17669function toResult$h(value) {
17670  if (Array.isArray(value)) {
17671    return value
17672  }
17673  if (typeof value === 'number') {
17674    return [CONTINUE$h, value]
17675  }
17676  return [value]
17677}
17678
17679const visit$h =
17680  (
17681    function (tree, test, visitor, reverse) {
17682      if (typeof test === 'function' && typeof visitor !== 'function') {
17683        reverse = visitor;
17684        visitor = test;
17685        test = null;
17686      }
17687      visitParents$h(tree, test, overload, reverse);
17688      function overload(node, parents) {
17689        const parent = parents[parents.length - 1];
17690        return visitor(
17691          node,
17692          parent ? parent.children.indexOf(node) : null,
17693          parent
17694        )
17695      }
17696    }
17697  );
17698
17699/**
17700 * ## When should I use this?
17701 *
17702 * You can use this package to check that the labels used in definitions
17703 * do not use meaningless white space.
17704 *
17705 * ## API
17706 *
17707 * There are no options.
17708 *
17709 * ## Recommendation
17710 *
17711 * Definitions and references are matched together by collapsing white space.
17712 * Using more white space in labels might incorrectly indicate that they are of
17713 * importance.
17714 * Due to this, it’s recommended to use one space (or a line ending if needed)
17715 * and turn this rule on.
17716 *
17717 * @module definition-spacing
17718 * @summary
17719 *   remark-lint rule to warn when consecutive whitespace is used in
17720 *   a definition label.
17721 * @author Titus Wormer
17722 * @copyright 2015 Titus Wormer
17723 * @license MIT
17724 * @example
17725 *   {"name": "ok.md"}
17726 *
17727 *   [example domain]: http://example.com "Example Domain"
17728 *
17729 * @example
17730 *   {"name": "not-ok.md", "label": "input"}
17731 *
17732 *   [example····domain]: http://example.com "Example Domain"
17733 *
17734 * @example
17735 *   {"name": "not-ok.md", "label": "output"}
17736 *
17737 *   1:1-1:57: Do not use consecutive whitespace in definition labels
17738 */
17739const label = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/;
17740const remarkLintDefinitionSpacing = lintRule(
17741  {
17742    origin: 'remark-lint:definition-spacing',
17743    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-definition-spacing#readme'
17744  },
17745  (tree, file) => {
17746    const value = String(file);
17747    visit$h(tree, (node) => {
17748      if (node.type === 'definition' || node.type === 'footnoteDefinition') {
17749        const start = pointStart(node).offset;
17750        const end = pointEnd(node).offset;
17751        if (typeof start === 'number' && typeof end === 'number') {
17752          const match = value.slice(start, end).match(label);
17753          if (match && /[ \t\n]{2,}/.test(match[1])) {
17754            file.message(
17755              'Do not use consecutive whitespace in definition labels',
17756              node
17757            );
17758          }
17759        }
17760      }
17761    });
17762  }
17763);
17764var remarkLintDefinitionSpacing$1 = remarkLintDefinitionSpacing;
17765
17766const convert$g =
17767  (
17768    function (test) {
17769      if (test === undefined || test === null) {
17770        return ok$g
17771      }
17772      if (typeof test === 'string') {
17773        return typeFactory$g(test)
17774      }
17775      if (typeof test === 'object') {
17776        return Array.isArray(test) ? anyFactory$g(test) : propsFactory$g(test)
17777      }
17778      if (typeof test === 'function') {
17779        return castFactory$g(test)
17780      }
17781      throw new Error('Expected function, string, or object as test')
17782    }
17783  );
17784function anyFactory$g(tests) {
17785  const checks = [];
17786  let index = -1;
17787  while (++index < tests.length) {
17788    checks[index] = convert$g(tests[index]);
17789  }
17790  return castFactory$g(any)
17791  function any(...parameters) {
17792    let index = -1;
17793    while (++index < checks.length) {
17794      if (checks[index].call(this, ...parameters)) return true
17795    }
17796    return false
17797  }
17798}
17799function propsFactory$g(check) {
17800  return castFactory$g(all)
17801  function all(node) {
17802    let key;
17803    for (key in check) {
17804      if (node[key] !== check[key]) return false
17805    }
17806    return true
17807  }
17808}
17809function typeFactory$g(check) {
17810  return castFactory$g(type)
17811  function type(node) {
17812    return node && node.type === check
17813  }
17814}
17815function castFactory$g(check) {
17816  return assertion
17817  function assertion(node, ...parameters) {
17818    return Boolean(
17819      node &&
17820        typeof node === 'object' &&
17821        'type' in node &&
17822        Boolean(check.call(this, node, ...parameters))
17823    )
17824  }
17825}
17826function ok$g() {
17827  return true
17828}
17829
17830function color$h(d) {
17831  return '\u001B[33m' + d + '\u001B[39m'
17832}
17833
17834const CONTINUE$g = true;
17835const EXIT$g = false;
17836const SKIP$g = 'skip';
17837const visitParents$g =
17838  (
17839    function (tree, test, visitor, reverse) {
17840      if (typeof test === 'function' && typeof visitor !== 'function') {
17841        reverse = visitor;
17842        visitor = test;
17843        test = null;
17844      }
17845      const is = convert$g(test);
17846      const step = reverse ? -1 : 1;
17847      factory(tree, undefined, [])();
17848      function factory(node, index, parents) {
17849        const value = node && typeof node === 'object' ? node : {};
17850        if (typeof value.type === 'string') {
17851          const name =
17852            typeof value.tagName === 'string'
17853              ? value.tagName
17854              :
17855              typeof value.name === 'string'
17856              ? value.name
17857              : undefined;
17858          Object.defineProperty(visit, 'name', {
17859            value:
17860              'node (' + color$h(node.type + (name ? '<' + name + '>' : '')) + ')'
17861          });
17862        }
17863        return visit
17864        function visit() {
17865          let result = [];
17866          let subresult;
17867          let offset;
17868          let grandparents;
17869          if (!test || is(node, index, parents[parents.length - 1] || null)) {
17870            result = toResult$g(visitor(node, parents));
17871            if (result[0] === EXIT$g) {
17872              return result
17873            }
17874          }
17875          if (node.children && result[0] !== SKIP$g) {
17876            offset = (reverse ? node.children.length : -1) + step;
17877            grandparents = parents.concat(node);
17878            while (offset > -1 && offset < node.children.length) {
17879              subresult = factory(node.children[offset], offset, grandparents)();
17880              if (subresult[0] === EXIT$g) {
17881                return subresult
17882              }
17883              offset =
17884                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
17885            }
17886          }
17887          return result
17888        }
17889      }
17890    }
17891  );
17892function toResult$g(value) {
17893  if (Array.isArray(value)) {
17894    return value
17895  }
17896  if (typeof value === 'number') {
17897    return [CONTINUE$g, value]
17898  }
17899  return [value]
17900}
17901
17902const visit$g =
17903  (
17904    function (tree, test, visitor, reverse) {
17905      if (typeof test === 'function' && typeof visitor !== 'function') {
17906        reverse = visitor;
17907        visitor = test;
17908        test = null;
17909      }
17910      visitParents$g(tree, test, overload, reverse);
17911      function overload(node, parents) {
17912        const parent = parents[parents.length - 1];
17913        return visitor(
17914          node,
17915          parent ? parent.children.indexOf(node) : null,
17916          parent
17917        )
17918      }
17919    }
17920  );
17921
17922/**
17923 * ## When should I use this?
17924 *
17925 * You can use this package to check that language flags of fenced code
17926 * are used and consistent.
17927 *
17928 * ## API
17929 *
17930 * The following options (default: `undefined`) are accepted:
17931 *
17932 * *   `Array<string>`
17933 *     — as if passing `{flags: options}`
17934 * *   `Object` with the following fields:
17935 *     *   `allowEmpty` (`boolean`, default: `false`)
17936 *         — allow language flags to be omitted
17937 *     *   `flags` (`Array<string>` default: `[]`)
17938 *         — specific flags to allow (other flags will result in a warning)
17939 *
17940 * ## Recommendation
17941 *
17942 * While omitting the language flag is perfectly fine to signal that the code is
17943 * plain text, it *could* point to a mistake.
17944 * It’s recommended to instead use a certain flag for plain text (such as `txt`)
17945 * and to turn this rule on.
17946 *
17947 * @module fenced-code-flag
17948 * @summary
17949 *   remark-lint rule to check that language flags of fenced code are used.
17950 * @author Titus Wormer
17951 * @copyright 2015 Titus Wormer
17952 * @license MIT
17953 *
17954 * @example
17955 *   {"name": "ok.md"}
17956 *
17957 *   ```alpha
17958 *   bravo()
17959 *   ```
17960 *
17961 * @example
17962 *   {"name": "not-ok.md", "label": "input"}
17963 *
17964 *   ```
17965 *   alpha()
17966 *   ```
17967 *
17968 * @example
17969 *   {"name": "not-ok.md", "label": "output"}
17970 *
17971 *   1:1-3:4: Missing code language flag
17972 *
17973 * @example
17974 *   {"name": "ok.md", "config": {"allowEmpty": true}}
17975 *
17976 *   ```
17977 *   alpha()
17978 *   ```
17979 *
17980 * @example
17981 *   {"name": "not-ok.md", "config": {"allowEmpty": false}, "label": "input"}
17982 *
17983 *   ```
17984 *   alpha()
17985 *   ```
17986 *
17987 * @example
17988 *   {"name": "not-ok.md", "config": {"allowEmpty": false}, "label": "output"}
17989 *
17990 *   1:1-3:4: Missing code language flag
17991 *
17992 * @example
17993 *   {"name": "ok.md", "config": ["alpha"]}
17994 *
17995 *   ```alpha
17996 *   bravo()
17997 *   ```
17998 *
17999 * @example
18000 *   {"name": "ok.md", "config": {"flags":["alpha"]}}
18001 *
18002 *   ```alpha
18003 *   bravo()
18004 *   ```
18005 *
18006 * @example
18007 *   {"name": "not-ok.md", "config": ["charlie"], "label": "input"}
18008 *
18009 *   ```alpha
18010 *   bravo()
18011 *   ```
18012 *
18013 * @example
18014 *   {"name": "not-ok.md", "config": ["charlie"], "label": "output"}
18015 *
18016 *   1:1-3:4: Incorrect code language flag
18017 */
18018const fence = /^ {0,3}([~`])\1{2,}/;
18019const remarkLintFencedCodeFlag = lintRule(
18020  {
18021    origin: 'remark-lint:fenced-code-flag',
18022    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-flag#readme'
18023  },
18024  (tree, file, option) => {
18025    const value = String(file);
18026    let allowEmpty = false;
18027    let allowed = [];
18028    if (typeof option === 'object') {
18029      if (Array.isArray(option)) {
18030        allowed = option;
18031      } else {
18032        allowEmpty = Boolean(option.allowEmpty);
18033        if (option.flags) {
18034          allowed = option.flags;
18035        }
18036      }
18037    }
18038    visit$g(tree, 'code', (node) => {
18039      if (!generated(node)) {
18040        if (node.lang) {
18041          if (allowed.length > 0 && !allowed.includes(node.lang)) {
18042            file.message('Incorrect code language flag', node);
18043          }
18044        } else {
18045          const slice = value.slice(
18046            pointStart(node).offset,
18047            pointEnd(node).offset
18048          );
18049          if (!allowEmpty && fence.test(slice)) {
18050            file.message('Missing code language flag', node);
18051          }
18052        }
18053      }
18054    });
18055  }
18056);
18057var remarkLintFencedCodeFlag$1 = remarkLintFencedCodeFlag;
18058
18059const convert$f =
18060  (
18061    function (test) {
18062      if (test === undefined || test === null) {
18063        return ok$f
18064      }
18065      if (typeof test === 'string') {
18066        return typeFactory$f(test)
18067      }
18068      if (typeof test === 'object') {
18069        return Array.isArray(test) ? anyFactory$f(test) : propsFactory$f(test)
18070      }
18071      if (typeof test === 'function') {
18072        return castFactory$f(test)
18073      }
18074      throw new Error('Expected function, string, or object as test')
18075    }
18076  );
18077function anyFactory$f(tests) {
18078  const checks = [];
18079  let index = -1;
18080  while (++index < tests.length) {
18081    checks[index] = convert$f(tests[index]);
18082  }
18083  return castFactory$f(any)
18084  function any(...parameters) {
18085    let index = -1;
18086    while (++index < checks.length) {
18087      if (checks[index].call(this, ...parameters)) return true
18088    }
18089    return false
18090  }
18091}
18092function propsFactory$f(check) {
18093  return castFactory$f(all)
18094  function all(node) {
18095    let key;
18096    for (key in check) {
18097      if (node[key] !== check[key]) return false
18098    }
18099    return true
18100  }
18101}
18102function typeFactory$f(check) {
18103  return castFactory$f(type)
18104  function type(node) {
18105    return node && node.type === check
18106  }
18107}
18108function castFactory$f(check) {
18109  return assertion
18110  function assertion(node, ...parameters) {
18111    return Boolean(
18112      node &&
18113        typeof node === 'object' &&
18114        'type' in node &&
18115        Boolean(check.call(this, node, ...parameters))
18116    )
18117  }
18118}
18119function ok$f() {
18120  return true
18121}
18122
18123function color$g(d) {
18124  return '\u001B[33m' + d + '\u001B[39m'
18125}
18126
18127const CONTINUE$f = true;
18128const EXIT$f = false;
18129const SKIP$f = 'skip';
18130const visitParents$f =
18131  (
18132    function (tree, test, visitor, reverse) {
18133      if (typeof test === 'function' && typeof visitor !== 'function') {
18134        reverse = visitor;
18135        visitor = test;
18136        test = null;
18137      }
18138      const is = convert$f(test);
18139      const step = reverse ? -1 : 1;
18140      factory(tree, undefined, [])();
18141      function factory(node, index, parents) {
18142        const value = node && typeof node === 'object' ? node : {};
18143        if (typeof value.type === 'string') {
18144          const name =
18145            typeof value.tagName === 'string'
18146              ? value.tagName
18147              :
18148              typeof value.name === 'string'
18149              ? value.name
18150              : undefined;
18151          Object.defineProperty(visit, 'name', {
18152            value:
18153              'node (' + color$g(node.type + (name ? '<' + name + '>' : '')) + ')'
18154          });
18155        }
18156        return visit
18157        function visit() {
18158          let result = [];
18159          let subresult;
18160          let offset;
18161          let grandparents;
18162          if (!test || is(node, index, parents[parents.length - 1] || null)) {
18163            result = toResult$f(visitor(node, parents));
18164            if (result[0] === EXIT$f) {
18165              return result
18166            }
18167          }
18168          if (node.children && result[0] !== SKIP$f) {
18169            offset = (reverse ? node.children.length : -1) + step;
18170            grandparents = parents.concat(node);
18171            while (offset > -1 && offset < node.children.length) {
18172              subresult = factory(node.children[offset], offset, grandparents)();
18173              if (subresult[0] === EXIT$f) {
18174                return subresult
18175              }
18176              offset =
18177                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
18178            }
18179          }
18180          return result
18181        }
18182      }
18183    }
18184  );
18185function toResult$f(value) {
18186  if (Array.isArray(value)) {
18187    return value
18188  }
18189  if (typeof value === 'number') {
18190    return [CONTINUE$f, value]
18191  }
18192  return [value]
18193}
18194
18195const visit$f =
18196  (
18197    function (tree, test, visitor, reverse) {
18198      if (typeof test === 'function' && typeof visitor !== 'function') {
18199        reverse = visitor;
18200        visitor = test;
18201        test = null;
18202      }
18203      visitParents$f(tree, test, overload, reverse);
18204      function overload(node, parents) {
18205        const parent = parents[parents.length - 1];
18206        return visitor(
18207          node,
18208          parent ? parent.children.indexOf(node) : null,
18209          parent
18210        )
18211      }
18212    }
18213  );
18214
18215/**
18216 * ## When should I use this?
18217 *
18218 * You can use this package to check that fenced code markers are consistent.
18219 *
18220 * ## API
18221 *
18222 * The following options (default: `'consistent'`) are accepted:
18223 *
18224 * *   ``'`'``
18225 *     — prefer grave accents
18226 * *   `'~'`
18227 *     — prefer tildes
18228 * *   `'consistent'`
18229 *     — detect the first used style and warn when further fenced code differs
18230 *
18231 * ## Recommendation
18232 *
18233 * Tildes are extremely uncommon.
18234 * Due to this, it’s recommended to configure this rule with ``'`'``.
18235 *
18236 * ## Fix
18237 *
18238 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
18239 * formats fenced code with grave accents by default.
18240 * Pass
18241 * [`fence: '~'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsfence)
18242 * to always use tildes.
18243 *
18244 * @module fenced-code-marker
18245 * @summary
18246 *   remark-lint rule to warn when fenced code markers are inconsistent.
18247 * @author Titus Wormer
18248 * @copyright 2015 Titus Wormer
18249 * @license MIT
18250 * @example
18251 *   {"name": "ok.md"}
18252 *
18253 *   Indented code blocks are not affected by this rule:
18254 *
18255 *       bravo()
18256 *
18257 * @example
18258 *   {"name": "ok.md", "config": "`"}
18259 *
18260 *   ```alpha
18261 *   bravo()
18262 *   ```
18263 *
18264 *   ```
18265 *   charlie()
18266 *   ```
18267 *
18268 * @example
18269 *   {"name": "ok.md", "config": "~"}
18270 *
18271 *   ~~~alpha
18272 *   bravo()
18273 *   ~~~
18274 *
18275 *   ~~~
18276 *   charlie()
18277 *   ~~~
18278 *
18279 * @example
18280 *   {"name": "not-ok-consistent-tick.md", "label": "input"}
18281 *
18282 *   ```alpha
18283 *   bravo()
18284 *   ```
18285 *
18286 *   ~~~
18287 *   charlie()
18288 *   ~~~
18289 *
18290 * @example
18291 *   {"name": "not-ok-consistent-tick.md", "label": "output"}
18292 *
18293 *   5:1-7:4: Fenced code should use `` ` `` as a marker
18294 *
18295 * @example
18296 *   {"name": "not-ok-consistent-tilde.md", "label": "input"}
18297 *
18298 *   ~~~alpha
18299 *   bravo()
18300 *   ~~~
18301 *
18302 *   ```
18303 *   charlie()
18304 *   ```
18305 *
18306 * @example
18307 *   {"name": "not-ok-consistent-tilde.md", "label": "output"}
18308 *
18309 *   5:1-7:4: Fenced code should use `~` as a marker
18310 *
18311 * @example
18312 *   {"name": "not-ok-incorrect.md", "config": "�", "label": "output", "positionless": true}
18313 *
18314 *   1:1: Incorrect fenced code marker `�`: use either `'consistent'`, `` '`' ``, or `'~'`
18315 */
18316const remarkLintFencedCodeMarker = lintRule(
18317  {
18318    origin: 'remark-lint:fenced-code-marker',
18319    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-marker#readme'
18320  },
18321  (tree, file, option = 'consistent') => {
18322    const contents = String(file);
18323    if (option !== 'consistent' && option !== '~' && option !== '`') {
18324      file.fail(
18325        'Incorrect fenced code marker `' +
18326          option +
18327          "`: use either `'consistent'`, `` '`' ``, or `'~'`"
18328      );
18329    }
18330    visit$f(tree, 'code', (node) => {
18331      const start = pointStart(node).offset;
18332      if (typeof start === 'number') {
18333        const marker = contents
18334          .slice(start, start + 4)
18335          .replace(/^\s+/, '')
18336          .charAt(0);
18337        if (marker === '~' || marker === '`') {
18338          if (option === 'consistent') {
18339            option = marker;
18340          } else if (marker !== option) {
18341            file.message(
18342              'Fenced code should use `' +
18343                (option === '~' ? option : '` ` `') +
18344                '` as a marker',
18345              node
18346            );
18347          }
18348        }
18349      }
18350    });
18351  }
18352);
18353var remarkLintFencedCodeMarker$1 = remarkLintFencedCodeMarker;
18354
18355/**
18356 * ## When should I use this?
18357 *
18358 * You can use this package to check that file extensions are `md`.
18359 *
18360 * ## API
18361 *
18362 * The following options (default: `'md'`) are accepted:
18363 *
18364 * *   `string` (example `'markdown'`)
18365 *     — preferred file extension (no dot)
18366 *
18367 * > � **Note**: does not warn when files have no file extensions (such as
18368 * > `AUTHORS` or `LICENSE`).
18369 *
18370 * ## Recommendation
18371 *
18372 * Use `md` as it’s the most common.
18373 * Also use `md` when your markdown contains common syntax extensions (such as
18374 * GFM, frontmatter, or math).
18375 * Do not use `md` for MDX: use `mdx` instead.
18376 *
18377 * @module file-extension
18378 * @summary
18379 *   remark-lint rule to check the file extension.
18380 * @author Titus Wormer
18381 * @copyright 2015 Titus Wormer
18382 * @license MIT
18383 * @example
18384 *   {"name": "readme.md"}
18385 *
18386 * @example
18387 *   {"name": "readme"}
18388 *
18389 * @example
18390 *   {"name": "readme.mkd", "label": "output", "positionless": true}
18391 *
18392 *   1:1: Incorrect extension: use `md`
18393 *
18394 * @example
18395 *   {"name": "readme.mkd", "config": "mkd"}
18396 */
18397const remarkLintFileExtension = lintRule(
18398  {
18399    origin: 'remark-lint:file-extension',
18400    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-file-extension#readme'
18401  },
18402  (_, file, option = 'md') => {
18403    const ext = file.extname;
18404    if (ext && ext.slice(1) !== option) {
18405      file.message('Incorrect extension: use `' + option + '`');
18406    }
18407  }
18408);
18409var remarkLintFileExtension$1 = remarkLintFileExtension;
18410
18411const convert$e =
18412  (
18413    function (test) {
18414      if (test === undefined || test === null) {
18415        return ok$e
18416      }
18417      if (typeof test === 'string') {
18418        return typeFactory$e(test)
18419      }
18420      if (typeof test === 'object') {
18421        return Array.isArray(test) ? anyFactory$e(test) : propsFactory$e(test)
18422      }
18423      if (typeof test === 'function') {
18424        return castFactory$e(test)
18425      }
18426      throw new Error('Expected function, string, or object as test')
18427    }
18428  );
18429function anyFactory$e(tests) {
18430  const checks = [];
18431  let index = -1;
18432  while (++index < tests.length) {
18433    checks[index] = convert$e(tests[index]);
18434  }
18435  return castFactory$e(any)
18436  function any(...parameters) {
18437    let index = -1;
18438    while (++index < checks.length) {
18439      if (checks[index].call(this, ...parameters)) return true
18440    }
18441    return false
18442  }
18443}
18444function propsFactory$e(check) {
18445  return castFactory$e(all)
18446  function all(node) {
18447    let key;
18448    for (key in check) {
18449      if (node[key] !== check[key]) return false
18450    }
18451    return true
18452  }
18453}
18454function typeFactory$e(check) {
18455  return castFactory$e(type)
18456  function type(node) {
18457    return node && node.type === check
18458  }
18459}
18460function castFactory$e(check) {
18461  return assertion
18462  function assertion(node, ...parameters) {
18463    return Boolean(
18464      node &&
18465        typeof node === 'object' &&
18466        'type' in node &&
18467        Boolean(check.call(this, node, ...parameters))
18468    )
18469  }
18470}
18471function ok$e() {
18472  return true
18473}
18474
18475function color$f(d) {
18476  return '\u001B[33m' + d + '\u001B[39m'
18477}
18478
18479const CONTINUE$e = true;
18480const EXIT$e = false;
18481const SKIP$e = 'skip';
18482const visitParents$e =
18483  (
18484    function (tree, test, visitor, reverse) {
18485      if (typeof test === 'function' && typeof visitor !== 'function') {
18486        reverse = visitor;
18487        visitor = test;
18488        test = null;
18489      }
18490      const is = convert$e(test);
18491      const step = reverse ? -1 : 1;
18492      factory(tree, undefined, [])();
18493      function factory(node, index, parents) {
18494        const value = node && typeof node === 'object' ? node : {};
18495        if (typeof value.type === 'string') {
18496          const name =
18497            typeof value.tagName === 'string'
18498              ? value.tagName
18499              :
18500              typeof value.name === 'string'
18501              ? value.name
18502              : undefined;
18503          Object.defineProperty(visit, 'name', {
18504            value:
18505              'node (' + color$f(node.type + (name ? '<' + name + '>' : '')) + ')'
18506          });
18507        }
18508        return visit
18509        function visit() {
18510          let result = [];
18511          let subresult;
18512          let offset;
18513          let grandparents;
18514          if (!test || is(node, index, parents[parents.length - 1] || null)) {
18515            result = toResult$e(visitor(node, parents));
18516            if (result[0] === EXIT$e) {
18517              return result
18518            }
18519          }
18520          if (node.children && result[0] !== SKIP$e) {
18521            offset = (reverse ? node.children.length : -1) + step;
18522            grandparents = parents.concat(node);
18523            while (offset > -1 && offset < node.children.length) {
18524              subresult = factory(node.children[offset], offset, grandparents)();
18525              if (subresult[0] === EXIT$e) {
18526                return subresult
18527              }
18528              offset =
18529                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
18530            }
18531          }
18532          return result
18533        }
18534      }
18535    }
18536  );
18537function toResult$e(value) {
18538  if (Array.isArray(value)) {
18539    return value
18540  }
18541  if (typeof value === 'number') {
18542    return [CONTINUE$e, value]
18543  }
18544  return [value]
18545}
18546
18547const visit$e =
18548  (
18549    function (tree, test, visitor, reverse) {
18550      if (typeof test === 'function' && typeof visitor !== 'function') {
18551        reverse = visitor;
18552        visitor = test;
18553        test = null;
18554      }
18555      visitParents$e(tree, test, overload, reverse);
18556      function overload(node, parents) {
18557        const parent = parents[parents.length - 1];
18558        return visitor(
18559          node,
18560          parent ? parent.children.indexOf(node) : null,
18561          parent
18562        )
18563      }
18564    }
18565  );
18566
18567/**
18568 * ## When should I use this?
18569 *
18570 * You can use this package to check that definitions are placed at the end of
18571 * the document.
18572 *
18573 * ## API
18574 *
18575 * There are no options.
18576 *
18577 * ## Recommendation
18578 *
18579 * There are different strategies for placing definitions.
18580 * The simplest is perhaps to place them all at the bottem of documents.
18581 * If you prefer that, turn on this rule.
18582 *
18583 * @module final-definition
18584 * @summary
18585 *   remark-lint rule to warn when definitions are used *in* the document
18586 *   instead of at the end.
18587 * @author Titus Wormer
18588 * @copyright 2015 Titus Wormer
18589 * @license MIT
18590 * @example
18591 *   {"name": "ok.md"}
18592 *
18593 *   Paragraph.
18594 *
18595 *   [example]: http://example.com "Example Domain"
18596 *
18597 * @example
18598 *   {"name": "not-ok.md", "label": "input"}
18599 *
18600 *   Paragraph.
18601 *
18602 *   [example]: http://example.com "Example Domain"
18603 *
18604 *   Another paragraph.
18605 *
18606 * @example
18607 *   {"name": "not-ok.md", "label": "output"}
18608 *
18609 *   3:1-3:47: Move definitions to the end of the file (after the node at line `5`)
18610 *
18611 * @example
18612 *   {"name": "ok-comments.md"}
18613 *
18614 *   Paragraph.
18615 *
18616 *   [example-1]: http://example.com/one/
18617 *
18618 *   <!-- Comments are fine between and after definitions -->
18619 *
18620 *   [example-2]: http://example.com/two/
18621 */
18622const remarkLintFinalDefinition = lintRule(
18623  {
18624    origin: 'remark-lint:final-definition',
18625    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-final-definition#readme'
18626  },
18627  (tree, file) => {
18628    let last = 0;
18629    visit$e(
18630      tree,
18631      (node) => {
18632        if (
18633          node.type === 'root' ||
18634          generated(node) ||
18635          (node.type === 'html' && /^\s*<!--/.test(node.value))
18636        ) {
18637          return
18638        }
18639        const line = pointStart(node).line;
18640        if (node.type === 'definition') {
18641          if (last && last > line) {
18642            file.message(
18643              'Move definitions to the end of the file (after the node at line `' +
18644                last +
18645                '`)',
18646              node
18647            );
18648          }
18649        } else if (last === 0) {
18650          last = line;
18651        }
18652      },
18653      true
18654    );
18655  }
18656);
18657var remarkLintFinalDefinition$1 = remarkLintFinalDefinition;
18658
18659const convert$d =
18660  (
18661    function (test) {
18662      if (test === undefined || test === null) {
18663        return ok$d
18664      }
18665      if (typeof test === 'string') {
18666        return typeFactory$d(test)
18667      }
18668      if (typeof test === 'object') {
18669        return Array.isArray(test) ? anyFactory$d(test) : propsFactory$d(test)
18670      }
18671      if (typeof test === 'function') {
18672        return castFactory$d(test)
18673      }
18674      throw new Error('Expected function, string, or object as test')
18675    }
18676  );
18677function anyFactory$d(tests) {
18678  const checks = [];
18679  let index = -1;
18680  while (++index < tests.length) {
18681    checks[index] = convert$d(tests[index]);
18682  }
18683  return castFactory$d(any)
18684  function any(...parameters) {
18685    let index = -1;
18686    while (++index < checks.length) {
18687      if (checks[index].call(this, ...parameters)) return true
18688    }
18689    return false
18690  }
18691}
18692function propsFactory$d(check) {
18693  return castFactory$d(all)
18694  function all(node) {
18695    let key;
18696    for (key in check) {
18697      if (node[key] !== check[key]) return false
18698    }
18699    return true
18700  }
18701}
18702function typeFactory$d(check) {
18703  return castFactory$d(type)
18704  function type(node) {
18705    return node && node.type === check
18706  }
18707}
18708function castFactory$d(check) {
18709  return assertion
18710  function assertion(node, ...parameters) {
18711    return Boolean(
18712      node &&
18713        typeof node === 'object' &&
18714        'type' in node &&
18715        Boolean(check.call(this, node, ...parameters))
18716    )
18717  }
18718}
18719function ok$d() {
18720  return true
18721}
18722
18723function color$e(d) {
18724  return '\u001B[33m' + d + '\u001B[39m'
18725}
18726
18727const CONTINUE$d = true;
18728const EXIT$d = false;
18729const SKIP$d = 'skip';
18730const visitParents$d =
18731  (
18732    function (tree, test, visitor, reverse) {
18733      if (typeof test === 'function' && typeof visitor !== 'function') {
18734        reverse = visitor;
18735        visitor = test;
18736        test = null;
18737      }
18738      const is = convert$d(test);
18739      const step = reverse ? -1 : 1;
18740      factory(tree, undefined, [])();
18741      function factory(node, index, parents) {
18742        const value = node && typeof node === 'object' ? node : {};
18743        if (typeof value.type === 'string') {
18744          const name =
18745            typeof value.tagName === 'string'
18746              ? value.tagName
18747              :
18748              typeof value.name === 'string'
18749              ? value.name
18750              : undefined;
18751          Object.defineProperty(visit, 'name', {
18752            value:
18753              'node (' + color$e(node.type + (name ? '<' + name + '>' : '')) + ')'
18754          });
18755        }
18756        return visit
18757        function visit() {
18758          let result = [];
18759          let subresult;
18760          let offset;
18761          let grandparents;
18762          if (!test || is(node, index, parents[parents.length - 1] || null)) {
18763            result = toResult$d(visitor(node, parents));
18764            if (result[0] === EXIT$d) {
18765              return result
18766            }
18767          }
18768          if (node.children && result[0] !== SKIP$d) {
18769            offset = (reverse ? node.children.length : -1) + step;
18770            grandparents = parents.concat(node);
18771            while (offset > -1 && offset < node.children.length) {
18772              subresult = factory(node.children[offset], offset, grandparents)();
18773              if (subresult[0] === EXIT$d) {
18774                return subresult
18775              }
18776              offset =
18777                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
18778            }
18779          }
18780          return result
18781        }
18782      }
18783    }
18784  );
18785function toResult$d(value) {
18786  if (Array.isArray(value)) {
18787    return value
18788  }
18789  if (typeof value === 'number') {
18790    return [CONTINUE$d, value]
18791  }
18792  return [value]
18793}
18794
18795const visit$d =
18796  (
18797    function (tree, test, visitor, reverse) {
18798      if (typeof test === 'function' && typeof visitor !== 'function') {
18799        reverse = visitor;
18800        visitor = test;
18801        test = null;
18802      }
18803      visitParents$d(tree, test, overload, reverse);
18804      function overload(node, parents) {
18805        const parent = parents[parents.length - 1];
18806        return visitor(
18807          node,
18808          parent ? parent.children.indexOf(node) : null,
18809          parent
18810        )
18811      }
18812    }
18813  );
18814
18815/**
18816 * ## When should I use this?
18817 *
18818 * You can use this package to check the heading rank of the first heading.
18819 *
18820 * ## API
18821 *
18822 * The following options (default: `1`) are accepted:
18823 *
18824 * *   `number` (example `1`)
18825 *     — expected rank of first heading
18826 *
18827 * ## Recommendation
18828 *
18829 * In most cases you’d want to first heading in a markdown document to start at
18830 * rank 1.
18831 * In some cases a different rank makes more sense, such as when building a blog
18832 * and generating the primary heading from frontmatter metadata, in which case
18833 * a value of `2` can be defined here.
18834 *
18835 * @module first-heading-level
18836 * @summary
18837 *   remark-lint rule to warn when the first heading has an unexpected rank.
18838 * @author Titus Wormer
18839 * @copyright 2015 Titus Wormer
18840 * @license MIT
18841 * @example
18842 *   {"name": "ok.md"}
18843 *
18844 *   # The default is to expect a level one heading
18845 *
18846 * @example
18847 *   {"name": "ok-html.md"}
18848 *
18849 *   <h1>An HTML heading is also seen by this rule.</h1>
18850 *
18851 * @example
18852 *   {"name": "ok-delayed.md"}
18853 *
18854 *   You can use markdown content before the heading.
18855 *
18856 *   <div>Or non-heading HTML</div>
18857 *
18858 *   <h1>So the first heading, be it HTML or markdown, is checked</h1>
18859 *
18860 * @example
18861 *   {"name": "not-ok.md", "label": "input"}
18862 *
18863 *   ## Bravo
18864 *
18865 *   Paragraph.
18866 *
18867 * @example
18868 *   {"name": "not-ok.md", "label": "output"}
18869 *
18870 *   1:1-1:9: First heading level should be `1`
18871 *
18872 * @example
18873 *   {"name": "not-ok-html.md", "label": "input"}
18874 *
18875 *   <h2>Charlie</h2>
18876 *
18877 *   Paragraph.
18878 *
18879 * @example
18880 *   {"name": "not-ok-html.md", "label": "output"}
18881 *
18882 *   1:1-1:17: First heading level should be `1`
18883 *
18884 * @example
18885 *   {"name": "ok.md", "config": 2}
18886 *
18887 *   ## Delta
18888 *
18889 *   Paragraph.
18890 *
18891 * @example
18892 *   {"name": "ok-html.md", "config": 2}
18893 *
18894 *   <h2>Echo</h2>
18895 *
18896 *   Paragraph.
18897 *
18898 * @example
18899 *   {"name": "not-ok.md", "config": 2, "label": "input"}
18900 *
18901 *   # Foxtrot
18902 *
18903 *   Paragraph.
18904 *
18905 * @example
18906 *   {"name": "not-ok.md", "config": 2, "label": "output"}
18907 *
18908 *   1:1-1:10: First heading level should be `2`
18909 *
18910 * @example
18911 *   {"name": "not-ok-html.md", "config": 2, "label": "input"}
18912 *
18913 *   <h1>Golf</h1>
18914 *
18915 *   Paragraph.
18916 *
18917 * @example
18918 *   {"name": "not-ok-html.md", "config": 2, "label": "output"}
18919 *
18920 *   1:1-1:14: First heading level should be `2`
18921 */
18922const re$2 = /<h([1-6])/;
18923const remarkLintFirstHeadingLevel = lintRule(
18924  {
18925    origin: 'remark-lint:first-heading-level',
18926    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-first-heading-level#readme'
18927  },
18928  (tree, file, option = 1) => {
18929    visit$d(tree, (node) => {
18930      if (!generated(node)) {
18931        let rank;
18932        if (node.type === 'heading') {
18933          rank = node.depth;
18934        } else if (node.type === 'html') {
18935          rank = infer(node);
18936        }
18937        if (rank !== undefined) {
18938          if (rank !== option) {
18939            file.message('First heading level should be `' + option + '`', node);
18940          }
18941          return EXIT$d
18942        }
18943      }
18944    });
18945  }
18946);
18947var remarkLintFirstHeadingLevel$1 = remarkLintFirstHeadingLevel;
18948function infer(node) {
18949  const results = node.value.match(re$2);
18950  return results ? Number(results[1]) : undefined
18951}
18952
18953const convert$c =
18954  (
18955    function (test) {
18956      if (test === undefined || test === null) {
18957        return ok$c
18958      }
18959      if (typeof test === 'string') {
18960        return typeFactory$c(test)
18961      }
18962      if (typeof test === 'object') {
18963        return Array.isArray(test) ? anyFactory$c(test) : propsFactory$c(test)
18964      }
18965      if (typeof test === 'function') {
18966        return castFactory$c(test)
18967      }
18968      throw new Error('Expected function, string, or object as test')
18969    }
18970  );
18971function anyFactory$c(tests) {
18972  const checks = [];
18973  let index = -1;
18974  while (++index < tests.length) {
18975    checks[index] = convert$c(tests[index]);
18976  }
18977  return castFactory$c(any)
18978  function any(...parameters) {
18979    let index = -1;
18980    while (++index < checks.length) {
18981      if (checks[index].call(this, ...parameters)) return true
18982    }
18983    return false
18984  }
18985}
18986function propsFactory$c(check) {
18987  return castFactory$c(all)
18988  function all(node) {
18989    let key;
18990    for (key in check) {
18991      if (node[key] !== check[key]) return false
18992    }
18993    return true
18994  }
18995}
18996function typeFactory$c(check) {
18997  return castFactory$c(type)
18998  function type(node) {
18999    return node && node.type === check
19000  }
19001}
19002function castFactory$c(check) {
19003  return assertion
19004  function assertion(node, ...parameters) {
19005    return Boolean(
19006      node &&
19007        typeof node === 'object' &&
19008        'type' in node &&
19009        Boolean(check.call(this, node, ...parameters))
19010    )
19011  }
19012}
19013function ok$c() {
19014  return true
19015}
19016
19017function color$d(d) {
19018  return '\u001B[33m' + d + '\u001B[39m'
19019}
19020
19021const CONTINUE$c = true;
19022const EXIT$c = false;
19023const SKIP$c = 'skip';
19024const visitParents$c =
19025  (
19026    function (tree, test, visitor, reverse) {
19027      if (typeof test === 'function' && typeof visitor !== 'function') {
19028        reverse = visitor;
19029        visitor = test;
19030        test = null;
19031      }
19032      const is = convert$c(test);
19033      const step = reverse ? -1 : 1;
19034      factory(tree, undefined, [])();
19035      function factory(node, index, parents) {
19036        const value = node && typeof node === 'object' ? node : {};
19037        if (typeof value.type === 'string') {
19038          const name =
19039            typeof value.tagName === 'string'
19040              ? value.tagName
19041              :
19042              typeof value.name === 'string'
19043              ? value.name
19044              : undefined;
19045          Object.defineProperty(visit, 'name', {
19046            value:
19047              'node (' + color$d(node.type + (name ? '<' + name + '>' : '')) + ')'
19048          });
19049        }
19050        return visit
19051        function visit() {
19052          let result = [];
19053          let subresult;
19054          let offset;
19055          let grandparents;
19056          if (!test || is(node, index, parents[parents.length - 1] || null)) {
19057            result = toResult$c(visitor(node, parents));
19058            if (result[0] === EXIT$c) {
19059              return result
19060            }
19061          }
19062          if (node.children && result[0] !== SKIP$c) {
19063            offset = (reverse ? node.children.length : -1) + step;
19064            grandparents = parents.concat(node);
19065            while (offset > -1 && offset < node.children.length) {
19066              subresult = factory(node.children[offset], offset, grandparents)();
19067              if (subresult[0] === EXIT$c) {
19068                return subresult
19069              }
19070              offset =
19071                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
19072            }
19073          }
19074          return result
19075        }
19076      }
19077    }
19078  );
19079function toResult$c(value) {
19080  if (Array.isArray(value)) {
19081    return value
19082  }
19083  if (typeof value === 'number') {
19084    return [CONTINUE$c, value]
19085  }
19086  return [value]
19087}
19088
19089const visit$c =
19090  (
19091    function (tree, test, visitor, reverse) {
19092      if (typeof test === 'function' && typeof visitor !== 'function') {
19093        reverse = visitor;
19094        visitor = test;
19095        test = null;
19096      }
19097      visitParents$c(tree, test, overload, reverse);
19098      function overload(node, parents) {
19099        const parent = parents[parents.length - 1];
19100        return visitor(
19101          node,
19102          parent ? parent.children.indexOf(node) : null,
19103          parent
19104        )
19105      }
19106    }
19107  );
19108
19109/**
19110 * ## When should I use this?
19111 *
19112 * You can use this package to check that headings are consistent.
19113 *
19114 * ## API
19115 *
19116 * The following options (default: `'consistent'`) are accepted:
19117 *
19118 * *   `'atx'`
19119 *     — prefer ATX headings:
19120 *     ```markdown
19121 *     ## Hello
19122 *     ```
19123 * *   `'atx-closed'`
19124 *     — prefer ATX headings with a closing sequence:
19125 *     ```markdown
19126 *     ## Hello ##
19127 *     ```
19128 * *   `'setext'`
19129 *     — prefer setext headings:
19130 *     ```markdown
19131 *     Hello
19132 *     -----
19133 *     ```
19134 * *   `'consistent'`
19135 *     — detect the first used style and warn when further headings differ
19136 *
19137 * ## Recommendation
19138 *
19139 * Setext headings are limited in that they can only construct headings with a
19140 * rank of one and two.
19141 * On the other hand, they do allow multiple lines of content whereas ATX only
19142 * allows one line.
19143 * The number of used markers in their underline does not matter, leading to
19144 * either:
19145 *
19146 * *   1 marker (`Hello\n-`), which is the bare minimum, and for rank 2 headings
19147 *     looks suspiciously like an empty list item
19148 * *   using as many markers as the content (`Hello\n-----`), which is hard to
19149 *     maintain
19150 * *   an arbitrary number (`Hello\n---`), which for rank 2 headings looks
19151 *     suspiciously like a thematic break
19152 *
19153 * Setext headings are also rather uncommon.
19154 * Using a sequence of hashes at the end of ATX headings is even more uncommon.
19155 * Due to this, it’s recommended to prefer ATX headings.
19156 *
19157 * ## Fix
19158 *
19159 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
19160 * formats headings as ATX by default.
19161 * The other styles can be configured with
19162 * [`setext: true`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionssetext)
19163 * or
19164 * [`closeAtx: true`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionscloseatx).
19165 *
19166 * @module heading-style
19167 * @summary
19168 *   remark-lint rule to warn when headings violate a given style.
19169 * @author Titus Wormer
19170 * @copyright 2015 Titus Wormer
19171 * @license MIT
19172 * @example
19173 *   {"name": "ok.md", "config": "atx"}
19174 *
19175 *   # Alpha
19176 *
19177 *   ## Bravo
19178 *
19179 *   ### Charlie
19180 *
19181 * @example
19182 *   {"name": "ok.md", "config": "atx-closed"}
19183 *
19184 *   # Delta ##
19185 *
19186 *   ## Echo ##
19187 *
19188 *   ### Foxtrot ###
19189 *
19190 * @example
19191 *   {"name": "ok.md", "config": "setext"}
19192 *
19193 *   Golf
19194 *   ====
19195 *
19196 *   Hotel
19197 *   -----
19198 *
19199 *   ### India
19200 *
19201 * @example
19202 *   {"name": "not-ok.md", "label": "input"}
19203 *
19204 *   Juliett
19205 *   =======
19206 *
19207 *   ## Kilo
19208 *
19209 *   ### Lima ###
19210 *
19211 * @example
19212 *   {"name": "not-ok.md", "label": "output"}
19213 *
19214 *   4:1-4:8: Headings should use setext
19215 *   6:1-6:13: Headings should use setext
19216 *
19217 * @example
19218 *   {"name": "not-ok.md", "config": "�", "label": "output", "positionless": true}
19219 *
19220 *   1:1: Incorrect heading style type `�`: use either `'consistent'`, `'atx'`, `'atx-closed'`, or `'setext'`
19221 */
19222const remarkLintHeadingStyle = lintRule(
19223  {
19224    origin: 'remark-lint:heading-style',
19225    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-heading-style#readme'
19226  },
19227  (tree, file, option = 'consistent') => {
19228    if (
19229      option !== 'consistent' &&
19230      option !== 'atx' &&
19231      option !== 'atx-closed' &&
19232      option !== 'setext'
19233    ) {
19234      file.fail(
19235        'Incorrect heading style type `' +
19236          option +
19237          "`: use either `'consistent'`, `'atx'`, `'atx-closed'`, or `'setext'`"
19238      );
19239    }
19240    visit$c(tree, 'heading', (node) => {
19241      if (!generated(node)) {
19242        if (option === 'consistent') {
19243          option = headingStyle(node) || 'consistent';
19244        } else if (headingStyle(node, option) !== option) {
19245          file.message('Headings should use ' + option, node);
19246        }
19247      }
19248    });
19249  }
19250);
19251var remarkLintHeadingStyle$1 = remarkLintHeadingStyle;
19252
19253const convert$b =
19254  (
19255    function (test) {
19256      if (test === undefined || test === null) {
19257        return ok$b
19258      }
19259      if (typeof test === 'string') {
19260        return typeFactory$b(test)
19261      }
19262      if (typeof test === 'object') {
19263        return Array.isArray(test) ? anyFactory$b(test) : propsFactory$b(test)
19264      }
19265      if (typeof test === 'function') {
19266        return castFactory$b(test)
19267      }
19268      throw new Error('Expected function, string, or object as test')
19269    }
19270  );
19271function anyFactory$b(tests) {
19272  const checks = [];
19273  let index = -1;
19274  while (++index < tests.length) {
19275    checks[index] = convert$b(tests[index]);
19276  }
19277  return castFactory$b(any)
19278  function any(...parameters) {
19279    let index = -1;
19280    while (++index < checks.length) {
19281      if (checks[index].call(this, ...parameters)) return true
19282    }
19283    return false
19284  }
19285}
19286function propsFactory$b(check) {
19287  return castFactory$b(all)
19288  function all(node) {
19289    let key;
19290    for (key in check) {
19291      if (node[key] !== check[key]) return false
19292    }
19293    return true
19294  }
19295}
19296function typeFactory$b(check) {
19297  return castFactory$b(type)
19298  function type(node) {
19299    return node && node.type === check
19300  }
19301}
19302function castFactory$b(check) {
19303  return assertion
19304  function assertion(node, ...parameters) {
19305    return Boolean(
19306      node &&
19307        typeof node === 'object' &&
19308        'type' in node &&
19309        Boolean(check.call(this, node, ...parameters))
19310    )
19311  }
19312}
19313function ok$b() {
19314  return true
19315}
19316
19317function color$c(d) {
19318  return '\u001B[33m' + d + '\u001B[39m'
19319}
19320
19321const CONTINUE$b = true;
19322const EXIT$b = false;
19323const SKIP$b = 'skip';
19324const visitParents$b =
19325  (
19326    function (tree, test, visitor, reverse) {
19327      if (typeof test === 'function' && typeof visitor !== 'function') {
19328        reverse = visitor;
19329        visitor = test;
19330        test = null;
19331      }
19332      const is = convert$b(test);
19333      const step = reverse ? -1 : 1;
19334      factory(tree, undefined, [])();
19335      function factory(node, index, parents) {
19336        const value = node && typeof node === 'object' ? node : {};
19337        if (typeof value.type === 'string') {
19338          const name =
19339            typeof value.tagName === 'string'
19340              ? value.tagName
19341              :
19342              typeof value.name === 'string'
19343              ? value.name
19344              : undefined;
19345          Object.defineProperty(visit, 'name', {
19346            value:
19347              'node (' + color$c(node.type + (name ? '<' + name + '>' : '')) + ')'
19348          });
19349        }
19350        return visit
19351        function visit() {
19352          let result = [];
19353          let subresult;
19354          let offset;
19355          let grandparents;
19356          if (!test || is(node, index, parents[parents.length - 1] || null)) {
19357            result = toResult$b(visitor(node, parents));
19358            if (result[0] === EXIT$b) {
19359              return result
19360            }
19361          }
19362          if (node.children && result[0] !== SKIP$b) {
19363            offset = (reverse ? node.children.length : -1) + step;
19364            grandparents = parents.concat(node);
19365            while (offset > -1 && offset < node.children.length) {
19366              subresult = factory(node.children[offset], offset, grandparents)();
19367              if (subresult[0] === EXIT$b) {
19368                return subresult
19369              }
19370              offset =
19371                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
19372            }
19373          }
19374          return result
19375        }
19376      }
19377    }
19378  );
19379function toResult$b(value) {
19380  if (Array.isArray(value)) {
19381    return value
19382  }
19383  if (typeof value === 'number') {
19384    return [CONTINUE$b, value]
19385  }
19386  return [value]
19387}
19388
19389const visit$b =
19390  (
19391    function (tree, test, visitor, reverse) {
19392      if (typeof test === 'function' && typeof visitor !== 'function') {
19393        reverse = visitor;
19394        visitor = test;
19395        test = null;
19396      }
19397      visitParents$b(tree, test, overload, reverse);
19398      function overload(node, parents) {
19399        const parent = parents[parents.length - 1];
19400        return visitor(
19401          node,
19402          parent ? parent.children.indexOf(node) : null,
19403          parent
19404        )
19405      }
19406    }
19407  );
19408
19409/**
19410 * ## When should I use this?
19411 *
19412 * You can use this package to check that lines do not exceed a certain size.
19413 *
19414 * ## API
19415 *
19416 * The following options (default: `80`) are accepted:
19417 *
19418 * *   `number` (example: `72`)
19419 *     — max number of characters to accept in heading text
19420 *
19421 * Ignores nodes that cannot be wrapped, such as headings, tables, code,
19422 * definitions, HTML, and JSX.
19423 * Ignores images, links, and code (inline) if they start before the wrap, end
19424 * after the wrap, and there’s no white space after them.
19425 *
19426 * ## Recommendation
19427 *
19428 * Whether to wrap prose or not is a stylistic choice.
19429 *
19430 * @module maximum-line-length
19431 * @summary
19432 *   remark-lint rule to warn when lines are too long.
19433 * @author Titus Wormer
19434 * @copyright 2015 Titus Wormer
19435 * @license MIT
19436 * @example
19437 *   {"name": "ok.md", "positionless": true, "gfm": true}
19438 *
19439 *   This line is simply not toooooooooooooooooooooooooooooooooooooooooooo
19440 *   long.
19441 *
19442 *   This is also fine: <http://this-long-url-with-a-long-domain.co.uk/a-long-path?query=variables>
19443 *
19444 *   <http://this-link-is-fine.com>
19445 *
19446 *   `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()`
19447 *
19448 *   [foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables)
19449 *
19450 *   <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>
19451 *
19452 *   ![foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables)
19453 *
19454 *   | An | exception | is | line | length | in | long | tables | because | those | can’t | just |
19455 *   | -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- |
19456 *   | be | helped    |    |      |        |    |      |        |         |       |       | .    |
19457 *
19458 *   <a><b><i><p><q><s><u>alpha bravo charlie delta echo foxtrot golf</u></s></q></p></i></b></a>
19459 *
19460 *   The following is also fine (note the `.`), because there is no whitespace.
19461 *
19462 *   <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>.
19463 *
19464 *   In addition, definitions are also fine:
19465 *
19466 *   [foo]: <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>
19467 *
19468 * @example
19469 *   {"name": "not-ok.md", "config": 80, "label": "input", "positionless": true}
19470 *
19471 *   This line is simply not tooooooooooooooooooooooooooooooooooooooooooooooooooooooo
19472 *   long.
19473 *
19474 *   Just like thiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis one.
19475 *
19476 *   And this one is also very wrong: because the link starts aaaaaaafter the column: <http://line.com>
19477 *
19478 *   <http://this-long-url-with-a-long-domain-is-not-ok.co.uk/a-long-path?query=variables> and such.
19479 *
19480 *   And this one is also very wrong: because the code starts aaaaaaafter the column: `alpha.bravo()`
19481 *
19482 *   `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscar.papa()` and such.
19483 *
19484 * @example
19485 *   {"name": "not-ok.md", "config": 80, "label": "output", "positionless": true}
19486 *
19487 *   4:86: Line must be at most 80 characters
19488 *   6:99: Line must be at most 80 characters
19489 *   8:96: Line must be at most 80 characters
19490 *   10:97: Line must be at most 80 characters
19491 *   12:99: Line must be at most 80 characters
19492 *
19493 * @example
19494 *   {"name": "ok-mixed-line-endings.md", "config": 10, "positionless": true}
19495 *
19496 *   0123456789␍␊
19497 *   0123456789␊
19498 *   01234␍␊
19499 *   01234␊
19500 *
19501 * @example
19502 *   {"name": "not-ok-mixed-line-endings.md", "config": 10, "label": "input", "positionless": true}
19503 *
19504 *   012345678901␍␊
19505 *   012345678901␊
19506 *   01234567890␍␊
19507 *   01234567890␊
19508 *
19509 * @example
19510 *   {"name": "not-ok-mixed-line-endings.md", "config": 10, "label": "output", "positionless": true}
19511 *
19512 *   1:13: Line must be at most 10 characters
19513 *   2:13: Line must be at most 10 characters
19514 *   3:12: Line must be at most 10 characters
19515 *   4:12: Line must be at most 10 characters
19516 */
19517const remarkLintMaximumLineLength = lintRule(
19518  {
19519    origin: 'remark-lint:maximum-line-length',
19520    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-maximum-line-length#readme'
19521  },
19522  (tree, file, option = 80) => {
19523    const value = String(file);
19524    const lines = value.split(/\r?\n/);
19525    visit$b(tree, (node) => {
19526      if (
19527        (node.type === 'heading' ||
19528          node.type === 'table' ||
19529          node.type === 'code' ||
19530          node.type === 'definition' ||
19531          node.type === 'html' ||
19532          node.type === 'jsx' ||
19533          node.type === 'mdxFlowExpression' ||
19534          node.type === 'mdxJsxFlowElement' ||
19535          node.type === 'mdxJsxTextElement' ||
19536          node.type === 'mdxTextExpression' ||
19537          node.type === 'mdxjsEsm' ||
19538          node.type === 'yaml' ||
19539          node.type === 'toml') &&
19540        !generated(node)
19541      ) {
19542        allowList(pointStart(node).line - 1, pointEnd(node).line);
19543      }
19544    });
19545    visit$b(tree, (node, pos, parent) => {
19546      if (
19547        (node.type === 'link' ||
19548          node.type === 'image' ||
19549          node.type === 'inlineCode') &&
19550        !generated(node) &&
19551        parent &&
19552        typeof pos === 'number'
19553      ) {
19554        const initial = pointStart(node);
19555        const final = pointEnd(node);
19556        if (initial.column > option || final.column < option) {
19557          return
19558        }
19559        const next = parent.children[pos + 1];
19560        if (
19561          next &&
19562          pointStart(next).line === initial.line &&
19563          (!('value' in next) || /^(.+?[ \t].+?)/.test(next.value))
19564        ) {
19565          return
19566        }
19567        allowList(initial.line - 1, final.line);
19568      }
19569    });
19570    let index = -1;
19571    while (++index < lines.length) {
19572      const lineLength = lines[index].length;
19573      if (lineLength > option) {
19574        file.message('Line must be at most ' + option + ' characters', {
19575          line: index + 1,
19576          column: lineLength + 1
19577        });
19578      }
19579    }
19580    function allowList(initial, final) {
19581      while (initial < final) {
19582        lines[initial++] = '';
19583      }
19584    }
19585  }
19586);
19587var remarkLintMaximumLineLength$1 = remarkLintMaximumLineLength;
19588
19589const convert$a =
19590  (
19591    function (test) {
19592      if (test === undefined || test === null) {
19593        return ok$a
19594      }
19595      if (typeof test === 'string') {
19596        return typeFactory$a(test)
19597      }
19598      if (typeof test === 'object') {
19599        return Array.isArray(test) ? anyFactory$a(test) : propsFactory$a(test)
19600      }
19601      if (typeof test === 'function') {
19602        return castFactory$a(test)
19603      }
19604      throw new Error('Expected function, string, or object as test')
19605    }
19606  );
19607function anyFactory$a(tests) {
19608  const checks = [];
19609  let index = -1;
19610  while (++index < tests.length) {
19611    checks[index] = convert$a(tests[index]);
19612  }
19613  return castFactory$a(any)
19614  function any(...parameters) {
19615    let index = -1;
19616    while (++index < checks.length) {
19617      if (checks[index].call(this, ...parameters)) return true
19618    }
19619    return false
19620  }
19621}
19622function propsFactory$a(check) {
19623  return castFactory$a(all)
19624  function all(node) {
19625    let key;
19626    for (key in check) {
19627      if (node[key] !== check[key]) return false
19628    }
19629    return true
19630  }
19631}
19632function typeFactory$a(check) {
19633  return castFactory$a(type)
19634  function type(node) {
19635    return node && node.type === check
19636  }
19637}
19638function castFactory$a(check) {
19639  return assertion
19640  function assertion(node, ...parameters) {
19641    return Boolean(
19642      node &&
19643        typeof node === 'object' &&
19644        'type' in node &&
19645        Boolean(check.call(this, node, ...parameters))
19646    )
19647  }
19648}
19649function ok$a() {
19650  return true
19651}
19652
19653function color$b(d) {
19654  return '\u001B[33m' + d + '\u001B[39m'
19655}
19656
19657const CONTINUE$a = true;
19658const EXIT$a = false;
19659const SKIP$a = 'skip';
19660const visitParents$a =
19661  (
19662    function (tree, test, visitor, reverse) {
19663      if (typeof test === 'function' && typeof visitor !== 'function') {
19664        reverse = visitor;
19665        visitor = test;
19666        test = null;
19667      }
19668      const is = convert$a(test);
19669      const step = reverse ? -1 : 1;
19670      factory(tree, undefined, [])();
19671      function factory(node, index, parents) {
19672        const value = node && typeof node === 'object' ? node : {};
19673        if (typeof value.type === 'string') {
19674          const name =
19675            typeof value.tagName === 'string'
19676              ? value.tagName
19677              :
19678              typeof value.name === 'string'
19679              ? value.name
19680              : undefined;
19681          Object.defineProperty(visit, 'name', {
19682            value:
19683              'node (' + color$b(node.type + (name ? '<' + name + '>' : '')) + ')'
19684          });
19685        }
19686        return visit
19687        function visit() {
19688          let result = [];
19689          let subresult;
19690          let offset;
19691          let grandparents;
19692          if (!test || is(node, index, parents[parents.length - 1] || null)) {
19693            result = toResult$a(visitor(node, parents));
19694            if (result[0] === EXIT$a) {
19695              return result
19696            }
19697          }
19698          if (node.children && result[0] !== SKIP$a) {
19699            offset = (reverse ? node.children.length : -1) + step;
19700            grandparents = parents.concat(node);
19701            while (offset > -1 && offset < node.children.length) {
19702              subresult = factory(node.children[offset], offset, grandparents)();
19703              if (subresult[0] === EXIT$a) {
19704                return subresult
19705              }
19706              offset =
19707                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
19708            }
19709          }
19710          return result
19711        }
19712      }
19713    }
19714  );
19715function toResult$a(value) {
19716  if (Array.isArray(value)) {
19717    return value
19718  }
19719  if (typeof value === 'number') {
19720    return [CONTINUE$a, value]
19721  }
19722  return [value]
19723}
19724
19725const visit$a =
19726  (
19727    function (tree, test, visitor, reverse) {
19728      if (typeof test === 'function' && typeof visitor !== 'function') {
19729        reverse = visitor;
19730        visitor = test;
19731        test = null;
19732      }
19733      visitParents$a(tree, test, overload, reverse);
19734      function overload(node, parents) {
19735        const parent = parents[parents.length - 1];
19736        return visitor(
19737          node,
19738          parent ? parent.children.indexOf(node) : null,
19739          parent
19740        )
19741      }
19742    }
19743  );
19744
19745/**
19746 * ## When should I use this?
19747 *
19748 * You can use this package to check that no more blank lines than needed
19749 * are used between blocks.
19750 *
19751 * ## API
19752 *
19753 * There are no options.
19754 *
19755 * ## Recommendation
19756 *
19757 * More than one blank line has no effect between blocks.
19758 *
19759 * ## Fix
19760 *
19761 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
19762 * adds exactly one blank line between any block.
19763 *
19764 * @module no-consecutive-blank-lines
19765 * @summary
19766 *   remark-lint rule to warn when more blank lines that needed are used
19767 *   between blocks.
19768 * @author Titus Wormer
19769 * @copyright 2015 Titus Wormer
19770 * @license MIT
19771 * @example
19772 *   {"name": "ok.md"}
19773 *
19774 *   Foo…
19775 *   ␊
19776 *   …Bar.
19777 *
19778 * @example
19779 *   {"name": "empty-document.md"}
19780 *
19781 * @example
19782 *   {"name": "not-ok.md", "label": "input"}
19783 *
19784 *   Foo…
19785 *   ␊
19786 *   ␊
19787 *   …Bar
19788 *   ␊
19789 *   ␊
19790 *
19791 * @example
19792 *   {"name": "not-ok.md", "label": "output"}
19793 *
19794 *   4:1: Remove 1 line before node
19795 *   4:5: Remove 2 lines after node
19796 */
19797const unknownContainerSize = new Set(['mdxJsxFlowElement', 'mdxJsxTextElement']);
19798const remarkLintNoConsecutiveBlankLines = lintRule(
19799  {
19800    origin: 'remark-lint:no-consecutive-blank-lines',
19801    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-consecutive-blank-lines#readme'
19802  },
19803  (tree, file) => {
19804    visit$a(tree, (node) => {
19805      if (!generated(node) && 'children' in node) {
19806        const head = node.children[0];
19807        if (head && !generated(head)) {
19808          if (!unknownContainerSize.has(node.type)) {
19809            compare(pointStart(node), pointStart(head), 0);
19810          }
19811          let index = -1;
19812          while (++index < node.children.length) {
19813            const previous = node.children[index - 1];
19814            const child = node.children[index];
19815            if (previous && !generated(previous) && !generated(child)) {
19816              compare(pointEnd(previous), pointStart(child), 2);
19817            }
19818          }
19819          const tail = node.children[node.children.length - 1];
19820          if (
19821            tail !== head &&
19822            !generated(tail) &&
19823            !unknownContainerSize.has(node.type)
19824          ) {
19825            compare(pointEnd(node), pointEnd(tail), 1);
19826          }
19827        }
19828      }
19829    });
19830    function compare(start, end, max) {
19831      const diff = end.line - start.line;
19832      const lines = Math.abs(diff) - max;
19833      if (lines > 0) {
19834        file.message(
19835          'Remove ' +
19836            lines +
19837            ' ' +
19838            plural('line', Math.abs(lines)) +
19839            ' ' +
19840            (diff > 0 ? 'before' : 'after') +
19841            ' node',
19842          end
19843        );
19844      }
19845    }
19846  }
19847);
19848var remarkLintNoConsecutiveBlankLines$1 = remarkLintNoConsecutiveBlankLines;
19849
19850/**
19851 * ## When should I use this?
19852 *
19853 * You can use this package to check that file names do not start with
19854 *  articles (`a`, `the`, etc).
19855 *
19856 * ## API
19857 *
19858 * There are no options.
19859 *
19860 * @module no-file-name-articles
19861 * @summary
19862 *   remark-lint rule to warn when file names start with articles.
19863 * @author Titus Wormer
19864 * @copyright 2015 Titus Wormer
19865 * @license MIT
19866 * @example
19867 *   {"name": "title.md"}
19868 *
19869 * @example
19870 *   {"name": "a-title.md", "label": "output", "positionless": true}
19871 *
19872 *   1:1: Do not start file names with `a`
19873 *
19874 * @example
19875 *   {"name": "the-title.md", "label": "output", "positionless": true}
19876 *
19877 *   1:1: Do not start file names with `the`
19878 *
19879 * @example
19880 *   {"name": "teh-title.md", "label": "output", "positionless": true}
19881 *
19882 *   1:1: Do not start file names with `teh`
19883 *
19884 * @example
19885 *   {"name": "an-article.md", "label": "output", "positionless": true}
19886 *
19887 *   1:1: Do not start file names with `an`
19888 */
19889const remarkLintNoFileNameArticles = lintRule(
19890  {
19891    origin: 'remark-lint:no-file-name-articles',
19892    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-articles#readme'
19893  },
19894  (_, file) => {
19895    const match = file.stem && file.stem.match(/^(the|teh|an?)\b/i);
19896    if (match) {
19897      file.message('Do not start file names with `' + match[0] + '`');
19898    }
19899  }
19900);
19901var remarkLintNoFileNameArticles$1 = remarkLintNoFileNameArticles;
19902
19903/**
19904 * ## When should I use this?
19905 *
19906 * You can use this package to check that no consecutive dashes appear in
19907 * file names.
19908 *
19909 * ## API
19910 *
19911 * There are no options.
19912 *
19913 * @module no-file-name-consecutive-dashes
19914 * @summary
19915 *   remark-lint rule to warn when consecutive dashes appear in file names.
19916 * @author Titus Wormer
19917 * @copyright 2015 Titus Wormer
19918 * @license MIT
19919 * @example
19920 *   {"name": "plug-ins.md"}
19921 *
19922 * @example
19923 *   {"name": "plug--ins.md", "label": "output", "positionless": true}
19924 *
19925 *   1:1: Do not use consecutive dashes in a file name
19926 */
19927const remarkLintNoFileNameConsecutiveDashes = lintRule(
19928  {
19929    origin: 'remark-lint:no-file-name-consecutive-dashes',
19930    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-consecutive-dashes#readme'
19931  },
19932  (_, file) => {
19933    if (file.stem && /-{2,}/.test(file.stem)) {
19934      file.message('Do not use consecutive dashes in a file name');
19935    }
19936  }
19937);
19938var remarkLintNoFileNameConsecutiveDashes$1 = remarkLintNoFileNameConsecutiveDashes;
19939
19940/**
19941 * ## When should I use this?
19942 *
19943 * You can use this package to check that no initial or final dashes appear in
19944 * file names.
19945 *
19946 * ## API
19947 *
19948 * There are no options.
19949 *
19950 * @module no-file-name-outer-dashes
19951 * @summary
19952 *   remark-lint rule to warn when initial or final dashes appear in file names.
19953 * @author Titus Wormer
19954 * @copyright 2015 Titus Wormer
19955 * @license MIT
19956 * @example
19957 *   {"name": "readme.md"}
19958 *
19959 * @example
19960 *   {"name": "-readme.md", "label": "output", "positionless": true}
19961 *
19962 *   1:1: Do not use initial or final dashes in a file name
19963 *
19964 * @example
19965 *   {"name": "readme-.md", "label": "output", "positionless": true}
19966 *
19967 *   1:1: Do not use initial or final dashes in a file name
19968 */
19969const remarkLintNofileNameOuterDashes = lintRule(
19970  {
19971    origin: 'remark-lint:no-file-name-outer-dashes',
19972    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-outer-dashes#readme'
19973  },
19974  (_, file) => {
19975    if (file.stem && /^-|-$/.test(file.stem)) {
19976      file.message('Do not use initial or final dashes in a file name');
19977    }
19978  }
19979);
19980var remarkLintNofileNameOuterDashes$1 = remarkLintNofileNameOuterDashes;
19981
19982const convert$9 =
19983  (
19984    function (test) {
19985      if (test === undefined || test === null) {
19986        return ok$9
19987      }
19988      if (typeof test === 'string') {
19989        return typeFactory$9(test)
19990      }
19991      if (typeof test === 'object') {
19992        return Array.isArray(test) ? anyFactory$9(test) : propsFactory$9(test)
19993      }
19994      if (typeof test === 'function') {
19995        return castFactory$9(test)
19996      }
19997      throw new Error('Expected function, string, or object as test')
19998    }
19999  );
20000function anyFactory$9(tests) {
20001  const checks = [];
20002  let index = -1;
20003  while (++index < tests.length) {
20004    checks[index] = convert$9(tests[index]);
20005  }
20006  return castFactory$9(any)
20007  function any(...parameters) {
20008    let index = -1;
20009    while (++index < checks.length) {
20010      if (checks[index].call(this, ...parameters)) return true
20011    }
20012    return false
20013  }
20014}
20015function propsFactory$9(check) {
20016  return castFactory$9(all)
20017  function all(node) {
20018    let key;
20019    for (key in check) {
20020      if (node[key] !== check[key]) return false
20021    }
20022    return true
20023  }
20024}
20025function typeFactory$9(check) {
20026  return castFactory$9(type)
20027  function type(node) {
20028    return node && node.type === check
20029  }
20030}
20031function castFactory$9(check) {
20032  return assertion
20033  function assertion(node, ...parameters) {
20034    return Boolean(
20035      node &&
20036        typeof node === 'object' &&
20037        'type' in node &&
20038        Boolean(check.call(this, node, ...parameters))
20039    )
20040  }
20041}
20042function ok$9() {
20043  return true
20044}
20045
20046function color$a(d) {
20047  return '\u001B[33m' + d + '\u001B[39m'
20048}
20049
20050const CONTINUE$9 = true;
20051const EXIT$9 = false;
20052const SKIP$9 = 'skip';
20053const visitParents$9 =
20054  (
20055    function (tree, test, visitor, reverse) {
20056      if (typeof test === 'function' && typeof visitor !== 'function') {
20057        reverse = visitor;
20058        visitor = test;
20059        test = null;
20060      }
20061      const is = convert$9(test);
20062      const step = reverse ? -1 : 1;
20063      factory(tree, undefined, [])();
20064      function factory(node, index, parents) {
20065        const value = node && typeof node === 'object' ? node : {};
20066        if (typeof value.type === 'string') {
20067          const name =
20068            typeof value.tagName === 'string'
20069              ? value.tagName
20070              :
20071              typeof value.name === 'string'
20072              ? value.name
20073              : undefined;
20074          Object.defineProperty(visit, 'name', {
20075            value:
20076              'node (' + color$a(node.type + (name ? '<' + name + '>' : '')) + ')'
20077          });
20078        }
20079        return visit
20080        function visit() {
20081          let result = [];
20082          let subresult;
20083          let offset;
20084          let grandparents;
20085          if (!test || is(node, index, parents[parents.length - 1] || null)) {
20086            result = toResult$9(visitor(node, parents));
20087            if (result[0] === EXIT$9) {
20088              return result
20089            }
20090          }
20091          if (node.children && result[0] !== SKIP$9) {
20092            offset = (reverse ? node.children.length : -1) + step;
20093            grandparents = parents.concat(node);
20094            while (offset > -1 && offset < node.children.length) {
20095              subresult = factory(node.children[offset], offset, grandparents)();
20096              if (subresult[0] === EXIT$9) {
20097                return subresult
20098              }
20099              offset =
20100                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
20101            }
20102          }
20103          return result
20104        }
20105      }
20106    }
20107  );
20108function toResult$9(value) {
20109  if (Array.isArray(value)) {
20110    return value
20111  }
20112  if (typeof value === 'number') {
20113    return [CONTINUE$9, value]
20114  }
20115  return [value]
20116}
20117
20118const visit$9 =
20119  (
20120    function (tree, test, visitor, reverse) {
20121      if (typeof test === 'function' && typeof visitor !== 'function') {
20122        reverse = visitor;
20123        visitor = test;
20124        test = null;
20125      }
20126      visitParents$9(tree, test, overload, reverse);
20127      function overload(node, parents) {
20128        const parent = parents[parents.length - 1];
20129        return visitor(
20130          node,
20131          parent ? parent.children.indexOf(node) : null,
20132          parent
20133        )
20134      }
20135    }
20136  );
20137
20138/**
20139 * ## When should I use this?
20140 *
20141 * You can use this package to check that headings are not indented.
20142 *
20143 * ## API
20144 *
20145 * There are no options.
20146 *
20147 * ## Recommendation
20148 *
20149 * There is no specific handling of indented headings (or anything else) in
20150 * markdown.
20151 * While it is possible to use an indent to headings on their text:
20152 *
20153 * ```markdown
20154 *    # One
20155 *   ## Two
20156 *  ### Three
20157 * #### Four
20158 * ```
20159 *
20160 * …such style is uncommon, a bit hard to maintain, and it’s impossible to add a
20161 * heading with a rank of 5 as it would form indented code instead.
20162 * Hence, it’s recommended to not indent headings and to turn this rule on.
20163 *
20164 * ## Fix
20165 *
20166 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
20167 * formats all headings without indent.
20168 *
20169 * @module no-heading-indent
20170 * @summary
20171 *   remark-lint rule to warn when headings are indented.
20172 * @author Titus Wormer
20173 * @copyright 2015 Titus Wormer
20174 * @license MIT
20175 * @example
20176 *   {"name": "ok.md"}
20177 *
20178 *   #·Hello world
20179 *
20180 *   Foo
20181 *   -----
20182 *
20183 *   #·Hello world·#
20184 *
20185 *   Bar
20186 *   =====
20187 *
20188 * @example
20189 *   {"name": "not-ok.md", "label": "input"}
20190 *
20191 *   ···# Hello world
20192 *
20193 *   ·Foo
20194 *   -----
20195 *
20196 *   ·# Hello world #
20197 *
20198 *   ···Bar
20199 *   =====
20200 *
20201 * @example
20202 *   {"name": "not-ok.md", "label": "output"}
20203 *
20204 *   1:4: Remove 3 spaces before this heading
20205 *   3:2: Remove 1 space before this heading
20206 *   6:2: Remove 1 space before this heading
20207 *   8:4: Remove 3 spaces before this heading
20208 */
20209const remarkLintNoHeadingIndent = lintRule(
20210  {
20211    origin: 'remark-lint:no-heading-indent',
20212    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-indent#readme'
20213  },
20214  (tree, file) => {
20215    visit$9(tree, 'heading', (node, _, parent) => {
20216      if (generated(node) || (parent && parent.type !== 'root')) {
20217        return
20218      }
20219      const diff = pointStart(node).column - 1;
20220      if (diff) {
20221        file.message(
20222          'Remove ' +
20223            diff +
20224            ' ' +
20225            plural('space', diff) +
20226            ' before this heading',
20227          pointStart(node)
20228        );
20229      }
20230    });
20231  }
20232);
20233var remarkLintNoHeadingIndent$1 = remarkLintNoHeadingIndent;
20234
20235const convert$8 =
20236  (
20237    function (test) {
20238      if (test === undefined || test === null) {
20239        return ok$8
20240      }
20241      if (typeof test === 'string') {
20242        return typeFactory$8(test)
20243      }
20244      if (typeof test === 'object') {
20245        return Array.isArray(test) ? anyFactory$8(test) : propsFactory$8(test)
20246      }
20247      if (typeof test === 'function') {
20248        return castFactory$8(test)
20249      }
20250      throw new Error('Expected function, string, or object as test')
20251    }
20252  );
20253function anyFactory$8(tests) {
20254  const checks = [];
20255  let index = -1;
20256  while (++index < tests.length) {
20257    checks[index] = convert$8(tests[index]);
20258  }
20259  return castFactory$8(any)
20260  function any(...parameters) {
20261    let index = -1;
20262    while (++index < checks.length) {
20263      if (checks[index].call(this, ...parameters)) return true
20264    }
20265    return false
20266  }
20267}
20268function propsFactory$8(check) {
20269  return castFactory$8(all)
20270  function all(node) {
20271    let key;
20272    for (key in check) {
20273      if (node[key] !== check[key]) return false
20274    }
20275    return true
20276  }
20277}
20278function typeFactory$8(check) {
20279  return castFactory$8(type)
20280  function type(node) {
20281    return node && node.type === check
20282  }
20283}
20284function castFactory$8(check) {
20285  return assertion
20286  function assertion(node, ...parameters) {
20287    return Boolean(
20288      node &&
20289        typeof node === 'object' &&
20290        'type' in node &&
20291        Boolean(check.call(this, node, ...parameters))
20292    )
20293  }
20294}
20295function ok$8() {
20296  return true
20297}
20298
20299function color$9(d) {
20300  return '\u001B[33m' + d + '\u001B[39m'
20301}
20302
20303const CONTINUE$8 = true;
20304const EXIT$8 = false;
20305const SKIP$8 = 'skip';
20306const visitParents$8 =
20307  (
20308    function (tree, test, visitor, reverse) {
20309      if (typeof test === 'function' && typeof visitor !== 'function') {
20310        reverse = visitor;
20311        visitor = test;
20312        test = null;
20313      }
20314      const is = convert$8(test);
20315      const step = reverse ? -1 : 1;
20316      factory(tree, undefined, [])();
20317      function factory(node, index, parents) {
20318        const value = node && typeof node === 'object' ? node : {};
20319        if (typeof value.type === 'string') {
20320          const name =
20321            typeof value.tagName === 'string'
20322              ? value.tagName
20323              :
20324              typeof value.name === 'string'
20325              ? value.name
20326              : undefined;
20327          Object.defineProperty(visit, 'name', {
20328            value:
20329              'node (' + color$9(node.type + (name ? '<' + name + '>' : '')) + ')'
20330          });
20331        }
20332        return visit
20333        function visit() {
20334          let result = [];
20335          let subresult;
20336          let offset;
20337          let grandparents;
20338          if (!test || is(node, index, parents[parents.length - 1] || null)) {
20339            result = toResult$8(visitor(node, parents));
20340            if (result[0] === EXIT$8) {
20341              return result
20342            }
20343          }
20344          if (node.children && result[0] !== SKIP$8) {
20345            offset = (reverse ? node.children.length : -1) + step;
20346            grandparents = parents.concat(node);
20347            while (offset > -1 && offset < node.children.length) {
20348              subresult = factory(node.children[offset], offset, grandparents)();
20349              if (subresult[0] === EXIT$8) {
20350                return subresult
20351              }
20352              offset =
20353                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
20354            }
20355          }
20356          return result
20357        }
20358      }
20359    }
20360  );
20361function toResult$8(value) {
20362  if (Array.isArray(value)) {
20363    return value
20364  }
20365  if (typeof value === 'number') {
20366    return [CONTINUE$8, value]
20367  }
20368  return [value]
20369}
20370
20371const visit$8 =
20372  (
20373    function (tree, test, visitor, reverse) {
20374      if (typeof test === 'function' && typeof visitor !== 'function') {
20375        reverse = visitor;
20376        visitor = test;
20377        test = null;
20378      }
20379      visitParents$8(tree, test, overload, reverse);
20380      function overload(node, parents) {
20381        const parent = parents[parents.length - 1];
20382        return visitor(
20383          node,
20384          parent ? parent.children.indexOf(node) : null,
20385          parent
20386        )
20387      }
20388    }
20389  );
20390
20391function stringifyPosition(value) {
20392  if (!value || typeof value !== 'object') {
20393    return ''
20394  }
20395  if ('position' in value || 'type' in value) {
20396    return position(value.position)
20397  }
20398  if ('start' in value || 'end' in value) {
20399    return position(value)
20400  }
20401  if ('line' in value || 'column' in value) {
20402    return point(value)
20403  }
20404  return ''
20405}
20406function point(point) {
20407  return index(point && point.line) + ':' + index(point && point.column)
20408}
20409function position(pos) {
20410  return point(pos && pos.start) + '-' + point(pos && pos.end)
20411}
20412function index(value) {
20413  return value && typeof value === 'number' ? value : 1
20414}
20415
20416/**
20417 * ## When should I use this?
20418 *
20419 * You can use this package to check that no more than one top level heading
20420 * is used.
20421 *
20422 * ## API
20423 *
20424 * The following options (default: `1`) are accepted:
20425 *
20426 * *   `number` (example: `1`)
20427 *     — assumed top level heading rank
20428 *
20429 * ## Recommendation
20430 *
20431 * Documents should almost always have one main heading, which is typically a
20432 * heading with a rank of `1`.
20433 *
20434 * @module no-multiple-toplevel-headings
20435 * @summary
20436 *   remark-lint rule to warn when more than one top level heading is used.
20437 * @author Titus Wormer
20438 * @copyright 2015 Titus Wormer
20439 * @license MIT
20440 * @example
20441 *   {"name": "ok.md", "config": 1}
20442 *
20443 *   # Foo
20444 *
20445 *   ## Bar
20446 *
20447 * @example
20448 *   {"name": "not-ok.md", "config": 1, "label": "input"}
20449 *
20450 *   # Foo
20451 *
20452 *   # Bar
20453 *
20454 * @example
20455 *   {"name": "not-ok.md", "config": 1, "label": "output"}
20456 *
20457 *   3:1-3:6: Don’t use multiple top level headings (1:1)
20458 */
20459const remarkLintNoMultipleToplevelHeadings = lintRule(
20460  {
20461    origin: 'remark-lint:no-multiple-toplevel-headings',
20462    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-multiple-toplevel-headings#readme'
20463  },
20464  (tree, file, option = 1) => {
20465    let duplicate;
20466    visit$8(tree, 'heading', (node) => {
20467      if (!generated(node) && node.depth === option) {
20468        if (duplicate) {
20469          file.message(
20470            'Don’t use multiple top level headings (' + duplicate + ')',
20471            node
20472          );
20473        } else {
20474          duplicate = stringifyPosition(pointStart(node));
20475        }
20476      }
20477    });
20478  }
20479);
20480var remarkLintNoMultipleToplevelHeadings$1 = remarkLintNoMultipleToplevelHeadings;
20481
20482const convert$7 =
20483  (
20484    function (test) {
20485      if (test === undefined || test === null) {
20486        return ok$7
20487      }
20488      if (typeof test === 'string') {
20489        return typeFactory$7(test)
20490      }
20491      if (typeof test === 'object') {
20492        return Array.isArray(test) ? anyFactory$7(test) : propsFactory$7(test)
20493      }
20494      if (typeof test === 'function') {
20495        return castFactory$7(test)
20496      }
20497      throw new Error('Expected function, string, or object as test')
20498    }
20499  );
20500function anyFactory$7(tests) {
20501  const checks = [];
20502  let index = -1;
20503  while (++index < tests.length) {
20504    checks[index] = convert$7(tests[index]);
20505  }
20506  return castFactory$7(any)
20507  function any(...parameters) {
20508    let index = -1;
20509    while (++index < checks.length) {
20510      if (checks[index].call(this, ...parameters)) return true
20511    }
20512    return false
20513  }
20514}
20515function propsFactory$7(check) {
20516  return castFactory$7(all)
20517  function all(node) {
20518    let key;
20519    for (key in check) {
20520      if (node[key] !== check[key]) return false
20521    }
20522    return true
20523  }
20524}
20525function typeFactory$7(check) {
20526  return castFactory$7(type)
20527  function type(node) {
20528    return node && node.type === check
20529  }
20530}
20531function castFactory$7(check) {
20532  return assertion
20533  function assertion(node, ...parameters) {
20534    return Boolean(
20535      node &&
20536        typeof node === 'object' &&
20537        'type' in node &&
20538        Boolean(check.call(this, node, ...parameters))
20539    )
20540  }
20541}
20542function ok$7() {
20543  return true
20544}
20545
20546function color$8(d) {
20547  return '\u001B[33m' + d + '\u001B[39m'
20548}
20549
20550const CONTINUE$7 = true;
20551const EXIT$7 = false;
20552const SKIP$7 = 'skip';
20553const visitParents$7 =
20554  (
20555    function (tree, test, visitor, reverse) {
20556      if (typeof test === 'function' && typeof visitor !== 'function') {
20557        reverse = visitor;
20558        visitor = test;
20559        test = null;
20560      }
20561      const is = convert$7(test);
20562      const step = reverse ? -1 : 1;
20563      factory(tree, undefined, [])();
20564      function factory(node, index, parents) {
20565        const value = node && typeof node === 'object' ? node : {};
20566        if (typeof value.type === 'string') {
20567          const name =
20568            typeof value.tagName === 'string'
20569              ? value.tagName
20570              :
20571              typeof value.name === 'string'
20572              ? value.name
20573              : undefined;
20574          Object.defineProperty(visit, 'name', {
20575            value:
20576              'node (' + color$8(node.type + (name ? '<' + name + '>' : '')) + ')'
20577          });
20578        }
20579        return visit
20580        function visit() {
20581          let result = [];
20582          let subresult;
20583          let offset;
20584          let grandparents;
20585          if (!test || is(node, index, parents[parents.length - 1] || null)) {
20586            result = toResult$7(visitor(node, parents));
20587            if (result[0] === EXIT$7) {
20588              return result
20589            }
20590          }
20591          if (node.children && result[0] !== SKIP$7) {
20592            offset = (reverse ? node.children.length : -1) + step;
20593            grandparents = parents.concat(node);
20594            while (offset > -1 && offset < node.children.length) {
20595              subresult = factory(node.children[offset], offset, grandparents)();
20596              if (subresult[0] === EXIT$7) {
20597                return subresult
20598              }
20599              offset =
20600                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
20601            }
20602          }
20603          return result
20604        }
20605      }
20606    }
20607  );
20608function toResult$7(value) {
20609  if (Array.isArray(value)) {
20610    return value
20611  }
20612  if (typeof value === 'number') {
20613    return [CONTINUE$7, value]
20614  }
20615  return [value]
20616}
20617
20618const visit$7 =
20619  (
20620    function (tree, test, visitor, reverse) {
20621      if (typeof test === 'function' && typeof visitor !== 'function') {
20622        reverse = visitor;
20623        visitor = test;
20624        test = null;
20625      }
20626      visitParents$7(tree, test, overload, reverse);
20627      function overload(node, parents) {
20628        const parent = parents[parents.length - 1];
20629        return visitor(
20630          node,
20631          parent ? parent.children.indexOf(node) : null,
20632          parent
20633        )
20634      }
20635    }
20636  );
20637
20638/**
20639 * ## When should I use this?
20640 *
20641 * You can use this package to check that not all lines in shell code are
20642 * preceded by dollars (`$`).
20643 *
20644 * ## API
20645 *
20646 * There are no options.
20647 *
20648 * ## Recommendation
20649 *
20650 * Dollars make copy/pasting hard.
20651 * Either put both dollars in front of some lines (to indicate shell commands)
20652 * and don’t put them in front of other lines, or use fenced code to indicate
20653 * shell commands on their own, followed by another fenced code that contains
20654 * just the output.
20655 *
20656 * @module no-shell-dollars
20657 * @summary
20658 *   remark-lint rule to warn every line in shell code is preceded by `$`s.
20659 * @author Titus Wormer
20660 * @copyright 2015 Titus Wormer
20661 * @license MIT
20662 * @example
20663 *   {"name": "ok.md"}
20664 *
20665 *   ```bash
20666 *   echo a
20667 *   ```
20668 *
20669 *   ```sh
20670 *   echo a
20671 *   echo a > file
20672 *   ```
20673 *
20674 *   ```zsh
20675 *   $ echo a
20676 *   a
20677 *   $ echo a > file
20678 *   ```
20679 *
20680 *   Some empty code:
20681 *
20682 *   ```command
20683 *   ```
20684 *
20685 *   It’s fine to use dollars in non-shell code.
20686 *
20687 *   ```js
20688 *   $('div').remove()
20689 *   ```
20690 *
20691 * @example
20692 *   {"name": "not-ok.md", "label": "input"}
20693 *
20694 *   ```sh
20695 *   $ echo a
20696 *   ```
20697 *
20698 *   ```bash
20699 *   $ echo a
20700 *   $ echo a > file
20701 *   ```
20702 *
20703 * @example
20704 *   {"name": "not-ok.md", "label": "output"}
20705 *
20706 *   1:1-3:4: Do not use dollar signs before shell commands
20707 *   5:1-8:4: Do not use dollar signs before shell commands
20708 */
20709const flags = new Set([
20710  'sh',
20711  'bash',
20712  'bats',
20713  'cgi',
20714  'command',
20715  'fcgi',
20716  'ksh',
20717  'tmux',
20718  'tool',
20719  'zsh'
20720]);
20721const remarkLintNoShellDollars = lintRule(
20722  {
20723    origin: 'remark-lint:no-shell-dollars',
20724    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-shell-dollars#readme'
20725  },
20726  (tree, file) => {
20727    visit$7(tree, 'code', (node) => {
20728      if (!generated(node) && node.lang && flags.has(node.lang)) {
20729        const lines = node.value
20730          .split('\n')
20731          .filter((line) => line.trim().length > 0);
20732        let index = -1;
20733        if (lines.length === 0) {
20734          return
20735        }
20736        while (++index < lines.length) {
20737          const line = lines[index];
20738          if (line.trim() && !/^\s*\$\s*/.test(line)) {
20739            return
20740          }
20741        }
20742        file.message('Do not use dollar signs before shell commands', node);
20743      }
20744    });
20745  }
20746);
20747var remarkLintNoShellDollars$1 = remarkLintNoShellDollars;
20748
20749const convert$6 =
20750  (
20751    function (test) {
20752      if (test === undefined || test === null) {
20753        return ok$6
20754      }
20755      if (typeof test === 'string') {
20756        return typeFactory$6(test)
20757      }
20758      if (typeof test === 'object') {
20759        return Array.isArray(test) ? anyFactory$6(test) : propsFactory$6(test)
20760      }
20761      if (typeof test === 'function') {
20762        return castFactory$6(test)
20763      }
20764      throw new Error('Expected function, string, or object as test')
20765    }
20766  );
20767function anyFactory$6(tests) {
20768  const checks = [];
20769  let index = -1;
20770  while (++index < tests.length) {
20771    checks[index] = convert$6(tests[index]);
20772  }
20773  return castFactory$6(any)
20774  function any(...parameters) {
20775    let index = -1;
20776    while (++index < checks.length) {
20777      if (checks[index].call(this, ...parameters)) return true
20778    }
20779    return false
20780  }
20781}
20782function propsFactory$6(check) {
20783  return castFactory$6(all)
20784  function all(node) {
20785    let key;
20786    for (key in check) {
20787      if (node[key] !== check[key]) return false
20788    }
20789    return true
20790  }
20791}
20792function typeFactory$6(check) {
20793  return castFactory$6(type)
20794  function type(node) {
20795    return node && node.type === check
20796  }
20797}
20798function castFactory$6(check) {
20799  return assertion
20800  function assertion(node, ...parameters) {
20801    return Boolean(
20802      node &&
20803        typeof node === 'object' &&
20804        'type' in node &&
20805        Boolean(check.call(this, node, ...parameters))
20806    )
20807  }
20808}
20809function ok$6() {
20810  return true
20811}
20812
20813function color$7(d) {
20814  return '\u001B[33m' + d + '\u001B[39m'
20815}
20816
20817const CONTINUE$6 = true;
20818const EXIT$6 = false;
20819const SKIP$6 = 'skip';
20820const visitParents$6 =
20821  (
20822    function (tree, test, visitor, reverse) {
20823      if (typeof test === 'function' && typeof visitor !== 'function') {
20824        reverse = visitor;
20825        visitor = test;
20826        test = null;
20827      }
20828      const is = convert$6(test);
20829      const step = reverse ? -1 : 1;
20830      factory(tree, undefined, [])();
20831      function factory(node, index, parents) {
20832        const value = node && typeof node === 'object' ? node : {};
20833        if (typeof value.type === 'string') {
20834          const name =
20835            typeof value.tagName === 'string'
20836              ? value.tagName
20837              :
20838              typeof value.name === 'string'
20839              ? value.name
20840              : undefined;
20841          Object.defineProperty(visit, 'name', {
20842            value:
20843              'node (' + color$7(node.type + (name ? '<' + name + '>' : '')) + ')'
20844          });
20845        }
20846        return visit
20847        function visit() {
20848          let result = [];
20849          let subresult;
20850          let offset;
20851          let grandparents;
20852          if (!test || is(node, index, parents[parents.length - 1] || null)) {
20853            result = toResult$6(visitor(node, parents));
20854            if (result[0] === EXIT$6) {
20855              return result
20856            }
20857          }
20858          if (node.children && result[0] !== SKIP$6) {
20859            offset = (reverse ? node.children.length : -1) + step;
20860            grandparents = parents.concat(node);
20861            while (offset > -1 && offset < node.children.length) {
20862              subresult = factory(node.children[offset], offset, grandparents)();
20863              if (subresult[0] === EXIT$6) {
20864                return subresult
20865              }
20866              offset =
20867                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
20868            }
20869          }
20870          return result
20871        }
20872      }
20873    }
20874  );
20875function toResult$6(value) {
20876  if (Array.isArray(value)) {
20877    return value
20878  }
20879  if (typeof value === 'number') {
20880    return [CONTINUE$6, value]
20881  }
20882  return [value]
20883}
20884
20885const visit$6 =
20886  (
20887    function (tree, test, visitor, reverse) {
20888      if (typeof test === 'function' && typeof visitor !== 'function') {
20889        reverse = visitor;
20890        visitor = test;
20891        test = null;
20892      }
20893      visitParents$6(tree, test, overload, reverse);
20894      function overload(node, parents) {
20895        const parent = parents[parents.length - 1];
20896        return visitor(
20897          node,
20898          parent ? parent.children.indexOf(node) : null,
20899          parent
20900        )
20901      }
20902    }
20903  );
20904
20905/**
20906 * ## When should I use this?
20907 *
20908 * You can use this package to check that tables are not indented.
20909 * Tables are a GFM feature enabled with
20910 * [`remark-gfm`](https://github.com/remarkjs/remark-gfm).
20911 *
20912 * ## API
20913 *
20914 * There are no options.
20915 *
20916 * ## Recommendation
20917 *
20918 * There is no specific handling of indented tables (or anything else) in
20919 * markdown.
20920 * Hence, it’s recommended to not indent tables and to turn this rule on.
20921 *
20922 * ## Fix
20923 *
20924 * [`remark-gfm`](https://github.com/remarkjs/remark-gfm)
20925 * formats all tables without indent.
20926 *
20927 * @module no-table-indentation
20928 * @summary
20929 *   remark-lint rule to warn when tables are indented.
20930 * @author Titus Wormer
20931 * @copyright 2015 Titus Wormer
20932 * @license MIT
20933 * @example
20934 *   {"name": "ok.md", "gfm": true}
20935 *
20936 *   Paragraph.
20937 *
20938 *   | A     | B     |
20939 *   | ----- | ----- |
20940 *   | Alpha | Bravo |
20941 *
20942 * @example
20943 *   {"name": "not-ok.md", "label": "input", "gfm": true}
20944 *
20945 *   Paragraph.
20946 *
20947 *   ···| A     | B     |
20948 *   ···| ----- | ----- |
20949 *   ···| Alpha | Bravo |
20950 *
20951 * @example
20952 *   {"name": "not-ok.md", "label": "output", "gfm": true}
20953 *
20954 *   3:4: Do not indent table rows
20955 *   4:4: Do not indent table rows
20956 *   5:4: Do not indent table rows
20957 *
20958 * @example
20959 *   {"name": "not-ok-blockquote.md", "label": "input", "gfm": true}
20960 *
20961 *   >··| A |
20962 *   >·| - |
20963 *
20964 * @example
20965 *   {"name": "not-ok-blockquote.md", "label": "output", "gfm": true}
20966 *
20967 *   1:4: Do not indent table rows
20968 *
20969 * @example
20970 *   {"name": "not-ok-list.md", "label": "input", "gfm": true}
20971 *
20972 *   -···paragraph
20973 *
20974 *   ·····| A |
20975 *   ····| - |
20976 *
20977 * @example
20978 *   {"name": "not-ok-list.md", "label": "output", "gfm": true}
20979 *
20980 *   3:6: Do not indent table rows
20981 */
20982const remarkLintNoTableIndentation = lintRule(
20983  {
20984    origin: 'remark-lint:no-table-indentation',
20985    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-table-indentation#readme'
20986  },
20987  (tree, file) => {
20988    const value = String(file);
20989    const loc = location(value);
20990    visit$6(tree, 'table', (node, _, parent) => {
20991      const end = pointEnd(node).line;
20992      let line = pointStart(node).line;
20993      let column = 0;
20994      if (parent && parent.type === 'root') {
20995        column = 1;
20996      } else if (parent && parent.type === 'blockquote') {
20997        column = pointStart(parent).column + 2;
20998      } else if (parent && parent.type === 'listItem') {
20999        column = pointStart(parent.children[0]).column;
21000        if (parent.children[0] === node) {
21001          line++;
21002        }
21003      }
21004      if (!column || !line) {
21005        return
21006      }
21007      while (line <= end) {
21008        let offset = loc.toOffset({line, column});
21009        const lineColumn = offset;
21010        while (/[ \t]/.test(value.charAt(offset - 1))) {
21011          offset--;
21012        }
21013        if (!offset || /[\r\n>]/.test(value.charAt(offset - 1))) {
21014          offset = lineColumn;
21015          while (/[ \t]/.test(value.charAt(offset))) {
21016            offset++;
21017          }
21018          if (lineColumn !== offset) {
21019            file.message('Do not indent table rows', loc.toPoint(offset));
21020          }
21021        }
21022        line++;
21023      }
21024      return SKIP$6
21025    });
21026  }
21027);
21028var remarkLintNoTableIndentation$1 = remarkLintNoTableIndentation;
21029
21030/**
21031 * ## When should I use this?
21032 *
21033 * You can use this package to check that tabs are not used.
21034 *
21035 * ## API
21036 *
21037 * There are no options.
21038 *
21039 * ## Recommendation
21040 *
21041 * Regardless of the debate in other languages of whether to use tabs vs.
21042 * spaces, when it comes to markdown, tabs do not work as expected.
21043 * Largely around contains such as block quotes and lists.
21044 * Take for example block quotes: `>\ta` gives a paragraph with the text `a`
21045 * in a blockquote, so one might expect that `>\t\ta` results in indented code
21046 * with the text `a` in a block quote.
21047 *
21048 * ```markdown
21049 * >\ta
21050 *
21051 * >\t\ta
21052 * ```
21053 *
21054 * Yields:
21055 *
21056 * ```html
21057 * <blockquote>
21058 * <p>a</p>
21059 * </blockquote>
21060 * <blockquote>
21061 * <pre><code>  a
21062 * </code></pre>
21063 * </blockquote>
21064 * ```
21065 *
21066 * Because markdown uses a hardcoded tab size of 4, the first tab could be
21067 * represented as 3 spaces (because there’s a `>` before).
21068 * One of those “spaces” is taken because block quotes allow the `>` to be
21069 * followed by one space, leaving 2 spaces.
21070 * The next tab can be represented as 4 spaces, so together we have 6 spaces.
21071 * The indented code uses 4 spaces, so there are two spaces left, which are
21072 * shown in the indented code.
21073 *
21074 * ## Fix
21075 *
21076 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
21077 * uses spaces exclusively for indentation.
21078 *
21079 * @module no-tabs
21080 * @summary
21081 *   remark-lint rule to warn when tabs are used.
21082 * @author Titus Wormer
21083 * @copyright 2015 Titus Wormer
21084 * @license MIT
21085 * @example
21086 *   {"name": "ok.md"}
21087 *
21088 *   Foo Bar
21089 *
21090 *   ····Foo
21091 *
21092 * @example
21093 *   {"name": "not-ok.md", "label": "input", "positionless": true}
21094 *
21095 *   »Here's one before a code block.
21096 *
21097 *   Here's a tab:», and here is another:».
21098 *
21099 *   And this is in `inline»code`.
21100 *
21101 *   >»This is in a block quote.
21102 *
21103 *   *»And…
21104 *
21105 *   »1.»in a list.
21106 *
21107 *   And this is a tab as the last character.»
21108 *
21109 * @example
21110 *   {"name": "not-ok.md", "label": "output"}
21111 *
21112 *   1:1: Use spaces instead of tabs
21113 *   3:14: Use spaces instead of tabs
21114 *   3:37: Use spaces instead of tabs
21115 *   5:23: Use spaces instead of tabs
21116 *   7:2: Use spaces instead of tabs
21117 *   9:2: Use spaces instead of tabs
21118 *   11:1: Use spaces instead of tabs
21119 *   11:4: Use spaces instead of tabs
21120 *   13:41: Use spaces instead of tabs
21121 */
21122const remarkLintNoTabs = lintRule(
21123  {
21124    origin: 'remark-lint:no-tabs',
21125    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-tabs#readme'
21126  },
21127  (_, file) => {
21128    const value = String(file);
21129    const toPoint = location(file).toPoint;
21130    let index = value.indexOf('\t');
21131    while (index !== -1) {
21132      file.message('Use spaces instead of tabs', toPoint(index));
21133      index = value.indexOf('\t', index + 1);
21134    }
21135  }
21136);
21137var remarkLintNoTabs$1 = remarkLintNoTabs;
21138
21139var sliced$1 = function (args, slice, sliceEnd) {
21140  var ret = [];
21141  var len = args.length;
21142  if (0 === len) return ret;
21143  var start = slice < 0
21144    ? Math.max(0, slice + len)
21145    : slice || 0;
21146  if (sliceEnd !== undefined) {
21147    len = sliceEnd < 0
21148      ? sliceEnd + len
21149      : sliceEnd;
21150  }
21151  while (len-- > start) {
21152    ret[len - start] = args[len];
21153  }
21154  return ret;
21155};
21156getDefaultExportFromCjs(sliced$1);
21157
21158var slice = Array.prototype.slice;
21159var co_1 = co$1;
21160function co$1(fn) {
21161  var isGenFun = isGeneratorFunction(fn);
21162  return function (done) {
21163    var ctx = this;
21164    var gen = fn;
21165    if (isGenFun) {
21166      var args = slice.call(arguments), len = args.length;
21167      var hasCallback = len && 'function' == typeof args[len - 1];
21168      done = hasCallback ? args.pop() : error;
21169      gen = fn.apply(this, args);
21170    } else {
21171      done = done || error;
21172    }
21173    next();
21174    function exit(err, res) {
21175      setImmediate(function(){
21176        done.call(ctx, err, res);
21177      });
21178    }
21179    function next(err, res) {
21180      var ret;
21181      if (arguments.length > 2) res = slice.call(arguments, 1);
21182      if (err) {
21183        try {
21184          ret = gen.throw(err);
21185        } catch (e) {
21186          return exit(e);
21187        }
21188      }
21189      if (!err) {
21190        try {
21191          ret = gen.next(res);
21192        } catch (e) {
21193          return exit(e);
21194        }
21195      }
21196      if (ret.done) return exit(null, ret.value);
21197      ret.value = toThunk(ret.value, ctx);
21198      if ('function' == typeof ret.value) {
21199        var called = false;
21200        try {
21201          ret.value.call(ctx, function(){
21202            if (called) return;
21203            called = true;
21204            next.apply(ctx, arguments);
21205          });
21206        } catch (e) {
21207          setImmediate(function(){
21208            if (called) return;
21209            called = true;
21210            next(e);
21211          });
21212        }
21213        return;
21214      }
21215      next(new TypeError('You may only yield a function, promise, generator, array, or object, '
21216        + 'but the following was passed: "' + String(ret.value) + '"'));
21217    }
21218  }
21219}
21220function toThunk(obj, ctx) {
21221  if (isGeneratorFunction(obj)) {
21222    return co$1(obj.call(ctx));
21223  }
21224  if (isGenerator(obj)) {
21225    return co$1(obj);
21226  }
21227  if (isPromise(obj)) {
21228    return promiseToThunk(obj);
21229  }
21230  if ('function' == typeof obj) {
21231    return obj;
21232  }
21233  if (isObject$1(obj) || Array.isArray(obj)) {
21234    return objectToThunk.call(ctx, obj);
21235  }
21236  return obj;
21237}
21238function objectToThunk(obj){
21239  var ctx = this;
21240  var isArray = Array.isArray(obj);
21241  return function(done){
21242    var keys = Object.keys(obj);
21243    var pending = keys.length;
21244    var results = isArray
21245      ? new Array(pending)
21246      : new obj.constructor();
21247    var finished;
21248    if (!pending) {
21249      setImmediate(function(){
21250        done(null, results);
21251      });
21252      return;
21253    }
21254    if (!isArray) {
21255      for (var i = 0; i < pending; i++) {
21256        results[keys[i]] = undefined;
21257      }
21258    }
21259    for (var i = 0; i < keys.length; i++) {
21260      run(obj[keys[i]], keys[i]);
21261    }
21262    function run(fn, key) {
21263      if (finished) return;
21264      try {
21265        fn = toThunk(fn, ctx);
21266        if ('function' != typeof fn) {
21267          results[key] = fn;
21268          return --pending || done(null, results);
21269        }
21270        fn.call(ctx, function(err, res){
21271          if (finished) return;
21272          if (err) {
21273            finished = true;
21274            return done(err);
21275          }
21276          results[key] = res;
21277          --pending || done(null, results);
21278        });
21279      } catch (err) {
21280        finished = true;
21281        done(err);
21282      }
21283    }
21284  }
21285}
21286function promiseToThunk(promise) {
21287  return function(fn){
21288    promise.then(function(res) {
21289      fn(null, res);
21290    }, fn);
21291  }
21292}
21293function isPromise(obj) {
21294  return obj && 'function' == typeof obj.then;
21295}
21296function isGenerator(obj) {
21297  return obj && 'function' == typeof obj.next && 'function' == typeof obj.throw;
21298}
21299function isGeneratorFunction(obj) {
21300  return obj && obj.constructor && 'GeneratorFunction' == obj.constructor.name;
21301}
21302function isObject$1(val) {
21303  return val && Object == val.constructor;
21304}
21305function error(err) {
21306  if (!err) return;
21307  setImmediate(function(){
21308    throw err;
21309  });
21310}
21311getDefaultExportFromCjs(co_1);
21312
21313var sliced = sliced$1;
21314var noop = function(){};
21315var co = co_1;
21316var wrapped_1 = wrapped$1;
21317function wrapped$1(fn) {
21318  function wrap() {
21319    var args = sliced(arguments);
21320    var last = args[args.length - 1];
21321    var ctx = this;
21322    var done = typeof last == 'function' ? args.pop() : noop;
21323    if (!fn) {
21324      return done.apply(ctx, [null].concat(args));
21325    }
21326    if (generator(fn)) {
21327      return co(fn).apply(ctx, args.concat(done));
21328    }
21329    if (fn.length > args.length) {
21330      try {
21331        return fn.apply(ctx, args.concat(done));
21332      } catch (e) {
21333        return done(e);
21334      }
21335    }
21336    return sync(fn, done).apply(ctx, args);
21337  }
21338  return wrap;
21339}
21340function sync(fn, done) {
21341  return function () {
21342    var ret;
21343    try {
21344      ret = fn.apply(this, arguments);
21345    } catch (err) {
21346      return done(err);
21347    }
21348    if (promise(ret)) {
21349      ret.then(function (value) { done(null, value); }, done);
21350    } else {
21351      ret instanceof Error ? done(ret) : done(null, ret);
21352    }
21353  }
21354}
21355function generator(value) {
21356  return value
21357    && value.constructor
21358    && 'GeneratorFunction' == value.constructor.name;
21359}
21360function promise(value) {
21361  return value && 'function' == typeof value.then;
21362}
21363getDefaultExportFromCjs(wrapped_1);
21364
21365var wrapped = wrapped_1;
21366var unifiedLintRule = factory;
21367function factory(id, rule) {
21368  var parts = id.split(':');
21369  var source = parts[0];
21370  var ruleId = parts[1];
21371  var fn = wrapped(rule);
21372  if (!ruleId) {
21373    ruleId = source;
21374    source = null;
21375  }
21376  attacher.displayName = id;
21377  return attacher
21378  function attacher(raw) {
21379    var config = coerce(ruleId, raw);
21380    var severity = config[0];
21381    var options = config[1];
21382    var fatal = severity === 2;
21383    return severity ? transformer : undefined
21384    function transformer(tree, file, next) {
21385      var index = file.messages.length;
21386      fn(tree, file, options, done);
21387      function done(err) {
21388        var messages = file.messages;
21389        var message;
21390        if (err && messages.indexOf(err) === -1) {
21391          try {
21392            file.fail(err);
21393          } catch (_) {}
21394        }
21395        while (index < messages.length) {
21396          message = messages[index];
21397          message.ruleId = ruleId;
21398          message.source = source;
21399          message.fatal = fatal;
21400          index++;
21401        }
21402        next();
21403      }
21404    }
21405  }
21406}
21407function coerce(name, value) {
21408  var def = 1;
21409  var result;
21410  var level;
21411  if (typeof value === 'boolean') {
21412    result = [value];
21413  } else if (value == null) {
21414    result = [def];
21415  } else if (
21416    typeof value === 'object' &&
21417    (typeof value[0] === 'number' ||
21418      typeof value[0] === 'boolean' ||
21419      typeof value[0] === 'string')
21420  ) {
21421    result = value.concat();
21422  } else {
21423    result = [1, value];
21424  }
21425  level = result[0];
21426  if (typeof level === 'boolean') {
21427    level = level ? 1 : 0;
21428  } else if (typeof level === 'string') {
21429    if (level === 'off') {
21430      level = 0;
21431    } else if (level === 'on' || level === 'warn') {
21432      level = 1;
21433    } else if (level === 'error') {
21434      level = 2;
21435    } else {
21436      level = 1;
21437      result = [level, result];
21438    }
21439  }
21440  if (level < 0 || level > 2) {
21441    throw new Error(
21442      'Incorrect severity `' +
21443        level +
21444        '` for `' +
21445        name +
21446        '`, ' +
21447        'expected 0, 1, or 2'
21448    )
21449  }
21450  result[0] = level;
21451  return result
21452}
21453getDefaultExportFromCjs(unifiedLintRule);
21454
21455var rule = unifiedLintRule;
21456var remarkLintNoTrailingSpaces = rule('remark-lint:no-trailing-spaces', noTrailingSpaces);
21457function noTrailingSpaces(ast, file) {
21458  var lines = file.toString().split(/\r?\n/);
21459  for (var i = 0; i < lines.length; i++) {
21460    var currentLine = lines[i];
21461    var lineIndex = i + 1;
21462    if (/\s$/.test(currentLine)) {
21463      file.message('Remove trailing whitespace', {
21464        position: {
21465          start: { line: lineIndex, column: currentLine.length + 1 },
21466          end: { line: lineIndex }
21467        }
21468      });
21469    }
21470  }
21471}
21472var remarkLintNoTrailingSpaces$1 = getDefaultExportFromCjs(remarkLintNoTrailingSpaces);
21473
21474function* getLinksRecursively(node) {
21475  if (node.url) {
21476    yield node;
21477  }
21478  for (const child of node.children || []) {
21479    yield* getLinksRecursively(child);
21480  }
21481}
21482function validateLinks(tree, vfile) {
21483  const currentFileURL = pathToFileURL(path$2.join(vfile.cwd, vfile.path));
21484  let previousDefinitionLabel;
21485  for (const node of getLinksRecursively(tree)) {
21486    if (node.url[0] !== "#") {
21487      const targetURL = new URL(node.url, currentFileURL);
21488      if (targetURL.protocol === "file:" && !fs.existsSync(targetURL)) {
21489        vfile.message("Broken link", node);
21490      } else if (targetURL.pathname === currentFileURL.pathname) {
21491        const expected = node.url.includes("#")
21492          ? node.url.slice(node.url.indexOf("#"))
21493          : "#";
21494        vfile.message(
21495          `Self-reference must start with hash (expected "${expected}", got "${node.url}")`,
21496          node,
21497        );
21498      }
21499    }
21500    if (node.type === "definition") {
21501      if (previousDefinitionLabel && previousDefinitionLabel > node.label) {
21502        vfile.message(
21503          `Unordered reference ("${node.label}" should be before "${previousDefinitionLabel}")`,
21504          node,
21505        );
21506      }
21507      previousDefinitionLabel = node.label;
21508    }
21509  }
21510}
21511const remarkLintNodejsLinks = lintRule(
21512  "remark-lint:nodejs-links",
21513  validateLinks,
21514);
21515
21516/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
21517function isNothing(subject) {
21518  return (typeof subject === 'undefined') || (subject === null);
21519}
21520function isObject(subject) {
21521  return (typeof subject === 'object') && (subject !== null);
21522}
21523function toArray(sequence) {
21524  if (Array.isArray(sequence)) return sequence;
21525  else if (isNothing(sequence)) return [];
21526  return [ sequence ];
21527}
21528function extend(target, source) {
21529  var index, length, key, sourceKeys;
21530  if (source) {
21531    sourceKeys = Object.keys(source);
21532    for (index = 0, length = sourceKeys.length; index < length; index += 1) {
21533      key = sourceKeys[index];
21534      target[key] = source[key];
21535    }
21536  }
21537  return target;
21538}
21539function repeat(string, count) {
21540  var result = '', cycle;
21541  for (cycle = 0; cycle < count; cycle += 1) {
21542    result += string;
21543  }
21544  return result;
21545}
21546function isNegativeZero(number) {
21547  return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
21548}
21549var isNothing_1      = isNothing;
21550var isObject_1       = isObject;
21551var toArray_1        = toArray;
21552var repeat_1         = repeat;
21553var isNegativeZero_1 = isNegativeZero;
21554var extend_1         = extend;
21555var common = {
21556	isNothing: isNothing_1,
21557	isObject: isObject_1,
21558	toArray: toArray_1,
21559	repeat: repeat_1,
21560	isNegativeZero: isNegativeZero_1,
21561	extend: extend_1
21562};
21563function formatError(exception, compact) {
21564  var where = '', message = exception.reason || '(unknown reason)';
21565  if (!exception.mark) return message;
21566  if (exception.mark.name) {
21567    where += 'in "' + exception.mark.name + '" ';
21568  }
21569  where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';
21570  if (!compact && exception.mark.snippet) {
21571    where += '\n\n' + exception.mark.snippet;
21572  }
21573  return message + ' ' + where;
21574}
21575function YAMLException$1(reason, mark) {
21576  Error.call(this);
21577  this.name = 'YAMLException';
21578  this.reason = reason;
21579  this.mark = mark;
21580  this.message = formatError(this, false);
21581  if (Error.captureStackTrace) {
21582    Error.captureStackTrace(this, this.constructor);
21583  } else {
21584    this.stack = (new Error()).stack || '';
21585  }
21586}
21587YAMLException$1.prototype = Object.create(Error.prototype);
21588YAMLException$1.prototype.constructor = YAMLException$1;
21589YAMLException$1.prototype.toString = function toString(compact) {
21590  return this.name + ': ' + formatError(this, compact);
21591};
21592var exception = YAMLException$1;
21593function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
21594  var head = '';
21595  var tail = '';
21596  var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
21597  if (position - lineStart > maxHalfLength) {
21598    head = ' ... ';
21599    lineStart = position - maxHalfLength + head.length;
21600  }
21601  if (lineEnd - position > maxHalfLength) {
21602    tail = ' ...';
21603    lineEnd = position + maxHalfLength - tail.length;
21604  }
21605  return {
21606    str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
21607    pos: position - lineStart + head.length
21608  };
21609}
21610function padStart(string, max) {
21611  return common.repeat(' ', max - string.length) + string;
21612}
21613function makeSnippet(mark, options) {
21614  options = Object.create(options || null);
21615  if (!mark.buffer) return null;
21616  if (!options.maxLength) options.maxLength = 79;
21617  if (typeof options.indent      !== 'number') options.indent      = 1;
21618  if (typeof options.linesBefore !== 'number') options.linesBefore = 3;
21619  if (typeof options.linesAfter  !== 'number') options.linesAfter  = 2;
21620  var re = /\r?\n|\r|\0/g;
21621  var lineStarts = [ 0 ];
21622  var lineEnds = [];
21623  var match;
21624  var foundLineNo = -1;
21625  while ((match = re.exec(mark.buffer))) {
21626    lineEnds.push(match.index);
21627    lineStarts.push(match.index + match[0].length);
21628    if (mark.position <= match.index && foundLineNo < 0) {
21629      foundLineNo = lineStarts.length - 2;
21630    }
21631  }
21632  if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
21633  var result = '', i, line;
21634  var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
21635  var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
21636  for (i = 1; i <= options.linesBefore; i++) {
21637    if (foundLineNo - i < 0) break;
21638    line = getLine(
21639      mark.buffer,
21640      lineStarts[foundLineNo - i],
21641      lineEnds[foundLineNo - i],
21642      mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
21643      maxLineLength
21644    );
21645    result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
21646      ' | ' + line.str + '\n' + result;
21647  }
21648  line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
21649  result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
21650    ' | ' + line.str + '\n';
21651  result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n';
21652  for (i = 1; i <= options.linesAfter; i++) {
21653    if (foundLineNo + i >= lineEnds.length) break;
21654    line = getLine(
21655      mark.buffer,
21656      lineStarts[foundLineNo + i],
21657      lineEnds[foundLineNo + i],
21658      mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
21659      maxLineLength
21660    );
21661    result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
21662      ' | ' + line.str + '\n';
21663  }
21664  return result.replace(/\n$/, '');
21665}
21666var snippet = makeSnippet;
21667var TYPE_CONSTRUCTOR_OPTIONS = [
21668  'kind',
21669  'multi',
21670  'resolve',
21671  'construct',
21672  'instanceOf',
21673  'predicate',
21674  'represent',
21675  'representName',
21676  'defaultStyle',
21677  'styleAliases'
21678];
21679var YAML_NODE_KINDS = [
21680  'scalar',
21681  'sequence',
21682  'mapping'
21683];
21684function compileStyleAliases(map) {
21685  var result = {};
21686  if (map !== null) {
21687    Object.keys(map).forEach(function (style) {
21688      map[style].forEach(function (alias) {
21689        result[String(alias)] = style;
21690      });
21691    });
21692  }
21693  return result;
21694}
21695function Type$1(tag, options) {
21696  options = options || {};
21697  Object.keys(options).forEach(function (name) {
21698    if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
21699      throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
21700    }
21701  });
21702  this.options       = options;
21703  this.tag           = tag;
21704  this.kind          = options['kind']          || null;
21705  this.resolve       = options['resolve']       || function () { return true; };
21706  this.construct     = options['construct']     || function (data) { return data; };
21707  this.instanceOf    = options['instanceOf']    || null;
21708  this.predicate     = options['predicate']     || null;
21709  this.represent     = options['represent']     || null;
21710  this.representName = options['representName'] || null;
21711  this.defaultStyle  = options['defaultStyle']  || null;
21712  this.multi         = options['multi']         || false;
21713  this.styleAliases  = compileStyleAliases(options['styleAliases'] || null);
21714  if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
21715    throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
21716  }
21717}
21718var type = Type$1;
21719function compileList(schema, name) {
21720  var result = [];
21721  schema[name].forEach(function (currentType) {
21722    var newIndex = result.length;
21723    result.forEach(function (previousType, previousIndex) {
21724      if (previousType.tag === currentType.tag &&
21725          previousType.kind === currentType.kind &&
21726          previousType.multi === currentType.multi) {
21727        newIndex = previousIndex;
21728      }
21729    });
21730    result[newIndex] = currentType;
21731  });
21732  return result;
21733}
21734function compileMap() {
21735  var result = {
21736        scalar: {},
21737        sequence: {},
21738        mapping: {},
21739        fallback: {},
21740        multi: {
21741          scalar: [],
21742          sequence: [],
21743          mapping: [],
21744          fallback: []
21745        }
21746      }, index, length;
21747  function collectType(type) {
21748    if (type.multi) {
21749      result.multi[type.kind].push(type);
21750      result.multi['fallback'].push(type);
21751    } else {
21752      result[type.kind][type.tag] = result['fallback'][type.tag] = type;
21753    }
21754  }
21755  for (index = 0, length = arguments.length; index < length; index += 1) {
21756    arguments[index].forEach(collectType);
21757  }
21758  return result;
21759}
21760function Schema$1(definition) {
21761  return this.extend(definition);
21762}
21763Schema$1.prototype.extend = function extend(definition) {
21764  var implicit = [];
21765  var explicit = [];
21766  if (definition instanceof type) {
21767    explicit.push(definition);
21768  } else if (Array.isArray(definition)) {
21769    explicit = explicit.concat(definition);
21770  } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
21771    if (definition.implicit) implicit = implicit.concat(definition.implicit);
21772    if (definition.explicit) explicit = explicit.concat(definition.explicit);
21773  } else {
21774    throw new exception('Schema.extend argument should be a Type, [ Type ], ' +
21775      'or a schema definition ({ implicit: [...], explicit: [...] })');
21776  }
21777  implicit.forEach(function (type$1) {
21778    if (!(type$1 instanceof type)) {
21779      throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
21780    }
21781    if (type$1.loadKind && type$1.loadKind !== 'scalar') {
21782      throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
21783    }
21784    if (type$1.multi) {
21785      throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');
21786    }
21787  });
21788  explicit.forEach(function (type$1) {
21789    if (!(type$1 instanceof type)) {
21790      throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
21791    }
21792  });
21793  var result = Object.create(Schema$1.prototype);
21794  result.implicit = (this.implicit || []).concat(implicit);
21795  result.explicit = (this.explicit || []).concat(explicit);
21796  result.compiledImplicit = compileList(result, 'implicit');
21797  result.compiledExplicit = compileList(result, 'explicit');
21798  result.compiledTypeMap  = compileMap(result.compiledImplicit, result.compiledExplicit);
21799  return result;
21800};
21801var schema = Schema$1;
21802var str = new type('tag:yaml.org,2002:str', {
21803  kind: 'scalar',
21804  construct: function (data) { return data !== null ? data : ''; }
21805});
21806var seq = new type('tag:yaml.org,2002:seq', {
21807  kind: 'sequence',
21808  construct: function (data) { return data !== null ? data : []; }
21809});
21810var map = new type('tag:yaml.org,2002:map', {
21811  kind: 'mapping',
21812  construct: function (data) { return data !== null ? data : {}; }
21813});
21814var failsafe = new schema({
21815  explicit: [
21816    str,
21817    seq,
21818    map
21819  ]
21820});
21821function resolveYamlNull(data) {
21822  if (data === null) return true;
21823  var max = data.length;
21824  return (max === 1 && data === '~') ||
21825         (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
21826}
21827function constructYamlNull() {
21828  return null;
21829}
21830function isNull(object) {
21831  return object === null;
21832}
21833var _null = new type('tag:yaml.org,2002:null', {
21834  kind: 'scalar',
21835  resolve: resolveYamlNull,
21836  construct: constructYamlNull,
21837  predicate: isNull,
21838  represent: {
21839    canonical: function () { return '~';    },
21840    lowercase: function () { return 'null'; },
21841    uppercase: function () { return 'NULL'; },
21842    camelcase: function () { return 'Null'; },
21843    empty:     function () { return '';     }
21844  },
21845  defaultStyle: 'lowercase'
21846});
21847function resolveYamlBoolean(data) {
21848  if (data === null) return false;
21849  var max = data.length;
21850  return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
21851         (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
21852}
21853function constructYamlBoolean(data) {
21854  return data === 'true' ||
21855         data === 'True' ||
21856         data === 'TRUE';
21857}
21858function isBoolean(object) {
21859  return Object.prototype.toString.call(object) === '[object Boolean]';
21860}
21861var bool = new type('tag:yaml.org,2002:bool', {
21862  kind: 'scalar',
21863  resolve: resolveYamlBoolean,
21864  construct: constructYamlBoolean,
21865  predicate: isBoolean,
21866  represent: {
21867    lowercase: function (object) { return object ? 'true' : 'false'; },
21868    uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
21869    camelcase: function (object) { return object ? 'True' : 'False'; }
21870  },
21871  defaultStyle: 'lowercase'
21872});
21873function isHexCode(c) {
21874  return ((0x30 <= c) && (c <= 0x39)) ||
21875         ((0x41 <= c) && (c <= 0x46)) ||
21876         ((0x61 <= c) && (c <= 0x66));
21877}
21878function isOctCode(c) {
21879  return ((0x30 <= c) && (c <= 0x37));
21880}
21881function isDecCode(c) {
21882  return ((0x30 <= c) && (c <= 0x39));
21883}
21884function resolveYamlInteger(data) {
21885  if (data === null) return false;
21886  var max = data.length,
21887      index = 0,
21888      hasDigits = false,
21889      ch;
21890  if (!max) return false;
21891  ch = data[index];
21892  if (ch === '-' || ch === '+') {
21893    ch = data[++index];
21894  }
21895  if (ch === '0') {
21896    if (index + 1 === max) return true;
21897    ch = data[++index];
21898    if (ch === 'b') {
21899      index++;
21900      for (; index < max; index++) {
21901        ch = data[index];
21902        if (ch === '_') continue;
21903        if (ch !== '0' && ch !== '1') return false;
21904        hasDigits = true;
21905      }
21906      return hasDigits && ch !== '_';
21907    }
21908    if (ch === 'x') {
21909      index++;
21910      for (; index < max; index++) {
21911        ch = data[index];
21912        if (ch === '_') continue;
21913        if (!isHexCode(data.charCodeAt(index))) return false;
21914        hasDigits = true;
21915      }
21916      return hasDigits && ch !== '_';
21917    }
21918    if (ch === 'o') {
21919      index++;
21920      for (; index < max; index++) {
21921        ch = data[index];
21922        if (ch === '_') continue;
21923        if (!isOctCode(data.charCodeAt(index))) return false;
21924        hasDigits = true;
21925      }
21926      return hasDigits && ch !== '_';
21927    }
21928  }
21929  if (ch === '_') return false;
21930  for (; index < max; index++) {
21931    ch = data[index];
21932    if (ch === '_') continue;
21933    if (!isDecCode(data.charCodeAt(index))) {
21934      return false;
21935    }
21936    hasDigits = true;
21937  }
21938  if (!hasDigits || ch === '_') return false;
21939  return true;
21940}
21941function constructYamlInteger(data) {
21942  var value = data, sign = 1, ch;
21943  if (value.indexOf('_') !== -1) {
21944    value = value.replace(/_/g, '');
21945  }
21946  ch = value[0];
21947  if (ch === '-' || ch === '+') {
21948    if (ch === '-') sign = -1;
21949    value = value.slice(1);
21950    ch = value[0];
21951  }
21952  if (value === '0') return 0;
21953  if (ch === '0') {
21954    if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
21955    if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);
21956    if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);
21957  }
21958  return sign * parseInt(value, 10);
21959}
21960function isInteger(object) {
21961  return (Object.prototype.toString.call(object)) === '[object Number]' &&
21962         (object % 1 === 0 && !common.isNegativeZero(object));
21963}
21964var int = new type('tag:yaml.org,2002:int', {
21965  kind: 'scalar',
21966  resolve: resolveYamlInteger,
21967  construct: constructYamlInteger,
21968  predicate: isInteger,
21969  represent: {
21970    binary:      function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
21971    octal:       function (obj) { return obj >= 0 ? '0o'  + obj.toString(8) : '-0o'  + obj.toString(8).slice(1); },
21972    decimal:     function (obj) { return obj.toString(10); },
21973    hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() :  '-0x' + obj.toString(16).toUpperCase().slice(1); }
21974  },
21975  defaultStyle: 'decimal',
21976  styleAliases: {
21977    binary:      [ 2,  'bin' ],
21978    octal:       [ 8,  'oct' ],
21979    decimal:     [ 10, 'dec' ],
21980    hexadecimal: [ 16, 'hex' ]
21981  }
21982});
21983var YAML_FLOAT_PATTERN = new RegExp(
21984  '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
21985  '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
21986  '|[-+]?\\.(?:inf|Inf|INF)' +
21987  '|\\.(?:nan|NaN|NAN))$');
21988function resolveYamlFloat(data) {
21989  if (data === null) return false;
21990  if (!YAML_FLOAT_PATTERN.test(data) ||
21991      data[data.length - 1] === '_') {
21992    return false;
21993  }
21994  return true;
21995}
21996function constructYamlFloat(data) {
21997  var value, sign;
21998  value  = data.replace(/_/g, '').toLowerCase();
21999  sign   = value[0] === '-' ? -1 : 1;
22000  if ('+-'.indexOf(value[0]) >= 0) {
22001    value = value.slice(1);
22002  }
22003  if (value === '.inf') {
22004    return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
22005  } else if (value === '.nan') {
22006    return NaN;
22007  }
22008  return sign * parseFloat(value, 10);
22009}
22010var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
22011function representYamlFloat(object, style) {
22012  var res;
22013  if (isNaN(object)) {
22014    switch (style) {
22015      case 'lowercase': return '.nan';
22016      case 'uppercase': return '.NAN';
22017      case 'camelcase': return '.NaN';
22018    }
22019  } else if (Number.POSITIVE_INFINITY === object) {
22020    switch (style) {
22021      case 'lowercase': return '.inf';
22022      case 'uppercase': return '.INF';
22023      case 'camelcase': return '.Inf';
22024    }
22025  } else if (Number.NEGATIVE_INFINITY === object) {
22026    switch (style) {
22027      case 'lowercase': return '-.inf';
22028      case 'uppercase': return '-.INF';
22029      case 'camelcase': return '-.Inf';
22030    }
22031  } else if (common.isNegativeZero(object)) {
22032    return '-0.0';
22033  }
22034  res = object.toString(10);
22035  return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
22036}
22037function isFloat(object) {
22038  return (Object.prototype.toString.call(object) === '[object Number]') &&
22039         (object % 1 !== 0 || common.isNegativeZero(object));
22040}
22041var float = new type('tag:yaml.org,2002:float', {
22042  kind: 'scalar',
22043  resolve: resolveYamlFloat,
22044  construct: constructYamlFloat,
22045  predicate: isFloat,
22046  represent: representYamlFloat,
22047  defaultStyle: 'lowercase'
22048});
22049var json = failsafe.extend({
22050  implicit: [
22051    _null,
22052    bool,
22053    int,
22054    float
22055  ]
22056});
22057var core = json;
22058var YAML_DATE_REGEXP = new RegExp(
22059  '^([0-9][0-9][0-9][0-9])'          +
22060  '-([0-9][0-9])'                    +
22061  '-([0-9][0-9])$');
22062var YAML_TIMESTAMP_REGEXP = new RegExp(
22063  '^([0-9][0-9][0-9][0-9])'          +
22064  '-([0-9][0-9]?)'                   +
22065  '-([0-9][0-9]?)'                   +
22066  '(?:[Tt]|[ \\t]+)'                 +
22067  '([0-9][0-9]?)'                    +
22068  ':([0-9][0-9])'                    +
22069  ':([0-9][0-9])'                    +
22070  '(?:\\.([0-9]*))?'                 +
22071  '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' +
22072  '(?::([0-9][0-9]))?))?$');
22073function resolveYamlTimestamp(data) {
22074  if (data === null) return false;
22075  if (YAML_DATE_REGEXP.exec(data) !== null) return true;
22076  if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
22077  return false;
22078}
22079function constructYamlTimestamp(data) {
22080  var match, year, month, day, hour, minute, second, fraction = 0,
22081      delta = null, tz_hour, tz_minute, date;
22082  match = YAML_DATE_REGEXP.exec(data);
22083  if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
22084  if (match === null) throw new Error('Date resolve error');
22085  year = +(match[1]);
22086  month = +(match[2]) - 1;
22087  day = +(match[3]);
22088  if (!match[4]) {
22089    return new Date(Date.UTC(year, month, day));
22090  }
22091  hour = +(match[4]);
22092  minute = +(match[5]);
22093  second = +(match[6]);
22094  if (match[7]) {
22095    fraction = match[7].slice(0, 3);
22096    while (fraction.length < 3) {
22097      fraction += '0';
22098    }
22099    fraction = +fraction;
22100  }
22101  if (match[9]) {
22102    tz_hour = +(match[10]);
22103    tz_minute = +(match[11] || 0);
22104    delta = (tz_hour * 60 + tz_minute) * 60000;
22105    if (match[9] === '-') delta = -delta;
22106  }
22107  date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
22108  if (delta) date.setTime(date.getTime() - delta);
22109  return date;
22110}
22111function representYamlTimestamp(object ) {
22112  return object.toISOString();
22113}
22114var timestamp = new type('tag:yaml.org,2002:timestamp', {
22115  kind: 'scalar',
22116  resolve: resolveYamlTimestamp,
22117  construct: constructYamlTimestamp,
22118  instanceOf: Date,
22119  represent: representYamlTimestamp
22120});
22121function resolveYamlMerge(data) {
22122  return data === '<<' || data === null;
22123}
22124var merge = new type('tag:yaml.org,2002:merge', {
22125  kind: 'scalar',
22126  resolve: resolveYamlMerge
22127});
22128var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
22129function resolveYamlBinary(data) {
22130  if (data === null) return false;
22131  var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
22132  for (idx = 0; idx < max; idx++) {
22133    code = map.indexOf(data.charAt(idx));
22134    if (code > 64) continue;
22135    if (code < 0) return false;
22136    bitlen += 6;
22137  }
22138  return (bitlen % 8) === 0;
22139}
22140function constructYamlBinary(data) {
22141  var idx, tailbits,
22142      input = data.replace(/[\r\n=]/g, ''),
22143      max = input.length,
22144      map = BASE64_MAP,
22145      bits = 0,
22146      result = [];
22147  for (idx = 0; idx < max; idx++) {
22148    if ((idx % 4 === 0) && idx) {
22149      result.push((bits >> 16) & 0xFF);
22150      result.push((bits >> 8) & 0xFF);
22151      result.push(bits & 0xFF);
22152    }
22153    bits = (bits << 6) | map.indexOf(input.charAt(idx));
22154  }
22155  tailbits = (max % 4) * 6;
22156  if (tailbits === 0) {
22157    result.push((bits >> 16) & 0xFF);
22158    result.push((bits >> 8) & 0xFF);
22159    result.push(bits & 0xFF);
22160  } else if (tailbits === 18) {
22161    result.push((bits >> 10) & 0xFF);
22162    result.push((bits >> 2) & 0xFF);
22163  } else if (tailbits === 12) {
22164    result.push((bits >> 4) & 0xFF);
22165  }
22166  return new Uint8Array(result);
22167}
22168function representYamlBinary(object ) {
22169  var result = '', bits = 0, idx, tail,
22170      max = object.length,
22171      map = BASE64_MAP;
22172  for (idx = 0; idx < max; idx++) {
22173    if ((idx % 3 === 0) && idx) {
22174      result += map[(bits >> 18) & 0x3F];
22175      result += map[(bits >> 12) & 0x3F];
22176      result += map[(bits >> 6) & 0x3F];
22177      result += map[bits & 0x3F];
22178    }
22179    bits = (bits << 8) + object[idx];
22180  }
22181  tail = max % 3;
22182  if (tail === 0) {
22183    result += map[(bits >> 18) & 0x3F];
22184    result += map[(bits >> 12) & 0x3F];
22185    result += map[(bits >> 6) & 0x3F];
22186    result += map[bits & 0x3F];
22187  } else if (tail === 2) {
22188    result += map[(bits >> 10) & 0x3F];
22189    result += map[(bits >> 4) & 0x3F];
22190    result += map[(bits << 2) & 0x3F];
22191    result += map[64];
22192  } else if (tail === 1) {
22193    result += map[(bits >> 2) & 0x3F];
22194    result += map[(bits << 4) & 0x3F];
22195    result += map[64];
22196    result += map[64];
22197  }
22198  return result;
22199}
22200function isBinary(obj) {
22201  return Object.prototype.toString.call(obj) ===  '[object Uint8Array]';
22202}
22203var binary = new type('tag:yaml.org,2002:binary', {
22204  kind: 'scalar',
22205  resolve: resolveYamlBinary,
22206  construct: constructYamlBinary,
22207  predicate: isBinary,
22208  represent: representYamlBinary
22209});
22210var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
22211var _toString$2       = Object.prototype.toString;
22212function resolveYamlOmap(data) {
22213  if (data === null) return true;
22214  var objectKeys = [], index, length, pair, pairKey, pairHasKey,
22215      object = data;
22216  for (index = 0, length = object.length; index < length; index += 1) {
22217    pair = object[index];
22218    pairHasKey = false;
22219    if (_toString$2.call(pair) !== '[object Object]') return false;
22220    for (pairKey in pair) {
22221      if (_hasOwnProperty$3.call(pair, pairKey)) {
22222        if (!pairHasKey) pairHasKey = true;
22223        else return false;
22224      }
22225    }
22226    if (!pairHasKey) return false;
22227    if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
22228    else return false;
22229  }
22230  return true;
22231}
22232function constructYamlOmap(data) {
22233  return data !== null ? data : [];
22234}
22235var omap = new type('tag:yaml.org,2002:omap', {
22236  kind: 'sequence',
22237  resolve: resolveYamlOmap,
22238  construct: constructYamlOmap
22239});
22240var _toString$1 = Object.prototype.toString;
22241function resolveYamlPairs(data) {
22242  if (data === null) return true;
22243  var index, length, pair, keys, result,
22244      object = data;
22245  result = new Array(object.length);
22246  for (index = 0, length = object.length; index < length; index += 1) {
22247    pair = object[index];
22248    if (_toString$1.call(pair) !== '[object Object]') return false;
22249    keys = Object.keys(pair);
22250    if (keys.length !== 1) return false;
22251    result[index] = [ keys[0], pair[keys[0]] ];
22252  }
22253  return true;
22254}
22255function constructYamlPairs(data) {
22256  if (data === null) return [];
22257  var index, length, pair, keys, result,
22258      object = data;
22259  result = new Array(object.length);
22260  for (index = 0, length = object.length; index < length; index += 1) {
22261    pair = object[index];
22262    keys = Object.keys(pair);
22263    result[index] = [ keys[0], pair[keys[0]] ];
22264  }
22265  return result;
22266}
22267var pairs = new type('tag:yaml.org,2002:pairs', {
22268  kind: 'sequence',
22269  resolve: resolveYamlPairs,
22270  construct: constructYamlPairs
22271});
22272var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
22273function resolveYamlSet(data) {
22274  if (data === null) return true;
22275  var key, object = data;
22276  for (key in object) {
22277    if (_hasOwnProperty$2.call(object, key)) {
22278      if (object[key] !== null) return false;
22279    }
22280  }
22281  return true;
22282}
22283function constructYamlSet(data) {
22284  return data !== null ? data : {};
22285}
22286var set = new type('tag:yaml.org,2002:set', {
22287  kind: 'mapping',
22288  resolve: resolveYamlSet,
22289  construct: constructYamlSet
22290});
22291var _default = core.extend({
22292  implicit: [
22293    timestamp,
22294    merge
22295  ],
22296  explicit: [
22297    binary,
22298    omap,
22299    pairs,
22300    set
22301  ]
22302});
22303var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
22304var CONTEXT_FLOW_IN   = 1;
22305var CONTEXT_FLOW_OUT  = 2;
22306var CONTEXT_BLOCK_IN  = 3;
22307var CONTEXT_BLOCK_OUT = 4;
22308var CHOMPING_CLIP  = 1;
22309var CHOMPING_STRIP = 2;
22310var CHOMPING_KEEP  = 3;
22311var PATTERN_NON_PRINTABLE         = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
22312var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
22313var PATTERN_FLOW_INDICATORS       = /[,\[\]\{\}]/;
22314var PATTERN_TAG_HANDLE            = /^(?:!|!!|![a-z\-]+!)$/i;
22315var PATTERN_TAG_URI               = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
22316function _class(obj) { return Object.prototype.toString.call(obj); }
22317function is_EOL(c) {
22318  return (c === 0x0A) || (c === 0x0D);
22319}
22320function is_WHITE_SPACE(c) {
22321  return (c === 0x09) || (c === 0x20);
22322}
22323function is_WS_OR_EOL(c) {
22324  return (c === 0x09) ||
22325         (c === 0x20) ||
22326         (c === 0x0A) ||
22327         (c === 0x0D);
22328}
22329function is_FLOW_INDICATOR(c) {
22330  return c === 0x2C ||
22331         c === 0x5B ||
22332         c === 0x5D ||
22333         c === 0x7B ||
22334         c === 0x7D;
22335}
22336function fromHexCode(c) {
22337  var lc;
22338  if ((0x30 <= c) && (c <= 0x39)) {
22339    return c - 0x30;
22340  }
22341  lc = c | 0x20;
22342  if ((0x61 <= lc) && (lc <= 0x66)) {
22343    return lc - 0x61 + 10;
22344  }
22345  return -1;
22346}
22347function escapedHexLen(c) {
22348  if (c === 0x78) { return 2; }
22349  if (c === 0x75) { return 4; }
22350  if (c === 0x55) { return 8; }
22351  return 0;
22352}
22353function fromDecimalCode(c) {
22354  if ((0x30 <= c) && (c <= 0x39)) {
22355    return c - 0x30;
22356  }
22357  return -1;
22358}
22359function simpleEscapeSequence(c) {
22360  return (c === 0x30) ? '\x00' :
22361        (c === 0x61) ? '\x07' :
22362        (c === 0x62) ? '\x08' :
22363        (c === 0x74) ? '\x09' :
22364        (c === 0x09) ? '\x09' :
22365        (c === 0x6E) ? '\x0A' :
22366        (c === 0x76) ? '\x0B' :
22367        (c === 0x66) ? '\x0C' :
22368        (c === 0x72) ? '\x0D' :
22369        (c === 0x65) ? '\x1B' :
22370        (c === 0x20) ? ' ' :
22371        (c === 0x22) ? '\x22' :
22372        (c === 0x2F) ? '/' :
22373        (c === 0x5C) ? '\x5C' :
22374        (c === 0x4E) ? '\x85' :
22375        (c === 0x5F) ? '\xA0' :
22376        (c === 0x4C) ? '\u2028' :
22377        (c === 0x50) ? '\u2029' : '';
22378}
22379function charFromCodepoint(c) {
22380  if (c <= 0xFFFF) {
22381    return String.fromCharCode(c);
22382  }
22383  return String.fromCharCode(
22384    ((c - 0x010000) >> 10) + 0xD800,
22385    ((c - 0x010000) & 0x03FF) + 0xDC00
22386  );
22387}
22388var simpleEscapeCheck = new Array(256);
22389var simpleEscapeMap = new Array(256);
22390for (var i = 0; i < 256; i++) {
22391  simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
22392  simpleEscapeMap[i] = simpleEscapeSequence(i);
22393}
22394function State$1(input, options) {
22395  this.input = input;
22396  this.filename  = options['filename']  || null;
22397  this.schema    = options['schema']    || _default;
22398  this.onWarning = options['onWarning'] || null;
22399  this.legacy    = options['legacy']    || false;
22400  this.json      = options['json']      || false;
22401  this.listener  = options['listener']  || null;
22402  this.implicitTypes = this.schema.compiledImplicit;
22403  this.typeMap       = this.schema.compiledTypeMap;
22404  this.length     = input.length;
22405  this.position   = 0;
22406  this.line       = 0;
22407  this.lineStart  = 0;
22408  this.lineIndent = 0;
22409  this.firstTabInLine = -1;
22410  this.documents = [];
22411}
22412function generateError(state, message) {
22413  var mark = {
22414    name:     state.filename,
22415    buffer:   state.input.slice(0, -1),
22416    position: state.position,
22417    line:     state.line,
22418    column:   state.position - state.lineStart
22419  };
22420  mark.snippet = snippet(mark);
22421  return new exception(message, mark);
22422}
22423function throwError(state, message) {
22424  throw generateError(state, message);
22425}
22426function throwWarning(state, message) {
22427  if (state.onWarning) {
22428    state.onWarning.call(null, generateError(state, message));
22429  }
22430}
22431var directiveHandlers = {
22432  YAML: function handleYamlDirective(state, name, args) {
22433    var match, major, minor;
22434    if (state.version !== null) {
22435      throwError(state, 'duplication of %YAML directive');
22436    }
22437    if (args.length !== 1) {
22438      throwError(state, 'YAML directive accepts exactly one argument');
22439    }
22440    match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
22441    if (match === null) {
22442      throwError(state, 'ill-formed argument of the YAML directive');
22443    }
22444    major = parseInt(match[1], 10);
22445    minor = parseInt(match[2], 10);
22446    if (major !== 1) {
22447      throwError(state, 'unacceptable YAML version of the document');
22448    }
22449    state.version = args[0];
22450    state.checkLineBreaks = (minor < 2);
22451    if (minor !== 1 && minor !== 2) {
22452      throwWarning(state, 'unsupported YAML version of the document');
22453    }
22454  },
22455  TAG: function handleTagDirective(state, name, args) {
22456    var handle, prefix;
22457    if (args.length !== 2) {
22458      throwError(state, 'TAG directive accepts exactly two arguments');
22459    }
22460    handle = args[0];
22461    prefix = args[1];
22462    if (!PATTERN_TAG_HANDLE.test(handle)) {
22463      throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
22464    }
22465    if (_hasOwnProperty$1.call(state.tagMap, handle)) {
22466      throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
22467    }
22468    if (!PATTERN_TAG_URI.test(prefix)) {
22469      throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
22470    }
22471    try {
22472      prefix = decodeURIComponent(prefix);
22473    } catch (err) {
22474      throwError(state, 'tag prefix is malformed: ' + prefix);
22475    }
22476    state.tagMap[handle] = prefix;
22477  }
22478};
22479function captureSegment(state, start, end, checkJson) {
22480  var _position, _length, _character, _result;
22481  if (start < end) {
22482    _result = state.input.slice(start, end);
22483    if (checkJson) {
22484      for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
22485        _character = _result.charCodeAt(_position);
22486        if (!(_character === 0x09 ||
22487              (0x20 <= _character && _character <= 0x10FFFF))) {
22488          throwError(state, 'expected valid JSON character');
22489        }
22490      }
22491    } else if (PATTERN_NON_PRINTABLE.test(_result)) {
22492      throwError(state, 'the stream contains non-printable characters');
22493    }
22494    state.result += _result;
22495  }
22496}
22497function mergeMappings(state, destination, source, overridableKeys) {
22498  var sourceKeys, key, index, quantity;
22499  if (!common.isObject(source)) {
22500    throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
22501  }
22502  sourceKeys = Object.keys(source);
22503  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
22504    key = sourceKeys[index];
22505    if (!_hasOwnProperty$1.call(destination, key)) {
22506      destination[key] = source[key];
22507      overridableKeys[key] = true;
22508    }
22509  }
22510}
22511function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,
22512  startLine, startLineStart, startPos) {
22513  var index, quantity;
22514  if (Array.isArray(keyNode)) {
22515    keyNode = Array.prototype.slice.call(keyNode);
22516    for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
22517      if (Array.isArray(keyNode[index])) {
22518        throwError(state, 'nested arrays are not supported inside keys');
22519      }
22520      if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
22521        keyNode[index] = '[object Object]';
22522      }
22523    }
22524  }
22525  if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
22526    keyNode = '[object Object]';
22527  }
22528  keyNode = String(keyNode);
22529  if (_result === null) {
22530    _result = {};
22531  }
22532  if (keyTag === 'tag:yaml.org,2002:merge') {
22533    if (Array.isArray(valueNode)) {
22534      for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
22535        mergeMappings(state, _result, valueNode[index], overridableKeys);
22536      }
22537    } else {
22538      mergeMappings(state, _result, valueNode, overridableKeys);
22539    }
22540  } else {
22541    if (!state.json &&
22542        !_hasOwnProperty$1.call(overridableKeys, keyNode) &&
22543        _hasOwnProperty$1.call(_result, keyNode)) {
22544      state.line = startLine || state.line;
22545      state.lineStart = startLineStart || state.lineStart;
22546      state.position = startPos || state.position;
22547      throwError(state, 'duplicated mapping key');
22548    }
22549    if (keyNode === '__proto__') {
22550      Object.defineProperty(_result, keyNode, {
22551        configurable: true,
22552        enumerable: true,
22553        writable: true,
22554        value: valueNode
22555      });
22556    } else {
22557      _result[keyNode] = valueNode;
22558    }
22559    delete overridableKeys[keyNode];
22560  }
22561  return _result;
22562}
22563function readLineBreak(state) {
22564  var ch;
22565  ch = state.input.charCodeAt(state.position);
22566  if (ch === 0x0A) {
22567    state.position++;
22568  } else if (ch === 0x0D) {
22569    state.position++;
22570    if (state.input.charCodeAt(state.position) === 0x0A) {
22571      state.position++;
22572    }
22573  } else {
22574    throwError(state, 'a line break is expected');
22575  }
22576  state.line += 1;
22577  state.lineStart = state.position;
22578  state.firstTabInLine = -1;
22579}
22580function skipSeparationSpace(state, allowComments, checkIndent) {
22581  var lineBreaks = 0,
22582      ch = state.input.charCodeAt(state.position);
22583  while (ch !== 0) {
22584    while (is_WHITE_SPACE(ch)) {
22585      if (ch === 0x09 && state.firstTabInLine === -1) {
22586        state.firstTabInLine = state.position;
22587      }
22588      ch = state.input.charCodeAt(++state.position);
22589    }
22590    if (allowComments && ch === 0x23) {
22591      do {
22592        ch = state.input.charCodeAt(++state.position);
22593      } while (ch !== 0x0A && ch !== 0x0D && ch !== 0);
22594    }
22595    if (is_EOL(ch)) {
22596      readLineBreak(state);
22597      ch = state.input.charCodeAt(state.position);
22598      lineBreaks++;
22599      state.lineIndent = 0;
22600      while (ch === 0x20) {
22601        state.lineIndent++;
22602        ch = state.input.charCodeAt(++state.position);
22603      }
22604    } else {
22605      break;
22606    }
22607  }
22608  if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
22609    throwWarning(state, 'deficient indentation');
22610  }
22611  return lineBreaks;
22612}
22613function testDocumentSeparator(state) {
22614  var _position = state.position,
22615      ch;
22616  ch = state.input.charCodeAt(_position);
22617  if ((ch === 0x2D || ch === 0x2E) &&
22618      ch === state.input.charCodeAt(_position + 1) &&
22619      ch === state.input.charCodeAt(_position + 2)) {
22620    _position += 3;
22621    ch = state.input.charCodeAt(_position);
22622    if (ch === 0 || is_WS_OR_EOL(ch)) {
22623      return true;
22624    }
22625  }
22626  return false;
22627}
22628function writeFoldedLines(state, count) {
22629  if (count === 1) {
22630    state.result += ' ';
22631  } else if (count > 1) {
22632    state.result += common.repeat('\n', count - 1);
22633  }
22634}
22635function readPlainScalar(state, nodeIndent, withinFlowCollection) {
22636  var preceding,
22637      following,
22638      captureStart,
22639      captureEnd,
22640      hasPendingContent,
22641      _line,
22642      _lineStart,
22643      _lineIndent,
22644      _kind = state.kind,
22645      _result = state.result,
22646      ch;
22647  ch = state.input.charCodeAt(state.position);
22648  if (is_WS_OR_EOL(ch)      ||
22649      is_FLOW_INDICATOR(ch) ||
22650      ch === 0x23    ||
22651      ch === 0x26    ||
22652      ch === 0x2A    ||
22653      ch === 0x21    ||
22654      ch === 0x7C    ||
22655      ch === 0x3E    ||
22656      ch === 0x27    ||
22657      ch === 0x22    ||
22658      ch === 0x25    ||
22659      ch === 0x40    ||
22660      ch === 0x60) {
22661    return false;
22662  }
22663  if (ch === 0x3F || ch === 0x2D) {
22664    following = state.input.charCodeAt(state.position + 1);
22665    if (is_WS_OR_EOL(following) ||
22666        withinFlowCollection && is_FLOW_INDICATOR(following)) {
22667      return false;
22668    }
22669  }
22670  state.kind = 'scalar';
22671  state.result = '';
22672  captureStart = captureEnd = state.position;
22673  hasPendingContent = false;
22674  while (ch !== 0) {
22675    if (ch === 0x3A) {
22676      following = state.input.charCodeAt(state.position + 1);
22677      if (is_WS_OR_EOL(following) ||
22678          withinFlowCollection && is_FLOW_INDICATOR(following)) {
22679        break;
22680      }
22681    } else if (ch === 0x23) {
22682      preceding = state.input.charCodeAt(state.position - 1);
22683      if (is_WS_OR_EOL(preceding)) {
22684        break;
22685      }
22686    } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
22687               withinFlowCollection && is_FLOW_INDICATOR(ch)) {
22688      break;
22689    } else if (is_EOL(ch)) {
22690      _line = state.line;
22691      _lineStart = state.lineStart;
22692      _lineIndent = state.lineIndent;
22693      skipSeparationSpace(state, false, -1);
22694      if (state.lineIndent >= nodeIndent) {
22695        hasPendingContent = true;
22696        ch = state.input.charCodeAt(state.position);
22697        continue;
22698      } else {
22699        state.position = captureEnd;
22700        state.line = _line;
22701        state.lineStart = _lineStart;
22702        state.lineIndent = _lineIndent;
22703        break;
22704      }
22705    }
22706    if (hasPendingContent) {
22707      captureSegment(state, captureStart, captureEnd, false);
22708      writeFoldedLines(state, state.line - _line);
22709      captureStart = captureEnd = state.position;
22710      hasPendingContent = false;
22711    }
22712    if (!is_WHITE_SPACE(ch)) {
22713      captureEnd = state.position + 1;
22714    }
22715    ch = state.input.charCodeAt(++state.position);
22716  }
22717  captureSegment(state, captureStart, captureEnd, false);
22718  if (state.result) {
22719    return true;
22720  }
22721  state.kind = _kind;
22722  state.result = _result;
22723  return false;
22724}
22725function readSingleQuotedScalar(state, nodeIndent) {
22726  var ch,
22727      captureStart, captureEnd;
22728  ch = state.input.charCodeAt(state.position);
22729  if (ch !== 0x27) {
22730    return false;
22731  }
22732  state.kind = 'scalar';
22733  state.result = '';
22734  state.position++;
22735  captureStart = captureEnd = state.position;
22736  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
22737    if (ch === 0x27) {
22738      captureSegment(state, captureStart, state.position, true);
22739      ch = state.input.charCodeAt(++state.position);
22740      if (ch === 0x27) {
22741        captureStart = state.position;
22742        state.position++;
22743        captureEnd = state.position;
22744      } else {
22745        return true;
22746      }
22747    } else if (is_EOL(ch)) {
22748      captureSegment(state, captureStart, captureEnd, true);
22749      writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
22750      captureStart = captureEnd = state.position;
22751    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
22752      throwError(state, 'unexpected end of the document within a single quoted scalar');
22753    } else {
22754      state.position++;
22755      captureEnd = state.position;
22756    }
22757  }
22758  throwError(state, 'unexpected end of the stream within a single quoted scalar');
22759}
22760function readDoubleQuotedScalar(state, nodeIndent) {
22761  var captureStart,
22762      captureEnd,
22763      hexLength,
22764      hexResult,
22765      tmp,
22766      ch;
22767  ch = state.input.charCodeAt(state.position);
22768  if (ch !== 0x22) {
22769    return false;
22770  }
22771  state.kind = 'scalar';
22772  state.result = '';
22773  state.position++;
22774  captureStart = captureEnd = state.position;
22775  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
22776    if (ch === 0x22) {
22777      captureSegment(state, captureStart, state.position, true);
22778      state.position++;
22779      return true;
22780    } else if (ch === 0x5C) {
22781      captureSegment(state, captureStart, state.position, true);
22782      ch = state.input.charCodeAt(++state.position);
22783      if (is_EOL(ch)) {
22784        skipSeparationSpace(state, false, nodeIndent);
22785      } else if (ch < 256 && simpleEscapeCheck[ch]) {
22786        state.result += simpleEscapeMap[ch];
22787        state.position++;
22788      } else if ((tmp = escapedHexLen(ch)) > 0) {
22789        hexLength = tmp;
22790        hexResult = 0;
22791        for (; hexLength > 0; hexLength--) {
22792          ch = state.input.charCodeAt(++state.position);
22793          if ((tmp = fromHexCode(ch)) >= 0) {
22794            hexResult = (hexResult << 4) + tmp;
22795          } else {
22796            throwError(state, 'expected hexadecimal character');
22797          }
22798        }
22799        state.result += charFromCodepoint(hexResult);
22800        state.position++;
22801      } else {
22802        throwError(state, 'unknown escape sequence');
22803      }
22804      captureStart = captureEnd = state.position;
22805    } else if (is_EOL(ch)) {
22806      captureSegment(state, captureStart, captureEnd, true);
22807      writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
22808      captureStart = captureEnd = state.position;
22809    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
22810      throwError(state, 'unexpected end of the document within a double quoted scalar');
22811    } else {
22812      state.position++;
22813      captureEnd = state.position;
22814    }
22815  }
22816  throwError(state, 'unexpected end of the stream within a double quoted scalar');
22817}
22818function readFlowCollection(state, nodeIndent) {
22819  var readNext = true,
22820      _line,
22821      _lineStart,
22822      _pos,
22823      _tag     = state.tag,
22824      _result,
22825      _anchor  = state.anchor,
22826      following,
22827      terminator,
22828      isPair,
22829      isExplicitPair,
22830      isMapping,
22831      overridableKeys = Object.create(null),
22832      keyNode,
22833      keyTag,
22834      valueNode,
22835      ch;
22836  ch = state.input.charCodeAt(state.position);
22837  if (ch === 0x5B) {
22838    terminator = 0x5D;
22839    isMapping = false;
22840    _result = [];
22841  } else if (ch === 0x7B) {
22842    terminator = 0x7D;
22843    isMapping = true;
22844    _result = {};
22845  } else {
22846    return false;
22847  }
22848  if (state.anchor !== null) {
22849    state.anchorMap[state.anchor] = _result;
22850  }
22851  ch = state.input.charCodeAt(++state.position);
22852  while (ch !== 0) {
22853    skipSeparationSpace(state, true, nodeIndent);
22854    ch = state.input.charCodeAt(state.position);
22855    if (ch === terminator) {
22856      state.position++;
22857      state.tag = _tag;
22858      state.anchor = _anchor;
22859      state.kind = isMapping ? 'mapping' : 'sequence';
22860      state.result = _result;
22861      return true;
22862    } else if (!readNext) {
22863      throwError(state, 'missed comma between flow collection entries');
22864    } else if (ch === 0x2C) {
22865      throwError(state, "expected the node content, but found ','");
22866    }
22867    keyTag = keyNode = valueNode = null;
22868    isPair = isExplicitPair = false;
22869    if (ch === 0x3F) {
22870      following = state.input.charCodeAt(state.position + 1);
22871      if (is_WS_OR_EOL(following)) {
22872        isPair = isExplicitPair = true;
22873        state.position++;
22874        skipSeparationSpace(state, true, nodeIndent);
22875      }
22876    }
22877    _line = state.line;
22878    _lineStart = state.lineStart;
22879    _pos = state.position;
22880    composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
22881    keyTag = state.tag;
22882    keyNode = state.result;
22883    skipSeparationSpace(state, true, nodeIndent);
22884    ch = state.input.charCodeAt(state.position);
22885    if ((isExplicitPair || state.line === _line) && ch === 0x3A) {
22886      isPair = true;
22887      ch = state.input.charCodeAt(++state.position);
22888      skipSeparationSpace(state, true, nodeIndent);
22889      composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
22890      valueNode = state.result;
22891    }
22892    if (isMapping) {
22893      storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
22894    } else if (isPair) {
22895      _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
22896    } else {
22897      _result.push(keyNode);
22898    }
22899    skipSeparationSpace(state, true, nodeIndent);
22900    ch = state.input.charCodeAt(state.position);
22901    if (ch === 0x2C) {
22902      readNext = true;
22903      ch = state.input.charCodeAt(++state.position);
22904    } else {
22905      readNext = false;
22906    }
22907  }
22908  throwError(state, 'unexpected end of the stream within a flow collection');
22909}
22910function readBlockScalar(state, nodeIndent) {
22911  var captureStart,
22912      folding,
22913      chomping       = CHOMPING_CLIP,
22914      didReadContent = false,
22915      detectedIndent = false,
22916      textIndent     = nodeIndent,
22917      emptyLines     = 0,
22918      atMoreIndented = false,
22919      tmp,
22920      ch;
22921  ch = state.input.charCodeAt(state.position);
22922  if (ch === 0x7C) {
22923    folding = false;
22924  } else if (ch === 0x3E) {
22925    folding = true;
22926  } else {
22927    return false;
22928  }
22929  state.kind = 'scalar';
22930  state.result = '';
22931  while (ch !== 0) {
22932    ch = state.input.charCodeAt(++state.position);
22933    if (ch === 0x2B || ch === 0x2D) {
22934      if (CHOMPING_CLIP === chomping) {
22935        chomping = (ch === 0x2B) ? CHOMPING_KEEP : CHOMPING_STRIP;
22936      } else {
22937        throwError(state, 'repeat of a chomping mode identifier');
22938      }
22939    } else if ((tmp = fromDecimalCode(ch)) >= 0) {
22940      if (tmp === 0) {
22941        throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
22942      } else if (!detectedIndent) {
22943        textIndent = nodeIndent + tmp - 1;
22944        detectedIndent = true;
22945      } else {
22946        throwError(state, 'repeat of an indentation width identifier');
22947      }
22948    } else {
22949      break;
22950    }
22951  }
22952  if (is_WHITE_SPACE(ch)) {
22953    do { ch = state.input.charCodeAt(++state.position); }
22954    while (is_WHITE_SPACE(ch));
22955    if (ch === 0x23) {
22956      do { ch = state.input.charCodeAt(++state.position); }
22957      while (!is_EOL(ch) && (ch !== 0));
22958    }
22959  }
22960  while (ch !== 0) {
22961    readLineBreak(state);
22962    state.lineIndent = 0;
22963    ch = state.input.charCodeAt(state.position);
22964    while ((!detectedIndent || state.lineIndent < textIndent) &&
22965           (ch === 0x20)) {
22966      state.lineIndent++;
22967      ch = state.input.charCodeAt(++state.position);
22968    }
22969    if (!detectedIndent && state.lineIndent > textIndent) {
22970      textIndent = state.lineIndent;
22971    }
22972    if (is_EOL(ch)) {
22973      emptyLines++;
22974      continue;
22975    }
22976    if (state.lineIndent < textIndent) {
22977      if (chomping === CHOMPING_KEEP) {
22978        state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
22979      } else if (chomping === CHOMPING_CLIP) {
22980        if (didReadContent) {
22981          state.result += '\n';
22982        }
22983      }
22984      break;
22985    }
22986    if (folding) {
22987      if (is_WHITE_SPACE(ch)) {
22988        atMoreIndented = true;
22989        state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
22990      } else if (atMoreIndented) {
22991        atMoreIndented = false;
22992        state.result += common.repeat('\n', emptyLines + 1);
22993      } else if (emptyLines === 0) {
22994        if (didReadContent) {
22995          state.result += ' ';
22996        }
22997      } else {
22998        state.result += common.repeat('\n', emptyLines);
22999      }
23000    } else {
23001      state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
23002    }
23003    didReadContent = true;
23004    detectedIndent = true;
23005    emptyLines = 0;
23006    captureStart = state.position;
23007    while (!is_EOL(ch) && (ch !== 0)) {
23008      ch = state.input.charCodeAt(++state.position);
23009    }
23010    captureSegment(state, captureStart, state.position, false);
23011  }
23012  return true;
23013}
23014function readBlockSequence(state, nodeIndent) {
23015  var _line,
23016      _tag      = state.tag,
23017      _anchor   = state.anchor,
23018      _result   = [],
23019      following,
23020      detected  = false,
23021      ch;
23022  if (state.firstTabInLine !== -1) return false;
23023  if (state.anchor !== null) {
23024    state.anchorMap[state.anchor] = _result;
23025  }
23026  ch = state.input.charCodeAt(state.position);
23027  while (ch !== 0) {
23028    if (state.firstTabInLine !== -1) {
23029      state.position = state.firstTabInLine;
23030      throwError(state, 'tab characters must not be used in indentation');
23031    }
23032    if (ch !== 0x2D) {
23033      break;
23034    }
23035    following = state.input.charCodeAt(state.position + 1);
23036    if (!is_WS_OR_EOL(following)) {
23037      break;
23038    }
23039    detected = true;
23040    state.position++;
23041    if (skipSeparationSpace(state, true, -1)) {
23042      if (state.lineIndent <= nodeIndent) {
23043        _result.push(null);
23044        ch = state.input.charCodeAt(state.position);
23045        continue;
23046      }
23047    }
23048    _line = state.line;
23049    composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
23050    _result.push(state.result);
23051    skipSeparationSpace(state, true, -1);
23052    ch = state.input.charCodeAt(state.position);
23053    if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
23054      throwError(state, 'bad indentation of a sequence entry');
23055    } else if (state.lineIndent < nodeIndent) {
23056      break;
23057    }
23058  }
23059  if (detected) {
23060    state.tag = _tag;
23061    state.anchor = _anchor;
23062    state.kind = 'sequence';
23063    state.result = _result;
23064    return true;
23065  }
23066  return false;
23067}
23068function readBlockMapping(state, nodeIndent, flowIndent) {
23069  var following,
23070      allowCompact,
23071      _line,
23072      _keyLine,
23073      _keyLineStart,
23074      _keyPos,
23075      _tag          = state.tag,
23076      _anchor       = state.anchor,
23077      _result       = {},
23078      overridableKeys = Object.create(null),
23079      keyTag        = null,
23080      keyNode       = null,
23081      valueNode     = null,
23082      atExplicitKey = false,
23083      detected      = false,
23084      ch;
23085  if (state.firstTabInLine !== -1) return false;
23086  if (state.anchor !== null) {
23087    state.anchorMap[state.anchor] = _result;
23088  }
23089  ch = state.input.charCodeAt(state.position);
23090  while (ch !== 0) {
23091    if (!atExplicitKey && state.firstTabInLine !== -1) {
23092      state.position = state.firstTabInLine;
23093      throwError(state, 'tab characters must not be used in indentation');
23094    }
23095    following = state.input.charCodeAt(state.position + 1);
23096    _line = state.line;
23097    if ((ch === 0x3F || ch === 0x3A) && is_WS_OR_EOL(following)) {
23098      if (ch === 0x3F) {
23099        if (atExplicitKey) {
23100          storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
23101          keyTag = keyNode = valueNode = null;
23102        }
23103        detected = true;
23104        atExplicitKey = true;
23105        allowCompact = true;
23106      } else if (atExplicitKey) {
23107        atExplicitKey = false;
23108        allowCompact = true;
23109      } else {
23110        throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
23111      }
23112      state.position += 1;
23113      ch = following;
23114    } else {
23115      _keyLine = state.line;
23116      _keyLineStart = state.lineStart;
23117      _keyPos = state.position;
23118      if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
23119        break;
23120      }
23121      if (state.line === _line) {
23122        ch = state.input.charCodeAt(state.position);
23123        while (is_WHITE_SPACE(ch)) {
23124          ch = state.input.charCodeAt(++state.position);
23125        }
23126        if (ch === 0x3A) {
23127          ch = state.input.charCodeAt(++state.position);
23128          if (!is_WS_OR_EOL(ch)) {
23129            throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
23130          }
23131          if (atExplicitKey) {
23132            storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
23133            keyTag = keyNode = valueNode = null;
23134          }
23135          detected = true;
23136          atExplicitKey = false;
23137          allowCompact = false;
23138          keyTag = state.tag;
23139          keyNode = state.result;
23140        } else if (detected) {
23141          throwError(state, 'can not read an implicit mapping pair; a colon is missed');
23142        } else {
23143          state.tag = _tag;
23144          state.anchor = _anchor;
23145          return true;
23146        }
23147      } else if (detected) {
23148        throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
23149      } else {
23150        state.tag = _tag;
23151        state.anchor = _anchor;
23152        return true;
23153      }
23154    }
23155    if (state.line === _line || state.lineIndent > nodeIndent) {
23156      if (atExplicitKey) {
23157        _keyLine = state.line;
23158        _keyLineStart = state.lineStart;
23159        _keyPos = state.position;
23160      }
23161      if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
23162        if (atExplicitKey) {
23163          keyNode = state.result;
23164        } else {
23165          valueNode = state.result;
23166        }
23167      }
23168      if (!atExplicitKey) {
23169        storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
23170        keyTag = keyNode = valueNode = null;
23171      }
23172      skipSeparationSpace(state, true, -1);
23173      ch = state.input.charCodeAt(state.position);
23174    }
23175    if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
23176      throwError(state, 'bad indentation of a mapping entry');
23177    } else if (state.lineIndent < nodeIndent) {
23178      break;
23179    }
23180  }
23181  if (atExplicitKey) {
23182    storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
23183  }
23184  if (detected) {
23185    state.tag = _tag;
23186    state.anchor = _anchor;
23187    state.kind = 'mapping';
23188    state.result = _result;
23189  }
23190  return detected;
23191}
23192function readTagProperty(state) {
23193  var _position,
23194      isVerbatim = false,
23195      isNamed    = false,
23196      tagHandle,
23197      tagName,
23198      ch;
23199  ch = state.input.charCodeAt(state.position);
23200  if (ch !== 0x21) return false;
23201  if (state.tag !== null) {
23202    throwError(state, 'duplication of a tag property');
23203  }
23204  ch = state.input.charCodeAt(++state.position);
23205  if (ch === 0x3C) {
23206    isVerbatim = true;
23207    ch = state.input.charCodeAt(++state.position);
23208  } else if (ch === 0x21) {
23209    isNamed = true;
23210    tagHandle = '!!';
23211    ch = state.input.charCodeAt(++state.position);
23212  } else {
23213    tagHandle = '!';
23214  }
23215  _position = state.position;
23216  if (isVerbatim) {
23217    do { ch = state.input.charCodeAt(++state.position); }
23218    while (ch !== 0 && ch !== 0x3E);
23219    if (state.position < state.length) {
23220      tagName = state.input.slice(_position, state.position);
23221      ch = state.input.charCodeAt(++state.position);
23222    } else {
23223      throwError(state, 'unexpected end of the stream within a verbatim tag');
23224    }
23225  } else {
23226    while (ch !== 0 && !is_WS_OR_EOL(ch)) {
23227      if (ch === 0x21) {
23228        if (!isNamed) {
23229          tagHandle = state.input.slice(_position - 1, state.position + 1);
23230          if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
23231            throwError(state, 'named tag handle cannot contain such characters');
23232          }
23233          isNamed = true;
23234          _position = state.position + 1;
23235        } else {
23236          throwError(state, 'tag suffix cannot contain exclamation marks');
23237        }
23238      }
23239      ch = state.input.charCodeAt(++state.position);
23240    }
23241    tagName = state.input.slice(_position, state.position);
23242    if (PATTERN_FLOW_INDICATORS.test(tagName)) {
23243      throwError(state, 'tag suffix cannot contain flow indicator characters');
23244    }
23245  }
23246  if (tagName && !PATTERN_TAG_URI.test(tagName)) {
23247    throwError(state, 'tag name cannot contain such characters: ' + tagName);
23248  }
23249  try {
23250    tagName = decodeURIComponent(tagName);
23251  } catch (err) {
23252    throwError(state, 'tag name is malformed: ' + tagName);
23253  }
23254  if (isVerbatim) {
23255    state.tag = tagName;
23256  } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
23257    state.tag = state.tagMap[tagHandle] + tagName;
23258  } else if (tagHandle === '!') {
23259    state.tag = '!' + tagName;
23260  } else if (tagHandle === '!!') {
23261    state.tag = 'tag:yaml.org,2002:' + tagName;
23262  } else {
23263    throwError(state, 'undeclared tag handle "' + tagHandle + '"');
23264  }
23265  return true;
23266}
23267function readAnchorProperty(state) {
23268  var _position,
23269      ch;
23270  ch = state.input.charCodeAt(state.position);
23271  if (ch !== 0x26) return false;
23272  if (state.anchor !== null) {
23273    throwError(state, 'duplication of an anchor property');
23274  }
23275  ch = state.input.charCodeAt(++state.position);
23276  _position = state.position;
23277  while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
23278    ch = state.input.charCodeAt(++state.position);
23279  }
23280  if (state.position === _position) {
23281    throwError(state, 'name of an anchor node must contain at least one character');
23282  }
23283  state.anchor = state.input.slice(_position, state.position);
23284  return true;
23285}
23286function readAlias(state) {
23287  var _position, alias,
23288      ch;
23289  ch = state.input.charCodeAt(state.position);
23290  if (ch !== 0x2A) return false;
23291  ch = state.input.charCodeAt(++state.position);
23292  _position = state.position;
23293  while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
23294    ch = state.input.charCodeAt(++state.position);
23295  }
23296  if (state.position === _position) {
23297    throwError(state, 'name of an alias node must contain at least one character');
23298  }
23299  alias = state.input.slice(_position, state.position);
23300  if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
23301    throwError(state, 'unidentified alias "' + alias + '"');
23302  }
23303  state.result = state.anchorMap[alias];
23304  skipSeparationSpace(state, true, -1);
23305  return true;
23306}
23307function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
23308  var allowBlockStyles,
23309      allowBlockScalars,
23310      allowBlockCollections,
23311      indentStatus = 1,
23312      atNewLine  = false,
23313      hasContent = false,
23314      typeIndex,
23315      typeQuantity,
23316      typeList,
23317      type,
23318      flowIndent,
23319      blockIndent;
23320  if (state.listener !== null) {
23321    state.listener('open', state);
23322  }
23323  state.tag    = null;
23324  state.anchor = null;
23325  state.kind   = null;
23326  state.result = null;
23327  allowBlockStyles = allowBlockScalars = allowBlockCollections =
23328    CONTEXT_BLOCK_OUT === nodeContext ||
23329    CONTEXT_BLOCK_IN  === nodeContext;
23330  if (allowToSeek) {
23331    if (skipSeparationSpace(state, true, -1)) {
23332      atNewLine = true;
23333      if (state.lineIndent > parentIndent) {
23334        indentStatus = 1;
23335      } else if (state.lineIndent === parentIndent) {
23336        indentStatus = 0;
23337      } else if (state.lineIndent < parentIndent) {
23338        indentStatus = -1;
23339      }
23340    }
23341  }
23342  if (indentStatus === 1) {
23343    while (readTagProperty(state) || readAnchorProperty(state)) {
23344      if (skipSeparationSpace(state, true, -1)) {
23345        atNewLine = true;
23346        allowBlockCollections = allowBlockStyles;
23347        if (state.lineIndent > parentIndent) {
23348          indentStatus = 1;
23349        } else if (state.lineIndent === parentIndent) {
23350          indentStatus = 0;
23351        } else if (state.lineIndent < parentIndent) {
23352          indentStatus = -1;
23353        }
23354      } else {
23355        allowBlockCollections = false;
23356      }
23357    }
23358  }
23359  if (allowBlockCollections) {
23360    allowBlockCollections = atNewLine || allowCompact;
23361  }
23362  if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
23363    if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
23364      flowIndent = parentIndent;
23365    } else {
23366      flowIndent = parentIndent + 1;
23367    }
23368    blockIndent = state.position - state.lineStart;
23369    if (indentStatus === 1) {
23370      if (allowBlockCollections &&
23371          (readBlockSequence(state, blockIndent) ||
23372           readBlockMapping(state, blockIndent, flowIndent)) ||
23373          readFlowCollection(state, flowIndent)) {
23374        hasContent = true;
23375      } else {
23376        if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
23377            readSingleQuotedScalar(state, flowIndent) ||
23378            readDoubleQuotedScalar(state, flowIndent)) {
23379          hasContent = true;
23380        } else if (readAlias(state)) {
23381          hasContent = true;
23382          if (state.tag !== null || state.anchor !== null) {
23383            throwError(state, 'alias node should not have any properties');
23384          }
23385        } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
23386          hasContent = true;
23387          if (state.tag === null) {
23388            state.tag = '?';
23389          }
23390        }
23391        if (state.anchor !== null) {
23392          state.anchorMap[state.anchor] = state.result;
23393        }
23394      }
23395    } else if (indentStatus === 0) {
23396      hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
23397    }
23398  }
23399  if (state.tag === null) {
23400    if (state.anchor !== null) {
23401      state.anchorMap[state.anchor] = state.result;
23402    }
23403  } else if (state.tag === '?') {
23404    if (state.result !== null && state.kind !== 'scalar') {
23405      throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
23406    }
23407    for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
23408      type = state.implicitTypes[typeIndex];
23409      if (type.resolve(state.result)) {
23410        state.result = type.construct(state.result);
23411        state.tag = type.tag;
23412        if (state.anchor !== null) {
23413          state.anchorMap[state.anchor] = state.result;
23414        }
23415        break;
23416      }
23417    }
23418  } else if (state.tag !== '!') {
23419    if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
23420      type = state.typeMap[state.kind || 'fallback'][state.tag];
23421    } else {
23422      type = null;
23423      typeList = state.typeMap.multi[state.kind || 'fallback'];
23424      for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
23425        if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
23426          type = typeList[typeIndex];
23427          break;
23428        }
23429      }
23430    }
23431    if (!type) {
23432      throwError(state, 'unknown tag !<' + state.tag + '>');
23433    }
23434    if (state.result !== null && type.kind !== state.kind) {
23435      throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
23436    }
23437    if (!type.resolve(state.result, state.tag)) {
23438      throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
23439    } else {
23440      state.result = type.construct(state.result, state.tag);
23441      if (state.anchor !== null) {
23442        state.anchorMap[state.anchor] = state.result;
23443      }
23444    }
23445  }
23446  if (state.listener !== null) {
23447    state.listener('close', state);
23448  }
23449  return state.tag !== null ||  state.anchor !== null || hasContent;
23450}
23451function readDocument(state) {
23452  var documentStart = state.position,
23453      _position,
23454      directiveName,
23455      directiveArgs,
23456      hasDirectives = false,
23457      ch;
23458  state.version = null;
23459  state.checkLineBreaks = state.legacy;
23460  state.tagMap = Object.create(null);
23461  state.anchorMap = Object.create(null);
23462  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
23463    skipSeparationSpace(state, true, -1);
23464    ch = state.input.charCodeAt(state.position);
23465    if (state.lineIndent > 0 || ch !== 0x25) {
23466      break;
23467    }
23468    hasDirectives = true;
23469    ch = state.input.charCodeAt(++state.position);
23470    _position = state.position;
23471    while (ch !== 0 && !is_WS_OR_EOL(ch)) {
23472      ch = state.input.charCodeAt(++state.position);
23473    }
23474    directiveName = state.input.slice(_position, state.position);
23475    directiveArgs = [];
23476    if (directiveName.length < 1) {
23477      throwError(state, 'directive name must not be less than one character in length');
23478    }
23479    while (ch !== 0) {
23480      while (is_WHITE_SPACE(ch)) {
23481        ch = state.input.charCodeAt(++state.position);
23482      }
23483      if (ch === 0x23) {
23484        do { ch = state.input.charCodeAt(++state.position); }
23485        while (ch !== 0 && !is_EOL(ch));
23486        break;
23487      }
23488      if (is_EOL(ch)) break;
23489      _position = state.position;
23490      while (ch !== 0 && !is_WS_OR_EOL(ch)) {
23491        ch = state.input.charCodeAt(++state.position);
23492      }
23493      directiveArgs.push(state.input.slice(_position, state.position));
23494    }
23495    if (ch !== 0) readLineBreak(state);
23496    if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
23497      directiveHandlers[directiveName](state, directiveName, directiveArgs);
23498    } else {
23499      throwWarning(state, 'unknown document directive "' + directiveName + '"');
23500    }
23501  }
23502  skipSeparationSpace(state, true, -1);
23503  if (state.lineIndent === 0 &&
23504      state.input.charCodeAt(state.position)     === 0x2D &&
23505      state.input.charCodeAt(state.position + 1) === 0x2D &&
23506      state.input.charCodeAt(state.position + 2) === 0x2D) {
23507    state.position += 3;
23508    skipSeparationSpace(state, true, -1);
23509  } else if (hasDirectives) {
23510    throwError(state, 'directives end mark is expected');
23511  }
23512  composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
23513  skipSeparationSpace(state, true, -1);
23514  if (state.checkLineBreaks &&
23515      PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
23516    throwWarning(state, 'non-ASCII line breaks are interpreted as content');
23517  }
23518  state.documents.push(state.result);
23519  if (state.position === state.lineStart && testDocumentSeparator(state)) {
23520    if (state.input.charCodeAt(state.position) === 0x2E) {
23521      state.position += 3;
23522      skipSeparationSpace(state, true, -1);
23523    }
23524    return;
23525  }
23526  if (state.position < (state.length - 1)) {
23527    throwError(state, 'end of the stream or a document separator is expected');
23528  } else {
23529    return;
23530  }
23531}
23532function loadDocuments(input, options) {
23533  input = String(input);
23534  options = options || {};
23535  if (input.length !== 0) {
23536    if (input.charCodeAt(input.length - 1) !== 0x0A &&
23537        input.charCodeAt(input.length - 1) !== 0x0D) {
23538      input += '\n';
23539    }
23540    if (input.charCodeAt(0) === 0xFEFF) {
23541      input = input.slice(1);
23542    }
23543  }
23544  var state = new State$1(input, options);
23545  var nullpos = input.indexOf('\0');
23546  if (nullpos !== -1) {
23547    state.position = nullpos;
23548    throwError(state, 'null byte is not allowed in input');
23549  }
23550  state.input += '\0';
23551  while (state.input.charCodeAt(state.position) === 0x20) {
23552    state.lineIndent += 1;
23553    state.position += 1;
23554  }
23555  while (state.position < (state.length - 1)) {
23556    readDocument(state);
23557  }
23558  return state.documents;
23559}
23560function loadAll$1(input, iterator, options) {
23561  if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
23562    options = iterator;
23563    iterator = null;
23564  }
23565  var documents = loadDocuments(input, options);
23566  if (typeof iterator !== 'function') {
23567    return documents;
23568  }
23569  for (var index = 0, length = documents.length; index < length; index += 1) {
23570    iterator(documents[index]);
23571  }
23572}
23573function load$1(input, options) {
23574  var documents = loadDocuments(input, options);
23575  if (documents.length === 0) {
23576    return undefined;
23577  } else if (documents.length === 1) {
23578    return documents[0];
23579  }
23580  throw new exception('expected a single document in the stream, but found more');
23581}
23582var loadAll_1 = loadAll$1;
23583var load_1    = load$1;
23584var loader = {
23585	loadAll: loadAll_1,
23586	load: load_1
23587};
23588var _toString       = Object.prototype.toString;
23589var _hasOwnProperty = Object.prototype.hasOwnProperty;
23590var CHAR_BOM                  = 0xFEFF;
23591var CHAR_TAB                  = 0x09;
23592var CHAR_LINE_FEED            = 0x0A;
23593var CHAR_CARRIAGE_RETURN      = 0x0D;
23594var CHAR_SPACE                = 0x20;
23595var CHAR_EXCLAMATION          = 0x21;
23596var CHAR_DOUBLE_QUOTE         = 0x22;
23597var CHAR_SHARP                = 0x23;
23598var CHAR_PERCENT              = 0x25;
23599var CHAR_AMPERSAND            = 0x26;
23600var CHAR_SINGLE_QUOTE         = 0x27;
23601var CHAR_ASTERISK             = 0x2A;
23602var CHAR_COMMA                = 0x2C;
23603var CHAR_MINUS                = 0x2D;
23604var CHAR_COLON                = 0x3A;
23605var CHAR_EQUALS               = 0x3D;
23606var CHAR_GREATER_THAN         = 0x3E;
23607var CHAR_QUESTION             = 0x3F;
23608var CHAR_COMMERCIAL_AT        = 0x40;
23609var CHAR_LEFT_SQUARE_BRACKET  = 0x5B;
23610var CHAR_RIGHT_SQUARE_BRACKET = 0x5D;
23611var CHAR_GRAVE_ACCENT         = 0x60;
23612var CHAR_LEFT_CURLY_BRACKET   = 0x7B;
23613var CHAR_VERTICAL_LINE        = 0x7C;
23614var CHAR_RIGHT_CURLY_BRACKET  = 0x7D;
23615var ESCAPE_SEQUENCES = {};
23616ESCAPE_SEQUENCES[0x00]   = '\\0';
23617ESCAPE_SEQUENCES[0x07]   = '\\a';
23618ESCAPE_SEQUENCES[0x08]   = '\\b';
23619ESCAPE_SEQUENCES[0x09]   = '\\t';
23620ESCAPE_SEQUENCES[0x0A]   = '\\n';
23621ESCAPE_SEQUENCES[0x0B]   = '\\v';
23622ESCAPE_SEQUENCES[0x0C]   = '\\f';
23623ESCAPE_SEQUENCES[0x0D]   = '\\r';
23624ESCAPE_SEQUENCES[0x1B]   = '\\e';
23625ESCAPE_SEQUENCES[0x22]   = '\\"';
23626ESCAPE_SEQUENCES[0x5C]   = '\\\\';
23627ESCAPE_SEQUENCES[0x85]   = '\\N';
23628ESCAPE_SEQUENCES[0xA0]   = '\\_';
23629ESCAPE_SEQUENCES[0x2028] = '\\L';
23630ESCAPE_SEQUENCES[0x2029] = '\\P';
23631var DEPRECATED_BOOLEANS_SYNTAX = [
23632  'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
23633  'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
23634];
23635var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
23636function compileStyleMap(schema, map) {
23637  var result, keys, index, length, tag, style, type;
23638  if (map === null) return {};
23639  result = {};
23640  keys = Object.keys(map);
23641  for (index = 0, length = keys.length; index < length; index += 1) {
23642    tag = keys[index];
23643    style = String(map[tag]);
23644    if (tag.slice(0, 2) === '!!') {
23645      tag = 'tag:yaml.org,2002:' + tag.slice(2);
23646    }
23647    type = schema.compiledTypeMap['fallback'][tag];
23648    if (type && _hasOwnProperty.call(type.styleAliases, style)) {
23649      style = type.styleAliases[style];
23650    }
23651    result[tag] = style;
23652  }
23653  return result;
23654}
23655function encodeHex(character) {
23656  var string, handle, length;
23657  string = character.toString(16).toUpperCase();
23658  if (character <= 0xFF) {
23659    handle = 'x';
23660    length = 2;
23661  } else if (character <= 0xFFFF) {
23662    handle = 'u';
23663    length = 4;
23664  } else if (character <= 0xFFFFFFFF) {
23665    handle = 'U';
23666    length = 8;
23667  } else {
23668    throw new exception('code point within a string may not be greater than 0xFFFFFFFF');
23669  }
23670  return '\\' + handle + common.repeat('0', length - string.length) + string;
23671}
23672var QUOTING_TYPE_SINGLE = 1,
23673    QUOTING_TYPE_DOUBLE = 2;
23674function State(options) {
23675  this.schema        = options['schema'] || _default;
23676  this.indent        = Math.max(1, (options['indent'] || 2));
23677  this.noArrayIndent = options['noArrayIndent'] || false;
23678  this.skipInvalid   = options['skipInvalid'] || false;
23679  this.flowLevel     = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
23680  this.styleMap      = compileStyleMap(this.schema, options['styles'] || null);
23681  this.sortKeys      = options['sortKeys'] || false;
23682  this.lineWidth     = options['lineWidth'] || 80;
23683  this.noRefs        = options['noRefs'] || false;
23684  this.noCompatMode  = options['noCompatMode'] || false;
23685  this.condenseFlow  = options['condenseFlow'] || false;
23686  this.quotingType   = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
23687  this.forceQuotes   = options['forceQuotes'] || false;
23688  this.replacer      = typeof options['replacer'] === 'function' ? options['replacer'] : null;
23689  this.implicitTypes = this.schema.compiledImplicit;
23690  this.explicitTypes = this.schema.compiledExplicit;
23691  this.tag = null;
23692  this.result = '';
23693  this.duplicates = [];
23694  this.usedDuplicates = null;
23695}
23696function indentString(string, spaces) {
23697  var ind = common.repeat(' ', spaces),
23698      position = 0,
23699      next = -1,
23700      result = '',
23701      line,
23702      length = string.length;
23703  while (position < length) {
23704    next = string.indexOf('\n', position);
23705    if (next === -1) {
23706      line = string.slice(position);
23707      position = length;
23708    } else {
23709      line = string.slice(position, next + 1);
23710      position = next + 1;
23711    }
23712    if (line.length && line !== '\n') result += ind;
23713    result += line;
23714  }
23715  return result;
23716}
23717function generateNextLine(state, level) {
23718  return '\n' + common.repeat(' ', state.indent * level);
23719}
23720function testImplicitResolving(state, str) {
23721  var index, length, type;
23722  for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
23723    type = state.implicitTypes[index];
23724    if (type.resolve(str)) {
23725      return true;
23726    }
23727  }
23728  return false;
23729}
23730function isWhitespace(c) {
23731  return c === CHAR_SPACE || c === CHAR_TAB;
23732}
23733function isPrintable(c) {
23734  return  (0x00020 <= c && c <= 0x00007E)
23735      || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
23736      || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)
23737      ||  (0x10000 <= c && c <= 0x10FFFF);
23738}
23739function isNsCharOrWhitespace(c) {
23740  return isPrintable(c)
23741    && c !== CHAR_BOM
23742    && c !== CHAR_CARRIAGE_RETURN
23743    && c !== CHAR_LINE_FEED;
23744}
23745function isPlainSafe(c, prev, inblock) {
23746  var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
23747  var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
23748  return (
23749    inblock ?
23750      cIsNsCharOrWhitespace
23751      : cIsNsCharOrWhitespace
23752        && c !== CHAR_COMMA
23753        && c !== CHAR_LEFT_SQUARE_BRACKET
23754        && c !== CHAR_RIGHT_SQUARE_BRACKET
23755        && c !== CHAR_LEFT_CURLY_BRACKET
23756        && c !== CHAR_RIGHT_CURLY_BRACKET
23757  )
23758    && c !== CHAR_SHARP
23759    && !(prev === CHAR_COLON && !cIsNsChar)
23760    || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP)
23761    || (prev === CHAR_COLON && cIsNsChar);
23762}
23763function isPlainSafeFirst(c) {
23764  return isPrintable(c) && c !== CHAR_BOM
23765    && !isWhitespace(c)
23766    && c !== CHAR_MINUS
23767    && c !== CHAR_QUESTION
23768    && c !== CHAR_COLON
23769    && c !== CHAR_COMMA
23770    && c !== CHAR_LEFT_SQUARE_BRACKET
23771    && c !== CHAR_RIGHT_SQUARE_BRACKET
23772    && c !== CHAR_LEFT_CURLY_BRACKET
23773    && c !== CHAR_RIGHT_CURLY_BRACKET
23774    && c !== CHAR_SHARP
23775    && c !== CHAR_AMPERSAND
23776    && c !== CHAR_ASTERISK
23777    && c !== CHAR_EXCLAMATION
23778    && c !== CHAR_VERTICAL_LINE
23779    && c !== CHAR_EQUALS
23780    && c !== CHAR_GREATER_THAN
23781    && c !== CHAR_SINGLE_QUOTE
23782    && c !== CHAR_DOUBLE_QUOTE
23783    && c !== CHAR_PERCENT
23784    && c !== CHAR_COMMERCIAL_AT
23785    && c !== CHAR_GRAVE_ACCENT;
23786}
23787function isPlainSafeLast(c) {
23788  return !isWhitespace(c) && c !== CHAR_COLON;
23789}
23790function codePointAt(string, pos) {
23791  var first = string.charCodeAt(pos), second;
23792  if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {
23793    second = string.charCodeAt(pos + 1);
23794    if (second >= 0xDC00 && second <= 0xDFFF) {
23795      return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
23796    }
23797  }
23798  return first;
23799}
23800function needIndentIndicator(string) {
23801  var leadingSpaceRe = /^\n* /;
23802  return leadingSpaceRe.test(string);
23803}
23804var STYLE_PLAIN   = 1,
23805    STYLE_SINGLE  = 2,
23806    STYLE_LITERAL = 3,
23807    STYLE_FOLDED  = 4,
23808    STYLE_DOUBLE  = 5;
23809function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,
23810  testAmbiguousType, quotingType, forceQuotes, inblock) {
23811  var i;
23812  var char = 0;
23813  var prevChar = null;
23814  var hasLineBreak = false;
23815  var hasFoldableLine = false;
23816  var shouldTrackWidth = lineWidth !== -1;
23817  var previousLineBreak = -1;
23818  var plain = isPlainSafeFirst(codePointAt(string, 0))
23819          && isPlainSafeLast(codePointAt(string, string.length - 1));
23820  if (singleLineOnly || forceQuotes) {
23821    for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
23822      char = codePointAt(string, i);
23823      if (!isPrintable(char)) {
23824        return STYLE_DOUBLE;
23825      }
23826      plain = plain && isPlainSafe(char, prevChar, inblock);
23827      prevChar = char;
23828    }
23829  } else {
23830    for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
23831      char = codePointAt(string, i);
23832      if (char === CHAR_LINE_FEED) {
23833        hasLineBreak = true;
23834        if (shouldTrackWidth) {
23835          hasFoldableLine = hasFoldableLine ||
23836            (i - previousLineBreak - 1 > lineWidth &&
23837             string[previousLineBreak + 1] !== ' ');
23838          previousLineBreak = i;
23839        }
23840      } else if (!isPrintable(char)) {
23841        return STYLE_DOUBLE;
23842      }
23843      plain = plain && isPlainSafe(char, prevChar, inblock);
23844      prevChar = char;
23845    }
23846    hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
23847      (i - previousLineBreak - 1 > lineWidth &&
23848       string[previousLineBreak + 1] !== ' '));
23849  }
23850  if (!hasLineBreak && !hasFoldableLine) {
23851    if (plain && !forceQuotes && !testAmbiguousType(string)) {
23852      return STYLE_PLAIN;
23853    }
23854    return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
23855  }
23856  if (indentPerLevel > 9 && needIndentIndicator(string)) {
23857    return STYLE_DOUBLE;
23858  }
23859  if (!forceQuotes) {
23860    return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
23861  }
23862  return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
23863}
23864function writeScalar(state, string, level, iskey, inblock) {
23865  state.dump = (function () {
23866    if (string.length === 0) {
23867      return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
23868    }
23869    if (!state.noCompatMode) {
23870      if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
23871        return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'");
23872      }
23873    }
23874    var indent = state.indent * Math.max(1, level);
23875    var lineWidth = state.lineWidth === -1
23876      ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
23877    var singleLineOnly = iskey
23878      || (state.flowLevel > -1 && level >= state.flowLevel);
23879    function testAmbiguity(string) {
23880      return testImplicitResolving(state, string);
23881    }
23882    switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,
23883      testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
23884      case STYLE_PLAIN:
23885        return string;
23886      case STYLE_SINGLE:
23887        return "'" + string.replace(/'/g, "''") + "'";
23888      case STYLE_LITERAL:
23889        return '|' + blockHeader(string, state.indent)
23890          + dropEndingNewline(indentString(string, indent));
23891      case STYLE_FOLDED:
23892        return '>' + blockHeader(string, state.indent)
23893          + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
23894      case STYLE_DOUBLE:
23895        return '"' + escapeString(string) + '"';
23896      default:
23897        throw new exception('impossible error: invalid scalar style');
23898    }
23899  }());
23900}
23901function blockHeader(string, indentPerLevel) {
23902  var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
23903  var clip =          string[string.length - 1] === '\n';
23904  var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
23905  var chomp = keep ? '+' : (clip ? '' : '-');
23906  return indentIndicator + chomp + '\n';
23907}
23908function dropEndingNewline(string) {
23909  return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
23910}
23911function foldString(string, width) {
23912  var lineRe = /(\n+)([^\n]*)/g;
23913  var result = (function () {
23914    var nextLF = string.indexOf('\n');
23915    nextLF = nextLF !== -1 ? nextLF : string.length;
23916    lineRe.lastIndex = nextLF;
23917    return foldLine(string.slice(0, nextLF), width);
23918  }());
23919  var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
23920  var moreIndented;
23921  var match;
23922  while ((match = lineRe.exec(string))) {
23923    var prefix = match[1], line = match[2];
23924    moreIndented = (line[0] === ' ');
23925    result += prefix
23926      + (!prevMoreIndented && !moreIndented && line !== ''
23927        ? '\n' : '')
23928      + foldLine(line, width);
23929    prevMoreIndented = moreIndented;
23930  }
23931  return result;
23932}
23933function foldLine(line, width) {
23934  if (line === '' || line[0] === ' ') return line;
23935  var breakRe = / [^ ]/g;
23936  var match;
23937  var start = 0, end, curr = 0, next = 0;
23938  var result = '';
23939  while ((match = breakRe.exec(line))) {
23940    next = match.index;
23941    if (next - start > width) {
23942      end = (curr > start) ? curr : next;
23943      result += '\n' + line.slice(start, end);
23944      start = end + 1;
23945    }
23946    curr = next;
23947  }
23948  result += '\n';
23949  if (line.length - start > width && curr > start) {
23950    result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
23951  } else {
23952    result += line.slice(start);
23953  }
23954  return result.slice(1);
23955}
23956function escapeString(string) {
23957  var result = '';
23958  var char = 0;
23959  var escapeSeq;
23960  for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
23961    char = codePointAt(string, i);
23962    escapeSeq = ESCAPE_SEQUENCES[char];
23963    if (!escapeSeq && isPrintable(char)) {
23964      result += string[i];
23965      if (char >= 0x10000) result += string[i + 1];
23966    } else {
23967      result += escapeSeq || encodeHex(char);
23968    }
23969  }
23970  return result;
23971}
23972function writeFlowSequence(state, level, object) {
23973  var _result = '',
23974      _tag    = state.tag,
23975      index,
23976      length,
23977      value;
23978  for (index = 0, length = object.length; index < length; index += 1) {
23979    value = object[index];
23980    if (state.replacer) {
23981      value = state.replacer.call(object, String(index), value);
23982    }
23983    if (writeNode(state, level, value, false, false) ||
23984        (typeof value === 'undefined' &&
23985         writeNode(state, level, null, false, false))) {
23986      if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');
23987      _result += state.dump;
23988    }
23989  }
23990  state.tag = _tag;
23991  state.dump = '[' + _result + ']';
23992}
23993function writeBlockSequence(state, level, object, compact) {
23994  var _result = '',
23995      _tag    = state.tag,
23996      index,
23997      length,
23998      value;
23999  for (index = 0, length = object.length; index < length; index += 1) {
24000    value = object[index];
24001    if (state.replacer) {
24002      value = state.replacer.call(object, String(index), value);
24003    }
24004    if (writeNode(state, level + 1, value, true, true, false, true) ||
24005        (typeof value === 'undefined' &&
24006         writeNode(state, level + 1, null, true, true, false, true))) {
24007      if (!compact || _result !== '') {
24008        _result += generateNextLine(state, level);
24009      }
24010      if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
24011        _result += '-';
24012      } else {
24013        _result += '- ';
24014      }
24015      _result += state.dump;
24016    }
24017  }
24018  state.tag = _tag;
24019  state.dump = _result || '[]';
24020}
24021function writeFlowMapping(state, level, object) {
24022  var _result       = '',
24023      _tag          = state.tag,
24024      objectKeyList = Object.keys(object),
24025      index,
24026      length,
24027      objectKey,
24028      objectValue,
24029      pairBuffer;
24030  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
24031    pairBuffer = '';
24032    if (_result !== '') pairBuffer += ', ';
24033    if (state.condenseFlow) pairBuffer += '"';
24034    objectKey = objectKeyList[index];
24035    objectValue = object[objectKey];
24036    if (state.replacer) {
24037      objectValue = state.replacer.call(object, objectKey, objectValue);
24038    }
24039    if (!writeNode(state, level, objectKey, false, false)) {
24040      continue;
24041    }
24042    if (state.dump.length > 1024) pairBuffer += '? ';
24043    pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
24044    if (!writeNode(state, level, objectValue, false, false)) {
24045      continue;
24046    }
24047    pairBuffer += state.dump;
24048    _result += pairBuffer;
24049  }
24050  state.tag = _tag;
24051  state.dump = '{' + _result + '}';
24052}
24053function writeBlockMapping(state, level, object, compact) {
24054  var _result       = '',
24055      _tag          = state.tag,
24056      objectKeyList = Object.keys(object),
24057      index,
24058      length,
24059      objectKey,
24060      objectValue,
24061      explicitPair,
24062      pairBuffer;
24063  if (state.sortKeys === true) {
24064    objectKeyList.sort();
24065  } else if (typeof state.sortKeys === 'function') {
24066    objectKeyList.sort(state.sortKeys);
24067  } else if (state.sortKeys) {
24068    throw new exception('sortKeys must be a boolean or a function');
24069  }
24070  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
24071    pairBuffer = '';
24072    if (!compact || _result !== '') {
24073      pairBuffer += generateNextLine(state, level);
24074    }
24075    objectKey = objectKeyList[index];
24076    objectValue = object[objectKey];
24077    if (state.replacer) {
24078      objectValue = state.replacer.call(object, objectKey, objectValue);
24079    }
24080    if (!writeNode(state, level + 1, objectKey, true, true, true)) {
24081      continue;
24082    }
24083    explicitPair = (state.tag !== null && state.tag !== '?') ||
24084                   (state.dump && state.dump.length > 1024);
24085    if (explicitPair) {
24086      if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
24087        pairBuffer += '?';
24088      } else {
24089        pairBuffer += '? ';
24090      }
24091    }
24092    pairBuffer += state.dump;
24093    if (explicitPair) {
24094      pairBuffer += generateNextLine(state, level);
24095    }
24096    if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
24097      continue;
24098    }
24099    if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
24100      pairBuffer += ':';
24101    } else {
24102      pairBuffer += ': ';
24103    }
24104    pairBuffer += state.dump;
24105    _result += pairBuffer;
24106  }
24107  state.tag = _tag;
24108  state.dump = _result || '{}';
24109}
24110function detectType(state, object, explicit) {
24111  var _result, typeList, index, length, type, style;
24112  typeList = explicit ? state.explicitTypes : state.implicitTypes;
24113  for (index = 0, length = typeList.length; index < length; index += 1) {
24114    type = typeList[index];
24115    if ((type.instanceOf  || type.predicate) &&
24116        (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
24117        (!type.predicate  || type.predicate(object))) {
24118      if (explicit) {
24119        if (type.multi && type.representName) {
24120          state.tag = type.representName(object);
24121        } else {
24122          state.tag = type.tag;
24123        }
24124      } else {
24125        state.tag = '?';
24126      }
24127      if (type.represent) {
24128        style = state.styleMap[type.tag] || type.defaultStyle;
24129        if (_toString.call(type.represent) === '[object Function]') {
24130          _result = type.represent(object, style);
24131        } else if (_hasOwnProperty.call(type.represent, style)) {
24132          _result = type.represent[style](object, style);
24133        } else {
24134          throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
24135        }
24136        state.dump = _result;
24137      }
24138      return true;
24139    }
24140  }
24141  return false;
24142}
24143function writeNode(state, level, object, block, compact, iskey, isblockseq) {
24144  state.tag = null;
24145  state.dump = object;
24146  if (!detectType(state, object, false)) {
24147    detectType(state, object, true);
24148  }
24149  var type = _toString.call(state.dump);
24150  var inblock = block;
24151  var tagStr;
24152  if (block) {
24153    block = (state.flowLevel < 0 || state.flowLevel > level);
24154  }
24155  var objectOrArray = type === '[object Object]' || type === '[object Array]',
24156      duplicateIndex,
24157      duplicate;
24158  if (objectOrArray) {
24159    duplicateIndex = state.duplicates.indexOf(object);
24160    duplicate = duplicateIndex !== -1;
24161  }
24162  if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
24163    compact = false;
24164  }
24165  if (duplicate && state.usedDuplicates[duplicateIndex]) {
24166    state.dump = '*ref_' + duplicateIndex;
24167  } else {
24168    if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
24169      state.usedDuplicates[duplicateIndex] = true;
24170    }
24171    if (type === '[object Object]') {
24172      if (block && (Object.keys(state.dump).length !== 0)) {
24173        writeBlockMapping(state, level, state.dump, compact);
24174        if (duplicate) {
24175          state.dump = '&ref_' + duplicateIndex + state.dump;
24176        }
24177      } else {
24178        writeFlowMapping(state, level, state.dump);
24179        if (duplicate) {
24180          state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
24181        }
24182      }
24183    } else if (type === '[object Array]') {
24184      if (block && (state.dump.length !== 0)) {
24185        if (state.noArrayIndent && !isblockseq && level > 0) {
24186          writeBlockSequence(state, level - 1, state.dump, compact);
24187        } else {
24188          writeBlockSequence(state, level, state.dump, compact);
24189        }
24190        if (duplicate) {
24191          state.dump = '&ref_' + duplicateIndex + state.dump;
24192        }
24193      } else {
24194        writeFlowSequence(state, level, state.dump);
24195        if (duplicate) {
24196          state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
24197        }
24198      }
24199    } else if (type === '[object String]') {
24200      if (state.tag !== '?') {
24201        writeScalar(state, state.dump, level, iskey, inblock);
24202      }
24203    } else if (type === '[object Undefined]') {
24204      return false;
24205    } else {
24206      if (state.skipInvalid) return false;
24207      throw new exception('unacceptable kind of an object to dump ' + type);
24208    }
24209    if (state.tag !== null && state.tag !== '?') {
24210      tagStr = encodeURI(
24211        state.tag[0] === '!' ? state.tag.slice(1) : state.tag
24212      ).replace(/!/g, '%21');
24213      if (state.tag[0] === '!') {
24214        tagStr = '!' + tagStr;
24215      } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {
24216        tagStr = '!!' + tagStr.slice(18);
24217      } else {
24218        tagStr = '!<' + tagStr + '>';
24219      }
24220      state.dump = tagStr + ' ' + state.dump;
24221    }
24222  }
24223  return true;
24224}
24225function getDuplicateReferences(object, state) {
24226  var objects = [],
24227      duplicatesIndexes = [],
24228      index,
24229      length;
24230  inspectNode(object, objects, duplicatesIndexes);
24231  for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
24232    state.duplicates.push(objects[duplicatesIndexes[index]]);
24233  }
24234  state.usedDuplicates = new Array(length);
24235}
24236function inspectNode(object, objects, duplicatesIndexes) {
24237  var objectKeyList,
24238      index,
24239      length;
24240  if (object !== null && typeof object === 'object') {
24241    index = objects.indexOf(object);
24242    if (index !== -1) {
24243      if (duplicatesIndexes.indexOf(index) === -1) {
24244        duplicatesIndexes.push(index);
24245      }
24246    } else {
24247      objects.push(object);
24248      if (Array.isArray(object)) {
24249        for (index = 0, length = object.length; index < length; index += 1) {
24250          inspectNode(object[index], objects, duplicatesIndexes);
24251        }
24252      } else {
24253        objectKeyList = Object.keys(object);
24254        for (index = 0, length = objectKeyList.length; index < length; index += 1) {
24255          inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
24256        }
24257      }
24258    }
24259  }
24260}
24261function dump$1(input, options) {
24262  options = options || {};
24263  var state = new State(options);
24264  if (!state.noRefs) getDuplicateReferences(input, state);
24265  var value = input;
24266  if (state.replacer) {
24267    value = state.replacer.call({ '': value }, '', value);
24268  }
24269  if (writeNode(state, 0, value, true, true)) return state.dump + '\n';
24270  return '';
24271}
24272var dump_1 = dump$1;
24273var dumper = {
24274	dump: dump_1
24275};
24276function renamed(from, to) {
24277  return function () {
24278    throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
24279      'Use yaml.' + to + ' instead, which is now safe by default.');
24280  };
24281}
24282var Type                = type;
24283var Schema              = schema;
24284var FAILSAFE_SCHEMA     = failsafe;
24285var JSON_SCHEMA         = json;
24286var CORE_SCHEMA         = core;
24287var DEFAULT_SCHEMA      = _default;
24288var load                = loader.load;
24289var loadAll             = loader.loadAll;
24290var dump                = dumper.dump;
24291var YAMLException       = exception;
24292var types = {
24293  binary:    binary,
24294  float:     float,
24295  map:       map,
24296  null:      _null,
24297  pairs:     pairs,
24298  set:       set,
24299  timestamp: timestamp,
24300  bool:      bool,
24301  int:       int,
24302  merge:     merge,
24303  omap:      omap,
24304  seq:       seq,
24305  str:       str
24306};
24307var safeLoad            = renamed('safeLoad', 'load');
24308var safeLoadAll         = renamed('safeLoadAll', 'loadAll');
24309var safeDump            = renamed('safeDump', 'dump');
24310var jsYaml = {
24311	Type: Type,
24312	Schema: Schema,
24313	FAILSAFE_SCHEMA: FAILSAFE_SCHEMA,
24314	JSON_SCHEMA: JSON_SCHEMA,
24315	CORE_SCHEMA: CORE_SCHEMA,
24316	DEFAULT_SCHEMA: DEFAULT_SCHEMA,
24317	load: load,
24318	loadAll: loadAll,
24319	dump: dump,
24320	YAMLException: YAMLException,
24321	types: types,
24322	safeLoad: safeLoad,
24323	safeLoadAll: safeLoadAll,
24324	safeDump: safeDump
24325};
24326
24327const debug$1 = (
24328  typeof process === 'object' &&
24329  process.env &&
24330  process.env.NODE_DEBUG &&
24331  /\bsemver\b/i.test(process.env.NODE_DEBUG)
24332) ? (...args) => console.error('SEMVER', ...args)
24333  : () => {};
24334var debug_1 = debug$1;
24335getDefaultExportFromCjs(debug_1);
24336
24337const SEMVER_SPEC_VERSION = '2.0.0';
24338const MAX_LENGTH$1 = 256;
24339const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER ||
24340 9007199254740991;
24341const MAX_SAFE_COMPONENT_LENGTH = 16;
24342const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
24343const RELEASE_TYPES = [
24344  'major',
24345  'premajor',
24346  'minor',
24347  'preminor',
24348  'patch',
24349  'prepatch',
24350  'prerelease',
24351];
24352var constants = {
24353  MAX_LENGTH: MAX_LENGTH$1,
24354  MAX_SAFE_COMPONENT_LENGTH,
24355  MAX_SAFE_BUILD_LENGTH,
24356  MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
24357  RELEASE_TYPES,
24358  SEMVER_SPEC_VERSION,
24359  FLAG_INCLUDE_PRERELEASE: 0b001,
24360  FLAG_LOOSE: 0b010,
24361};
24362getDefaultExportFromCjs(constants);
24363
24364var re$1 = {exports: {}};
24365
24366(function (module, exports) {
24367	const {
24368	  MAX_SAFE_COMPONENT_LENGTH,
24369	  MAX_SAFE_BUILD_LENGTH,
24370	  MAX_LENGTH,
24371	} = constants;
24372	const debug = debug_1;
24373	exports = module.exports = {};
24374	const re = exports.re = [];
24375	const safeRe = exports.safeRe = [];
24376	const src = exports.src = [];
24377	const t = exports.t = {};
24378	let R = 0;
24379	const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
24380	const safeRegexReplacements = [
24381	  ['\\s', 1],
24382	  ['\\d', MAX_LENGTH],
24383	  [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
24384	];
24385	const makeSafeRegex = (value) => {
24386	  for (const [token, max] of safeRegexReplacements) {
24387	    value = value
24388	      .split(`${token}*`).join(`${token}{0,${max}}`)
24389	      .split(`${token}+`).join(`${token}{1,${max}}`);
24390	  }
24391	  return value
24392	};
24393	const createToken = (name, value, isGlobal) => {
24394	  const safe = makeSafeRegex(value);
24395	  const index = R++;
24396	  debug(name, index, value);
24397	  t[name] = index;
24398	  src[index] = value;
24399	  re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
24400	  safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
24401	};
24402	createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
24403	createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
24404	createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
24405	createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
24406	                   `(${src[t.NUMERICIDENTIFIER]})\\.` +
24407	                   `(${src[t.NUMERICIDENTIFIER]})`);
24408	createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
24409	                        `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
24410	                        `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
24411	createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
24412	}|${src[t.NONNUMERICIDENTIFIER]})`);
24413	createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
24414	}|${src[t.NONNUMERICIDENTIFIER]})`);
24415	createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
24416	}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
24417	createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
24418	}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
24419	createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
24420	createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
24421	}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
24422	createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
24423	}${src[t.PRERELEASE]}?${
24424	  src[t.BUILD]}?`);
24425	createToken('FULL', `^${src[t.FULLPLAIN]}$`);
24426	createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
24427	}${src[t.PRERELEASELOOSE]}?${
24428	  src[t.BUILD]}?`);
24429	createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
24430	createToken('GTLT', '((?:<|>)?=?)');
24431	createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
24432	createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
24433	createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
24434	                   `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
24435	                   `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
24436	                   `(?:${src[t.PRERELEASE]})?${
24437	                     src[t.BUILD]}?` +
24438	                   `)?)?`);
24439	createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
24440	                        `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
24441	                        `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
24442	                        `(?:${src[t.PRERELEASELOOSE]})?${
24443	                          src[t.BUILD]}?` +
24444	                        `)?)?`);
24445	createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
24446	createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
24447	createToken('COERCE', `${'(^|[^\\d])' +
24448	              '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
24449	              `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
24450	              `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
24451	              `(?:$|[^\\d])`);
24452	createToken('COERCERTL', src[t.COERCE], true);
24453	createToken('LONETILDE', '(?:~>?)');
24454	createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
24455	exports.tildeTrimReplace = '$1~';
24456	createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
24457	createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
24458	createToken('LONECARET', '(?:\\^)');
24459	createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
24460	exports.caretTrimReplace = '$1^';
24461	createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
24462	createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
24463	createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
24464	createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
24465	createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
24466	}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
24467	exports.comparatorTrimReplace = '$1$2$3';
24468	createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
24469	                   `\\s+-\\s+` +
24470	                   `(${src[t.XRANGEPLAIN]})` +
24471	                   `\\s*$`);
24472	createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
24473	                        `\\s+-\\s+` +
24474	                        `(${src[t.XRANGEPLAINLOOSE]})` +
24475	                        `\\s*$`);
24476	createToken('STAR', '(<|>)?=?\\s*\\*');
24477	createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
24478	createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
24479} (re$1, re$1.exports));
24480var reExports = re$1.exports;
24481getDefaultExportFromCjs(reExports);
24482
24483const looseOption = Object.freeze({ loose: true });
24484const emptyOpts = Object.freeze({ });
24485const parseOptions$1 = options => {
24486  if (!options) {
24487    return emptyOpts
24488  }
24489  if (typeof options !== 'object') {
24490    return looseOption
24491  }
24492  return options
24493};
24494var parseOptions_1 = parseOptions$1;
24495getDefaultExportFromCjs(parseOptions_1);
24496
24497const numeric = /^[0-9]+$/;
24498const compareIdentifiers$1 = (a, b) => {
24499  const anum = numeric.test(a);
24500  const bnum = numeric.test(b);
24501  if (anum && bnum) {
24502    a = +a;
24503    b = +b;
24504  }
24505  return a === b ? 0
24506    : (anum && !bnum) ? -1
24507    : (bnum && !anum) ? 1
24508    : a < b ? -1
24509    : 1
24510};
24511const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
24512var identifiers = {
24513  compareIdentifiers: compareIdentifiers$1,
24514  rcompareIdentifiers,
24515};
24516getDefaultExportFromCjs(identifiers);
24517
24518const debug = debug_1;
24519const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants;
24520const { safeRe: re, t } = reExports;
24521const parseOptions = parseOptions_1;
24522const { compareIdentifiers } = identifiers;
24523let SemVer$2 = class SemVer {
24524  constructor (version, options) {
24525    options = parseOptions(options);
24526    if (version instanceof SemVer) {
24527      if (version.loose === !!options.loose &&
24528          version.includePrerelease === !!options.includePrerelease) {
24529        return version
24530      } else {
24531        version = version.version;
24532      }
24533    } else if (typeof version !== 'string') {
24534      throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
24535    }
24536    if (version.length > MAX_LENGTH) {
24537      throw new TypeError(
24538        `version is longer than ${MAX_LENGTH} characters`
24539      )
24540    }
24541    debug('SemVer', version, options);
24542    this.options = options;
24543    this.loose = !!options.loose;
24544    this.includePrerelease = !!options.includePrerelease;
24545    const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
24546    if (!m) {
24547      throw new TypeError(`Invalid Version: ${version}`)
24548    }
24549    this.raw = version;
24550    this.major = +m[1];
24551    this.minor = +m[2];
24552    this.patch = +m[3];
24553    if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
24554      throw new TypeError('Invalid major version')
24555    }
24556    if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
24557      throw new TypeError('Invalid minor version')
24558    }
24559    if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
24560      throw new TypeError('Invalid patch version')
24561    }
24562    if (!m[4]) {
24563      this.prerelease = [];
24564    } else {
24565      this.prerelease = m[4].split('.').map((id) => {
24566        if (/^[0-9]+$/.test(id)) {
24567          const num = +id;
24568          if (num >= 0 && num < MAX_SAFE_INTEGER) {
24569            return num
24570          }
24571        }
24572        return id
24573      });
24574    }
24575    this.build = m[5] ? m[5].split('.') : [];
24576    this.format();
24577  }
24578  format () {
24579    this.version = `${this.major}.${this.minor}.${this.patch}`;
24580    if (this.prerelease.length) {
24581      this.version += `-${this.prerelease.join('.')}`;
24582    }
24583    return this.version
24584  }
24585  toString () {
24586    return this.version
24587  }
24588  compare (other) {
24589    debug('SemVer.compare', this.version, this.options, other);
24590    if (!(other instanceof SemVer)) {
24591      if (typeof other === 'string' && other === this.version) {
24592        return 0
24593      }
24594      other = new SemVer(other, this.options);
24595    }
24596    if (other.version === this.version) {
24597      return 0
24598    }
24599    return this.compareMain(other) || this.comparePre(other)
24600  }
24601  compareMain (other) {
24602    if (!(other instanceof SemVer)) {
24603      other = new SemVer(other, this.options);
24604    }
24605    return (
24606      compareIdentifiers(this.major, other.major) ||
24607      compareIdentifiers(this.minor, other.minor) ||
24608      compareIdentifiers(this.patch, other.patch)
24609    )
24610  }
24611  comparePre (other) {
24612    if (!(other instanceof SemVer)) {
24613      other = new SemVer(other, this.options);
24614    }
24615    if (this.prerelease.length && !other.prerelease.length) {
24616      return -1
24617    } else if (!this.prerelease.length && other.prerelease.length) {
24618      return 1
24619    } else if (!this.prerelease.length && !other.prerelease.length) {
24620      return 0
24621    }
24622    let i = 0;
24623    do {
24624      const a = this.prerelease[i];
24625      const b = other.prerelease[i];
24626      debug('prerelease compare', i, a, b);
24627      if (a === undefined && b === undefined) {
24628        return 0
24629      } else if (b === undefined) {
24630        return 1
24631      } else if (a === undefined) {
24632        return -1
24633      } else if (a === b) {
24634        continue
24635      } else {
24636        return compareIdentifiers(a, b)
24637      }
24638    } while (++i)
24639  }
24640  compareBuild (other) {
24641    if (!(other instanceof SemVer)) {
24642      other = new SemVer(other, this.options);
24643    }
24644    let i = 0;
24645    do {
24646      const a = this.build[i];
24647      const b = other.build[i];
24648      debug('prerelease compare', i, a, b);
24649      if (a === undefined && b === undefined) {
24650        return 0
24651      } else if (b === undefined) {
24652        return 1
24653      } else if (a === undefined) {
24654        return -1
24655      } else if (a === b) {
24656        continue
24657      } else {
24658        return compareIdentifiers(a, b)
24659      }
24660    } while (++i)
24661  }
24662  inc (release, identifier, identifierBase) {
24663    switch (release) {
24664      case 'premajor':
24665        this.prerelease.length = 0;
24666        this.patch = 0;
24667        this.minor = 0;
24668        this.major++;
24669        this.inc('pre', identifier, identifierBase);
24670        break
24671      case 'preminor':
24672        this.prerelease.length = 0;
24673        this.patch = 0;
24674        this.minor++;
24675        this.inc('pre', identifier, identifierBase);
24676        break
24677      case 'prepatch':
24678        this.prerelease.length = 0;
24679        this.inc('patch', identifier, identifierBase);
24680        this.inc('pre', identifier, identifierBase);
24681        break
24682      case 'prerelease':
24683        if (this.prerelease.length === 0) {
24684          this.inc('patch', identifier, identifierBase);
24685        }
24686        this.inc('pre', identifier, identifierBase);
24687        break
24688      case 'major':
24689        if (
24690          this.minor !== 0 ||
24691          this.patch !== 0 ||
24692          this.prerelease.length === 0
24693        ) {
24694          this.major++;
24695        }
24696        this.minor = 0;
24697        this.patch = 0;
24698        this.prerelease = [];
24699        break
24700      case 'minor':
24701        if (this.patch !== 0 || this.prerelease.length === 0) {
24702          this.minor++;
24703        }
24704        this.patch = 0;
24705        this.prerelease = [];
24706        break
24707      case 'patch':
24708        if (this.prerelease.length === 0) {
24709          this.patch++;
24710        }
24711        this.prerelease = [];
24712        break
24713      case 'pre': {
24714        const base = Number(identifierBase) ? 1 : 0;
24715        if (!identifier && identifierBase === false) {
24716          throw new Error('invalid increment argument: identifier is empty')
24717        }
24718        if (this.prerelease.length === 0) {
24719          this.prerelease = [base];
24720        } else {
24721          let i = this.prerelease.length;
24722          while (--i >= 0) {
24723            if (typeof this.prerelease[i] === 'number') {
24724              this.prerelease[i]++;
24725              i = -2;
24726            }
24727          }
24728          if (i === -1) {
24729            if (identifier === this.prerelease.join('.') && identifierBase === false) {
24730              throw new Error('invalid increment argument: identifier already exists')
24731            }
24732            this.prerelease.push(base);
24733          }
24734        }
24735        if (identifier) {
24736          let prerelease = [identifier, base];
24737          if (identifierBase === false) {
24738            prerelease = [identifier];
24739          }
24740          if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
24741            if (isNaN(this.prerelease[1])) {
24742              this.prerelease = prerelease;
24743            }
24744          } else {
24745            this.prerelease = prerelease;
24746          }
24747        }
24748        break
24749      }
24750      default:
24751        throw new Error(`invalid increment argument: ${release}`)
24752    }
24753    this.raw = this.format();
24754    if (this.build.length) {
24755      this.raw += `+${this.build.join('.')}`;
24756    }
24757    return this
24758  }
24759};
24760var semver = SemVer$2;
24761getDefaultExportFromCjs(semver);
24762
24763const SemVer$1 = semver;
24764const parse = (version, options, throwErrors = false) => {
24765  if (version instanceof SemVer$1) {
24766    return version
24767  }
24768  try {
24769    return new SemVer$1(version, options)
24770  } catch (er) {
24771    if (!throwErrors) {
24772      return null
24773    }
24774    throw er
24775  }
24776};
24777var parse_1 = parse;
24778var semverParse = getDefaultExportFromCjs(parse_1);
24779
24780const SemVer = semver;
24781const compare$1 = (a, b, loose) =>
24782  new SemVer(a, loose).compare(new SemVer(b, loose));
24783var compare_1 = compare$1;
24784getDefaultExportFromCjs(compare_1);
24785
24786const compare = compare_1;
24787const lt = (a, b, loose) => compare(a, b, loose) < 0;
24788var lt_1 = lt;
24789var semverLt = getDefaultExportFromCjs(lt_1);
24790
24791const allowedKeys = [
24792  "added",
24793  "napiVersion",
24794  "deprecated",
24795  "removed",
24796  "changes",
24797];
24798const changesExpectedKeys = ["version", "pr-url", "description"];
24799const VERSION_PLACEHOLDER = "REPLACEME";
24800const MAX_SAFE_SEMVER_VERSION = semverParse(
24801  Array.from({ length: 3 }, () => Number.MAX_SAFE_INTEGER).join("."),
24802);
24803const validVersionNumberRegex = /^v\d+\.\d+\.\d+$/;
24804const prUrlRegex = new RegExp("^https://github.com/nodejs/node/pull/\\d+$");
24805const privatePRUrl = "https://github.com/nodejs-private/node-private/pull/";
24806let releasedVersions;
24807let invalidVersionMessage = "version(s) must respect the pattern `vx.x.x` or";
24808if (process.env.NODE_RELEASED_VERSIONS) {
24809  console.log("Using release list from env...");
24810  releasedVersions = process.env.NODE_RELEASED_VERSIONS.split(",").map(
24811    (v) => `v${v}`,
24812  );
24813  invalidVersionMessage = `version not listed in the changelogs, `;
24814}
24815invalidVersionMessage += `use the placeholder \`${VERSION_PLACEHOLDER}\``;
24816const kContainsIllegalKey = Symbol("illegal key");
24817const kWrongKeyOrder = Symbol("Wrong key order");
24818function unorderedKeys(meta) {
24819  const keys = Object.keys(meta);
24820  let previousKeyIndex = -1;
24821  for (const key of keys) {
24822    const keyIndex = allowedKeys.indexOf(key);
24823    if (keyIndex <= previousKeyIndex) {
24824      return keyIndex === -1 ? kContainsIllegalKey : kWrongKeyOrder;
24825    }
24826    previousKeyIndex = keyIndex;
24827  }
24828}
24829function containsInvalidVersionNumber(version) {
24830  if (Array.isArray(version)) {
24831    return version.some(containsInvalidVersionNumber);
24832  }
24833  if (version === undefined || version === VERSION_PLACEHOLDER) return false;
24834  if (
24835    releasedVersions &&
24836    (version[1] !== "0" || (version[3] !== "0" && version[3] !== "1"))
24837  )
24838    return !releasedVersions.includes(version);
24839  return !validVersionNumberRegex.test(version);
24840}
24841const getValidSemver = (version) =>
24842  version === VERSION_PLACEHOLDER ? MAX_SAFE_SEMVER_VERSION : version;
24843function areVersionsUnordered(versions) {
24844  if (!Array.isArray(versions)) return false;
24845  for (let index = 1; index < versions.length; index++) {
24846    if (
24847      semverLt(
24848        getValidSemver(versions[index - 1]),
24849        getValidSemver(versions[index]),
24850      )
24851    ) {
24852      return true;
24853    }
24854  }
24855}
24856function invalidChangesKeys(change) {
24857  const keys = Object.keys(change);
24858  const { length } = keys;
24859  if (length !== changesExpectedKeys.length) return true;
24860  for (let index = 0; index < length; index++) {
24861    if (keys[index] !== changesExpectedKeys[index]) return true;
24862  }
24863}
24864function validateSecurityChange(file, node, change, index) {
24865  if ("commit" in change) {
24866    if (typeof change.commit !== "string" || isNaN(`0x${change.commit}`)) {
24867      file.message(
24868        `changes[${index}]: Ill-formed security change commit ID`,
24869        node,
24870      );
24871    }
24872    if (Object.keys(change)[1] === "commit") {
24873      change = { ...change };
24874      delete change.commit;
24875    }
24876  }
24877  if (invalidChangesKeys(change)) {
24878    const securityChangeExpectedKeys = [...changesExpectedKeys];
24879    securityChangeExpectedKeys[0] += "[, commit]";
24880    file.message(
24881      `changes[${index}]: Invalid keys. Expected keys are: ` +
24882        securityChangeExpectedKeys.join(", "),
24883      node,
24884    );
24885  }
24886}
24887function validateChanges(file, node, changes) {
24888  if (!Array.isArray(changes))
24889    return file.message("`changes` must be a YAML list", node);
24890  const changesVersions = [];
24891  for (let index = 0; index < changes.length; index++) {
24892    const change = changes[index];
24893    const isAncient =
24894      typeof change.version === "string" && change.version.startsWith("v0.");
24895    const isSecurityChange =
24896      !isAncient &&
24897      typeof change["pr-url"] === "string" &&
24898      change["pr-url"].startsWith(privatePRUrl);
24899    if (isSecurityChange) {
24900      validateSecurityChange(file, node, change, index);
24901    } else if (!isAncient && invalidChangesKeys(change)) {
24902      file.message(
24903        `changes[${index}]: Invalid keys. Expected keys are: ` +
24904          changesExpectedKeys.join(", "),
24905        node,
24906      );
24907    }
24908    if (containsInvalidVersionNumber(change.version)) {
24909      file.message(`changes[${index}]: ${invalidVersionMessage}`, node);
24910    } else if (areVersionsUnordered(change.version)) {
24911      file.message(`changes[${index}]: list of versions is not in order`, node);
24912    }
24913    if (!isAncient && !isSecurityChange && !prUrlRegex.test(change["pr-url"])) {
24914      file.message(
24915        `changes[${index}]: PR-URL does not match the expected pattern`,
24916        node,
24917      );
24918    }
24919    if (typeof change.description !== "string" || !change.description.length) {
24920      file.message(
24921        `changes[${index}]: must contain a non-empty description`,
24922        node,
24923      );
24924    } else if (!change.description.endsWith(".")) {
24925      file.message(
24926        `changes[${index}]: description must end with a period`,
24927        node,
24928      );
24929    }
24930    changesVersions.push(
24931      Array.isArray(change.version) ? change.version[0] : change.version,
24932    );
24933  }
24934  if (areVersionsUnordered(changesVersions)) {
24935    file.message("Items in `changes` list are not in order", node);
24936  }
24937}
24938function validateMeta(node, file, meta) {
24939  switch (unorderedKeys(meta)) {
24940    case kContainsIllegalKey:
24941      file.message(
24942        "YAML dictionary contains illegal keys. Accepted values are: " +
24943          allowedKeys.join(", "),
24944        node,
24945      );
24946      break;
24947    case kWrongKeyOrder:
24948      file.message(
24949        "YAML dictionary keys should be in this order: " +
24950          allowedKeys.join(", "),
24951        node,
24952      );
24953      break;
24954  }
24955  if (containsInvalidVersionNumber(meta.added)) {
24956    file.message(`Invalid \`added\` value: ${invalidVersionMessage}`, node);
24957  } else if (areVersionsUnordered(meta.added)) {
24958    file.message("Versions in `added` list are not in order", node);
24959  }
24960  if (containsInvalidVersionNumber(meta.deprecated)) {
24961    file.message(
24962      `Invalid \`deprecated\` value: ${invalidVersionMessage}`,
24963      node,
24964    );
24965  } else if (areVersionsUnordered(meta.deprecated)) {
24966    file.message("Versions in `deprecated` list are not in order", node);
24967  }
24968  if (containsInvalidVersionNumber(meta.removed)) {
24969    file.message(`Invalid \`removed\` value: ${invalidVersionMessage}`, node);
24970  } else if (areVersionsUnordered(meta.removed)) {
24971    file.message("Versions in `removed` list are not in order", node);
24972  }
24973  if ("changes" in meta) {
24974    validateChanges(file, node, meta.changes);
24975  }
24976}
24977function validateYAMLComments(tree, file) {
24978  visit$A(tree, "html", function visitor(node) {
24979    if (node.value.startsWith("<!--YAML\n"))
24980      file.message(
24981        "Expected `<!-- YAML`, found `<!--YAML`. Please add a space",
24982        node,
24983      );
24984    if (!node.value.startsWith("<!-- YAML\n")) return;
24985    try {
24986      const meta = jsYaml.load("#" + node.value.slice(0, -"-->".length));
24987      validateMeta(node, file, meta);
24988    } catch (e) {
24989      file.message(e, node);
24990    }
24991  });
24992}
24993const remarkLintNodejsYamlComments = lintRule(
24994  "remark-lint:nodejs-yaml-comments",
24995  validateYAMLComments,
24996);
24997
24998const convert$5 =
24999  (
25000    function (test) {
25001      if (test === undefined || test === null) {
25002        return ok$5
25003      }
25004      if (typeof test === 'string') {
25005        return typeFactory$5(test)
25006      }
25007      if (typeof test === 'object') {
25008        return Array.isArray(test) ? anyFactory$5(test) : propsFactory$5(test)
25009      }
25010      if (typeof test === 'function') {
25011        return castFactory$5(test)
25012      }
25013      throw new Error('Expected function, string, or object as test')
25014    }
25015  );
25016function anyFactory$5(tests) {
25017  const checks = [];
25018  let index = -1;
25019  while (++index < tests.length) {
25020    checks[index] = convert$5(tests[index]);
25021  }
25022  return castFactory$5(any)
25023  function any(...parameters) {
25024    let index = -1;
25025    while (++index < checks.length) {
25026      if (checks[index].call(this, ...parameters)) return true
25027    }
25028    return false
25029  }
25030}
25031function propsFactory$5(check) {
25032  return castFactory$5(all)
25033  function all(node) {
25034    let key;
25035    for (key in check) {
25036      if (node[key] !== check[key]) return false
25037    }
25038    return true
25039  }
25040}
25041function typeFactory$5(check) {
25042  return castFactory$5(type)
25043  function type(node) {
25044    return node && node.type === check
25045  }
25046}
25047function castFactory$5(check) {
25048  return assertion
25049  function assertion(node, ...parameters) {
25050    return Boolean(
25051      node &&
25052        typeof node === 'object' &&
25053        'type' in node &&
25054        Boolean(check.call(this, node, ...parameters))
25055    )
25056  }
25057}
25058function ok$5() {
25059  return true
25060}
25061
25062function color$6(d) {
25063  return '\u001B[33m' + d + '\u001B[39m'
25064}
25065
25066const CONTINUE$5 = true;
25067const EXIT$5 = false;
25068const SKIP$5 = 'skip';
25069const visitParents$5 =
25070  (
25071    function (tree, test, visitor, reverse) {
25072      if (typeof test === 'function' && typeof visitor !== 'function') {
25073        reverse = visitor;
25074        visitor = test;
25075        test = null;
25076      }
25077      const is = convert$5(test);
25078      const step = reverse ? -1 : 1;
25079      factory(tree, undefined, [])();
25080      function factory(node, index, parents) {
25081        const value = node && typeof node === 'object' ? node : {};
25082        if (typeof value.type === 'string') {
25083          const name =
25084            typeof value.tagName === 'string'
25085              ? value.tagName
25086              :
25087              typeof value.name === 'string'
25088              ? value.name
25089              : undefined;
25090          Object.defineProperty(visit, 'name', {
25091            value:
25092              'node (' + color$6(node.type + (name ? '<' + name + '>' : '')) + ')'
25093          });
25094        }
25095        return visit
25096        function visit() {
25097          let result = [];
25098          let subresult;
25099          let offset;
25100          let grandparents;
25101          if (!test || is(node, index, parents[parents.length - 1] || null)) {
25102            result = toResult$5(visitor(node, parents));
25103            if (result[0] === EXIT$5) {
25104              return result
25105            }
25106          }
25107          if (node.children && result[0] !== SKIP$5) {
25108            offset = (reverse ? node.children.length : -1) + step;
25109            grandparents = parents.concat(node);
25110            while (offset > -1 && offset < node.children.length) {
25111              subresult = factory(node.children[offset], offset, grandparents)();
25112              if (subresult[0] === EXIT$5) {
25113                return subresult
25114              }
25115              offset =
25116                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
25117            }
25118          }
25119          return result
25120        }
25121      }
25122    }
25123  );
25124function toResult$5(value) {
25125  if (Array.isArray(value)) {
25126    return value
25127  }
25128  if (typeof value === 'number') {
25129    return [CONTINUE$5, value]
25130  }
25131  return [value]
25132}
25133
25134const visit$5 =
25135  (
25136    function (tree, test, visitor, reverse) {
25137      if (typeof test === 'function' && typeof visitor !== 'function') {
25138        reverse = visitor;
25139        visitor = test;
25140        test = null;
25141      }
25142      visitParents$5(tree, test, overload, reverse);
25143      function overload(node, parents) {
25144        const parent = parents[parents.length - 1];
25145        return visitor(
25146          node,
25147          parent ? parent.children.indexOf(node) : null,
25148          parent
25149        )
25150      }
25151    }
25152  );
25153
25154const remarkLintProhibitedStrings = lintRule('remark-lint:prohibited-strings', prohibitedStrings);
25155function testProhibited (val, content) {
25156  let regexpFlags = 'g';
25157  let no = val.no;
25158  if (!no) {
25159    no = escapeStringRegexp(val.yes);
25160    regexpFlags += 'i';
25161  }
25162  let regexpString = '(?<!\\.|@[a-zA-Z0-9/-]*)';
25163  let ignoreNextTo;
25164  if (val.ignoreNextTo) {
25165    if (Array.isArray(val.ignoreNextTo)) {
25166      const parts = val.ignoreNextTo.map(a => escapeStringRegexp(a)).join('|');
25167      ignoreNextTo = `(?:${parts})`;
25168    } else {
25169      ignoreNextTo = escapeStringRegexp(val.ignoreNextTo);
25170    }
25171  } else {
25172    ignoreNextTo = '';
25173  }
25174  const replaceCaptureGroups = !!val.replaceCaptureGroups;
25175  if (/^\b/.test(no)) {
25176    regexpString += '\\b';
25177  }
25178  if (ignoreNextTo) {
25179    regexpString += `(?<!${ignoreNextTo})`;
25180  }
25181  regexpString += `(${no})`;
25182  if (ignoreNextTo) {
25183    regexpString += `(?!${ignoreNextTo})`;
25184  }
25185  if (/\b$/.test(no)) {
25186    regexpString += '\\b';
25187  }
25188  regexpString += '(?!\\.\\w)';
25189  const re = new RegExp(regexpString, regexpFlags);
25190  const results = [];
25191  let result = re.exec(content);
25192  while (result) {
25193    if (result[1] !== val.yes) {
25194      let yes = val.yes;
25195      if (replaceCaptureGroups) {
25196        yes = result[1].replace(new RegExp(no), yes);
25197      }
25198      results.push({ result: result[1], index: result.index, yes: yes });
25199    }
25200    result = re.exec(content);
25201  }
25202  return results
25203}
25204function prohibitedStrings (ast, file, strings) {
25205  const myLocation = location(file);
25206  visit$5(ast, 'text', checkText);
25207  function checkText (node) {
25208    const content = node.value;
25209    const initial = pointStart(node).offset;
25210    strings.forEach((val) => {
25211      const results = testProhibited(val, content);
25212      if (results.length) {
25213        results.forEach(({ result, index, yes }) => {
25214          const message = val.yes ? `Use "${yes}" instead of "${result}"` : `Do not use "${result}"`;
25215          file.message(message, {
25216            start: myLocation.toPoint(initial + index),
25217            end: myLocation.toPoint(initial + index + [...result].length)
25218          });
25219        });
25220      }
25221    });
25222  }
25223}
25224
25225const convert$4 =
25226  (
25227    function (test) {
25228      if (test === undefined || test === null) {
25229        return ok$4
25230      }
25231      if (typeof test === 'string') {
25232        return typeFactory$4(test)
25233      }
25234      if (typeof test === 'object') {
25235        return Array.isArray(test) ? anyFactory$4(test) : propsFactory$4(test)
25236      }
25237      if (typeof test === 'function') {
25238        return castFactory$4(test)
25239      }
25240      throw new Error('Expected function, string, or object as test')
25241    }
25242  );
25243function anyFactory$4(tests) {
25244  const checks = [];
25245  let index = -1;
25246  while (++index < tests.length) {
25247    checks[index] = convert$4(tests[index]);
25248  }
25249  return castFactory$4(any)
25250  function any(...parameters) {
25251    let index = -1;
25252    while (++index < checks.length) {
25253      if (checks[index].call(this, ...parameters)) return true
25254    }
25255    return false
25256  }
25257}
25258function propsFactory$4(check) {
25259  return castFactory$4(all)
25260  function all(node) {
25261    let key;
25262    for (key in check) {
25263      if (node[key] !== check[key]) return false
25264    }
25265    return true
25266  }
25267}
25268function typeFactory$4(check) {
25269  return castFactory$4(type)
25270  function type(node) {
25271    return node && node.type === check
25272  }
25273}
25274function castFactory$4(check) {
25275  return assertion
25276  function assertion(node, ...parameters) {
25277    return Boolean(
25278      node &&
25279        typeof node === 'object' &&
25280        'type' in node &&
25281        Boolean(check.call(this, node, ...parameters))
25282    )
25283  }
25284}
25285function ok$4() {
25286  return true
25287}
25288
25289function color$5(d) {
25290  return '\u001B[33m' + d + '\u001B[39m'
25291}
25292
25293const CONTINUE$4 = true;
25294const EXIT$4 = false;
25295const SKIP$4 = 'skip';
25296const visitParents$4 =
25297  (
25298    function (tree, test, visitor, reverse) {
25299      if (typeof test === 'function' && typeof visitor !== 'function') {
25300        reverse = visitor;
25301        visitor = test;
25302        test = null;
25303      }
25304      const is = convert$4(test);
25305      const step = reverse ? -1 : 1;
25306      factory(tree, undefined, [])();
25307      function factory(node, index, parents) {
25308        const value = node && typeof node === 'object' ? node : {};
25309        if (typeof value.type === 'string') {
25310          const name =
25311            typeof value.tagName === 'string'
25312              ? value.tagName
25313              :
25314              typeof value.name === 'string'
25315              ? value.name
25316              : undefined;
25317          Object.defineProperty(visit, 'name', {
25318            value:
25319              'node (' + color$5(node.type + (name ? '<' + name + '>' : '')) + ')'
25320          });
25321        }
25322        return visit
25323        function visit() {
25324          let result = [];
25325          let subresult;
25326          let offset;
25327          let grandparents;
25328          if (!test || is(node, index, parents[parents.length - 1] || null)) {
25329            result = toResult$4(visitor(node, parents));
25330            if (result[0] === EXIT$4) {
25331              return result
25332            }
25333          }
25334          if (node.children && result[0] !== SKIP$4) {
25335            offset = (reverse ? node.children.length : -1) + step;
25336            grandparents = parents.concat(node);
25337            while (offset > -1 && offset < node.children.length) {
25338              subresult = factory(node.children[offset], offset, grandparents)();
25339              if (subresult[0] === EXIT$4) {
25340                return subresult
25341              }
25342              offset =
25343                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
25344            }
25345          }
25346          return result
25347        }
25348      }
25349    }
25350  );
25351function toResult$4(value) {
25352  if (Array.isArray(value)) {
25353    return value
25354  }
25355  if (typeof value === 'number') {
25356    return [CONTINUE$4, value]
25357  }
25358  return [value]
25359}
25360
25361const visit$4 =
25362  (
25363    function (tree, test, visitor, reverse) {
25364      if (typeof test === 'function' && typeof visitor !== 'function') {
25365        reverse = visitor;
25366        visitor = test;
25367        test = null;
25368      }
25369      visitParents$4(tree, test, overload, reverse);
25370      function overload(node, parents) {
25371        const parent = parents[parents.length - 1];
25372        return visitor(
25373          node,
25374          parent ? parent.children.indexOf(node) : null,
25375          parent
25376        )
25377      }
25378    }
25379  );
25380
25381/**
25382 * ## When should I use this?
25383 *
25384 * You can use this package to check that rules (thematic breaks, horizontal
25385 * rules) are consistent.
25386 *
25387 * ## API
25388 *
25389 * The following options (default: `'consistent'`) are accepted:
25390 *
25391 * *   `string` (example: `'** * **'`, `'___'`)
25392 *     — thematic break to prefer
25393 * *   `'consistent'`
25394 *     — detect the first used style and warn when further rules differ
25395 *
25396 * ## Recommendation
25397 *
25398 * Rules consist of a `*`, `-`, or `_` character, which occurs at least three
25399 * times with nothing else except for arbitrary spaces or tabs on a single line.
25400 * Using spaces, tabs, and more than three markers seems unnecessary work to
25401 * type out.
25402 * Because asterisks can be used as a marker for more markdown constructs,
25403 * it’s recommended to use that for rules (and lists, emphasis, strong) too.
25404 * Due to this, it’s recommended to pass `'***'`.
25405 *
25406 * ## Fix
25407 *
25408 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
25409 * formats rules with `***` by default.
25410 * There are three settings to control rules:
25411 *
25412 * *   [`rule`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsrule)
25413 *     (default: `'*'`) — marker
25414 * *   [`ruleRepetition`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsrulerepetition)
25415 *     (default: `3`) — repetitions
25416 * *   [`ruleSpaces`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsrulespaces)
25417 *     (default: `false`) — use spaces between markers
25418 *
25419 * @module rule-style
25420 * @summary
25421 *   remark-lint rule to warn when rule markers are inconsistent.
25422 * @author Titus Wormer
25423 * @copyright 2015 Titus Wormer
25424 * @license MIT
25425 * @example
25426 *   {"name": "ok.md", "config": "* * *"}
25427 *
25428 *   * * *
25429 *
25430 *   * * *
25431 *
25432 * @example
25433 *   {"name": "ok.md", "config": "_______"}
25434 *
25435 *   _______
25436 *
25437 *   _______
25438 *
25439 * @example
25440 *   {"name": "not-ok.md", "label": "input"}
25441 *
25442 *   ***
25443 *
25444 *   * * *
25445 *
25446 * @example
25447 *   {"name": "not-ok.md", "label": "output"}
25448 *
25449 *   3:1-3:6: Rules should use `***`
25450 *
25451 * @example
25452 *   {"name": "not-ok.md", "label": "output", "config": "�", "positionless": true}
25453 *
25454 *   1:1: Incorrect preferred rule style: provide a correct markdown rule or `'consistent'`
25455 */
25456const remarkLintRuleStyle = lintRule(
25457  {
25458    origin: 'remark-lint:rule-style',
25459    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-rule-style#readme'
25460  },
25461  (tree, file, option = 'consistent') => {
25462    const value = String(file);
25463    if (option !== 'consistent' && /[^-_* ]/.test(option)) {
25464      file.fail(
25465        "Incorrect preferred rule style: provide a correct markdown rule or `'consistent'`"
25466      );
25467    }
25468    visit$4(tree, 'thematicBreak', (node) => {
25469      const initial = pointStart(node).offset;
25470      const final = pointEnd(node).offset;
25471      if (typeof initial === 'number' && typeof final === 'number') {
25472        const rule = value.slice(initial, final);
25473        if (option === 'consistent') {
25474          option = rule;
25475        } else if (rule !== option) {
25476          file.message('Rules should use `' + option + '`', node);
25477        }
25478      }
25479    });
25480  }
25481);
25482var remarkLintRuleStyle$1 = remarkLintRuleStyle;
25483
25484const convert$3 =
25485  (
25486    function (test) {
25487      if (test === undefined || test === null) {
25488        return ok$3
25489      }
25490      if (typeof test === 'string') {
25491        return typeFactory$3(test)
25492      }
25493      if (typeof test === 'object') {
25494        return Array.isArray(test) ? anyFactory$3(test) : propsFactory$3(test)
25495      }
25496      if (typeof test === 'function') {
25497        return castFactory$3(test)
25498      }
25499      throw new Error('Expected function, string, or object as test')
25500    }
25501  );
25502function anyFactory$3(tests) {
25503  const checks = [];
25504  let index = -1;
25505  while (++index < tests.length) {
25506    checks[index] = convert$3(tests[index]);
25507  }
25508  return castFactory$3(any)
25509  function any(...parameters) {
25510    let index = -1;
25511    while (++index < checks.length) {
25512      if (checks[index].call(this, ...parameters)) return true
25513    }
25514    return false
25515  }
25516}
25517function propsFactory$3(check) {
25518  return castFactory$3(all)
25519  function all(node) {
25520    let key;
25521    for (key in check) {
25522      if (node[key] !== check[key]) return false
25523    }
25524    return true
25525  }
25526}
25527function typeFactory$3(check) {
25528  return castFactory$3(type)
25529  function type(node) {
25530    return node && node.type === check
25531  }
25532}
25533function castFactory$3(check) {
25534  return assertion
25535  function assertion(node, ...parameters) {
25536    return Boolean(
25537      node &&
25538        typeof node === 'object' &&
25539        'type' in node &&
25540        Boolean(check.call(this, node, ...parameters))
25541    )
25542  }
25543}
25544function ok$3() {
25545  return true
25546}
25547
25548function color$4(d) {
25549  return '\u001B[33m' + d + '\u001B[39m'
25550}
25551
25552const CONTINUE$3 = true;
25553const EXIT$3 = false;
25554const SKIP$3 = 'skip';
25555const visitParents$3 =
25556  (
25557    function (tree, test, visitor, reverse) {
25558      if (typeof test === 'function' && typeof visitor !== 'function') {
25559        reverse = visitor;
25560        visitor = test;
25561        test = null;
25562      }
25563      const is = convert$3(test);
25564      const step = reverse ? -1 : 1;
25565      factory(tree, undefined, [])();
25566      function factory(node, index, parents) {
25567        const value = node && typeof node === 'object' ? node : {};
25568        if (typeof value.type === 'string') {
25569          const name =
25570            typeof value.tagName === 'string'
25571              ? value.tagName
25572              :
25573              typeof value.name === 'string'
25574              ? value.name
25575              : undefined;
25576          Object.defineProperty(visit, 'name', {
25577            value:
25578              'node (' + color$4(node.type + (name ? '<' + name + '>' : '')) + ')'
25579          });
25580        }
25581        return visit
25582        function visit() {
25583          let result = [];
25584          let subresult;
25585          let offset;
25586          let grandparents;
25587          if (!test || is(node, index, parents[parents.length - 1] || null)) {
25588            result = toResult$3(visitor(node, parents));
25589            if (result[0] === EXIT$3) {
25590              return result
25591            }
25592          }
25593          if (node.children && result[0] !== SKIP$3) {
25594            offset = (reverse ? node.children.length : -1) + step;
25595            grandparents = parents.concat(node);
25596            while (offset > -1 && offset < node.children.length) {
25597              subresult = factory(node.children[offset], offset, grandparents)();
25598              if (subresult[0] === EXIT$3) {
25599                return subresult
25600              }
25601              offset =
25602                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
25603            }
25604          }
25605          return result
25606        }
25607      }
25608    }
25609  );
25610function toResult$3(value) {
25611  if (Array.isArray(value)) {
25612    return value
25613  }
25614  if (typeof value === 'number') {
25615    return [CONTINUE$3, value]
25616  }
25617  return [value]
25618}
25619
25620const visit$3 =
25621  (
25622    function (tree, test, visitor, reverse) {
25623      if (typeof test === 'function' && typeof visitor !== 'function') {
25624        reverse = visitor;
25625        visitor = test;
25626        test = null;
25627      }
25628      visitParents$3(tree, test, overload, reverse);
25629      function overload(node, parents) {
25630        const parent = parents[parents.length - 1];
25631        return visitor(
25632          node,
25633          parent ? parent.children.indexOf(node) : null,
25634          parent
25635        )
25636      }
25637    }
25638  );
25639
25640/**
25641 * ## When should I use this?
25642 *
25643 * You can use this package to check that strong markers are consistent.
25644 *
25645 * ## API
25646 *
25647 * The following options (default: `'consistent'`) are accepted:
25648 *
25649 * *   `'*'`
25650 *     — prefer asterisks
25651 * *   `'_'`
25652 *     — prefer underscores
25653 * *   `'consistent'`
25654 *     — detect the first used style and warn when further strong differs
25655 *
25656 * ## Recommendation
25657 *
25658 * Underscores and asterisks work slightly different: asterisks can form strong
25659 * in more cases than underscores.
25660 * Because underscores are sometimes used to represent normal underscores inside
25661 * words, there are extra rules supporting that.
25662 * Asterisks can also be used as the marker of more constructs than underscores:
25663 * lists.
25664 * Due to having simpler parsing rules, looking more like syntax, and that they
25665 * can be used for more constructs, it’s recommended to prefer asterisks.
25666 *
25667 * ## Fix
25668 *
25669 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
25670 * formats strong with asterisks by default.
25671 * Pass
25672 * [`strong: '_'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsstrong)
25673 * to always use underscores.
25674 *
25675 * @module strong-marker
25676 * @summary
25677 *   remark-lint rule to warn when strong markers are inconsistent.
25678 * @author Titus Wormer
25679 * @copyright 2015 Titus Wormer
25680 * @license MIT
25681 * @example
25682 *   {"name": "ok.md"}
25683 *
25684 *   **foo** and **bar**.
25685 *
25686 * @example
25687 *   {"name": "also-ok.md"}
25688 *
25689 *   __foo__ and __bar__.
25690 *
25691 * @example
25692 *   {"name": "ok.md", "config": "*"}
25693 *
25694 *   **foo**.
25695 *
25696 * @example
25697 *   {"name": "ok.md", "config": "_"}
25698 *
25699 *   __foo__.
25700 *
25701 * @example
25702 *   {"name": "not-ok.md", "label": "input"}
25703 *
25704 *   **foo** and __bar__.
25705 *
25706 * @example
25707 *   {"name": "not-ok.md", "label": "output"}
25708 *
25709 *   1:13-1:20: Strong should use `*` as a marker
25710 *
25711 * @example
25712 *   {"name": "not-ok.md", "label": "output", "config": "�", "positionless": true}
25713 *
25714 *   1:1: Incorrect strong marker `�`: use either `'consistent'`, `'*'`, or `'_'`
25715 */
25716const remarkLintStrongMarker = lintRule(
25717  {
25718    origin: 'remark-lint:strong-marker',
25719    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-strong-marker#readme'
25720  },
25721  (tree, file, option = 'consistent') => {
25722    const value = String(file);
25723    if (option !== '*' && option !== '_' && option !== 'consistent') {
25724      file.fail(
25725        'Incorrect strong marker `' +
25726          option +
25727          "`: use either `'consistent'`, `'*'`, or `'_'`"
25728      );
25729    }
25730    visit$3(tree, 'strong', (node) => {
25731      const start = pointStart(node).offset;
25732      if (typeof start === 'number') {
25733        const marker =  (value.charAt(start));
25734        if (option === 'consistent') {
25735          option = marker;
25736        } else if (marker !== option) {
25737          file.message('Strong should use `' + option + '` as a marker', node);
25738        }
25739      }
25740    });
25741  }
25742);
25743var remarkLintStrongMarker$1 = remarkLintStrongMarker;
25744
25745const convert$2 =
25746  (
25747    function (test) {
25748      if (test === undefined || test === null) {
25749        return ok$2
25750      }
25751      if (typeof test === 'string') {
25752        return typeFactory$2(test)
25753      }
25754      if (typeof test === 'object') {
25755        return Array.isArray(test) ? anyFactory$2(test) : propsFactory$2(test)
25756      }
25757      if (typeof test === 'function') {
25758        return castFactory$2(test)
25759      }
25760      throw new Error('Expected function, string, or object as test')
25761    }
25762  );
25763function anyFactory$2(tests) {
25764  const checks = [];
25765  let index = -1;
25766  while (++index < tests.length) {
25767    checks[index] = convert$2(tests[index]);
25768  }
25769  return castFactory$2(any)
25770  function any(...parameters) {
25771    let index = -1;
25772    while (++index < checks.length) {
25773      if (checks[index].call(this, ...parameters)) return true
25774    }
25775    return false
25776  }
25777}
25778function propsFactory$2(check) {
25779  return castFactory$2(all)
25780  function all(node) {
25781    let key;
25782    for (key in check) {
25783      if (node[key] !== check[key]) return false
25784    }
25785    return true
25786  }
25787}
25788function typeFactory$2(check) {
25789  return castFactory$2(type)
25790  function type(node) {
25791    return node && node.type === check
25792  }
25793}
25794function castFactory$2(check) {
25795  return assertion
25796  function assertion(node, ...parameters) {
25797    return Boolean(
25798      node &&
25799        typeof node === 'object' &&
25800        'type' in node &&
25801        Boolean(check.call(this, node, ...parameters))
25802    )
25803  }
25804}
25805function ok$2() {
25806  return true
25807}
25808
25809function color$3(d) {
25810  return '\u001B[33m' + d + '\u001B[39m'
25811}
25812
25813const CONTINUE$2 = true;
25814const EXIT$2 = false;
25815const SKIP$2 = 'skip';
25816const visitParents$2 =
25817  (
25818    function (tree, test, visitor, reverse) {
25819      if (typeof test === 'function' && typeof visitor !== 'function') {
25820        reverse = visitor;
25821        visitor = test;
25822        test = null;
25823      }
25824      const is = convert$2(test);
25825      const step = reverse ? -1 : 1;
25826      factory(tree, undefined, [])();
25827      function factory(node, index, parents) {
25828        const value = node && typeof node === 'object' ? node : {};
25829        if (typeof value.type === 'string') {
25830          const name =
25831            typeof value.tagName === 'string'
25832              ? value.tagName
25833              :
25834              typeof value.name === 'string'
25835              ? value.name
25836              : undefined;
25837          Object.defineProperty(visit, 'name', {
25838            value:
25839              'node (' + color$3(node.type + (name ? '<' + name + '>' : '')) + ')'
25840          });
25841        }
25842        return visit
25843        function visit() {
25844          let result = [];
25845          let subresult;
25846          let offset;
25847          let grandparents;
25848          if (!test || is(node, index, parents[parents.length - 1] || null)) {
25849            result = toResult$2(visitor(node, parents));
25850            if (result[0] === EXIT$2) {
25851              return result
25852            }
25853          }
25854          if (node.children && result[0] !== SKIP$2) {
25855            offset = (reverse ? node.children.length : -1) + step;
25856            grandparents = parents.concat(node);
25857            while (offset > -1 && offset < node.children.length) {
25858              subresult = factory(node.children[offset], offset, grandparents)();
25859              if (subresult[0] === EXIT$2) {
25860                return subresult
25861              }
25862              offset =
25863                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
25864            }
25865          }
25866          return result
25867        }
25868      }
25869    }
25870  );
25871function toResult$2(value) {
25872  if (Array.isArray(value)) {
25873    return value
25874  }
25875  if (typeof value === 'number') {
25876    return [CONTINUE$2, value]
25877  }
25878  return [value]
25879}
25880
25881const visit$2 =
25882  (
25883    function (tree, test, visitor, reverse) {
25884      if (typeof test === 'function' && typeof visitor !== 'function') {
25885        reverse = visitor;
25886        visitor = test;
25887        test = null;
25888      }
25889      visitParents$2(tree, test, overload, reverse);
25890      function overload(node, parents) {
25891        const parent = parents[parents.length - 1];
25892        return visitor(
25893          node,
25894          parent ? parent.children.indexOf(node) : null,
25895          parent
25896        )
25897      }
25898    }
25899  );
25900
25901/**
25902 * ## When should I use this?
25903 *
25904 * You can use this package to check that table cells are padded consistently.
25905 * Tables are a GFM feature enabled with
25906 * [`remark-gfm`](https://github.com/remarkjs/remark-gfm).
25907 *
25908 * ## API
25909 *
25910 * The following options (default: `'consistent'`) are accepted:
25911 *
25912 * *   `'padded'`
25913 *     — prefer at least one space between pipes and content
25914 * *   `'compact'`
25915 *     — prefer zero spaces between pipes and content
25916 * *   `'consistent'`
25917 *     — detect the first used style and warn when further tables differ
25918 *
25919 * ## Recommendation
25920 *
25921 * It’s recommended to use at least one space between pipes and content for
25922 * legibility of the markup (`'padded'`).
25923 *
25924 * ## Fix
25925 *
25926 * [`remark-gfm`](https://github.com/remarkjs/remark-gfm)
25927 * formats all table cells as padded by default.
25928 * Pass
25929 * [`tableCellPadding: false`](https://github.com/remarkjs/remark-gfm#optionstablecellpadding)
25930 * to use a more compact style.
25931 *
25932 * @module table-cell-padding
25933 * @summary
25934 *   remark-lint rule to warn when table cells are inconsistently padded.
25935 * @author Titus Wormer
25936 * @copyright 2015 Titus Wormer
25937 * @license MIT
25938 * @example
25939 *   {"name": "ok.md", "config": "padded", "gfm": true}
25940 *
25941 *   | A     | B     |
25942 *   | ----- | ----- |
25943 *   | Alpha | Bravo |
25944 *
25945 * @example
25946 *   {"name": "not-ok.md", "label": "input", "config": "padded", "gfm": true}
25947 *
25948 *   | A    |    B |
25949 *   | :----|----: |
25950 *   | Alpha|Bravo |
25951 *
25952 *   | C      |    D |
25953 *   | :----- | ---: |
25954 *   |Charlie | Delta|
25955 *
25956 *   Too much padding isn’t good either:
25957 *
25958 *   | E     | F        |   G    |      H |
25959 *   | :---- | -------- | :----: | -----: |
25960 *   | Echo  | Foxtrot  |  Golf  |  Hotel |
25961 *
25962 * @example
25963 *   {"name": "not-ok.md", "label": "output", "config": "padded", "gfm": true}
25964 *
25965 *   3:8: Cell should be padded
25966 *   3:9: Cell should be padded
25967 *   7:2: Cell should be padded
25968 *   7:17: Cell should be padded
25969 *   13:7: Cell should be padded with 1 space, not 2
25970 *   13:18: Cell should be padded with 1 space, not 2
25971 *   13:23: Cell should be padded with 1 space, not 2
25972 *   13:27: Cell should be padded with 1 space, not 2
25973 *   13:32: Cell should be padded with 1 space, not 2
25974 *
25975 * @example
25976 *   {"name": "ok.md", "config": "compact", "gfm": true}
25977 *
25978 *   |A    |B    |
25979 *   |-----|-----|
25980 *   |Alpha|Bravo|
25981 *
25982 * @example
25983 *   {"name": "not-ok.md", "label": "input", "config": "compact", "gfm": true}
25984 *
25985 *   |   A    | B    |
25986 *   |   -----| -----|
25987 *   |   Alpha| Bravo|
25988 *
25989 *   |C      |     D|
25990 *   |:------|-----:|
25991 *   |Charlie|Delta |
25992 *
25993 * @example
25994 *   {"name": "not-ok.md", "label": "output", "config": "compact", "gfm": true}
25995 *
25996 *   3:5: Cell should be compact
25997 *   3:12: Cell should be compact
25998 *   7:15: Cell should be compact
25999 *
26000 * @example
26001 *   {"name": "ok-padded.md", "config": "consistent", "gfm": true}
26002 *
26003 *   | A     | B     |
26004 *   | ----- | ----- |
26005 *   | Alpha | Bravo |
26006 *
26007 *   | C       | D     |
26008 *   | ------- | ----- |
26009 *   | Charlie | Delta |
26010 *
26011 * @example
26012 *   {"name": "not-ok-padded.md", "label": "input", "config": "consistent", "gfm": true}
26013 *
26014 *   | A     | B     |
26015 *   | ----- | ----- |
26016 *   | Alpha | Bravo |
26017 *
26018 *   | C      |     D |
26019 *   | :----- | ----: |
26020 *   |Charlie | Delta |
26021 *
26022 * @example
26023 *   {"name": "not-ok-padded.md", "label": "output", "config": "consistent", "gfm": true}
26024 *
26025 *   7:2: Cell should be padded
26026 *
26027 * @example
26028 *   {"name": "ok-compact.md", "config": "consistent", "gfm": true}
26029 *
26030 *   |A    |B    |
26031 *   |-----|-----|
26032 *   |Alpha|Bravo|
26033 *
26034 *   |C      |D    |
26035 *   |-------|-----|
26036 *   |Charlie|Delta|
26037 *
26038 * @example
26039 *   {"name": "not-ok-compact.md", "label": "input", "config": "consistent", "gfm": true}
26040 *
26041 *   |A    |B    |
26042 *   |-----|-----|
26043 *   |Alpha|Bravo|
26044 *
26045 *   |C      |     D|
26046 *   |:------|-----:|
26047 *   |Charlie|Delta |
26048 *
26049 * @example
26050 *   {"name": "not-ok-compact.md", "label": "output", "config": "consistent", "gfm": true}
26051 *
26052 *   7:15: Cell should be compact
26053 *
26054 * @example
26055 *   {"name": "not-ok.md", "label": "output", "config": "�", "positionless": true, "gfm": true}
26056 *
26057 *   1:1: Incorrect table cell padding style `�`, expected `'padded'`, `'compact'`, or `'consistent'`
26058 *
26059 * @example
26060 *   {"name": "empty.md", "label": "input", "config": "padded", "gfm": true}
26061 *
26062 *   <!-- Empty cells are OK, but those surrounding them may not be. -->
26063 *
26064 *   |        | Alpha | Bravo|
26065 *   | ------ | ----- | ---: |
26066 *   | Charlie|       |  Echo|
26067 *
26068 * @example
26069 *   {"name": "empty.md", "label": "output", "config": "padded", "gfm": true}
26070 *
26071 *   3:25: Cell should be padded
26072 *   5:10: Cell should be padded
26073 *   5:25: Cell should be padded
26074 *
26075 * @example
26076 *   {"name": "missing-body.md", "config": "padded", "gfm": true}
26077 *
26078 *   <!-- Missing cells are fine as well. -->
26079 *
26080 *   | Alpha | Bravo   | Charlie |
26081 *   | ----- | ------- | ------- |
26082 *   | Delta |
26083 *   | Echo  | Foxtrot |
26084 */
26085const remarkLintTableCellPadding = lintRule(
26086  {
26087    origin: 'remark-lint:table-cell-padding',
26088    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-table-cell-padding#readme'
26089  },
26090  (tree, file, option = 'consistent') => {
26091    if (
26092      option !== 'padded' &&
26093      option !== 'compact' &&
26094      option !== 'consistent'
26095    ) {
26096      file.fail(
26097        'Incorrect table cell padding style `' +
26098          option +
26099          "`, expected `'padded'`, `'compact'`, or `'consistent'`"
26100      );
26101    }
26102    visit$2(tree, 'table', (node) => {
26103      const rows = node.children;
26104      const align = node.align || [];
26105      const sizes = [];
26106      const entries = [];
26107      let index = -1;
26108      while (++index < align.length) {
26109        const alignment = align[index];
26110        sizes[index] = alignment === 'center' ? 3 : alignment ? 2 : 1;
26111      }
26112      index = -1;
26113      while (++index < rows.length) {
26114        const row = rows[index];
26115        let column = -1;
26116        while (++column < row.children.length) {
26117          const cell = row.children[column];
26118          const cellStart = pointStart(cell).offset;
26119          const cellEnd = pointEnd(cell).offset;
26120          const contentStart = pointStart(cell.children[0]).offset;
26121          const contentEnd = pointEnd(
26122            cell.children[cell.children.length - 1]
26123          ).offset;
26124          if (
26125            typeof cellStart !== 'number' ||
26126            typeof cellEnd !== 'number' ||
26127            typeof contentStart !== 'number' ||
26128            typeof contentEnd !== 'number'
26129          ) {
26130            continue
26131          }
26132          entries.push({
26133            node: cell,
26134            start: contentStart - cellStart - 1,
26135            end:
26136              cellEnd -
26137              contentEnd -
26138              (column === row.children.length - 1 ? 1 : 0),
26139            column
26140          });
26141          sizes[column] = Math.max(
26142            sizes[column] || 0,
26143            contentEnd - contentStart
26144          );
26145        }
26146      }
26147      const style =
26148        option === 'consistent'
26149          ? entries[0] && (!entries[0].start || !entries[0].end)
26150            ? 0
26151            : 1
26152          : option === 'padded'
26153          ? 1
26154          : 0;
26155      index = -1;
26156      while (++index < entries.length) {
26157        checkSide('start', entries[index], style, sizes);
26158        checkSide('end', entries[index], style, sizes);
26159      }
26160      return SKIP$2
26161    });
26162    function checkSide(side, entry, style, sizes) {
26163      const cell = entry.node;
26164      const column = entry.column;
26165      const spacing = entry[side];
26166      if (spacing === undefined || spacing === style) {
26167        return
26168      }
26169      let reason = 'Cell should be ';
26170      if (style === 0) {
26171        if (size(cell) < sizes[column]) {
26172          return
26173        }
26174        reason += 'compact';
26175      } else {
26176        reason += 'padded';
26177        if (spacing > style) {
26178          if (size(cell) < sizes[column]) {
26179            return
26180          }
26181          reason += ' with 1 space, not ' + spacing;
26182        }
26183      }
26184      file.message(
26185        reason,
26186        side === 'start'
26187          ? pointStart(cell.children[0])
26188          : pointEnd(cell.children[cell.children.length - 1])
26189      );
26190    }
26191  }
26192);
26193var remarkLintTableCellPadding$1 = remarkLintTableCellPadding;
26194function size(node) {
26195  const head = pointStart(node.children[0]).offset;
26196  const tail = pointEnd(node.children[node.children.length - 1]).offset;
26197  return typeof head === 'number' && typeof tail === 'number' ? tail - head : 0
26198}
26199
26200const convert$1 =
26201  (
26202    function (test) {
26203      if (test === undefined || test === null) {
26204        return ok$1
26205      }
26206      if (typeof test === 'string') {
26207        return typeFactory$1(test)
26208      }
26209      if (typeof test === 'object') {
26210        return Array.isArray(test) ? anyFactory$1(test) : propsFactory$1(test)
26211      }
26212      if (typeof test === 'function') {
26213        return castFactory$1(test)
26214      }
26215      throw new Error('Expected function, string, or object as test')
26216    }
26217  );
26218function anyFactory$1(tests) {
26219  const checks = [];
26220  let index = -1;
26221  while (++index < tests.length) {
26222    checks[index] = convert$1(tests[index]);
26223  }
26224  return castFactory$1(any)
26225  function any(...parameters) {
26226    let index = -1;
26227    while (++index < checks.length) {
26228      if (checks[index].call(this, ...parameters)) return true
26229    }
26230    return false
26231  }
26232}
26233function propsFactory$1(check) {
26234  return castFactory$1(all)
26235  function all(node) {
26236    let key;
26237    for (key in check) {
26238      if (node[key] !== check[key]) return false
26239    }
26240    return true
26241  }
26242}
26243function typeFactory$1(check) {
26244  return castFactory$1(type)
26245  function type(node) {
26246    return node && node.type === check
26247  }
26248}
26249function castFactory$1(check) {
26250  return assertion
26251  function assertion(node, ...parameters) {
26252    return Boolean(
26253      node &&
26254        typeof node === 'object' &&
26255        'type' in node &&
26256        Boolean(check.call(this, node, ...parameters))
26257    )
26258  }
26259}
26260function ok$1() {
26261  return true
26262}
26263
26264function color$2(d) {
26265  return '\u001B[33m' + d + '\u001B[39m'
26266}
26267
26268const CONTINUE$1 = true;
26269const EXIT$1 = false;
26270const SKIP$1 = 'skip';
26271const visitParents$1 =
26272  (
26273    function (tree, test, visitor, reverse) {
26274      if (typeof test === 'function' && typeof visitor !== 'function') {
26275        reverse = visitor;
26276        visitor = test;
26277        test = null;
26278      }
26279      const is = convert$1(test);
26280      const step = reverse ? -1 : 1;
26281      factory(tree, undefined, [])();
26282      function factory(node, index, parents) {
26283        const value = node && typeof node === 'object' ? node : {};
26284        if (typeof value.type === 'string') {
26285          const name =
26286            typeof value.tagName === 'string'
26287              ? value.tagName
26288              :
26289              typeof value.name === 'string'
26290              ? value.name
26291              : undefined;
26292          Object.defineProperty(visit, 'name', {
26293            value:
26294              'node (' + color$2(node.type + (name ? '<' + name + '>' : '')) + ')'
26295          });
26296        }
26297        return visit
26298        function visit() {
26299          let result = [];
26300          let subresult;
26301          let offset;
26302          let grandparents;
26303          if (!test || is(node, index, parents[parents.length - 1] || null)) {
26304            result = toResult$1(visitor(node, parents));
26305            if (result[0] === EXIT$1) {
26306              return result
26307            }
26308          }
26309          if (node.children && result[0] !== SKIP$1) {
26310            offset = (reverse ? node.children.length : -1) + step;
26311            grandparents = parents.concat(node);
26312            while (offset > -1 && offset < node.children.length) {
26313              subresult = factory(node.children[offset], offset, grandparents)();
26314              if (subresult[0] === EXIT$1) {
26315                return subresult
26316              }
26317              offset =
26318                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
26319            }
26320          }
26321          return result
26322        }
26323      }
26324    }
26325  );
26326function toResult$1(value) {
26327  if (Array.isArray(value)) {
26328    return value
26329  }
26330  if (typeof value === 'number') {
26331    return [CONTINUE$1, value]
26332  }
26333  return [value]
26334}
26335
26336const visit$1 =
26337  (
26338    function (tree, test, visitor, reverse) {
26339      if (typeof test === 'function' && typeof visitor !== 'function') {
26340        reverse = visitor;
26341        visitor = test;
26342        test = null;
26343      }
26344      visitParents$1(tree, test, overload, reverse);
26345      function overload(node, parents) {
26346        const parent = parents[parents.length - 1];
26347        return visitor(
26348          node,
26349          parent ? parent.children.indexOf(node) : null,
26350          parent
26351        )
26352      }
26353    }
26354  );
26355
26356/**
26357 * ## When should I use this?
26358 *
26359 * You can use this package to check that tables have initial and final
26360 * delimiters.
26361 * Tables are a GFM feature enabled with
26362 * [`remark-gfm`](https://github.com/remarkjs/remark-gfm).
26363 *
26364 * ## API
26365 *
26366 * There are no options.
26367 *
26368 * ## Recommendation
26369 *
26370 * While tables don’t require initial or final delimiters (pipes before the
26371 * first and after the last cells in a row), it arguably does look weird.
26372 *
26373 * ## Fix
26374 *
26375 * [`remark-gfm`](https://github.com/remarkjs/remark-gfm)
26376 * formats all tables with initial and final delimiters.
26377 *
26378 * @module table-pipes
26379 * @summary
26380 *   remark-lint rule to warn when tables are missing initial and final
26381 *   delimiters.
26382 * @author Titus Wormer
26383 * @copyright 2015 Titus Wormer
26384 * @license MIT
26385 * @example
26386 *   {"name": "ok.md", "gfm": true}
26387 *
26388 *   | A     | B     |
26389 *   | ----- | ----- |
26390 *   | Alpha | Bravo |
26391 *
26392 * @example
26393 *   {"name": "not-ok.md", "label": "input", "gfm": true}
26394 *
26395 *   A     | B
26396 *   ----- | -----
26397 *   Alpha | Bravo
26398 *
26399 * @example
26400 *   {"name": "not-ok.md", "label": "output", "gfm": true}
26401 *
26402 *   1:1: Missing initial pipe in table fence
26403 *   1:10: Missing final pipe in table fence
26404 *   3:1: Missing initial pipe in table fence
26405 *   3:14: Missing final pipe in table fence
26406 */
26407const reasonStart = 'Missing initial pipe in table fence';
26408const reasonEnd = 'Missing final pipe in table fence';
26409const remarkLintTablePipes = lintRule(
26410  {
26411    origin: 'remark-lint:table-pipes',
26412    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-table-pipes#readme'
26413  },
26414  (tree, file) => {
26415    const value = String(file);
26416    visit$1(tree, 'table', (node) => {
26417      let index = -1;
26418      while (++index < node.children.length) {
26419        const row = node.children[index];
26420        const start = pointStart(row);
26421        const end = pointEnd(row);
26422        if (
26423          typeof start.offset === 'number' &&
26424          value.charCodeAt(start.offset) !== 124
26425        ) {
26426          file.message(reasonStart, start);
26427        }
26428        if (
26429          typeof end.offset === 'number' &&
26430          value.charCodeAt(end.offset - 1) !== 124
26431        ) {
26432          file.message(reasonEnd, end);
26433        }
26434      }
26435    });
26436  }
26437);
26438var remarkLintTablePipes$1 = remarkLintTablePipes;
26439
26440const convert =
26441  (
26442    function (test) {
26443      if (test === undefined || test === null) {
26444        return ok
26445      }
26446      if (typeof test === 'string') {
26447        return typeFactory(test)
26448      }
26449      if (typeof test === 'object') {
26450        return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
26451      }
26452      if (typeof test === 'function') {
26453        return castFactory(test)
26454      }
26455      throw new Error('Expected function, string, or object as test')
26456    }
26457  );
26458function anyFactory(tests) {
26459  const checks = [];
26460  let index = -1;
26461  while (++index < tests.length) {
26462    checks[index] = convert(tests[index]);
26463  }
26464  return castFactory(any)
26465  function any(...parameters) {
26466    let index = -1;
26467    while (++index < checks.length) {
26468      if (checks[index].call(this, ...parameters)) return true
26469    }
26470    return false
26471  }
26472}
26473function propsFactory(check) {
26474  return castFactory(all)
26475  function all(node) {
26476    let key;
26477    for (key in check) {
26478      if (node[key] !== check[key]) return false
26479    }
26480    return true
26481  }
26482}
26483function typeFactory(check) {
26484  return castFactory(type)
26485  function type(node) {
26486    return node && node.type === check
26487  }
26488}
26489function castFactory(check) {
26490  return assertion
26491  function assertion(node, ...parameters) {
26492    return Boolean(
26493      node &&
26494        typeof node === 'object' &&
26495        'type' in node &&
26496        Boolean(check.call(this, node, ...parameters))
26497    )
26498  }
26499}
26500function ok() {
26501  return true
26502}
26503
26504function color$1(d) {
26505  return '\u001B[33m' + d + '\u001B[39m'
26506}
26507
26508const CONTINUE = true;
26509const EXIT = false;
26510const SKIP = 'skip';
26511const visitParents =
26512  (
26513    function (tree, test, visitor, reverse) {
26514      if (typeof test === 'function' && typeof visitor !== 'function') {
26515        reverse = visitor;
26516        visitor = test;
26517        test = null;
26518      }
26519      const is = convert(test);
26520      const step = reverse ? -1 : 1;
26521      factory(tree, undefined, [])();
26522      function factory(node, index, parents) {
26523        const value = node && typeof node === 'object' ? node : {};
26524        if (typeof value.type === 'string') {
26525          const name =
26526            typeof value.tagName === 'string'
26527              ? value.tagName
26528              :
26529              typeof value.name === 'string'
26530              ? value.name
26531              : undefined;
26532          Object.defineProperty(visit, 'name', {
26533            value:
26534              'node (' + color$1(node.type + (name ? '<' + name + '>' : '')) + ')'
26535          });
26536        }
26537        return visit
26538        function visit() {
26539          let result = [];
26540          let subresult;
26541          let offset;
26542          let grandparents;
26543          if (!test || is(node, index, parents[parents.length - 1] || null)) {
26544            result = toResult(visitor(node, parents));
26545            if (result[0] === EXIT) {
26546              return result
26547            }
26548          }
26549          if (node.children && result[0] !== SKIP) {
26550            offset = (reverse ? node.children.length : -1) + step;
26551            grandparents = parents.concat(node);
26552            while (offset > -1 && offset < node.children.length) {
26553              subresult = factory(node.children[offset], offset, grandparents)();
26554              if (subresult[0] === EXIT) {
26555                return subresult
26556              }
26557              offset =
26558                typeof subresult[1] === 'number' ? subresult[1] : offset + step;
26559            }
26560          }
26561          return result
26562        }
26563      }
26564    }
26565  );
26566function toResult(value) {
26567  if (Array.isArray(value)) {
26568    return value
26569  }
26570  if (typeof value === 'number') {
26571    return [CONTINUE, value]
26572  }
26573  return [value]
26574}
26575
26576const visit =
26577  (
26578    function (tree, test, visitor, reverse) {
26579      if (typeof test === 'function' && typeof visitor !== 'function') {
26580        reverse = visitor;
26581        visitor = test;
26582        test = null;
26583      }
26584      visitParents(tree, test, overload, reverse);
26585      function overload(node, parents) {
26586        const parent = parents[parents.length - 1];
26587        return visitor(
26588          node,
26589          parent ? parent.children.indexOf(node) : null,
26590          parent
26591        )
26592      }
26593    }
26594  );
26595
26596/**
26597 * ## When should I use this?
26598 *
26599 * You can use this package to check that unordered list markers (bullets)
26600 * are consistent.
26601 *
26602 * ## API
26603 *
26604 * The following options (default: `'consistent'`) are accepted:
26605 *
26606 * *   `'*'`
26607 *     — prefer asterisks
26608 * *   `'+'`
26609 *     — prefer plusses
26610 * *   `'-'`
26611 *     — prefer dashes
26612 * *   `'consistent'`
26613 *     — detect the first used style and warn when further markers differ
26614 *
26615 * ## Recommendation
26616 *
26617 * Because asterisks can be used as a marker for more markdown constructs,
26618 * it’s recommended to use that for lists (and thematic breaks, emphasis,
26619 * strong) too.
26620 *
26621 * ## Fix
26622 *
26623 * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
26624 * formats ordered lists with asterisks by default.
26625 * Pass
26626 * [`bullet: '+'` or `bullet: '-'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsbullet)
26627 * to always use plusses or dashes.
26628 *
26629 * @module unordered-list-marker-style
26630 * @summary
26631 *   remark-lint rule to warn when unordered list markers are inconsistent.
26632 * @author Titus Wormer
26633 * @copyright 2015 Titus Wormer
26634 * @license MIT
26635 * @example
26636 *   {"name": "ok.md"}
26637 *
26638 *   By default (`'consistent'`), if the file uses only one marker,
26639 *   that’s OK.
26640 *
26641 *   * Foo
26642 *   * Bar
26643 *   * Baz
26644 *
26645 *   Ordered lists are not affected.
26646 *
26647 *   1. Foo
26648 *   2. Bar
26649 *   3. Baz
26650 *
26651 * @example
26652 *   {"name": "ok.md", "config": "*"}
26653 *
26654 *   * Foo
26655 *
26656 * @example
26657 *   {"name": "ok.md", "config": "-"}
26658 *
26659 *   - Foo
26660 *
26661 * @example
26662 *   {"name": "ok.md", "config": "+"}
26663 *
26664 *   + Foo
26665 *
26666 * @example
26667 *   {"name": "not-ok.md", "label": "input"}
26668 *
26669 *   * Foo
26670 *   - Bar
26671 *   + Baz
26672 *
26673 * @example
26674 *   {"name": "not-ok.md", "label": "output"}
26675 *
26676 *   2:1-2:6: Marker style should be `*`
26677 *   3:1-3:6: Marker style should be `*`
26678 *
26679 * @example
26680 *   {"name": "not-ok.md", "label": "output", "config": "�", "positionless": true}
26681 *
26682 *   1:1: Incorrect unordered list item marker style `�`: use either `'-'`, `'*'`, or `'+'`
26683 */
26684const markers = new Set(['-', '*', '+']);
26685const remarkLintUnorderedListMarkerStyle = lintRule(
26686  {
26687    origin: 'remark-lint:unordered-list-marker-style',
26688    url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-unordered-list-marker-style#readme'
26689  },
26690  (tree, file, option = 'consistent') => {
26691    const value = String(file);
26692    if (option !== 'consistent' && !markers.has(option)) {
26693      file.fail(
26694        'Incorrect unordered list item marker style `' +
26695          option +
26696          "`: use either `'-'`, `'*'`, or `'+'`"
26697      );
26698    }
26699    visit(tree, 'list', (node) => {
26700      if (node.ordered) return
26701      let index = -1;
26702      while (++index < node.children.length) {
26703        const child = node.children[index];
26704        if (!generated(child)) {
26705          const marker =  (
26706            value
26707              .slice(
26708                pointStart(child).offset,
26709                pointStart(child.children[0]).offset
26710              )
26711              .replace(/\[[x ]?]\s*$/i, '')
26712              .replace(/\s/g, '')
26713          );
26714          if (option === 'consistent') {
26715            option = marker;
26716          } else if (marker !== option) {
26717            file.message('Marker style should be `' + option + '`', child);
26718          }
26719        }
26720      }
26721    });
26722  }
26723);
26724var remarkLintUnorderedListMarkerStyle$1 = remarkLintUnorderedListMarkerStyle;
26725
26726const plugins = [
26727  remarkGfm,
26728  remarkPresetLintRecommended$1,
26729  [remarkLintBlockquoteIndentation$1, 2],
26730  [remarkLintCheckboxCharacterStyle$1, { checked: "x", unchecked: " " }],
26731  remarkLintCheckboxContentIndent$1,
26732  [remarkLintCodeBlockStyle$1, "fenced"],
26733  remarkLintDefinitionSpacing$1,
26734  [
26735    remarkLintFencedCodeFlag$1,
26736    {
26737      flags: [
26738        "bash",
26739        "c",
26740        "cjs",
26741        "coffee",
26742        "console",
26743        "cpp",
26744        "diff",
26745        "http",
26746        "js",
26747        "json",
26748        "markdown",
26749        "mjs",
26750        "powershell",
26751        "r",
26752        "text",
26753        "ts",
26754      ],
26755    },
26756  ],
26757  [remarkLintFencedCodeMarker$1, "`"],
26758  [remarkLintFileExtension$1, "md"],
26759  remarkLintFinalDefinition$1,
26760  [remarkLintFirstHeadingLevel$1, 1],
26761  [remarkLintHeadingStyle$1, "atx"],
26762  [remarkLintListItemIndent$1, "space"],
26763  remarkLintMaximumLineLength$1,
26764  remarkLintNoConsecutiveBlankLines$1,
26765  remarkLintNoFileNameArticles$1,
26766  remarkLintNoFileNameConsecutiveDashes$1,
26767  remarkLintNofileNameOuterDashes$1,
26768  remarkLintNoHeadingIndent$1,
26769  remarkLintNoMultipleToplevelHeadings$1,
26770  remarkLintNoShellDollars$1,
26771  remarkLintNoTableIndentation$1,
26772  remarkLintNoTabs$1,
26773  remarkLintNoTrailingSpaces$1,
26774  remarkLintNodejsLinks,
26775  remarkLintNodejsYamlComments,
26776  [
26777    remarkLintProhibitedStrings,
26778    [
26779      { yes: "End-of-Life" },
26780      { no: "filesystem", yes: "file system" },
26781      { yes: "GitHub" },
26782      { no: "hostname", yes: "host name" },
26783      { yes: "JavaScript" },
26784      { no: "[Ll]ong[ -][Tt]erm [Ss]upport", yes: "Long Term Support" },
26785      { no: "Node", yes: "Node.js", ignoreNextTo: "-API" },
26786      { yes: "Node.js" },
26787      { no: "Node[Jj][Ss]", yes: "Node.js" },
26788      { no: "Node\\.js's?", yes: "the Node.js" },
26789      { no: "[Nn]ote that", yes: "<nothing>" },
26790      { yes: "RFC" },
26791      { no: "[Rr][Ff][Cc]\\d+", yes: "RFC <number>" },
26792      { yes: "Unix" },
26793      { yes: "Valgrind" },
26794      { yes: "V8" },
26795    ],
26796  ],
26797  remarkLintRuleStyle$1,
26798  [remarkLintStrongMarker$1, "*"],
26799  [remarkLintTableCellPadding$1, "padded"],
26800  remarkLintTablePipes$1,
26801  [remarkLintUnorderedListMarkerStyle$1, "*"],
26802];
26803const settings = {
26804  emphasis: "_",
26805  listItemIndent: "one",
26806  tightDefinitions: true,
26807};
26808const remarkPresetLintNode = { plugins, settings };
26809
26810class VFileMessage extends Error {
26811  constructor(causeOrReason, optionsOrParentOrPlace, origin) {
26812    super();
26813    if (typeof optionsOrParentOrPlace === 'string') {
26814      origin = optionsOrParentOrPlace;
26815      optionsOrParentOrPlace = undefined;
26816    }
26817    let reason = '';
26818    let options = {};
26819    let legacyCause = false;
26820    if (optionsOrParentOrPlace) {
26821      if (
26822        'line' in optionsOrParentOrPlace &&
26823        'column' in optionsOrParentOrPlace
26824      ) {
26825        options = {place: optionsOrParentOrPlace};
26826      }
26827      else if (
26828        'start' in optionsOrParentOrPlace &&
26829        'end' in optionsOrParentOrPlace
26830      ) {
26831        options = {place: optionsOrParentOrPlace};
26832      }
26833      else if ('type' in optionsOrParentOrPlace) {
26834        options = {
26835          ancestors: [optionsOrParentOrPlace],
26836          place: optionsOrParentOrPlace.position
26837        };
26838      }
26839      else {
26840        options = {...optionsOrParentOrPlace};
26841      }
26842    }
26843    if (typeof causeOrReason === 'string') {
26844      reason = causeOrReason;
26845    }
26846    else if (!options.cause && causeOrReason) {
26847      legacyCause = true;
26848      reason = causeOrReason.message;
26849      options.cause = causeOrReason;
26850    }
26851    if (!options.ruleId && !options.source && typeof origin === 'string') {
26852      const index = origin.indexOf(':');
26853      if (index === -1) {
26854        options.ruleId = origin;
26855      } else {
26856        options.source = origin.slice(0, index);
26857        options.ruleId = origin.slice(index + 1);
26858      }
26859    }
26860    if (!options.place && options.ancestors && options.ancestors) {
26861      const parent = options.ancestors[options.ancestors.length - 1];
26862      if (parent) {
26863        options.place = parent.position;
26864      }
26865    }
26866    const start =
26867      options.place && 'start' in options.place
26868        ? options.place.start
26869        : options.place;
26870    this.ancestors = options.ancestors || undefined;
26871    this.cause = options.cause || undefined;
26872    this.column = start ? start.column : undefined;
26873    this.fatal = undefined;
26874    this.file;
26875    this.message = reason;
26876    this.line = start ? start.line : undefined;
26877    this.name = stringifyPosition$2(options.place) || '1:1';
26878    this.place = options.place || undefined;
26879    this.reason = this.message;
26880    this.ruleId = options.ruleId || undefined;
26881    this.source = options.source || undefined;
26882    this.stack =
26883      legacyCause && options.cause && typeof options.cause.stack === 'string'
26884        ? options.cause.stack
26885        : '';
26886    this.actual;
26887    this.expected;
26888    this.note;
26889    this.url;
26890  }
26891}
26892VFileMessage.prototype.file = '';
26893VFileMessage.prototype.name = '';
26894VFileMessage.prototype.reason = '';
26895VFileMessage.prototype.message = '';
26896VFileMessage.prototype.stack = '';
26897VFileMessage.prototype.column = undefined;
26898VFileMessage.prototype.line = undefined;
26899VFileMessage.prototype.ancestors = undefined;
26900VFileMessage.prototype.cause = undefined;
26901VFileMessage.prototype.fatal = undefined;
26902VFileMessage.prototype.place = undefined;
26903VFileMessage.prototype.ruleId = undefined;
26904VFileMessage.prototype.source = undefined;
26905
26906function isUrl(fileUrlOrPath) {
26907  return Boolean(
26908    fileUrlOrPath !== null &&
26909      typeof fileUrlOrPath === 'object' &&
26910      'href' in fileUrlOrPath &&
26911      fileUrlOrPath.href &&
26912      'protocol' in fileUrlOrPath &&
26913      fileUrlOrPath.protocol &&
26914      fileUrlOrPath.auth === undefined
26915  )
26916}
26917
26918const order =  ([
26919  'history',
26920  'path',
26921  'basename',
26922  'stem',
26923  'extname',
26924  'dirname'
26925]);
26926class VFile {
26927  constructor(value) {
26928    let options;
26929    if (!value) {
26930      options = {};
26931    } else if (isUrl(value)) {
26932      options = {path: value};
26933    } else if (typeof value === 'string' || isUint8Array$1(value)) {
26934      options = {value};
26935    } else {
26936      options = value;
26937    }
26938    this.cwd = process$1.cwd();
26939    this.data = {};
26940    this.history = [];
26941    this.messages = [];
26942    this.value;
26943    this.map;
26944    this.result;
26945    this.stored;
26946    let index = -1;
26947    while (++index < order.length) {
26948      const prop = order[index];
26949      if (
26950        prop in options &&
26951        options[prop] !== undefined &&
26952        options[prop] !== null
26953      ) {
26954        this[prop] = prop === 'history' ? [...options[prop]] : options[prop];
26955      }
26956    }
26957    let prop;
26958    for (prop in options) {
26959      if (!order.includes(prop)) {
26960        this[prop] = options[prop];
26961      }
26962    }
26963  }
26964  get basename() {
26965    return typeof this.path === 'string' ? path$1.basename(this.path) : undefined
26966  }
26967  set basename(basename) {
26968    assertNonEmpty(basename, 'basename');
26969    assertPart(basename, 'basename');
26970    this.path = path$1.join(this.dirname || '', basename);
26971  }
26972  get dirname() {
26973    return typeof this.path === 'string' ? path$1.dirname(this.path) : undefined
26974  }
26975  set dirname(dirname) {
26976    assertPath(this.basename, 'dirname');
26977    this.path = path$1.join(dirname || '', this.basename);
26978  }
26979  get extname() {
26980    return typeof this.path === 'string' ? path$1.extname(this.path) : undefined
26981  }
26982  set extname(extname) {
26983    assertPart(extname, 'extname');
26984    assertPath(this.dirname, 'extname');
26985    if (extname) {
26986      if (extname.codePointAt(0) !== 46 ) {
26987        throw new Error('`extname` must start with `.`')
26988      }
26989      if (extname.includes('.', 1)) {
26990        throw new Error('`extname` cannot contain multiple dots')
26991      }
26992    }
26993    this.path = path$1.join(this.dirname, this.stem + (extname || ''));
26994  }
26995  get path() {
26996    return this.history[this.history.length - 1]
26997  }
26998  set path(path) {
26999    if (isUrl(path)) {
27000      path = fileURLToPath(path);
27001    }
27002    assertNonEmpty(path, 'path');
27003    if (this.path !== path) {
27004      this.history.push(path);
27005    }
27006  }
27007  get stem() {
27008    return typeof this.path === 'string'
27009      ? path$1.basename(this.path, this.extname)
27010      : undefined
27011  }
27012  set stem(stem) {
27013    assertNonEmpty(stem, 'stem');
27014    assertPart(stem, 'stem');
27015    this.path = path$1.join(this.dirname || '', stem + (this.extname || ''));
27016  }
27017  fail(causeOrReason, optionsOrParentOrPlace, origin) {
27018    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
27019    message.fatal = true;
27020    throw message
27021  }
27022  info(causeOrReason, optionsOrParentOrPlace, origin) {
27023    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
27024    message.fatal = undefined;
27025    return message
27026  }
27027  message(causeOrReason, optionsOrParentOrPlace, origin) {
27028    const message = new VFileMessage(
27029      causeOrReason,
27030      optionsOrParentOrPlace,
27031      origin
27032    );
27033    if (this.path) {
27034      message.name = this.path + ':' + message.name;
27035      message.file = this.path;
27036    }
27037    message.fatal = false;
27038    this.messages.push(message);
27039    return message
27040  }
27041  toString(encoding) {
27042    if (this.value === undefined) {
27043      return ''
27044    }
27045    if (typeof this.value === 'string') {
27046      return this.value
27047    }
27048    const decoder = new TextDecoder(encoding || undefined);
27049    return decoder.decode(this.value)
27050  }
27051}
27052function assertPart(part, name) {
27053  if (part && part.includes(path$1.sep)) {
27054    throw new Error(
27055      '`' + name + '` cannot be a path: did not expect `' + path$1.sep + '`'
27056    )
27057  }
27058}
27059function assertNonEmpty(part, name) {
27060  if (!part) {
27061    throw new Error('`' + name + '` cannot be empty')
27062  }
27063}
27064function assertPath(path, name) {
27065  if (!path) {
27066    throw new Error('Setting `' + name + '` requires `path` to be set too')
27067  }
27068}
27069function isUint8Array$1(value) {
27070  return Boolean(
27071    value &&
27072      typeof value === 'object' &&
27073      'byteLength' in value &&
27074      'byteOffset' in value
27075  )
27076}
27077
27078function read(description, options, callback) {
27079  const file = toVFile(description);
27080  if (!callback && typeof options === 'function') {
27081    callback = options;
27082    options = undefined;
27083  }
27084  if (!callback) {
27085    return new Promise(executor)
27086  }
27087  executor(resolve, callback);
27088  function resolve(result) {
27089    callback(undefined, result);
27090  }
27091  function executor(resolve, reject) {
27092    let fp;
27093    try {
27094      fp = path$1.resolve(file.cwd, file.path);
27095    } catch (error) {
27096      const exception =  (error);
27097      return reject(exception)
27098    }
27099    fs$1.readFile(fp, options, done);
27100    function done(error, result) {
27101      if (error) {
27102        reject(error);
27103      } else {
27104        file.value = result;
27105        resolve(file);
27106      }
27107    }
27108  }
27109}
27110function toVFile(description) {
27111  if (typeof description === 'string' || description instanceof URL) {
27112    description = {path: description};
27113  } else if (isUint8Array(description)) {
27114    description = {path: new TextDecoder().decode(description)};
27115  }
27116  return looksLikeAVFile(description) ? description : new VFile(description)
27117}
27118function looksLikeAVFile(value) {
27119  return Boolean(
27120    value &&
27121      typeof value === 'object' &&
27122      'message' in value &&
27123      'messages' in value
27124  )
27125}
27126function isUint8Array(value) {
27127  return Boolean(
27128    value &&
27129      typeof value === 'object' &&
27130      'byteLength' in value &&
27131      'byteOffset' in value
27132  )
27133}
27134
27135function ansiRegex({onlyFirst = false} = {}) {
27136	const pattern = [
27137	    '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
27138		'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
27139	].join('|');
27140	return new RegExp(pattern, onlyFirst ? undefined : 'g');
27141}
27142
27143const regex = ansiRegex();
27144function stripAnsi(string) {
27145	if (typeof string !== 'string') {
27146		throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
27147	}
27148	return string.replace(regex, '');
27149}
27150
27151var eastasianwidth = {exports: {}};
27152
27153(function (module) {
27154	var eaw = {};
27155	{
27156	  module.exports = eaw;
27157	}
27158	eaw.eastAsianWidth = function(character) {
27159	  var x = character.charCodeAt(0);
27160	  var y = (character.length == 2) ? character.charCodeAt(1) : 0;
27161	  var codePoint = x;
27162	  if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) {
27163	    x &= 0x3FF;
27164	    y &= 0x3FF;
27165	    codePoint = (x << 10) | y;
27166	    codePoint += 0x10000;
27167	  }
27168	  if ((0x3000 == codePoint) ||
27169	      (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
27170	      (0xFFE0 <= codePoint && codePoint <= 0xFFE6)) {
27171	    return 'F';
27172	  }
27173	  if ((0x20A9 == codePoint) ||
27174	      (0xFF61 <= codePoint && codePoint <= 0xFFBE) ||
27175	      (0xFFC2 <= codePoint && codePoint <= 0xFFC7) ||
27176	      (0xFFCA <= codePoint && codePoint <= 0xFFCF) ||
27177	      (0xFFD2 <= codePoint && codePoint <= 0xFFD7) ||
27178	      (0xFFDA <= codePoint && codePoint <= 0xFFDC) ||
27179	      (0xFFE8 <= codePoint && codePoint <= 0xFFEE)) {
27180	    return 'H';
27181	  }
27182	  if ((0x1100 <= codePoint && codePoint <= 0x115F) ||
27183	      (0x11A3 <= codePoint && codePoint <= 0x11A7) ||
27184	      (0x11FA <= codePoint && codePoint <= 0x11FF) ||
27185	      (0x2329 <= codePoint && codePoint <= 0x232A) ||
27186	      (0x2E80 <= codePoint && codePoint <= 0x2E99) ||
27187	      (0x2E9B <= codePoint && codePoint <= 0x2EF3) ||
27188	      (0x2F00 <= codePoint && codePoint <= 0x2FD5) ||
27189	      (0x2FF0 <= codePoint && codePoint <= 0x2FFB) ||
27190	      (0x3001 <= codePoint && codePoint <= 0x303E) ||
27191	      (0x3041 <= codePoint && codePoint <= 0x3096) ||
27192	      (0x3099 <= codePoint && codePoint <= 0x30FF) ||
27193	      (0x3105 <= codePoint && codePoint <= 0x312D) ||
27194	      (0x3131 <= codePoint && codePoint <= 0x318E) ||
27195	      (0x3190 <= codePoint && codePoint <= 0x31BA) ||
27196	      (0x31C0 <= codePoint && codePoint <= 0x31E3) ||
27197	      (0x31F0 <= codePoint && codePoint <= 0x321E) ||
27198	      (0x3220 <= codePoint && codePoint <= 0x3247) ||
27199	      (0x3250 <= codePoint && codePoint <= 0x32FE) ||
27200	      (0x3300 <= codePoint && codePoint <= 0x4DBF) ||
27201	      (0x4E00 <= codePoint && codePoint <= 0xA48C) ||
27202	      (0xA490 <= codePoint && codePoint <= 0xA4C6) ||
27203	      (0xA960 <= codePoint && codePoint <= 0xA97C) ||
27204	      (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
27205	      (0xD7B0 <= codePoint && codePoint <= 0xD7C6) ||
27206	      (0xD7CB <= codePoint && codePoint <= 0xD7FB) ||
27207	      (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
27208	      (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
27209	      (0xFE30 <= codePoint && codePoint <= 0xFE52) ||
27210	      (0xFE54 <= codePoint && codePoint <= 0xFE66) ||
27211	      (0xFE68 <= codePoint && codePoint <= 0xFE6B) ||
27212	      (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
27213	      (0x1F200 <= codePoint && codePoint <= 0x1F202) ||
27214	      (0x1F210 <= codePoint && codePoint <= 0x1F23A) ||
27215	      (0x1F240 <= codePoint && codePoint <= 0x1F248) ||
27216	      (0x1F250 <= codePoint && codePoint <= 0x1F251) ||
27217	      (0x20000 <= codePoint && codePoint <= 0x2F73F) ||
27218	      (0x2B740 <= codePoint && codePoint <= 0x2FFFD) ||
27219	      (0x30000 <= codePoint && codePoint <= 0x3FFFD)) {
27220	    return 'W';
27221	  }
27222	  if ((0x0020 <= codePoint && codePoint <= 0x007E) ||
27223	      (0x00A2 <= codePoint && codePoint <= 0x00A3) ||
27224	      (0x00A5 <= codePoint && codePoint <= 0x00A6) ||
27225	      (0x00AC == codePoint) ||
27226	      (0x00AF == codePoint) ||
27227	      (0x27E6 <= codePoint && codePoint <= 0x27ED) ||
27228	      (0x2985 <= codePoint && codePoint <= 0x2986)) {
27229	    return 'Na';
27230	  }
27231	  if ((0x00A1 == codePoint) ||
27232	      (0x00A4 == codePoint) ||
27233	      (0x00A7 <= codePoint && codePoint <= 0x00A8) ||
27234	      (0x00AA == codePoint) ||
27235	      (0x00AD <= codePoint && codePoint <= 0x00AE) ||
27236	      (0x00B0 <= codePoint && codePoint <= 0x00B4) ||
27237	      (0x00B6 <= codePoint && codePoint <= 0x00BA) ||
27238	      (0x00BC <= codePoint && codePoint <= 0x00BF) ||
27239	      (0x00C6 == codePoint) ||
27240	      (0x00D0 == codePoint) ||
27241	      (0x00D7 <= codePoint && codePoint <= 0x00D8) ||
27242	      (0x00DE <= codePoint && codePoint <= 0x00E1) ||
27243	      (0x00E6 == codePoint) ||
27244	      (0x00E8 <= codePoint && codePoint <= 0x00EA) ||
27245	      (0x00EC <= codePoint && codePoint <= 0x00ED) ||
27246	      (0x00F0 == codePoint) ||
27247	      (0x00F2 <= codePoint && codePoint <= 0x00F3) ||
27248	      (0x00F7 <= codePoint && codePoint <= 0x00FA) ||
27249	      (0x00FC == codePoint) ||
27250	      (0x00FE == codePoint) ||
27251	      (0x0101 == codePoint) ||
27252	      (0x0111 == codePoint) ||
27253	      (0x0113 == codePoint) ||
27254	      (0x011B == codePoint) ||
27255	      (0x0126 <= codePoint && codePoint <= 0x0127) ||
27256	      (0x012B == codePoint) ||
27257	      (0x0131 <= codePoint && codePoint <= 0x0133) ||
27258	      (0x0138 == codePoint) ||
27259	      (0x013F <= codePoint && codePoint <= 0x0142) ||
27260	      (0x0144 == codePoint) ||
27261	      (0x0148 <= codePoint && codePoint <= 0x014B) ||
27262	      (0x014D == codePoint) ||
27263	      (0x0152 <= codePoint && codePoint <= 0x0153) ||
27264	      (0x0166 <= codePoint && codePoint <= 0x0167) ||
27265	      (0x016B == codePoint) ||
27266	      (0x01CE == codePoint) ||
27267	      (0x01D0 == codePoint) ||
27268	      (0x01D2 == codePoint) ||
27269	      (0x01D4 == codePoint) ||
27270	      (0x01D6 == codePoint) ||
27271	      (0x01D8 == codePoint) ||
27272	      (0x01DA == codePoint) ||
27273	      (0x01DC == codePoint) ||
27274	      (0x0251 == codePoint) ||
27275	      (0x0261 == codePoint) ||
27276	      (0x02C4 == codePoint) ||
27277	      (0x02C7 == codePoint) ||
27278	      (0x02C9 <= codePoint && codePoint <= 0x02CB) ||
27279	      (0x02CD == codePoint) ||
27280	      (0x02D0 == codePoint) ||
27281	      (0x02D8 <= codePoint && codePoint <= 0x02DB) ||
27282	      (0x02DD == codePoint) ||
27283	      (0x02DF == codePoint) ||
27284	      (0x0300 <= codePoint && codePoint <= 0x036F) ||
27285	      (0x0391 <= codePoint && codePoint <= 0x03A1) ||
27286	      (0x03A3 <= codePoint && codePoint <= 0x03A9) ||
27287	      (0x03B1 <= codePoint && codePoint <= 0x03C1) ||
27288	      (0x03C3 <= codePoint && codePoint <= 0x03C9) ||
27289	      (0x0401 == codePoint) ||
27290	      (0x0410 <= codePoint && codePoint <= 0x044F) ||
27291	      (0x0451 == codePoint) ||
27292	      (0x2010 == codePoint) ||
27293	      (0x2013 <= codePoint && codePoint <= 0x2016) ||
27294	      (0x2018 <= codePoint && codePoint <= 0x2019) ||
27295	      (0x201C <= codePoint && codePoint <= 0x201D) ||
27296	      (0x2020 <= codePoint && codePoint <= 0x2022) ||
27297	      (0x2024 <= codePoint && codePoint <= 0x2027) ||
27298	      (0x2030 == codePoint) ||
27299	      (0x2032 <= codePoint && codePoint <= 0x2033) ||
27300	      (0x2035 == codePoint) ||
27301	      (0x203B == codePoint) ||
27302	      (0x203E == codePoint) ||
27303	      (0x2074 == codePoint) ||
27304	      (0x207F == codePoint) ||
27305	      (0x2081 <= codePoint && codePoint <= 0x2084) ||
27306	      (0x20AC == codePoint) ||
27307	      (0x2103 == codePoint) ||
27308	      (0x2105 == codePoint) ||
27309	      (0x2109 == codePoint) ||
27310	      (0x2113 == codePoint) ||
27311	      (0x2116 == codePoint) ||
27312	      (0x2121 <= codePoint && codePoint <= 0x2122) ||
27313	      (0x2126 == codePoint) ||
27314	      (0x212B == codePoint) ||
27315	      (0x2153 <= codePoint && codePoint <= 0x2154) ||
27316	      (0x215B <= codePoint && codePoint <= 0x215E) ||
27317	      (0x2160 <= codePoint && codePoint <= 0x216B) ||
27318	      (0x2170 <= codePoint && codePoint <= 0x2179) ||
27319	      (0x2189 == codePoint) ||
27320	      (0x2190 <= codePoint && codePoint <= 0x2199) ||
27321	      (0x21B8 <= codePoint && codePoint <= 0x21B9) ||
27322	      (0x21D2 == codePoint) ||
27323	      (0x21D4 == codePoint) ||
27324	      (0x21E7 == codePoint) ||
27325	      (0x2200 == codePoint) ||
27326	      (0x2202 <= codePoint && codePoint <= 0x2203) ||
27327	      (0x2207 <= codePoint && codePoint <= 0x2208) ||
27328	      (0x220B == codePoint) ||
27329	      (0x220F == codePoint) ||
27330	      (0x2211 == codePoint) ||
27331	      (0x2215 == codePoint) ||
27332	      (0x221A == codePoint) ||
27333	      (0x221D <= codePoint && codePoint <= 0x2220) ||
27334	      (0x2223 == codePoint) ||
27335	      (0x2225 == codePoint) ||
27336	      (0x2227 <= codePoint && codePoint <= 0x222C) ||
27337	      (0x222E == codePoint) ||
27338	      (0x2234 <= codePoint && codePoint <= 0x2237) ||
27339	      (0x223C <= codePoint && codePoint <= 0x223D) ||
27340	      (0x2248 == codePoint) ||
27341	      (0x224C == codePoint) ||
27342	      (0x2252 == codePoint) ||
27343	      (0x2260 <= codePoint && codePoint <= 0x2261) ||
27344	      (0x2264 <= codePoint && codePoint <= 0x2267) ||
27345	      (0x226A <= codePoint && codePoint <= 0x226B) ||
27346	      (0x226E <= codePoint && codePoint <= 0x226F) ||
27347	      (0x2282 <= codePoint && codePoint <= 0x2283) ||
27348	      (0x2286 <= codePoint && codePoint <= 0x2287) ||
27349	      (0x2295 == codePoint) ||
27350	      (0x2299 == codePoint) ||
27351	      (0x22A5 == codePoint) ||
27352	      (0x22BF == codePoint) ||
27353	      (0x2312 == codePoint) ||
27354	      (0x2460 <= codePoint && codePoint <= 0x24E9) ||
27355	      (0x24EB <= codePoint && codePoint <= 0x254B) ||
27356	      (0x2550 <= codePoint && codePoint <= 0x2573) ||
27357	      (0x2580 <= codePoint && codePoint <= 0x258F) ||
27358	      (0x2592 <= codePoint && codePoint <= 0x2595) ||
27359	      (0x25A0 <= codePoint && codePoint <= 0x25A1) ||
27360	      (0x25A3 <= codePoint && codePoint <= 0x25A9) ||
27361	      (0x25B2 <= codePoint && codePoint <= 0x25B3) ||
27362	      (0x25B6 <= codePoint && codePoint <= 0x25B7) ||
27363	      (0x25BC <= codePoint && codePoint <= 0x25BD) ||
27364	      (0x25C0 <= codePoint && codePoint <= 0x25C1) ||
27365	      (0x25C6 <= codePoint && codePoint <= 0x25C8) ||
27366	      (0x25CB == codePoint) ||
27367	      (0x25CE <= codePoint && codePoint <= 0x25D1) ||
27368	      (0x25E2 <= codePoint && codePoint <= 0x25E5) ||
27369	      (0x25EF == codePoint) ||
27370	      (0x2605 <= codePoint && codePoint <= 0x2606) ||
27371	      (0x2609 == codePoint) ||
27372	      (0x260E <= codePoint && codePoint <= 0x260F) ||
27373	      (0x2614 <= codePoint && codePoint <= 0x2615) ||
27374	      (0x261C == codePoint) ||
27375	      (0x261E == codePoint) ||
27376	      (0x2640 == codePoint) ||
27377	      (0x2642 == codePoint) ||
27378	      (0x2660 <= codePoint && codePoint <= 0x2661) ||
27379	      (0x2663 <= codePoint && codePoint <= 0x2665) ||
27380	      (0x2667 <= codePoint && codePoint <= 0x266A) ||
27381	      (0x266C <= codePoint && codePoint <= 0x266D) ||
27382	      (0x266F == codePoint) ||
27383	      (0x269E <= codePoint && codePoint <= 0x269F) ||
27384	      (0x26BE <= codePoint && codePoint <= 0x26BF) ||
27385	      (0x26C4 <= codePoint && codePoint <= 0x26CD) ||
27386	      (0x26CF <= codePoint && codePoint <= 0x26E1) ||
27387	      (0x26E3 == codePoint) ||
27388	      (0x26E8 <= codePoint && codePoint <= 0x26FF) ||
27389	      (0x273D == codePoint) ||
27390	      (0x2757 == codePoint) ||
27391	      (0x2776 <= codePoint && codePoint <= 0x277F) ||
27392	      (0x2B55 <= codePoint && codePoint <= 0x2B59) ||
27393	      (0x3248 <= codePoint && codePoint <= 0x324F) ||
27394	      (0xE000 <= codePoint && codePoint <= 0xF8FF) ||
27395	      (0xFE00 <= codePoint && codePoint <= 0xFE0F) ||
27396	      (0xFFFD == codePoint) ||
27397	      (0x1F100 <= codePoint && codePoint <= 0x1F10A) ||
27398	      (0x1F110 <= codePoint && codePoint <= 0x1F12D) ||
27399	      (0x1F130 <= codePoint && codePoint <= 0x1F169) ||
27400	      (0x1F170 <= codePoint && codePoint <= 0x1F19A) ||
27401	      (0xE0100 <= codePoint && codePoint <= 0xE01EF) ||
27402	      (0xF0000 <= codePoint && codePoint <= 0xFFFFD) ||
27403	      (0x100000 <= codePoint && codePoint <= 0x10FFFD)) {
27404	    return 'A';
27405	  }
27406	  return 'N';
27407	};
27408	eaw.characterLength = function(character) {
27409	  var code = this.eastAsianWidth(character);
27410	  if (code == 'F' || code == 'W' || code == 'A') {
27411	    return 2;
27412	  } else {
27413	    return 1;
27414	  }
27415	};
27416	function stringToArray(string) {
27417	  return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
27418	}
27419	eaw.length = function(string) {
27420	  var characters = stringToArray(string);
27421	  var len = 0;
27422	  for (var i = 0; i < characters.length; i++) {
27423	    len = len + this.characterLength(characters[i]);
27424	  }
27425	  return len;
27426	};
27427	eaw.slice = function(text, start, end) {
27428	  textLen = eaw.length(text);
27429	  start = start ? start : 0;
27430	  end = end ? end : 1;
27431	  if (start < 0) {
27432	      start = textLen + start;
27433	  }
27434	  if (end < 0) {
27435	      end = textLen + end;
27436	  }
27437	  var result = '';
27438	  var eawLen = 0;
27439	  var chars = stringToArray(text);
27440	  for (var i = 0; i < chars.length; i++) {
27441	    var char = chars[i];
27442	    var charLen = eaw.length(char);
27443	    if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
27444	        if (eawLen + charLen <= end) {
27445	            result += char;
27446	        } else {
27447	            break;
27448	        }
27449	    }
27450	    eawLen += charLen;
27451	  }
27452	  return result;
27453	};
27454} (eastasianwidth));
27455var eastasianwidthExports = eastasianwidth.exports;
27456var eastAsianWidth = getDefaultExportFromCjs(eastasianwidthExports);
27457
27458var emojiRegex = () => {
27459	return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\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]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\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?|[\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](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\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\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
27460};
27461
27462function stringWidth(string, options) {
27463	if (typeof string !== 'string' || string.length === 0) {
27464		return 0;
27465	}
27466	options = {
27467		ambiguousIsNarrow: true,
27468		countAnsiEscapeCodes: false,
27469		...options,
27470	};
27471	if (!options.countAnsiEscapeCodes) {
27472		string = stripAnsi(string);
27473	}
27474	if (string.length === 0) {
27475		return 0;
27476	}
27477	const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
27478	let width = 0;
27479	for (const {segment: character} of new Intl.Segmenter().segment(string)) {
27480		const codePoint = character.codePointAt(0);
27481		if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
27482			continue;
27483		}
27484		if (codePoint >= 0x3_00 && codePoint <= 0x3_6F) {
27485			continue;
27486		}
27487		if (emojiRegex().test(character)) {
27488			width += 2;
27489			continue;
27490		}
27491		const code = eastAsianWidth.eastAsianWidth(character);
27492		switch (code) {
27493			case 'F':
27494			case 'W': {
27495				width += 2;
27496				break;
27497			}
27498			case 'A': {
27499				width += ambiguousCharacterWidth;
27500				break;
27501			}
27502			default: {
27503				width += 1;
27504			}
27505		}
27506	}
27507	return width;
27508}
27509
27510function compareFile(a, b) {
27511  return compareString(a, b, 'path')
27512}
27513function compareMessage(a, b) {
27514  return (
27515    compareNumber(a, b, 'line') ||
27516    compareNumber(a, b, 'column') ||
27517    compareBoolean(a, b, 'fatal') ||
27518    compareString(a, b, 'source') ||
27519    compareString(a, b, 'ruleId') ||
27520    compareString(a, b, 'reason')
27521  )
27522}
27523function compareBoolean(a, b, field) {
27524  return scoreNullableBoolean(a[field]) - scoreNullableBoolean(b[field])
27525}
27526function compareNumber(a, b, field) {
27527  return (a[field] || 0) - (b[field] || 0)
27528}
27529function compareString(a, b, field) {
27530  return String(a[field] || '').localeCompare(String(b[field] || ''))
27531}
27532function scoreNullableBoolean(value) {
27533  return value ? 0 : value === false ? 1 : 2
27534}
27535
27536function statistics(value) {
27537  const result = {fatal: 0, warn: 0, info: 0};
27538  if (!value) {
27539    throw new TypeError(
27540      'Expected file or message for `value`, not `' + value + '`'
27541    )
27542  }
27543  if (Array.isArray(value)) {
27544    list(value);
27545  } else {
27546    one(value);
27547  }
27548  return {
27549    fatal: result.fatal,
27550    nonfatal: result.warn + result.info,
27551    warn: result.warn,
27552    info: result.info,
27553    total: result.fatal + result.warn + result.info
27554  }
27555  function list(value) {
27556    let index = -1;
27557    while (++index < value.length) {
27558      one(value[index]);
27559    }
27560  }
27561  function one(value) {
27562    if ('messages' in value) return list(value.messages)
27563    result[value.fatal ? 'fatal' : value.fatal === false ? 'warn' : 'info']++;
27564  }
27565}
27566
27567function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
27568	const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
27569	const position = argv.indexOf(prefix + flag);
27570	const terminatorPosition = argv.indexOf('--');
27571	return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
27572}
27573const {env} = process$1;
27574let flagForceColor;
27575if (
27576	hasFlag('no-color')
27577	|| hasFlag('no-colors')
27578	|| hasFlag('color=false')
27579	|| hasFlag('color=never')
27580) {
27581	flagForceColor = 0;
27582} else if (
27583	hasFlag('color')
27584	|| hasFlag('colors')
27585	|| hasFlag('color=true')
27586	|| hasFlag('color=always')
27587) {
27588	flagForceColor = 1;
27589}
27590function envForceColor() {
27591	if ('FORCE_COLOR' in env) {
27592		if (env.FORCE_COLOR === 'true') {
27593			return 1;
27594		}
27595		if (env.FORCE_COLOR === 'false') {
27596			return 0;
27597		}
27598		return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
27599	}
27600}
27601function translateLevel(level) {
27602	if (level === 0) {
27603		return false;
27604	}
27605	return {
27606		level,
27607		hasBasic: true,
27608		has256: level >= 2,
27609		has16m: level >= 3,
27610	};
27611}
27612function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
27613	const noFlagForceColor = envForceColor();
27614	if (noFlagForceColor !== undefined) {
27615		flagForceColor = noFlagForceColor;
27616	}
27617	const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
27618	if (forceColor === 0) {
27619		return 0;
27620	}
27621	if (sniffFlags) {
27622		if (hasFlag('color=16m')
27623			|| hasFlag('color=full')
27624			|| hasFlag('color=truecolor')) {
27625			return 3;
27626		}
27627		if (hasFlag('color=256')) {
27628			return 2;
27629		}
27630	}
27631	if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
27632		return 1;
27633	}
27634	if (haveStream && !streamIsTTY && forceColor === undefined) {
27635		return 0;
27636	}
27637	const min = forceColor || 0;
27638	if (env.TERM === 'dumb') {
27639		return min;
27640	}
27641	if (process$1.platform === 'win32') {
27642		const osRelease = os.release().split('.');
27643		if (
27644			Number(osRelease[0]) >= 10
27645			&& Number(osRelease[2]) >= 10_586
27646		) {
27647			return Number(osRelease[2]) >= 14_931 ? 3 : 2;
27648		}
27649		return 1;
27650	}
27651	if ('CI' in env) {
27652		if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
27653			return 3;
27654		}
27655		if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
27656			return 1;
27657		}
27658		return min;
27659	}
27660	if ('TEAMCITY_VERSION' in env) {
27661		return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
27662	}
27663	if (env.COLORTERM === 'truecolor') {
27664		return 3;
27665	}
27666	if (env.TERM === 'xterm-kitty') {
27667		return 3;
27668	}
27669	if ('TERM_PROGRAM' in env) {
27670		const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
27671		switch (env.TERM_PROGRAM) {
27672			case 'iTerm.app': {
27673				return version >= 3 ? 3 : 2;
27674			}
27675			case 'Apple_Terminal': {
27676				return 2;
27677			}
27678		}
27679	}
27680	if (/-256(color)?$/i.test(env.TERM)) {
27681		return 2;
27682	}
27683	if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
27684		return 1;
27685	}
27686	if ('COLORTERM' in env) {
27687		return 1;
27688	}
27689	return min;
27690}
27691function createSupportsColor(stream, options = {}) {
27692	const level = _supportsColor(stream, {
27693		streamIsTTY: stream && stream.isTTY,
27694		...options,
27695	});
27696	return translateLevel(level);
27697}
27698const supportsColor = {
27699	stdout: createSupportsColor({isTTY: tty.isatty(1)}),
27700	stderr: createSupportsColor({isTTY: tty.isatty(2)}),
27701};
27702
27703const color = supportsColor.stderr.hasBasic;
27704
27705const eol = /\r?\n|\r/;
27706function reporter(files, options) {
27707  if (
27708    !files ||
27709    ('name' in files && 'message' in files)
27710  ) {
27711    throw new TypeError(
27712      'Unexpected value for `files`, expected one or more `VFile`s'
27713    )
27714  }
27715  const settings = options || {};
27716  const colorEnabled =
27717    typeof settings.color === 'boolean' ? settings.color : color;
27718  let oneFileMode = false;
27719  if (Array.isArray(files)) ; else {
27720    oneFileMode = true;
27721    files = [files];
27722  }
27723  return serializeRows(
27724    createRows(
27725      {
27726        defaultName: settings.defaultName || undefined,
27727        oneFileMode,
27728        quiet: settings.quiet || false,
27729        silent: settings.silent || false,
27730        traceLimit:
27731          typeof settings.traceLimit === 'number' ? settings.traceLimit : 10,
27732        verbose: settings.verbose || false,
27733        bold: colorEnabled ? '\u001B[1m' : '',
27734        underline: colorEnabled ? '\u001B[4m' : '',
27735        normalIntensity: colorEnabled ? '\u001B[22m' : '',
27736        noUnderline: colorEnabled ? '\u001B[24m' : '',
27737        red: colorEnabled ? '\u001B[31m' : '',
27738        cyan: colorEnabled ? '\u001B[36m' : '',
27739        green: colorEnabled ? '\u001B[32m' : '',
27740        yellow: colorEnabled ? '\u001B[33m' : '',
27741        defaultColor: colorEnabled ? '\u001B[39m' : ''
27742      },
27743      files
27744    )
27745  )
27746}
27747function createAncestorsLines(state, ancestors) {
27748  const min =
27749    ancestors.length > state.traceLimit
27750      ? ancestors.length - state.traceLimit
27751      : 0;
27752  let index = ancestors.length;
27753  const lines = [];
27754  if (index > min) {
27755    lines.unshift('  ' + state.bold + '[trace]' + state.normalIntensity + ':');
27756  }
27757  while (index-- > min) {
27758    const node = ancestors[index];
27759    const value = node;
27760    const name =
27761      typeof value.tagName === 'string'
27762        ? value.tagName
27763        :
27764        typeof value.name === 'string'
27765        ? value.name
27766        : undefined;
27767    const position = stringifyPosition$2(node.position);
27768    lines.push(
27769      '    at ' +
27770        state.yellow +
27771        node.type +
27772        (name ? '<' + name + '>' : '') +
27773        state.defaultColor +
27774        (position ? ' (' + position + ')' : '')
27775    );
27776  }
27777  return lines
27778}
27779function createByline(state, stats) {
27780  let result = '';
27781  if (stats.fatal) {
27782    result =
27783      state.red +
27784      '✖' +
27785      state.defaultColor +
27786      ' ' +
27787      stats.fatal +
27788      ' ' +
27789      (fatalToLabel(true) + (stats.fatal === 1 ? '' : 's'));
27790  }
27791  if (stats.warn) {
27792    result =
27793      (result ? result + ', ' : '') +
27794      (state.yellow + '⚠' + state.defaultColor) +
27795      ' ' +
27796      stats.warn +
27797      ' ' +
27798      (fatalToLabel(false) + (stats.warn === 1 ? '' : 's'));
27799  }
27800  if (stats.total !== stats.fatal && stats.total !== stats.warn) {
27801    result = stats.total + ' messages (' + result + ')';
27802  }
27803  return result
27804}
27805function createCauseLines(state, cause) {
27806  const lines = ['  ' + state.bold + '[cause]' + state.normalIntensity + ':'];
27807  let foundReasonableCause = false;
27808  if (cause !== null && typeof cause === 'object') {
27809    const stackValue =
27810      ('stack' in cause ? String(cause.stack) : undefined) ||
27811      ('message' in cause ? String(cause.message) : undefined);
27812    if (typeof stackValue === 'string') {
27813      foundReasonableCause = true;
27814      const stackLines = stackValue.split(eol);
27815      stackLines[0] = '    ' + stackLines[0];
27816      lines.push(...stackLines);
27817      if ('cause' in cause && cause.cause) {
27818        lines.push(...createCauseLines(state, cause.cause));
27819      }
27820    }
27821  }
27822  if (!foundReasonableCause) {
27823    lines.push('    ' + cause);
27824  }
27825  return lines
27826}
27827function createFileLine(state, file) {
27828  const stats = statistics(file.messages);
27829  const fromPath = file.history[0];
27830  const toPath = file.path;
27831  let left = '';
27832  let right = '';
27833  if (!state.oneFileMode || state.defaultName || fromPath) {
27834    const name = fromPath || state.defaultName || '<stdin>';
27835    left =
27836      state.underline +
27837      (stats.fatal ? state.red : stats.total ? state.yellow : state.green) +
27838      name +
27839      state.defaultColor +
27840      state.noUnderline +
27841      (file.stored && name !== toPath ? ' > ' + toPath : '');
27842  }
27843  if (file.stored) {
27844    right = state.yellow + 'written' + state.defaultColor;
27845  } else if (!stats.total) {
27846    right = 'no issues found';
27847  }
27848  return left && right ? left + ': ' + right : left + right
27849}
27850function createNoteLines(state, note) {
27851  const noteLines = note.split(eol);
27852  let index = -1;
27853  while (++index < noteLines.length) {
27854    noteLines[index] = '    ' + noteLines[index];
27855  }
27856  return [
27857    '  ' + state.bold + '[note]' + state.normalIntensity + ':',
27858    ...noteLines
27859  ]
27860}
27861function createMessageLine(state, message) {
27862  const label = fatalToLabel(message.fatal);
27863  let reason = message.stack || message.message;
27864  const match = eol.exec(reason);
27865  let rest = [];
27866  if (match) {
27867    rest = reason.slice(match.index + 1).split(eol);
27868    reason = reason.slice(0, match.index);
27869  }
27870  const place = message.place || message.position;
27871  const row = [
27872    stringifyPosition$2(place),
27873    (label === 'error' ? state.red : state.yellow) + label + state.defaultColor,
27874    formatReason(state, reason),
27875    message.ruleId || '',
27876    message.source || ''
27877  ];
27878  if (message.cause) {
27879    rest.push(...createCauseLines(state, message.cause));
27880  }
27881  if (state.verbose && message.url) {
27882    rest.push(...createUrlLines(state, message.url));
27883  }
27884  if (state.verbose && message.note) {
27885    rest.push(...createNoteLines(state, message.note));
27886  }
27887  if (state.verbose && message.ancestors) {
27888    rest.push(...createAncestorsLines(state, message.ancestors));
27889  }
27890  return [row, ...rest]
27891}
27892function createRows(state, files) {
27893  const sortedFiles = [...files].sort(compareFile);
27894  const all = [];
27895  let index = -1;
27896  const rows = [];
27897  let lastWasMessage = false;
27898  while (++index < sortedFiles.length) {
27899    const file = sortedFiles[index];
27900    const messages = [...file.messages].sort(compareMessage);
27901    const messageRows = [];
27902    let offset = -1;
27903    while (++offset < messages.length) {
27904      const message = messages[offset];
27905      if (!state.silent || message.fatal) {
27906        all.push(message);
27907        messageRows.push(...createMessageLine(state, message));
27908      }
27909    }
27910    if ((!state.quiet && !state.silent) || messageRows.length > 0) {
27911      const line = createFileLine(state, file);
27912      if (lastWasMessage && line) rows.push('');
27913      if (line) rows.push(line);
27914      if (messageRows.length > 0) rows.push(...messageRows);
27915      lastWasMessage = messageRows.length > 0;
27916    }
27917  }
27918  const stats = statistics(all);
27919  if (stats.fatal || stats.warn) {
27920    rows.push('', createByline(state, stats));
27921  }
27922  return rows
27923}
27924function createUrlLines(state, url) {
27925  return [
27926    '  ' + state.bold + '[url]' + state.normalIntensity + ':',
27927    '    ' + url
27928  ]
27929}
27930function formatReason(state, reason) {
27931  const result = [];
27932  const splits = [];
27933  let index = reason.indexOf('`');
27934  while (index !== -1) {
27935    const split = {index, size: 1};
27936    splits.push(split);
27937    while (reason.codePointAt(index + 1) === 96) {
27938      split.size++;
27939      index++;
27940    }
27941    index = reason.indexOf('`', index + 1);
27942  }
27943  index = -1;
27944  let textStart = 0;
27945  while (++index < splits.length) {
27946    let closeIndex = index;
27947    let close;
27948    while (++closeIndex < splits.length) {
27949      if (splits[index].size === splits[closeIndex].size) {
27950        close = splits[closeIndex];
27951        break
27952      }
27953    }
27954    if (close) {
27955      const codeStart = splits[index].index;
27956      const codeEnd = close.index + close.size;
27957      result.push(
27958        reason.slice(textStart, codeStart) +
27959          state.cyan +
27960          reason.slice(codeStart, codeEnd) +
27961          state.defaultColor
27962      );
27963      textStart = codeEnd;
27964      index = closeIndex;
27965    }
27966  }
27967  result.push(reason.slice(textStart));
27968  return state.bold + result.join('') + state.normalIntensity
27969}
27970function fatalToLabel(value) {
27971  return value ? 'error' : value === false ? 'warning' : 'info'
27972}
27973function serializeRows(rows) {
27974  const sizes = [];
27975  let index = -1;
27976  while (++index < rows.length) {
27977    const row = rows[index];
27978    if (typeof row === 'string') ; else {
27979      let cellIndex = -1;
27980      while (++cellIndex < row.length) {
27981        const current = sizes[cellIndex] || 0;
27982        const size = stringWidth(row[cellIndex]);
27983        if (size > current) {
27984          sizes[cellIndex] = size;
27985        }
27986      }
27987    }
27988  }
27989  const lines = [];
27990  index = -1;
27991  while (++index < rows.length) {
27992    const row = rows[index];
27993    let line = '';
27994    if (typeof row === 'string') {
27995      line = row;
27996    } else {
27997      let cellIndex = -1;
27998      while (++cellIndex < row.length) {
27999        const cell = row[cellIndex] || '';
28000        const max = (sizes[cellIndex] || 0) + 1;
28001        line += cell + ' '.repeat(max - stringWidth(cell));
28002      }
28003    }
28004    lines.push(line.trimEnd());
28005  }
28006  return lines.join('\n')
28007}
28008
28009const paths = process.argv.slice(2);
28010if (!paths.length) {
28011  console.error('Usage: lint-md.mjs <path> [<path> ...]');
28012  process.exit(1);
28013}
28014let format = false;
28015if (paths[0] === '--format') {
28016  paths.shift();
28017  format = true;
28018}
28019const linter = unified()
28020  .use(remarkParse)
28021  .use(remarkPresetLintNode)
28022  .use(remarkStringify);
28023paths.forEach(async (path) => {
28024  const file = await read(path);
28025  const fileContents = file.toString();
28026  const result = await linter.process(file);
28027  const isDifferent = fileContents !== result.toString();
28028  if (format) {
28029    if (isDifferent) {
28030      fs.writeFileSync(path, result.toString());
28031    }
28032  } else {
28033    if (isDifferent) {
28034      process.exitCode = 1;
28035      const cmd = process.platform === 'win32' ? 'vcbuild' : 'make';
28036      console.error(`${path} is not formatted. Please run '${cmd} format-md'.`);
28037    }
28038    if (result.messages.length) {
28039      process.exitCode = 1;
28040      console.error(reporter(result));
28041    }
28042  }
28043});
28044