@readme/markdown 6.68.0-beta.1 → 6.68.0-beta.3
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.
- package/dist/main.js +1977 -1949
- package/dist/main.node.js +1908 -1861
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -8786,64 +8786,94 @@ module.exports = function ImageCompiler() {
|
|
|
8786
8786
|
|
|
8787
8787
|
/***/ }),
|
|
8788
8788
|
|
|
8789
|
-
/***/
|
|
8789
|
+
/***/ 8457:
|
|
8790
8790
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8791
8791
|
|
|
8792
8792
|
"use strict";
|
|
8793
|
+
// ESM COMPAT FLAG
|
|
8793
8794
|
__webpack_require__.r(__webpack_exports__);
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
/*
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8795
|
+
|
|
8796
|
+
// EXPORTS
|
|
8797
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
8798
|
+
"breakCompiler": () => (/* reexport */ (break_default())),
|
|
8799
|
+
"codeTabsCompiler": () => (/* reexport */ (code_tabs_default())),
|
|
8800
|
+
"divCompiler": () => (/* reexport */ (div_default())),
|
|
8801
|
+
"escapeCompiler": () => (/* reexport */ (escape_default())),
|
|
8802
|
+
"figureCompiler": () => (/* reexport */ (figure_default())),
|
|
8803
|
+
"htmlBlockCompiler": () => (/* reexport */ (html_block_default())),
|
|
8804
|
+
"iconCompiler": () => (/* reexport */ (i_default())),
|
|
8805
|
+
"imageCompiler": () => (/* reexport */ (image_default())),
|
|
8806
|
+
"rdmeCalloutCompiler": () => (/* reexport */ (callout_default())),
|
|
8807
|
+
"rdmeEmbedCompiler": () => (/* reexport */ (embed_default())),
|
|
8808
|
+
"rdmeGlossaryCompiler": () => (/* reexport */ (glossary_default())),
|
|
8809
|
+
"rdmePinCompiler": () => (/* reexport */ (pin_default())),
|
|
8810
|
+
"rdmeVarCompiler": () => (/* reexport */ (var_default())),
|
|
8811
|
+
"reusableContentCompiler": () => (/* reexport */ ReusableContentCompiler),
|
|
8812
|
+
"tableCompiler": () => (/* reexport */ (table_default())),
|
|
8813
|
+
"tableHeadCompiler": () => (/* reexport */ (table_head_default())),
|
|
8814
|
+
"yamlCompiler": () => (/* reexport */ (yaml_default()))
|
|
8815
|
+
});
|
|
8816
|
+
|
|
8817
|
+
// EXTERNAL MODULE: ./processor/compile/break.js
|
|
8818
|
+
var compile_break = __webpack_require__(3688);
|
|
8819
|
+
var break_default = /*#__PURE__*/__webpack_require__.n(compile_break);
|
|
8820
|
+
// EXTERNAL MODULE: ./processor/compile/code-tabs.js
|
|
8821
|
+
var code_tabs = __webpack_require__(4079);
|
|
8822
|
+
var code_tabs_default = /*#__PURE__*/__webpack_require__.n(code_tabs);
|
|
8823
|
+
// EXTERNAL MODULE: ./processor/compile/div.js
|
|
8824
|
+
var div = __webpack_require__(58);
|
|
8825
|
+
var div_default = /*#__PURE__*/__webpack_require__.n(div);
|
|
8826
|
+
// EXTERNAL MODULE: ./processor/compile/escape.js
|
|
8827
|
+
var compile_escape = __webpack_require__(8418);
|
|
8828
|
+
var escape_default = /*#__PURE__*/__webpack_require__.n(compile_escape);
|
|
8829
|
+
// EXTERNAL MODULE: ./processor/compile/figure.js
|
|
8830
|
+
var figure = __webpack_require__(8705);
|
|
8831
|
+
var figure_default = /*#__PURE__*/__webpack_require__.n(figure);
|
|
8832
|
+
// EXTERNAL MODULE: ./processor/compile/html-block.js
|
|
8833
|
+
var html_block = __webpack_require__(3551);
|
|
8834
|
+
var html_block_default = /*#__PURE__*/__webpack_require__.n(html_block);
|
|
8835
|
+
// EXTERNAL MODULE: ./processor/compile/i.js
|
|
8836
|
+
var i = __webpack_require__(4258);
|
|
8837
|
+
var i_default = /*#__PURE__*/__webpack_require__.n(i);
|
|
8838
|
+
// EXTERNAL MODULE: ./processor/compile/image.js
|
|
8839
|
+
var compile_image = __webpack_require__(3356);
|
|
8840
|
+
var image_default = /*#__PURE__*/__webpack_require__.n(compile_image);
|
|
8841
|
+
// EXTERNAL MODULE: ./processor/compile/callout.js
|
|
8842
|
+
var callout = __webpack_require__(5733);
|
|
8843
|
+
var callout_default = /*#__PURE__*/__webpack_require__.n(callout);
|
|
8844
|
+
// EXTERNAL MODULE: ./processor/compile/embed.js
|
|
8845
|
+
var compile_embed = __webpack_require__(4338);
|
|
8846
|
+
var embed_default = /*#__PURE__*/__webpack_require__.n(compile_embed);
|
|
8847
|
+
// EXTERNAL MODULE: ./processor/compile/glossary.js
|
|
8848
|
+
var glossary = __webpack_require__(2459);
|
|
8849
|
+
var glossary_default = /*#__PURE__*/__webpack_require__.n(glossary);
|
|
8850
|
+
// EXTERNAL MODULE: ./processor/compile/pin.js
|
|
8851
|
+
var pin = __webpack_require__(2151);
|
|
8852
|
+
var pin_default = /*#__PURE__*/__webpack_require__.n(pin);
|
|
8853
|
+
// EXTERNAL MODULE: ./processor/compile/var.js
|
|
8854
|
+
var compile_var = __webpack_require__(1067);
|
|
8855
|
+
var var_default = /*#__PURE__*/__webpack_require__.n(compile_var);
|
|
8856
|
+
// EXTERNAL MODULE: ./processor/transform/reusable-content.js
|
|
8857
|
+
var reusable_content = __webpack_require__(5772);
|
|
8858
|
+
;// CONCATENATED MODULE: ./processor/compile/reusable-content.js
|
|
8859
|
+
|
|
8860
|
+
function ReusableContentCompiler() {
|
|
8861
|
+
var Compiler = this.Compiler;
|
|
8862
|
+
var visitors = Compiler.prototype.visitors;
|
|
8863
|
+
visitors[reusable_content/* type */.dt] = function (node) {
|
|
8864
|
+
return "<".concat(reusable_content/* tag */._q, " name=\"").concat(node.name, "\" />");
|
|
8865
|
+
};
|
|
8866
|
+
}
|
|
8867
|
+
// EXTERNAL MODULE: ./processor/compile/table.js
|
|
8868
|
+
var table = __webpack_require__(4669);
|
|
8869
|
+
var table_default = /*#__PURE__*/__webpack_require__.n(table);
|
|
8870
|
+
// EXTERNAL MODULE: ./processor/compile/table-head.js
|
|
8871
|
+
var table_head = __webpack_require__(186);
|
|
8872
|
+
var table_head_default = /*#__PURE__*/__webpack_require__.n(table_head);
|
|
8873
|
+
// EXTERNAL MODULE: ./processor/compile/yaml.js
|
|
8874
|
+
var yaml = __webpack_require__(1773);
|
|
8875
|
+
var yaml_default = /*#__PURE__*/__webpack_require__.n(yaml);
|
|
8876
|
+
;// CONCATENATED MODULE: ./processor/compile/index.js
|
|
8847
8877
|
|
|
8848
8878
|
|
|
8849
8879
|
|
|
@@ -8878,19 +8908,6 @@ module.exports = function PinCompiler() {
|
|
|
8878
8908
|
|
|
8879
8909
|
/***/ }),
|
|
8880
8910
|
|
|
8881
|
-
/***/ 9585:
|
|
8882
|
-
/***/ ((module) => {
|
|
8883
|
-
|
|
8884
|
-
module.exports = function ReusableContentCompiler() {
|
|
8885
|
-
var Compiler = this.Compiler;
|
|
8886
|
-
var visitors = Compiler.prototype.visitors;
|
|
8887
|
-
visitors['reusable-content'] = function (node) {
|
|
8888
|
-
return "<ReadMeReusableContent name=\"".concat(node.name, "\" />");
|
|
8889
|
-
};
|
|
8890
|
-
};
|
|
8891
|
-
|
|
8892
|
-
/***/ }),
|
|
8893
|
-
|
|
8894
8911
|
/***/ 186:
|
|
8895
8912
|
/***/ ((module) => {
|
|
8896
8913
|
|
|
@@ -10148,7 +10165,7 @@ module.exports.tableFlattening = transformer;
|
|
|
10148
10165
|
|
|
10149
10166
|
/***/ }),
|
|
10150
10167
|
|
|
10151
|
-
/***/
|
|
10168
|
+
/***/ 2692:
|
|
10152
10169
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10153
10170
|
|
|
10154
10171
|
"use strict";
|
|
@@ -10161,791 +10178,293 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
10161
10178
|
"remarkTransformers": () => (/* binding */ remarkTransformers)
|
|
10162
10179
|
});
|
|
10163
10180
|
|
|
10164
|
-
// EXTERNAL MODULE: ./
|
|
10165
|
-
var
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
o.__proto__ = p;
|
|
10170
|
-
return o;
|
|
10171
|
-
};
|
|
10172
|
-
return _setPrototypeOf(o, p);
|
|
10173
|
-
}
|
|
10174
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
10181
|
+
// EXTERNAL MODULE: ./processor/transform/reusable-content.js
|
|
10182
|
+
var reusable_content = __webpack_require__(5772);
|
|
10183
|
+
// EXTERNAL MODULE: ./node_modules/unist-util-visit/index.js
|
|
10184
|
+
var unist_util_visit = __webpack_require__(6393);
|
|
10185
|
+
;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
|
|
10175
10186
|
|
|
10176
|
-
function
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10187
|
+
var singleCodeTabs = function singleCodeTabs() {
|
|
10188
|
+
return function (tree) {
|
|
10189
|
+
(0,unist_util_visit/* visit */.Vn)(tree, function (node, index, parent) {
|
|
10190
|
+
if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
|
|
10191
|
+
Object.assign(node, {
|
|
10192
|
+
className: 'tab-panel',
|
|
10193
|
+
data: {
|
|
10194
|
+
hName: 'code',
|
|
10195
|
+
hProperties: {
|
|
10196
|
+
meta: node.meta,
|
|
10197
|
+
lang: node.lang
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10200
|
+
});
|
|
10201
|
+
parent.children[index] = {
|
|
10202
|
+
type: 'code-tabs',
|
|
10203
|
+
className: 'tabs',
|
|
10204
|
+
data: {
|
|
10205
|
+
hName: 'div',
|
|
10206
|
+
hProperties: {
|
|
10207
|
+
className: ['code-tabs']
|
|
10208
|
+
}
|
|
10209
|
+
},
|
|
10210
|
+
children: [node]
|
|
10211
|
+
};
|
|
10212
|
+
}
|
|
10213
|
+
});
|
|
10214
|
+
return tree;
|
|
10215
|
+
};
|
|
10216
|
+
};
|
|
10217
|
+
/* harmony default export */ const single_code_tabs = (singleCodeTabs);
|
|
10218
|
+
// EXTERNAL MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js + 2 modules
|
|
10219
|
+
var unist_util_visit_parents = __webpack_require__(5605);
|
|
10220
|
+
;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
|
|
10202
10221
|
|
|
10203
|
-
|
|
10204
|
-
* Check if a node passes a test
|
|
10205
|
-
*
|
|
10206
|
-
* @callback TestFunctionAnything
|
|
10207
|
-
* @param {Node} node
|
|
10208
|
-
* @param {number|null|undefined} [index]
|
|
10209
|
-
* @param {Parent|null|undefined} [parent]
|
|
10210
|
-
* @returns {boolean|void}
|
|
10211
|
-
*/
|
|
10222
|
+
var rxEscapedPipe = /\\\|/g;
|
|
10212
10223
|
|
|
10213
10224
|
/**
|
|
10214
|
-
*
|
|
10225
|
+
* HAST Transformer that finds all inline code nodes within table cells and
|
|
10226
|
+
* unescapes any escaped pipe chars so that the editor outputs them without
|
|
10227
|
+
* escape chars.
|
|
10215
10228
|
*
|
|
10216
|
-
*
|
|
10217
|
-
* @callback TestFunctionPredicate
|
|
10218
|
-
* @param {Node} node
|
|
10219
|
-
* @param {number|null|undefined} [index]
|
|
10220
|
-
* @param {Parent|null|undefined} [parent]
|
|
10221
|
-
* @returns {node is X}
|
|
10222
|
-
*/
|
|
10223
|
-
|
|
10224
|
-
/**
|
|
10225
|
-
* @callback AssertAnything
|
|
10226
|
-
* @param {unknown} [node]
|
|
10227
|
-
* @param {number|null|undefined} [index]
|
|
10228
|
-
* @param {Parent|null|undefined} [parent]
|
|
10229
|
-
* @returns {boolean}
|
|
10229
|
+
* This appears to be a bug with remark-parse < ~8
|
|
10230
10230
|
*/
|
|
10231
|
+
var tableCellInlineCode = function tableCellInlineCode() {
|
|
10232
|
+
return function (tree) {
|
|
10233
|
+
(0,unist_util_visit/* visit */.Vn)(tree, [{
|
|
10234
|
+
tagName: 'th'
|
|
10235
|
+
}, {
|
|
10236
|
+
tagName: 'td'
|
|
10237
|
+
}], function (tableCellNode) {
|
|
10238
|
+
(0,unist_util_visit/* visit */.Vn)(tableCellNode, {
|
|
10239
|
+
tagName: 'code'
|
|
10240
|
+
}, function (inlineCodeNode) {
|
|
10241
|
+
var textNode = inlineCodeNode.children[0];
|
|
10242
|
+
if (textNode && rxEscapedPipe.test(textNode.value)) {
|
|
10243
|
+
textNode.value = textNode.value.replace(rxEscapedPipe, '|');
|
|
10244
|
+
}
|
|
10245
|
+
});
|
|
10246
|
+
return unist_util_visit_parents/* SKIP */.AM;
|
|
10247
|
+
});
|
|
10248
|
+
};
|
|
10249
|
+
};
|
|
10250
|
+
/* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
|
|
10251
|
+
;// CONCATENATED MODULE: ./processor/transform/index.js
|
|
10231
10252
|
|
|
10232
|
-
/**
|
|
10233
|
-
* Check if a node passes a certain node test
|
|
10234
|
-
*
|
|
10235
|
-
* @template {Node} Y
|
|
10236
|
-
* @callback AssertPredicate
|
|
10237
|
-
* @param {unknown} [node]
|
|
10238
|
-
* @param {number|null|undefined} [index]
|
|
10239
|
-
* @param {Parent|null|undefined} [parent]
|
|
10240
|
-
* @returns {node is Y}
|
|
10241
|
-
*/
|
|
10242
10253
|
|
|
10243
|
-
const is =
|
|
10244
|
-
/**
|
|
10245
|
-
* Check if a node passes a test.
|
|
10246
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
10247
|
-
*
|
|
10248
|
-
* @type {(
|
|
10249
|
-
* (<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) &
|
|
10250
|
-
* ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
|
|
10251
|
-
* )}
|
|
10252
|
-
*/
|
|
10253
|
-
(
|
|
10254
|
-
/**
|
|
10255
|
-
* Check if a node passes a test.
|
|
10256
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
10257
|
-
*
|
|
10258
|
-
* @param {unknown} [node] Node to check
|
|
10259
|
-
* @param {Test} [test]
|
|
10260
|
-
* When nullish, checks if `node` is a `Node`.
|
|
10261
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
10262
|
-
* When `function` checks if function passed the node is true.
|
|
10263
|
-
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
10264
|
-
* When `array`, checks any one of the subtests pass.
|
|
10265
|
-
* @param {number|null|undefined} [index] Position of `node` in `parent`
|
|
10266
|
-
* @param {Parent|null|undefined} [parent] Parent of `node`
|
|
10267
|
-
* @param {unknown} [context] Context object to invoke `test` with
|
|
10268
|
-
* @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
|
|
10269
|
-
*/
|
|
10270
|
-
// eslint-disable-next-line max-params
|
|
10271
|
-
function is(node, test, index, parent, context) {
|
|
10272
|
-
const check = convert(test)
|
|
10273
10254
|
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
index !== null &&
|
|
10277
|
-
(typeof index !== 'number' ||
|
|
10278
|
-
index < 0 ||
|
|
10279
|
-
index === Number.POSITIVE_INFINITY)
|
|
10280
|
-
) {
|
|
10281
|
-
throw new Error('Expected positive finite index')
|
|
10282
|
-
}
|
|
10255
|
+
var remarkTransformers = [single_code_tabs, reusable_content/* default */.ZP];
|
|
10256
|
+
var rehypeTransformers = [table_cell_inline_code];
|
|
10283
10257
|
|
|
10284
|
-
|
|
10285
|
-
parent !== undefined &&
|
|
10286
|
-
parent !== null &&
|
|
10287
|
-
(!is(parent) || !parent.children)
|
|
10288
|
-
) {
|
|
10289
|
-
throw new Error('Expected parent node')
|
|
10290
|
-
}
|
|
10258
|
+
/***/ }),
|
|
10291
10259
|
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
(index === undefined || index === null)
|
|
10295
|
-
) {
|
|
10296
|
-
throw new Error('Expected both parent and index')
|
|
10297
|
-
}
|
|
10260
|
+
/***/ 5772:
|
|
10261
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10298
10262
|
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10263
|
+
"use strict";
|
|
10264
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10265
|
+
/* harmony export */ "ZP": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
10266
|
+
/* harmony export */ "_q": () => (/* binding */ tag),
|
|
10267
|
+
/* harmony export */ "dt": () => (/* binding */ type)
|
|
10268
|
+
/* harmony export */ });
|
|
10269
|
+
/* harmony import */ var unist_util_visit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6393);
|
|
10305
10270
|
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
}
|
|
10271
|
+
var type = 'reusable-content';
|
|
10272
|
+
var tag = 'RMReusableContent';
|
|
10273
|
+
var regexp = new RegExp("^\\s*<".concat(tag, " name=\"(?<name>.*)\" />\\s*$"));
|
|
10274
|
+
var reusableContentTransformer = function reusableContentTransformer() {
|
|
10275
|
+
var reusableContent = this.data('reusableContent');
|
|
10276
|
+
return function (tree) {
|
|
10277
|
+
(0,unist_util_visit__WEBPACK_IMPORTED_MODULE_0__/* .visit */ .Vn)(tree, 'html', function (node, index, parent) {
|
|
10278
|
+
var result = regexp.exec(node.value);
|
|
10279
|
+
if (!result || !result.groups.name) return;
|
|
10280
|
+
var name = result.groups.name;
|
|
10281
|
+
var block = {
|
|
10282
|
+
type: type,
|
|
10283
|
+
name: name,
|
|
10284
|
+
children: name in reusableContent ? reusableContent[name] : []
|
|
10285
|
+
};
|
|
10286
|
+
parent.children[index] = block;
|
|
10287
|
+
});
|
|
10288
|
+
return tree;
|
|
10289
|
+
};
|
|
10290
|
+
};
|
|
10291
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reusableContentTransformer);
|
|
10328
10292
|
|
|
10329
|
-
|
|
10330
|
-
return typeFactory(test)
|
|
10331
|
-
}
|
|
10293
|
+
/***/ }),
|
|
10332
10294
|
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
}
|
|
10295
|
+
/***/ 8229:
|
|
10296
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
10336
10297
|
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
)
|
|
10344
|
-
/**
|
|
10345
|
-
* @param {Array.<Type|Props|TestFunctionAnything>} tests
|
|
10346
|
-
* @returns {AssertAnything}
|
|
10347
|
-
*/
|
|
10348
|
-
function anyFactory(tests) {
|
|
10349
|
-
/** @type {Array.<AssertAnything>} */
|
|
10350
|
-
const checks = []
|
|
10351
|
-
let index = -1
|
|
10298
|
+
var _require = __webpack_require__(2781),
|
|
10299
|
+
defaultSchema = _require.defaultSchema;
|
|
10300
|
+
var createSchema = function createSchema() {
|
|
10301
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
10302
|
+
safeMode = _ref.safeMode;
|
|
10303
|
+
var schema = JSON.parse(JSON.stringify(defaultSchema));
|
|
10352
10304
|
|
|
10353
|
-
|
|
10354
|
-
|
|
10305
|
+
// Sanitization Schema Defaults
|
|
10306
|
+
schema.clobberPrefix = '';
|
|
10307
|
+
schema.tagNames.push('span');
|
|
10308
|
+
schema.attributes['*'].push('class', 'className', 'align');
|
|
10309
|
+
if (!safeMode) {
|
|
10310
|
+
schema.attributes['*'].push('style');
|
|
10355
10311
|
}
|
|
10312
|
+
schema.tagNames.push('rdme-pin');
|
|
10313
|
+
schema.tagNames.push('rdme-embed');
|
|
10314
|
+
schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
|
|
10315
|
+
schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
|
|
10316
|
+
schema.tagNames.push('figure');
|
|
10317
|
+
schema.tagNames.push('figcaption');
|
|
10318
|
+
schema.tagNames.push('input'); // allow GitHub-style todo lists
|
|
10319
|
+
schema.ancestors.input = ['li'];
|
|
10320
|
+
schema.tagNames.push('colgroup'); // wat
|
|
10321
|
+
schema.tagNames.push('col');
|
|
10322
|
+
return schema;
|
|
10323
|
+
};
|
|
10324
|
+
module.exports = createSchema;
|
|
10356
10325
|
|
|
10357
|
-
|
|
10326
|
+
/***/ }),
|
|
10358
10327
|
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
* @param {unknown[]} parameters
|
|
10362
|
-
* @returns {boolean}
|
|
10363
|
-
*/
|
|
10364
|
-
function any(...parameters) {
|
|
10365
|
-
let index = -1
|
|
10328
|
+
/***/ 8841:
|
|
10329
|
+
/***/ ((module) => {
|
|
10366
10330
|
|
|
10367
|
-
|
|
10368
|
-
if (checks[index].call(this, ...parameters)) return true
|
|
10369
|
-
}
|
|
10331
|
+
"use strict";
|
|
10370
10332
|
|
|
10371
|
-
|
|
10333
|
+
|
|
10334
|
+
module.exports = bail
|
|
10335
|
+
|
|
10336
|
+
function bail(err) {
|
|
10337
|
+
if (err) {
|
|
10338
|
+
throw err
|
|
10372
10339
|
}
|
|
10373
10340
|
}
|
|
10374
10341
|
|
|
10375
|
-
/**
|
|
10376
|
-
* Utility to assert each property in `test` is represented in `node`, and each
|
|
10377
|
-
* values are strictly equal.
|
|
10378
|
-
*
|
|
10379
|
-
* @param {Props} check
|
|
10380
|
-
* @returns {AssertAnything}
|
|
10381
|
-
*/
|
|
10382
|
-
function propsFactory(check) {
|
|
10383
|
-
return castFactory(all)
|
|
10384
10342
|
|
|
10385
|
-
|
|
10386
|
-
* @param {Node} node
|
|
10387
|
-
* @returns {boolean}
|
|
10388
|
-
*/
|
|
10389
|
-
function all(node) {
|
|
10390
|
-
/** @type {string} */
|
|
10391
|
-
let key
|
|
10343
|
+
/***/ }),
|
|
10392
10344
|
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
if (node[key] !== check[key]) return false
|
|
10396
|
-
}
|
|
10345
|
+
/***/ 1073:
|
|
10346
|
+
/***/ ((module) => {
|
|
10397
10347
|
|
|
10398
|
-
|
|
10348
|
+
module.exports = {
|
|
10349
|
+
trueFunc: function trueFunc(){
|
|
10350
|
+
return true;
|
|
10351
|
+
},
|
|
10352
|
+
falseFunc: function falseFunc(){
|
|
10353
|
+
return false;
|
|
10354
|
+
}
|
|
10355
|
+
};
|
|
10356
|
+
|
|
10357
|
+
/***/ }),
|
|
10358
|
+
|
|
10359
|
+
/***/ 932:
|
|
10360
|
+
/***/ ((module) => {
|
|
10361
|
+
|
|
10362
|
+
"use strict";
|
|
10363
|
+
|
|
10364
|
+
|
|
10365
|
+
module.exports = ccount
|
|
10366
|
+
|
|
10367
|
+
function ccount(value, character) {
|
|
10368
|
+
var val = String(value)
|
|
10369
|
+
var count = 0
|
|
10370
|
+
var index
|
|
10371
|
+
|
|
10372
|
+
if (typeof character !== 'string' || character.length !== 1) {
|
|
10373
|
+
throw new Error('Expected character')
|
|
10399
10374
|
}
|
|
10400
|
-
}
|
|
10401
10375
|
|
|
10402
|
-
|
|
10403
|
-
* Utility to convert a string into a function which checks a given node’s type
|
|
10404
|
-
* for said string.
|
|
10405
|
-
*
|
|
10406
|
-
* @param {Type} check
|
|
10407
|
-
* @returns {AssertAnything}
|
|
10408
|
-
*/
|
|
10409
|
-
function typeFactory(check) {
|
|
10410
|
-
return castFactory(type)
|
|
10376
|
+
index = val.indexOf(character)
|
|
10411
10377
|
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
function type(node) {
|
|
10416
|
-
return node && node.type === check
|
|
10378
|
+
while (index !== -1) {
|
|
10379
|
+
count++
|
|
10380
|
+
index = val.indexOf(character, index + 1)
|
|
10417
10381
|
}
|
|
10382
|
+
|
|
10383
|
+
return count
|
|
10418
10384
|
}
|
|
10419
10385
|
|
|
10420
|
-
/**
|
|
10421
|
-
* Utility to convert a string into a function which checks a given node’s type
|
|
10422
|
-
* for said string.
|
|
10423
|
-
* @param {TestFunctionAnything} check
|
|
10424
|
-
* @returns {AssertAnything}
|
|
10425
|
-
*/
|
|
10426
|
-
function castFactory(check) {
|
|
10427
|
-
return assertion
|
|
10428
10386
|
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10387
|
+
/***/ }),
|
|
10388
|
+
|
|
10389
|
+
/***/ 6313:
|
|
10390
|
+
/***/ ((module) => {
|
|
10391
|
+
|
|
10392
|
+
var clone = (function() {
|
|
10393
|
+
'use strict';
|
|
10394
|
+
|
|
10395
|
+
function _instanceof(obj, type) {
|
|
10396
|
+
return type != null && obj instanceof type;
|
|
10438
10397
|
}
|
|
10439
10398
|
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10399
|
+
var nativeMap;
|
|
10400
|
+
try {
|
|
10401
|
+
nativeMap = Map;
|
|
10402
|
+
} catch(_) {
|
|
10403
|
+
// maybe a reference error because no `Map`. Give it a dummy value that no
|
|
10404
|
+
// value will ever be an instanceof.
|
|
10405
|
+
nativeMap = function() {};
|
|
10443
10406
|
}
|
|
10444
10407
|
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10408
|
+
var nativeSet;
|
|
10409
|
+
try {
|
|
10410
|
+
nativeSet = Set;
|
|
10411
|
+
} catch(_) {
|
|
10412
|
+
nativeSet = function() {};
|
|
10413
|
+
}
|
|
10414
|
+
|
|
10415
|
+
var nativePromise;
|
|
10416
|
+
try {
|
|
10417
|
+
nativePromise = Promise;
|
|
10418
|
+
} catch(_) {
|
|
10419
|
+
nativePromise = function() {};
|
|
10452
10420
|
}
|
|
10453
10421
|
|
|
10454
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
|
|
10455
10422
|
/**
|
|
10456
|
-
*
|
|
10457
|
-
*
|
|
10458
|
-
*
|
|
10459
|
-
*
|
|
10460
|
-
*
|
|
10461
|
-
*
|
|
10462
|
-
*
|
|
10463
|
-
*
|
|
10464
|
-
|
|
10423
|
+
* Clones (copies) an Object using deep copying.
|
|
10424
|
+
*
|
|
10425
|
+
* This function supports circular references by default, but if you are certain
|
|
10426
|
+
* there are no circular references in your object, you can save some CPU time
|
|
10427
|
+
* by calling clone(obj, false).
|
|
10428
|
+
*
|
|
10429
|
+
* Caution: if `circular` is false and `parent` contains circular references,
|
|
10430
|
+
* your program may enter an infinite loop and crash.
|
|
10431
|
+
*
|
|
10432
|
+
* @param `parent` - the object to be cloned
|
|
10433
|
+
* @param `circular` - set to true if the object to be cloned may contain
|
|
10434
|
+
* circular references. (optional - true by default)
|
|
10435
|
+
* @param `depth` - set to a number if the object is only to be cloned to
|
|
10436
|
+
* a particular depth. (optional - defaults to Infinity)
|
|
10437
|
+
* @param `prototype` - sets the prototype to be used when cloning an object.
|
|
10438
|
+
* (optional - defaults to parent prototype).
|
|
10439
|
+
* @param `includeNonEnumerable` - set to true if the non-enumerable properties
|
|
10440
|
+
* should be cloned as well. Non-enumerable properties on the prototype
|
|
10441
|
+
* chain will be ignored. (optional - false by default)
|
|
10442
|
+
*/
|
|
10443
|
+
function clone(parent, circular, depth, prototype, includeNonEnumerable) {
|
|
10444
|
+
if (typeof circular === 'object') {
|
|
10445
|
+
depth = circular.depth;
|
|
10446
|
+
prototype = circular.prototype;
|
|
10447
|
+
includeNonEnumerable = circular.includeNonEnumerable;
|
|
10448
|
+
circular = circular.circular;
|
|
10449
|
+
}
|
|
10450
|
+
// maintain two arrays for circular references, where corresponding parents
|
|
10451
|
+
// and children have the same index
|
|
10452
|
+
var allParents = [];
|
|
10453
|
+
var allChildren = [];
|
|
10465
10454
|
|
|
10455
|
+
var useBuffer = typeof Buffer != 'undefined';
|
|
10466
10456
|
|
|
10457
|
+
if (typeof circular == 'undefined')
|
|
10458
|
+
circular = true;
|
|
10467
10459
|
|
|
10460
|
+
if (typeof depth == 'undefined')
|
|
10461
|
+
depth = Infinity;
|
|
10468
10462
|
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
* Do not traverse this node’s children
|
|
10475
|
-
*/
|
|
10476
|
-
const SKIP = 'skip'
|
|
10477
|
-
/**
|
|
10478
|
-
* Stop traversing immediately
|
|
10479
|
-
*/
|
|
10480
|
-
const EXIT = false
|
|
10481
|
-
|
|
10482
|
-
/**
|
|
10483
|
-
* Visit children of tree which pass test.
|
|
10484
|
-
*
|
|
10485
|
-
* @param tree
|
|
10486
|
-
* Tree to walk
|
|
10487
|
-
* @param [test]
|
|
10488
|
-
* `unist-util-is`-compatible test
|
|
10489
|
-
* @param visitor
|
|
10490
|
-
* Function called for nodes that pass `test`.
|
|
10491
|
-
* @param [reverse=false]
|
|
10492
|
-
* Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
|
|
10493
|
-
*/
|
|
10494
|
-
const visitParents =
|
|
10495
|
-
/**
|
|
10496
|
-
* @type {(
|
|
10497
|
-
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
|
|
10498
|
-
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
|
|
10499
|
-
* )}
|
|
10500
|
-
*/
|
|
10501
|
-
(
|
|
10502
|
-
/**
|
|
10503
|
-
* @param {Node} tree
|
|
10504
|
-
* @param {Test} test
|
|
10505
|
-
* @param {import('./complex-types.js').Visitor<Node>} visitor
|
|
10506
|
-
* @param {boolean} [reverse=false]
|
|
10507
|
-
*/
|
|
10508
|
-
function (tree, test, visitor, reverse) {
|
|
10509
|
-
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
10510
|
-
reverse = visitor
|
|
10511
|
-
// @ts-expect-error no visitor given, so `visitor` is test.
|
|
10512
|
-
visitor = test
|
|
10513
|
-
test = null
|
|
10514
|
-
}
|
|
10515
|
-
|
|
10516
|
-
const is = convert(test)
|
|
10517
|
-
const step = reverse ? -1 : 1
|
|
10518
|
-
|
|
10519
|
-
factory(tree, null, [])()
|
|
10520
|
-
|
|
10521
|
-
/**
|
|
10522
|
-
* @param {Node} node
|
|
10523
|
-
* @param {number?} index
|
|
10524
|
-
* @param {Array<Parent>} parents
|
|
10525
|
-
*/
|
|
10526
|
-
function factory(node, index, parents) {
|
|
10527
|
-
/** @type {Record<string, unknown>} */
|
|
10528
|
-
// @ts-expect-error: hush
|
|
10529
|
-
const value = typeof node === 'object' && node !== null ? node : {}
|
|
10530
|
-
/** @type {string|undefined} */
|
|
10531
|
-
let name
|
|
10532
|
-
|
|
10533
|
-
if (typeof value.type === 'string') {
|
|
10534
|
-
name =
|
|
10535
|
-
typeof value.tagName === 'string'
|
|
10536
|
-
? value.tagName
|
|
10537
|
-
: typeof value.name === 'string'
|
|
10538
|
-
? value.name
|
|
10539
|
-
: undefined
|
|
10540
|
-
|
|
10541
|
-
Object.defineProperty(visit, 'name', {
|
|
10542
|
-
value:
|
|
10543
|
-
'node (' +
|
|
10544
|
-
color(value.type + (name ? '<' + name + '>' : '')) +
|
|
10545
|
-
')'
|
|
10546
|
-
})
|
|
10547
|
-
}
|
|
10548
|
-
|
|
10549
|
-
return visit
|
|
10550
|
-
|
|
10551
|
-
function visit() {
|
|
10552
|
-
/** @type {ActionTuple} */
|
|
10553
|
-
let result = []
|
|
10554
|
-
/** @type {ActionTuple} */
|
|
10555
|
-
let subresult
|
|
10556
|
-
/** @type {number} */
|
|
10557
|
-
let offset
|
|
10558
|
-
/** @type {Array<Parent>} */
|
|
10559
|
-
let grandparents
|
|
10560
|
-
|
|
10561
|
-
if (!test || is(node, index, parents[parents.length - 1] || null)) {
|
|
10562
|
-
result = toResult(visitor(node, parents))
|
|
10563
|
-
|
|
10564
|
-
if (result[0] === EXIT) {
|
|
10565
|
-
return result
|
|
10566
|
-
}
|
|
10567
|
-
}
|
|
10568
|
-
|
|
10569
|
-
// @ts-expect-error looks like a parent.
|
|
10570
|
-
if (node.children && result[0] !== SKIP) {
|
|
10571
|
-
// @ts-expect-error looks like a parent.
|
|
10572
|
-
offset = (reverse ? node.children.length : -1) + step
|
|
10573
|
-
// @ts-expect-error looks like a parent.
|
|
10574
|
-
grandparents = parents.concat(node)
|
|
10575
|
-
|
|
10576
|
-
// @ts-expect-error looks like a parent.
|
|
10577
|
-
while (offset > -1 && offset < node.children.length) {
|
|
10578
|
-
// @ts-expect-error looks like a parent.
|
|
10579
|
-
subresult = factory(node.children[offset], offset, grandparents)()
|
|
10580
|
-
|
|
10581
|
-
if (subresult[0] === EXIT) {
|
|
10582
|
-
return subresult
|
|
10583
|
-
}
|
|
10584
|
-
|
|
10585
|
-
offset =
|
|
10586
|
-
typeof subresult[1] === 'number' ? subresult[1] : offset + step
|
|
10587
|
-
}
|
|
10588
|
-
}
|
|
10589
|
-
|
|
10590
|
-
return result
|
|
10591
|
-
}
|
|
10592
|
-
}
|
|
10593
|
-
}
|
|
10594
|
-
)
|
|
10595
|
-
|
|
10596
|
-
/**
|
|
10597
|
-
* @param {VisitorResult} value
|
|
10598
|
-
* @returns {ActionTuple}
|
|
10599
|
-
*/
|
|
10600
|
-
function toResult(value) {
|
|
10601
|
-
if (Array.isArray(value)) {
|
|
10602
|
-
return value
|
|
10603
|
-
}
|
|
10604
|
-
|
|
10605
|
-
if (typeof value === 'number') {
|
|
10606
|
-
return [CONTINUE, value]
|
|
10607
|
-
}
|
|
10608
|
-
|
|
10609
|
-
return [value]
|
|
10610
|
-
}
|
|
10611
|
-
|
|
10612
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/index.js
|
|
10613
|
-
/**
|
|
10614
|
-
* @typedef {import('unist').Node} Node
|
|
10615
|
-
* @typedef {import('unist').Parent} Parent
|
|
10616
|
-
* @typedef {import('unist-util-is').Test} Test
|
|
10617
|
-
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
|
|
10618
|
-
* @typedef {import('./complex-types.js').Visitor} Visitor
|
|
10619
|
-
*/
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
/**
|
|
10624
|
-
* Visit children of tree which pass test.
|
|
10625
|
-
*
|
|
10626
|
-
* @param tree
|
|
10627
|
-
* Tree to walk
|
|
10628
|
-
* @param [test]
|
|
10629
|
-
* `unist-util-is`-compatible test
|
|
10630
|
-
* @param visitor
|
|
10631
|
-
* Function called for nodes that pass `test`.
|
|
10632
|
-
* @param reverse
|
|
10633
|
-
* Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
|
|
10634
|
-
*/
|
|
10635
|
-
const visit =
|
|
10636
|
-
/**
|
|
10637
|
-
* @type {(
|
|
10638
|
-
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
|
|
10639
|
-
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
|
|
10640
|
-
* )}
|
|
10641
|
-
*/
|
|
10642
|
-
(
|
|
10643
|
-
/**
|
|
10644
|
-
* @param {Node} tree
|
|
10645
|
-
* @param {Test} test
|
|
10646
|
-
* @param {import('./complex-types.js').Visitor} visitor
|
|
10647
|
-
* @param {boolean} [reverse]
|
|
10648
|
-
*/
|
|
10649
|
-
function (tree, test, visitor, reverse) {
|
|
10650
|
-
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
10651
|
-
reverse = visitor
|
|
10652
|
-
visitor = test
|
|
10653
|
-
test = null
|
|
10654
|
-
}
|
|
10655
|
-
|
|
10656
|
-
visitParents(tree, test, overload, reverse)
|
|
10657
|
-
|
|
10658
|
-
/**
|
|
10659
|
-
* @param {Node} node
|
|
10660
|
-
* @param {Array<Parent>} parents
|
|
10661
|
-
*/
|
|
10662
|
-
function overload(node, parents) {
|
|
10663
|
-
const parent = parents[parents.length - 1]
|
|
10664
|
-
return visitor(
|
|
10665
|
-
node,
|
|
10666
|
-
parent ? parent.children.indexOf(node) : null,
|
|
10667
|
-
parent
|
|
10668
|
-
)
|
|
10669
|
-
}
|
|
10670
|
-
}
|
|
10671
|
-
)
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
;// CONCATENATED MODULE: ./processor/transform/reusable-content.js
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
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(_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(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" != (0,esm_typeof/* default */.Z)(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); }
|
|
10680
|
-
|
|
10681
|
-
var type = 'reusable-content';
|
|
10682
|
-
var regexp = /*#__PURE__*/_wrapRegExp(/^\s*<ReadMeReusableContent name="(.*)" \/>\s*$/, {
|
|
10683
|
-
name: 1
|
|
10684
|
-
});
|
|
10685
|
-
var reusableContentTransformer = function reusableContentTransformer() {
|
|
10686
|
-
var reusableContent = this.data('reusableContent');
|
|
10687
|
-
return function (tree) {
|
|
10688
|
-
visit(tree, 'html', function (node, index, parent) {
|
|
10689
|
-
var result = regexp.exec(node.value);
|
|
10690
|
-
if (!result || !result.groups.name) return;
|
|
10691
|
-
var name = result.groups.name;
|
|
10692
|
-
var block = {
|
|
10693
|
-
type: type,
|
|
10694
|
-
name: name,
|
|
10695
|
-
children: name in reusableContent ? reusableContent[name] : []
|
|
10696
|
-
};
|
|
10697
|
-
parent.children[index] = block;
|
|
10698
|
-
});
|
|
10699
|
-
return tree;
|
|
10700
|
-
};
|
|
10701
|
-
};
|
|
10702
|
-
/* harmony default export */ const reusable_content = (reusableContentTransformer);
|
|
10703
|
-
;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
|
|
10704
|
-
|
|
10705
|
-
var singleCodeTabs = function singleCodeTabs() {
|
|
10706
|
-
return function (tree) {
|
|
10707
|
-
visit(tree, function (node, index, parent) {
|
|
10708
|
-
if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
|
|
10709
|
-
Object.assign(node, {
|
|
10710
|
-
className: 'tab-panel',
|
|
10711
|
-
data: {
|
|
10712
|
-
hName: 'code',
|
|
10713
|
-
hProperties: {
|
|
10714
|
-
meta: node.meta,
|
|
10715
|
-
lang: node.lang
|
|
10716
|
-
}
|
|
10717
|
-
}
|
|
10718
|
-
});
|
|
10719
|
-
parent.children[index] = {
|
|
10720
|
-
type: 'code-tabs',
|
|
10721
|
-
className: 'tabs',
|
|
10722
|
-
data: {
|
|
10723
|
-
hName: 'div',
|
|
10724
|
-
hProperties: {
|
|
10725
|
-
className: ['code-tabs']
|
|
10726
|
-
}
|
|
10727
|
-
},
|
|
10728
|
-
children: [node]
|
|
10729
|
-
};
|
|
10730
|
-
}
|
|
10731
|
-
});
|
|
10732
|
-
return tree;
|
|
10733
|
-
};
|
|
10734
|
-
};
|
|
10735
|
-
/* harmony default export */ const single_code_tabs = (singleCodeTabs);
|
|
10736
|
-
;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
|
|
10737
|
-
|
|
10738
|
-
var rxEscapedPipe = /\\\|/g;
|
|
10739
|
-
|
|
10740
|
-
/**
|
|
10741
|
-
* HAST Transformer that finds all inline code nodes within table cells and
|
|
10742
|
-
* unescapes any escaped pipe chars so that the editor outputs them without
|
|
10743
|
-
* escape chars.
|
|
10744
|
-
*
|
|
10745
|
-
* This appears to be a bug with remark-parse < ~8
|
|
10746
|
-
*/
|
|
10747
|
-
var tableCellInlineCode = function tableCellInlineCode() {
|
|
10748
|
-
return function (tree) {
|
|
10749
|
-
visit(tree, [{
|
|
10750
|
-
tagName: 'th'
|
|
10751
|
-
}, {
|
|
10752
|
-
tagName: 'td'
|
|
10753
|
-
}], function (tableCellNode) {
|
|
10754
|
-
visit(tableCellNode, {
|
|
10755
|
-
tagName: 'code'
|
|
10756
|
-
}, function (inlineCodeNode) {
|
|
10757
|
-
var textNode = inlineCodeNode.children[0];
|
|
10758
|
-
if (textNode && rxEscapedPipe.test(textNode.value)) {
|
|
10759
|
-
textNode.value = textNode.value.replace(rxEscapedPipe, '|');
|
|
10760
|
-
}
|
|
10761
|
-
});
|
|
10762
|
-
return SKIP;
|
|
10763
|
-
});
|
|
10764
|
-
};
|
|
10765
|
-
};
|
|
10766
|
-
/* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
|
|
10767
|
-
;// CONCATENATED MODULE: ./processor/transform/index.js
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
var remarkTransformers = [single_code_tabs, reusable_content];
|
|
10772
|
-
var rehypeTransformers = [table_cell_inline_code];
|
|
10773
|
-
|
|
10774
|
-
/***/ }),
|
|
10775
|
-
|
|
10776
|
-
/***/ 8229:
|
|
10777
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
10778
|
-
|
|
10779
|
-
var _require = __webpack_require__(2781),
|
|
10780
|
-
defaultSchema = _require.defaultSchema;
|
|
10781
|
-
var createSchema = function createSchema() {
|
|
10782
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
10783
|
-
safeMode = _ref.safeMode;
|
|
10784
|
-
var schema = JSON.parse(JSON.stringify(defaultSchema));
|
|
10785
|
-
|
|
10786
|
-
// Sanitization Schema Defaults
|
|
10787
|
-
schema.clobberPrefix = '';
|
|
10788
|
-
schema.tagNames.push('span');
|
|
10789
|
-
schema.attributes['*'].push('class', 'className', 'align');
|
|
10790
|
-
if (!safeMode) {
|
|
10791
|
-
schema.attributes['*'].push('style');
|
|
10792
|
-
}
|
|
10793
|
-
schema.tagNames.push('rdme-pin');
|
|
10794
|
-
schema.tagNames.push('rdme-embed');
|
|
10795
|
-
schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
|
|
10796
|
-
schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
|
|
10797
|
-
schema.tagNames.push('figure');
|
|
10798
|
-
schema.tagNames.push('figcaption');
|
|
10799
|
-
schema.tagNames.push('input'); // allow GitHub-style todo lists
|
|
10800
|
-
schema.ancestors.input = ['li'];
|
|
10801
|
-
schema.tagNames.push('colgroup'); // wat
|
|
10802
|
-
schema.tagNames.push('col');
|
|
10803
|
-
return schema;
|
|
10804
|
-
};
|
|
10805
|
-
module.exports = createSchema;
|
|
10806
|
-
|
|
10807
|
-
/***/ }),
|
|
10808
|
-
|
|
10809
|
-
/***/ 8841:
|
|
10810
|
-
/***/ ((module) => {
|
|
10811
|
-
|
|
10812
|
-
"use strict";
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
module.exports = bail
|
|
10816
|
-
|
|
10817
|
-
function bail(err) {
|
|
10818
|
-
if (err) {
|
|
10819
|
-
throw err
|
|
10820
|
-
}
|
|
10821
|
-
}
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
/***/ }),
|
|
10825
|
-
|
|
10826
|
-
/***/ 1073:
|
|
10827
|
-
/***/ ((module) => {
|
|
10828
|
-
|
|
10829
|
-
module.exports = {
|
|
10830
|
-
trueFunc: function trueFunc(){
|
|
10831
|
-
return true;
|
|
10832
|
-
},
|
|
10833
|
-
falseFunc: function falseFunc(){
|
|
10834
|
-
return false;
|
|
10835
|
-
}
|
|
10836
|
-
};
|
|
10837
|
-
|
|
10838
|
-
/***/ }),
|
|
10839
|
-
|
|
10840
|
-
/***/ 932:
|
|
10841
|
-
/***/ ((module) => {
|
|
10842
|
-
|
|
10843
|
-
"use strict";
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
module.exports = ccount
|
|
10847
|
-
|
|
10848
|
-
function ccount(value, character) {
|
|
10849
|
-
var val = String(value)
|
|
10850
|
-
var count = 0
|
|
10851
|
-
var index
|
|
10852
|
-
|
|
10853
|
-
if (typeof character !== 'string' || character.length !== 1) {
|
|
10854
|
-
throw new Error('Expected character')
|
|
10855
|
-
}
|
|
10856
|
-
|
|
10857
|
-
index = val.indexOf(character)
|
|
10858
|
-
|
|
10859
|
-
while (index !== -1) {
|
|
10860
|
-
count++
|
|
10861
|
-
index = val.indexOf(character, index + 1)
|
|
10862
|
-
}
|
|
10863
|
-
|
|
10864
|
-
return count
|
|
10865
|
-
}
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
/***/ }),
|
|
10869
|
-
|
|
10870
|
-
/***/ 6313:
|
|
10871
|
-
/***/ ((module) => {
|
|
10872
|
-
|
|
10873
|
-
var clone = (function() {
|
|
10874
|
-
'use strict';
|
|
10875
|
-
|
|
10876
|
-
function _instanceof(obj, type) {
|
|
10877
|
-
return type != null && obj instanceof type;
|
|
10878
|
-
}
|
|
10879
|
-
|
|
10880
|
-
var nativeMap;
|
|
10881
|
-
try {
|
|
10882
|
-
nativeMap = Map;
|
|
10883
|
-
} catch(_) {
|
|
10884
|
-
// maybe a reference error because no `Map`. Give it a dummy value that no
|
|
10885
|
-
// value will ever be an instanceof.
|
|
10886
|
-
nativeMap = function() {};
|
|
10887
|
-
}
|
|
10888
|
-
|
|
10889
|
-
var nativeSet;
|
|
10890
|
-
try {
|
|
10891
|
-
nativeSet = Set;
|
|
10892
|
-
} catch(_) {
|
|
10893
|
-
nativeSet = function() {};
|
|
10894
|
-
}
|
|
10895
|
-
|
|
10896
|
-
var nativePromise;
|
|
10897
|
-
try {
|
|
10898
|
-
nativePromise = Promise;
|
|
10899
|
-
} catch(_) {
|
|
10900
|
-
nativePromise = function() {};
|
|
10901
|
-
}
|
|
10902
|
-
|
|
10903
|
-
/**
|
|
10904
|
-
* Clones (copies) an Object using deep copying.
|
|
10905
|
-
*
|
|
10906
|
-
* This function supports circular references by default, but if you are certain
|
|
10907
|
-
* there are no circular references in your object, you can save some CPU time
|
|
10908
|
-
* by calling clone(obj, false).
|
|
10909
|
-
*
|
|
10910
|
-
* Caution: if `circular` is false and `parent` contains circular references,
|
|
10911
|
-
* your program may enter an infinite loop and crash.
|
|
10912
|
-
*
|
|
10913
|
-
* @param `parent` - the object to be cloned
|
|
10914
|
-
* @param `circular` - set to true if the object to be cloned may contain
|
|
10915
|
-
* circular references. (optional - true by default)
|
|
10916
|
-
* @param `depth` - set to a number if the object is only to be cloned to
|
|
10917
|
-
* a particular depth. (optional - defaults to Infinity)
|
|
10918
|
-
* @param `prototype` - sets the prototype to be used when cloning an object.
|
|
10919
|
-
* (optional - defaults to parent prototype).
|
|
10920
|
-
* @param `includeNonEnumerable` - set to true if the non-enumerable properties
|
|
10921
|
-
* should be cloned as well. Non-enumerable properties on the prototype
|
|
10922
|
-
* chain will be ignored. (optional - false by default)
|
|
10923
|
-
*/
|
|
10924
|
-
function clone(parent, circular, depth, prototype, includeNonEnumerable) {
|
|
10925
|
-
if (typeof circular === 'object') {
|
|
10926
|
-
depth = circular.depth;
|
|
10927
|
-
prototype = circular.prototype;
|
|
10928
|
-
includeNonEnumerable = circular.includeNonEnumerable;
|
|
10929
|
-
circular = circular.circular;
|
|
10930
|
-
}
|
|
10931
|
-
// maintain two arrays for circular references, where corresponding parents
|
|
10932
|
-
// and children have the same index
|
|
10933
|
-
var allParents = [];
|
|
10934
|
-
var allChildren = [];
|
|
10935
|
-
|
|
10936
|
-
var useBuffer = typeof Buffer != 'undefined';
|
|
10937
|
-
|
|
10938
|
-
if (typeof circular == 'undefined')
|
|
10939
|
-
circular = true;
|
|
10940
|
-
|
|
10941
|
-
if (typeof depth == 'undefined')
|
|
10942
|
-
depth = Infinity;
|
|
10943
|
-
|
|
10944
|
-
// recurse this function so we don't reset allParents and allChildren
|
|
10945
|
-
function _clone(parent, depth) {
|
|
10946
|
-
// cloning null always returns null
|
|
10947
|
-
if (parent === null)
|
|
10948
|
-
return null;
|
|
10463
|
+
// recurse this function so we don't reset allParents and allChildren
|
|
10464
|
+
function _clone(parent, depth) {
|
|
10465
|
+
// cloning null always returns null
|
|
10466
|
+
if (parent === null)
|
|
10467
|
+
return null;
|
|
10949
10468
|
|
|
10950
10469
|
if (depth === 0)
|
|
10951
10470
|
return parent;
|
|
@@ -32853,745 +32372,972 @@ const defaultSchema = {
|
|
|
32853
32372
|
}
|
|
32854
32373
|
|
|
32855
32374
|
|
|
32856
|
-
/***/ }),
|
|
32375
|
+
/***/ }),
|
|
32376
|
+
|
|
32377
|
+
/***/ 1445:
|
|
32378
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
32379
|
+
|
|
32380
|
+
"use strict";
|
|
32381
|
+
__webpack_require__.r(__webpack_exports__);
|
|
32382
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
32383
|
+
/* harmony export */ "map": () => (/* binding */ map)
|
|
32384
|
+
/* harmony export */ });
|
|
32385
|
+
/**
|
|
32386
|
+
* @typedef {import('unist').Node} Node
|
|
32387
|
+
*/
|
|
32388
|
+
|
|
32389
|
+
/**
|
|
32390
|
+
* @template {Node} [Tree=Node]
|
|
32391
|
+
* @typedef {import('./complex-types.js').MapFunction<Tree>} MapFunction
|
|
32392
|
+
* Function called with a node, its index, and its parent to produce a new
|
|
32393
|
+
* node.
|
|
32394
|
+
*/
|
|
32395
|
+
|
|
32396
|
+
/**
|
|
32397
|
+
* Create a new tree by mapping all nodes with the given function.
|
|
32398
|
+
*
|
|
32399
|
+
* @template {Node} Tree
|
|
32400
|
+
* Type of input tree.
|
|
32401
|
+
* @param {Tree} tree
|
|
32402
|
+
* Tree to map.
|
|
32403
|
+
* @param {MapFunction<Tree>} mapFunction
|
|
32404
|
+
* Function called with a node, its index, and its parent to produce a new
|
|
32405
|
+
* node.
|
|
32406
|
+
* @returns {Tree}
|
|
32407
|
+
* New mapped tree.
|
|
32408
|
+
*/
|
|
32409
|
+
function map(tree, mapFunction) {
|
|
32410
|
+
// @ts-expect-error Looks like a children.
|
|
32411
|
+
return preorder(tree, null, null)
|
|
32412
|
+
|
|
32413
|
+
/** @type {import('./complex-types').MapFunction<Tree>} */
|
|
32414
|
+
function preorder(node, index, parent) {
|
|
32415
|
+
var newNode = Object.assign({}, mapFunction(node, index, parent))
|
|
32416
|
+
|
|
32417
|
+
if ('children' in node) {
|
|
32418
|
+
// @ts-expect-error Looks like a parent.
|
|
32419
|
+
newNode.children = node.children.map(function (
|
|
32420
|
+
/** @type {import('./complex-types').InclusiveDescendant<Tree>} */ child,
|
|
32421
|
+
/** @type {number} */ index
|
|
32422
|
+
) {
|
|
32423
|
+
return preorder(child, index, node)
|
|
32424
|
+
})
|
|
32425
|
+
}
|
|
32426
|
+
|
|
32427
|
+
return newNode
|
|
32428
|
+
}
|
|
32429
|
+
}
|
|
32430
|
+
|
|
32431
|
+
|
|
32432
|
+
/***/ }),
|
|
32433
|
+
|
|
32434
|
+
/***/ 5907:
|
|
32435
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
32436
|
+
|
|
32437
|
+
"use strict";
|
|
32438
|
+
// ESM COMPAT FLAG
|
|
32439
|
+
__webpack_require__.r(__webpack_exports__);
|
|
32440
|
+
|
|
32441
|
+
// EXPORTS
|
|
32442
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
32443
|
+
"matches": () => (/* binding */ unist_util_select_matches),
|
|
32444
|
+
"select": () => (/* binding */ unist_util_select_select),
|
|
32445
|
+
"selectAll": () => (/* binding */ selectAll)
|
|
32446
|
+
});
|
|
32447
|
+
|
|
32448
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/zwitch/index.js
|
|
32449
|
+
var own = {}.hasOwnProperty
|
|
32450
|
+
|
|
32451
|
+
/**
|
|
32452
|
+
* @callback Handler
|
|
32453
|
+
* @param {...unknown} value
|
|
32454
|
+
* @return {unknown}
|
|
32455
|
+
*
|
|
32456
|
+
* @typedef {Record<string, Handler>} Handlers
|
|
32457
|
+
*
|
|
32458
|
+
* @typedef {Object} Options
|
|
32459
|
+
* @property {Handler} [unknown]
|
|
32460
|
+
* @property {Handler} [invalid]
|
|
32461
|
+
* @property {Handlers} [handlers]
|
|
32462
|
+
*/
|
|
32463
|
+
|
|
32464
|
+
/**
|
|
32465
|
+
* Handle values based on a property.
|
|
32466
|
+
*
|
|
32467
|
+
* @param {string} key
|
|
32468
|
+
* @param {Options} [options]
|
|
32469
|
+
*/
|
|
32470
|
+
function zwitch(key, options) {
|
|
32471
|
+
var settings = options || {}
|
|
32472
|
+
|
|
32473
|
+
/**
|
|
32474
|
+
* Handle one value.
|
|
32475
|
+
* Based on the bound `key`, a respective handler will be called.
|
|
32476
|
+
* If `value` is not an object, or doesn’t have a `key` property, the special
|
|
32477
|
+
* “invalid” handler will be called.
|
|
32478
|
+
* If `value` has an unknown `key`, the special “unknown” handler will be
|
|
32479
|
+
* called.
|
|
32480
|
+
*
|
|
32481
|
+
* All arguments, and the context object, are passed through to the handler,
|
|
32482
|
+
* and it’s result is returned.
|
|
32483
|
+
*
|
|
32484
|
+
* @param {...unknown} [value]
|
|
32485
|
+
* @this {unknown}
|
|
32486
|
+
* @returns {unknown}
|
|
32487
|
+
* @property {Handler} invalid
|
|
32488
|
+
* @property {Handler} unknown
|
|
32489
|
+
* @property {Handlers} handlers
|
|
32490
|
+
*/
|
|
32491
|
+
function one(value) {
|
|
32492
|
+
var fn = one.invalid
|
|
32493
|
+
var handlers = one.handlers
|
|
32494
|
+
|
|
32495
|
+
if (value && own.call(value, key)) {
|
|
32496
|
+
fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
|
|
32497
|
+
}
|
|
32498
|
+
|
|
32499
|
+
if (fn) {
|
|
32500
|
+
return fn.apply(this, arguments)
|
|
32501
|
+
}
|
|
32502
|
+
}
|
|
32503
|
+
|
|
32504
|
+
one.handlers = settings.handlers || {}
|
|
32505
|
+
one.invalid = settings.invalid
|
|
32506
|
+
one.unknown = settings.unknown
|
|
32507
|
+
|
|
32508
|
+
return one
|
|
32509
|
+
}
|
|
32510
|
+
|
|
32511
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/util.js
|
|
32512
|
+
/**
|
|
32513
|
+
* @typedef {import('./types.js').Selector} Selector
|
|
32514
|
+
* @typedef {import('./types.js').Selectors} Selectors
|
|
32515
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
32516
|
+
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
32517
|
+
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
32518
|
+
* @typedef {import('./types.js').Query} Query
|
|
32519
|
+
* @typedef {import('./types.js').Node} Node
|
|
32520
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
32521
|
+
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
32522
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
32523
|
+
*/
|
|
32524
|
+
|
|
32525
|
+
/**
|
|
32526
|
+
* @param {Node} node
|
|
32527
|
+
* @returns {node is Parent}
|
|
32528
|
+
*/
|
|
32529
|
+
function root(node) {
|
|
32530
|
+
return (
|
|
32531
|
+
// Root in nlcst.
|
|
32532
|
+
node.type === 'RootNode' ||
|
|
32533
|
+
// Rest
|
|
32534
|
+
node.type === 'root'
|
|
32535
|
+
)
|
|
32536
|
+
}
|
|
32537
|
+
|
|
32538
|
+
/**
|
|
32539
|
+
* @param {Node} node
|
|
32540
|
+
* @returns {node is Parent}
|
|
32541
|
+
*/
|
|
32542
|
+
function util_parent(node) {
|
|
32543
|
+
return Array.isArray(node.children)
|
|
32544
|
+
}
|
|
32545
|
+
|
|
32546
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/nest.js
|
|
32547
|
+
/**
|
|
32548
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
32549
|
+
* @typedef {import('./types.js').Query} Query
|
|
32550
|
+
* @typedef {import('./types.js').Node} Node
|
|
32551
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
32552
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
32553
|
+
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
32554
|
+
* @typedef {import('./types.js').Handler} Handler
|
|
32555
|
+
*/
|
|
32556
|
+
|
|
32557
|
+
|
|
32558
|
+
|
|
32559
|
+
|
|
32560
|
+
var nest_own = {}.hasOwnProperty
|
|
32561
|
+
|
|
32562
|
+
var handle = zwitch('nestingOperator', {
|
|
32563
|
+
unknown: unknownNesting,
|
|
32564
|
+
invalid: topScan, // `undefined` is the top query selector.
|
|
32565
|
+
handlers: {
|
|
32566
|
+
null: descendant, // `null` is the descendant combinator.
|
|
32567
|
+
'>': child,
|
|
32568
|
+
'+': adjacentSibling,
|
|
32569
|
+
'~': generalSibling
|
|
32570
|
+
}
|
|
32571
|
+
})
|
|
32572
|
+
|
|
32573
|
+
/** @type {Handler} */
|
|
32574
|
+
function nest(query, node, index, parent, state) {
|
|
32575
|
+
return handle(query, node, index, parent, state)
|
|
32576
|
+
}
|
|
32577
|
+
|
|
32578
|
+
// Shouldn’t be invoked, parser gives correct data.
|
|
32579
|
+
/* c8 ignore next 6 */
|
|
32580
|
+
/**
|
|
32581
|
+
* @param {{[x: string]: unknown, type: string}} query
|
|
32582
|
+
*/
|
|
32583
|
+
function unknownNesting(query) {
|
|
32584
|
+
throw new Error('Unexpected nesting `' + query.nestingOperator + '`')
|
|
32585
|
+
}
|
|
32586
|
+
|
|
32587
|
+
/** @type {Handler} */
|
|
32588
|
+
function topScan(query, node, index, parent, state) {
|
|
32589
|
+
// Shouldn’t happen.
|
|
32590
|
+
/* c8 ignore next 3 */
|
|
32591
|
+
if (parent) {
|
|
32592
|
+
throw new Error('topScan is supposed to be called from the root node')
|
|
32593
|
+
}
|
|
32594
|
+
|
|
32595
|
+
state.iterator(query, node, index, parent, state)
|
|
32596
|
+
if (!state.shallow) descendant(query, node, index, parent, state)
|
|
32597
|
+
}
|
|
32598
|
+
|
|
32599
|
+
/** @type {Handler} */
|
|
32600
|
+
function descendant(query, node, index, parent, state) {
|
|
32601
|
+
var previous = state.iterator
|
|
32602
|
+
|
|
32603
|
+
state.iterator = iterator
|
|
32604
|
+
child(query, node, index, parent, state)
|
|
32857
32605
|
|
|
32858
|
-
|
|
32859
|
-
|
|
32606
|
+
/** @type {SelectIterator} */
|
|
32607
|
+
function iterator(query, node, index, parent, state) {
|
|
32608
|
+
state.iterator = previous
|
|
32609
|
+
previous(query, node, index, parent, state)
|
|
32610
|
+
state.iterator = iterator
|
|
32860
32611
|
|
|
32861
|
-
|
|
32862
|
-
__webpack_require__.r(__webpack_exports__);
|
|
32863
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
32864
|
-
/* harmony export */ "map": () => (/* binding */ map)
|
|
32865
|
-
/* harmony export */ });
|
|
32866
|
-
/**
|
|
32867
|
-
* @typedef {import('unist').Node} Node
|
|
32868
|
-
*/
|
|
32612
|
+
if (state.one && state.found) return
|
|
32869
32613
|
|
|
32870
|
-
|
|
32871
|
-
|
|
32872
|
-
|
|
32873
|
-
* Function called with a node, its index, and its parent to produce a new
|
|
32874
|
-
* node.
|
|
32875
|
-
*/
|
|
32614
|
+
child(query, node, index, parent, state)
|
|
32615
|
+
}
|
|
32616
|
+
}
|
|
32876
32617
|
|
|
32877
|
-
/**
|
|
32878
|
-
|
|
32879
|
-
|
|
32880
|
-
|
|
32881
|
-
* Type of input tree.
|
|
32882
|
-
* @param {Tree} tree
|
|
32883
|
-
* Tree to map.
|
|
32884
|
-
* @param {MapFunction<Tree>} mapFunction
|
|
32885
|
-
* Function called with a node, its index, and its parent to produce a new
|
|
32886
|
-
* node.
|
|
32887
|
-
* @returns {Tree}
|
|
32888
|
-
* New mapped tree.
|
|
32889
|
-
*/
|
|
32890
|
-
function map(tree, mapFunction) {
|
|
32891
|
-
// @ts-expect-error Looks like a children.
|
|
32892
|
-
return preorder(tree, null, null)
|
|
32618
|
+
/** @type {Handler} */
|
|
32619
|
+
function child(query, node, _1, _2, state) {
|
|
32620
|
+
if (!util_parent(node)) return
|
|
32621
|
+
if (node.children.length === 0) return
|
|
32893
32622
|
|
|
32894
|
-
|
|
32895
|
-
|
|
32896
|
-
var newNode = Object.assign({}, mapFunction(node, index, parent))
|
|
32623
|
+
new WalkIterator(query, node, state).each().done()
|
|
32624
|
+
}
|
|
32897
32625
|
|
|
32898
|
-
|
|
32899
|
-
|
|
32900
|
-
|
|
32901
|
-
|
|
32902
|
-
|
|
32903
|
-
|
|
32904
|
-
|
|
32905
|
-
|
|
32626
|
+
/** @type {Handler} */
|
|
32627
|
+
function adjacentSibling(query, _, index, parent, state) {
|
|
32628
|
+
// Shouldn’t happen.
|
|
32629
|
+
/* c8 ignore next */
|
|
32630
|
+
if (!parent) return
|
|
32631
|
+
|
|
32632
|
+
new WalkIterator(query, parent, state)
|
|
32633
|
+
.prefillTypeIndex(0, ++index)
|
|
32634
|
+
.each(index, ++index)
|
|
32635
|
+
.prefillTypeIndex(index)
|
|
32636
|
+
.done()
|
|
32637
|
+
}
|
|
32638
|
+
|
|
32639
|
+
/** @type {Handler} */
|
|
32640
|
+
function generalSibling(query, _, index, parent, state) {
|
|
32641
|
+
// Shouldn’t happen.
|
|
32642
|
+
/* c8 ignore next */
|
|
32643
|
+
if (!parent) return
|
|
32644
|
+
|
|
32645
|
+
new WalkIterator(query, parent, state)
|
|
32646
|
+
.prefillTypeIndex(0, ++index)
|
|
32647
|
+
.each(index)
|
|
32648
|
+
.done()
|
|
32649
|
+
}
|
|
32650
|
+
|
|
32651
|
+
class WalkIterator {
|
|
32652
|
+
/**
|
|
32653
|
+
* Handles typeIndex and typeCount properties for every walker.
|
|
32654
|
+
*
|
|
32655
|
+
* @param {Rule} query
|
|
32656
|
+
* @param {Parent} parent
|
|
32657
|
+
* @param {SelectState} state
|
|
32658
|
+
*/
|
|
32659
|
+
constructor(query, parent, state) {
|
|
32660
|
+
/** @type {Rule} */
|
|
32661
|
+
this.query = query
|
|
32662
|
+
/** @type {Parent} */
|
|
32663
|
+
this.parent = parent
|
|
32664
|
+
/** @type {SelectState} */
|
|
32665
|
+
this.state = state
|
|
32666
|
+
/** @type {TypeIndex|undefined} */
|
|
32667
|
+
this.typeIndex = state.index ? new TypeIndex() : undefined
|
|
32668
|
+
/** @type {Array.<Function>} */
|
|
32669
|
+
this.delayed = []
|
|
32670
|
+
}
|
|
32671
|
+
|
|
32672
|
+
/**
|
|
32673
|
+
* @param {number|null|undefined} [x]
|
|
32674
|
+
* @param {number|null|undefined} [y]
|
|
32675
|
+
* @returns {this}
|
|
32676
|
+
*/
|
|
32677
|
+
prefillTypeIndex(x, y) {
|
|
32678
|
+
var [start, end] = this.defaults(x, y)
|
|
32679
|
+
|
|
32680
|
+
if (this.typeIndex) {
|
|
32681
|
+
while (start < end) {
|
|
32682
|
+
this.typeIndex.index(this.parent.children[start])
|
|
32683
|
+
start++
|
|
32684
|
+
}
|
|
32906
32685
|
}
|
|
32907
32686
|
|
|
32908
|
-
return
|
|
32687
|
+
return this
|
|
32909
32688
|
}
|
|
32910
|
-
}
|
|
32911
32689
|
|
|
32690
|
+
/**
|
|
32691
|
+
* @param {number|null|undefined} [x]
|
|
32692
|
+
* @param {number|null|undefined} [y]
|
|
32693
|
+
* @returns {this}
|
|
32694
|
+
*/
|
|
32695
|
+
each(x, y) {
|
|
32696
|
+
var [start, end] = this.defaults(x, y)
|
|
32697
|
+
var child = this.parent.children[start]
|
|
32698
|
+
/** @type {number} */
|
|
32699
|
+
var index
|
|
32700
|
+
/** @type {number} */
|
|
32701
|
+
var nodeIndex
|
|
32912
32702
|
|
|
32913
|
-
|
|
32703
|
+
if (start >= end) return this
|
|
32914
32704
|
|
|
32915
|
-
|
|
32916
|
-
|
|
32705
|
+
if (this.typeIndex) {
|
|
32706
|
+
nodeIndex = this.typeIndex.nodes
|
|
32707
|
+
index = this.typeIndex.index(child)
|
|
32708
|
+
this.delayed.push(delay)
|
|
32709
|
+
} else {
|
|
32710
|
+
this.state.iterator(this.query, child, start, this.parent, this.state)
|
|
32711
|
+
}
|
|
32917
32712
|
|
|
32918
|
-
|
|
32919
|
-
|
|
32920
|
-
__webpack_require__.r(__webpack_exports__);
|
|
32713
|
+
// Stop if we’re looking for one node and it’s already found.
|
|
32714
|
+
if (this.state.one && this.state.found) return this
|
|
32921
32715
|
|
|
32922
|
-
|
|
32923
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
32924
|
-
"matches": () => (/* binding */ unist_util_select_matches),
|
|
32925
|
-
"select": () => (/* binding */ unist_util_select_select),
|
|
32926
|
-
"selectAll": () => (/* binding */ selectAll)
|
|
32927
|
-
});
|
|
32716
|
+
return this.each(start + 1, end)
|
|
32928
32717
|
|
|
32929
|
-
|
|
32930
|
-
|
|
32718
|
+
/**
|
|
32719
|
+
* @this {WalkIterator}
|
|
32720
|
+
*/
|
|
32721
|
+
function delay() {
|
|
32722
|
+
this.state.typeIndex = index
|
|
32723
|
+
this.state.nodeIndex = nodeIndex
|
|
32724
|
+
this.state.typeCount = this.typeIndex.count(child)
|
|
32725
|
+
this.state.nodeCount = this.typeIndex.nodes
|
|
32726
|
+
this.state.iterator(this.query, child, start, this.parent, this.state)
|
|
32727
|
+
}
|
|
32728
|
+
}
|
|
32931
32729
|
|
|
32932
|
-
/**
|
|
32933
|
-
|
|
32934
|
-
|
|
32935
|
-
|
|
32936
|
-
|
|
32937
|
-
|
|
32938
|
-
*
|
|
32939
|
-
* @typedef {Object} Options
|
|
32940
|
-
* @property {Handler} [unknown]
|
|
32941
|
-
* @property {Handler} [invalid]
|
|
32942
|
-
* @property {Handlers} [handlers]
|
|
32943
|
-
*/
|
|
32730
|
+
/**
|
|
32731
|
+
* Done!
|
|
32732
|
+
* @returns {this}
|
|
32733
|
+
*/
|
|
32734
|
+
done() {
|
|
32735
|
+
var index = -1
|
|
32944
32736
|
|
|
32945
|
-
|
|
32946
|
-
|
|
32947
|
-
|
|
32948
|
-
|
|
32949
|
-
|
|
32950
|
-
|
|
32951
|
-
|
|
32952
|
-
var settings = options || {}
|
|
32737
|
+
while (++index < this.delayed.length) {
|
|
32738
|
+
this.delayed[index].call(this)
|
|
32739
|
+
if (this.state.one && this.state.found) break
|
|
32740
|
+
}
|
|
32741
|
+
|
|
32742
|
+
return this
|
|
32743
|
+
}
|
|
32953
32744
|
|
|
32954
32745
|
/**
|
|
32955
|
-
*
|
|
32956
|
-
*
|
|
32957
|
-
*
|
|
32958
|
-
* “invalid” handler will be called.
|
|
32959
|
-
* If `value` has an unknown `key`, the special “unknown” handler will be
|
|
32960
|
-
* called.
|
|
32961
|
-
*
|
|
32962
|
-
* All arguments, and the context object, are passed through to the handler,
|
|
32963
|
-
* and it’s result is returned.
|
|
32964
|
-
*
|
|
32965
|
-
* @param {...unknown} [value]
|
|
32966
|
-
* @this {unknown}
|
|
32967
|
-
* @returns {unknown}
|
|
32968
|
-
* @property {Handler} invalid
|
|
32969
|
-
* @property {Handler} unknown
|
|
32970
|
-
* @property {Handlers} handlers
|
|
32746
|
+
* @param {number|null|undefined} [start]
|
|
32747
|
+
* @param {number|null|undefined} [end]
|
|
32748
|
+
* @returns {[number, number]}
|
|
32971
32749
|
*/
|
|
32972
|
-
|
|
32973
|
-
|
|
32974
|
-
|
|
32750
|
+
defaults(start, end) {
|
|
32751
|
+
if (start === null || start === undefined || start < 0) start = 0
|
|
32752
|
+
if (end === null || end === undefined || end > this.parent.children.length)
|
|
32753
|
+
end = this.parent.children.length
|
|
32754
|
+
return [start, end]
|
|
32755
|
+
}
|
|
32756
|
+
}
|
|
32757
|
+
|
|
32758
|
+
class TypeIndex {
|
|
32759
|
+
constructor() {
|
|
32760
|
+
/** @type {Object.<string, number>} */
|
|
32761
|
+
this.counts = {}
|
|
32762
|
+
/** @type {number} */
|
|
32763
|
+
this.nodes = 0
|
|
32764
|
+
}
|
|
32765
|
+
|
|
32766
|
+
/**
|
|
32767
|
+
* @param {Node} node
|
|
32768
|
+
* @returns {number}
|
|
32769
|
+
*/
|
|
32770
|
+
index(node) {
|
|
32771
|
+
var type = node.type
|
|
32772
|
+
|
|
32773
|
+
this.nodes++
|
|
32975
32774
|
|
|
32976
|
-
if (
|
|
32977
|
-
fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
|
|
32978
|
-
}
|
|
32775
|
+
if (!nest_own.call(this.counts, type)) this.counts[type] = 0
|
|
32979
32776
|
|
|
32980
|
-
|
|
32981
|
-
|
|
32982
|
-
}
|
|
32777
|
+
// Note: `++` is intended to be postfixed!
|
|
32778
|
+
return this.counts[type]++
|
|
32983
32779
|
}
|
|
32984
32780
|
|
|
32985
|
-
|
|
32986
|
-
|
|
32987
|
-
|
|
32988
|
-
|
|
32989
|
-
|
|
32781
|
+
/**
|
|
32782
|
+
* @param {Node} node
|
|
32783
|
+
* @returns {number|undefined}
|
|
32784
|
+
*/
|
|
32785
|
+
count(node) {
|
|
32786
|
+
return this.counts[node.type]
|
|
32787
|
+
}
|
|
32990
32788
|
}
|
|
32991
32789
|
|
|
32992
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/
|
|
32790
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
|
|
32993
32791
|
/**
|
|
32994
|
-
* @typedef {import('
|
|
32995
|
-
* @typedef {import('
|
|
32996
|
-
*
|
|
32997
|
-
* @typedef {
|
|
32998
|
-
* @typedef {
|
|
32999
|
-
*
|
|
33000
|
-
* @typedef {
|
|
33001
|
-
* @typedef {import('./types.js').Parent} Parent
|
|
33002
|
-
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
33003
|
-
* @typedef {import('./types.js').SelectState} SelectState
|
|
32792
|
+
* @typedef {import('unist').Node} Node
|
|
32793
|
+
* @typedef {import('unist').Parent} Parent
|
|
32794
|
+
*
|
|
32795
|
+
* @typedef {string} Type
|
|
32796
|
+
* @typedef {Object<string, unknown>} Props
|
|
32797
|
+
*
|
|
32798
|
+
* @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
|
|
33004
32799
|
*/
|
|
33005
32800
|
|
|
33006
32801
|
/**
|
|
32802
|
+
* Check if a node passes a test
|
|
32803
|
+
*
|
|
32804
|
+
* @callback TestFunctionAnything
|
|
33007
32805
|
* @param {Node} node
|
|
33008
|
-
* @
|
|
32806
|
+
* @param {number} [index]
|
|
32807
|
+
* @param {Parent} [parent]
|
|
32808
|
+
* @returns {boolean|void}
|
|
33009
32809
|
*/
|
|
33010
|
-
function root(node) {
|
|
33011
|
-
return (
|
|
33012
|
-
// Root in nlcst.
|
|
33013
|
-
node.type === 'RootNode' ||
|
|
33014
|
-
// Rest
|
|
33015
|
-
node.type === 'root'
|
|
33016
|
-
)
|
|
33017
|
-
}
|
|
33018
32810
|
|
|
33019
32811
|
/**
|
|
32812
|
+
* Check if a node passes a certain node test
|
|
32813
|
+
*
|
|
32814
|
+
* @template {Node} X
|
|
32815
|
+
* @callback TestFunctionPredicate
|
|
33020
32816
|
* @param {Node} node
|
|
33021
|
-
* @
|
|
32817
|
+
* @param {number} [index]
|
|
32818
|
+
* @param {Parent} [parent]
|
|
32819
|
+
* @returns {node is X}
|
|
33022
32820
|
*/
|
|
33023
|
-
function util_parent(node) {
|
|
33024
|
-
return Array.isArray(node.children)
|
|
33025
|
-
}
|
|
33026
32821
|
|
|
33027
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/nest.js
|
|
33028
32822
|
/**
|
|
33029
|
-
* @
|
|
33030
|
-
* @
|
|
33031
|
-
* @
|
|
33032
|
-
* @
|
|
33033
|
-
* @
|
|
33034
|
-
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
33035
|
-
* @typedef {import('./types.js').Handler} Handler
|
|
32823
|
+
* @callback AssertAnything
|
|
32824
|
+
* @param {unknown} [node]
|
|
32825
|
+
* @param {number} [index]
|
|
32826
|
+
* @param {Parent} [parent]
|
|
32827
|
+
* @returns {boolean}
|
|
33036
32828
|
*/
|
|
33037
32829
|
|
|
32830
|
+
/**
|
|
32831
|
+
* Check if a node passes a certain node test
|
|
32832
|
+
*
|
|
32833
|
+
* @template {Node} Y
|
|
32834
|
+
* @callback AssertPredicate
|
|
32835
|
+
* @param {unknown} [node]
|
|
32836
|
+
* @param {number} [index]
|
|
32837
|
+
* @param {Parent} [parent]
|
|
32838
|
+
* @returns {node is Y}
|
|
32839
|
+
*/
|
|
33038
32840
|
|
|
32841
|
+
var is =
|
|
32842
|
+
/**
|
|
32843
|
+
* Check if a node passes a test.
|
|
32844
|
+
* When a `parent` node is known the `index` of node should also be given.
|
|
32845
|
+
*
|
|
32846
|
+
* @type {(
|
|
32847
|
+
* (<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) &
|
|
32848
|
+
* ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
|
|
32849
|
+
* )}
|
|
32850
|
+
*/
|
|
32851
|
+
(
|
|
32852
|
+
/**
|
|
32853
|
+
* Check if a node passes a test.
|
|
32854
|
+
* When a `parent` node is known the `index` of node should also be given.
|
|
32855
|
+
*
|
|
32856
|
+
* @param {unknown} [node] Node to check
|
|
32857
|
+
* @param {Test} [test]
|
|
32858
|
+
* When nullish, checks if `node` is a `Node`.
|
|
32859
|
+
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
32860
|
+
* When `function` checks if function passed the node is true.
|
|
32861
|
+
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
32862
|
+
* When `array`, checks any one of the subtests pass.
|
|
32863
|
+
* @param {number} [index] Position of `node` in `parent`
|
|
32864
|
+
* @param {Parent} [parent] Parent of `node`
|
|
32865
|
+
* @param {unknown} [context] Context object to invoke `test` with
|
|
32866
|
+
* @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
|
|
32867
|
+
*/
|
|
32868
|
+
// eslint-disable-next-line max-params
|
|
32869
|
+
function is(node, test, index, parent, context) {
|
|
32870
|
+
var check = convert(test)
|
|
33039
32871
|
|
|
32872
|
+
if (
|
|
32873
|
+
index !== undefined &&
|
|
32874
|
+
index !== null &&
|
|
32875
|
+
(typeof index !== 'number' ||
|
|
32876
|
+
index < 0 ||
|
|
32877
|
+
index === Number.POSITIVE_INFINITY)
|
|
32878
|
+
) {
|
|
32879
|
+
throw new Error('Expected positive finite index')
|
|
32880
|
+
}
|
|
33040
32881
|
|
|
33041
|
-
|
|
33042
|
-
|
|
33043
|
-
|
|
33044
|
-
|
|
33045
|
-
|
|
33046
|
-
|
|
33047
|
-
|
|
33048
|
-
'>': child,
|
|
33049
|
-
'+': adjacentSibling,
|
|
33050
|
-
'~': generalSibling
|
|
33051
|
-
}
|
|
33052
|
-
})
|
|
33053
|
-
|
|
33054
|
-
/** @type {Handler} */
|
|
33055
|
-
function nest(query, node, index, parent, state) {
|
|
33056
|
-
return handle(query, node, index, parent, state)
|
|
33057
|
-
}
|
|
32882
|
+
if (
|
|
32883
|
+
parent !== undefined &&
|
|
32884
|
+
parent !== null &&
|
|
32885
|
+
(!is(parent) || !parent.children)
|
|
32886
|
+
) {
|
|
32887
|
+
throw new Error('Expected parent node')
|
|
32888
|
+
}
|
|
33058
32889
|
|
|
33059
|
-
|
|
33060
|
-
|
|
33061
|
-
|
|
33062
|
-
|
|
33063
|
-
|
|
33064
|
-
|
|
33065
|
-
throw new Error('Unexpected nesting `' + query.nestingOperator + '`')
|
|
33066
|
-
}
|
|
32890
|
+
if (
|
|
32891
|
+
(parent === undefined || parent === null) !==
|
|
32892
|
+
(index === undefined || index === null)
|
|
32893
|
+
) {
|
|
32894
|
+
throw new Error('Expected both parent and index')
|
|
32895
|
+
}
|
|
33067
32896
|
|
|
33068
|
-
|
|
33069
|
-
|
|
33070
|
-
|
|
33071
|
-
|
|
33072
|
-
|
|
33073
|
-
|
|
33074
|
-
}
|
|
32897
|
+
// @ts-ignore Looks like a node.
|
|
32898
|
+
return node && node.type && typeof node.type === 'string'
|
|
32899
|
+
? Boolean(check.call(context, node, index, parent))
|
|
32900
|
+
: false
|
|
32901
|
+
}
|
|
32902
|
+
)
|
|
33075
32903
|
|
|
33076
|
-
|
|
33077
|
-
|
|
33078
|
-
|
|
32904
|
+
var convert =
|
|
32905
|
+
/**
|
|
32906
|
+
* @type {(
|
|
32907
|
+
* (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
|
|
32908
|
+
* ((test?: Test) => AssertAnything)
|
|
32909
|
+
* )}
|
|
32910
|
+
*/
|
|
32911
|
+
(
|
|
32912
|
+
/**
|
|
32913
|
+
* Generate an assertion from a check.
|
|
32914
|
+
* @param {Test} [test]
|
|
32915
|
+
* When nullish, checks if `node` is a `Node`.
|
|
32916
|
+
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
32917
|
+
* When `function` checks if function passed the node is true.
|
|
32918
|
+
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
32919
|
+
* When `array`, checks any one of the subtests pass.
|
|
32920
|
+
* @returns {AssertAnything}
|
|
32921
|
+
*/
|
|
32922
|
+
function (test) {
|
|
32923
|
+
if (test === undefined || test === null) {
|
|
32924
|
+
return ok
|
|
32925
|
+
}
|
|
33079
32926
|
|
|
33080
|
-
|
|
33081
|
-
|
|
33082
|
-
|
|
32927
|
+
if (typeof test === 'string') {
|
|
32928
|
+
return typeFactory(test)
|
|
32929
|
+
}
|
|
33083
32930
|
|
|
33084
|
-
|
|
33085
|
-
|
|
32931
|
+
if (typeof test === 'object') {
|
|
32932
|
+
// @ts-ignore looks like a list of tests / partial test object.
|
|
32933
|
+
return 'length' in test ? anyFactory(test) : propsFactory(test)
|
|
32934
|
+
}
|
|
33086
32935
|
|
|
33087
|
-
|
|
33088
|
-
|
|
33089
|
-
|
|
33090
|
-
previous(query, node, index, parent, state)
|
|
33091
|
-
state.iterator = iterator
|
|
32936
|
+
if (typeof test === 'function') {
|
|
32937
|
+
return castFactory(test)
|
|
32938
|
+
}
|
|
33092
32939
|
|
|
33093
|
-
|
|
32940
|
+
throw new Error('Expected function, string, or object as test')
|
|
32941
|
+
}
|
|
32942
|
+
)
|
|
32943
|
+
/**
|
|
32944
|
+
* @param {Array.<Type|Props|TestFunctionAnything>} tests
|
|
32945
|
+
* @returns {AssertAnything}
|
|
32946
|
+
*/
|
|
32947
|
+
function anyFactory(tests) {
|
|
32948
|
+
/** @type {Array.<AssertAnything>} */
|
|
32949
|
+
var checks = []
|
|
32950
|
+
var index = -1
|
|
33094
32951
|
|
|
33095
|
-
|
|
32952
|
+
while (++index < tests.length) {
|
|
32953
|
+
checks[index] = convert(tests[index])
|
|
33096
32954
|
}
|
|
33097
|
-
}
|
|
33098
32955
|
|
|
33099
|
-
|
|
33100
|
-
function child(query, node, _1, _2, state) {
|
|
33101
|
-
if (!util_parent(node)) return
|
|
33102
|
-
if (node.children.length === 0) return
|
|
32956
|
+
return castFactory(any)
|
|
33103
32957
|
|
|
33104
|
-
|
|
32958
|
+
/**
|
|
32959
|
+
* @this {unknown}
|
|
32960
|
+
* @param {unknown[]} parameters
|
|
32961
|
+
* @returns {boolean}
|
|
32962
|
+
*/
|
|
32963
|
+
function any(...parameters) {
|
|
32964
|
+
var index = -1
|
|
32965
|
+
|
|
32966
|
+
while (++index < checks.length) {
|
|
32967
|
+
if (checks[index].call(this, ...parameters)) return true
|
|
32968
|
+
}
|
|
32969
|
+
}
|
|
33105
32970
|
}
|
|
33106
32971
|
|
|
33107
|
-
/**
|
|
33108
|
-
|
|
33109
|
-
|
|
33110
|
-
|
|
33111
|
-
|
|
32972
|
+
/**
|
|
32973
|
+
* Utility to assert each property in `test` is represented in `node`, and each
|
|
32974
|
+
* values are strictly equal.
|
|
32975
|
+
*
|
|
32976
|
+
* @param {Props} check
|
|
32977
|
+
* @returns {AssertAnything}
|
|
32978
|
+
*/
|
|
32979
|
+
function propsFactory(check) {
|
|
32980
|
+
return castFactory(all)
|
|
33112
32981
|
|
|
33113
|
-
|
|
33114
|
-
|
|
33115
|
-
|
|
33116
|
-
|
|
33117
|
-
|
|
33118
|
-
}
|
|
32982
|
+
/**
|
|
32983
|
+
* @param {Node} node
|
|
32984
|
+
* @returns {boolean}
|
|
32985
|
+
*/
|
|
32986
|
+
function all(node) {
|
|
32987
|
+
/** @type {string} */
|
|
32988
|
+
var key
|
|
33119
32989
|
|
|
33120
|
-
|
|
33121
|
-
|
|
33122
|
-
|
|
33123
|
-
/* c8 ignore next */
|
|
33124
|
-
if (!parent) return
|
|
32990
|
+
for (key in check) {
|
|
32991
|
+
if (node[key] !== check[key]) return
|
|
32992
|
+
}
|
|
33125
32993
|
|
|
33126
|
-
|
|
33127
|
-
|
|
33128
|
-
.each(index)
|
|
33129
|
-
.done()
|
|
32994
|
+
return true
|
|
32995
|
+
}
|
|
33130
32996
|
}
|
|
33131
32997
|
|
|
33132
|
-
|
|
32998
|
+
/**
|
|
32999
|
+
* Utility to convert a string into a function which checks a given node’s type
|
|
33000
|
+
* for said string.
|
|
33001
|
+
*
|
|
33002
|
+
* @param {Type} check
|
|
33003
|
+
* @returns {AssertAnything}
|
|
33004
|
+
*/
|
|
33005
|
+
function typeFactory(check) {
|
|
33006
|
+
return castFactory(type)
|
|
33007
|
+
|
|
33133
33008
|
/**
|
|
33134
|
-
*
|
|
33135
|
-
*
|
|
33136
|
-
* @param {Rule} query
|
|
33137
|
-
* @param {Parent} parent
|
|
33138
|
-
* @param {SelectState} state
|
|
33009
|
+
* @param {Node} node
|
|
33139
33010
|
*/
|
|
33140
|
-
|
|
33141
|
-
|
|
33142
|
-
this.query = query
|
|
33143
|
-
/** @type {Parent} */
|
|
33144
|
-
this.parent = parent
|
|
33145
|
-
/** @type {SelectState} */
|
|
33146
|
-
this.state = state
|
|
33147
|
-
/** @type {TypeIndex|undefined} */
|
|
33148
|
-
this.typeIndex = state.index ? new TypeIndex() : undefined
|
|
33149
|
-
/** @type {Array.<Function>} */
|
|
33150
|
-
this.delayed = []
|
|
33011
|
+
function type(node) {
|
|
33012
|
+
return node && node.type === check
|
|
33151
33013
|
}
|
|
33014
|
+
}
|
|
33015
|
+
|
|
33016
|
+
/**
|
|
33017
|
+
* Utility to convert a string into a function which checks a given node’s type
|
|
33018
|
+
* for said string.
|
|
33019
|
+
* @param {TestFunctionAnything} check
|
|
33020
|
+
* @returns {AssertAnything}
|
|
33021
|
+
*/
|
|
33022
|
+
function castFactory(check) {
|
|
33023
|
+
return assertion
|
|
33152
33024
|
|
|
33153
33025
|
/**
|
|
33154
|
-
* @
|
|
33155
|
-
* @param {
|
|
33156
|
-
* @returns {
|
|
33026
|
+
* @this {unknown}
|
|
33027
|
+
* @param {Array.<unknown>} parameters
|
|
33028
|
+
* @returns {boolean}
|
|
33157
33029
|
*/
|
|
33158
|
-
|
|
33159
|
-
|
|
33030
|
+
function assertion(...parameters) {
|
|
33031
|
+
return Boolean(check.call(this, ...parameters))
|
|
33032
|
+
}
|
|
33033
|
+
}
|
|
33160
33034
|
|
|
33161
|
-
|
|
33162
|
-
|
|
33163
|
-
|
|
33164
|
-
|
|
33165
|
-
}
|
|
33166
|
-
}
|
|
33035
|
+
// Utility to return true.
|
|
33036
|
+
function ok() {
|
|
33037
|
+
return true
|
|
33038
|
+
}
|
|
33167
33039
|
|
|
33168
|
-
|
|
33169
|
-
|
|
33040
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
|
|
33041
|
+
/**
|
|
33042
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33043
|
+
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
33044
|
+
* @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
|
|
33045
|
+
* @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
|
|
33046
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
33047
|
+
* @typedef {import('./types.js').Selector} Selector
|
|
33048
|
+
* @typedef {import('./types.js').Selectors} Selectors
|
|
33049
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
33050
|
+
* @typedef {import('./types.js').Node} Node
|
|
33051
|
+
*/
|
|
33170
33052
|
|
|
33171
|
-
/**
|
|
33172
|
-
* @param {number|null|undefined} [x]
|
|
33173
|
-
* @param {number|null|undefined} [y]
|
|
33174
|
-
* @returns {this}
|
|
33175
|
-
*/
|
|
33176
|
-
each(x, y) {
|
|
33177
|
-
var [start, end] = this.defaults(x, y)
|
|
33178
|
-
var child = this.parent.children[start]
|
|
33179
|
-
/** @type {number} */
|
|
33180
|
-
var index
|
|
33181
|
-
/** @type {number} */
|
|
33182
|
-
var nodeIndex
|
|
33183
33053
|
|
|
33184
|
-
if (start >= end) return this
|
|
33185
33054
|
|
|
33186
|
-
if (this.typeIndex) {
|
|
33187
|
-
nodeIndex = this.typeIndex.nodes
|
|
33188
|
-
index = this.typeIndex.index(child)
|
|
33189
|
-
this.delayed.push(delay)
|
|
33190
|
-
} else {
|
|
33191
|
-
this.state.iterator(this.query, child, start, this.parent, this.state)
|
|
33192
|
-
}
|
|
33193
33055
|
|
|
33194
|
-
// Stop if we’re looking for one node and it’s already found.
|
|
33195
|
-
if (this.state.one && this.state.found) return this
|
|
33196
33056
|
|
|
33197
|
-
|
|
33057
|
+
var pseudo_is = convert()
|
|
33198
33058
|
|
|
33199
|
-
|
|
33200
|
-
|
|
33201
|
-
|
|
33202
|
-
|
|
33203
|
-
|
|
33204
|
-
|
|
33205
|
-
|
|
33206
|
-
|
|
33207
|
-
|
|
33208
|
-
|
|
33059
|
+
var pseudo_handle = zwitch('name', {
|
|
33060
|
+
unknown: unknownPseudo,
|
|
33061
|
+
invalid: invalidPseudo,
|
|
33062
|
+
handlers: {
|
|
33063
|
+
any: matches,
|
|
33064
|
+
blank: empty,
|
|
33065
|
+
empty,
|
|
33066
|
+
'first-child': firstChild,
|
|
33067
|
+
'first-of-type': firstOfType,
|
|
33068
|
+
has: hasSelector,
|
|
33069
|
+
'last-child': lastChild,
|
|
33070
|
+
'last-of-type': lastOfType,
|
|
33071
|
+
matches,
|
|
33072
|
+
not,
|
|
33073
|
+
'nth-child': nthChild,
|
|
33074
|
+
'nth-last-child': nthLastChild,
|
|
33075
|
+
'nth-of-type': nthOfType,
|
|
33076
|
+
'nth-last-of-type': nthLastOfType,
|
|
33077
|
+
'only-child': onlyChild,
|
|
33078
|
+
'only-of-type': onlyOfType,
|
|
33079
|
+
root: pseudo_root,
|
|
33080
|
+
scope
|
|
33209
33081
|
}
|
|
33082
|
+
})
|
|
33210
33083
|
|
|
33211
|
-
|
|
33212
|
-
|
|
33213
|
-
|
|
33214
|
-
|
|
33215
|
-
|
|
33216
|
-
|
|
33084
|
+
pseudo.needsIndex = [
|
|
33085
|
+
'first-child',
|
|
33086
|
+
'first-of-type',
|
|
33087
|
+
'last-child',
|
|
33088
|
+
'last-of-type',
|
|
33089
|
+
'nth-child',
|
|
33090
|
+
'nth-last-child',
|
|
33091
|
+
'nth-of-type',
|
|
33092
|
+
'nth-last-of-type',
|
|
33093
|
+
'only-child',
|
|
33094
|
+
'only-of-type'
|
|
33095
|
+
]
|
|
33217
33096
|
|
|
33218
|
-
|
|
33219
|
-
|
|
33220
|
-
|
|
33221
|
-
|
|
33097
|
+
/**
|
|
33098
|
+
* @param {Rule} query
|
|
33099
|
+
* @param {Node} node
|
|
33100
|
+
* @param {number|null} index
|
|
33101
|
+
* @param {Parent|null} parent
|
|
33102
|
+
* @param {SelectState} state
|
|
33103
|
+
* @returns {boolean}
|
|
33104
|
+
*/
|
|
33105
|
+
function pseudo(query, node, index, parent, state) {
|
|
33106
|
+
var pseudos = query.pseudos
|
|
33107
|
+
var offset = -1
|
|
33222
33108
|
|
|
33223
|
-
|
|
33109
|
+
while (++offset < pseudos.length) {
|
|
33110
|
+
if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
|
|
33224
33111
|
}
|
|
33225
33112
|
|
|
33226
|
-
|
|
33227
|
-
* @param {number|null|undefined} [start]
|
|
33228
|
-
* @param {number|null|undefined} [end]
|
|
33229
|
-
* @returns {[number, number]}
|
|
33230
|
-
*/
|
|
33231
|
-
defaults(start, end) {
|
|
33232
|
-
if (start === null || start === undefined || start < 0) start = 0
|
|
33233
|
-
if (end === null || end === undefined || end > this.parent.children.length)
|
|
33234
|
-
end = this.parent.children.length
|
|
33235
|
-
return [start, end]
|
|
33236
|
-
}
|
|
33113
|
+
return true
|
|
33237
33114
|
}
|
|
33238
33115
|
|
|
33239
|
-
|
|
33240
|
-
|
|
33241
|
-
|
|
33242
|
-
|
|
33243
|
-
|
|
33244
|
-
|
|
33245
|
-
|
|
33246
|
-
|
|
33247
|
-
|
|
33248
|
-
|
|
33249
|
-
|
|
33250
|
-
|
|
33251
|
-
|
|
33252
|
-
var type = node.type
|
|
33116
|
+
/**
|
|
33117
|
+
* @param {RulePseudoSelector} query
|
|
33118
|
+
* @param {Node} node
|
|
33119
|
+
* @param {number|null} _1
|
|
33120
|
+
* @param {Parent|null} _2
|
|
33121
|
+
* @param {SelectState} state
|
|
33122
|
+
* @returns {boolean}
|
|
33123
|
+
*/
|
|
33124
|
+
function matches(query, node, _1, _2, state) {
|
|
33125
|
+
var shallow = state.shallow
|
|
33126
|
+
var one = state.one
|
|
33127
|
+
/** @type {boolean} */
|
|
33128
|
+
var result
|
|
33253
33129
|
|
|
33254
|
-
|
|
33130
|
+
state.one = true
|
|
33131
|
+
state.shallow = true
|
|
33255
33132
|
|
|
33256
|
-
|
|
33133
|
+
result = state.any(query.value, node, state)[0] === node
|
|
33257
33134
|
|
|
33258
|
-
|
|
33259
|
-
|
|
33260
|
-
}
|
|
33135
|
+
state.shallow = shallow
|
|
33136
|
+
state.one = one
|
|
33261
33137
|
|
|
33262
|
-
|
|
33263
|
-
* @param {Node} node
|
|
33264
|
-
* @returns {number|undefined}
|
|
33265
|
-
*/
|
|
33266
|
-
count(node) {
|
|
33267
|
-
return this.counts[node.type]
|
|
33268
|
-
}
|
|
33138
|
+
return result
|
|
33269
33139
|
}
|
|
33270
33140
|
|
|
33271
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
|
|
33272
33141
|
/**
|
|
33273
|
-
* @
|
|
33274
|
-
* @
|
|
33275
|
-
*
|
|
33276
|
-
* @
|
|
33277
|
-
* @
|
|
33278
|
-
*
|
|
33279
|
-
* @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
|
|
33142
|
+
* @param {RulePseudoSelector} query
|
|
33143
|
+
* @param {Node} node
|
|
33144
|
+
* @param {number|null} index
|
|
33145
|
+
* @param {Parent|null} parent
|
|
33146
|
+
* @param {SelectState} state
|
|
33147
|
+
* @returns {boolean}
|
|
33280
33148
|
*/
|
|
33149
|
+
function not(query, node, index, parent, state) {
|
|
33150
|
+
return !matches(query, node, index, parent, state)
|
|
33151
|
+
}
|
|
33281
33152
|
|
|
33282
33153
|
/**
|
|
33283
|
-
*
|
|
33284
|
-
*
|
|
33285
|
-
* @callback TestFunctionAnything
|
|
33154
|
+
* @param {RulePseudo} _1
|
|
33286
33155
|
* @param {Node} node
|
|
33287
|
-
* @param {number}
|
|
33288
|
-
* @param {Parent}
|
|
33289
|
-
* @returns {boolean
|
|
33156
|
+
* @param {number|null} _2
|
|
33157
|
+
* @param {Parent|null} parent
|
|
33158
|
+
* @returns {boolean}
|
|
33290
33159
|
*/
|
|
33160
|
+
function pseudo_root(_1, node, _2, parent) {
|
|
33161
|
+
return pseudo_is(node) && !parent
|
|
33162
|
+
}
|
|
33291
33163
|
|
|
33292
33164
|
/**
|
|
33293
|
-
*
|
|
33294
|
-
*
|
|
33295
|
-
* @template {Node} X
|
|
33296
|
-
* @callback TestFunctionPredicate
|
|
33165
|
+
* @param {RulePseudo} _1
|
|
33297
33166
|
* @param {Node} node
|
|
33298
|
-
* @param {number}
|
|
33299
|
-
* @param {Parent}
|
|
33300
|
-
* @
|
|
33167
|
+
* @param {number|null} _2
|
|
33168
|
+
* @param {Parent|null} _3
|
|
33169
|
+
* @param {SelectState} state
|
|
33170
|
+
* @returns {boolean}
|
|
33301
33171
|
*/
|
|
33172
|
+
function scope(_1, node, _2, _3, state) {
|
|
33173
|
+
return pseudo_is(node) && state.scopeNodes.includes(node)
|
|
33174
|
+
}
|
|
33302
33175
|
|
|
33303
33176
|
/**
|
|
33304
|
-
* @
|
|
33305
|
-
* @param {
|
|
33306
|
-
* @param {number} [index]
|
|
33307
|
-
* @param {Parent} [parent]
|
|
33177
|
+
* @param {RulePseudo} _1
|
|
33178
|
+
* @param {Node} node
|
|
33308
33179
|
* @returns {boolean}
|
|
33309
33180
|
*/
|
|
33181
|
+
function empty(_1, node) {
|
|
33182
|
+
return util_parent(node) ? node.children.length === 0 : !('value' in node)
|
|
33183
|
+
}
|
|
33310
33184
|
|
|
33311
33185
|
/**
|
|
33312
|
-
*
|
|
33313
|
-
*
|
|
33314
|
-
* @
|
|
33315
|
-
* @
|
|
33316
|
-
* @param {
|
|
33317
|
-
* @
|
|
33318
|
-
* @param {Parent} [parent]
|
|
33319
|
-
* @returns {node is Y}
|
|
33186
|
+
* @param {RulePseudo} query
|
|
33187
|
+
* @param {Node} _1
|
|
33188
|
+
* @param {number|null} _2
|
|
33189
|
+
* @param {Parent|null} _3
|
|
33190
|
+
* @param {SelectState} state
|
|
33191
|
+
* @returns {boolean}
|
|
33320
33192
|
*/
|
|
33193
|
+
function firstChild(query, _1, _2, _3, state) {
|
|
33194
|
+
assertDeep(state, query)
|
|
33195
|
+
return state.nodeIndex === 0 // Specifically `0`, not falsey.
|
|
33196
|
+
}
|
|
33321
33197
|
|
|
33322
|
-
var is =
|
|
33323
|
-
/**
|
|
33324
|
-
* Check if a node passes a test.
|
|
33325
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
33326
|
-
*
|
|
33327
|
-
* @type {(
|
|
33328
|
-
* (<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) &
|
|
33329
|
-
* ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
|
|
33330
|
-
* )}
|
|
33331
|
-
*/
|
|
33332
|
-
(
|
|
33333
|
-
/**
|
|
33334
|
-
* Check if a node passes a test.
|
|
33335
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
33336
|
-
*
|
|
33337
|
-
* @param {unknown} [node] Node to check
|
|
33338
|
-
* @param {Test} [test]
|
|
33339
|
-
* When nullish, checks if `node` is a `Node`.
|
|
33340
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
33341
|
-
* When `function` checks if function passed the node is true.
|
|
33342
|
-
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
33343
|
-
* When `array`, checks any one of the subtests pass.
|
|
33344
|
-
* @param {number} [index] Position of `node` in `parent`
|
|
33345
|
-
* @param {Parent} [parent] Parent of `node`
|
|
33346
|
-
* @param {unknown} [context] Context object to invoke `test` with
|
|
33347
|
-
* @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
|
|
33348
|
-
*/
|
|
33349
|
-
// eslint-disable-next-line max-params
|
|
33350
|
-
function is(node, test, index, parent, context) {
|
|
33351
|
-
var check = convert(test)
|
|
33352
|
-
|
|
33353
|
-
if (
|
|
33354
|
-
index !== undefined &&
|
|
33355
|
-
index !== null &&
|
|
33356
|
-
(typeof index !== 'number' ||
|
|
33357
|
-
index < 0 ||
|
|
33358
|
-
index === Number.POSITIVE_INFINITY)
|
|
33359
|
-
) {
|
|
33360
|
-
throw new Error('Expected positive finite index')
|
|
33361
|
-
}
|
|
33362
|
-
|
|
33363
|
-
if (
|
|
33364
|
-
parent !== undefined &&
|
|
33365
|
-
parent !== null &&
|
|
33366
|
-
(!is(parent) || !parent.children)
|
|
33367
|
-
) {
|
|
33368
|
-
throw new Error('Expected parent node')
|
|
33369
|
-
}
|
|
33370
|
-
|
|
33371
|
-
if (
|
|
33372
|
-
(parent === undefined || parent === null) !==
|
|
33373
|
-
(index === undefined || index === null)
|
|
33374
|
-
) {
|
|
33375
|
-
throw new Error('Expected both parent and index')
|
|
33376
|
-
}
|
|
33377
|
-
|
|
33378
|
-
// @ts-ignore Looks like a node.
|
|
33379
|
-
return node && node.type && typeof node.type === 'string'
|
|
33380
|
-
? Boolean(check.call(context, node, index, parent))
|
|
33381
|
-
: false
|
|
33382
|
-
}
|
|
33383
|
-
)
|
|
33384
|
-
|
|
33385
|
-
var convert =
|
|
33386
|
-
/**
|
|
33387
|
-
* @type {(
|
|
33388
|
-
* (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
|
|
33389
|
-
* ((test?: Test) => AssertAnything)
|
|
33390
|
-
* )}
|
|
33391
|
-
*/
|
|
33392
|
-
(
|
|
33393
|
-
/**
|
|
33394
|
-
* Generate an assertion from a check.
|
|
33395
|
-
* @param {Test} [test]
|
|
33396
|
-
* When nullish, checks if `node` is a `Node`.
|
|
33397
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
33398
|
-
* When `function` checks if function passed the node is true.
|
|
33399
|
-
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
33400
|
-
* When `array`, checks any one of the subtests pass.
|
|
33401
|
-
* @returns {AssertAnything}
|
|
33402
|
-
*/
|
|
33403
|
-
function (test) {
|
|
33404
|
-
if (test === undefined || test === null) {
|
|
33405
|
-
return ok
|
|
33406
|
-
}
|
|
33407
|
-
|
|
33408
|
-
if (typeof test === 'string') {
|
|
33409
|
-
return typeFactory(test)
|
|
33410
|
-
}
|
|
33411
|
-
|
|
33412
|
-
if (typeof test === 'object') {
|
|
33413
|
-
// @ts-ignore looks like a list of tests / partial test object.
|
|
33414
|
-
return 'length' in test ? anyFactory(test) : propsFactory(test)
|
|
33415
|
-
}
|
|
33416
|
-
|
|
33417
|
-
if (typeof test === 'function') {
|
|
33418
|
-
return castFactory(test)
|
|
33419
|
-
}
|
|
33420
|
-
|
|
33421
|
-
throw new Error('Expected function, string, or object as test')
|
|
33422
|
-
}
|
|
33423
|
-
)
|
|
33424
33198
|
/**
|
|
33425
|
-
* @param {
|
|
33426
|
-
* @
|
|
33199
|
+
* @param {RulePseudo} query
|
|
33200
|
+
* @param {Node} _1
|
|
33201
|
+
* @param {number|null} _2
|
|
33202
|
+
* @param {Parent|null} _3
|
|
33203
|
+
* @param {SelectState} state
|
|
33204
|
+
* @returns {boolean}
|
|
33427
33205
|
*/
|
|
33428
|
-
function
|
|
33429
|
-
|
|
33430
|
-
|
|
33431
|
-
|
|
33206
|
+
function lastChild(query, _1, _2, _3, state) {
|
|
33207
|
+
assertDeep(state, query)
|
|
33208
|
+
return state.nodeIndex === state.nodeCount - 1
|
|
33209
|
+
}
|
|
33432
33210
|
|
|
33433
|
-
|
|
33434
|
-
|
|
33435
|
-
|
|
33211
|
+
/**
|
|
33212
|
+
* @param {RulePseudo} query
|
|
33213
|
+
* @param {Node} _1
|
|
33214
|
+
* @param {number|null} _2
|
|
33215
|
+
* @param {Parent|null} _3
|
|
33216
|
+
* @param {SelectState} state
|
|
33217
|
+
* @returns {boolean}
|
|
33218
|
+
*/
|
|
33219
|
+
function onlyChild(query, _1, _2, _3, state) {
|
|
33220
|
+
assertDeep(state, query)
|
|
33221
|
+
return state.nodeCount === 1
|
|
33222
|
+
}
|
|
33436
33223
|
|
|
33437
|
-
|
|
33224
|
+
/**
|
|
33225
|
+
* @param {RulePseudoNth} query
|
|
33226
|
+
* @param {Node} _1
|
|
33227
|
+
* @param {number|null} _2
|
|
33228
|
+
* @param {Parent|null} _3
|
|
33229
|
+
* @param {SelectState} state
|
|
33230
|
+
* @returns {boolean}
|
|
33231
|
+
*/
|
|
33232
|
+
function nthChild(query, _1, _2, _3, state) {
|
|
33233
|
+
assertDeep(state, query)
|
|
33234
|
+
return query.value(state.nodeIndex)
|
|
33235
|
+
}
|
|
33438
33236
|
|
|
33439
|
-
|
|
33440
|
-
|
|
33441
|
-
|
|
33442
|
-
|
|
33443
|
-
|
|
33444
|
-
|
|
33445
|
-
|
|
33237
|
+
/**
|
|
33238
|
+
* @param {RulePseudoNth} query
|
|
33239
|
+
* @param {Node} _1
|
|
33240
|
+
* @param {number|null} _2
|
|
33241
|
+
* @param {Parent|null} _3
|
|
33242
|
+
* @param {SelectState} state
|
|
33243
|
+
* @returns {boolean}
|
|
33244
|
+
*/
|
|
33245
|
+
function nthLastChild(query, _1, _2, _3, state) {
|
|
33246
|
+
assertDeep(state, query)
|
|
33247
|
+
return query.value(state.nodeCount - state.nodeIndex - 1)
|
|
33248
|
+
}
|
|
33446
33249
|
|
|
33447
|
-
|
|
33448
|
-
|
|
33449
|
-
|
|
33450
|
-
|
|
33250
|
+
/**
|
|
33251
|
+
* @param {RulePseudoNth} query
|
|
33252
|
+
* @param {Node} _1
|
|
33253
|
+
* @param {number|null} _2
|
|
33254
|
+
* @param {Parent|null} _3
|
|
33255
|
+
* @param {SelectState} state
|
|
33256
|
+
* @returns {boolean}
|
|
33257
|
+
*/
|
|
33258
|
+
function nthOfType(query, _1, _2, _3, state) {
|
|
33259
|
+
assertDeep(state, query)
|
|
33260
|
+
return query.value(state.typeIndex)
|
|
33451
33261
|
}
|
|
33452
33262
|
|
|
33453
33263
|
/**
|
|
33454
|
-
*
|
|
33455
|
-
*
|
|
33456
|
-
*
|
|
33457
|
-
* @param {
|
|
33458
|
-
* @
|
|
33264
|
+
* @param {RulePseudoNth} query
|
|
33265
|
+
* @param {Node} _1
|
|
33266
|
+
* @param {number|null} _2
|
|
33267
|
+
* @param {Parent|null} _3
|
|
33268
|
+
* @param {SelectState} state
|
|
33269
|
+
* @returns {boolean}
|
|
33459
33270
|
*/
|
|
33460
|
-
function
|
|
33461
|
-
|
|
33462
|
-
|
|
33463
|
-
/**
|
|
33464
|
-
* @param {Node} node
|
|
33465
|
-
* @returns {boolean}
|
|
33466
|
-
*/
|
|
33467
|
-
function all(node) {
|
|
33468
|
-
/** @type {string} */
|
|
33469
|
-
var key
|
|
33470
|
-
|
|
33471
|
-
for (key in check) {
|
|
33472
|
-
if (node[key] !== check[key]) return
|
|
33473
|
-
}
|
|
33474
|
-
|
|
33475
|
-
return true
|
|
33476
|
-
}
|
|
33271
|
+
function nthLastOfType(query, _1, _2, _3, state) {
|
|
33272
|
+
assertDeep(state, query)
|
|
33273
|
+
return query.value(state.typeCount - 1 - state.typeIndex)
|
|
33477
33274
|
}
|
|
33478
33275
|
|
|
33479
33276
|
/**
|
|
33480
|
-
*
|
|
33481
|
-
*
|
|
33482
|
-
*
|
|
33483
|
-
* @param {
|
|
33484
|
-
* @
|
|
33277
|
+
* @param {RulePseudo} query
|
|
33278
|
+
* @param {Node} _1
|
|
33279
|
+
* @param {number|null} _2
|
|
33280
|
+
* @param {Parent|null} _3
|
|
33281
|
+
* @param {SelectState} state
|
|
33282
|
+
* @returns {boolean}
|
|
33485
33283
|
*/
|
|
33486
|
-
function
|
|
33487
|
-
|
|
33488
|
-
|
|
33489
|
-
/**
|
|
33490
|
-
* @param {Node} node
|
|
33491
|
-
*/
|
|
33492
|
-
function type(node) {
|
|
33493
|
-
return node && node.type === check
|
|
33494
|
-
}
|
|
33284
|
+
function firstOfType(query, _1, _2, _3, state) {
|
|
33285
|
+
assertDeep(state, query)
|
|
33286
|
+
return state.typeIndex === 0
|
|
33495
33287
|
}
|
|
33496
33288
|
|
|
33497
33289
|
/**
|
|
33498
|
-
*
|
|
33499
|
-
*
|
|
33500
|
-
* @param {
|
|
33501
|
-
* @
|
|
33290
|
+
* @param {RulePseudo} query
|
|
33291
|
+
* @param {Node} _1
|
|
33292
|
+
* @param {number|null} _2
|
|
33293
|
+
* @param {Parent|null} _3
|
|
33294
|
+
* @param {SelectState} state
|
|
33295
|
+
* @returns {boolean}
|
|
33502
33296
|
*/
|
|
33503
|
-
function
|
|
33504
|
-
|
|
33297
|
+
function lastOfType(query, _1, _2, _3, state) {
|
|
33298
|
+
assertDeep(state, query)
|
|
33299
|
+
return state.typeIndex === state.typeCount - 1
|
|
33300
|
+
}
|
|
33505
33301
|
|
|
33506
|
-
|
|
33507
|
-
|
|
33508
|
-
|
|
33509
|
-
|
|
33510
|
-
|
|
33511
|
-
|
|
33512
|
-
|
|
33513
|
-
|
|
33302
|
+
/**
|
|
33303
|
+
* @param {RulePseudo} query
|
|
33304
|
+
* @param {Node} _1
|
|
33305
|
+
* @param {number|null} _2
|
|
33306
|
+
* @param {Parent|null} _3
|
|
33307
|
+
* @param {SelectState} state
|
|
33308
|
+
* @returns {boolean}
|
|
33309
|
+
*/
|
|
33310
|
+
function onlyOfType(query, _1, _2, _3, state) {
|
|
33311
|
+
assertDeep(state, query)
|
|
33312
|
+
return state.typeCount === 1
|
|
33514
33313
|
}
|
|
33515
33314
|
|
|
33516
|
-
//
|
|
33517
|
-
|
|
33518
|
-
|
|
33315
|
+
// Shouldn’t be invoked, parser gives correct data.
|
|
33316
|
+
/* c8 ignore next 3 */
|
|
33317
|
+
function invalidPseudo() {
|
|
33318
|
+
throw new Error('Invalid pseudo-selector')
|
|
33519
33319
|
}
|
|
33520
33320
|
|
|
33521
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
|
|
33522
33321
|
/**
|
|
33523
|
-
* @
|
|
33524
|
-
* @
|
|
33525
|
-
* @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
|
|
33526
|
-
* @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
|
|
33527
|
-
* @typedef {import('./types.js').Parent} Parent
|
|
33528
|
-
* @typedef {import('./types.js').Selector} Selector
|
|
33529
|
-
* @typedef {import('./types.js').Selectors} Selectors
|
|
33530
|
-
* @typedef {import('./types.js').SelectState} SelectState
|
|
33531
|
-
* @typedef {import('./types.js').Node} Node
|
|
33322
|
+
* @param {RulePseudo} query
|
|
33323
|
+
* @returns {boolean}
|
|
33532
33324
|
*/
|
|
33533
|
-
|
|
33534
|
-
|
|
33535
|
-
|
|
33536
|
-
|
|
33537
|
-
|
|
33538
|
-
var pseudo_is = convert()
|
|
33539
|
-
|
|
33540
|
-
var pseudo_handle = zwitch('name', {
|
|
33541
|
-
unknown: unknownPseudo,
|
|
33542
|
-
invalid: invalidPseudo,
|
|
33543
|
-
handlers: {
|
|
33544
|
-
any: matches,
|
|
33545
|
-
blank: empty,
|
|
33546
|
-
empty,
|
|
33547
|
-
'first-child': firstChild,
|
|
33548
|
-
'first-of-type': firstOfType,
|
|
33549
|
-
has: hasSelector,
|
|
33550
|
-
'last-child': lastChild,
|
|
33551
|
-
'last-of-type': lastOfType,
|
|
33552
|
-
matches,
|
|
33553
|
-
not,
|
|
33554
|
-
'nth-child': nthChild,
|
|
33555
|
-
'nth-last-child': nthLastChild,
|
|
33556
|
-
'nth-of-type': nthOfType,
|
|
33557
|
-
'nth-last-of-type': nthLastOfType,
|
|
33558
|
-
'only-child': onlyChild,
|
|
33559
|
-
'only-of-type': onlyOfType,
|
|
33560
|
-
root: pseudo_root,
|
|
33561
|
-
scope
|
|
33325
|
+
function unknownPseudo(query) {
|
|
33326
|
+
if (query.name) {
|
|
33327
|
+
throw new Error('Unknown pseudo-selector `' + query.name + '`')
|
|
33562
33328
|
}
|
|
33563
|
-
})
|
|
33564
33329
|
|
|
33565
|
-
pseudo
|
|
33566
|
-
|
|
33567
|
-
'first-of-type',
|
|
33568
|
-
'last-child',
|
|
33569
|
-
'last-of-type',
|
|
33570
|
-
'nth-child',
|
|
33571
|
-
'nth-last-child',
|
|
33572
|
-
'nth-of-type',
|
|
33573
|
-
'nth-last-of-type',
|
|
33574
|
-
'only-child',
|
|
33575
|
-
'only-of-type'
|
|
33576
|
-
]
|
|
33330
|
+
throw new Error('Unexpected pseudo-element or empty pseudo-class')
|
|
33331
|
+
}
|
|
33577
33332
|
|
|
33578
33333
|
/**
|
|
33579
|
-
* @param {Rule} query
|
|
33580
|
-
* @param {Node} node
|
|
33581
|
-
* @param {number|null} index
|
|
33582
|
-
* @param {Parent|null} parent
|
|
33583
33334
|
* @param {SelectState} state
|
|
33584
|
-
* @
|
|
33335
|
+
* @param {RulePseudo|RulePseudoNth} query
|
|
33585
33336
|
*/
|
|
33586
|
-
function
|
|
33587
|
-
|
|
33588
|
-
|
|
33589
|
-
|
|
33590
|
-
while (++offset < pseudos.length) {
|
|
33591
|
-
if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
|
|
33337
|
+
function assertDeep(state, query) {
|
|
33338
|
+
if (state.shallow) {
|
|
33339
|
+
throw new Error('Cannot use `:' + query.name + '` without parent')
|
|
33592
33340
|
}
|
|
33593
|
-
|
|
33594
|
-
return true
|
|
33595
33341
|
}
|
|
33596
33342
|
|
|
33597
33343
|
/**
|
|
@@ -33602,780 +33348,1062 @@ function pseudo(query, node, index, parent, state) {
|
|
|
33602
33348
|
* @param {SelectState} state
|
|
33603
33349
|
* @returns {boolean}
|
|
33604
33350
|
*/
|
|
33605
|
-
function
|
|
33351
|
+
function hasSelector(query, node, _1, _2, state) {
|
|
33606
33352
|
var shallow = state.shallow
|
|
33607
33353
|
var one = state.one
|
|
33354
|
+
var scopeNodes = state.scopeNodes
|
|
33355
|
+
var value = appendScope(query.value)
|
|
33356
|
+
var anything = state.any
|
|
33608
33357
|
/** @type {boolean} */
|
|
33609
33358
|
var result
|
|
33610
33359
|
|
|
33360
|
+
state.shallow = false
|
|
33611
33361
|
state.one = true
|
|
33612
|
-
state.
|
|
33362
|
+
state.scopeNodes = [node]
|
|
33363
|
+
|
|
33364
|
+
result = Boolean(anything(value, node, state)[0])
|
|
33365
|
+
|
|
33366
|
+
state.shallow = shallow
|
|
33367
|
+
state.one = one
|
|
33368
|
+
state.scopeNodes = scopeNodes
|
|
33369
|
+
|
|
33370
|
+
return result
|
|
33371
|
+
}
|
|
33372
|
+
|
|
33373
|
+
/**
|
|
33374
|
+
* @param {Selector} value
|
|
33375
|
+
*/
|
|
33376
|
+
function appendScope(value) {
|
|
33377
|
+
/** @type {Selectors} */
|
|
33378
|
+
var selector =
|
|
33379
|
+
value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
|
|
33380
|
+
var index = -1
|
|
33381
|
+
/** @type {Rule} */
|
|
33382
|
+
var rule
|
|
33383
|
+
|
|
33384
|
+
while (++index < selector.selectors.length) {
|
|
33385
|
+
rule = selector.selectors[index].rule
|
|
33386
|
+
rule.nestingOperator = null
|
|
33387
|
+
|
|
33388
|
+
// Needed if new pseudo’s are added that accepts commas (such as
|
|
33389
|
+
// `:lang(en, nl)`)
|
|
33390
|
+
/* c8 ignore else */
|
|
33391
|
+
if (
|
|
33392
|
+
!rule.pseudos ||
|
|
33393
|
+
rule.pseudos.length !== 1 ||
|
|
33394
|
+
rule.pseudos[0].name !== 'scope'
|
|
33395
|
+
) {
|
|
33396
|
+
selector.selectors[index] = {
|
|
33397
|
+
type: 'ruleSet',
|
|
33398
|
+
rule: {
|
|
33399
|
+
type: 'rule',
|
|
33400
|
+
rule,
|
|
33401
|
+
// @ts-ignore pseudos are fine w/ just a name!
|
|
33402
|
+
pseudos: [{name: 'scope'}]
|
|
33403
|
+
}
|
|
33404
|
+
}
|
|
33405
|
+
}
|
|
33406
|
+
}
|
|
33407
|
+
|
|
33408
|
+
return selector
|
|
33409
|
+
}
|
|
33410
|
+
|
|
33411
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/attribute.js
|
|
33412
|
+
/**
|
|
33413
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33414
|
+
* @typedef {import('./types.js').RuleAttr} RuleAttr
|
|
33415
|
+
* @typedef {import('./types.js').Node} Node
|
|
33416
|
+
*/
|
|
33417
|
+
|
|
33418
|
+
|
|
33419
|
+
|
|
33420
|
+
var attribute_handle = zwitch('operator', {
|
|
33421
|
+
unknown: unknownOperator,
|
|
33422
|
+
invalid: exists,
|
|
33423
|
+
handlers: {
|
|
33424
|
+
'=': exact,
|
|
33425
|
+
'^=': begins,
|
|
33426
|
+
'$=': ends,
|
|
33427
|
+
'*=': containsString,
|
|
33428
|
+
'~=': containsArray
|
|
33429
|
+
}
|
|
33430
|
+
})
|
|
33613
33431
|
|
|
33614
|
-
|
|
33432
|
+
/**
|
|
33433
|
+
* @param {Rule} query
|
|
33434
|
+
* @param {Node} node
|
|
33435
|
+
*/
|
|
33436
|
+
function attribute(query, node) {
|
|
33437
|
+
var index = -1
|
|
33615
33438
|
|
|
33616
|
-
|
|
33617
|
-
|
|
33439
|
+
while (++index < query.attrs.length) {
|
|
33440
|
+
if (!attribute_handle(query.attrs[index], node)) return false
|
|
33441
|
+
}
|
|
33618
33442
|
|
|
33619
|
-
return
|
|
33443
|
+
return true
|
|
33620
33444
|
}
|
|
33621
33445
|
|
|
33622
33446
|
/**
|
|
33623
|
-
*
|
|
33447
|
+
* `[attr]`
|
|
33448
|
+
*
|
|
33449
|
+
* @param {RuleAttr} query
|
|
33624
33450
|
* @param {Node} node
|
|
33625
|
-
* @param {number|null} index
|
|
33626
|
-
* @param {Parent|null} parent
|
|
33627
|
-
* @param {SelectState} state
|
|
33628
|
-
* @returns {boolean}
|
|
33629
33451
|
*/
|
|
33630
|
-
function
|
|
33631
|
-
return
|
|
33452
|
+
function exists(query, node) {
|
|
33453
|
+
return node[query.name] !== null && node[query.name] !== undefined
|
|
33632
33454
|
}
|
|
33633
33455
|
|
|
33634
33456
|
/**
|
|
33635
|
-
*
|
|
33457
|
+
* `[attr=value]`
|
|
33458
|
+
*
|
|
33459
|
+
* @param {RuleAttr} query
|
|
33636
33460
|
* @param {Node} node
|
|
33637
|
-
* @param {number|null} _2
|
|
33638
|
-
* @param {Parent|null} parent
|
|
33639
|
-
* @returns {boolean}
|
|
33640
33461
|
*/
|
|
33641
|
-
function
|
|
33642
|
-
return
|
|
33462
|
+
function exact(query, node) {
|
|
33463
|
+
return exists(query, node) && String(node[query.name]) === query.value
|
|
33643
33464
|
}
|
|
33644
33465
|
|
|
33645
33466
|
/**
|
|
33646
|
-
*
|
|
33467
|
+
* `[attr~=value]`
|
|
33468
|
+
*
|
|
33469
|
+
* @param {RuleAttr} query
|
|
33647
33470
|
* @param {Node} node
|
|
33648
|
-
* @param {number|null} _2
|
|
33649
|
-
* @param {Parent|null} _3
|
|
33650
|
-
* @param {SelectState} state
|
|
33651
|
-
* @returns {boolean}
|
|
33652
33471
|
*/
|
|
33653
|
-
function
|
|
33654
|
-
|
|
33472
|
+
function containsArray(query, node) {
|
|
33473
|
+
var value = node[query.name]
|
|
33474
|
+
|
|
33475
|
+
if (value === null || value === undefined) return false
|
|
33476
|
+
|
|
33477
|
+
// If this is an array, and the query is contained in it, return true.
|
|
33478
|
+
// Coverage comment in place because TS turns `Array.isArray(unknown)`
|
|
33479
|
+
// into `Array.<any>` instead of `Array.<unknown>`.
|
|
33480
|
+
// type-coverage:ignore-next-line
|
|
33481
|
+
if (Array.isArray(value) && value.includes(query.value)) {
|
|
33482
|
+
return true
|
|
33483
|
+
}
|
|
33484
|
+
|
|
33485
|
+
// For all other values, return whether this is an exact match.
|
|
33486
|
+
return String(value) === query.value
|
|
33655
33487
|
}
|
|
33656
33488
|
|
|
33657
33489
|
/**
|
|
33658
|
-
*
|
|
33490
|
+
* `[attr^=value]`
|
|
33491
|
+
*
|
|
33492
|
+
* @param {RuleAttr} query
|
|
33659
33493
|
* @param {Node} node
|
|
33660
|
-
* @returns {boolean}
|
|
33661
33494
|
*/
|
|
33662
|
-
function
|
|
33663
|
-
|
|
33664
|
-
}
|
|
33495
|
+
function begins(query, node) {
|
|
33496
|
+
var value = node[query.name]
|
|
33665
33497
|
|
|
33666
|
-
|
|
33667
|
-
|
|
33668
|
-
|
|
33669
|
-
|
|
33670
|
-
* @param {Parent|null} _3
|
|
33671
|
-
* @param {SelectState} state
|
|
33672
|
-
* @returns {boolean}
|
|
33673
|
-
*/
|
|
33674
|
-
function firstChild(query, _1, _2, _3, state) {
|
|
33675
|
-
assertDeep(state, query)
|
|
33676
|
-
return state.nodeIndex === 0 // Specifically `0`, not falsey.
|
|
33498
|
+
return (
|
|
33499
|
+
typeof value === 'string' &&
|
|
33500
|
+
value.slice(0, query.value.length) === query.value
|
|
33501
|
+
)
|
|
33677
33502
|
}
|
|
33678
33503
|
|
|
33679
33504
|
/**
|
|
33680
|
-
*
|
|
33681
|
-
*
|
|
33682
|
-
* @param {
|
|
33683
|
-
* @param {
|
|
33684
|
-
* @param {SelectState} state
|
|
33685
|
-
* @returns {boolean}
|
|
33505
|
+
* `[attr$=value]`
|
|
33506
|
+
*
|
|
33507
|
+
* @param {RuleAttr} query
|
|
33508
|
+
* @param {Node} node
|
|
33686
33509
|
*/
|
|
33687
|
-
function
|
|
33688
|
-
|
|
33689
|
-
return state.nodeIndex === state.nodeCount - 1
|
|
33690
|
-
}
|
|
33510
|
+
function ends(query, node) {
|
|
33511
|
+
var value = node[query.name]
|
|
33691
33512
|
|
|
33692
|
-
|
|
33693
|
-
|
|
33694
|
-
|
|
33695
|
-
|
|
33696
|
-
* @param {Parent|null} _3
|
|
33697
|
-
* @param {SelectState} state
|
|
33698
|
-
* @returns {boolean}
|
|
33699
|
-
*/
|
|
33700
|
-
function onlyChild(query, _1, _2, _3, state) {
|
|
33701
|
-
assertDeep(state, query)
|
|
33702
|
-
return state.nodeCount === 1
|
|
33513
|
+
return (
|
|
33514
|
+
typeof value === 'string' &&
|
|
33515
|
+
value.slice(-query.value.length) === query.value
|
|
33516
|
+
)
|
|
33703
33517
|
}
|
|
33704
33518
|
|
|
33705
33519
|
/**
|
|
33706
|
-
*
|
|
33707
|
-
*
|
|
33708
|
-
* @param {
|
|
33709
|
-
* @param {
|
|
33710
|
-
* @param {SelectState} state
|
|
33711
|
-
* @returns {boolean}
|
|
33520
|
+
* `[attr*=value]`
|
|
33521
|
+
*
|
|
33522
|
+
* @param {RuleAttr} query
|
|
33523
|
+
* @param {Node} node
|
|
33712
33524
|
*/
|
|
33713
|
-
function
|
|
33714
|
-
|
|
33715
|
-
return query.value
|
|
33525
|
+
function containsString(query, node) {
|
|
33526
|
+
var value = node[query.name]
|
|
33527
|
+
return typeof value === 'string' && value.includes(query.value)
|
|
33716
33528
|
}
|
|
33717
33529
|
|
|
33530
|
+
// Shouldn’t be invoked, Parser throws an error instead.
|
|
33531
|
+
/* c8 ignore next 6 */
|
|
33718
33532
|
/**
|
|
33719
|
-
* @param {
|
|
33720
|
-
* @param {Node} _1
|
|
33721
|
-
* @param {number|null} _2
|
|
33722
|
-
* @param {Parent|null} _3
|
|
33723
|
-
* @param {SelectState} state
|
|
33724
|
-
* @returns {boolean}
|
|
33533
|
+
* @param {{[x: string]: unknown, type: string}} query
|
|
33725
33534
|
*/
|
|
33726
|
-
function
|
|
33727
|
-
|
|
33728
|
-
return query.value(state.nodeCount - state.nodeIndex - 1)
|
|
33535
|
+
function unknownOperator(query) {
|
|
33536
|
+
throw new Error('Unknown operator `' + query.operator + '`')
|
|
33729
33537
|
}
|
|
33730
33538
|
|
|
33539
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
|
|
33731
33540
|
/**
|
|
33732
|
-
* @
|
|
33733
|
-
* @
|
|
33734
|
-
* @param {number|null} _2
|
|
33735
|
-
* @param {Parent|null} _3
|
|
33736
|
-
* @param {SelectState} state
|
|
33737
|
-
* @returns {boolean}
|
|
33541
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33542
|
+
* @typedef {import('./types.js').Node} Node
|
|
33738
33543
|
*/
|
|
33739
|
-
function nthOfType(query, _1, _2, _3, state) {
|
|
33740
|
-
assertDeep(state, query)
|
|
33741
|
-
return query.value(state.typeIndex)
|
|
33742
|
-
}
|
|
33743
33544
|
|
|
33744
33545
|
/**
|
|
33745
|
-
* @param {
|
|
33746
|
-
* @param {Node}
|
|
33747
|
-
* @param {number|null} _2
|
|
33748
|
-
* @param {Parent|null} _3
|
|
33749
|
-
* @param {SelectState} state
|
|
33750
|
-
* @returns {boolean}
|
|
33546
|
+
* @param {Rule} query
|
|
33547
|
+
* @param {Node} node
|
|
33751
33548
|
*/
|
|
33752
|
-
function
|
|
33753
|
-
|
|
33754
|
-
return query.value(state.typeCount - 1 - state.typeIndex)
|
|
33549
|
+
function name_name(query, node) {
|
|
33550
|
+
return query.tagName === '*' || query.tagName === node.type
|
|
33755
33551
|
}
|
|
33756
33552
|
|
|
33553
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
|
|
33757
33554
|
/**
|
|
33758
|
-
* @
|
|
33759
|
-
* @
|
|
33760
|
-
* @
|
|
33761
|
-
* @
|
|
33762
|
-
* @param {SelectState} state
|
|
33763
|
-
* @returns {boolean}
|
|
33555
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33556
|
+
* @typedef {import('./types.js').Node} Node
|
|
33557
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
33558
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
33764
33559
|
*/
|
|
33765
|
-
|
|
33766
|
-
|
|
33767
|
-
|
|
33768
|
-
|
|
33560
|
+
|
|
33561
|
+
|
|
33562
|
+
|
|
33563
|
+
|
|
33769
33564
|
|
|
33770
33565
|
/**
|
|
33771
|
-
* @param {
|
|
33772
|
-
* @param {Node}
|
|
33773
|
-
* @param {number|null}
|
|
33774
|
-
* @param {Parent|null}
|
|
33566
|
+
* @param {Rule} query
|
|
33567
|
+
* @param {Node} node
|
|
33568
|
+
* @param {number|null} index
|
|
33569
|
+
* @param {Parent|null} parent
|
|
33775
33570
|
* @param {SelectState} state
|
|
33776
33571
|
* @returns {boolean}
|
|
33777
33572
|
*/
|
|
33778
|
-
function
|
|
33779
|
-
|
|
33780
|
-
|
|
33573
|
+
function test(query, node, index, parent, state) {
|
|
33574
|
+
if (query.id) throw new Error('Invalid selector: id')
|
|
33575
|
+
if (query.classNames) throw new Error('Invalid selector: class')
|
|
33576
|
+
|
|
33577
|
+
return Boolean(
|
|
33578
|
+
node &&
|
|
33579
|
+
(!query.tagName || name_name(query, node)) &&
|
|
33580
|
+
(!query.attrs || attribute(query, node)) &&
|
|
33581
|
+
(!query.pseudos || pseudo(query, node, index, parent, state))
|
|
33582
|
+
)
|
|
33781
33583
|
}
|
|
33782
33584
|
|
|
33585
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/any.js
|
|
33783
33586
|
/**
|
|
33784
|
-
* @
|
|
33785
|
-
* @
|
|
33786
|
-
* @
|
|
33787
|
-
* @
|
|
33788
|
-
* @
|
|
33789
|
-
* @
|
|
33587
|
+
* @typedef {import('./types.js').Selector} Selector
|
|
33588
|
+
* @typedef {import('./types.js').Selectors} Selectors
|
|
33589
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33590
|
+
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
33591
|
+
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
33592
|
+
* @typedef {import('./types.js').Query} Query
|
|
33593
|
+
* @typedef {import('./types.js').Node} Node
|
|
33594
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
33595
|
+
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
33596
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
33790
33597
|
*/
|
|
33791
|
-
function onlyOfType(query, _1, _2, _3, state) {
|
|
33792
|
-
assertDeep(state, query)
|
|
33793
|
-
return state.typeCount === 1
|
|
33794
|
-
}
|
|
33795
33598
|
|
|
33796
|
-
|
|
33797
|
-
|
|
33798
|
-
|
|
33799
|
-
|
|
33599
|
+
|
|
33600
|
+
|
|
33601
|
+
|
|
33602
|
+
|
|
33603
|
+
|
|
33604
|
+
|
|
33605
|
+
var type = zwitch('type', {
|
|
33606
|
+
unknown: unknownType,
|
|
33607
|
+
invalid: invalidType,
|
|
33608
|
+
handlers: {selectors, ruleSet, rule}
|
|
33609
|
+
})
|
|
33610
|
+
|
|
33611
|
+
/**
|
|
33612
|
+
* @param {Selectors|RuleSet|Rule} query
|
|
33613
|
+
* @param {Node} node
|
|
33614
|
+
* @param {SelectState} state
|
|
33615
|
+
*/
|
|
33616
|
+
function any(query, node, state) {
|
|
33617
|
+
// @ts-ignore zwitch types are off.
|
|
33618
|
+
return query && node ? type(query, node, state) : []
|
|
33800
33619
|
}
|
|
33801
33620
|
|
|
33802
33621
|
/**
|
|
33803
|
-
* @param {
|
|
33804
|
-
* @
|
|
33622
|
+
* @param {Selectors} query
|
|
33623
|
+
* @param {Node} node
|
|
33624
|
+
* @param {SelectState} state
|
|
33805
33625
|
*/
|
|
33806
|
-
function
|
|
33807
|
-
|
|
33808
|
-
|
|
33626
|
+
function selectors(query, node, state) {
|
|
33627
|
+
var collect = collector(state.one)
|
|
33628
|
+
var index = -1
|
|
33629
|
+
|
|
33630
|
+
while (++index < query.selectors.length) {
|
|
33631
|
+
collect(ruleSet(query.selectors[index], node, state))
|
|
33809
33632
|
}
|
|
33810
33633
|
|
|
33811
|
-
|
|
33634
|
+
return collect.result
|
|
33812
33635
|
}
|
|
33813
33636
|
|
|
33814
33637
|
/**
|
|
33638
|
+
* @param {RuleSet} query
|
|
33639
|
+
* @param {Node} node
|
|
33815
33640
|
* @param {SelectState} state
|
|
33816
|
-
* @param {RulePseudo|RulePseudoNth} query
|
|
33817
33641
|
*/
|
|
33818
|
-
function
|
|
33819
|
-
|
|
33820
|
-
throw new Error('Cannot use `:' + query.name + '` without parent')
|
|
33821
|
-
}
|
|
33642
|
+
function ruleSet(query, node, state) {
|
|
33643
|
+
return rule(query.rule, node, state)
|
|
33822
33644
|
}
|
|
33823
33645
|
|
|
33824
33646
|
/**
|
|
33825
|
-
* @param {
|
|
33826
|
-
* @param {Node}
|
|
33827
|
-
* @param {number|null} _1
|
|
33828
|
-
* @param {Parent|null} _2
|
|
33647
|
+
* @param {Rule} query
|
|
33648
|
+
* @param {Node} tree
|
|
33829
33649
|
* @param {SelectState} state
|
|
33830
|
-
* @returns {boolean}
|
|
33831
33650
|
*/
|
|
33832
|
-
function
|
|
33833
|
-
var
|
|
33834
|
-
var one = state.one
|
|
33835
|
-
var scopeNodes = state.scopeNodes
|
|
33836
|
-
var value = appendScope(query.value)
|
|
33837
|
-
var anything = state.any
|
|
33838
|
-
/** @type {boolean} */
|
|
33839
|
-
var result
|
|
33651
|
+
function rule(query, tree, state) {
|
|
33652
|
+
var collect = collector(state.one)
|
|
33840
33653
|
|
|
33841
|
-
state.shallow
|
|
33842
|
-
|
|
33843
|
-
|
|
33654
|
+
if (state.shallow && query.rule) {
|
|
33655
|
+
throw new Error('Expected selector without nesting')
|
|
33656
|
+
}
|
|
33844
33657
|
|
|
33845
|
-
|
|
33658
|
+
nest(
|
|
33659
|
+
query,
|
|
33660
|
+
tree,
|
|
33661
|
+
0,
|
|
33662
|
+
null,
|
|
33663
|
+
configure(query, {
|
|
33664
|
+
scopeNodes: root(tree) ? tree.children : [tree],
|
|
33665
|
+
index: false,
|
|
33666
|
+
iterator,
|
|
33667
|
+
one: state.one,
|
|
33668
|
+
shallow: state.shallow,
|
|
33669
|
+
any: state.any
|
|
33670
|
+
})
|
|
33671
|
+
)
|
|
33846
33672
|
|
|
33847
|
-
|
|
33848
|
-
state.one = one
|
|
33849
|
-
state.scopeNodes = scopeNodes
|
|
33673
|
+
return collect.result
|
|
33850
33674
|
|
|
33851
|
-
|
|
33675
|
+
/** @type {SelectIterator} */
|
|
33676
|
+
function iterator(query, node, index, parent, state) {
|
|
33677
|
+
if (test(query, node, index, parent, state)) {
|
|
33678
|
+
if ('rule' in query) {
|
|
33679
|
+
nest(query.rule, node, index, parent, configure(query.rule, state))
|
|
33680
|
+
} else {
|
|
33681
|
+
collect(node)
|
|
33682
|
+
state.found = true
|
|
33683
|
+
}
|
|
33684
|
+
}
|
|
33685
|
+
}
|
|
33852
33686
|
}
|
|
33853
33687
|
|
|
33854
33688
|
/**
|
|
33855
|
-
* @
|
|
33689
|
+
* @template {SelectState} S
|
|
33690
|
+
* @param {Rule} query
|
|
33691
|
+
* @param {S} state
|
|
33692
|
+
* @returns {S}
|
|
33856
33693
|
*/
|
|
33857
|
-
function
|
|
33858
|
-
|
|
33859
|
-
var selector =
|
|
33860
|
-
value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
|
|
33694
|
+
function configure(query, state) {
|
|
33695
|
+
var pseudos = query.pseudos || []
|
|
33861
33696
|
var index = -1
|
|
33862
|
-
/** @type {Rule} */
|
|
33863
|
-
var rule
|
|
33864
|
-
|
|
33865
|
-
while (++index < selector.selectors.length) {
|
|
33866
|
-
rule = selector.selectors[index].rule
|
|
33867
|
-
rule.nestingOperator = null
|
|
33868
33697
|
|
|
33869
|
-
|
|
33870
|
-
|
|
33871
|
-
|
|
33872
|
-
|
|
33873
|
-
!rule.pseudos ||
|
|
33874
|
-
rule.pseudos.length !== 1 ||
|
|
33875
|
-
rule.pseudos[0].name !== 'scope'
|
|
33876
|
-
) {
|
|
33877
|
-
selector.selectors[index] = {
|
|
33878
|
-
type: 'ruleSet',
|
|
33879
|
-
rule: {
|
|
33880
|
-
type: 'rule',
|
|
33881
|
-
rule,
|
|
33882
|
-
// @ts-ignore pseudos are fine w/ just a name!
|
|
33883
|
-
pseudos: [{name: 'scope'}]
|
|
33884
|
-
}
|
|
33885
|
-
}
|
|
33698
|
+
while (++index < pseudos.length) {
|
|
33699
|
+
if (pseudo.needsIndex.includes(pseudos[index].name)) {
|
|
33700
|
+
state.index = true
|
|
33701
|
+
break
|
|
33886
33702
|
}
|
|
33887
33703
|
}
|
|
33888
33704
|
|
|
33889
|
-
return
|
|
33705
|
+
return state
|
|
33890
33706
|
}
|
|
33891
33707
|
|
|
33892
|
-
|
|
33708
|
+
// Shouldn’t be invoked, all data is handled.
|
|
33709
|
+
/* c8 ignore next 6 */
|
|
33893
33710
|
/**
|
|
33894
|
-
* @
|
|
33895
|
-
* @typedef {import('./types.js').RuleAttr} RuleAttr
|
|
33896
|
-
* @typedef {import('./types.js').Node} Node
|
|
33711
|
+
* @param {{[x: string]: unknown, type: string}} query
|
|
33897
33712
|
*/
|
|
33713
|
+
function unknownType(query) {
|
|
33714
|
+
throw new Error('Unknown type `' + query.type + '`')
|
|
33715
|
+
}
|
|
33898
33716
|
|
|
33899
|
-
|
|
33900
|
-
|
|
33901
|
-
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
handlers: {
|
|
33905
|
-
'=': exact,
|
|
33906
|
-
'^=': begins,
|
|
33907
|
-
'$=': ends,
|
|
33908
|
-
'*=': containsString,
|
|
33909
|
-
'~=': containsArray
|
|
33910
|
-
}
|
|
33911
|
-
})
|
|
33717
|
+
// Shouldn’t be invoked, parser gives correct data.
|
|
33718
|
+
/* c8 ignore next 3 */
|
|
33719
|
+
function invalidType() {
|
|
33720
|
+
throw new Error('Invalid type')
|
|
33721
|
+
}
|
|
33912
33722
|
|
|
33913
33723
|
/**
|
|
33914
|
-
* @param {
|
|
33915
|
-
* @param {Node} node
|
|
33724
|
+
* @param {boolean} one
|
|
33916
33725
|
*/
|
|
33917
|
-
function
|
|
33918
|
-
|
|
33726
|
+
function collector(one) {
|
|
33727
|
+
/** @type {Array.<Node>} */
|
|
33728
|
+
var result = []
|
|
33729
|
+
/** @type {boolean} */
|
|
33730
|
+
var found
|
|
33919
33731
|
|
|
33920
|
-
|
|
33921
|
-
|
|
33732
|
+
collect.result = result
|
|
33733
|
+
|
|
33734
|
+
return collect
|
|
33735
|
+
|
|
33736
|
+
/**
|
|
33737
|
+
* Append nodes to array, filtering out duplicates.
|
|
33738
|
+
*
|
|
33739
|
+
* @param {Node|Array.<Node>} node
|
|
33740
|
+
*/
|
|
33741
|
+
function collect(node) {
|
|
33742
|
+
var index = -1
|
|
33743
|
+
|
|
33744
|
+
if ('length' in node) {
|
|
33745
|
+
while (++index < node.length) {
|
|
33746
|
+
collectOne(node[index])
|
|
33747
|
+
}
|
|
33748
|
+
} else {
|
|
33749
|
+
collectOne(node)
|
|
33750
|
+
}
|
|
33922
33751
|
}
|
|
33923
33752
|
|
|
33924
|
-
|
|
33925
|
-
}
|
|
33753
|
+
/**
|
|
33754
|
+
* @param {Node} node
|
|
33755
|
+
*/
|
|
33756
|
+
function collectOne(node) {
|
|
33757
|
+
if (one) {
|
|
33758
|
+
/* Shouldn’t happen, safeguards performance problems. */
|
|
33759
|
+
/* c8 ignore next */
|
|
33760
|
+
if (found) throw new Error('Cannot collect multiple nodes')
|
|
33926
33761
|
|
|
33927
|
-
|
|
33928
|
-
|
|
33929
|
-
*
|
|
33930
|
-
* @param {RuleAttr} query
|
|
33931
|
-
* @param {Node} node
|
|
33932
|
-
*/
|
|
33933
|
-
function exists(query, node) {
|
|
33934
|
-
return node[query.name] !== null && node[query.name] !== undefined
|
|
33935
|
-
}
|
|
33762
|
+
found = true
|
|
33763
|
+
}
|
|
33936
33764
|
|
|
33937
|
-
|
|
33938
|
-
|
|
33939
|
-
*
|
|
33940
|
-
* @param {RuleAttr} query
|
|
33941
|
-
* @param {Node} node
|
|
33942
|
-
*/
|
|
33943
|
-
function exact(query, node) {
|
|
33944
|
-
return exists(query, node) && String(node[query.name]) === query.value
|
|
33765
|
+
if (!result.includes(node)) result.push(node)
|
|
33766
|
+
}
|
|
33945
33767
|
}
|
|
33946
33768
|
|
|
33769
|
+
// EXTERNAL MODULE: ./node_modules/css-selector-parser/lib/index.js
|
|
33770
|
+
var lib = __webpack_require__(8079);
|
|
33771
|
+
// EXTERNAL MODULE: ./node_modules/nth-check/lib/index.js
|
|
33772
|
+
var nth_check_lib = __webpack_require__(7540);
|
|
33773
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/parse.js
|
|
33947
33774
|
/**
|
|
33948
|
-
*
|
|
33949
|
-
*
|
|
33950
|
-
* @
|
|
33951
|
-
* @
|
|
33775
|
+
* @typedef {import('./types.js').Selector} Selector
|
|
33776
|
+
* @typedef {import('./types.js').Selectors} Selectors
|
|
33777
|
+
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
33778
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33779
|
+
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
33780
|
+
* @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
|
|
33952
33781
|
*/
|
|
33953
|
-
function containsArray(query, node) {
|
|
33954
|
-
var value = node[query.name]
|
|
33955
33782
|
|
|
33956
|
-
if (value === null || value === undefined) return false
|
|
33957
33783
|
|
|
33958
|
-
// If this is an array, and the query is contained in it, return true.
|
|
33959
|
-
// Coverage comment in place because TS turns `Array.isArray(unknown)`
|
|
33960
|
-
// into `Array.<any>` instead of `Array.<unknown>`.
|
|
33961
|
-
// type-coverage:ignore-next-line
|
|
33962
|
-
if (Array.isArray(value) && value.includes(query.value)) {
|
|
33963
|
-
return true
|
|
33964
|
-
}
|
|
33965
33784
|
|
|
33966
|
-
|
|
33967
|
-
|
|
33968
|
-
}
|
|
33785
|
+
|
|
33786
|
+
|
|
33787
|
+
/** @type {import('nth-check').default} */
|
|
33788
|
+
// @ts-ignore
|
|
33789
|
+
var nthCheck = nth_check_lib/* default */.ZP
|
|
33790
|
+
|
|
33791
|
+
var nth = new Set([
|
|
33792
|
+
'nth-child',
|
|
33793
|
+
'nth-last-child',
|
|
33794
|
+
'nth-of-type',
|
|
33795
|
+
'nth-last-of-type'
|
|
33796
|
+
])
|
|
33797
|
+
|
|
33798
|
+
var parser = new lib/* CssSelectorParser */.N()
|
|
33799
|
+
|
|
33800
|
+
parser.registerAttrEqualityMods('~', '^', '$', '*')
|
|
33801
|
+
parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
|
|
33802
|
+
parser.registerNestingOperators('>', '+', '~')
|
|
33803
|
+
|
|
33804
|
+
var compile = zwitch('type', {handlers: {selectors: parse_selectors, ruleSet: parse_ruleSet, rule: parse_rule}})
|
|
33969
33805
|
|
|
33970
33806
|
/**
|
|
33971
|
-
*
|
|
33972
|
-
*
|
|
33973
|
-
* @param {RuleAttr} query
|
|
33974
|
-
* @param {Node} node
|
|
33807
|
+
* @param {string} selector
|
|
33808
|
+
* @returns {Selector}
|
|
33975
33809
|
*/
|
|
33976
|
-
function
|
|
33977
|
-
|
|
33810
|
+
function parse(selector) {
|
|
33811
|
+
if (typeof selector !== 'string') {
|
|
33812
|
+
throw new TypeError('Expected `string` as selector, not `' + selector + '`')
|
|
33813
|
+
}
|
|
33978
33814
|
|
|
33979
|
-
|
|
33980
|
-
|
|
33981
|
-
value.slice(0, query.value.length) === query.value
|
|
33982
|
-
)
|
|
33815
|
+
// @ts-ignore types are wrong.
|
|
33816
|
+
return compile(parser.parse(selector))
|
|
33983
33817
|
}
|
|
33984
33818
|
|
|
33985
33819
|
/**
|
|
33986
|
-
*
|
|
33987
|
-
*
|
|
33988
|
-
* @param {RuleAttr} query
|
|
33989
|
-
* @param {Node} node
|
|
33820
|
+
* @param {Selectors} query
|
|
33990
33821
|
*/
|
|
33991
|
-
function
|
|
33992
|
-
var
|
|
33822
|
+
function parse_selectors(query) {
|
|
33823
|
+
var selectors = query.selectors
|
|
33824
|
+
var index = -1
|
|
33993
33825
|
|
|
33994
|
-
|
|
33995
|
-
|
|
33996
|
-
|
|
33997
|
-
)
|
|
33998
|
-
}
|
|
33826
|
+
while (++index < selectors.length) {
|
|
33827
|
+
compile(selectors[index])
|
|
33828
|
+
}
|
|
33999
33829
|
|
|
34000
|
-
|
|
34001
|
-
* `[attr*=value]`
|
|
34002
|
-
*
|
|
34003
|
-
* @param {RuleAttr} query
|
|
34004
|
-
* @param {Node} node
|
|
34005
|
-
*/
|
|
34006
|
-
function containsString(query, node) {
|
|
34007
|
-
var value = node[query.name]
|
|
34008
|
-
return typeof value === 'string' && value.includes(query.value)
|
|
33830
|
+
return query
|
|
34009
33831
|
}
|
|
34010
33832
|
|
|
34011
|
-
// Shouldn’t be invoked, Parser throws an error instead.
|
|
34012
|
-
/* c8 ignore next 6 */
|
|
34013
33833
|
/**
|
|
34014
|
-
* @param {
|
|
33834
|
+
* @param {RuleSet} query
|
|
34015
33835
|
*/
|
|
34016
|
-
function
|
|
34017
|
-
|
|
33836
|
+
function parse_ruleSet(query) {
|
|
33837
|
+
return parse_rule(query.rule)
|
|
34018
33838
|
}
|
|
34019
33839
|
|
|
34020
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
|
|
34021
|
-
/**
|
|
34022
|
-
* @typedef {import('./types.js').Rule} Rule
|
|
34023
|
-
* @typedef {import('./types.js').Node} Node
|
|
34024
|
-
*/
|
|
34025
|
-
|
|
34026
33840
|
/**
|
|
34027
33841
|
* @param {Rule} query
|
|
34028
|
-
* @param {Node} node
|
|
34029
|
-
*/
|
|
34030
|
-
function name_name(query, node) {
|
|
34031
|
-
return query.tagName === '*' || query.tagName === node.type
|
|
34032
|
-
}
|
|
34033
|
-
|
|
34034
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
|
|
34035
|
-
/**
|
|
34036
|
-
* @typedef {import('./types.js').Rule} Rule
|
|
34037
|
-
* @typedef {import('./types.js').Node} Node
|
|
34038
|
-
* @typedef {import('./types.js').Parent} Parent
|
|
34039
|
-
* @typedef {import('./types.js').SelectState} SelectState
|
|
34040
33842
|
*/
|
|
33843
|
+
function parse_rule(query) {
|
|
33844
|
+
var pseudos = query.pseudos || []
|
|
33845
|
+
var index = -1
|
|
33846
|
+
/** @type {RulePseudo|RulePseudoNth} */
|
|
33847
|
+
var pseudo
|
|
34041
33848
|
|
|
33849
|
+
while (++index < pseudos.length) {
|
|
33850
|
+
pseudo = pseudos[index]
|
|
34042
33851
|
|
|
33852
|
+
if (nth.has(pseudo.name)) {
|
|
33853
|
+
// @ts-ignore Patch a non-primitive type.
|
|
33854
|
+
pseudo.value = nthCheck(pseudo.value)
|
|
33855
|
+
// @ts-ignore Patch a non-primitive type.
|
|
33856
|
+
pseudo.valueType = 'function'
|
|
33857
|
+
}
|
|
33858
|
+
}
|
|
34043
33859
|
|
|
33860
|
+
compile(query.rule)
|
|
34044
33861
|
|
|
34045
|
-
|
|
34046
|
-
/**
|
|
34047
|
-
* @param {Rule} query
|
|
34048
|
-
* @param {Node} node
|
|
34049
|
-
* @param {number|null} index
|
|
34050
|
-
* @param {Parent|null} parent
|
|
34051
|
-
* @param {SelectState} state
|
|
34052
|
-
* @returns {boolean}
|
|
34053
|
-
*/
|
|
34054
|
-
function test(query, node, index, parent, state) {
|
|
34055
|
-
if (query.id) throw new Error('Invalid selector: id')
|
|
34056
|
-
if (query.classNames) throw new Error('Invalid selector: class')
|
|
34057
|
-
|
|
34058
|
-
return Boolean(
|
|
34059
|
-
node &&
|
|
34060
|
-
(!query.tagName || name_name(query, node)) &&
|
|
34061
|
-
(!query.attrs || attribute(query, node)) &&
|
|
34062
|
-
(!query.pseudos || pseudo(query, node, index, parent, state))
|
|
34063
|
-
)
|
|
33862
|
+
return query
|
|
34064
33863
|
}
|
|
34065
33864
|
|
|
34066
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/
|
|
33865
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
|
|
34067
33866
|
/**
|
|
34068
|
-
* @typedef {import('
|
|
34069
|
-
* @typedef {import('./types.js').Selectors} Selectors
|
|
34070
|
-
* @typedef {import('./types.js').Rule} Rule
|
|
34071
|
-
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
34072
|
-
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
34073
|
-
* @typedef {import('./types.js').Query} Query
|
|
34074
|
-
* @typedef {import('./types.js').Node} Node
|
|
34075
|
-
* @typedef {import('./types.js').Parent} Parent
|
|
34076
|
-
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
34077
|
-
* @typedef {import('./types.js').SelectState} SelectState
|
|
33867
|
+
* @typedef {import('unist').Node} Node
|
|
34078
33868
|
*/
|
|
34079
33869
|
|
|
34080
33870
|
|
|
34081
33871
|
|
|
34082
33872
|
|
|
34083
|
-
|
|
34084
|
-
|
|
34085
|
-
|
|
34086
|
-
var type = zwitch('type', {
|
|
34087
|
-
unknown: unknownType,
|
|
34088
|
-
invalid: invalidType,
|
|
34089
|
-
handlers: {selectors, ruleSet, rule}
|
|
34090
|
-
})
|
|
34091
|
-
|
|
34092
33873
|
/**
|
|
34093
|
-
* @param {
|
|
34094
|
-
* @param {Node} node
|
|
34095
|
-
* @
|
|
33874
|
+
* @param {string} selector
|
|
33875
|
+
* @param {Node} [node]
|
|
33876
|
+
* @returns {boolean}
|
|
34096
33877
|
*/
|
|
34097
|
-
function
|
|
34098
|
-
|
|
34099
|
-
return query && node ? type(query, node, state) : []
|
|
33878
|
+
function unist_util_select_matches(selector, node) {
|
|
33879
|
+
return Boolean(any(parse(selector), node, {one: true, shallow: true, any: any})[0])
|
|
34100
33880
|
}
|
|
34101
33881
|
|
|
34102
33882
|
/**
|
|
34103
|
-
* @param {
|
|
34104
|
-
* @param {Node} node
|
|
34105
|
-
* @
|
|
33883
|
+
* @param {string} selector
|
|
33884
|
+
* @param {Node} [node]
|
|
33885
|
+
* @returns {Node|null}
|
|
34106
33886
|
*/
|
|
34107
|
-
function
|
|
34108
|
-
|
|
34109
|
-
var index = -1
|
|
34110
|
-
|
|
34111
|
-
while (++index < query.selectors.length) {
|
|
34112
|
-
collect(ruleSet(query.selectors[index], node, state))
|
|
34113
|
-
}
|
|
34114
|
-
|
|
34115
|
-
return collect.result
|
|
33887
|
+
function unist_util_select_select(selector, node) {
|
|
33888
|
+
return any(parse(selector), node, {one: true, any: any})[0] || null
|
|
34116
33889
|
}
|
|
34117
33890
|
|
|
34118
33891
|
/**
|
|
34119
|
-
* @param {
|
|
34120
|
-
* @param {Node} node
|
|
34121
|
-
* @
|
|
33892
|
+
* @param {string} selector
|
|
33893
|
+
* @param {Node} [node]
|
|
33894
|
+
* @returns {Array.<Node>}
|
|
34122
33895
|
*/
|
|
34123
|
-
function
|
|
34124
|
-
return
|
|
33896
|
+
function selectAll(selector, node) {
|
|
33897
|
+
return any(parse(selector), node, {any: any})
|
|
34125
33898
|
}
|
|
34126
33899
|
|
|
33900
|
+
|
|
33901
|
+
/***/ }),
|
|
33902
|
+
|
|
33903
|
+
/***/ 6393:
|
|
33904
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
33905
|
+
|
|
33906
|
+
"use strict";
|
|
33907
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
33908
|
+
/* harmony export */ "Vn": () => (/* binding */ visit)
|
|
33909
|
+
/* harmony export */ });
|
|
33910
|
+
/* harmony import */ var unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5605);
|
|
34127
33911
|
/**
|
|
34128
|
-
* @
|
|
34129
|
-
* @
|
|
34130
|
-
* @
|
|
33912
|
+
* @typedef {import('unist').Node} Node
|
|
33913
|
+
* @typedef {import('unist').Parent} Parent
|
|
33914
|
+
* @typedef {import('unist-util-is').Test} Test
|
|
33915
|
+
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
|
|
33916
|
+
* @typedef {import('./complex-types.js').Visitor} Visitor
|
|
34131
33917
|
*/
|
|
34132
|
-
function rule(query, tree, state) {
|
|
34133
|
-
var collect = collector(state.one)
|
|
34134
33918
|
|
|
34135
|
-
if (state.shallow && query.rule) {
|
|
34136
|
-
throw new Error('Expected selector without nesting')
|
|
34137
|
-
}
|
|
34138
33919
|
|
|
34139
|
-
nest(
|
|
34140
|
-
query,
|
|
34141
|
-
tree,
|
|
34142
|
-
0,
|
|
34143
|
-
null,
|
|
34144
|
-
configure(query, {
|
|
34145
|
-
scopeNodes: root(tree) ? tree.children : [tree],
|
|
34146
|
-
index: false,
|
|
34147
|
-
iterator,
|
|
34148
|
-
one: state.one,
|
|
34149
|
-
shallow: state.shallow,
|
|
34150
|
-
any: state.any
|
|
34151
|
-
})
|
|
34152
|
-
)
|
|
34153
33920
|
|
|
34154
|
-
|
|
33921
|
+
/**
|
|
33922
|
+
* Visit children of tree which pass test.
|
|
33923
|
+
*
|
|
33924
|
+
* @param tree
|
|
33925
|
+
* Tree to walk
|
|
33926
|
+
* @param [test]
|
|
33927
|
+
* `unist-util-is`-compatible test
|
|
33928
|
+
* @param visitor
|
|
33929
|
+
* Function called for nodes that pass `test`.
|
|
33930
|
+
* @param reverse
|
|
33931
|
+
* Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
|
|
33932
|
+
*/
|
|
33933
|
+
const visit =
|
|
33934
|
+
/**
|
|
33935
|
+
* @type {(
|
|
33936
|
+
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
|
|
33937
|
+
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
|
|
33938
|
+
* )}
|
|
33939
|
+
*/
|
|
33940
|
+
(
|
|
33941
|
+
/**
|
|
33942
|
+
* @param {Node} tree
|
|
33943
|
+
* @param {Test} test
|
|
33944
|
+
* @param {import('./complex-types.js').Visitor} visitor
|
|
33945
|
+
* @param {boolean} [reverse]
|
|
33946
|
+
*/
|
|
33947
|
+
function (tree, test, visitor, reverse) {
|
|
33948
|
+
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
33949
|
+
reverse = visitor
|
|
33950
|
+
visitor = test
|
|
33951
|
+
test = null
|
|
33952
|
+
}
|
|
34155
33953
|
|
|
34156
|
-
|
|
34157
|
-
|
|
34158
|
-
|
|
34159
|
-
|
|
34160
|
-
|
|
34161
|
-
|
|
34162
|
-
|
|
34163
|
-
|
|
33954
|
+
(0,unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__/* .visitParents */ .S4)(tree, test, overload, reverse)
|
|
33955
|
+
|
|
33956
|
+
/**
|
|
33957
|
+
* @param {Node} node
|
|
33958
|
+
* @param {Array<Parent>} parents
|
|
33959
|
+
*/
|
|
33960
|
+
function overload(node, parents) {
|
|
33961
|
+
const parent = parents[parents.length - 1]
|
|
33962
|
+
return visitor(
|
|
33963
|
+
node,
|
|
33964
|
+
parent ? parent.children.indexOf(node) : null,
|
|
33965
|
+
parent
|
|
33966
|
+
)
|
|
34164
33967
|
}
|
|
34165
33968
|
}
|
|
34166
|
-
|
|
34167
|
-
}
|
|
33969
|
+
)
|
|
34168
33970
|
|
|
34169
|
-
/**
|
|
34170
|
-
* @template {SelectState} S
|
|
34171
|
-
* @param {Rule} query
|
|
34172
|
-
* @param {S} state
|
|
34173
|
-
* @returns {S}
|
|
34174
|
-
*/
|
|
34175
|
-
function configure(query, state) {
|
|
34176
|
-
var pseudos = query.pseudos || []
|
|
34177
|
-
var index = -1
|
|
34178
33971
|
|
|
34179
|
-
while (++index < pseudos.length) {
|
|
34180
|
-
if (pseudo.needsIndex.includes(pseudos[index].name)) {
|
|
34181
|
-
state.index = true
|
|
34182
|
-
break
|
|
34183
|
-
}
|
|
34184
|
-
}
|
|
34185
33972
|
|
|
34186
|
-
return state
|
|
34187
|
-
}
|
|
34188
33973
|
|
|
34189
|
-
|
|
34190
|
-
|
|
33974
|
+
/***/ }),
|
|
33975
|
+
|
|
33976
|
+
/***/ 5605:
|
|
33977
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
33978
|
+
|
|
33979
|
+
"use strict";
|
|
33980
|
+
|
|
33981
|
+
// EXPORTS
|
|
33982
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
33983
|
+
"AM": () => (/* binding */ SKIP),
|
|
33984
|
+
"S4": () => (/* binding */ visitParents)
|
|
33985
|
+
});
|
|
33986
|
+
|
|
33987
|
+
// UNUSED EXPORTS: CONTINUE, EXIT
|
|
33988
|
+
|
|
33989
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-is/index.js
|
|
34191
33990
|
/**
|
|
34192
|
-
* @
|
|
33991
|
+
* @typedef {import('unist').Node} Node
|
|
33992
|
+
* @typedef {import('unist').Parent} Parent
|
|
33993
|
+
*
|
|
33994
|
+
* @typedef {string} Type
|
|
33995
|
+
* @typedef {Object<string, unknown>} Props
|
|
33996
|
+
*
|
|
33997
|
+
* @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
|
|
34193
33998
|
*/
|
|
34194
|
-
function unknownType(query) {
|
|
34195
|
-
throw new Error('Unknown type `' + query.type + '`')
|
|
34196
|
-
}
|
|
34197
33999
|
|
|
34198
|
-
|
|
34199
|
-
|
|
34200
|
-
|
|
34201
|
-
|
|
34202
|
-
}
|
|
34000
|
+
/**
|
|
34001
|
+
* Check if a node passes a test
|
|
34002
|
+
*
|
|
34003
|
+
* @callback TestFunctionAnything
|
|
34004
|
+
* @param {Node} node
|
|
34005
|
+
* @param {number|null|undefined} [index]
|
|
34006
|
+
* @param {Parent|null|undefined} [parent]
|
|
34007
|
+
* @returns {boolean|void}
|
|
34008
|
+
*/
|
|
34203
34009
|
|
|
34204
34010
|
/**
|
|
34205
|
-
*
|
|
34011
|
+
* Check if a node passes a certain node test
|
|
34012
|
+
*
|
|
34013
|
+
* @template {Node} X
|
|
34014
|
+
* @callback TestFunctionPredicate
|
|
34015
|
+
* @param {Node} node
|
|
34016
|
+
* @param {number|null|undefined} [index]
|
|
34017
|
+
* @param {Parent|null|undefined} [parent]
|
|
34018
|
+
* @returns {node is X}
|
|
34206
34019
|
*/
|
|
34207
|
-
function collector(one) {
|
|
34208
|
-
/** @type {Array.<Node>} */
|
|
34209
|
-
var result = []
|
|
34210
|
-
/** @type {boolean} */
|
|
34211
|
-
var found
|
|
34212
34020
|
|
|
34213
|
-
|
|
34021
|
+
/**
|
|
34022
|
+
* @callback AssertAnything
|
|
34023
|
+
* @param {unknown} [node]
|
|
34024
|
+
* @param {number|null|undefined} [index]
|
|
34025
|
+
* @param {Parent|null|undefined} [parent]
|
|
34026
|
+
* @returns {boolean}
|
|
34027
|
+
*/
|
|
34214
34028
|
|
|
34215
|
-
|
|
34029
|
+
/**
|
|
34030
|
+
* Check if a node passes a certain node test
|
|
34031
|
+
*
|
|
34032
|
+
* @template {Node} Y
|
|
34033
|
+
* @callback AssertPredicate
|
|
34034
|
+
* @param {unknown} [node]
|
|
34035
|
+
* @param {number|null|undefined} [index]
|
|
34036
|
+
* @param {Parent|null|undefined} [parent]
|
|
34037
|
+
* @returns {node is Y}
|
|
34038
|
+
*/
|
|
34216
34039
|
|
|
34040
|
+
const is =
|
|
34217
34041
|
/**
|
|
34218
|
-
*
|
|
34042
|
+
* Check if a node passes a test.
|
|
34043
|
+
* When a `parent` node is known the `index` of node should also be given.
|
|
34219
34044
|
*
|
|
34220
|
-
* @
|
|
34045
|
+
* @type {(
|
|
34046
|
+
* (<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) &
|
|
34047
|
+
* ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
|
|
34048
|
+
* )}
|
|
34221
34049
|
*/
|
|
34222
|
-
|
|
34223
|
-
|
|
34050
|
+
(
|
|
34051
|
+
/**
|
|
34052
|
+
* Check if a node passes a test.
|
|
34053
|
+
* When a `parent` node is known the `index` of node should also be given.
|
|
34054
|
+
*
|
|
34055
|
+
* @param {unknown} [node] Node to check
|
|
34056
|
+
* @param {Test} [test]
|
|
34057
|
+
* When nullish, checks if `node` is a `Node`.
|
|
34058
|
+
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
34059
|
+
* When `function` checks if function passed the node is true.
|
|
34060
|
+
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
34061
|
+
* When `array`, checks any one of the subtests pass.
|
|
34062
|
+
* @param {number|null|undefined} [index] Position of `node` in `parent`
|
|
34063
|
+
* @param {Parent|null|undefined} [parent] Parent of `node`
|
|
34064
|
+
* @param {unknown} [context] Context object to invoke `test` with
|
|
34065
|
+
* @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
|
|
34066
|
+
*/
|
|
34067
|
+
// eslint-disable-next-line max-params
|
|
34068
|
+
function is(node, test, index, parent, context) {
|
|
34069
|
+
const check = convert(test)
|
|
34224
34070
|
|
|
34225
|
-
|
|
34226
|
-
|
|
34227
|
-
|
|
34071
|
+
if (
|
|
34072
|
+
index !== undefined &&
|
|
34073
|
+
index !== null &&
|
|
34074
|
+
(typeof index !== 'number' ||
|
|
34075
|
+
index < 0 ||
|
|
34076
|
+
index === Number.POSITIVE_INFINITY)
|
|
34077
|
+
) {
|
|
34078
|
+
throw new Error('Expected positive finite index')
|
|
34228
34079
|
}
|
|
34229
|
-
|
|
34230
|
-
|
|
34080
|
+
|
|
34081
|
+
if (
|
|
34082
|
+
parent !== undefined &&
|
|
34083
|
+
parent !== null &&
|
|
34084
|
+
(!is(parent) || !parent.children)
|
|
34085
|
+
) {
|
|
34086
|
+
throw new Error('Expected parent node')
|
|
34087
|
+
}
|
|
34088
|
+
|
|
34089
|
+
if (
|
|
34090
|
+
(parent === undefined || parent === null) !==
|
|
34091
|
+
(index === undefined || index === null)
|
|
34092
|
+
) {
|
|
34093
|
+
throw new Error('Expected both parent and index')
|
|
34094
|
+
}
|
|
34095
|
+
|
|
34096
|
+
// @ts-expect-error Looks like a node.
|
|
34097
|
+
return node && node.type && typeof node.type === 'string'
|
|
34098
|
+
? Boolean(check.call(context, node, index, parent))
|
|
34099
|
+
: false
|
|
34231
34100
|
}
|
|
34232
|
-
|
|
34101
|
+
)
|
|
34233
34102
|
|
|
34103
|
+
const convert =
|
|
34234
34104
|
/**
|
|
34235
|
-
* @
|
|
34105
|
+
* @type {(
|
|
34106
|
+
* (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
|
|
34107
|
+
* ((test?: Test) => AssertAnything)
|
|
34108
|
+
* )}
|
|
34236
34109
|
*/
|
|
34237
|
-
|
|
34238
|
-
|
|
34239
|
-
|
|
34240
|
-
|
|
34241
|
-
|
|
34110
|
+
(
|
|
34111
|
+
/**
|
|
34112
|
+
* Generate an assertion from a check.
|
|
34113
|
+
* @param {Test} [test]
|
|
34114
|
+
* When nullish, checks if `node` is a `Node`.
|
|
34115
|
+
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
34116
|
+
* When `function` checks if function passed the node is true.
|
|
34117
|
+
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
34118
|
+
* When `array`, checks any one of the subtests pass.
|
|
34119
|
+
* @returns {AssertAnything}
|
|
34120
|
+
*/
|
|
34121
|
+
function (test) {
|
|
34122
|
+
if (test === undefined || test === null) {
|
|
34123
|
+
return ok
|
|
34124
|
+
}
|
|
34242
34125
|
|
|
34243
|
-
|
|
34244
|
-
|
|
34126
|
+
if (typeof test === 'string') {
|
|
34127
|
+
return typeFactory(test)
|
|
34128
|
+
}
|
|
34245
34129
|
|
|
34246
|
-
|
|
34247
|
-
|
|
34248
|
-
}
|
|
34130
|
+
if (typeof test === 'object') {
|
|
34131
|
+
return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
|
|
34132
|
+
}
|
|
34249
34133
|
|
|
34250
|
-
|
|
34251
|
-
|
|
34252
|
-
|
|
34253
|
-
|
|
34254
|
-
|
|
34134
|
+
if (typeof test === 'function') {
|
|
34135
|
+
return castFactory(test)
|
|
34136
|
+
}
|
|
34137
|
+
|
|
34138
|
+
throw new Error('Expected function, string, or object as test')
|
|
34139
|
+
}
|
|
34140
|
+
)
|
|
34255
34141
|
/**
|
|
34256
|
-
* @
|
|
34257
|
-
* @
|
|
34258
|
-
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
34259
|
-
* @typedef {import('./types.js').Rule} Rule
|
|
34260
|
-
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
34261
|
-
* @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
|
|
34142
|
+
* @param {Array.<Type|Props|TestFunctionAnything>} tests
|
|
34143
|
+
* @returns {AssertAnything}
|
|
34262
34144
|
*/
|
|
34145
|
+
function anyFactory(tests) {
|
|
34146
|
+
/** @type {Array.<AssertAnything>} */
|
|
34147
|
+
const checks = []
|
|
34148
|
+
let index = -1
|
|
34263
34149
|
|
|
34150
|
+
while (++index < tests.length) {
|
|
34151
|
+
checks[index] = convert(tests[index])
|
|
34152
|
+
}
|
|
34264
34153
|
|
|
34154
|
+
return castFactory(any)
|
|
34265
34155
|
|
|
34156
|
+
/**
|
|
34157
|
+
* @this {unknown}
|
|
34158
|
+
* @param {unknown[]} parameters
|
|
34159
|
+
* @returns {boolean}
|
|
34160
|
+
*/
|
|
34161
|
+
function any(...parameters) {
|
|
34162
|
+
let index = -1
|
|
34266
34163
|
|
|
34164
|
+
while (++index < checks.length) {
|
|
34165
|
+
if (checks[index].call(this, ...parameters)) return true
|
|
34166
|
+
}
|
|
34267
34167
|
|
|
34268
|
-
|
|
34269
|
-
|
|
34270
|
-
|
|
34168
|
+
return false
|
|
34169
|
+
}
|
|
34170
|
+
}
|
|
34271
34171
|
|
|
34272
|
-
|
|
34273
|
-
|
|
34274
|
-
|
|
34275
|
-
|
|
34276
|
-
|
|
34277
|
-
|
|
34172
|
+
/**
|
|
34173
|
+
* Utility to assert each property in `test` is represented in `node`, and each
|
|
34174
|
+
* values are strictly equal.
|
|
34175
|
+
*
|
|
34176
|
+
* @param {Props} check
|
|
34177
|
+
* @returns {AssertAnything}
|
|
34178
|
+
*/
|
|
34179
|
+
function propsFactory(check) {
|
|
34180
|
+
return castFactory(all)
|
|
34278
34181
|
|
|
34279
|
-
|
|
34182
|
+
/**
|
|
34183
|
+
* @param {Node} node
|
|
34184
|
+
* @returns {boolean}
|
|
34185
|
+
*/
|
|
34186
|
+
function all(node) {
|
|
34187
|
+
/** @type {string} */
|
|
34188
|
+
let key
|
|
34280
34189
|
|
|
34281
|
-
|
|
34282
|
-
|
|
34283
|
-
|
|
34190
|
+
for (key in check) {
|
|
34191
|
+
// @ts-expect-error: hush, it sure works as an index.
|
|
34192
|
+
if (node[key] !== check[key]) return false
|
|
34193
|
+
}
|
|
34284
34194
|
|
|
34285
|
-
|
|
34195
|
+
return true
|
|
34196
|
+
}
|
|
34197
|
+
}
|
|
34286
34198
|
|
|
34287
34199
|
/**
|
|
34288
|
-
*
|
|
34289
|
-
*
|
|
34200
|
+
* Utility to convert a string into a function which checks a given node’s type
|
|
34201
|
+
* for said string.
|
|
34202
|
+
*
|
|
34203
|
+
* @param {Type} check
|
|
34204
|
+
* @returns {AssertAnything}
|
|
34290
34205
|
*/
|
|
34291
|
-
function
|
|
34292
|
-
|
|
34293
|
-
throw new TypeError('Expected `string` as selector, not `' + selector + '`')
|
|
34294
|
-
}
|
|
34206
|
+
function typeFactory(check) {
|
|
34207
|
+
return castFactory(type)
|
|
34295
34208
|
|
|
34296
|
-
|
|
34297
|
-
|
|
34209
|
+
/**
|
|
34210
|
+
* @param {Node} node
|
|
34211
|
+
*/
|
|
34212
|
+
function type(node) {
|
|
34213
|
+
return node && node.type === check
|
|
34214
|
+
}
|
|
34298
34215
|
}
|
|
34299
34216
|
|
|
34300
34217
|
/**
|
|
34301
|
-
*
|
|
34218
|
+
* Utility to convert a string into a function which checks a given node’s type
|
|
34219
|
+
* for said string.
|
|
34220
|
+
* @param {TestFunctionAnything} check
|
|
34221
|
+
* @returns {AssertAnything}
|
|
34302
34222
|
*/
|
|
34303
|
-
function
|
|
34304
|
-
|
|
34305
|
-
var index = -1
|
|
34223
|
+
function castFactory(check) {
|
|
34224
|
+
return assertion
|
|
34306
34225
|
|
|
34307
|
-
|
|
34308
|
-
|
|
34226
|
+
/**
|
|
34227
|
+
* @this {unknown}
|
|
34228
|
+
* @param {Array.<unknown>} parameters
|
|
34229
|
+
* @returns {boolean}
|
|
34230
|
+
*/
|
|
34231
|
+
function assertion(...parameters) {
|
|
34232
|
+
// @ts-expect-error: spreading is fine.
|
|
34233
|
+
return Boolean(check.call(this, ...parameters))
|
|
34309
34234
|
}
|
|
34235
|
+
}
|
|
34310
34236
|
|
|
34311
|
-
|
|
34237
|
+
// Utility to return true.
|
|
34238
|
+
function ok() {
|
|
34239
|
+
return true
|
|
34312
34240
|
}
|
|
34313
34241
|
|
|
34242
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.browser.js
|
|
34314
34243
|
/**
|
|
34315
|
-
* @param {
|
|
34244
|
+
* @param {string} d
|
|
34245
|
+
* @returns {string}
|
|
34316
34246
|
*/
|
|
34317
|
-
function
|
|
34318
|
-
return
|
|
34247
|
+
function color(d) {
|
|
34248
|
+
return d
|
|
34319
34249
|
}
|
|
34320
34250
|
|
|
34251
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
|
|
34321
34252
|
/**
|
|
34322
|
-
* @
|
|
34253
|
+
* @typedef {import('unist').Node} Node
|
|
34254
|
+
* @typedef {import('unist').Parent} Parent
|
|
34255
|
+
* @typedef {import('unist-util-is').Test} Test
|
|
34256
|
+
* @typedef {import('./complex-types.js').Action} Action
|
|
34257
|
+
* @typedef {import('./complex-types.js').Index} Index
|
|
34258
|
+
* @typedef {import('./complex-types.js').ActionTuple} ActionTuple
|
|
34259
|
+
* @typedef {import('./complex-types.js').VisitorResult} VisitorResult
|
|
34260
|
+
* @typedef {import('./complex-types.js').Visitor} Visitor
|
|
34323
34261
|
*/
|
|
34324
|
-
function parse_rule(query) {
|
|
34325
|
-
var pseudos = query.pseudos || []
|
|
34326
|
-
var index = -1
|
|
34327
|
-
/** @type {RulePseudo|RulePseudoNth} */
|
|
34328
|
-
var pseudo
|
|
34329
34262
|
|
|
34330
|
-
while (++index < pseudos.length) {
|
|
34331
|
-
pseudo = pseudos[index]
|
|
34332
34263
|
|
|
34333
|
-
if (nth.has(pseudo.name)) {
|
|
34334
|
-
// @ts-ignore Patch a non-primitive type.
|
|
34335
|
-
pseudo.value = nthCheck(pseudo.value)
|
|
34336
|
-
// @ts-ignore Patch a non-primitive type.
|
|
34337
|
-
pseudo.valueType = 'function'
|
|
34338
|
-
}
|
|
34339
|
-
}
|
|
34340
34264
|
|
|
34341
|
-
compile(query.rule)
|
|
34342
34265
|
|
|
34343
|
-
|
|
34344
|
-
|
|
34266
|
+
/**
|
|
34267
|
+
* Continue traversing as normal
|
|
34268
|
+
*/
|
|
34269
|
+
const CONTINUE = true
|
|
34270
|
+
/**
|
|
34271
|
+
* Do not traverse this node’s children
|
|
34272
|
+
*/
|
|
34273
|
+
const SKIP = 'skip'
|
|
34274
|
+
/**
|
|
34275
|
+
* Stop traversing immediately
|
|
34276
|
+
*/
|
|
34277
|
+
const EXIT = false
|
|
34345
34278
|
|
|
34346
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
|
|
34347
34279
|
/**
|
|
34348
|
-
*
|
|
34280
|
+
* Visit children of tree which pass test.
|
|
34281
|
+
*
|
|
34282
|
+
* @param tree
|
|
34283
|
+
* Tree to walk
|
|
34284
|
+
* @param [test]
|
|
34285
|
+
* `unist-util-is`-compatible test
|
|
34286
|
+
* @param visitor
|
|
34287
|
+
* Function called for nodes that pass `test`.
|
|
34288
|
+
* @param [reverse=false]
|
|
34289
|
+
* Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
|
|
34349
34290
|
*/
|
|
34291
|
+
const visitParents =
|
|
34292
|
+
/**
|
|
34293
|
+
* @type {(
|
|
34294
|
+
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
|
|
34295
|
+
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
|
|
34296
|
+
* )}
|
|
34297
|
+
*/
|
|
34298
|
+
(
|
|
34299
|
+
/**
|
|
34300
|
+
* @param {Node} tree
|
|
34301
|
+
* @param {Test} test
|
|
34302
|
+
* @param {import('./complex-types.js').Visitor<Node>} visitor
|
|
34303
|
+
* @param {boolean} [reverse=false]
|
|
34304
|
+
*/
|
|
34305
|
+
function (tree, test, visitor, reverse) {
|
|
34306
|
+
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
34307
|
+
reverse = visitor
|
|
34308
|
+
// @ts-expect-error no visitor given, so `visitor` is test.
|
|
34309
|
+
visitor = test
|
|
34310
|
+
test = null
|
|
34311
|
+
}
|
|
34350
34312
|
|
|
34313
|
+
const is = convert(test)
|
|
34314
|
+
const step = reverse ? -1 : 1
|
|
34351
34315
|
|
|
34316
|
+
factory(tree, null, [])()
|
|
34352
34317
|
|
|
34318
|
+
/**
|
|
34319
|
+
* @param {Node} node
|
|
34320
|
+
* @param {number?} index
|
|
34321
|
+
* @param {Array<Parent>} parents
|
|
34322
|
+
*/
|
|
34323
|
+
function factory(node, index, parents) {
|
|
34324
|
+
/** @type {Record<string, unknown>} */
|
|
34325
|
+
// @ts-expect-error: hush
|
|
34326
|
+
const value = typeof node === 'object' && node !== null ? node : {}
|
|
34327
|
+
/** @type {string|undefined} */
|
|
34328
|
+
let name
|
|
34353
34329
|
|
|
34354
|
-
|
|
34355
|
-
|
|
34356
|
-
|
|
34357
|
-
|
|
34358
|
-
|
|
34359
|
-
|
|
34360
|
-
|
|
34361
|
-
}
|
|
34330
|
+
if (typeof value.type === 'string') {
|
|
34331
|
+
name =
|
|
34332
|
+
typeof value.tagName === 'string'
|
|
34333
|
+
? value.tagName
|
|
34334
|
+
: typeof value.name === 'string'
|
|
34335
|
+
? value.name
|
|
34336
|
+
: undefined
|
|
34362
34337
|
|
|
34363
|
-
|
|
34364
|
-
|
|
34365
|
-
|
|
34366
|
-
|
|
34367
|
-
|
|
34368
|
-
|
|
34369
|
-
|
|
34370
|
-
|
|
34338
|
+
Object.defineProperty(visit, 'name', {
|
|
34339
|
+
value:
|
|
34340
|
+
'node (' +
|
|
34341
|
+
color(value.type + (name ? '<' + name + '>' : '')) +
|
|
34342
|
+
')'
|
|
34343
|
+
})
|
|
34344
|
+
}
|
|
34345
|
+
|
|
34346
|
+
return visit
|
|
34347
|
+
|
|
34348
|
+
function visit() {
|
|
34349
|
+
/** @type {ActionTuple} */
|
|
34350
|
+
let result = []
|
|
34351
|
+
/** @type {ActionTuple} */
|
|
34352
|
+
let subresult
|
|
34353
|
+
/** @type {number} */
|
|
34354
|
+
let offset
|
|
34355
|
+
/** @type {Array<Parent>} */
|
|
34356
|
+
let grandparents
|
|
34357
|
+
|
|
34358
|
+
if (!test || is(node, index, parents[parents.length - 1] || null)) {
|
|
34359
|
+
result = toResult(visitor(node, parents))
|
|
34360
|
+
|
|
34361
|
+
if (result[0] === EXIT) {
|
|
34362
|
+
return result
|
|
34363
|
+
}
|
|
34364
|
+
}
|
|
34365
|
+
|
|
34366
|
+
// @ts-expect-error looks like a parent.
|
|
34367
|
+
if (node.children && result[0] !== SKIP) {
|
|
34368
|
+
// @ts-expect-error looks like a parent.
|
|
34369
|
+
offset = (reverse ? node.children.length : -1) + step
|
|
34370
|
+
// @ts-expect-error looks like a parent.
|
|
34371
|
+
grandparents = parents.concat(node)
|
|
34372
|
+
|
|
34373
|
+
// @ts-expect-error looks like a parent.
|
|
34374
|
+
while (offset > -1 && offset < node.children.length) {
|
|
34375
|
+
// @ts-expect-error looks like a parent.
|
|
34376
|
+
subresult = factory(node.children[offset], offset, grandparents)()
|
|
34377
|
+
|
|
34378
|
+
if (subresult[0] === EXIT) {
|
|
34379
|
+
return subresult
|
|
34380
|
+
}
|
|
34381
|
+
|
|
34382
|
+
offset =
|
|
34383
|
+
typeof subresult[1] === 'number' ? subresult[1] : offset + step
|
|
34384
|
+
}
|
|
34385
|
+
}
|
|
34386
|
+
|
|
34387
|
+
return result
|
|
34388
|
+
}
|
|
34389
|
+
}
|
|
34390
|
+
}
|
|
34391
|
+
)
|
|
34371
34392
|
|
|
34372
34393
|
/**
|
|
34373
|
-
* @param {
|
|
34374
|
-
* @
|
|
34375
|
-
* @returns {Array.<Node>}
|
|
34394
|
+
* @param {VisitorResult} value
|
|
34395
|
+
* @returns {ActionTuple}
|
|
34376
34396
|
*/
|
|
34377
|
-
function
|
|
34378
|
-
|
|
34397
|
+
function toResult(value) {
|
|
34398
|
+
if (Array.isArray(value)) {
|
|
34399
|
+
return value
|
|
34400
|
+
}
|
|
34401
|
+
|
|
34402
|
+
if (typeof value === 'number') {
|
|
34403
|
+
return [CONTINUE, value]
|
|
34404
|
+
}
|
|
34405
|
+
|
|
34406
|
+
return [value]
|
|
34379
34407
|
}
|
|
34380
34408
|
|
|
34381
34409
|
|
|
@@ -34635,7 +34663,7 @@ var _require3 = __webpack_require__(8447),
|
|
|
34635
34663
|
var BaseUrlContext = __webpack_require__(6785);
|
|
34636
34664
|
var createElement = __webpack_require__(5894);
|
|
34637
34665
|
var CustomParsers = Object.values(__webpack_require__(8521));
|
|
34638
|
-
var customCompilers = Object.values(__webpack_require__(
|
|
34666
|
+
var customCompilers = Object.values(__webpack_require__(8457));
|
|
34639
34667
|
var registerCustomComponents = __webpack_require__(1264);
|
|
34640
34668
|
var _require4 = __webpack_require__(2531),
|
|
34641
34669
|
options = _require4.options,
|
|
@@ -34645,7 +34673,7 @@ var _require5 = __webpack_require__(6284),
|
|
|
34645
34673
|
var toPlainText = __webpack_require__(4792);
|
|
34646
34674
|
var sectionAnchorId = __webpack_require__(9620);
|
|
34647
34675
|
var tableFlattening = __webpack_require__(4625);
|
|
34648
|
-
var _require6 = __webpack_require__(
|
|
34676
|
+
var _require6 = __webpack_require__(2692),
|
|
34649
34677
|
remarkTransformers = _require6.remarkTransformers,
|
|
34650
34678
|
rehypeTransformers = _require6.rehypeTransformers;
|
|
34651
34679
|
var createSchema = __webpack_require__(8229);
|