@readme/markdown 6.68.0-beta.1 → 6.68.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/main.js +1993 -1926
  2. package/dist/main.node.js +1917 -1858
  3. package/package.json +1 -1
package/dist/main.node.js CHANGED
@@ -9154,64 +9154,94 @@ module.exports = function ImageCompiler() {
9154
9154
 
9155
9155
  /***/ }),
9156
9156
 
9157
- /***/ 9647:
9157
+ /***/ 8457:
9158
9158
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9159
9159
 
9160
9160
  "use strict";
9161
+ // ESM COMPAT FLAG
9161
9162
  __webpack_require__.r(__webpack_exports__);
9162
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9163
- /* harmony export */ "breakCompiler": () => (/* reexport default from dynamic */ _break__WEBPACK_IMPORTED_MODULE_0___default.a),
9164
- /* harmony export */ "codeTabsCompiler": () => (/* reexport default from dynamic */ _code_tabs__WEBPACK_IMPORTED_MODULE_1___default.a),
9165
- /* harmony export */ "divCompiler": () => (/* reexport default from dynamic */ _div__WEBPACK_IMPORTED_MODULE_2___default.a),
9166
- /* harmony export */ "escapeCompiler": () => (/* reexport default from dynamic */ _escape__WEBPACK_IMPORTED_MODULE_3___default.a),
9167
- /* harmony export */ "figureCompiler": () => (/* reexport default from dynamic */ _figure__WEBPACK_IMPORTED_MODULE_4___default.a),
9168
- /* harmony export */ "htmlBlockCompiler": () => (/* reexport default from dynamic */ _html_block__WEBPACK_IMPORTED_MODULE_5___default.a),
9169
- /* harmony export */ "iconCompiler": () => (/* reexport default from dynamic */ _i__WEBPACK_IMPORTED_MODULE_6___default.a),
9170
- /* harmony export */ "imageCompiler": () => (/* reexport default from dynamic */ _image__WEBPACK_IMPORTED_MODULE_7___default.a),
9171
- /* harmony export */ "rdmeCalloutCompiler": () => (/* reexport default from dynamic */ _callout__WEBPACK_IMPORTED_MODULE_8___default.a),
9172
- /* harmony export */ "rdmeEmbedCompiler": () => (/* reexport default from dynamic */ _embed__WEBPACK_IMPORTED_MODULE_9___default.a),
9173
- /* harmony export */ "rdmeGlossaryCompiler": () => (/* reexport default from dynamic */ _glossary__WEBPACK_IMPORTED_MODULE_10___default.a),
9174
- /* harmony export */ "rdmePinCompiler": () => (/* reexport default from dynamic */ _pin__WEBPACK_IMPORTED_MODULE_11___default.a),
9175
- /* harmony export */ "rdmeVarCompiler": () => (/* reexport default from dynamic */ _var__WEBPACK_IMPORTED_MODULE_12___default.a),
9176
- /* harmony export */ "reusableContentCompiler": () => (/* reexport default from dynamic */ _reusable_content__WEBPACK_IMPORTED_MODULE_13___default.a),
9177
- /* harmony export */ "tableCompiler": () => (/* reexport default from dynamic */ _table__WEBPACK_IMPORTED_MODULE_14___default.a),
9178
- /* harmony export */ "tableHeadCompiler": () => (/* reexport default from dynamic */ _table_head__WEBPACK_IMPORTED_MODULE_15___default.a),
9179
- /* harmony export */ "yamlCompiler": () => (/* reexport default from dynamic */ _yaml__WEBPACK_IMPORTED_MODULE_16___default.a)
9180
- /* harmony export */ });
9181
- /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3688);
9182
- /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_break__WEBPACK_IMPORTED_MODULE_0__);
9183
- /* harmony import */ var _code_tabs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4079);
9184
- /* harmony import */ var _code_tabs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_code_tabs__WEBPACK_IMPORTED_MODULE_1__);
9185
- /* harmony import */ var _div__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58);
9186
- /* harmony import */ var _div__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_div__WEBPACK_IMPORTED_MODULE_2__);
9187
- /* harmony import */ var _escape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8418);
9188
- /* harmony import */ var _escape__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_escape__WEBPACK_IMPORTED_MODULE_3__);
9189
- /* harmony import */ var _figure__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8705);
9190
- /* harmony import */ var _figure__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_figure__WEBPACK_IMPORTED_MODULE_4__);
9191
- /* harmony import */ var _html_block__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3551);
9192
- /* harmony import */ var _html_block__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_html_block__WEBPACK_IMPORTED_MODULE_5__);
9193
- /* harmony import */ var _i__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4258);
9194
- /* harmony import */ var _i__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_i__WEBPACK_IMPORTED_MODULE_6__);
9195
- /* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3356);
9196
- /* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_image__WEBPACK_IMPORTED_MODULE_7__);
9197
- /* harmony import */ var _callout__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5733);
9198
- /* harmony import */ var _callout__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_callout__WEBPACK_IMPORTED_MODULE_8__);
9199
- /* harmony import */ var _embed__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4338);
9200
- /* harmony import */ var _embed__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_embed__WEBPACK_IMPORTED_MODULE_9__);
9201
- /* harmony import */ var _glossary__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(2459);
9202
- /* harmony import */ var _glossary__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_glossary__WEBPACK_IMPORTED_MODULE_10__);
9203
- /* harmony import */ var _pin__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(2151);
9204
- /* harmony import */ var _pin__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_pin__WEBPACK_IMPORTED_MODULE_11__);
9205
- /* harmony import */ var _var__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(1067);
9206
- /* harmony import */ var _var__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_var__WEBPACK_IMPORTED_MODULE_12__);
9207
- /* harmony import */ var _reusable_content__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(9585);
9208
- /* harmony import */ var _reusable_content__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_reusable_content__WEBPACK_IMPORTED_MODULE_13__);
9209
- /* harmony import */ var _table__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(4669);
9210
- /* harmony import */ var _table__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_table__WEBPACK_IMPORTED_MODULE_14__);
9211
- /* harmony import */ var _table_head__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(186);
9212
- /* harmony import */ var _table_head__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_table_head__WEBPACK_IMPORTED_MODULE_15__);
9213
- /* harmony import */ var _yaml__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(1773);
9214
- /* harmony import */ var _yaml__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_yaml__WEBPACK_IMPORTED_MODULE_16__);
9163
+
9164
+ // EXPORTS
9165
+ __webpack_require__.d(__webpack_exports__, {
9166
+ "breakCompiler": () => (/* reexport */ (break_default())),
9167
+ "codeTabsCompiler": () => (/* reexport */ (code_tabs_default())),
9168
+ "divCompiler": () => (/* reexport */ (div_default())),
9169
+ "escapeCompiler": () => (/* reexport */ (escape_default())),
9170
+ "figureCompiler": () => (/* reexport */ (figure_default())),
9171
+ "htmlBlockCompiler": () => (/* reexport */ (html_block_default())),
9172
+ "iconCompiler": () => (/* reexport */ (i_default())),
9173
+ "imageCompiler": () => (/* reexport */ (image_default())),
9174
+ "rdmeCalloutCompiler": () => (/* reexport */ (callout_default())),
9175
+ "rdmeEmbedCompiler": () => (/* reexport */ (embed_default())),
9176
+ "rdmeGlossaryCompiler": () => (/* reexport */ (glossary_default())),
9177
+ "rdmePinCompiler": () => (/* reexport */ (pin_default())),
9178
+ "rdmeVarCompiler": () => (/* reexport */ (var_default())),
9179
+ "reusableContentCompiler": () => (/* reexport */ ReusableContentCompiler),
9180
+ "tableCompiler": () => (/* reexport */ (table_default())),
9181
+ "tableHeadCompiler": () => (/* reexport */ (table_head_default())),
9182
+ "yamlCompiler": () => (/* reexport */ (yaml_default()))
9183
+ });
9184
+
9185
+ // EXTERNAL MODULE: ./processor/compile/break.js
9186
+ var compile_break = __webpack_require__(3688);
9187
+ var break_default = /*#__PURE__*/__webpack_require__.n(compile_break);
9188
+ // EXTERNAL MODULE: ./processor/compile/code-tabs.js
9189
+ var code_tabs = __webpack_require__(4079);
9190
+ var code_tabs_default = /*#__PURE__*/__webpack_require__.n(code_tabs);
9191
+ // EXTERNAL MODULE: ./processor/compile/div.js
9192
+ var div = __webpack_require__(58);
9193
+ var div_default = /*#__PURE__*/__webpack_require__.n(div);
9194
+ // EXTERNAL MODULE: ./processor/compile/escape.js
9195
+ var compile_escape = __webpack_require__(8418);
9196
+ var escape_default = /*#__PURE__*/__webpack_require__.n(compile_escape);
9197
+ // EXTERNAL MODULE: ./processor/compile/figure.js
9198
+ var figure = __webpack_require__(8705);
9199
+ var figure_default = /*#__PURE__*/__webpack_require__.n(figure);
9200
+ // EXTERNAL MODULE: ./processor/compile/html-block.js
9201
+ var html_block = __webpack_require__(3551);
9202
+ var html_block_default = /*#__PURE__*/__webpack_require__.n(html_block);
9203
+ // EXTERNAL MODULE: ./processor/compile/i.js
9204
+ var i = __webpack_require__(4258);
9205
+ var i_default = /*#__PURE__*/__webpack_require__.n(i);
9206
+ // EXTERNAL MODULE: ./processor/compile/image.js
9207
+ var compile_image = __webpack_require__(3356);
9208
+ var image_default = /*#__PURE__*/__webpack_require__.n(compile_image);
9209
+ // EXTERNAL MODULE: ./processor/compile/callout.js
9210
+ var callout = __webpack_require__(5733);
9211
+ var callout_default = /*#__PURE__*/__webpack_require__.n(callout);
9212
+ // EXTERNAL MODULE: ./processor/compile/embed.js
9213
+ var compile_embed = __webpack_require__(4338);
9214
+ var embed_default = /*#__PURE__*/__webpack_require__.n(compile_embed);
9215
+ // EXTERNAL MODULE: ./processor/compile/glossary.js
9216
+ var glossary = __webpack_require__(2459);
9217
+ var glossary_default = /*#__PURE__*/__webpack_require__.n(glossary);
9218
+ // EXTERNAL MODULE: ./processor/compile/pin.js
9219
+ var pin = __webpack_require__(2151);
9220
+ var pin_default = /*#__PURE__*/__webpack_require__.n(pin);
9221
+ // EXTERNAL MODULE: ./processor/compile/var.js
9222
+ var compile_var = __webpack_require__(1067);
9223
+ var var_default = /*#__PURE__*/__webpack_require__.n(compile_var);
9224
+ // EXTERNAL MODULE: ./processor/transform/reusable-content.js
9225
+ var reusable_content = __webpack_require__(5772);
9226
+ ;// CONCATENATED MODULE: ./processor/compile/reusable-content.js
9227
+
9228
+ function ReusableContentCompiler() {
9229
+ var Compiler = this.Compiler;
9230
+ var visitors = Compiler.prototype.visitors;
9231
+ visitors[reusable_content/* type */.dt] = function (node) {
9232
+ return "<".concat(reusable_content/* tag */._q, " name=\"").concat(node.name, "\" />");
9233
+ };
9234
+ }
9235
+ // EXTERNAL MODULE: ./processor/compile/table.js
9236
+ var table = __webpack_require__(4669);
9237
+ var table_default = /*#__PURE__*/__webpack_require__.n(table);
9238
+ // EXTERNAL MODULE: ./processor/compile/table-head.js
9239
+ var table_head = __webpack_require__(186);
9240
+ var table_head_default = /*#__PURE__*/__webpack_require__.n(table_head);
9241
+ // EXTERNAL MODULE: ./processor/compile/yaml.js
9242
+ var yaml = __webpack_require__(1773);
9243
+ var yaml_default = /*#__PURE__*/__webpack_require__.n(yaml);
9244
+ ;// CONCATENATED MODULE: ./processor/compile/index.js
9215
9245
 
9216
9246
 
9217
9247
 
@@ -9246,19 +9276,6 @@ module.exports = function PinCompiler() {
9246
9276
 
9247
9277
  /***/ }),
9248
9278
 
9249
- /***/ 9585:
9250
- /***/ ((module) => {
9251
-
9252
- module.exports = function ReusableContentCompiler() {
9253
- var Compiler = this.Compiler;
9254
- var visitors = Compiler.prototype.visitors;
9255
- visitors['reusable-content'] = function (node) {
9256
- return "<ReadMeReusableContent name=\"".concat(node.name, "\" />");
9257
- };
9258
- };
9259
-
9260
- /***/ }),
9261
-
9262
9279
  /***/ 186:
9263
9280
  /***/ ((module) => {
9264
9281
 
@@ -10497,7 +10514,7 @@ module.exports.tableFlattening = transformer;
10497
10514
 
10498
10515
  /***/ }),
10499
10516
 
10500
- /***/ 1269:
10517
+ /***/ 2692:
10501
10518
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10502
10519
 
10503
10520
  "use strict";
@@ -10510,702 +10527,235 @@ __webpack_require__.d(__webpack_exports__, {
10510
10527
  "remarkTransformers": () => (/* binding */ remarkTransformers)
10511
10528
  });
10512
10529
 
10513
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/typeof.js
10514
- var helpers_typeof = __webpack_require__(8698);
10515
- var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_typeof);
10516
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inherits.js
10517
- var inherits = __webpack_require__(1655);
10518
- var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits);
10519
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/setPrototypeOf.js
10520
- var setPrototypeOf = __webpack_require__(6015);
10521
- var setPrototypeOf_default = /*#__PURE__*/__webpack_require__.n(setPrototypeOf);
10522
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-is/index.js
10523
- /**
10524
- * @typedef {import('unist').Node} Node
10525
- * @typedef {import('unist').Parent} Parent
10526
- *
10527
- * @typedef {string} Type
10528
- * @typedef {Object<string, unknown>} Props
10529
- *
10530
- * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
10531
- */
10532
-
10533
- /**
10534
- * Check if a node passes a test
10535
- *
10536
- * @callback TestFunctionAnything
10537
- * @param {Node} node
10538
- * @param {number|null|undefined} [index]
10539
- * @param {Parent|null|undefined} [parent]
10540
- * @returns {boolean|void}
10541
- */
10530
+ // EXTERNAL MODULE: ./processor/transform/reusable-content.js
10531
+ var reusable_content = __webpack_require__(5772);
10532
+ // EXTERNAL MODULE: ./node_modules/unist-util-visit/index.js
10533
+ var unist_util_visit = __webpack_require__(6393);
10534
+ ;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
10542
10535
 
10543
- /**
10544
- * Check if a node passes a certain node test
10545
- *
10546
- * @template {Node} X
10547
- * @callback TestFunctionPredicate
10548
- * @param {Node} node
10549
- * @param {number|null|undefined} [index]
10550
- * @param {Parent|null|undefined} [parent]
10551
- * @returns {node is X}
10552
- */
10536
+ var singleCodeTabs = function singleCodeTabs() {
10537
+ return function (tree) {
10538
+ (0,unist_util_visit/* visit */.Vn)(tree, function (node, index, parent) {
10539
+ if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
10540
+ Object.assign(node, {
10541
+ className: 'tab-panel',
10542
+ data: {
10543
+ hName: 'code',
10544
+ hProperties: {
10545
+ meta: node.meta,
10546
+ lang: node.lang
10547
+ }
10548
+ }
10549
+ });
10550
+ parent.children[index] = {
10551
+ type: 'code-tabs',
10552
+ className: 'tabs',
10553
+ data: {
10554
+ hName: 'div',
10555
+ hProperties: {
10556
+ className: ['code-tabs']
10557
+ }
10558
+ },
10559
+ children: [node]
10560
+ };
10561
+ }
10562
+ });
10563
+ return tree;
10564
+ };
10565
+ };
10566
+ /* harmony default export */ const single_code_tabs = (singleCodeTabs);
10567
+ // EXTERNAL MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js + 2 modules
10568
+ var unist_util_visit_parents = __webpack_require__(9445);
10569
+ ;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
10553
10570
 
10554
- /**
10555
- * @callback AssertAnything
10556
- * @param {unknown} [node]
10557
- * @param {number|null|undefined} [index]
10558
- * @param {Parent|null|undefined} [parent]
10559
- * @returns {boolean}
10560
- */
10571
+ var rxEscapedPipe = /\\\|/g;
10561
10572
 
10562
10573
  /**
10563
- * Check if a node passes a certain node test
10574
+ * HAST Transformer that finds all inline code nodes within table cells and
10575
+ * unescapes any escaped pipe chars so that the editor outputs them without
10576
+ * escape chars.
10564
10577
  *
10565
- * @template {Node} Y
10566
- * @callback AssertPredicate
10567
- * @param {unknown} [node]
10568
- * @param {number|null|undefined} [index]
10569
- * @param {Parent|null|undefined} [parent]
10570
- * @returns {node is Y}
10578
+ * This appears to be a bug with remark-parse < ~8
10571
10579
  */
10580
+ var tableCellInlineCode = function tableCellInlineCode() {
10581
+ return function (tree) {
10582
+ (0,unist_util_visit/* visit */.Vn)(tree, [{
10583
+ tagName: 'th'
10584
+ }, {
10585
+ tagName: 'td'
10586
+ }], function (tableCellNode) {
10587
+ (0,unist_util_visit/* visit */.Vn)(tableCellNode, {
10588
+ tagName: 'code'
10589
+ }, function (inlineCodeNode) {
10590
+ var textNode = inlineCodeNode.children[0];
10591
+ if (textNode && rxEscapedPipe.test(textNode.value)) {
10592
+ textNode.value = textNode.value.replace(rxEscapedPipe, '|');
10593
+ }
10594
+ });
10595
+ return unist_util_visit_parents/* SKIP */.AM;
10596
+ });
10597
+ };
10598
+ };
10599
+ /* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
10600
+ ;// CONCATENATED MODULE: ./processor/transform/index.js
10572
10601
 
10573
- const is =
10574
- /**
10575
- * Check if a node passes a test.
10576
- * When a `parent` node is known the `index` of node should also be given.
10577
- *
10578
- * @type {(
10579
- * (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => node is T) &
10580
- * ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
10581
- * )}
10582
- */
10583
- (
10584
- /**
10585
- * Check if a node passes a test.
10586
- * When a `parent` node is known the `index` of node should also be given.
10587
- *
10588
- * @param {unknown} [node] Node to check
10589
- * @param {Test} [test]
10590
- * When nullish, checks if `node` is a `Node`.
10591
- * When `string`, works like passing `function (node) {return node.type === test}`.
10592
- * When `function` checks if function passed the node is true.
10593
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
10594
- * When `array`, checks any one of the subtests pass.
10595
- * @param {number|null|undefined} [index] Position of `node` in `parent`
10596
- * @param {Parent|null|undefined} [parent] Parent of `node`
10597
- * @param {unknown} [context] Context object to invoke `test` with
10598
- * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
10599
- */
10600
- // eslint-disable-next-line max-params
10601
- function is(node, test, index, parent, context) {
10602
- const check = convert(test)
10603
-
10604
- if (
10605
- index !== undefined &&
10606
- index !== null &&
10607
- (typeof index !== 'number' ||
10608
- index < 0 ||
10609
- index === Number.POSITIVE_INFINITY)
10610
- ) {
10611
- throw new Error('Expected positive finite index')
10612
- }
10613
10602
 
10614
- if (
10615
- parent !== undefined &&
10616
- parent !== null &&
10617
- (!is(parent) || !parent.children)
10618
- ) {
10619
- throw new Error('Expected parent node')
10620
- }
10621
10603
 
10622
- if (
10623
- (parent === undefined || parent === null) !==
10624
- (index === undefined || index === null)
10625
- ) {
10626
- throw new Error('Expected both parent and index')
10627
- }
10604
+ var remarkTransformers = [single_code_tabs, reusable_content/* default */.ZP];
10605
+ var rehypeTransformers = [table_cell_inline_code];
10628
10606
 
10629
- // @ts-expect-error Looks like a node.
10630
- return node && node.type && typeof node.type === 'string'
10631
- ? Boolean(check.call(context, node, index, parent))
10632
- : false
10633
- }
10634
- )
10607
+ /***/ }),
10635
10608
 
10636
- const convert =
10637
- /**
10638
- * @type {(
10639
- * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
10640
- * ((test?: Test) => AssertAnything)
10641
- * )}
10642
- */
10643
- (
10644
- /**
10645
- * Generate an assertion from a check.
10646
- * @param {Test} [test]
10647
- * When nullish, checks if `node` is a `Node`.
10648
- * When `string`, works like passing `function (node) {return node.type === test}`.
10649
- * When `function` checks if function passed the node is true.
10650
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
10651
- * When `array`, checks any one of the subtests pass.
10652
- * @returns {AssertAnything}
10653
- */
10654
- function (test) {
10655
- if (test === undefined || test === null) {
10656
- return ok
10657
- }
10609
+ /***/ 5772:
10610
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10658
10611
 
10659
- if (typeof test === 'string') {
10660
- return typeFactory(test)
10661
- }
10612
+ "use strict";
10613
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10614
+ /* harmony export */ "ZP": () => (__WEBPACK_DEFAULT_EXPORT__),
10615
+ /* harmony export */ "_q": () => (/* binding */ tag),
10616
+ /* harmony export */ "dt": () => (/* binding */ type)
10617
+ /* harmony export */ });
10618
+ /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8698);
10619
+ /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);
10620
+ /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1655);
10621
+ /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
10622
+ /* harmony import */ var _babel_runtime_helpers_setPrototypeOf__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6015);
10623
+ /* harmony import */ var _babel_runtime_helpers_setPrototypeOf__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_setPrototypeOf__WEBPACK_IMPORTED_MODULE_2__);
10624
+ /* harmony import */ var unist_util_visit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6393);
10662
10625
 
10663
- if (typeof test === 'object') {
10664
- return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
10665
- }
10666
10626
 
10667
- if (typeof test === 'function') {
10668
- return castFactory(test)
10669
- }
10670
10627
 
10671
- throw new Error('Expected function, string, or object as test')
10672
- }
10673
- )
10674
- /**
10675
- * @param {Array.<Type|Props|TestFunctionAnything>} tests
10676
- * @returns {AssertAnything}
10677
- */
10678
- function anyFactory(tests) {
10679
- /** @type {Array.<AssertAnything>} */
10680
- const checks = []
10681
- let index = -1
10628
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), _babel_runtime_helpers_setPrototypeOf__WEBPACK_IMPORTED_MODULE_2___default()(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { var i = g[name]; if ("number" == typeof i) groups[name] = result[i];else { for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) { k++; } groups[name] = result[i[k]]; } return groups; }, Object.create(null)); } return _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
10682
10629
 
10683
- while (++index < tests.length) {
10684
- checks[index] = convert(tests[index])
10685
- }
10630
+ var type = 'reusable-content';
10631
+ var tag = 'RMReusableContent';
10632
+ var regexp = /*#__PURE__*/_wrapRegExp(/^\s*<RMReusableContent name="(.*)" \/>\s*$/, {
10633
+ name: 1
10634
+ });
10635
+ var reusableContentTransformer = function reusableContentTransformer() {
10636
+ var reusableContent = this.data('reusableContent');
10637
+ return function (tree) {
10638
+ (0,unist_util_visit__WEBPACK_IMPORTED_MODULE_3__/* .visit */ .Vn)(tree, 'html', function (node, index, parent) {
10639
+ var result = regexp.exec(node.value);
10640
+ if (!result || !result.groups.name) return;
10641
+ var name = result.groups.name;
10642
+ var block = {
10643
+ type: type,
10644
+ name: name,
10645
+ children: name in reusableContent ? reusableContent[name] : []
10646
+ };
10647
+ parent.children[index] = block;
10648
+ });
10649
+ return tree;
10650
+ };
10651
+ };
10652
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reusableContentTransformer);
10686
10653
 
10687
- return castFactory(any)
10654
+ /***/ }),
10688
10655
 
10689
- /**
10690
- * @this {unknown}
10691
- * @param {unknown[]} parameters
10692
- * @returns {boolean}
10693
- */
10694
- function any(...parameters) {
10695
- let index = -1
10656
+ /***/ 8229:
10657
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
10696
10658
 
10697
- while (++index < checks.length) {
10698
- if (checks[index].call(this, ...parameters)) return true
10699
- }
10659
+ var _require = __webpack_require__(2781),
10660
+ defaultSchema = _require.defaultSchema;
10661
+ var createSchema = function createSchema() {
10662
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
10663
+ safeMode = _ref.safeMode;
10664
+ var schema = JSON.parse(JSON.stringify(defaultSchema));
10700
10665
 
10701
- return false
10666
+ // Sanitization Schema Defaults
10667
+ schema.clobberPrefix = '';
10668
+ schema.tagNames.push('span');
10669
+ schema.attributes['*'].push('class', 'className', 'align');
10670
+ if (!safeMode) {
10671
+ schema.attributes['*'].push('style');
10702
10672
  }
10703
- }
10673
+ schema.tagNames.push('rdme-pin');
10674
+ schema.tagNames.push('rdme-embed');
10675
+ schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
10676
+ schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
10677
+ schema.tagNames.push('figure');
10678
+ schema.tagNames.push('figcaption');
10679
+ schema.tagNames.push('input'); // allow GitHub-style todo lists
10680
+ schema.ancestors.input = ['li'];
10681
+ schema.tagNames.push('colgroup'); // wat
10682
+ schema.tagNames.push('col');
10683
+ return schema;
10684
+ };
10685
+ module.exports = createSchema;
10704
10686
 
10705
- /**
10706
- * Utility to assert each property in `test` is represented in `node`, and each
10707
- * values are strictly equal.
10708
- *
10709
- * @param {Props} check
10710
- * @returns {AssertAnything}
10711
- */
10712
- function propsFactory(check) {
10713
- return castFactory(all)
10687
+ /***/ }),
10714
10688
 
10715
- /**
10716
- * @param {Node} node
10717
- * @returns {boolean}
10718
- */
10719
- function all(node) {
10720
- /** @type {string} */
10721
- let key
10689
+ /***/ 8841:
10690
+ /***/ ((module) => {
10722
10691
 
10723
- for (key in check) {
10724
- // @ts-expect-error: hush, it sure works as an index.
10725
- if (node[key] !== check[key]) return false
10726
- }
10692
+ "use strict";
10727
10693
 
10728
- return true
10729
- }
10730
- }
10731
10694
 
10732
- /**
10733
- * Utility to convert a string into a function which checks a given node’s type
10734
- * for said string.
10735
- *
10736
- * @param {Type} check
10737
- * @returns {AssertAnything}
10738
- */
10739
- function typeFactory(check) {
10740
- return castFactory(type)
10695
+ module.exports = bail
10741
10696
 
10742
- /**
10743
- * @param {Node} node
10744
- */
10745
- function type(node) {
10746
- return node && node.type === check
10697
+ function bail(err) {
10698
+ if (err) {
10699
+ throw err
10747
10700
  }
10748
10701
  }
10749
10702
 
10750
- /**
10751
- * Utility to convert a string into a function which checks a given node’s type
10752
- * for said string.
10753
- * @param {TestFunctionAnything} check
10754
- * @returns {AssertAnything}
10755
- */
10756
- function castFactory(check) {
10757
- return assertion
10758
10703
 
10759
- /**
10760
- * @this {unknown}
10761
- * @param {Array.<unknown>} parameters
10762
- * @returns {boolean}
10763
- */
10764
- function assertion(...parameters) {
10765
- // @ts-expect-error: spreading is fine.
10766
- return Boolean(check.call(this, ...parameters))
10767
- }
10768
- }
10704
+ /***/ }),
10769
10705
 
10770
- // Utility to return true.
10771
- function ok() {
10772
- return true
10773
- }
10706
+ /***/ 1073:
10707
+ /***/ ((module) => {
10774
10708
 
10775
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.js
10776
- /**
10777
- * @param {string} d
10778
- * @returns {string}
10779
- */
10780
- function color(d) {
10781
- return '\u001B[33m' + d + '\u001B[39m'
10782
- }
10709
+ module.exports = {
10710
+ trueFunc: function trueFunc(){
10711
+ return true;
10712
+ },
10713
+ falseFunc: function falseFunc(){
10714
+ return false;
10715
+ }
10716
+ };
10783
10717
 
10784
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
10785
- /**
10786
- * @typedef {import('unist').Node} Node
10787
- * @typedef {import('unist').Parent} Parent
10788
- * @typedef {import('unist-util-is').Test} Test
10789
- * @typedef {import('./complex-types.js').Action} Action
10790
- * @typedef {import('./complex-types.js').Index} Index
10791
- * @typedef {import('./complex-types.js').ActionTuple} ActionTuple
10792
- * @typedef {import('./complex-types.js').VisitorResult} VisitorResult
10793
- * @typedef {import('./complex-types.js').Visitor} Visitor
10794
- */
10718
+ /***/ }),
10795
10719
 
10720
+ /***/ 932:
10721
+ /***/ ((module) => {
10796
10722
 
10723
+ "use strict";
10797
10724
 
10798
10725
 
10799
- /**
10800
- * Continue traversing as normal
10801
- */
10802
- const CONTINUE = true
10803
- /**
10804
- * Do not traverse this node’s children
10805
- */
10806
- const SKIP = 'skip'
10807
- /**
10808
- * Stop traversing immediately
10809
- */
10810
- const EXIT = false
10726
+ module.exports = ccount
10811
10727
 
10812
- /**
10813
- * Visit children of tree which pass test.
10814
- *
10815
- * @param tree
10816
- * Tree to walk
10817
- * @param [test]
10818
- * `unist-util-is`-compatible test
10819
- * @param visitor
10820
- * Function called for nodes that pass `test`.
10821
- * @param [reverse=false]
10822
- * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
10823
- */
10824
- const visitParents =
10825
- /**
10826
- * @type {(
10827
- * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
10828
- * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
10829
- * )}
10830
- */
10831
- (
10832
- /**
10833
- * @param {Node} tree
10834
- * @param {Test} test
10835
- * @param {import('./complex-types.js').Visitor<Node>} visitor
10836
- * @param {boolean} [reverse=false]
10837
- */
10838
- function (tree, test, visitor, reverse) {
10839
- if (typeof test === 'function' && typeof visitor !== 'function') {
10840
- reverse = visitor
10841
- // @ts-expect-error no visitor given, so `visitor` is test.
10842
- visitor = test
10843
- test = null
10844
- }
10728
+ function ccount(value, character) {
10729
+ var val = String(value)
10730
+ var count = 0
10731
+ var index
10845
10732
 
10846
- const is = convert(test)
10847
- const step = reverse ? -1 : 1
10733
+ if (typeof character !== 'string' || character.length !== 1) {
10734
+ throw new Error('Expected character')
10735
+ }
10848
10736
 
10849
- factory(tree, null, [])()
10737
+ index = val.indexOf(character)
10850
10738
 
10851
- /**
10852
- * @param {Node} node
10853
- * @param {number?} index
10854
- * @param {Array<Parent>} parents
10855
- */
10856
- function factory(node, index, parents) {
10857
- /** @type {Record<string, unknown>} */
10858
- // @ts-expect-error: hush
10859
- const value = typeof node === 'object' && node !== null ? node : {}
10860
- /** @type {string|undefined} */
10861
- let name
10739
+ while (index !== -1) {
10740
+ count++
10741
+ index = val.indexOf(character, index + 1)
10742
+ }
10862
10743
 
10863
- if (typeof value.type === 'string') {
10864
- name =
10865
- typeof value.tagName === 'string'
10866
- ? value.tagName
10867
- : typeof value.name === 'string'
10868
- ? value.name
10869
- : undefined
10744
+ return count
10745
+ }
10870
10746
 
10871
- Object.defineProperty(visit, 'name', {
10872
- value:
10873
- 'node (' +
10874
- color(value.type + (name ? '<' + name + '>' : '')) +
10875
- ')'
10876
- })
10877
- }
10878
10747
 
10879
- return visit
10748
+ /***/ }),
10880
10749
 
10881
- function visit() {
10882
- /** @type {ActionTuple} */
10883
- let result = []
10884
- /** @type {ActionTuple} */
10885
- let subresult
10886
- /** @type {number} */
10887
- let offset
10888
- /** @type {Array<Parent>} */
10889
- let grandparents
10750
+ /***/ 6313:
10751
+ /***/ ((module) => {
10890
10752
 
10891
- if (!test || is(node, index, parents[parents.length - 1] || null)) {
10892
- result = toResult(visitor(node, parents))
10753
+ var clone = (function() {
10754
+ 'use strict';
10893
10755
 
10894
- if (result[0] === EXIT) {
10895
- return result
10896
- }
10897
- }
10898
-
10899
- // @ts-expect-error looks like a parent.
10900
- if (node.children && result[0] !== SKIP) {
10901
- // @ts-expect-error looks like a parent.
10902
- offset = (reverse ? node.children.length : -1) + step
10903
- // @ts-expect-error looks like a parent.
10904
- grandparents = parents.concat(node)
10905
-
10906
- // @ts-expect-error looks like a parent.
10907
- while (offset > -1 && offset < node.children.length) {
10908
- // @ts-expect-error looks like a parent.
10909
- subresult = factory(node.children[offset], offset, grandparents)()
10910
-
10911
- if (subresult[0] === EXIT) {
10912
- return subresult
10913
- }
10914
-
10915
- offset =
10916
- typeof subresult[1] === 'number' ? subresult[1] : offset + step
10917
- }
10918
- }
10919
-
10920
- return result
10921
- }
10922
- }
10923
- }
10924
- )
10925
-
10926
- /**
10927
- * @param {VisitorResult} value
10928
- * @returns {ActionTuple}
10929
- */
10930
- function toResult(value) {
10931
- if (Array.isArray(value)) {
10932
- return value
10933
- }
10934
-
10935
- if (typeof value === 'number') {
10936
- return [CONTINUE, value]
10937
- }
10938
-
10939
- return [value]
10940
- }
10941
-
10942
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/index.js
10943
- /**
10944
- * @typedef {import('unist').Node} Node
10945
- * @typedef {import('unist').Parent} Parent
10946
- * @typedef {import('unist-util-is').Test} Test
10947
- * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
10948
- * @typedef {import('./complex-types.js').Visitor} Visitor
10949
- */
10950
-
10951
-
10952
-
10953
- /**
10954
- * Visit children of tree which pass test.
10955
- *
10956
- * @param tree
10957
- * Tree to walk
10958
- * @param [test]
10959
- * `unist-util-is`-compatible test
10960
- * @param visitor
10961
- * Function called for nodes that pass `test`.
10962
- * @param reverse
10963
- * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
10964
- */
10965
- const visit =
10966
- /**
10967
- * @type {(
10968
- * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
10969
- * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
10970
- * )}
10971
- */
10972
- (
10973
- /**
10974
- * @param {Node} tree
10975
- * @param {Test} test
10976
- * @param {import('./complex-types.js').Visitor} visitor
10977
- * @param {boolean} [reverse]
10978
- */
10979
- function (tree, test, visitor, reverse) {
10980
- if (typeof test === 'function' && typeof visitor !== 'function') {
10981
- reverse = visitor
10982
- visitor = test
10983
- test = null
10984
- }
10985
-
10986
- visitParents(tree, test, overload, reverse)
10987
-
10988
- /**
10989
- * @param {Node} node
10990
- * @param {Array<Parent>} parents
10991
- */
10992
- function overload(node, parents) {
10993
- const parent = parents[parents.length - 1]
10994
- return visitor(
10995
- node,
10996
- parent ? parent.children.indexOf(node) : null,
10997
- parent
10998
- )
10999
- }
11000
- }
11001
- )
11002
-
11003
-
11004
-
11005
- ;// CONCATENATED MODULE: ./processor/transform/reusable-content.js
11006
-
11007
-
11008
-
11009
- function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf_default()(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { var i = g[name]; if ("number" == typeof i) groups[name] = result[i];else { for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) { k++; } groups[name] = result[i[k]]; } return groups; }, Object.create(null)); } return inherits_default()(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != typeof_default()(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
11010
-
11011
- var type = 'reusable-content';
11012
- var regexp = /*#__PURE__*/_wrapRegExp(/^\s*<ReadMeReusableContent name="(.*)" \/>\s*$/, {
11013
- name: 1
11014
- });
11015
- var reusableContentTransformer = function reusableContentTransformer() {
11016
- var reusableContent = this.data('reusableContent');
11017
- return function (tree) {
11018
- visit(tree, 'html', function (node, index, parent) {
11019
- var result = regexp.exec(node.value);
11020
- if (!result || !result.groups.name) return;
11021
- var name = result.groups.name;
11022
- var block = {
11023
- type: type,
11024
- name: name,
11025
- children: name in reusableContent ? reusableContent[name] : []
11026
- };
11027
- parent.children[index] = block;
11028
- });
11029
- return tree;
11030
- };
11031
- };
11032
- /* harmony default export */ const reusable_content = (reusableContentTransformer);
11033
- ;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
11034
-
11035
- var singleCodeTabs = function singleCodeTabs() {
11036
- return function (tree) {
11037
- visit(tree, function (node, index, parent) {
11038
- if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
11039
- Object.assign(node, {
11040
- className: 'tab-panel',
11041
- data: {
11042
- hName: 'code',
11043
- hProperties: {
11044
- meta: node.meta,
11045
- lang: node.lang
11046
- }
11047
- }
11048
- });
11049
- parent.children[index] = {
11050
- type: 'code-tabs',
11051
- className: 'tabs',
11052
- data: {
11053
- hName: 'div',
11054
- hProperties: {
11055
- className: ['code-tabs']
11056
- }
11057
- },
11058
- children: [node]
11059
- };
11060
- }
11061
- });
11062
- return tree;
11063
- };
11064
- };
11065
- /* harmony default export */ const single_code_tabs = (singleCodeTabs);
11066
- ;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
11067
-
11068
- var rxEscapedPipe = /\\\|/g;
11069
-
11070
- /**
11071
- * HAST Transformer that finds all inline code nodes within table cells and
11072
- * unescapes any escaped pipe chars so that the editor outputs them without
11073
- * escape chars.
11074
- *
11075
- * This appears to be a bug with remark-parse < ~8
11076
- */
11077
- var tableCellInlineCode = function tableCellInlineCode() {
11078
- return function (tree) {
11079
- visit(tree, [{
11080
- tagName: 'th'
11081
- }, {
11082
- tagName: 'td'
11083
- }], function (tableCellNode) {
11084
- visit(tableCellNode, {
11085
- tagName: 'code'
11086
- }, function (inlineCodeNode) {
11087
- var textNode = inlineCodeNode.children[0];
11088
- if (textNode && rxEscapedPipe.test(textNode.value)) {
11089
- textNode.value = textNode.value.replace(rxEscapedPipe, '|');
11090
- }
11091
- });
11092
- return SKIP;
11093
- });
11094
- };
11095
- };
11096
- /* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
11097
- ;// CONCATENATED MODULE: ./processor/transform/index.js
11098
-
11099
-
11100
-
11101
- var remarkTransformers = [single_code_tabs, reusable_content];
11102
- var rehypeTransformers = [table_cell_inline_code];
11103
-
11104
- /***/ }),
11105
-
11106
- /***/ 8229:
11107
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
11108
-
11109
- var _require = __webpack_require__(2781),
11110
- defaultSchema = _require.defaultSchema;
11111
- var createSchema = function createSchema() {
11112
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
11113
- safeMode = _ref.safeMode;
11114
- var schema = JSON.parse(JSON.stringify(defaultSchema));
11115
-
11116
- // Sanitization Schema Defaults
11117
- schema.clobberPrefix = '';
11118
- schema.tagNames.push('span');
11119
- schema.attributes['*'].push('class', 'className', 'align');
11120
- if (!safeMode) {
11121
- schema.attributes['*'].push('style');
11122
- }
11123
- schema.tagNames.push('rdme-pin');
11124
- schema.tagNames.push('rdme-embed');
11125
- schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
11126
- schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
11127
- schema.tagNames.push('figure');
11128
- schema.tagNames.push('figcaption');
11129
- schema.tagNames.push('input'); // allow GitHub-style todo lists
11130
- schema.ancestors.input = ['li'];
11131
- schema.tagNames.push('colgroup'); // wat
11132
- schema.tagNames.push('col');
11133
- return schema;
11134
- };
11135
- module.exports = createSchema;
11136
-
11137
- /***/ }),
11138
-
11139
- /***/ 8841:
11140
- /***/ ((module) => {
11141
-
11142
- "use strict";
11143
-
11144
-
11145
- module.exports = bail
11146
-
11147
- function bail(err) {
11148
- if (err) {
11149
- throw err
11150
- }
11151
- }
11152
-
11153
-
11154
- /***/ }),
11155
-
11156
- /***/ 1073:
11157
- /***/ ((module) => {
11158
-
11159
- module.exports = {
11160
- trueFunc: function trueFunc(){
11161
- return true;
11162
- },
11163
- falseFunc: function falseFunc(){
11164
- return false;
11165
- }
11166
- };
11167
-
11168
- /***/ }),
11169
-
11170
- /***/ 932:
11171
- /***/ ((module) => {
11172
-
11173
- "use strict";
11174
-
11175
-
11176
- module.exports = ccount
11177
-
11178
- function ccount(value, character) {
11179
- var val = String(value)
11180
- var count = 0
11181
- var index
11182
-
11183
- if (typeof character !== 'string' || character.length !== 1) {
11184
- throw new Error('Expected character')
11185
- }
11186
-
11187
- index = val.indexOf(character)
11188
-
11189
- while (index !== -1) {
11190
- count++
11191
- index = val.indexOf(character, index + 1)
11192
- }
11193
-
11194
- return count
11195
- }
11196
-
11197
-
11198
- /***/ }),
11199
-
11200
- /***/ 6313:
11201
- /***/ ((module) => {
11202
-
11203
- var clone = (function() {
11204
- 'use strict';
11205
-
11206
- function _instanceof(obj, type) {
11207
- return type != null && obj instanceof type;
11208
- }
10756
+ function _instanceof(obj, type) {
10757
+ return type != null && obj instanceof type;
10758
+ }
11209
10759
 
11210
10760
  var nativeMap;
11211
10761
  try {
@@ -32657,745 +32207,972 @@ const defaultSchema = {
32657
32207
  }
32658
32208
 
32659
32209
 
32660
- /***/ }),
32210
+ /***/ }),
32211
+
32212
+ /***/ 1445:
32213
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
32214
+
32215
+ "use strict";
32216
+ __webpack_require__.r(__webpack_exports__);
32217
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32218
+ /* harmony export */ "map": () => (/* binding */ map)
32219
+ /* harmony export */ });
32220
+ /**
32221
+ * @typedef {import('unist').Node} Node
32222
+ */
32223
+
32224
+ /**
32225
+ * @template {Node} [Tree=Node]
32226
+ * @typedef {import('./complex-types.js').MapFunction<Tree>} MapFunction
32227
+ * Function called with a node, its index, and its parent to produce a new
32228
+ * node.
32229
+ */
32230
+
32231
+ /**
32232
+ * Create a new tree by mapping all nodes with the given function.
32233
+ *
32234
+ * @template {Node} Tree
32235
+ * Type of input tree.
32236
+ * @param {Tree} tree
32237
+ * Tree to map.
32238
+ * @param {MapFunction<Tree>} mapFunction
32239
+ * Function called with a node, its index, and its parent to produce a new
32240
+ * node.
32241
+ * @returns {Tree}
32242
+ * New mapped tree.
32243
+ */
32244
+ function map(tree, mapFunction) {
32245
+ // @ts-expect-error Looks like a children.
32246
+ return preorder(tree, null, null)
32247
+
32248
+ /** @type {import('./complex-types').MapFunction<Tree>} */
32249
+ function preorder(node, index, parent) {
32250
+ var newNode = Object.assign({}, mapFunction(node, index, parent))
32251
+
32252
+ if ('children' in node) {
32253
+ // @ts-expect-error Looks like a parent.
32254
+ newNode.children = node.children.map(function (
32255
+ /** @type {import('./complex-types').InclusiveDescendant<Tree>} */ child,
32256
+ /** @type {number} */ index
32257
+ ) {
32258
+ return preorder(child, index, node)
32259
+ })
32260
+ }
32261
+
32262
+ return newNode
32263
+ }
32264
+ }
32265
+
32266
+
32267
+ /***/ }),
32268
+
32269
+ /***/ 5907:
32270
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
32271
+
32272
+ "use strict";
32273
+ // ESM COMPAT FLAG
32274
+ __webpack_require__.r(__webpack_exports__);
32275
+
32276
+ // EXPORTS
32277
+ __webpack_require__.d(__webpack_exports__, {
32278
+ "matches": () => (/* binding */ unist_util_select_matches),
32279
+ "select": () => (/* binding */ unist_util_select_select),
32280
+ "selectAll": () => (/* binding */ selectAll)
32281
+ });
32282
+
32283
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/zwitch/index.js
32284
+ var own = {}.hasOwnProperty
32285
+
32286
+ /**
32287
+ * @callback Handler
32288
+ * @param {...unknown} value
32289
+ * @return {unknown}
32290
+ *
32291
+ * @typedef {Record<string, Handler>} Handlers
32292
+ *
32293
+ * @typedef {Object} Options
32294
+ * @property {Handler} [unknown]
32295
+ * @property {Handler} [invalid]
32296
+ * @property {Handlers} [handlers]
32297
+ */
32298
+
32299
+ /**
32300
+ * Handle values based on a property.
32301
+ *
32302
+ * @param {string} key
32303
+ * @param {Options} [options]
32304
+ */
32305
+ function zwitch(key, options) {
32306
+ var settings = options || {}
32307
+
32308
+ /**
32309
+ * Handle one value.
32310
+ * Based on the bound `key`, a respective handler will be called.
32311
+ * If `value` is not an object, or doesn’t have a `key` property, the special
32312
+ * “invalid” handler will be called.
32313
+ * If `value` has an unknown `key`, the special “unknown” handler will be
32314
+ * called.
32315
+ *
32316
+ * All arguments, and the context object, are passed through to the handler,
32317
+ * and it’s result is returned.
32318
+ *
32319
+ * @param {...unknown} [value]
32320
+ * @this {unknown}
32321
+ * @returns {unknown}
32322
+ * @property {Handler} invalid
32323
+ * @property {Handler} unknown
32324
+ * @property {Handlers} handlers
32325
+ */
32326
+ function one(value) {
32327
+ var fn = one.invalid
32328
+ var handlers = one.handlers
32329
+
32330
+ if (value && own.call(value, key)) {
32331
+ fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
32332
+ }
32333
+
32334
+ if (fn) {
32335
+ return fn.apply(this, arguments)
32336
+ }
32337
+ }
32338
+
32339
+ one.handlers = settings.handlers || {}
32340
+ one.invalid = settings.invalid
32341
+ one.unknown = settings.unknown
32342
+
32343
+ return one
32344
+ }
32345
+
32346
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/util.js
32347
+ /**
32348
+ * @typedef {import('./types.js').Selector} Selector
32349
+ * @typedef {import('./types.js').Selectors} Selectors
32350
+ * @typedef {import('./types.js').Rule} Rule
32351
+ * @typedef {import('./types.js').RuleSet} RuleSet
32352
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
32353
+ * @typedef {import('./types.js').Query} Query
32354
+ * @typedef {import('./types.js').Node} Node
32355
+ * @typedef {import('./types.js').Parent} Parent
32356
+ * @typedef {import('./types.js').SelectIterator} SelectIterator
32357
+ * @typedef {import('./types.js').SelectState} SelectState
32358
+ */
32359
+
32360
+ /**
32361
+ * @param {Node} node
32362
+ * @returns {node is Parent}
32363
+ */
32364
+ function root(node) {
32365
+ return (
32366
+ // Root in nlcst.
32367
+ node.type === 'RootNode' ||
32368
+ // Rest
32369
+ node.type === 'root'
32370
+ )
32371
+ }
32372
+
32373
+ /**
32374
+ * @param {Node} node
32375
+ * @returns {node is Parent}
32376
+ */
32377
+ function util_parent(node) {
32378
+ return Array.isArray(node.children)
32379
+ }
32380
+
32381
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/nest.js
32382
+ /**
32383
+ * @typedef {import('./types.js').Rule} Rule
32384
+ * @typedef {import('./types.js').Query} Query
32385
+ * @typedef {import('./types.js').Node} Node
32386
+ * @typedef {import('./types.js').Parent} Parent
32387
+ * @typedef {import('./types.js').SelectState} SelectState
32388
+ * @typedef {import('./types.js').SelectIterator} SelectIterator
32389
+ * @typedef {import('./types.js').Handler} Handler
32390
+ */
32391
+
32392
+
32393
+
32394
+
32395
+ var nest_own = {}.hasOwnProperty
32396
+
32397
+ var handle = zwitch('nestingOperator', {
32398
+ unknown: unknownNesting,
32399
+ invalid: topScan, // `undefined` is the top query selector.
32400
+ handlers: {
32401
+ null: descendant, // `null` is the descendant combinator.
32402
+ '>': child,
32403
+ '+': adjacentSibling,
32404
+ '~': generalSibling
32405
+ }
32406
+ })
32407
+
32408
+ /** @type {Handler} */
32409
+ function nest(query, node, index, parent, state) {
32410
+ return handle(query, node, index, parent, state)
32411
+ }
32412
+
32413
+ // Shouldn’t be invoked, parser gives correct data.
32414
+ /* c8 ignore next 6 */
32415
+ /**
32416
+ * @param {{[x: string]: unknown, type: string}} query
32417
+ */
32418
+ function unknownNesting(query) {
32419
+ throw new Error('Unexpected nesting `' + query.nestingOperator + '`')
32420
+ }
32421
+
32422
+ /** @type {Handler} */
32423
+ function topScan(query, node, index, parent, state) {
32424
+ // Shouldn’t happen.
32425
+ /* c8 ignore next 3 */
32426
+ if (parent) {
32427
+ throw new Error('topScan is supposed to be called from the root node')
32428
+ }
32429
+
32430
+ state.iterator(query, node, index, parent, state)
32431
+ if (!state.shallow) descendant(query, node, index, parent, state)
32432
+ }
32433
+
32434
+ /** @type {Handler} */
32435
+ function descendant(query, node, index, parent, state) {
32436
+ var previous = state.iterator
32437
+
32438
+ state.iterator = iterator
32439
+ child(query, node, index, parent, state)
32661
32440
 
32662
- /***/ 1445:
32663
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
32441
+ /** @type {SelectIterator} */
32442
+ function iterator(query, node, index, parent, state) {
32443
+ state.iterator = previous
32444
+ previous(query, node, index, parent, state)
32445
+ state.iterator = iterator
32664
32446
 
32665
- "use strict";
32666
- __webpack_require__.r(__webpack_exports__);
32667
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32668
- /* harmony export */ "map": () => (/* binding */ map)
32669
- /* harmony export */ });
32670
- /**
32671
- * @typedef {import('unist').Node} Node
32672
- */
32447
+ if (state.one && state.found) return
32673
32448
 
32674
- /**
32675
- * @template {Node} [Tree=Node]
32676
- * @typedef {import('./complex-types.js').MapFunction<Tree>} MapFunction
32677
- * Function called with a node, its index, and its parent to produce a new
32678
- * node.
32679
- */
32449
+ child(query, node, index, parent, state)
32450
+ }
32451
+ }
32680
32452
 
32681
- /**
32682
- * Create a new tree by mapping all nodes with the given function.
32683
- *
32684
- * @template {Node} Tree
32685
- * Type of input tree.
32686
- * @param {Tree} tree
32687
- * Tree to map.
32688
- * @param {MapFunction<Tree>} mapFunction
32689
- * Function called with a node, its index, and its parent to produce a new
32690
- * node.
32691
- * @returns {Tree}
32692
- * New mapped tree.
32693
- */
32694
- function map(tree, mapFunction) {
32695
- // @ts-expect-error Looks like a children.
32696
- return preorder(tree, null, null)
32453
+ /** @type {Handler} */
32454
+ function child(query, node, _1, _2, state) {
32455
+ if (!util_parent(node)) return
32456
+ if (node.children.length === 0) return
32697
32457
 
32698
- /** @type {import('./complex-types').MapFunction<Tree>} */
32699
- function preorder(node, index, parent) {
32700
- var newNode = Object.assign({}, mapFunction(node, index, parent))
32458
+ new WalkIterator(query, node, state).each().done()
32459
+ }
32701
32460
 
32702
- if ('children' in node) {
32703
- // @ts-expect-error Looks like a parent.
32704
- newNode.children = node.children.map(function (
32705
- /** @type {import('./complex-types').InclusiveDescendant<Tree>} */ child,
32706
- /** @type {number} */ index
32707
- ) {
32708
- return preorder(child, index, node)
32709
- })
32461
+ /** @type {Handler} */
32462
+ function adjacentSibling(query, _, index, parent, state) {
32463
+ // Shouldn’t happen.
32464
+ /* c8 ignore next */
32465
+ if (!parent) return
32466
+
32467
+ new WalkIterator(query, parent, state)
32468
+ .prefillTypeIndex(0, ++index)
32469
+ .each(index, ++index)
32470
+ .prefillTypeIndex(index)
32471
+ .done()
32472
+ }
32473
+
32474
+ /** @type {Handler} */
32475
+ function generalSibling(query, _, index, parent, state) {
32476
+ // Shouldn’t happen.
32477
+ /* c8 ignore next */
32478
+ if (!parent) return
32479
+
32480
+ new WalkIterator(query, parent, state)
32481
+ .prefillTypeIndex(0, ++index)
32482
+ .each(index)
32483
+ .done()
32484
+ }
32485
+
32486
+ class WalkIterator {
32487
+ /**
32488
+ * Handles typeIndex and typeCount properties for every walker.
32489
+ *
32490
+ * @param {Rule} query
32491
+ * @param {Parent} parent
32492
+ * @param {SelectState} state
32493
+ */
32494
+ constructor(query, parent, state) {
32495
+ /** @type {Rule} */
32496
+ this.query = query
32497
+ /** @type {Parent} */
32498
+ this.parent = parent
32499
+ /** @type {SelectState} */
32500
+ this.state = state
32501
+ /** @type {TypeIndex|undefined} */
32502
+ this.typeIndex = state.index ? new TypeIndex() : undefined
32503
+ /** @type {Array.<Function>} */
32504
+ this.delayed = []
32505
+ }
32506
+
32507
+ /**
32508
+ * @param {number|null|undefined} [x]
32509
+ * @param {number|null|undefined} [y]
32510
+ * @returns {this}
32511
+ */
32512
+ prefillTypeIndex(x, y) {
32513
+ var [start, end] = this.defaults(x, y)
32514
+
32515
+ if (this.typeIndex) {
32516
+ while (start < end) {
32517
+ this.typeIndex.index(this.parent.children[start])
32518
+ start++
32519
+ }
32710
32520
  }
32711
32521
 
32712
- return newNode
32522
+ return this
32713
32523
  }
32714
- }
32715
32524
 
32525
+ /**
32526
+ * @param {number|null|undefined} [x]
32527
+ * @param {number|null|undefined} [y]
32528
+ * @returns {this}
32529
+ */
32530
+ each(x, y) {
32531
+ var [start, end] = this.defaults(x, y)
32532
+ var child = this.parent.children[start]
32533
+ /** @type {number} */
32534
+ var index
32535
+ /** @type {number} */
32536
+ var nodeIndex
32716
32537
 
32717
- /***/ }),
32538
+ if (start >= end) return this
32718
32539
 
32719
- /***/ 5907:
32720
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
32540
+ if (this.typeIndex) {
32541
+ nodeIndex = this.typeIndex.nodes
32542
+ index = this.typeIndex.index(child)
32543
+ this.delayed.push(delay)
32544
+ } else {
32545
+ this.state.iterator(this.query, child, start, this.parent, this.state)
32546
+ }
32721
32547
 
32722
- "use strict";
32723
- // ESM COMPAT FLAG
32724
- __webpack_require__.r(__webpack_exports__);
32548
+ // Stop if we’re looking for one node and it’s already found.
32549
+ if (this.state.one && this.state.found) return this
32725
32550
 
32726
- // EXPORTS
32727
- __webpack_require__.d(__webpack_exports__, {
32728
- "matches": () => (/* binding */ unist_util_select_matches),
32729
- "select": () => (/* binding */ unist_util_select_select),
32730
- "selectAll": () => (/* binding */ selectAll)
32731
- });
32551
+ return this.each(start + 1, end)
32732
32552
 
32733
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/zwitch/index.js
32734
- var own = {}.hasOwnProperty
32553
+ /**
32554
+ * @this {WalkIterator}
32555
+ */
32556
+ function delay() {
32557
+ this.state.typeIndex = index
32558
+ this.state.nodeIndex = nodeIndex
32559
+ this.state.typeCount = this.typeIndex.count(child)
32560
+ this.state.nodeCount = this.typeIndex.nodes
32561
+ this.state.iterator(this.query, child, start, this.parent, this.state)
32562
+ }
32563
+ }
32735
32564
 
32736
- /**
32737
- * @callback Handler
32738
- * @param {...unknown} value
32739
- * @return {unknown}
32740
- *
32741
- * @typedef {Record<string, Handler>} Handlers
32742
- *
32743
- * @typedef {Object} Options
32744
- * @property {Handler} [unknown]
32745
- * @property {Handler} [invalid]
32746
- * @property {Handlers} [handlers]
32747
- */
32565
+ /**
32566
+ * Done!
32567
+ * @returns {this}
32568
+ */
32569
+ done() {
32570
+ var index = -1
32748
32571
 
32749
- /**
32750
- * Handle values based on a property.
32751
- *
32752
- * @param {string} key
32753
- * @param {Options} [options]
32754
- */
32755
- function zwitch(key, options) {
32756
- var settings = options || {}
32572
+ while (++index < this.delayed.length) {
32573
+ this.delayed[index].call(this)
32574
+ if (this.state.one && this.state.found) break
32575
+ }
32576
+
32577
+ return this
32578
+ }
32757
32579
 
32758
32580
  /**
32759
- * Handle one value.
32760
- * Based on the bound `key`, a respective handler will be called.
32761
- * If `value` is not an object, or doesn’t have a `key` property, the special
32762
- * “invalid” handler will be called.
32763
- * If `value` has an unknown `key`, the special “unknown” handler will be
32764
- * called.
32765
- *
32766
- * All arguments, and the context object, are passed through to the handler,
32767
- * and it’s result is returned.
32768
- *
32769
- * @param {...unknown} [value]
32770
- * @this {unknown}
32771
- * @returns {unknown}
32772
- * @property {Handler} invalid
32773
- * @property {Handler} unknown
32774
- * @property {Handlers} handlers
32581
+ * @param {number|null|undefined} [start]
32582
+ * @param {number|null|undefined} [end]
32583
+ * @returns {[number, number]}
32775
32584
  */
32776
- function one(value) {
32777
- var fn = one.invalid
32778
- var handlers = one.handlers
32585
+ defaults(start, end) {
32586
+ if (start === null || start === undefined || start < 0) start = 0
32587
+ if (end === null || end === undefined || end > this.parent.children.length)
32588
+ end = this.parent.children.length
32589
+ return [start, end]
32590
+ }
32591
+ }
32592
+
32593
+ class TypeIndex {
32594
+ constructor() {
32595
+ /** @type {Object.<string, number>} */
32596
+ this.counts = {}
32597
+ /** @type {number} */
32598
+ this.nodes = 0
32599
+ }
32600
+
32601
+ /**
32602
+ * @param {Node} node
32603
+ * @returns {number}
32604
+ */
32605
+ index(node) {
32606
+ var type = node.type
32607
+
32608
+ this.nodes++
32779
32609
 
32780
- if (value && own.call(value, key)) {
32781
- fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
32782
- }
32610
+ if (!nest_own.call(this.counts, type)) this.counts[type] = 0
32783
32611
 
32784
- if (fn) {
32785
- return fn.apply(this, arguments)
32786
- }
32612
+ // Note: `++` is intended to be postfixed!
32613
+ return this.counts[type]++
32787
32614
  }
32788
32615
 
32789
- one.handlers = settings.handlers || {}
32790
- one.invalid = settings.invalid
32791
- one.unknown = settings.unknown
32792
-
32793
- return one
32616
+ /**
32617
+ * @param {Node} node
32618
+ * @returns {number|undefined}
32619
+ */
32620
+ count(node) {
32621
+ return this.counts[node.type]
32622
+ }
32794
32623
  }
32795
32624
 
32796
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/util.js
32625
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
32797
32626
  /**
32798
- * @typedef {import('./types.js').Selector} Selector
32799
- * @typedef {import('./types.js').Selectors} Selectors
32800
- * @typedef {import('./types.js').Rule} Rule
32801
- * @typedef {import('./types.js').RuleSet} RuleSet
32802
- * @typedef {import('./types.js').RulePseudo} RulePseudo
32803
- * @typedef {import('./types.js').Query} Query
32804
- * @typedef {import('./types.js').Node} Node
32805
- * @typedef {import('./types.js').Parent} Parent
32806
- * @typedef {import('./types.js').SelectIterator} SelectIterator
32807
- * @typedef {import('./types.js').SelectState} SelectState
32627
+ * @typedef {import('unist').Node} Node
32628
+ * @typedef {import('unist').Parent} Parent
32629
+ *
32630
+ * @typedef {string} Type
32631
+ * @typedef {Object<string, unknown>} Props
32632
+ *
32633
+ * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
32808
32634
  */
32809
32635
 
32810
32636
  /**
32637
+ * Check if a node passes a test
32638
+ *
32639
+ * @callback TestFunctionAnything
32811
32640
  * @param {Node} node
32812
- * @returns {node is Parent}
32641
+ * @param {number} [index]
32642
+ * @param {Parent} [parent]
32643
+ * @returns {boolean|void}
32813
32644
  */
32814
- function root(node) {
32815
- return (
32816
- // Root in nlcst.
32817
- node.type === 'RootNode' ||
32818
- // Rest
32819
- node.type === 'root'
32820
- )
32821
- }
32822
32645
 
32823
32646
  /**
32647
+ * Check if a node passes a certain node test
32648
+ *
32649
+ * @template {Node} X
32650
+ * @callback TestFunctionPredicate
32824
32651
  * @param {Node} node
32825
- * @returns {node is Parent}
32652
+ * @param {number} [index]
32653
+ * @param {Parent} [parent]
32654
+ * @returns {node is X}
32826
32655
  */
32827
- function util_parent(node) {
32828
- return Array.isArray(node.children)
32829
- }
32830
32656
 
32831
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/nest.js
32832
32657
  /**
32833
- * @typedef {import('./types.js').Rule} Rule
32834
- * @typedef {import('./types.js').Query} Query
32835
- * @typedef {import('./types.js').Node} Node
32836
- * @typedef {import('./types.js').Parent} Parent
32837
- * @typedef {import('./types.js').SelectState} SelectState
32838
- * @typedef {import('./types.js').SelectIterator} SelectIterator
32839
- * @typedef {import('./types.js').Handler} Handler
32658
+ * @callback AssertAnything
32659
+ * @param {unknown} [node]
32660
+ * @param {number} [index]
32661
+ * @param {Parent} [parent]
32662
+ * @returns {boolean}
32840
32663
  */
32841
32664
 
32665
+ /**
32666
+ * Check if a node passes a certain node test
32667
+ *
32668
+ * @template {Node} Y
32669
+ * @callback AssertPredicate
32670
+ * @param {unknown} [node]
32671
+ * @param {number} [index]
32672
+ * @param {Parent} [parent]
32673
+ * @returns {node is Y}
32674
+ */
32842
32675
 
32676
+ var is =
32677
+ /**
32678
+ * Check if a node passes a test.
32679
+ * When a `parent` node is known the `index` of node should also be given.
32680
+ *
32681
+ * @type {(
32682
+ * (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number, parent?: Parent, context?: unknown) => node is T) &
32683
+ * ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
32684
+ * )}
32685
+ */
32686
+ (
32687
+ /**
32688
+ * Check if a node passes a test.
32689
+ * When a `parent` node is known the `index` of node should also be given.
32690
+ *
32691
+ * @param {unknown} [node] Node to check
32692
+ * @param {Test} [test]
32693
+ * When nullish, checks if `node` is a `Node`.
32694
+ * When `string`, works like passing `function (node) {return node.type === test}`.
32695
+ * When `function` checks if function passed the node is true.
32696
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
32697
+ * When `array`, checks any one of the subtests pass.
32698
+ * @param {number} [index] Position of `node` in `parent`
32699
+ * @param {Parent} [parent] Parent of `node`
32700
+ * @param {unknown} [context] Context object to invoke `test` with
32701
+ * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
32702
+ */
32703
+ // eslint-disable-next-line max-params
32704
+ function is(node, test, index, parent, context) {
32705
+ var check = convert(test)
32843
32706
 
32707
+ if (
32708
+ index !== undefined &&
32709
+ index !== null &&
32710
+ (typeof index !== 'number' ||
32711
+ index < 0 ||
32712
+ index === Number.POSITIVE_INFINITY)
32713
+ ) {
32714
+ throw new Error('Expected positive finite index')
32715
+ }
32844
32716
 
32845
- var nest_own = {}.hasOwnProperty
32846
-
32847
- var handle = zwitch('nestingOperator', {
32848
- unknown: unknownNesting,
32849
- invalid: topScan, // `undefined` is the top query selector.
32850
- handlers: {
32851
- null: descendant, // `null` is the descendant combinator.
32852
- '>': child,
32853
- '+': adjacentSibling,
32854
- '~': generalSibling
32855
- }
32856
- })
32857
-
32858
- /** @type {Handler} */
32859
- function nest(query, node, index, parent, state) {
32860
- return handle(query, node, index, parent, state)
32861
- }
32717
+ if (
32718
+ parent !== undefined &&
32719
+ parent !== null &&
32720
+ (!is(parent) || !parent.children)
32721
+ ) {
32722
+ throw new Error('Expected parent node')
32723
+ }
32862
32724
 
32863
- // Shouldn’t be invoked, parser gives correct data.
32864
- /* c8 ignore next 6 */
32865
- /**
32866
- * @param {{[x: string]: unknown, type: string}} query
32867
- */
32868
- function unknownNesting(query) {
32869
- throw new Error('Unexpected nesting `' + query.nestingOperator + '`')
32870
- }
32725
+ if (
32726
+ (parent === undefined || parent === null) !==
32727
+ (index === undefined || index === null)
32728
+ ) {
32729
+ throw new Error('Expected both parent and index')
32730
+ }
32871
32731
 
32872
- /** @type {Handler} */
32873
- function topScan(query, node, index, parent, state) {
32874
- // Shouldn’t happen.
32875
- /* c8 ignore next 3 */
32876
- if (parent) {
32877
- throw new Error('topScan is supposed to be called from the root node')
32878
- }
32732
+ // @ts-ignore Looks like a node.
32733
+ return node && node.type && typeof node.type === 'string'
32734
+ ? Boolean(check.call(context, node, index, parent))
32735
+ : false
32736
+ }
32737
+ )
32879
32738
 
32880
- state.iterator(query, node, index, parent, state)
32881
- if (!state.shallow) descendant(query, node, index, parent, state)
32882
- }
32739
+ var convert =
32740
+ /**
32741
+ * @type {(
32742
+ * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
32743
+ * ((test?: Test) => AssertAnything)
32744
+ * )}
32745
+ */
32746
+ (
32747
+ /**
32748
+ * Generate an assertion from a check.
32749
+ * @param {Test} [test]
32750
+ * When nullish, checks if `node` is a `Node`.
32751
+ * When `string`, works like passing `function (node) {return node.type === test}`.
32752
+ * When `function` checks if function passed the node is true.
32753
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
32754
+ * When `array`, checks any one of the subtests pass.
32755
+ * @returns {AssertAnything}
32756
+ */
32757
+ function (test) {
32758
+ if (test === undefined || test === null) {
32759
+ return ok
32760
+ }
32883
32761
 
32884
- /** @type {Handler} */
32885
- function descendant(query, node, index, parent, state) {
32886
- var previous = state.iterator
32762
+ if (typeof test === 'string') {
32763
+ return typeFactory(test)
32764
+ }
32887
32765
 
32888
- state.iterator = iterator
32889
- child(query, node, index, parent, state)
32766
+ if (typeof test === 'object') {
32767
+ // @ts-ignore looks like a list of tests / partial test object.
32768
+ return 'length' in test ? anyFactory(test) : propsFactory(test)
32769
+ }
32890
32770
 
32891
- /** @type {SelectIterator} */
32892
- function iterator(query, node, index, parent, state) {
32893
- state.iterator = previous
32894
- previous(query, node, index, parent, state)
32895
- state.iterator = iterator
32771
+ if (typeof test === 'function') {
32772
+ return castFactory(test)
32773
+ }
32896
32774
 
32897
- if (state.one && state.found) return
32775
+ throw new Error('Expected function, string, or object as test')
32776
+ }
32777
+ )
32778
+ /**
32779
+ * @param {Array.<Type|Props|TestFunctionAnything>} tests
32780
+ * @returns {AssertAnything}
32781
+ */
32782
+ function anyFactory(tests) {
32783
+ /** @type {Array.<AssertAnything>} */
32784
+ var checks = []
32785
+ var index = -1
32898
32786
 
32899
- child(query, node, index, parent, state)
32787
+ while (++index < tests.length) {
32788
+ checks[index] = convert(tests[index])
32900
32789
  }
32901
- }
32902
32790
 
32903
- /** @type {Handler} */
32904
- function child(query, node, _1, _2, state) {
32905
- if (!util_parent(node)) return
32906
- if (node.children.length === 0) return
32791
+ return castFactory(any)
32907
32792
 
32908
- new WalkIterator(query, node, state).each().done()
32793
+ /**
32794
+ * @this {unknown}
32795
+ * @param {unknown[]} parameters
32796
+ * @returns {boolean}
32797
+ */
32798
+ function any(...parameters) {
32799
+ var index = -1
32800
+
32801
+ while (++index < checks.length) {
32802
+ if (checks[index].call(this, ...parameters)) return true
32803
+ }
32804
+ }
32909
32805
  }
32910
32806
 
32911
- /** @type {Handler} */
32912
- function adjacentSibling(query, _, index, parent, state) {
32913
- // Shouldn’t happen.
32914
- /* c8 ignore next */
32915
- if (!parent) return
32807
+ /**
32808
+ * Utility to assert each property in `test` is represented in `node`, and each
32809
+ * values are strictly equal.
32810
+ *
32811
+ * @param {Props} check
32812
+ * @returns {AssertAnything}
32813
+ */
32814
+ function propsFactory(check) {
32815
+ return castFactory(all)
32916
32816
 
32917
- new WalkIterator(query, parent, state)
32918
- .prefillTypeIndex(0, ++index)
32919
- .each(index, ++index)
32920
- .prefillTypeIndex(index)
32921
- .done()
32922
- }
32817
+ /**
32818
+ * @param {Node} node
32819
+ * @returns {boolean}
32820
+ */
32821
+ function all(node) {
32822
+ /** @type {string} */
32823
+ var key
32923
32824
 
32924
- /** @type {Handler} */
32925
- function generalSibling(query, _, index, parent, state) {
32926
- // Shouldn’t happen.
32927
- /* c8 ignore next */
32928
- if (!parent) return
32825
+ for (key in check) {
32826
+ if (node[key] !== check[key]) return
32827
+ }
32929
32828
 
32930
- new WalkIterator(query, parent, state)
32931
- .prefillTypeIndex(0, ++index)
32932
- .each(index)
32933
- .done()
32829
+ return true
32830
+ }
32934
32831
  }
32935
32832
 
32936
- class WalkIterator {
32833
+ /**
32834
+ * Utility to convert a string into a function which checks a given node’s type
32835
+ * for said string.
32836
+ *
32837
+ * @param {Type} check
32838
+ * @returns {AssertAnything}
32839
+ */
32840
+ function typeFactory(check) {
32841
+ return castFactory(type)
32842
+
32937
32843
  /**
32938
- * Handles typeIndex and typeCount properties for every walker.
32939
- *
32940
- * @param {Rule} query
32941
- * @param {Parent} parent
32942
- * @param {SelectState} state
32844
+ * @param {Node} node
32943
32845
  */
32944
- constructor(query, parent, state) {
32945
- /** @type {Rule} */
32946
- this.query = query
32947
- /** @type {Parent} */
32948
- this.parent = parent
32949
- /** @type {SelectState} */
32950
- this.state = state
32951
- /** @type {TypeIndex|undefined} */
32952
- this.typeIndex = state.index ? new TypeIndex() : undefined
32953
- /** @type {Array.<Function>} */
32954
- this.delayed = []
32846
+ function type(node) {
32847
+ return node && node.type === check
32955
32848
  }
32849
+ }
32850
+
32851
+ /**
32852
+ * Utility to convert a string into a function which checks a given node’s type
32853
+ * for said string.
32854
+ * @param {TestFunctionAnything} check
32855
+ * @returns {AssertAnything}
32856
+ */
32857
+ function castFactory(check) {
32858
+ return assertion
32956
32859
 
32957
32860
  /**
32958
- * @param {number|null|undefined} [x]
32959
- * @param {number|null|undefined} [y]
32960
- * @returns {this}
32861
+ * @this {unknown}
32862
+ * @param {Array.<unknown>} parameters
32863
+ * @returns {boolean}
32961
32864
  */
32962
- prefillTypeIndex(x, y) {
32963
- var [start, end] = this.defaults(x, y)
32865
+ function assertion(...parameters) {
32866
+ return Boolean(check.call(this, ...parameters))
32867
+ }
32868
+ }
32964
32869
 
32965
- if (this.typeIndex) {
32966
- while (start < end) {
32967
- this.typeIndex.index(this.parent.children[start])
32968
- start++
32969
- }
32970
- }
32870
+ // Utility to return true.
32871
+ function ok() {
32872
+ return true
32873
+ }
32971
32874
 
32972
- return this
32973
- }
32875
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
32876
+ /**
32877
+ * @typedef {import('./types.js').Rule} Rule
32878
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
32879
+ * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
32880
+ * @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
32881
+ * @typedef {import('./types.js').Parent} Parent
32882
+ * @typedef {import('./types.js').Selector} Selector
32883
+ * @typedef {import('./types.js').Selectors} Selectors
32884
+ * @typedef {import('./types.js').SelectState} SelectState
32885
+ * @typedef {import('./types.js').Node} Node
32886
+ */
32974
32887
 
32975
- /**
32976
- * @param {number|null|undefined} [x]
32977
- * @param {number|null|undefined} [y]
32978
- * @returns {this}
32979
- */
32980
- each(x, y) {
32981
- var [start, end] = this.defaults(x, y)
32982
- var child = this.parent.children[start]
32983
- /** @type {number} */
32984
- var index
32985
- /** @type {number} */
32986
- var nodeIndex
32987
32888
 
32988
- if (start >= end) return this
32989
32889
 
32990
- if (this.typeIndex) {
32991
- nodeIndex = this.typeIndex.nodes
32992
- index = this.typeIndex.index(child)
32993
- this.delayed.push(delay)
32994
- } else {
32995
- this.state.iterator(this.query, child, start, this.parent, this.state)
32996
- }
32997
32890
 
32998
- // Stop if we’re looking for one node and it’s already found.
32999
- if (this.state.one && this.state.found) return this
33000
32891
 
33001
- return this.each(start + 1, end)
32892
+ var pseudo_is = convert()
33002
32893
 
33003
- /**
33004
- * @this {WalkIterator}
33005
- */
33006
- function delay() {
33007
- this.state.typeIndex = index
33008
- this.state.nodeIndex = nodeIndex
33009
- this.state.typeCount = this.typeIndex.count(child)
33010
- this.state.nodeCount = this.typeIndex.nodes
33011
- this.state.iterator(this.query, child, start, this.parent, this.state)
33012
- }
32894
+ var pseudo_handle = zwitch('name', {
32895
+ unknown: unknownPseudo,
32896
+ invalid: invalidPseudo,
32897
+ handlers: {
32898
+ any: matches,
32899
+ blank: empty,
32900
+ empty,
32901
+ 'first-child': firstChild,
32902
+ 'first-of-type': firstOfType,
32903
+ has: hasSelector,
32904
+ 'last-child': lastChild,
32905
+ 'last-of-type': lastOfType,
32906
+ matches,
32907
+ not,
32908
+ 'nth-child': nthChild,
32909
+ 'nth-last-child': nthLastChild,
32910
+ 'nth-of-type': nthOfType,
32911
+ 'nth-last-of-type': nthLastOfType,
32912
+ 'only-child': onlyChild,
32913
+ 'only-of-type': onlyOfType,
32914
+ root: pseudo_root,
32915
+ scope
33013
32916
  }
32917
+ })
33014
32918
 
33015
- /**
33016
- * Done!
33017
- * @returns {this}
33018
- */
33019
- done() {
33020
- var index = -1
32919
+ pseudo.needsIndex = [
32920
+ 'first-child',
32921
+ 'first-of-type',
32922
+ 'last-child',
32923
+ 'last-of-type',
32924
+ 'nth-child',
32925
+ 'nth-last-child',
32926
+ 'nth-of-type',
32927
+ 'nth-last-of-type',
32928
+ 'only-child',
32929
+ 'only-of-type'
32930
+ ]
33021
32931
 
33022
- while (++index < this.delayed.length) {
33023
- this.delayed[index].call(this)
33024
- if (this.state.one && this.state.found) break
33025
- }
32932
+ /**
32933
+ * @param {Rule} query
32934
+ * @param {Node} node
32935
+ * @param {number|null} index
32936
+ * @param {Parent|null} parent
32937
+ * @param {SelectState} state
32938
+ * @returns {boolean}
32939
+ */
32940
+ function pseudo(query, node, index, parent, state) {
32941
+ var pseudos = query.pseudos
32942
+ var offset = -1
33026
32943
 
33027
- return this
32944
+ while (++offset < pseudos.length) {
32945
+ if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
33028
32946
  }
33029
32947
 
33030
- /**
33031
- * @param {number|null|undefined} [start]
33032
- * @param {number|null|undefined} [end]
33033
- * @returns {[number, number]}
33034
- */
33035
- defaults(start, end) {
33036
- if (start === null || start === undefined || start < 0) start = 0
33037
- if (end === null || end === undefined || end > this.parent.children.length)
33038
- end = this.parent.children.length
33039
- return [start, end]
33040
- }
32948
+ return true
33041
32949
  }
33042
32950
 
33043
- class TypeIndex {
33044
- constructor() {
33045
- /** @type {Object.<string, number>} */
33046
- this.counts = {}
33047
- /** @type {number} */
33048
- this.nodes = 0
33049
- }
33050
-
33051
- /**
33052
- * @param {Node} node
33053
- * @returns {number}
33054
- */
33055
- index(node) {
33056
- var type = node.type
32951
+ /**
32952
+ * @param {RulePseudoSelector} query
32953
+ * @param {Node} node
32954
+ * @param {number|null} _1
32955
+ * @param {Parent|null} _2
32956
+ * @param {SelectState} state
32957
+ * @returns {boolean}
32958
+ */
32959
+ function matches(query, node, _1, _2, state) {
32960
+ var shallow = state.shallow
32961
+ var one = state.one
32962
+ /** @type {boolean} */
32963
+ var result
33057
32964
 
33058
- this.nodes++
32965
+ state.one = true
32966
+ state.shallow = true
33059
32967
 
33060
- if (!nest_own.call(this.counts, type)) this.counts[type] = 0
32968
+ result = state.any(query.value, node, state)[0] === node
33061
32969
 
33062
- // Note: `++` is intended to be postfixed!
33063
- return this.counts[type]++
33064
- }
32970
+ state.shallow = shallow
32971
+ state.one = one
33065
32972
 
33066
- /**
33067
- * @param {Node} node
33068
- * @returns {number|undefined}
33069
- */
33070
- count(node) {
33071
- return this.counts[node.type]
33072
- }
32973
+ return result
33073
32974
  }
33074
32975
 
33075
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
33076
32976
  /**
33077
- * @typedef {import('unist').Node} Node
33078
- * @typedef {import('unist').Parent} Parent
33079
- *
33080
- * @typedef {string} Type
33081
- * @typedef {Object<string, unknown>} Props
33082
- *
33083
- * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
32977
+ * @param {RulePseudoSelector} query
32978
+ * @param {Node} node
32979
+ * @param {number|null} index
32980
+ * @param {Parent|null} parent
32981
+ * @param {SelectState} state
32982
+ * @returns {boolean}
33084
32983
  */
32984
+ function not(query, node, index, parent, state) {
32985
+ return !matches(query, node, index, parent, state)
32986
+ }
33085
32987
 
33086
32988
  /**
33087
- * Check if a node passes a test
33088
- *
33089
- * @callback TestFunctionAnything
32989
+ * @param {RulePseudo} _1
33090
32990
  * @param {Node} node
33091
- * @param {number} [index]
33092
- * @param {Parent} [parent]
33093
- * @returns {boolean|void}
32991
+ * @param {number|null} _2
32992
+ * @param {Parent|null} parent
32993
+ * @returns {boolean}
33094
32994
  */
32995
+ function pseudo_root(_1, node, _2, parent) {
32996
+ return pseudo_is(node) && !parent
32997
+ }
33095
32998
 
33096
32999
  /**
33097
- * Check if a node passes a certain node test
33098
- *
33099
- * @template {Node} X
33100
- * @callback TestFunctionPredicate
33000
+ * @param {RulePseudo} _1
33101
33001
  * @param {Node} node
33102
- * @param {number} [index]
33103
- * @param {Parent} [parent]
33104
- * @returns {node is X}
33002
+ * @param {number|null} _2
33003
+ * @param {Parent|null} _3
33004
+ * @param {SelectState} state
33005
+ * @returns {boolean}
33105
33006
  */
33007
+ function scope(_1, node, _2, _3, state) {
33008
+ return pseudo_is(node) && state.scopeNodes.includes(node)
33009
+ }
33106
33010
 
33107
33011
  /**
33108
- * @callback AssertAnything
33109
- * @param {unknown} [node]
33110
- * @param {number} [index]
33111
- * @param {Parent} [parent]
33012
+ * @param {RulePseudo} _1
33013
+ * @param {Node} node
33112
33014
  * @returns {boolean}
33113
33015
  */
33016
+ function empty(_1, node) {
33017
+ return util_parent(node) ? node.children.length === 0 : !('value' in node)
33018
+ }
33114
33019
 
33115
33020
  /**
33116
- * Check if a node passes a certain node test
33117
- *
33118
- * @template {Node} Y
33119
- * @callback AssertPredicate
33120
- * @param {unknown} [node]
33121
- * @param {number} [index]
33122
- * @param {Parent} [parent]
33123
- * @returns {node is Y}
33021
+ * @param {RulePseudo} query
33022
+ * @param {Node} _1
33023
+ * @param {number|null} _2
33024
+ * @param {Parent|null} _3
33025
+ * @param {SelectState} state
33026
+ * @returns {boolean}
33124
33027
  */
33028
+ function firstChild(query, _1, _2, _3, state) {
33029
+ assertDeep(state, query)
33030
+ return state.nodeIndex === 0 // Specifically `0`, not falsey.
33031
+ }
33125
33032
 
33126
- var is =
33127
- /**
33128
- * Check if a node passes a test.
33129
- * When a `parent` node is known the `index` of node should also be given.
33130
- *
33131
- * @type {(
33132
- * (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number, parent?: Parent, context?: unknown) => node is T) &
33133
- * ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
33134
- * )}
33135
- */
33136
- (
33137
- /**
33138
- * Check if a node passes a test.
33139
- * When a `parent` node is known the `index` of node should also be given.
33140
- *
33141
- * @param {unknown} [node] Node to check
33142
- * @param {Test} [test]
33143
- * When nullish, checks if `node` is a `Node`.
33144
- * When `string`, works like passing `function (node) {return node.type === test}`.
33145
- * When `function` checks if function passed the node is true.
33146
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33147
- * When `array`, checks any one of the subtests pass.
33148
- * @param {number} [index] Position of `node` in `parent`
33149
- * @param {Parent} [parent] Parent of `node`
33150
- * @param {unknown} [context] Context object to invoke `test` with
33151
- * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
33152
- */
33153
- // eslint-disable-next-line max-params
33154
- function is(node, test, index, parent, context) {
33155
- var check = convert(test)
33156
-
33157
- if (
33158
- index !== undefined &&
33159
- index !== null &&
33160
- (typeof index !== 'number' ||
33161
- index < 0 ||
33162
- index === Number.POSITIVE_INFINITY)
33163
- ) {
33164
- throw new Error('Expected positive finite index')
33165
- }
33166
-
33167
- if (
33168
- parent !== undefined &&
33169
- parent !== null &&
33170
- (!is(parent) || !parent.children)
33171
- ) {
33172
- throw new Error('Expected parent node')
33173
- }
33174
-
33175
- if (
33176
- (parent === undefined || parent === null) !==
33177
- (index === undefined || index === null)
33178
- ) {
33179
- throw new Error('Expected both parent and index')
33180
- }
33181
-
33182
- // @ts-ignore Looks like a node.
33183
- return node && node.type && typeof node.type === 'string'
33184
- ? Boolean(check.call(context, node, index, parent))
33185
- : false
33186
- }
33187
- )
33188
-
33189
- var convert =
33190
- /**
33191
- * @type {(
33192
- * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
33193
- * ((test?: Test) => AssertAnything)
33194
- * )}
33195
- */
33196
- (
33197
- /**
33198
- * Generate an assertion from a check.
33199
- * @param {Test} [test]
33200
- * When nullish, checks if `node` is a `Node`.
33201
- * When `string`, works like passing `function (node) {return node.type === test}`.
33202
- * When `function` checks if function passed the node is true.
33203
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33204
- * When `array`, checks any one of the subtests pass.
33205
- * @returns {AssertAnything}
33206
- */
33207
- function (test) {
33208
- if (test === undefined || test === null) {
33209
- return ok
33210
- }
33211
-
33212
- if (typeof test === 'string') {
33213
- return typeFactory(test)
33214
- }
33215
-
33216
- if (typeof test === 'object') {
33217
- // @ts-ignore looks like a list of tests / partial test object.
33218
- return 'length' in test ? anyFactory(test) : propsFactory(test)
33219
- }
33220
-
33221
- if (typeof test === 'function') {
33222
- return castFactory(test)
33223
- }
33224
-
33225
- throw new Error('Expected function, string, or object as test')
33226
- }
33227
- )
33228
33033
  /**
33229
- * @param {Array.<Type|Props|TestFunctionAnything>} tests
33230
- * @returns {AssertAnything}
33034
+ * @param {RulePseudo} query
33035
+ * @param {Node} _1
33036
+ * @param {number|null} _2
33037
+ * @param {Parent|null} _3
33038
+ * @param {SelectState} state
33039
+ * @returns {boolean}
33231
33040
  */
33232
- function anyFactory(tests) {
33233
- /** @type {Array.<AssertAnything>} */
33234
- var checks = []
33235
- var index = -1
33041
+ function lastChild(query, _1, _2, _3, state) {
33042
+ assertDeep(state, query)
33043
+ return state.nodeIndex === state.nodeCount - 1
33044
+ }
33236
33045
 
33237
- while (++index < tests.length) {
33238
- checks[index] = convert(tests[index])
33239
- }
33046
+ /**
33047
+ * @param {RulePseudo} query
33048
+ * @param {Node} _1
33049
+ * @param {number|null} _2
33050
+ * @param {Parent|null} _3
33051
+ * @param {SelectState} state
33052
+ * @returns {boolean}
33053
+ */
33054
+ function onlyChild(query, _1, _2, _3, state) {
33055
+ assertDeep(state, query)
33056
+ return state.nodeCount === 1
33057
+ }
33240
33058
 
33241
- return castFactory(any)
33059
+ /**
33060
+ * @param {RulePseudoNth} query
33061
+ * @param {Node} _1
33062
+ * @param {number|null} _2
33063
+ * @param {Parent|null} _3
33064
+ * @param {SelectState} state
33065
+ * @returns {boolean}
33066
+ */
33067
+ function nthChild(query, _1, _2, _3, state) {
33068
+ assertDeep(state, query)
33069
+ return query.value(state.nodeIndex)
33070
+ }
33242
33071
 
33243
- /**
33244
- * @this {unknown}
33245
- * @param {unknown[]} parameters
33246
- * @returns {boolean}
33247
- */
33248
- function any(...parameters) {
33249
- var index = -1
33072
+ /**
33073
+ * @param {RulePseudoNth} query
33074
+ * @param {Node} _1
33075
+ * @param {number|null} _2
33076
+ * @param {Parent|null} _3
33077
+ * @param {SelectState} state
33078
+ * @returns {boolean}
33079
+ */
33080
+ function nthLastChild(query, _1, _2, _3, state) {
33081
+ assertDeep(state, query)
33082
+ return query.value(state.nodeCount - state.nodeIndex - 1)
33083
+ }
33250
33084
 
33251
- while (++index < checks.length) {
33252
- if (checks[index].call(this, ...parameters)) return true
33253
- }
33254
- }
33085
+ /**
33086
+ * @param {RulePseudoNth} query
33087
+ * @param {Node} _1
33088
+ * @param {number|null} _2
33089
+ * @param {Parent|null} _3
33090
+ * @param {SelectState} state
33091
+ * @returns {boolean}
33092
+ */
33093
+ function nthOfType(query, _1, _2, _3, state) {
33094
+ assertDeep(state, query)
33095
+ return query.value(state.typeIndex)
33255
33096
  }
33256
33097
 
33257
33098
  /**
33258
- * Utility to assert each property in `test` is represented in `node`, and each
33259
- * values are strictly equal.
33260
- *
33261
- * @param {Props} check
33262
- * @returns {AssertAnything}
33099
+ * @param {RulePseudoNth} query
33100
+ * @param {Node} _1
33101
+ * @param {number|null} _2
33102
+ * @param {Parent|null} _3
33103
+ * @param {SelectState} state
33104
+ * @returns {boolean}
33263
33105
  */
33264
- function propsFactory(check) {
33265
- return castFactory(all)
33266
-
33267
- /**
33268
- * @param {Node} node
33269
- * @returns {boolean}
33270
- */
33271
- function all(node) {
33272
- /** @type {string} */
33273
- var key
33274
-
33275
- for (key in check) {
33276
- if (node[key] !== check[key]) return
33277
- }
33278
-
33279
- return true
33280
- }
33106
+ function nthLastOfType(query, _1, _2, _3, state) {
33107
+ assertDeep(state, query)
33108
+ return query.value(state.typeCount - 1 - state.typeIndex)
33281
33109
  }
33282
33110
 
33283
33111
  /**
33284
- * Utility to convert a string into a function which checks a given node’s type
33285
- * for said string.
33286
- *
33287
- * @param {Type} check
33288
- * @returns {AssertAnything}
33112
+ * @param {RulePseudo} query
33113
+ * @param {Node} _1
33114
+ * @param {number|null} _2
33115
+ * @param {Parent|null} _3
33116
+ * @param {SelectState} state
33117
+ * @returns {boolean}
33289
33118
  */
33290
- function typeFactory(check) {
33291
- return castFactory(type)
33292
-
33293
- /**
33294
- * @param {Node} node
33295
- */
33296
- function type(node) {
33297
- return node && node.type === check
33298
- }
33119
+ function firstOfType(query, _1, _2, _3, state) {
33120
+ assertDeep(state, query)
33121
+ return state.typeIndex === 0
33299
33122
  }
33300
33123
 
33301
33124
  /**
33302
- * Utility to convert a string into a function which checks a given node’s type
33303
- * for said string.
33304
- * @param {TestFunctionAnything} check
33305
- * @returns {AssertAnything}
33125
+ * @param {RulePseudo} query
33126
+ * @param {Node} _1
33127
+ * @param {number|null} _2
33128
+ * @param {Parent|null} _3
33129
+ * @param {SelectState} state
33130
+ * @returns {boolean}
33306
33131
  */
33307
- function castFactory(check) {
33308
- return assertion
33132
+ function lastOfType(query, _1, _2, _3, state) {
33133
+ assertDeep(state, query)
33134
+ return state.typeIndex === state.typeCount - 1
33135
+ }
33309
33136
 
33310
- /**
33311
- * @this {unknown}
33312
- * @param {Array.<unknown>} parameters
33313
- * @returns {boolean}
33314
- */
33315
- function assertion(...parameters) {
33316
- return Boolean(check.call(this, ...parameters))
33317
- }
33137
+ /**
33138
+ * @param {RulePseudo} query
33139
+ * @param {Node} _1
33140
+ * @param {number|null} _2
33141
+ * @param {Parent|null} _3
33142
+ * @param {SelectState} state
33143
+ * @returns {boolean}
33144
+ */
33145
+ function onlyOfType(query, _1, _2, _3, state) {
33146
+ assertDeep(state, query)
33147
+ return state.typeCount === 1
33318
33148
  }
33319
33149
 
33320
- // Utility to return true.
33321
- function ok() {
33322
- return true
33150
+ // Shouldn’t be invoked, parser gives correct data.
33151
+ /* c8 ignore next 3 */
33152
+ function invalidPseudo() {
33153
+ throw new Error('Invalid pseudo-selector')
33323
33154
  }
33324
33155
 
33325
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
33326
33156
  /**
33327
- * @typedef {import('./types.js').Rule} Rule
33328
- * @typedef {import('./types.js').RulePseudo} RulePseudo
33329
- * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
33330
- * @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
33331
- * @typedef {import('./types.js').Parent} Parent
33332
- * @typedef {import('./types.js').Selector} Selector
33333
- * @typedef {import('./types.js').Selectors} Selectors
33334
- * @typedef {import('./types.js').SelectState} SelectState
33335
- * @typedef {import('./types.js').Node} Node
33157
+ * @param {RulePseudo} query
33158
+ * @returns {boolean}
33336
33159
  */
33337
-
33338
-
33339
-
33340
-
33341
-
33342
- var pseudo_is = convert()
33343
-
33344
- var pseudo_handle = zwitch('name', {
33345
- unknown: unknownPseudo,
33346
- invalid: invalidPseudo,
33347
- handlers: {
33348
- any: matches,
33349
- blank: empty,
33350
- empty,
33351
- 'first-child': firstChild,
33352
- 'first-of-type': firstOfType,
33353
- has: hasSelector,
33354
- 'last-child': lastChild,
33355
- 'last-of-type': lastOfType,
33356
- matches,
33357
- not,
33358
- 'nth-child': nthChild,
33359
- 'nth-last-child': nthLastChild,
33360
- 'nth-of-type': nthOfType,
33361
- 'nth-last-of-type': nthLastOfType,
33362
- 'only-child': onlyChild,
33363
- 'only-of-type': onlyOfType,
33364
- root: pseudo_root,
33365
- scope
33160
+ function unknownPseudo(query) {
33161
+ if (query.name) {
33162
+ throw new Error('Unknown pseudo-selector `' + query.name + '`')
33366
33163
  }
33367
- })
33368
33164
 
33369
- pseudo.needsIndex = [
33370
- 'first-child',
33371
- 'first-of-type',
33372
- 'last-child',
33373
- 'last-of-type',
33374
- 'nth-child',
33375
- 'nth-last-child',
33376
- 'nth-of-type',
33377
- 'nth-last-of-type',
33378
- 'only-child',
33379
- 'only-of-type'
33380
- ]
33165
+ throw new Error('Unexpected pseudo-element or empty pseudo-class')
33166
+ }
33381
33167
 
33382
33168
  /**
33383
- * @param {Rule} query
33384
- * @param {Node} node
33385
- * @param {number|null} index
33386
- * @param {Parent|null} parent
33387
33169
  * @param {SelectState} state
33388
- * @returns {boolean}
33170
+ * @param {RulePseudo|RulePseudoNth} query
33389
33171
  */
33390
- function pseudo(query, node, index, parent, state) {
33391
- var pseudos = query.pseudos
33392
- var offset = -1
33393
-
33394
- while (++offset < pseudos.length) {
33395
- if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
33172
+ function assertDeep(state, query) {
33173
+ if (state.shallow) {
33174
+ throw new Error('Cannot use `:' + query.name + '` without parent')
33396
33175
  }
33397
-
33398
- return true
33399
33176
  }
33400
33177
 
33401
33178
  /**
@@ -33406,780 +33183,1062 @@ function pseudo(query, node, index, parent, state) {
33406
33183
  * @param {SelectState} state
33407
33184
  * @returns {boolean}
33408
33185
  */
33409
- function matches(query, node, _1, _2, state) {
33186
+ function hasSelector(query, node, _1, _2, state) {
33410
33187
  var shallow = state.shallow
33411
33188
  var one = state.one
33189
+ var scopeNodes = state.scopeNodes
33190
+ var value = appendScope(query.value)
33191
+ var anything = state.any
33412
33192
  /** @type {boolean} */
33413
33193
  var result
33414
33194
 
33195
+ state.shallow = false
33415
33196
  state.one = true
33416
- state.shallow = true
33197
+ state.scopeNodes = [node]
33198
+
33199
+ result = Boolean(anything(value, node, state)[0])
33200
+
33201
+ state.shallow = shallow
33202
+ state.one = one
33203
+ state.scopeNodes = scopeNodes
33204
+
33205
+ return result
33206
+ }
33207
+
33208
+ /**
33209
+ * @param {Selector} value
33210
+ */
33211
+ function appendScope(value) {
33212
+ /** @type {Selectors} */
33213
+ var selector =
33214
+ value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
33215
+ var index = -1
33216
+ /** @type {Rule} */
33217
+ var rule
33218
+
33219
+ while (++index < selector.selectors.length) {
33220
+ rule = selector.selectors[index].rule
33221
+ rule.nestingOperator = null
33222
+
33223
+ // Needed if new pseudo’s are added that accepts commas (such as
33224
+ // `:lang(en, nl)`)
33225
+ /* c8 ignore else */
33226
+ if (
33227
+ !rule.pseudos ||
33228
+ rule.pseudos.length !== 1 ||
33229
+ rule.pseudos[0].name !== 'scope'
33230
+ ) {
33231
+ selector.selectors[index] = {
33232
+ type: 'ruleSet',
33233
+ rule: {
33234
+ type: 'rule',
33235
+ rule,
33236
+ // @ts-ignore pseudos are fine w/ just a name!
33237
+ pseudos: [{name: 'scope'}]
33238
+ }
33239
+ }
33240
+ }
33241
+ }
33242
+
33243
+ return selector
33244
+ }
33245
+
33246
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/attribute.js
33247
+ /**
33248
+ * @typedef {import('./types.js').Rule} Rule
33249
+ * @typedef {import('./types.js').RuleAttr} RuleAttr
33250
+ * @typedef {import('./types.js').Node} Node
33251
+ */
33252
+
33253
+
33254
+
33255
+ var attribute_handle = zwitch('operator', {
33256
+ unknown: unknownOperator,
33257
+ invalid: exists,
33258
+ handlers: {
33259
+ '=': exact,
33260
+ '^=': begins,
33261
+ '$=': ends,
33262
+ '*=': containsString,
33263
+ '~=': containsArray
33264
+ }
33265
+ })
33417
33266
 
33418
- result = state.any(query.value, node, state)[0] === node
33267
+ /**
33268
+ * @param {Rule} query
33269
+ * @param {Node} node
33270
+ */
33271
+ function attribute(query, node) {
33272
+ var index = -1
33419
33273
 
33420
- state.shallow = shallow
33421
- state.one = one
33274
+ while (++index < query.attrs.length) {
33275
+ if (!attribute_handle(query.attrs[index], node)) return false
33276
+ }
33422
33277
 
33423
- return result
33278
+ return true
33424
33279
  }
33425
33280
 
33426
33281
  /**
33427
- * @param {RulePseudoSelector} query
33282
+ * `[attr]`
33283
+ *
33284
+ * @param {RuleAttr} query
33428
33285
  * @param {Node} node
33429
- * @param {number|null} index
33430
- * @param {Parent|null} parent
33431
- * @param {SelectState} state
33432
- * @returns {boolean}
33433
33286
  */
33434
- function not(query, node, index, parent, state) {
33435
- return !matches(query, node, index, parent, state)
33287
+ function exists(query, node) {
33288
+ return node[query.name] !== null && node[query.name] !== undefined
33436
33289
  }
33437
33290
 
33438
33291
  /**
33439
- * @param {RulePseudo} _1
33292
+ * `[attr=value]`
33293
+ *
33294
+ * @param {RuleAttr} query
33440
33295
  * @param {Node} node
33441
- * @param {number|null} _2
33442
- * @param {Parent|null} parent
33443
- * @returns {boolean}
33444
33296
  */
33445
- function pseudo_root(_1, node, _2, parent) {
33446
- return pseudo_is(node) && !parent
33297
+ function exact(query, node) {
33298
+ return exists(query, node) && String(node[query.name]) === query.value
33447
33299
  }
33448
33300
 
33449
33301
  /**
33450
- * @param {RulePseudo} _1
33302
+ * `[attr~=value]`
33303
+ *
33304
+ * @param {RuleAttr} query
33451
33305
  * @param {Node} node
33452
- * @param {number|null} _2
33453
- * @param {Parent|null} _3
33454
- * @param {SelectState} state
33455
- * @returns {boolean}
33456
33306
  */
33457
- function scope(_1, node, _2, _3, state) {
33458
- return pseudo_is(node) && state.scopeNodes.includes(node)
33307
+ function containsArray(query, node) {
33308
+ var value = node[query.name]
33309
+
33310
+ if (value === null || value === undefined) return false
33311
+
33312
+ // If this is an array, and the query is contained in it, return true.
33313
+ // Coverage comment in place because TS turns `Array.isArray(unknown)`
33314
+ // into `Array.<any>` instead of `Array.<unknown>`.
33315
+ // type-coverage:ignore-next-line
33316
+ if (Array.isArray(value) && value.includes(query.value)) {
33317
+ return true
33318
+ }
33319
+
33320
+ // For all other values, return whether this is an exact match.
33321
+ return String(value) === query.value
33459
33322
  }
33460
33323
 
33461
33324
  /**
33462
- * @param {RulePseudo} _1
33325
+ * `[attr^=value]`
33326
+ *
33327
+ * @param {RuleAttr} query
33463
33328
  * @param {Node} node
33464
- * @returns {boolean}
33465
33329
  */
33466
- function empty(_1, node) {
33467
- return util_parent(node) ? node.children.length === 0 : !('value' in node)
33468
- }
33330
+ function begins(query, node) {
33331
+ var value = node[query.name]
33469
33332
 
33470
- /**
33471
- * @param {RulePseudo} query
33472
- * @param {Node} _1
33473
- * @param {number|null} _2
33474
- * @param {Parent|null} _3
33475
- * @param {SelectState} state
33476
- * @returns {boolean}
33477
- */
33478
- function firstChild(query, _1, _2, _3, state) {
33479
- assertDeep(state, query)
33480
- return state.nodeIndex === 0 // Specifically `0`, not falsey.
33333
+ return (
33334
+ typeof value === 'string' &&
33335
+ value.slice(0, query.value.length) === query.value
33336
+ )
33481
33337
  }
33482
33338
 
33483
33339
  /**
33484
- * @param {RulePseudo} query
33485
- * @param {Node} _1
33486
- * @param {number|null} _2
33487
- * @param {Parent|null} _3
33488
- * @param {SelectState} state
33489
- * @returns {boolean}
33340
+ * `[attr$=value]`
33341
+ *
33342
+ * @param {RuleAttr} query
33343
+ * @param {Node} node
33490
33344
  */
33491
- function lastChild(query, _1, _2, _3, state) {
33492
- assertDeep(state, query)
33493
- return state.nodeIndex === state.nodeCount - 1
33494
- }
33345
+ function ends(query, node) {
33346
+ var value = node[query.name]
33495
33347
 
33496
- /**
33497
- * @param {RulePseudo} query
33498
- * @param {Node} _1
33499
- * @param {number|null} _2
33500
- * @param {Parent|null} _3
33501
- * @param {SelectState} state
33502
- * @returns {boolean}
33503
- */
33504
- function onlyChild(query, _1, _2, _3, state) {
33505
- assertDeep(state, query)
33506
- return state.nodeCount === 1
33348
+ return (
33349
+ typeof value === 'string' &&
33350
+ value.slice(-query.value.length) === query.value
33351
+ )
33507
33352
  }
33508
33353
 
33509
33354
  /**
33510
- * @param {RulePseudoNth} query
33511
- * @param {Node} _1
33512
- * @param {number|null} _2
33513
- * @param {Parent|null} _3
33514
- * @param {SelectState} state
33515
- * @returns {boolean}
33355
+ * `[attr*=value]`
33356
+ *
33357
+ * @param {RuleAttr} query
33358
+ * @param {Node} node
33516
33359
  */
33517
- function nthChild(query, _1, _2, _3, state) {
33518
- assertDeep(state, query)
33519
- return query.value(state.nodeIndex)
33360
+ function containsString(query, node) {
33361
+ var value = node[query.name]
33362
+ return typeof value === 'string' && value.includes(query.value)
33520
33363
  }
33521
33364
 
33365
+ // Shouldn’t be invoked, Parser throws an error instead.
33366
+ /* c8 ignore next 6 */
33522
33367
  /**
33523
- * @param {RulePseudoNth} query
33524
- * @param {Node} _1
33525
- * @param {number|null} _2
33526
- * @param {Parent|null} _3
33527
- * @param {SelectState} state
33528
- * @returns {boolean}
33368
+ * @param {{[x: string]: unknown, type: string}} query
33529
33369
  */
33530
- function nthLastChild(query, _1, _2, _3, state) {
33531
- assertDeep(state, query)
33532
- return query.value(state.nodeCount - state.nodeIndex - 1)
33370
+ function unknownOperator(query) {
33371
+ throw new Error('Unknown operator `' + query.operator + '`')
33533
33372
  }
33534
33373
 
33374
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
33535
33375
  /**
33536
- * @param {RulePseudoNth} query
33537
- * @param {Node} _1
33538
- * @param {number|null} _2
33539
- * @param {Parent|null} _3
33540
- * @param {SelectState} state
33541
- * @returns {boolean}
33376
+ * @typedef {import('./types.js').Rule} Rule
33377
+ * @typedef {import('./types.js').Node} Node
33542
33378
  */
33543
- function nthOfType(query, _1, _2, _3, state) {
33544
- assertDeep(state, query)
33545
- return query.value(state.typeIndex)
33546
- }
33547
33379
 
33548
33380
  /**
33549
- * @param {RulePseudoNth} query
33550
- * @param {Node} _1
33551
- * @param {number|null} _2
33552
- * @param {Parent|null} _3
33553
- * @param {SelectState} state
33554
- * @returns {boolean}
33381
+ * @param {Rule} query
33382
+ * @param {Node} node
33555
33383
  */
33556
- function nthLastOfType(query, _1, _2, _3, state) {
33557
- assertDeep(state, query)
33558
- return query.value(state.typeCount - 1 - state.typeIndex)
33384
+ function name_name(query, node) {
33385
+ return query.tagName === '*' || query.tagName === node.type
33559
33386
  }
33560
33387
 
33388
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
33561
33389
  /**
33562
- * @param {RulePseudo} query
33563
- * @param {Node} _1
33564
- * @param {number|null} _2
33565
- * @param {Parent|null} _3
33566
- * @param {SelectState} state
33567
- * @returns {boolean}
33390
+ * @typedef {import('./types.js').Rule} Rule
33391
+ * @typedef {import('./types.js').Node} Node
33392
+ * @typedef {import('./types.js').Parent} Parent
33393
+ * @typedef {import('./types.js').SelectState} SelectState
33568
33394
  */
33569
- function firstOfType(query, _1, _2, _3, state) {
33570
- assertDeep(state, query)
33571
- return state.typeIndex === 0
33572
- }
33395
+
33396
+
33397
+
33398
+
33573
33399
 
33574
33400
  /**
33575
- * @param {RulePseudo} query
33576
- * @param {Node} _1
33577
- * @param {number|null} _2
33578
- * @param {Parent|null} _3
33401
+ * @param {Rule} query
33402
+ * @param {Node} node
33403
+ * @param {number|null} index
33404
+ * @param {Parent|null} parent
33579
33405
  * @param {SelectState} state
33580
33406
  * @returns {boolean}
33581
33407
  */
33582
- function lastOfType(query, _1, _2, _3, state) {
33583
- assertDeep(state, query)
33584
- return state.typeIndex === state.typeCount - 1
33408
+ function test(query, node, index, parent, state) {
33409
+ if (query.id) throw new Error('Invalid selector: id')
33410
+ if (query.classNames) throw new Error('Invalid selector: class')
33411
+
33412
+ return Boolean(
33413
+ node &&
33414
+ (!query.tagName || name_name(query, node)) &&
33415
+ (!query.attrs || attribute(query, node)) &&
33416
+ (!query.pseudos || pseudo(query, node, index, parent, state))
33417
+ )
33585
33418
  }
33586
33419
 
33420
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/any.js
33587
33421
  /**
33588
- * @param {RulePseudo} query
33589
- * @param {Node} _1
33590
- * @param {number|null} _2
33591
- * @param {Parent|null} _3
33592
- * @param {SelectState} state
33593
- * @returns {boolean}
33422
+ * @typedef {import('./types.js').Selector} Selector
33423
+ * @typedef {import('./types.js').Selectors} Selectors
33424
+ * @typedef {import('./types.js').Rule} Rule
33425
+ * @typedef {import('./types.js').RuleSet} RuleSet
33426
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
33427
+ * @typedef {import('./types.js').Query} Query
33428
+ * @typedef {import('./types.js').Node} Node
33429
+ * @typedef {import('./types.js').Parent} Parent
33430
+ * @typedef {import('./types.js').SelectIterator} SelectIterator
33431
+ * @typedef {import('./types.js').SelectState} SelectState
33594
33432
  */
33595
- function onlyOfType(query, _1, _2, _3, state) {
33596
- assertDeep(state, query)
33597
- return state.typeCount === 1
33598
- }
33599
33433
 
33600
- // Shouldn’t be invoked, parser gives correct data.
33601
- /* c8 ignore next 3 */
33602
- function invalidPseudo() {
33603
- throw new Error('Invalid pseudo-selector')
33434
+
33435
+
33436
+
33437
+
33438
+
33439
+
33440
+ var type = zwitch('type', {
33441
+ unknown: unknownType,
33442
+ invalid: invalidType,
33443
+ handlers: {selectors, ruleSet, rule}
33444
+ })
33445
+
33446
+ /**
33447
+ * @param {Selectors|RuleSet|Rule} query
33448
+ * @param {Node} node
33449
+ * @param {SelectState} state
33450
+ */
33451
+ function any(query, node, state) {
33452
+ // @ts-ignore zwitch types are off.
33453
+ return query && node ? type(query, node, state) : []
33604
33454
  }
33605
33455
 
33606
33456
  /**
33607
- * @param {RulePseudo} query
33608
- * @returns {boolean}
33457
+ * @param {Selectors} query
33458
+ * @param {Node} node
33459
+ * @param {SelectState} state
33609
33460
  */
33610
- function unknownPseudo(query) {
33611
- if (query.name) {
33612
- throw new Error('Unknown pseudo-selector `' + query.name + '`')
33461
+ function selectors(query, node, state) {
33462
+ var collect = collector(state.one)
33463
+ var index = -1
33464
+
33465
+ while (++index < query.selectors.length) {
33466
+ collect(ruleSet(query.selectors[index], node, state))
33613
33467
  }
33614
33468
 
33615
- throw new Error('Unexpected pseudo-element or empty pseudo-class')
33469
+ return collect.result
33616
33470
  }
33617
33471
 
33618
33472
  /**
33473
+ * @param {RuleSet} query
33474
+ * @param {Node} node
33619
33475
  * @param {SelectState} state
33620
- * @param {RulePseudo|RulePseudoNth} query
33621
33476
  */
33622
- function assertDeep(state, query) {
33623
- if (state.shallow) {
33624
- throw new Error('Cannot use `:' + query.name + '` without parent')
33625
- }
33477
+ function ruleSet(query, node, state) {
33478
+ return rule(query.rule, node, state)
33626
33479
  }
33627
33480
 
33628
33481
  /**
33629
- * @param {RulePseudoSelector} query
33630
- * @param {Node} node
33631
- * @param {number|null} _1
33632
- * @param {Parent|null} _2
33482
+ * @param {Rule} query
33483
+ * @param {Node} tree
33633
33484
  * @param {SelectState} state
33634
- * @returns {boolean}
33635
33485
  */
33636
- function hasSelector(query, node, _1, _2, state) {
33637
- var shallow = state.shallow
33638
- var one = state.one
33639
- var scopeNodes = state.scopeNodes
33640
- var value = appendScope(query.value)
33641
- var anything = state.any
33642
- /** @type {boolean} */
33643
- var result
33486
+ function rule(query, tree, state) {
33487
+ var collect = collector(state.one)
33644
33488
 
33645
- state.shallow = false
33646
- state.one = true
33647
- state.scopeNodes = [node]
33489
+ if (state.shallow && query.rule) {
33490
+ throw new Error('Expected selector without nesting')
33491
+ }
33648
33492
 
33649
- result = Boolean(anything(value, node, state)[0])
33493
+ nest(
33494
+ query,
33495
+ tree,
33496
+ 0,
33497
+ null,
33498
+ configure(query, {
33499
+ scopeNodes: root(tree) ? tree.children : [tree],
33500
+ index: false,
33501
+ iterator,
33502
+ one: state.one,
33503
+ shallow: state.shallow,
33504
+ any: state.any
33505
+ })
33506
+ )
33650
33507
 
33651
- state.shallow = shallow
33652
- state.one = one
33653
- state.scopeNodes = scopeNodes
33508
+ return collect.result
33654
33509
 
33655
- return result
33510
+ /** @type {SelectIterator} */
33511
+ function iterator(query, node, index, parent, state) {
33512
+ if (test(query, node, index, parent, state)) {
33513
+ if ('rule' in query) {
33514
+ nest(query.rule, node, index, parent, configure(query.rule, state))
33515
+ } else {
33516
+ collect(node)
33517
+ state.found = true
33518
+ }
33519
+ }
33520
+ }
33656
33521
  }
33657
33522
 
33658
33523
  /**
33659
- * @param {Selector} value
33524
+ * @template {SelectState} S
33525
+ * @param {Rule} query
33526
+ * @param {S} state
33527
+ * @returns {S}
33660
33528
  */
33661
- function appendScope(value) {
33662
- /** @type {Selectors} */
33663
- var selector =
33664
- value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
33529
+ function configure(query, state) {
33530
+ var pseudos = query.pseudos || []
33665
33531
  var index = -1
33666
- /** @type {Rule} */
33667
- var rule
33668
-
33669
- while (++index < selector.selectors.length) {
33670
- rule = selector.selectors[index].rule
33671
- rule.nestingOperator = null
33672
33532
 
33673
- // Needed if new pseudo’s are added that accepts commas (such as
33674
- // `:lang(en, nl)`)
33675
- /* c8 ignore else */
33676
- if (
33677
- !rule.pseudos ||
33678
- rule.pseudos.length !== 1 ||
33679
- rule.pseudos[0].name !== 'scope'
33680
- ) {
33681
- selector.selectors[index] = {
33682
- type: 'ruleSet',
33683
- rule: {
33684
- type: 'rule',
33685
- rule,
33686
- // @ts-ignore pseudos are fine w/ just a name!
33687
- pseudos: [{name: 'scope'}]
33688
- }
33689
- }
33533
+ while (++index < pseudos.length) {
33534
+ if (pseudo.needsIndex.includes(pseudos[index].name)) {
33535
+ state.index = true
33536
+ break
33690
33537
  }
33691
33538
  }
33692
33539
 
33693
- return selector
33540
+ return state
33694
33541
  }
33695
33542
 
33696
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/attribute.js
33543
+ // Shouldn’t be invoked, all data is handled.
33544
+ /* c8 ignore next 6 */
33697
33545
  /**
33698
- * @typedef {import('./types.js').Rule} Rule
33699
- * @typedef {import('./types.js').RuleAttr} RuleAttr
33700
- * @typedef {import('./types.js').Node} Node
33546
+ * @param {{[x: string]: unknown, type: string}} query
33701
33547
  */
33548
+ function unknownType(query) {
33549
+ throw new Error('Unknown type `' + query.type + '`')
33550
+ }
33702
33551
 
33703
-
33704
-
33705
- var attribute_handle = zwitch('operator', {
33706
- unknown: unknownOperator,
33707
- invalid: exists,
33708
- handlers: {
33709
- '=': exact,
33710
- '^=': begins,
33711
- '$=': ends,
33712
- '*=': containsString,
33713
- '~=': containsArray
33714
- }
33715
- })
33552
+ // Shouldn’t be invoked, parser gives correct data.
33553
+ /* c8 ignore next 3 */
33554
+ function invalidType() {
33555
+ throw new Error('Invalid type')
33556
+ }
33716
33557
 
33717
33558
  /**
33718
- * @param {Rule} query
33719
- * @param {Node} node
33559
+ * @param {boolean} one
33720
33560
  */
33721
- function attribute(query, node) {
33722
- var index = -1
33561
+ function collector(one) {
33562
+ /** @type {Array.<Node>} */
33563
+ var result = []
33564
+ /** @type {boolean} */
33565
+ var found
33723
33566
 
33724
- while (++index < query.attrs.length) {
33725
- if (!attribute_handle(query.attrs[index], node)) return false
33567
+ collect.result = result
33568
+
33569
+ return collect
33570
+
33571
+ /**
33572
+ * Append nodes to array, filtering out duplicates.
33573
+ *
33574
+ * @param {Node|Array.<Node>} node
33575
+ */
33576
+ function collect(node) {
33577
+ var index = -1
33578
+
33579
+ if ('length' in node) {
33580
+ while (++index < node.length) {
33581
+ collectOne(node[index])
33582
+ }
33583
+ } else {
33584
+ collectOne(node)
33585
+ }
33726
33586
  }
33727
33587
 
33728
- return true
33729
- }
33588
+ /**
33589
+ * @param {Node} node
33590
+ */
33591
+ function collectOne(node) {
33592
+ if (one) {
33593
+ /* Shouldn’t happen, safeguards performance problems. */
33594
+ /* c8 ignore next */
33595
+ if (found) throw new Error('Cannot collect multiple nodes')
33730
33596
 
33731
- /**
33732
- * `[attr]`
33733
- *
33734
- * @param {RuleAttr} query
33735
- * @param {Node} node
33736
- */
33737
- function exists(query, node) {
33738
- return node[query.name] !== null && node[query.name] !== undefined
33739
- }
33597
+ found = true
33598
+ }
33740
33599
 
33741
- /**
33742
- * `[attr=value]`
33743
- *
33744
- * @param {RuleAttr} query
33745
- * @param {Node} node
33746
- */
33747
- function exact(query, node) {
33748
- return exists(query, node) && String(node[query.name]) === query.value
33600
+ if (!result.includes(node)) result.push(node)
33601
+ }
33749
33602
  }
33750
33603
 
33604
+ // EXTERNAL MODULE: ./node_modules/css-selector-parser/lib/index.js
33605
+ var lib = __webpack_require__(8079);
33606
+ // EXTERNAL MODULE: ./node_modules/nth-check/lib/index.js
33607
+ var nth_check_lib = __webpack_require__(7540);
33608
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/parse.js
33751
33609
  /**
33752
- * `[attr~=value]`
33753
- *
33754
- * @param {RuleAttr} query
33755
- * @param {Node} node
33610
+ * @typedef {import('./types.js').Selector} Selector
33611
+ * @typedef {import('./types.js').Selectors} Selectors
33612
+ * @typedef {import('./types.js').RuleSet} RuleSet
33613
+ * @typedef {import('./types.js').Rule} Rule
33614
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
33615
+ * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
33756
33616
  */
33757
- function containsArray(query, node) {
33758
- var value = node[query.name]
33759
33617
 
33760
- if (value === null || value === undefined) return false
33761
33618
 
33762
- // If this is an array, and the query is contained in it, return true.
33763
- // Coverage comment in place because TS turns `Array.isArray(unknown)`
33764
- // into `Array.<any>` instead of `Array.<unknown>`.
33765
- // type-coverage:ignore-next-line
33766
- if (Array.isArray(value) && value.includes(query.value)) {
33767
- return true
33768
- }
33769
33619
 
33770
- // For all other values, return whether this is an exact match.
33771
- return String(value) === query.value
33772
- }
33620
+
33621
+
33622
+ /** @type {import('nth-check').default} */
33623
+ // @ts-ignore
33624
+ var nthCheck = nth_check_lib/* default */.ZP
33625
+
33626
+ var nth = new Set([
33627
+ 'nth-child',
33628
+ 'nth-last-child',
33629
+ 'nth-of-type',
33630
+ 'nth-last-of-type'
33631
+ ])
33632
+
33633
+ var parser = new lib/* CssSelectorParser */.N()
33634
+
33635
+ parser.registerAttrEqualityMods('~', '^', '$', '*')
33636
+ parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
33637
+ parser.registerNestingOperators('>', '+', '~')
33638
+
33639
+ var compile = zwitch('type', {handlers: {selectors: parse_selectors, ruleSet: parse_ruleSet, rule: parse_rule}})
33773
33640
 
33774
33641
  /**
33775
- * `[attr^=value]`
33776
- *
33777
- * @param {RuleAttr} query
33778
- * @param {Node} node
33642
+ * @param {string} selector
33643
+ * @returns {Selector}
33779
33644
  */
33780
- function begins(query, node) {
33781
- var value = node[query.name]
33645
+ function parse(selector) {
33646
+ if (typeof selector !== 'string') {
33647
+ throw new TypeError('Expected `string` as selector, not `' + selector + '`')
33648
+ }
33782
33649
 
33783
- return (
33784
- typeof value === 'string' &&
33785
- value.slice(0, query.value.length) === query.value
33786
- )
33650
+ // @ts-ignore types are wrong.
33651
+ return compile(parser.parse(selector))
33787
33652
  }
33788
33653
 
33789
33654
  /**
33790
- * `[attr$=value]`
33791
- *
33792
- * @param {RuleAttr} query
33793
- * @param {Node} node
33655
+ * @param {Selectors} query
33794
33656
  */
33795
- function ends(query, node) {
33796
- var value = node[query.name]
33657
+ function parse_selectors(query) {
33658
+ var selectors = query.selectors
33659
+ var index = -1
33797
33660
 
33798
- return (
33799
- typeof value === 'string' &&
33800
- value.slice(-query.value.length) === query.value
33801
- )
33802
- }
33661
+ while (++index < selectors.length) {
33662
+ compile(selectors[index])
33663
+ }
33803
33664
 
33804
- /**
33805
- * `[attr*=value]`
33806
- *
33807
- * @param {RuleAttr} query
33808
- * @param {Node} node
33809
- */
33810
- function containsString(query, node) {
33811
- var value = node[query.name]
33812
- return typeof value === 'string' && value.includes(query.value)
33665
+ return query
33813
33666
  }
33814
33667
 
33815
- // Shouldn’t be invoked, Parser throws an error instead.
33816
- /* c8 ignore next 6 */
33817
33668
  /**
33818
- * @param {{[x: string]: unknown, type: string}} query
33669
+ * @param {RuleSet} query
33819
33670
  */
33820
- function unknownOperator(query) {
33821
- throw new Error('Unknown operator `' + query.operator + '`')
33671
+ function parse_ruleSet(query) {
33672
+ return parse_rule(query.rule)
33822
33673
  }
33823
33674
 
33824
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
33825
- /**
33826
- * @typedef {import('./types.js').Rule} Rule
33827
- * @typedef {import('./types.js').Node} Node
33828
- */
33829
-
33830
33675
  /**
33831
33676
  * @param {Rule} query
33832
- * @param {Node} node
33833
- */
33834
- function name_name(query, node) {
33835
- return query.tagName === '*' || query.tagName === node.type
33836
- }
33837
-
33838
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
33839
- /**
33840
- * @typedef {import('./types.js').Rule} Rule
33841
- * @typedef {import('./types.js').Node} Node
33842
- * @typedef {import('./types.js').Parent} Parent
33843
- * @typedef {import('./types.js').SelectState} SelectState
33844
33677
  */
33678
+ function parse_rule(query) {
33679
+ var pseudos = query.pseudos || []
33680
+ var index = -1
33681
+ /** @type {RulePseudo|RulePseudoNth} */
33682
+ var pseudo
33845
33683
 
33684
+ while (++index < pseudos.length) {
33685
+ pseudo = pseudos[index]
33846
33686
 
33687
+ if (nth.has(pseudo.name)) {
33688
+ // @ts-ignore Patch a non-primitive type.
33689
+ pseudo.value = nthCheck(pseudo.value)
33690
+ // @ts-ignore Patch a non-primitive type.
33691
+ pseudo.valueType = 'function'
33692
+ }
33693
+ }
33847
33694
 
33695
+ compile(query.rule)
33848
33696
 
33849
-
33850
- /**
33851
- * @param {Rule} query
33852
- * @param {Node} node
33853
- * @param {number|null} index
33854
- * @param {Parent|null} parent
33855
- * @param {SelectState} state
33856
- * @returns {boolean}
33857
- */
33858
- function test(query, node, index, parent, state) {
33859
- if (query.id) throw new Error('Invalid selector: id')
33860
- if (query.classNames) throw new Error('Invalid selector: class')
33861
-
33862
- return Boolean(
33863
- node &&
33864
- (!query.tagName || name_name(query, node)) &&
33865
- (!query.attrs || attribute(query, node)) &&
33866
- (!query.pseudos || pseudo(query, node, index, parent, state))
33867
- )
33697
+ return query
33868
33698
  }
33869
33699
 
33870
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/any.js
33700
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
33871
33701
  /**
33872
- * @typedef {import('./types.js').Selector} Selector
33873
- * @typedef {import('./types.js').Selectors} Selectors
33874
- * @typedef {import('./types.js').Rule} Rule
33875
- * @typedef {import('./types.js').RuleSet} RuleSet
33876
- * @typedef {import('./types.js').RulePseudo} RulePseudo
33877
- * @typedef {import('./types.js').Query} Query
33878
- * @typedef {import('./types.js').Node} Node
33879
- * @typedef {import('./types.js').Parent} Parent
33880
- * @typedef {import('./types.js').SelectIterator} SelectIterator
33881
- * @typedef {import('./types.js').SelectState} SelectState
33702
+ * @typedef {import('unist').Node} Node
33882
33703
  */
33883
33704
 
33884
33705
 
33885
33706
 
33886
33707
 
33887
-
33888
-
33889
-
33890
- var type = zwitch('type', {
33891
- unknown: unknownType,
33892
- invalid: invalidType,
33893
- handlers: {selectors, ruleSet, rule}
33894
- })
33895
-
33896
33708
  /**
33897
- * @param {Selectors|RuleSet|Rule} query
33898
- * @param {Node} node
33899
- * @param {SelectState} state
33709
+ * @param {string} selector
33710
+ * @param {Node} [node]
33711
+ * @returns {boolean}
33900
33712
  */
33901
- function any(query, node, state) {
33902
- // @ts-ignore zwitch types are off.
33903
- return query && node ? type(query, node, state) : []
33713
+ function unist_util_select_matches(selector, node) {
33714
+ return Boolean(any(parse(selector), node, {one: true, shallow: true, any: any})[0])
33904
33715
  }
33905
33716
 
33906
33717
  /**
33907
- * @param {Selectors} query
33908
- * @param {Node} node
33909
- * @param {SelectState} state
33718
+ * @param {string} selector
33719
+ * @param {Node} [node]
33720
+ * @returns {Node|null}
33910
33721
  */
33911
- function selectors(query, node, state) {
33912
- var collect = collector(state.one)
33913
- var index = -1
33914
-
33915
- while (++index < query.selectors.length) {
33916
- collect(ruleSet(query.selectors[index], node, state))
33917
- }
33918
-
33919
- return collect.result
33722
+ function unist_util_select_select(selector, node) {
33723
+ return any(parse(selector), node, {one: true, any: any})[0] || null
33920
33724
  }
33921
33725
 
33922
33726
  /**
33923
- * @param {RuleSet} query
33924
- * @param {Node} node
33925
- * @param {SelectState} state
33727
+ * @param {string} selector
33728
+ * @param {Node} [node]
33729
+ * @returns {Array.<Node>}
33926
33730
  */
33927
- function ruleSet(query, node, state) {
33928
- return rule(query.rule, node, state)
33731
+ function selectAll(selector, node) {
33732
+ return any(parse(selector), node, {any: any})
33929
33733
  }
33930
33734
 
33735
+
33736
+ /***/ }),
33737
+
33738
+ /***/ 6393:
33739
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
33740
+
33741
+ "use strict";
33742
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33743
+ /* harmony export */ "Vn": () => (/* binding */ visit)
33744
+ /* harmony export */ });
33745
+ /* harmony import */ var unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9445);
33931
33746
  /**
33932
- * @param {Rule} query
33933
- * @param {Node} tree
33934
- * @param {SelectState} state
33747
+ * @typedef {import('unist').Node} Node
33748
+ * @typedef {import('unist').Parent} Parent
33749
+ * @typedef {import('unist-util-is').Test} Test
33750
+ * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
33751
+ * @typedef {import('./complex-types.js').Visitor} Visitor
33935
33752
  */
33936
- function rule(query, tree, state) {
33937
- var collect = collector(state.one)
33938
33753
 
33939
- if (state.shallow && query.rule) {
33940
- throw new Error('Expected selector without nesting')
33941
- }
33942
33754
 
33943
- nest(
33944
- query,
33945
- tree,
33946
- 0,
33947
- null,
33948
- configure(query, {
33949
- scopeNodes: root(tree) ? tree.children : [tree],
33950
- index: false,
33951
- iterator,
33952
- one: state.one,
33953
- shallow: state.shallow,
33954
- any: state.any
33955
- })
33956
- )
33957
33755
 
33958
- return collect.result
33756
+ /**
33757
+ * Visit children of tree which pass test.
33758
+ *
33759
+ * @param tree
33760
+ * Tree to walk
33761
+ * @param [test]
33762
+ * `unist-util-is`-compatible test
33763
+ * @param visitor
33764
+ * Function called for nodes that pass `test`.
33765
+ * @param reverse
33766
+ * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
33767
+ */
33768
+ const visit =
33769
+ /**
33770
+ * @type {(
33771
+ * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
33772
+ * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
33773
+ * )}
33774
+ */
33775
+ (
33776
+ /**
33777
+ * @param {Node} tree
33778
+ * @param {Test} test
33779
+ * @param {import('./complex-types.js').Visitor} visitor
33780
+ * @param {boolean} [reverse]
33781
+ */
33782
+ function (tree, test, visitor, reverse) {
33783
+ if (typeof test === 'function' && typeof visitor !== 'function') {
33784
+ reverse = visitor
33785
+ visitor = test
33786
+ test = null
33787
+ }
33959
33788
 
33960
- /** @type {SelectIterator} */
33961
- function iterator(query, node, index, parent, state) {
33962
- if (test(query, node, index, parent, state)) {
33963
- if ('rule' in query) {
33964
- nest(query.rule, node, index, parent, configure(query.rule, state))
33965
- } else {
33966
- collect(node)
33967
- state.found = true
33789
+ (0,unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__/* .visitParents */ .S4)(tree, test, overload, reverse)
33790
+
33791
+ /**
33792
+ * @param {Node} node
33793
+ * @param {Array<Parent>} parents
33794
+ */
33795
+ function overload(node, parents) {
33796
+ const parent = parents[parents.length - 1]
33797
+ return visitor(
33798
+ node,
33799
+ parent ? parent.children.indexOf(node) : null,
33800
+ parent
33801
+ )
33968
33802
  }
33969
33803
  }
33970
- }
33971
- }
33804
+ )
33972
33805
 
33973
- /**
33974
- * @template {SelectState} S
33975
- * @param {Rule} query
33976
- * @param {S} state
33977
- * @returns {S}
33978
- */
33979
- function configure(query, state) {
33980
- var pseudos = query.pseudos || []
33981
- var index = -1
33982
33806
 
33983
- while (++index < pseudos.length) {
33984
- if (pseudo.needsIndex.includes(pseudos[index].name)) {
33985
- state.index = true
33986
- break
33987
- }
33988
- }
33989
33807
 
33990
- return state
33991
- }
33992
33808
 
33993
- // Shouldn’t be invoked, all data is handled.
33994
- /* c8 ignore next 6 */
33809
+ /***/ }),
33810
+
33811
+ /***/ 9445:
33812
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
33813
+
33814
+ "use strict";
33815
+
33816
+ // EXPORTS
33817
+ __webpack_require__.d(__webpack_exports__, {
33818
+ "AM": () => (/* binding */ SKIP),
33819
+ "S4": () => (/* binding */ visitParents)
33820
+ });
33821
+
33822
+ // UNUSED EXPORTS: CONTINUE, EXIT
33823
+
33824
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-is/index.js
33995
33825
  /**
33996
- * @param {{[x: string]: unknown, type: string}} query
33826
+ * @typedef {import('unist').Node} Node
33827
+ * @typedef {import('unist').Parent} Parent
33828
+ *
33829
+ * @typedef {string} Type
33830
+ * @typedef {Object<string, unknown>} Props
33831
+ *
33832
+ * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
33997
33833
  */
33998
- function unknownType(query) {
33999
- throw new Error('Unknown type `' + query.type + '`')
34000
- }
34001
33834
 
34002
- // Shouldn’t be invoked, parser gives correct data.
34003
- /* c8 ignore next 3 */
34004
- function invalidType() {
34005
- throw new Error('Invalid type')
34006
- }
33835
+ /**
33836
+ * Check if a node passes a test
33837
+ *
33838
+ * @callback TestFunctionAnything
33839
+ * @param {Node} node
33840
+ * @param {number|null|undefined} [index]
33841
+ * @param {Parent|null|undefined} [parent]
33842
+ * @returns {boolean|void}
33843
+ */
34007
33844
 
34008
33845
  /**
34009
- * @param {boolean} one
33846
+ * Check if a node passes a certain node test
33847
+ *
33848
+ * @template {Node} X
33849
+ * @callback TestFunctionPredicate
33850
+ * @param {Node} node
33851
+ * @param {number|null|undefined} [index]
33852
+ * @param {Parent|null|undefined} [parent]
33853
+ * @returns {node is X}
34010
33854
  */
34011
- function collector(one) {
34012
- /** @type {Array.<Node>} */
34013
- var result = []
34014
- /** @type {boolean} */
34015
- var found
34016
33855
 
34017
- collect.result = result
33856
+ /**
33857
+ * @callback AssertAnything
33858
+ * @param {unknown} [node]
33859
+ * @param {number|null|undefined} [index]
33860
+ * @param {Parent|null|undefined} [parent]
33861
+ * @returns {boolean}
33862
+ */
34018
33863
 
34019
- return collect
33864
+ /**
33865
+ * Check if a node passes a certain node test
33866
+ *
33867
+ * @template {Node} Y
33868
+ * @callback AssertPredicate
33869
+ * @param {unknown} [node]
33870
+ * @param {number|null|undefined} [index]
33871
+ * @param {Parent|null|undefined} [parent]
33872
+ * @returns {node is Y}
33873
+ */
34020
33874
 
33875
+ const is =
34021
33876
  /**
34022
- * Append nodes to array, filtering out duplicates.
33877
+ * Check if a node passes a test.
33878
+ * When a `parent` node is known the `index` of node should also be given.
34023
33879
  *
34024
- * @param {Node|Array.<Node>} node
33880
+ * @type {(
33881
+ * (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => node is T) &
33882
+ * ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
33883
+ * )}
34025
33884
  */
34026
- function collect(node) {
34027
- var index = -1
33885
+ (
33886
+ /**
33887
+ * Check if a node passes a test.
33888
+ * When a `parent` node is known the `index` of node should also be given.
33889
+ *
33890
+ * @param {unknown} [node] Node to check
33891
+ * @param {Test} [test]
33892
+ * When nullish, checks if `node` is a `Node`.
33893
+ * When `string`, works like passing `function (node) {return node.type === test}`.
33894
+ * When `function` checks if function passed the node is true.
33895
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33896
+ * When `array`, checks any one of the subtests pass.
33897
+ * @param {number|null|undefined} [index] Position of `node` in `parent`
33898
+ * @param {Parent|null|undefined} [parent] Parent of `node`
33899
+ * @param {unknown} [context] Context object to invoke `test` with
33900
+ * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
33901
+ */
33902
+ // eslint-disable-next-line max-params
33903
+ function is(node, test, index, parent, context) {
33904
+ const check = convert(test)
34028
33905
 
34029
- if ('length' in node) {
34030
- while (++index < node.length) {
34031
- collectOne(node[index])
33906
+ if (
33907
+ index !== undefined &&
33908
+ index !== null &&
33909
+ (typeof index !== 'number' ||
33910
+ index < 0 ||
33911
+ index === Number.POSITIVE_INFINITY)
33912
+ ) {
33913
+ throw new Error('Expected positive finite index')
34032
33914
  }
34033
- } else {
34034
- collectOne(node)
33915
+
33916
+ if (
33917
+ parent !== undefined &&
33918
+ parent !== null &&
33919
+ (!is(parent) || !parent.children)
33920
+ ) {
33921
+ throw new Error('Expected parent node')
33922
+ }
33923
+
33924
+ if (
33925
+ (parent === undefined || parent === null) !==
33926
+ (index === undefined || index === null)
33927
+ ) {
33928
+ throw new Error('Expected both parent and index')
33929
+ }
33930
+
33931
+ // @ts-expect-error Looks like a node.
33932
+ return node && node.type && typeof node.type === 'string'
33933
+ ? Boolean(check.call(context, node, index, parent))
33934
+ : false
34035
33935
  }
34036
- }
33936
+ )
34037
33937
 
33938
+ const convert =
34038
33939
  /**
34039
- * @param {Node} node
33940
+ * @type {(
33941
+ * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
33942
+ * ((test?: Test) => AssertAnything)
33943
+ * )}
34040
33944
  */
34041
- function collectOne(node) {
34042
- if (one) {
34043
- /* Shouldn’t happen, safeguards performance problems. */
34044
- /* c8 ignore next */
34045
- if (found) throw new Error('Cannot collect multiple nodes')
33945
+ (
33946
+ /**
33947
+ * Generate an assertion from a check.
33948
+ * @param {Test} [test]
33949
+ * When nullish, checks if `node` is a `Node`.
33950
+ * When `string`, works like passing `function (node) {return node.type === test}`.
33951
+ * When `function` checks if function passed the node is true.
33952
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33953
+ * When `array`, checks any one of the subtests pass.
33954
+ * @returns {AssertAnything}
33955
+ */
33956
+ function (test) {
33957
+ if (test === undefined || test === null) {
33958
+ return ok
33959
+ }
34046
33960
 
34047
- found = true
34048
- }
33961
+ if (typeof test === 'string') {
33962
+ return typeFactory(test)
33963
+ }
34049
33964
 
34050
- if (!result.includes(node)) result.push(node)
34051
- }
34052
- }
33965
+ if (typeof test === 'object') {
33966
+ return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
33967
+ }
34053
33968
 
34054
- // EXTERNAL MODULE: ./node_modules/css-selector-parser/lib/index.js
34055
- var lib = __webpack_require__(8079);
34056
- // EXTERNAL MODULE: ./node_modules/nth-check/lib/index.js
34057
- var nth_check_lib = __webpack_require__(7540);
34058
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/parse.js
33969
+ if (typeof test === 'function') {
33970
+ return castFactory(test)
33971
+ }
33972
+
33973
+ throw new Error('Expected function, string, or object as test')
33974
+ }
33975
+ )
34059
33976
  /**
34060
- * @typedef {import('./types.js').Selector} Selector
34061
- * @typedef {import('./types.js').Selectors} Selectors
34062
- * @typedef {import('./types.js').RuleSet} RuleSet
34063
- * @typedef {import('./types.js').Rule} Rule
34064
- * @typedef {import('./types.js').RulePseudo} RulePseudo
34065
- * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
33977
+ * @param {Array.<Type|Props|TestFunctionAnything>} tests
33978
+ * @returns {AssertAnything}
34066
33979
  */
33980
+ function anyFactory(tests) {
33981
+ /** @type {Array.<AssertAnything>} */
33982
+ const checks = []
33983
+ let index = -1
34067
33984
 
33985
+ while (++index < tests.length) {
33986
+ checks[index] = convert(tests[index])
33987
+ }
34068
33988
 
33989
+ return castFactory(any)
34069
33990
 
33991
+ /**
33992
+ * @this {unknown}
33993
+ * @param {unknown[]} parameters
33994
+ * @returns {boolean}
33995
+ */
33996
+ function any(...parameters) {
33997
+ let index = -1
34070
33998
 
33999
+ while (++index < checks.length) {
34000
+ if (checks[index].call(this, ...parameters)) return true
34001
+ }
34071
34002
 
34072
- /** @type {import('nth-check').default} */
34073
- // @ts-ignore
34074
- var nthCheck = nth_check_lib/* default */.ZP
34003
+ return false
34004
+ }
34005
+ }
34075
34006
 
34076
- var nth = new Set([
34077
- 'nth-child',
34078
- 'nth-last-child',
34079
- 'nth-of-type',
34080
- 'nth-last-of-type'
34081
- ])
34007
+ /**
34008
+ * Utility to assert each property in `test` is represented in `node`, and each
34009
+ * values are strictly equal.
34010
+ *
34011
+ * @param {Props} check
34012
+ * @returns {AssertAnything}
34013
+ */
34014
+ function propsFactory(check) {
34015
+ return castFactory(all)
34082
34016
 
34083
- var parser = new lib/* CssSelectorParser */.N()
34017
+ /**
34018
+ * @param {Node} node
34019
+ * @returns {boolean}
34020
+ */
34021
+ function all(node) {
34022
+ /** @type {string} */
34023
+ let key
34084
34024
 
34085
- parser.registerAttrEqualityMods('~', '^', '$', '*')
34086
- parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
34087
- parser.registerNestingOperators('>', '+', '~')
34025
+ for (key in check) {
34026
+ // @ts-expect-error: hush, it sure works as an index.
34027
+ if (node[key] !== check[key]) return false
34028
+ }
34088
34029
 
34089
- var compile = zwitch('type', {handlers: {selectors: parse_selectors, ruleSet: parse_ruleSet, rule: parse_rule}})
34030
+ return true
34031
+ }
34032
+ }
34090
34033
 
34091
34034
  /**
34092
- * @param {string} selector
34093
- * @returns {Selector}
34035
+ * Utility to convert a string into a function which checks a given node’s type
34036
+ * for said string.
34037
+ *
34038
+ * @param {Type} check
34039
+ * @returns {AssertAnything}
34094
34040
  */
34095
- function parse(selector) {
34096
- if (typeof selector !== 'string') {
34097
- throw new TypeError('Expected `string` as selector, not `' + selector + '`')
34098
- }
34041
+ function typeFactory(check) {
34042
+ return castFactory(type)
34099
34043
 
34100
- // @ts-ignore types are wrong.
34101
- return compile(parser.parse(selector))
34044
+ /**
34045
+ * @param {Node} node
34046
+ */
34047
+ function type(node) {
34048
+ return node && node.type === check
34049
+ }
34102
34050
  }
34103
34051
 
34104
34052
  /**
34105
- * @param {Selectors} query
34053
+ * Utility to convert a string into a function which checks a given node’s type
34054
+ * for said string.
34055
+ * @param {TestFunctionAnything} check
34056
+ * @returns {AssertAnything}
34106
34057
  */
34107
- function parse_selectors(query) {
34108
- var selectors = query.selectors
34109
- var index = -1
34058
+ function castFactory(check) {
34059
+ return assertion
34110
34060
 
34111
- while (++index < selectors.length) {
34112
- compile(selectors[index])
34061
+ /**
34062
+ * @this {unknown}
34063
+ * @param {Array.<unknown>} parameters
34064
+ * @returns {boolean}
34065
+ */
34066
+ function assertion(...parameters) {
34067
+ // @ts-expect-error: spreading is fine.
34068
+ return Boolean(check.call(this, ...parameters))
34113
34069
  }
34070
+ }
34114
34071
 
34115
- return query
34072
+ // Utility to return true.
34073
+ function ok() {
34074
+ return true
34116
34075
  }
34117
34076
 
34077
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.js
34118
34078
  /**
34119
- * @param {RuleSet} query
34079
+ * @param {string} d
34080
+ * @returns {string}
34120
34081
  */
34121
- function parse_ruleSet(query) {
34122
- return parse_rule(query.rule)
34082
+ function color(d) {
34083
+ return '\u001B[33m' + d + '\u001B[39m'
34123
34084
  }
34124
34085
 
34086
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
34125
34087
  /**
34126
- * @param {Rule} query
34088
+ * @typedef {import('unist').Node} Node
34089
+ * @typedef {import('unist').Parent} Parent
34090
+ * @typedef {import('unist-util-is').Test} Test
34091
+ * @typedef {import('./complex-types.js').Action} Action
34092
+ * @typedef {import('./complex-types.js').Index} Index
34093
+ * @typedef {import('./complex-types.js').ActionTuple} ActionTuple
34094
+ * @typedef {import('./complex-types.js').VisitorResult} VisitorResult
34095
+ * @typedef {import('./complex-types.js').Visitor} Visitor
34127
34096
  */
34128
- function parse_rule(query) {
34129
- var pseudos = query.pseudos || []
34130
- var index = -1
34131
- /** @type {RulePseudo|RulePseudoNth} */
34132
- var pseudo
34133
34097
 
34134
- while (++index < pseudos.length) {
34135
- pseudo = pseudos[index]
34136
34098
 
34137
- if (nth.has(pseudo.name)) {
34138
- // @ts-ignore Patch a non-primitive type.
34139
- pseudo.value = nthCheck(pseudo.value)
34140
- // @ts-ignore Patch a non-primitive type.
34141
- pseudo.valueType = 'function'
34142
- }
34143
- }
34144
34099
 
34145
- compile(query.rule)
34146
34100
 
34147
- return query
34148
- }
34101
+ /**
34102
+ * Continue traversing as normal
34103
+ */
34104
+ const CONTINUE = true
34105
+ /**
34106
+ * Do not traverse this node’s children
34107
+ */
34108
+ const SKIP = 'skip'
34109
+ /**
34110
+ * Stop traversing immediately
34111
+ */
34112
+ const EXIT = false
34149
34113
 
34150
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
34151
34114
  /**
34152
- * @typedef {import('unist').Node} Node
34115
+ * Visit children of tree which pass test.
34116
+ *
34117
+ * @param tree
34118
+ * Tree to walk
34119
+ * @param [test]
34120
+ * `unist-util-is`-compatible test
34121
+ * @param visitor
34122
+ * Function called for nodes that pass `test`.
34123
+ * @param [reverse=false]
34124
+ * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
34153
34125
  */
34126
+ const visitParents =
34127
+ /**
34128
+ * @type {(
34129
+ * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
34130
+ * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
34131
+ * )}
34132
+ */
34133
+ (
34134
+ /**
34135
+ * @param {Node} tree
34136
+ * @param {Test} test
34137
+ * @param {import('./complex-types.js').Visitor<Node>} visitor
34138
+ * @param {boolean} [reverse=false]
34139
+ */
34140
+ function (tree, test, visitor, reverse) {
34141
+ if (typeof test === 'function' && typeof visitor !== 'function') {
34142
+ reverse = visitor
34143
+ // @ts-expect-error no visitor given, so `visitor` is test.
34144
+ visitor = test
34145
+ test = null
34146
+ }
34154
34147
 
34148
+ const is = convert(test)
34149
+ const step = reverse ? -1 : 1
34155
34150
 
34151
+ factory(tree, null, [])()
34156
34152
 
34153
+ /**
34154
+ * @param {Node} node
34155
+ * @param {number?} index
34156
+ * @param {Array<Parent>} parents
34157
+ */
34158
+ function factory(node, index, parents) {
34159
+ /** @type {Record<string, unknown>} */
34160
+ // @ts-expect-error: hush
34161
+ const value = typeof node === 'object' && node !== null ? node : {}
34162
+ /** @type {string|undefined} */
34163
+ let name
34157
34164
 
34158
- /**
34159
- * @param {string} selector
34160
- * @param {Node} [node]
34161
- * @returns {boolean}
34162
- */
34163
- function unist_util_select_matches(selector, node) {
34164
- return Boolean(any(parse(selector), node, {one: true, shallow: true, any: any})[0])
34165
- }
34165
+ if (typeof value.type === 'string') {
34166
+ name =
34167
+ typeof value.tagName === 'string'
34168
+ ? value.tagName
34169
+ : typeof value.name === 'string'
34170
+ ? value.name
34171
+ : undefined
34166
34172
 
34167
- /**
34168
- * @param {string} selector
34169
- * @param {Node} [node]
34170
- * @returns {Node|null}
34171
- */
34172
- function unist_util_select_select(selector, node) {
34173
- return any(parse(selector), node, {one: true, any: any})[0] || null
34174
- }
34173
+ Object.defineProperty(visit, 'name', {
34174
+ value:
34175
+ 'node (' +
34176
+ color(value.type + (name ? '<' + name + '>' : '')) +
34177
+ ')'
34178
+ })
34179
+ }
34180
+
34181
+ return visit
34182
+
34183
+ function visit() {
34184
+ /** @type {ActionTuple} */
34185
+ let result = []
34186
+ /** @type {ActionTuple} */
34187
+ let subresult
34188
+ /** @type {number} */
34189
+ let offset
34190
+ /** @type {Array<Parent>} */
34191
+ let grandparents
34192
+
34193
+ if (!test || is(node, index, parents[parents.length - 1] || null)) {
34194
+ result = toResult(visitor(node, parents))
34195
+
34196
+ if (result[0] === EXIT) {
34197
+ return result
34198
+ }
34199
+ }
34200
+
34201
+ // @ts-expect-error looks like a parent.
34202
+ if (node.children && result[0] !== SKIP) {
34203
+ // @ts-expect-error looks like a parent.
34204
+ offset = (reverse ? node.children.length : -1) + step
34205
+ // @ts-expect-error looks like a parent.
34206
+ grandparents = parents.concat(node)
34207
+
34208
+ // @ts-expect-error looks like a parent.
34209
+ while (offset > -1 && offset < node.children.length) {
34210
+ // @ts-expect-error looks like a parent.
34211
+ subresult = factory(node.children[offset], offset, grandparents)()
34212
+
34213
+ if (subresult[0] === EXIT) {
34214
+ return subresult
34215
+ }
34216
+
34217
+ offset =
34218
+ typeof subresult[1] === 'number' ? subresult[1] : offset + step
34219
+ }
34220
+ }
34221
+
34222
+ return result
34223
+ }
34224
+ }
34225
+ }
34226
+ )
34175
34227
 
34176
34228
  /**
34177
- * @param {string} selector
34178
- * @param {Node} [node]
34179
- * @returns {Array.<Node>}
34229
+ * @param {VisitorResult} value
34230
+ * @returns {ActionTuple}
34180
34231
  */
34181
- function selectAll(selector, node) {
34182
- return any(parse(selector), node, {any: any})
34232
+ function toResult(value) {
34233
+ if (Array.isArray(value)) {
34234
+ return value
34235
+ }
34236
+
34237
+ if (typeof value === 'number') {
34238
+ return [CONTINUE, value]
34239
+ }
34240
+
34241
+ return [value]
34183
34242
  }
34184
34243
 
34185
34244
 
@@ -34402,7 +34461,7 @@ var _require3 = __webpack_require__(8447),
34402
34461
  var BaseUrlContext = __webpack_require__(6785);
34403
34462
  var createElement = __webpack_require__(5894);
34404
34463
  var CustomParsers = Object.values(__webpack_require__(8521));
34405
- var customCompilers = Object.values(__webpack_require__(9647));
34464
+ var customCompilers = Object.values(__webpack_require__(8457));
34406
34465
  var registerCustomComponents = __webpack_require__(1264);
34407
34466
  var _require4 = __webpack_require__(2531),
34408
34467
  options = _require4.options,
@@ -34412,7 +34471,7 @@ var _require5 = __webpack_require__(8160),
34412
34471
  var toPlainText = __webpack_require__(4792);
34413
34472
  var sectionAnchorId = __webpack_require__(9620);
34414
34473
  var tableFlattening = __webpack_require__(4625);
34415
- var _require6 = __webpack_require__(1269),
34474
+ var _require6 = __webpack_require__(2692),
34416
34475
  remarkTransformers = _require6.remarkTransformers,
34417
34476
  rehypeTransformers = _require6.rehypeTransformers;
34418
34477
  var createSchema = __webpack_require__(8229);