@uiw/react-md-editor 4.0.2 → 4.0.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/mdeditor.js +133 -1235
- package/dist/mdeditor.min.js +1 -1
- package/esm/Context.d.ts +1 -1
- package/lib/Context.d.ts +1 -1
- package/package.json +2 -2
package/dist/mdeditor.js
CHANGED
|
@@ -41615,1134 +41615,82 @@ var preview_defaultUrlTransform = url => url;
|
|
|
41615
41615
|
}))
|
|
41616
41616
|
}));
|
|
41617
41617
|
}));
|
|
41618
|
-
;// CONCATENATED MODULE: ../node_modules/
|
|
41619
|
-
/**
|
|
41620
|
-
* @typedef {import('unist').Node} Node
|
|
41621
|
-
* @typedef {import('unist').Parent} Parent
|
|
41622
|
-
*/
|
|
41623
|
-
|
|
41624
|
-
/**
|
|
41625
|
-
* @typedef {Record<string, unknown>} Props
|
|
41626
|
-
* @typedef {null | undefined | string | Props | TestFunctionAnything | Array<string | Props | TestFunctionAnything>} Test
|
|
41627
|
-
* Check for an arbitrary node, unaware of TypeScript inferral.
|
|
41628
|
-
*
|
|
41629
|
-
* @callback TestFunctionAnything
|
|
41630
|
-
* Check if a node passes a test, unaware of TypeScript inferral.
|
|
41631
|
-
* @param {unknown} this
|
|
41632
|
-
* The given context.
|
|
41633
|
-
* @param {Node} node
|
|
41634
|
-
* A node.
|
|
41635
|
-
* @param {number | null | undefined} [index]
|
|
41636
|
-
* The node’s position in its parent.
|
|
41637
|
-
* @param {Parent | null | undefined} [parent]
|
|
41638
|
-
* The node’s parent.
|
|
41639
|
-
* @returns {boolean | void}
|
|
41640
|
-
* Whether this node passes the test.
|
|
41641
|
-
*/
|
|
41642
|
-
|
|
41643
|
-
/**
|
|
41644
|
-
* @template {Node} Kind
|
|
41645
|
-
* Node type.
|
|
41646
|
-
* @typedef {Kind['type'] | Partial<Kind> | TestFunctionPredicate<Kind> | Array<Kind['type'] | Partial<Kind> | TestFunctionPredicate<Kind>>} PredicateTest
|
|
41647
|
-
* Check for a node that can be inferred by TypeScript.
|
|
41648
|
-
*/
|
|
41649
|
-
|
|
41650
|
-
/**
|
|
41651
|
-
* Check if a node passes a certain test.
|
|
41652
|
-
*
|
|
41653
|
-
* @template {Node} Kind
|
|
41654
|
-
* Node type.
|
|
41655
|
-
* @callback TestFunctionPredicate
|
|
41656
|
-
* Complex test function for a node that can be inferred by TypeScript.
|
|
41657
|
-
* @param {Node} node
|
|
41658
|
-
* A node.
|
|
41659
|
-
* @param {number | null | undefined} [index]
|
|
41660
|
-
* The node’s position in its parent.
|
|
41661
|
-
* @param {Parent | null | undefined} [parent]
|
|
41662
|
-
* The node’s parent.
|
|
41663
|
-
* @returns {node is Kind}
|
|
41664
|
-
* Whether this node passes the test.
|
|
41665
|
-
*/
|
|
41666
|
-
|
|
41667
|
-
/**
|
|
41668
|
-
* @callback AssertAnything
|
|
41669
|
-
* Check that an arbitrary value is a node, unaware of TypeScript inferral.
|
|
41670
|
-
* @param {unknown} [node]
|
|
41671
|
-
* Anything (typically a node).
|
|
41672
|
-
* @param {number | null | undefined} [index]
|
|
41673
|
-
* The node’s position in its parent.
|
|
41674
|
-
* @param {Parent | null | undefined} [parent]
|
|
41675
|
-
* The node’s parent.
|
|
41676
|
-
* @returns {boolean}
|
|
41677
|
-
* Whether this is a node and passes a test.
|
|
41678
|
-
*/
|
|
41679
|
-
|
|
41680
|
-
/**
|
|
41681
|
-
* Check if a node is a node and passes a certain node test.
|
|
41682
|
-
*
|
|
41683
|
-
* @template {Node} Kind
|
|
41684
|
-
* Node type.
|
|
41685
|
-
* @callback AssertPredicate
|
|
41686
|
-
* Check that an arbitrary value is a specific node, aware of TypeScript.
|
|
41687
|
-
* @param {unknown} [node]
|
|
41688
|
-
* Anything (typically a node).
|
|
41689
|
-
* @param {number | null | undefined} [index]
|
|
41690
|
-
* The node’s position in its parent.
|
|
41691
|
-
* @param {Parent | null | undefined} [parent]
|
|
41692
|
-
* The node’s parent.
|
|
41693
|
-
* @returns {node is Kind}
|
|
41694
|
-
* Whether this is a node and passes a test.
|
|
41695
|
-
*/
|
|
41696
|
-
|
|
41697
|
-
/**
|
|
41698
|
-
* Check if `node` is a `Node` and whether it passes the given test.
|
|
41699
|
-
*
|
|
41700
|
-
* @param node
|
|
41701
|
-
* Thing to check, typically `Node`.
|
|
41702
|
-
* @param test
|
|
41703
|
-
* A check for a specific node.
|
|
41704
|
-
* @param index
|
|
41705
|
-
* The node’s position in its parent.
|
|
41706
|
-
* @param parent
|
|
41707
|
-
* The node’s parent.
|
|
41708
|
-
* @returns
|
|
41709
|
-
* Whether `node` is a node and passes a test.
|
|
41710
|
-
*/
|
|
41711
|
-
const lib_is =
|
|
41712
|
-
/**
|
|
41713
|
-
* @type {(
|
|
41714
|
-
* (() => false) &
|
|
41715
|
-
* (<Kind extends Node = Node>(node: unknown, test: PredicateTest<Kind>, index: number, parent: Parent, context?: unknown) => node is Kind) &
|
|
41716
|
-
* (<Kind extends Node = Node>(node: unknown, test: PredicateTest<Kind>, index?: null | undefined, parent?: null | undefined, context?: unknown) => node is Kind) &
|
|
41717
|
-
* ((node: unknown, test: Test, index: number, parent: Parent, context?: unknown) => boolean) &
|
|
41718
|
-
* ((node: unknown, test?: Test, index?: null | undefined, parent?: null | undefined, context?: unknown) => boolean)
|
|
41719
|
-
* )}
|
|
41720
|
-
*/
|
|
41721
|
-
(
|
|
41722
|
-
/**
|
|
41723
|
-
* @param {unknown} [node]
|
|
41724
|
-
* @param {Test} [test]
|
|
41725
|
-
* @param {number | null | undefined} [index]
|
|
41726
|
-
* @param {Parent | null | undefined} [parent]
|
|
41727
|
-
* @param {unknown} [context]
|
|
41728
|
-
* @returns {boolean}
|
|
41729
|
-
*/
|
|
41730
|
-
// eslint-disable-next-line max-params
|
|
41731
|
-
function is(node, test, index, parent, context) {
|
|
41732
|
-
const check = lib_convert(test)
|
|
41733
|
-
|
|
41734
|
-
if (
|
|
41735
|
-
index !== undefined &&
|
|
41736
|
-
index !== null &&
|
|
41737
|
-
(typeof index !== 'number' ||
|
|
41738
|
-
index < 0 ||
|
|
41739
|
-
index === Number.POSITIVE_INFINITY)
|
|
41740
|
-
) {
|
|
41741
|
-
throw new Error('Expected positive finite index')
|
|
41742
|
-
}
|
|
41743
|
-
|
|
41744
|
-
if (
|
|
41745
|
-
parent !== undefined &&
|
|
41746
|
-
parent !== null &&
|
|
41747
|
-
(!is(parent) || !parent.children)
|
|
41748
|
-
) {
|
|
41749
|
-
throw new Error('Expected parent node')
|
|
41750
|
-
}
|
|
41751
|
-
|
|
41752
|
-
if (
|
|
41753
|
-
(parent === undefined || parent === null) !==
|
|
41754
|
-
(index === undefined || index === null)
|
|
41755
|
-
) {
|
|
41756
|
-
throw new Error('Expected both parent and index')
|
|
41757
|
-
}
|
|
41758
|
-
|
|
41759
|
-
// @ts-expect-error Looks like a node.
|
|
41760
|
-
return node && node.type && typeof node.type === 'string'
|
|
41761
|
-
? Boolean(check.call(context, node, index, parent))
|
|
41762
|
-
: false
|
|
41763
|
-
}
|
|
41764
|
-
)
|
|
41765
|
-
|
|
41766
|
-
/**
|
|
41767
|
-
* Generate an assertion from a test.
|
|
41768
|
-
*
|
|
41769
|
-
* Useful if you’re going to test many nodes, for example when creating a
|
|
41770
|
-
* utility where something else passes a compatible test.
|
|
41771
|
-
*
|
|
41772
|
-
* The created function is a bit faster because it expects valid input only:
|
|
41773
|
-
* a `node`, `index`, and `parent`.
|
|
41774
|
-
*
|
|
41775
|
-
* @param test
|
|
41776
|
-
* * when nullish, checks if `node` is a `Node`.
|
|
41777
|
-
* * when `string`, works like passing `(node) => node.type === test`.
|
|
41778
|
-
* * when `function` checks if function passed the node is true.
|
|
41779
|
-
* * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
41780
|
-
* * when `array`, checks if any one of the subtests pass.
|
|
41781
|
-
* @returns
|
|
41782
|
-
* An assertion.
|
|
41783
|
-
*/
|
|
41784
|
-
const lib_convert =
|
|
41785
|
-
/**
|
|
41786
|
-
* @type {(
|
|
41787
|
-
* (<Kind extends Node>(test: PredicateTest<Kind>) => AssertPredicate<Kind>) &
|
|
41788
|
-
* ((test?: Test) => AssertAnything)
|
|
41789
|
-
* )}
|
|
41790
|
-
*/
|
|
41791
|
-
(
|
|
41792
|
-
/**
|
|
41793
|
-
* @param {Test} [test]
|
|
41794
|
-
* @returns {AssertAnything}
|
|
41795
|
-
*/
|
|
41796
|
-
function (test) {
|
|
41797
|
-
if (test === undefined || test === null) {
|
|
41798
|
-
return unist_util_is_lib_ok
|
|
41799
|
-
}
|
|
41800
|
-
|
|
41801
|
-
if (typeof test === 'string') {
|
|
41802
|
-
return lib_typeFactory(test)
|
|
41803
|
-
}
|
|
41804
|
-
|
|
41805
|
-
if (typeof test === 'object') {
|
|
41806
|
-
return Array.isArray(test) ? lib_anyFactory(test) : lib_propsFactory(test)
|
|
41807
|
-
}
|
|
41808
|
-
|
|
41809
|
-
if (typeof test === 'function') {
|
|
41810
|
-
return lib_castFactory(test)
|
|
41811
|
-
}
|
|
41812
|
-
|
|
41813
|
-
throw new Error('Expected function, string, or object as test')
|
|
41814
|
-
}
|
|
41815
|
-
)
|
|
41816
|
-
|
|
41817
|
-
/**
|
|
41818
|
-
* @param {Array<string | Props | TestFunctionAnything>} tests
|
|
41819
|
-
* @returns {AssertAnything}
|
|
41820
|
-
*/
|
|
41821
|
-
function lib_anyFactory(tests) {
|
|
41822
|
-
/** @type {Array<AssertAnything>} */
|
|
41823
|
-
const checks = []
|
|
41824
|
-
let index = -1
|
|
41825
|
-
|
|
41826
|
-
while (++index < tests.length) {
|
|
41827
|
-
checks[index] = lib_convert(tests[index])
|
|
41828
|
-
}
|
|
41829
|
-
|
|
41830
|
-
return lib_castFactory(any)
|
|
41831
|
-
|
|
41832
|
-
/**
|
|
41833
|
-
* @this {unknown}
|
|
41834
|
-
* @param {Array<unknown>} parameters
|
|
41835
|
-
* @returns {boolean}
|
|
41836
|
-
*/
|
|
41837
|
-
function any(...parameters) {
|
|
41838
|
-
let index = -1
|
|
41839
|
-
|
|
41840
|
-
while (++index < checks.length) {
|
|
41841
|
-
if (checks[index].call(this, ...parameters)) return true
|
|
41842
|
-
}
|
|
41843
|
-
|
|
41844
|
-
return false
|
|
41845
|
-
}
|
|
41846
|
-
}
|
|
41847
|
-
|
|
41848
|
-
/**
|
|
41849
|
-
* Turn an object into a test for a node with a certain fields.
|
|
41850
|
-
*
|
|
41851
|
-
* @param {Props} check
|
|
41852
|
-
* @returns {AssertAnything}
|
|
41853
|
-
*/
|
|
41854
|
-
function lib_propsFactory(check) {
|
|
41855
|
-
return lib_castFactory(all)
|
|
41856
|
-
|
|
41857
|
-
/**
|
|
41858
|
-
* @param {Node} node
|
|
41859
|
-
* @returns {boolean}
|
|
41860
|
-
*/
|
|
41861
|
-
function all(node) {
|
|
41862
|
-
/** @type {string} */
|
|
41863
|
-
let key
|
|
41864
|
-
|
|
41865
|
-
for (key in check) {
|
|
41866
|
-
// @ts-expect-error: hush, it sure works as an index.
|
|
41867
|
-
if (node[key] !== check[key]) return false
|
|
41868
|
-
}
|
|
41869
|
-
|
|
41870
|
-
return true
|
|
41871
|
-
}
|
|
41872
|
-
}
|
|
41873
|
-
|
|
41874
|
-
/**
|
|
41875
|
-
* Turn a string into a test for a node with a certain type.
|
|
41876
|
-
*
|
|
41877
|
-
* @param {string} check
|
|
41878
|
-
* @returns {AssertAnything}
|
|
41879
|
-
*/
|
|
41880
|
-
function lib_typeFactory(check) {
|
|
41881
|
-
return lib_castFactory(type)
|
|
41882
|
-
|
|
41883
|
-
/**
|
|
41884
|
-
* @param {Node} node
|
|
41885
|
-
*/
|
|
41886
|
-
function type(node) {
|
|
41887
|
-
return node && node.type === check
|
|
41888
|
-
}
|
|
41889
|
-
}
|
|
41890
|
-
|
|
41891
|
-
/**
|
|
41892
|
-
* Turn a custom test into a test for a node that passes that test.
|
|
41893
|
-
*
|
|
41894
|
-
* @param {TestFunctionAnything} check
|
|
41895
|
-
* @returns {AssertAnything}
|
|
41896
|
-
*/
|
|
41897
|
-
function lib_castFactory(check) {
|
|
41898
|
-
return assertion
|
|
41899
|
-
|
|
41900
|
-
/**
|
|
41901
|
-
* @this {unknown}
|
|
41902
|
-
* @param {unknown} node
|
|
41903
|
-
* @param {Array<unknown>} parameters
|
|
41904
|
-
* @returns {boolean}
|
|
41905
|
-
*/
|
|
41906
|
-
function assertion(node, ...parameters) {
|
|
41907
|
-
return Boolean(
|
|
41908
|
-
node &&
|
|
41909
|
-
typeof node === 'object' &&
|
|
41910
|
-
'type' in node &&
|
|
41911
|
-
// @ts-expect-error: fine.
|
|
41912
|
-
Boolean(check.call(this, node, ...parameters))
|
|
41913
|
-
)
|
|
41914
|
-
}
|
|
41915
|
-
}
|
|
41916
|
-
|
|
41917
|
-
function unist_util_is_lib_ok() {
|
|
41918
|
-
return true
|
|
41919
|
-
}
|
|
41920
|
-
|
|
41921
|
-
;// CONCATENATED MODULE: ../node_modules/rehype-prism-plus/node_modules/unist-util-visit-parents/lib/color.browser.js
|
|
41922
|
-
/**
|
|
41923
|
-
* @param {string} d
|
|
41924
|
-
* @returns {string}
|
|
41925
|
-
*/
|
|
41926
|
-
function color_browser_color(d) {
|
|
41927
|
-
return d
|
|
41928
|
-
}
|
|
41929
|
-
|
|
41930
|
-
;// CONCATENATED MODULE: ../node_modules/rehype-prism-plus/node_modules/unist-util-visit-parents/lib/index.js
|
|
41931
|
-
/**
|
|
41932
|
-
* @typedef {import('unist').Node} Node
|
|
41933
|
-
* @typedef {import('unist').Parent} Parent
|
|
41934
|
-
* @typedef {import('unist-util-is').Test} Test
|
|
41935
|
-
*/
|
|
41936
|
-
|
|
41937
|
-
/**
|
|
41938
|
-
* @typedef {boolean | 'skip'} Action
|
|
41939
|
-
* Union of the action types.
|
|
41940
|
-
*
|
|
41941
|
-
* @typedef {number} Index
|
|
41942
|
-
* Move to the sibling at `index` next (after node itself is completely
|
|
41943
|
-
* traversed).
|
|
41944
|
-
*
|
|
41945
|
-
* Useful if mutating the tree, such as removing the node the visitor is
|
|
41946
|
-
* currently on, or any of its previous siblings.
|
|
41947
|
-
* Results less than 0 or greater than or equal to `children.length` stop
|
|
41948
|
-
* traversing the parent.
|
|
41949
|
-
*
|
|
41950
|
-
* @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple
|
|
41951
|
-
* List with one or two values, the first an action, the second an index.
|
|
41952
|
-
*
|
|
41953
|
-
* @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult
|
|
41954
|
-
* Any value that can be returned from a visitor.
|
|
41955
|
-
*/
|
|
41956
|
-
|
|
41957
|
-
/**
|
|
41958
|
-
* @template {Node} [Visited=Node]
|
|
41959
|
-
* Visited node type.
|
|
41960
|
-
* @template {Parent} [Ancestor=Parent]
|
|
41961
|
-
* Ancestor type.
|
|
41962
|
-
* @callback Visitor
|
|
41963
|
-
* Handle a node (matching `test`, if given).
|
|
41964
|
-
*
|
|
41965
|
-
* Visitors are free to transform `node`.
|
|
41966
|
-
* They can also transform the parent of node (the last of `ancestors`).
|
|
41967
|
-
*
|
|
41968
|
-
* Replacing `node` itself, if `SKIP` is not returned, still causes its
|
|
41969
|
-
* descendants to be walked (which is a bug).
|
|
41970
|
-
*
|
|
41971
|
-
* When adding or removing previous siblings of `node` (or next siblings, in
|
|
41972
|
-
* case of reverse), the `Visitor` should return a new `Index` to specify the
|
|
41973
|
-
* sibling to traverse after `node` is traversed.
|
|
41974
|
-
* Adding or removing next siblings of `node` (or previous siblings, in case
|
|
41975
|
-
* of reverse) is handled as expected without needing to return a new `Index`.
|
|
41976
|
-
*
|
|
41977
|
-
* Removing the children property of an ancestor still results in them being
|
|
41978
|
-
* traversed.
|
|
41979
|
-
* @param {Visited} node
|
|
41980
|
-
* Found node.
|
|
41981
|
-
* @param {Array<Ancestor>} ancestors
|
|
41982
|
-
* Ancestors of `node`.
|
|
41983
|
-
* @returns {VisitorResult}
|
|
41984
|
-
* What to do next.
|
|
41985
|
-
*
|
|
41986
|
-
* An `Index` is treated as a tuple of `[CONTINUE, Index]`.
|
|
41987
|
-
* An `Action` is treated as a tuple of `[Action]`.
|
|
41988
|
-
*
|
|
41989
|
-
* Passing a tuple back only makes sense if the `Action` is `SKIP`.
|
|
41990
|
-
* When the `Action` is `EXIT`, that action can be returned.
|
|
41991
|
-
* When the `Action` is `CONTINUE`, `Index` can be returned.
|
|
41992
|
-
*/
|
|
41993
|
-
|
|
41994
|
-
/**
|
|
41995
|
-
* @template {Node} [Tree=Node]
|
|
41996
|
-
* Tree type.
|
|
41997
|
-
* @template {Test} [Check=string]
|
|
41998
|
-
* Test type.
|
|
41999
|
-
* @typedef {Visitor<import('./complex-types.js').Matches<import('./complex-types.js').InclusiveDescendant<Tree>, Check>, Extract<import('./complex-types.js').InclusiveDescendant<Tree>, Parent>>} BuildVisitor
|
|
42000
|
-
* Build a typed `Visitor` function from a tree and a test.
|
|
42001
|
-
*
|
|
42002
|
-
* It will infer which values are passed as `node` and which as `parents`.
|
|
42003
|
-
*/
|
|
42004
|
-
|
|
42005
|
-
|
|
42006
|
-
|
|
42007
|
-
|
|
42008
|
-
/**
|
|
42009
|
-
* Continue traversing as normal.
|
|
42010
|
-
*/
|
|
42011
|
-
const lib_CONTINUE = true
|
|
42012
|
-
|
|
42013
|
-
/**
|
|
42014
|
-
* Stop traversing immediately.
|
|
42015
|
-
*/
|
|
42016
|
-
const lib_EXIT = false
|
|
42017
|
-
|
|
42018
|
-
/**
|
|
42019
|
-
* Do not traverse this node’s children.
|
|
42020
|
-
*/
|
|
42021
|
-
const lib_SKIP = 'skip'
|
|
42022
|
-
|
|
42023
|
-
/**
|
|
42024
|
-
* Visit nodes, with ancestral information.
|
|
42025
|
-
*
|
|
42026
|
-
* This algorithm performs *depth-first* *tree traversal* in *preorder*
|
|
42027
|
-
* (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).
|
|
42028
|
-
*
|
|
42029
|
-
* You can choose for which nodes `visitor` is called by passing a `test`.
|
|
42030
|
-
* For complex tests, you should test yourself in `visitor`, as it will be
|
|
42031
|
-
* faster and will have improved type information.
|
|
42032
|
-
*
|
|
42033
|
-
* Walking the tree is an intensive task.
|
|
42034
|
-
* Make use of the return values of the visitor when possible.
|
|
42035
|
-
* Instead of walking a tree multiple times, walk it once, use `unist-util-is`
|
|
42036
|
-
* to check if a node matches, and then perform different operations.
|
|
42037
|
-
*
|
|
42038
|
-
* You can change the tree.
|
|
42039
|
-
* See `Visitor` for more info.
|
|
42040
|
-
*
|
|
42041
|
-
* @param tree
|
|
42042
|
-
* Tree to traverse.
|
|
42043
|
-
* @param test
|
|
42044
|
-
* `unist-util-is`-compatible test
|
|
42045
|
-
* @param visitor
|
|
42046
|
-
* Handle each node.
|
|
42047
|
-
* @param reverse
|
|
42048
|
-
* Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
|
|
42049
|
-
* @returns
|
|
42050
|
-
* Nothing.
|
|
42051
|
-
*/
|
|
42052
|
-
const lib_visitParents =
|
|
42053
|
-
/**
|
|
42054
|
-
* @type {(
|
|
42055
|
-
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) &
|
|
42056
|
-
* (<Tree extends Node>(tree: Tree, visitor: BuildVisitor<Tree>, reverse?: boolean | null | undefined) => void)
|
|
42057
|
-
* )}
|
|
42058
|
-
*/
|
|
42059
|
-
(
|
|
42060
|
-
/**
|
|
42061
|
-
* @param {Node} tree
|
|
42062
|
-
* @param {Test} test
|
|
42063
|
-
* @param {Visitor<Node>} visitor
|
|
42064
|
-
* @param {boolean | null | undefined} [reverse]
|
|
42065
|
-
* @returns {void}
|
|
42066
|
-
*/
|
|
42067
|
-
function (tree, test, visitor, reverse) {
|
|
42068
|
-
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
42069
|
-
reverse = visitor
|
|
42070
|
-
// @ts-expect-error no visitor given, so `visitor` is test.
|
|
42071
|
-
visitor = test
|
|
42072
|
-
test = null
|
|
42073
|
-
}
|
|
42074
|
-
|
|
42075
|
-
const is = lib_convert(test)
|
|
42076
|
-
const step = reverse ? -1 : 1
|
|
42077
|
-
|
|
42078
|
-
factory(tree, undefined, [])()
|
|
42079
|
-
|
|
42080
|
-
/**
|
|
42081
|
-
* @param {Node} node
|
|
42082
|
-
* @param {number | undefined} index
|
|
42083
|
-
* @param {Array<Parent>} parents
|
|
42084
|
-
*/
|
|
42085
|
-
function factory(node, index, parents) {
|
|
42086
|
-
/** @type {Record<string, unknown>} */
|
|
42087
|
-
// @ts-expect-error: hush
|
|
42088
|
-
const value = node && typeof node === 'object' ? node : {}
|
|
42089
|
-
|
|
42090
|
-
if (typeof value.type === 'string') {
|
|
42091
|
-
const name =
|
|
42092
|
-
// `hast`
|
|
42093
|
-
typeof value.tagName === 'string'
|
|
42094
|
-
? value.tagName
|
|
42095
|
-
: // `xast`
|
|
42096
|
-
typeof value.name === 'string'
|
|
42097
|
-
? value.name
|
|
42098
|
-
: undefined
|
|
42099
|
-
|
|
42100
|
-
Object.defineProperty(visit, 'name', {
|
|
42101
|
-
value:
|
|
42102
|
-
'node (' + color_browser_color(node.type + (name ? '<' + name + '>' : '')) + ')'
|
|
42103
|
-
})
|
|
42104
|
-
}
|
|
42105
|
-
|
|
42106
|
-
return visit
|
|
42107
|
-
|
|
42108
|
-
function visit() {
|
|
42109
|
-
/** @type {ActionTuple} */
|
|
42110
|
-
let result = []
|
|
42111
|
-
/** @type {ActionTuple} */
|
|
42112
|
-
let subresult
|
|
42113
|
-
/** @type {number} */
|
|
42114
|
-
let offset
|
|
42115
|
-
/** @type {Array<Parent>} */
|
|
42116
|
-
let grandparents
|
|
42117
|
-
|
|
42118
|
-
if (!test || is(node, index, parents[parents.length - 1] || null)) {
|
|
42119
|
-
result = lib_toResult(visitor(node, parents))
|
|
42120
|
-
|
|
42121
|
-
if (result[0] === lib_EXIT) {
|
|
42122
|
-
return result
|
|
42123
|
-
}
|
|
42124
|
-
}
|
|
42125
|
-
|
|
42126
|
-
// @ts-expect-error looks like a parent.
|
|
42127
|
-
if (node.children && result[0] !== lib_SKIP) {
|
|
42128
|
-
// @ts-expect-error looks like a parent.
|
|
42129
|
-
offset = (reverse ? node.children.length : -1) + step
|
|
42130
|
-
// @ts-expect-error looks like a parent.
|
|
42131
|
-
grandparents = parents.concat(node)
|
|
42132
|
-
|
|
42133
|
-
// @ts-expect-error looks like a parent.
|
|
42134
|
-
while (offset > -1 && offset < node.children.length) {
|
|
42135
|
-
// @ts-expect-error looks like a parent.
|
|
42136
|
-
subresult = factory(node.children[offset], offset, grandparents)()
|
|
42137
|
-
|
|
42138
|
-
if (subresult[0] === lib_EXIT) {
|
|
42139
|
-
return subresult
|
|
42140
|
-
}
|
|
42141
|
-
|
|
42142
|
-
offset =
|
|
42143
|
-
typeof subresult[1] === 'number' ? subresult[1] : offset + step
|
|
42144
|
-
}
|
|
42145
|
-
}
|
|
42146
|
-
|
|
42147
|
-
return result
|
|
42148
|
-
}
|
|
42149
|
-
}
|
|
42150
|
-
}
|
|
42151
|
-
)
|
|
42152
|
-
|
|
42153
|
-
/**
|
|
42154
|
-
* Turn a return value into a clean result.
|
|
42155
|
-
*
|
|
42156
|
-
* @param {VisitorResult} value
|
|
42157
|
-
* Valid return values from visitors.
|
|
42158
|
-
* @returns {ActionTuple}
|
|
42159
|
-
* Clean result.
|
|
42160
|
-
*/
|
|
42161
|
-
function lib_toResult(value) {
|
|
42162
|
-
if (Array.isArray(value)) {
|
|
42163
|
-
return value
|
|
42164
|
-
}
|
|
42165
|
-
|
|
42166
|
-
if (typeof value === 'number') {
|
|
42167
|
-
return [lib_CONTINUE, value]
|
|
42168
|
-
}
|
|
42169
|
-
|
|
42170
|
-
return [value]
|
|
42171
|
-
}
|
|
42172
|
-
|
|
42173
|
-
;// CONCATENATED MODULE: ../node_modules/rehype-prism-plus/node_modules/unist-util-visit/lib/index.js
|
|
42174
|
-
/**
|
|
42175
|
-
* @typedef {import('unist').Node} Node
|
|
42176
|
-
* @typedef {import('unist').Parent} Parent
|
|
42177
|
-
* @typedef {import('unist-util-is').Test} Test
|
|
42178
|
-
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
|
|
42179
|
-
*/
|
|
42180
|
-
|
|
42181
|
-
/**
|
|
42182
|
-
* Check if `Child` can be a child of `Ancestor`.
|
|
42183
|
-
*
|
|
42184
|
-
* Returns the ancestor when `Child` can be a child of `Ancestor`, or returns
|
|
42185
|
-
* `never`.
|
|
42186
|
-
*
|
|
42187
|
-
* @template {Node} Ancestor
|
|
42188
|
-
* Node type.
|
|
42189
|
-
* @template {Node} Child
|
|
42190
|
-
* Node type.
|
|
42191
|
-
* @typedef {(
|
|
42192
|
-
* Ancestor extends Parent
|
|
42193
|
-
* ? Child extends Ancestor['children'][number]
|
|
42194
|
-
* ? Ancestor
|
|
42195
|
-
* : never
|
|
42196
|
-
* : never
|
|
42197
|
-
* )} ParentsOf
|
|
42198
|
-
*/
|
|
42199
|
-
|
|
42200
|
-
/**
|
|
42201
|
-
* @template {Node} [Visited=Node]
|
|
42202
|
-
* Visited node type.
|
|
42203
|
-
* @template {Parent} [Ancestor=Parent]
|
|
42204
|
-
* Ancestor type.
|
|
42205
|
-
* @callback Visitor
|
|
42206
|
-
* Handle a node (matching `test`, if given).
|
|
42207
|
-
*
|
|
42208
|
-
* Visitors are free to transform `node`.
|
|
42209
|
-
* They can also transform `parent`.
|
|
42210
|
-
*
|
|
42211
|
-
* Replacing `node` itself, if `SKIP` is not returned, still causes its
|
|
42212
|
-
* descendants to be walked (which is a bug).
|
|
42213
|
-
*
|
|
42214
|
-
* When adding or removing previous siblings of `node` (or next siblings, in
|
|
42215
|
-
* case of reverse), the `Visitor` should return a new `Index` to specify the
|
|
42216
|
-
* sibling to traverse after `node` is traversed.
|
|
42217
|
-
* Adding or removing next siblings of `node` (or previous siblings, in case
|
|
42218
|
-
* of reverse) is handled as expected without needing to return a new `Index`.
|
|
42219
|
-
*
|
|
42220
|
-
* Removing the children property of `parent` still results in them being
|
|
42221
|
-
* traversed.
|
|
42222
|
-
* @param {Visited} node
|
|
42223
|
-
* Found node.
|
|
42224
|
-
* @param {Visited extends Node ? number | null : never} index
|
|
42225
|
-
* Index of `node` in `parent`.
|
|
42226
|
-
* @param {Ancestor extends Node ? Ancestor | null : never} parent
|
|
42227
|
-
* Parent of `node`.
|
|
42228
|
-
* @returns {VisitorResult}
|
|
42229
|
-
* What to do next.
|
|
42230
|
-
*
|
|
42231
|
-
* An `Index` is treated as a tuple of `[CONTINUE, Index]`.
|
|
42232
|
-
* An `Action` is treated as a tuple of `[Action]`.
|
|
42233
|
-
*
|
|
42234
|
-
* Passing a tuple back only makes sense if the `Action` is `SKIP`.
|
|
42235
|
-
* When the `Action` is `EXIT`, that action can be returned.
|
|
42236
|
-
* When the `Action` is `CONTINUE`, `Index` can be returned.
|
|
42237
|
-
*/
|
|
42238
|
-
|
|
42239
|
-
/**
|
|
42240
|
-
* Build a typed `Visitor` function from a node and all possible parents.
|
|
42241
|
-
*
|
|
42242
|
-
* It will infer which values are passed as `node` and which as `parent`.
|
|
42243
|
-
*
|
|
42244
|
-
* @template {Node} Visited
|
|
42245
|
-
* Node type.
|
|
42246
|
-
* @template {Parent} Ancestor
|
|
42247
|
-
* Parent type.
|
|
42248
|
-
* @typedef {Visitor<Visited, ParentsOf<Ancestor, Visited>>} BuildVisitorFromMatch
|
|
42249
|
-
*/
|
|
42250
|
-
|
|
42251
|
-
/**
|
|
42252
|
-
* Build a typed `Visitor` function from a list of descendants and a test.
|
|
42253
|
-
*
|
|
42254
|
-
* It will infer which values are passed as `node` and which as `parent`.
|
|
42255
|
-
*
|
|
42256
|
-
* @template {Node} Descendant
|
|
42257
|
-
* Node type.
|
|
42258
|
-
* @template {Test} Check
|
|
42259
|
-
* Test type.
|
|
42260
|
-
* @typedef {(
|
|
42261
|
-
* BuildVisitorFromMatch<
|
|
42262
|
-
* import('unist-util-visit-parents/complex-types.js').Matches<Descendant, Check>,
|
|
42263
|
-
* Extract<Descendant, Parent>
|
|
42264
|
-
* >
|
|
42265
|
-
* )} BuildVisitorFromDescendants
|
|
42266
|
-
*/
|
|
42267
|
-
|
|
42268
|
-
/**
|
|
42269
|
-
* Build a typed `Visitor` function from a tree and a test.
|
|
42270
|
-
*
|
|
42271
|
-
* It will infer which values are passed as `node` and which as `parent`.
|
|
42272
|
-
*
|
|
42273
|
-
* @template {Node} [Tree=Node]
|
|
42274
|
-
* Node type.
|
|
42275
|
-
* @template {Test} [Check=string]
|
|
42276
|
-
* Test type.
|
|
42277
|
-
* @typedef {(
|
|
42278
|
-
* BuildVisitorFromDescendants<
|
|
42279
|
-
* import('unist-util-visit-parents/complex-types.js').InclusiveDescendant<Tree>,
|
|
42280
|
-
* Check
|
|
42281
|
-
* >
|
|
42282
|
-
* )} BuildVisitor
|
|
42283
|
-
*/
|
|
42284
|
-
|
|
42285
|
-
|
|
42286
|
-
|
|
42287
|
-
/**
|
|
42288
|
-
* Visit nodes.
|
|
42289
|
-
*
|
|
42290
|
-
* This algorithm performs *depth-first* *tree traversal* in *preorder*
|
|
42291
|
-
* (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).
|
|
42292
|
-
*
|
|
42293
|
-
* You can choose for which nodes `visitor` is called by passing a `test`.
|
|
42294
|
-
* For complex tests, you should test yourself in `visitor`, as it will be
|
|
42295
|
-
* faster and will have improved type information.
|
|
42296
|
-
*
|
|
42297
|
-
* Walking the tree is an intensive task.
|
|
42298
|
-
* Make use of the return values of the visitor when possible.
|
|
42299
|
-
* Instead of walking a tree multiple times, walk it once, use `unist-util-is`
|
|
42300
|
-
* to check if a node matches, and then perform different operations.
|
|
42301
|
-
*
|
|
42302
|
-
* You can change the tree.
|
|
42303
|
-
* See `Visitor` for more info.
|
|
42304
|
-
*
|
|
42305
|
-
* @param tree
|
|
42306
|
-
* Tree to traverse.
|
|
42307
|
-
* @param test
|
|
42308
|
-
* `unist-util-is`-compatible test
|
|
42309
|
-
* @param visitor
|
|
42310
|
-
* Handle each node.
|
|
42311
|
-
* @param reverse
|
|
42312
|
-
* Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
|
|
42313
|
-
* @returns
|
|
42314
|
-
* Nothing.
|
|
42315
|
-
*/
|
|
42316
|
-
const lib_visit =
|
|
42317
|
-
/**
|
|
42318
|
-
* @type {(
|
|
42319
|
-
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) &
|
|
42320
|
-
* (<Tree extends Node>(tree: Tree, visitor: BuildVisitor<Tree>, reverse?: boolean | null | undefined) => void)
|
|
42321
|
-
* )}
|
|
42322
|
-
*/
|
|
42323
|
-
(
|
|
42324
|
-
/**
|
|
42325
|
-
* @param {Node} tree
|
|
42326
|
-
* @param {Test} test
|
|
42327
|
-
* @param {Visitor} visitor
|
|
42328
|
-
* @param {boolean | null | undefined} [reverse]
|
|
42329
|
-
* @returns {void}
|
|
42330
|
-
*/
|
|
42331
|
-
function (tree, test, visitor, reverse) {
|
|
42332
|
-
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
42333
|
-
reverse = visitor
|
|
42334
|
-
visitor = test
|
|
42335
|
-
test = null
|
|
42336
|
-
}
|
|
42337
|
-
|
|
42338
|
-
lib_visitParents(tree, test, overload, reverse)
|
|
42339
|
-
|
|
42340
|
-
/**
|
|
42341
|
-
* @param {Node} node
|
|
42342
|
-
* @param {Array<Parent>} parents
|
|
42343
|
-
*/
|
|
42344
|
-
function overload(node, parents) {
|
|
42345
|
-
const parent = parents[parents.length - 1]
|
|
42346
|
-
return visitor(
|
|
42347
|
-
node,
|
|
42348
|
-
parent ? parent.children.indexOf(node) : null,
|
|
42349
|
-
parent
|
|
42350
|
-
)
|
|
42351
|
-
}
|
|
42352
|
-
}
|
|
42353
|
-
)
|
|
42354
|
-
|
|
42355
|
-
|
|
42356
|
-
|
|
42357
|
-
;// CONCATENATED MODULE: ../node_modules/rehype-prism-plus/node_modules/hast-util-to-string/index.js
|
|
42358
|
-
/**
|
|
42359
|
-
* @fileoverview
|
|
42360
|
-
* Get the plain-text value of a hast node.
|
|
42361
|
-
* @longdescription
|
|
42362
|
-
* ## Use
|
|
42363
|
-
*
|
|
42364
|
-
* ```js
|
|
42365
|
-
* import {h} from 'hastscript'
|
|
42366
|
-
* import {toString} from 'hast-util-to-string'
|
|
42367
|
-
*
|
|
42368
|
-
* toString(h('p', 'Alpha'))
|
|
42369
|
-
* //=> 'Alpha'
|
|
42370
|
-
* toString(h('div', [h('b', 'Bold'), ' and ', h('i', 'italic'), '.']))
|
|
42371
|
-
* //=> 'Bold and italic.'
|
|
42372
|
-
* ```
|
|
42373
|
-
*
|
|
42374
|
-
* ## API
|
|
42375
|
-
*
|
|
42376
|
-
* ### `toString(node)`
|
|
42377
|
-
*
|
|
42378
|
-
* Transform a node to a string.
|
|
42379
|
-
*/
|
|
42380
|
-
|
|
42381
|
-
/**
|
|
42382
|
-
* @typedef {import('hast').Root} Root
|
|
42383
|
-
* @typedef {import('hast').Element} Element
|
|
42384
|
-
* @typedef {Root|Root['children'][number]} Node
|
|
42385
|
-
*/
|
|
42386
|
-
|
|
42387
|
-
/**
|
|
42388
|
-
* Get the plain-text value of a hast node.
|
|
42389
|
-
*
|
|
42390
|
-
* @param {Node} node
|
|
42391
|
-
* @returns {string}
|
|
42392
|
-
*/
|
|
42393
|
-
function hast_util_to_string_toString(node) {
|
|
42394
|
-
// “The concatenation of data of all the Text node descendants of the context
|
|
42395
|
-
// object, in tree order.”
|
|
42396
|
-
if ('children' in node) {
|
|
42397
|
-
return hast_util_to_string_all(node)
|
|
42398
|
-
}
|
|
42399
|
-
|
|
42400
|
-
// “Context object’s data.”
|
|
42401
|
-
return 'value' in node ? node.value : ''
|
|
42402
|
-
}
|
|
42403
|
-
|
|
42404
|
-
/**
|
|
42405
|
-
* @param {Node} node
|
|
42406
|
-
* @returns {string}
|
|
42407
|
-
*/
|
|
42408
|
-
function hast_util_to_string_one(node) {
|
|
42409
|
-
if (node.type === 'text') {
|
|
42410
|
-
return node.value
|
|
42411
|
-
}
|
|
42412
|
-
|
|
42413
|
-
return 'children' in node ? hast_util_to_string_all(node) : ''
|
|
42414
|
-
}
|
|
42415
|
-
|
|
42416
|
-
/**
|
|
42417
|
-
* @param {Root|Element} node
|
|
42418
|
-
* @returns {string}
|
|
42419
|
-
*/
|
|
42420
|
-
function hast_util_to_string_all(node) {
|
|
42421
|
-
let index = -1
|
|
42422
|
-
/** @type {string[]} */
|
|
42423
|
-
const result = []
|
|
42424
|
-
|
|
42425
|
-
while (++index < node.children.length) {
|
|
42426
|
-
result[index] = hast_util_to_string_one(node.children[index])
|
|
42427
|
-
}
|
|
42428
|
-
|
|
42429
|
-
return result.join('')
|
|
42430
|
-
}
|
|
42431
|
-
|
|
42432
|
-
;// CONCATENATED MODULE: ../node_modules/unist-util-filter/node_modules/unist-util-is/lib/index.js
|
|
42433
|
-
/**
|
|
42434
|
-
* @typedef {import('unist').Node} Node
|
|
42435
|
-
* @typedef {import('unist').Parent} Parent
|
|
42436
|
-
*/
|
|
42437
|
-
|
|
42438
|
-
/**
|
|
42439
|
-
* @typedef {Record<string, unknown>} Props
|
|
42440
|
-
* @typedef {null | undefined | string | Props | TestFunctionAnything | Array<string | Props | TestFunctionAnything>} Test
|
|
42441
|
-
* Check for an arbitrary node, unaware of TypeScript inferral.
|
|
42442
|
-
*
|
|
42443
|
-
* @callback TestFunctionAnything
|
|
42444
|
-
* Check if a node passes a test, unaware of TypeScript inferral.
|
|
42445
|
-
* @param {unknown} this
|
|
42446
|
-
* The given context.
|
|
42447
|
-
* @param {Node} node
|
|
42448
|
-
* A node.
|
|
42449
|
-
* @param {number | null | undefined} [index]
|
|
42450
|
-
* The node’s position in its parent.
|
|
42451
|
-
* @param {Parent | null | undefined} [parent]
|
|
42452
|
-
* The node’s parent.
|
|
42453
|
-
* @returns {boolean | void}
|
|
42454
|
-
* Whether this node passes the test.
|
|
42455
|
-
*/
|
|
42456
|
-
|
|
42457
|
-
/**
|
|
42458
|
-
* @template {Node} Kind
|
|
42459
|
-
* Node type.
|
|
42460
|
-
* @typedef {Kind['type'] | Partial<Kind> | TestFunctionPredicate<Kind> | Array<Kind['type'] | Partial<Kind> | TestFunctionPredicate<Kind>>} PredicateTest
|
|
42461
|
-
* Check for a node that can be inferred by TypeScript.
|
|
42462
|
-
*/
|
|
42463
|
-
|
|
42464
|
-
/**
|
|
42465
|
-
* Check if a node passes a certain test.
|
|
42466
|
-
*
|
|
42467
|
-
* @template {Node} Kind
|
|
42468
|
-
* Node type.
|
|
42469
|
-
* @callback TestFunctionPredicate
|
|
42470
|
-
* Complex test function for a node that can be inferred by TypeScript.
|
|
42471
|
-
* @param {Node} node
|
|
42472
|
-
* A node.
|
|
42473
|
-
* @param {number | null | undefined} [index]
|
|
42474
|
-
* The node’s position in its parent.
|
|
42475
|
-
* @param {Parent | null | undefined} [parent]
|
|
42476
|
-
* The node’s parent.
|
|
42477
|
-
* @returns {node is Kind}
|
|
42478
|
-
* Whether this node passes the test.
|
|
42479
|
-
*/
|
|
42480
|
-
|
|
42481
|
-
/**
|
|
42482
|
-
* @callback AssertAnything
|
|
42483
|
-
* Check that an arbitrary value is a node, unaware of TypeScript inferral.
|
|
42484
|
-
* @param {unknown} [node]
|
|
42485
|
-
* Anything (typically a node).
|
|
42486
|
-
* @param {number | null | undefined} [index]
|
|
42487
|
-
* The node’s position in its parent.
|
|
42488
|
-
* @param {Parent | null | undefined} [parent]
|
|
42489
|
-
* The node’s parent.
|
|
42490
|
-
* @returns {boolean}
|
|
42491
|
-
* Whether this is a node and passes a test.
|
|
42492
|
-
*/
|
|
42493
|
-
|
|
42494
|
-
/**
|
|
42495
|
-
* Check if a node is a node and passes a certain node test.
|
|
42496
|
-
*
|
|
42497
|
-
* @template {Node} Kind
|
|
42498
|
-
* Node type.
|
|
42499
|
-
* @callback AssertPredicate
|
|
42500
|
-
* Check that an arbitrary value is a specific node, aware of TypeScript.
|
|
42501
|
-
* @param {unknown} [node]
|
|
42502
|
-
* Anything (typically a node).
|
|
42503
|
-
* @param {number | null | undefined} [index]
|
|
42504
|
-
* The node’s position in its parent.
|
|
42505
|
-
* @param {Parent | null | undefined} [parent]
|
|
42506
|
-
* The node’s parent.
|
|
42507
|
-
* @returns {node is Kind}
|
|
42508
|
-
* Whether this is a node and passes a test.
|
|
42509
|
-
*/
|
|
42510
|
-
|
|
42511
|
-
/**
|
|
42512
|
-
* Check if `node` is a `Node` and whether it passes the given test.
|
|
42513
|
-
*
|
|
42514
|
-
* @param node
|
|
42515
|
-
* Thing to check, typically `Node`.
|
|
42516
|
-
* @param test
|
|
42517
|
-
* A check for a specific node.
|
|
42518
|
-
* @param index
|
|
42519
|
-
* The node’s position in its parent.
|
|
42520
|
-
* @param parent
|
|
42521
|
-
* The node’s parent.
|
|
42522
|
-
* @returns
|
|
42523
|
-
* Whether `node` is a node and passes a test.
|
|
42524
|
-
*/
|
|
42525
|
-
const unist_util_is_lib_is =
|
|
42526
|
-
/**
|
|
42527
|
-
* @type {(
|
|
42528
|
-
* (() => false) &
|
|
42529
|
-
* (<Kind extends Node = Node>(node: unknown, test: PredicateTest<Kind>, index: number, parent: Parent, context?: unknown) => node is Kind) &
|
|
42530
|
-
* (<Kind extends Node = Node>(node: unknown, test: PredicateTest<Kind>, index?: null | undefined, parent?: null | undefined, context?: unknown) => node is Kind) &
|
|
42531
|
-
* ((node: unknown, test: Test, index: number, parent: Parent, context?: unknown) => boolean) &
|
|
42532
|
-
* ((node: unknown, test?: Test, index?: null | undefined, parent?: null | undefined, context?: unknown) => boolean)
|
|
42533
|
-
* )}
|
|
42534
|
-
*/
|
|
42535
|
-
(
|
|
42536
|
-
/**
|
|
42537
|
-
* @param {unknown} [node]
|
|
42538
|
-
* @param {Test} [test]
|
|
42539
|
-
* @param {number | null | undefined} [index]
|
|
42540
|
-
* @param {Parent | null | undefined} [parent]
|
|
42541
|
-
* @param {unknown} [context]
|
|
42542
|
-
* @returns {boolean}
|
|
42543
|
-
*/
|
|
42544
|
-
// eslint-disable-next-line max-params
|
|
42545
|
-
function is(node, test, index, parent, context) {
|
|
42546
|
-
const check = unist_util_is_lib_convert(test)
|
|
42547
|
-
|
|
42548
|
-
if (
|
|
42549
|
-
index !== undefined &&
|
|
42550
|
-
index !== null &&
|
|
42551
|
-
(typeof index !== 'number' ||
|
|
42552
|
-
index < 0 ||
|
|
42553
|
-
index === Number.POSITIVE_INFINITY)
|
|
42554
|
-
) {
|
|
42555
|
-
throw new Error('Expected positive finite index')
|
|
42556
|
-
}
|
|
42557
|
-
|
|
42558
|
-
if (
|
|
42559
|
-
parent !== undefined &&
|
|
42560
|
-
parent !== null &&
|
|
42561
|
-
(!is(parent) || !parent.children)
|
|
42562
|
-
) {
|
|
42563
|
-
throw new Error('Expected parent node')
|
|
42564
|
-
}
|
|
42565
|
-
|
|
42566
|
-
if (
|
|
42567
|
-
(parent === undefined || parent === null) !==
|
|
42568
|
-
(index === undefined || index === null)
|
|
42569
|
-
) {
|
|
42570
|
-
throw new Error('Expected both parent and index')
|
|
42571
|
-
}
|
|
42572
|
-
|
|
42573
|
-
// @ts-expect-error Looks like a node.
|
|
42574
|
-
return node && node.type && typeof node.type === 'string'
|
|
42575
|
-
? Boolean(check.call(context, node, index, parent))
|
|
42576
|
-
: false
|
|
42577
|
-
}
|
|
42578
|
-
)
|
|
42579
|
-
|
|
41618
|
+
;// CONCATENATED MODULE: ../node_modules/hast-util-to-string/lib/index.js
|
|
42580
41619
|
/**
|
|
42581
|
-
*
|
|
42582
|
-
*
|
|
42583
|
-
* Useful if you’re going to test many nodes, for example when creating a
|
|
42584
|
-
* utility where something else passes a compatible test.
|
|
42585
|
-
*
|
|
42586
|
-
* The created function is a bit faster because it expects valid input only:
|
|
42587
|
-
* a `node`, `index`, and `parent`.
|
|
42588
|
-
*
|
|
42589
|
-
* @param test
|
|
42590
|
-
* * when nullish, checks if `node` is a `Node`.
|
|
42591
|
-
* * when `string`, works like passing `(node) => node.type === test`.
|
|
42592
|
-
* * when `function` checks if function passed the node is true.
|
|
42593
|
-
* * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
42594
|
-
* * when `array`, checks if any one of the subtests pass.
|
|
42595
|
-
* @returns
|
|
42596
|
-
* An assertion.
|
|
41620
|
+
* @typedef {import('hast').Nodes} Nodes
|
|
41621
|
+
* @typedef {import('hast').Parents} Parents
|
|
42597
41622
|
*/
|
|
42598
|
-
const unist_util_is_lib_convert =
|
|
42599
|
-
/**
|
|
42600
|
-
* @type {(
|
|
42601
|
-
* (<Kind extends Node>(test: PredicateTest<Kind>) => AssertPredicate<Kind>) &
|
|
42602
|
-
* ((test?: Test) => AssertAnything)
|
|
42603
|
-
* )}
|
|
42604
|
-
*/
|
|
42605
|
-
(
|
|
42606
|
-
/**
|
|
42607
|
-
* @param {Test} [test]
|
|
42608
|
-
* @returns {AssertAnything}
|
|
42609
|
-
*/
|
|
42610
|
-
function (test) {
|
|
42611
|
-
if (test === undefined || test === null) {
|
|
42612
|
-
return node_modules_unist_util_is_lib_ok
|
|
42613
|
-
}
|
|
42614
|
-
|
|
42615
|
-
if (typeof test === 'string') {
|
|
42616
|
-
return unist_util_is_lib_typeFactory(test)
|
|
42617
|
-
}
|
|
42618
|
-
|
|
42619
|
-
if (typeof test === 'object') {
|
|
42620
|
-
return Array.isArray(test) ? unist_util_is_lib_anyFactory(test) : unist_util_is_lib_propsFactory(test)
|
|
42621
|
-
}
|
|
42622
|
-
|
|
42623
|
-
if (typeof test === 'function') {
|
|
42624
|
-
return unist_util_is_lib_castFactory(test)
|
|
42625
|
-
}
|
|
42626
|
-
|
|
42627
|
-
throw new Error('Expected function, string, or object as test')
|
|
42628
|
-
}
|
|
42629
|
-
)
|
|
42630
41623
|
|
|
42631
41624
|
/**
|
|
42632
|
-
*
|
|
42633
|
-
*
|
|
41625
|
+
* Get the plain-text value of a hast node.
|
|
41626
|
+
*
|
|
41627
|
+
* @param {Nodes} node
|
|
41628
|
+
* Node to serialize.
|
|
41629
|
+
* @returns {string}
|
|
41630
|
+
* Serialized node.
|
|
42634
41631
|
*/
|
|
42635
|
-
function
|
|
42636
|
-
|
|
42637
|
-
|
|
42638
|
-
|
|
42639
|
-
|
|
42640
|
-
while (++index < tests.length) {
|
|
42641
|
-
checks[index] = unist_util_is_lib_convert(tests[index])
|
|
41632
|
+
function hast_util_to_string_lib_toString(node) {
|
|
41633
|
+
// “The concatenation of data of all the Text node descendants of the context
|
|
41634
|
+
// object, in tree order.”
|
|
41635
|
+
if ('children' in node) {
|
|
41636
|
+
return hast_util_to_string_lib_all(node)
|
|
42642
41637
|
}
|
|
42643
41638
|
|
|
42644
|
-
|
|
42645
|
-
|
|
42646
|
-
/**
|
|
42647
|
-
* @this {unknown}
|
|
42648
|
-
* @param {Array<unknown>} parameters
|
|
42649
|
-
* @returns {boolean}
|
|
42650
|
-
*/
|
|
42651
|
-
function any(...parameters) {
|
|
42652
|
-
let index = -1
|
|
42653
|
-
|
|
42654
|
-
while (++index < checks.length) {
|
|
42655
|
-
if (checks[index].call(this, ...parameters)) return true
|
|
42656
|
-
}
|
|
42657
|
-
|
|
42658
|
-
return false
|
|
42659
|
-
}
|
|
41639
|
+
// “Context object’s data.”
|
|
41640
|
+
return 'value' in node ? node.value : ''
|
|
42660
41641
|
}
|
|
42661
41642
|
|
|
42662
41643
|
/**
|
|
42663
|
-
*
|
|
42664
|
-
*
|
|
42665
|
-
* @
|
|
42666
|
-
*
|
|
41644
|
+
* @param {Nodes} node
|
|
41645
|
+
* Node.
|
|
41646
|
+
* @returns {string}
|
|
41647
|
+
* Serialized node.
|
|
42667
41648
|
*/
|
|
42668
|
-
function
|
|
42669
|
-
|
|
42670
|
-
|
|
42671
|
-
/**
|
|
42672
|
-
* @param {Node} node
|
|
42673
|
-
* @returns {boolean}
|
|
42674
|
-
*/
|
|
42675
|
-
function all(node) {
|
|
42676
|
-
/** @type {string} */
|
|
42677
|
-
let key
|
|
42678
|
-
|
|
42679
|
-
for (key in check) {
|
|
42680
|
-
// @ts-expect-error: hush, it sure works as an index.
|
|
42681
|
-
if (node[key] !== check[key]) return false
|
|
42682
|
-
}
|
|
42683
|
-
|
|
42684
|
-
return true
|
|
41649
|
+
function hast_util_to_string_lib_one(node) {
|
|
41650
|
+
if (node.type === 'text') {
|
|
41651
|
+
return node.value
|
|
42685
41652
|
}
|
|
42686
|
-
}
|
|
42687
|
-
|
|
42688
|
-
/**
|
|
42689
|
-
* Turn a string into a test for a node with a certain type.
|
|
42690
|
-
*
|
|
42691
|
-
* @param {string} check
|
|
42692
|
-
* @returns {AssertAnything}
|
|
42693
|
-
*/
|
|
42694
|
-
function unist_util_is_lib_typeFactory(check) {
|
|
42695
|
-
return unist_util_is_lib_castFactory(type)
|
|
42696
41653
|
|
|
42697
|
-
|
|
42698
|
-
* @param {Node} node
|
|
42699
|
-
*/
|
|
42700
|
-
function type(node) {
|
|
42701
|
-
return node && node.type === check
|
|
42702
|
-
}
|
|
41654
|
+
return 'children' in node ? hast_util_to_string_lib_all(node) : ''
|
|
42703
41655
|
}
|
|
42704
41656
|
|
|
42705
41657
|
/**
|
|
42706
|
-
*
|
|
42707
|
-
*
|
|
42708
|
-
* @
|
|
42709
|
-
*
|
|
41658
|
+
* @param {Parents} node
|
|
41659
|
+
* Node.
|
|
41660
|
+
* @returns {string}
|
|
41661
|
+
* Serialized node.
|
|
42710
41662
|
*/
|
|
42711
|
-
function
|
|
42712
|
-
|
|
41663
|
+
function hast_util_to_string_lib_all(node) {
|
|
41664
|
+
let index = -1
|
|
41665
|
+
/** @type {Array<string>} */
|
|
41666
|
+
const result = []
|
|
42713
41667
|
|
|
42714
|
-
|
|
42715
|
-
|
|
42716
|
-
* @param {unknown} node
|
|
42717
|
-
* @param {Array<unknown>} parameters
|
|
42718
|
-
* @returns {boolean}
|
|
42719
|
-
*/
|
|
42720
|
-
function assertion(node, ...parameters) {
|
|
42721
|
-
return Boolean(
|
|
42722
|
-
node &&
|
|
42723
|
-
typeof node === 'object' &&
|
|
42724
|
-
'type' in node &&
|
|
42725
|
-
// @ts-expect-error: fine.
|
|
42726
|
-
Boolean(check.call(this, node, ...parameters))
|
|
42727
|
-
)
|
|
41668
|
+
while (++index < node.children.length) {
|
|
41669
|
+
result[index] = hast_util_to_string_lib_one(node.children[index])
|
|
42728
41670
|
}
|
|
42729
|
-
}
|
|
42730
41671
|
|
|
42731
|
-
|
|
42732
|
-
return true
|
|
41672
|
+
return result.join('')
|
|
42733
41673
|
}
|
|
42734
41674
|
|
|
42735
41675
|
;// CONCATENATED MODULE: ../node_modules/unist-util-filter/lib/index.js
|
|
42736
41676
|
/**
|
|
42737
41677
|
* @typedef {import('unist').Node} Node
|
|
42738
41678
|
* @typedef {import('unist').Parent} Parent
|
|
42739
|
-
* @typedef {import('unist-util-is').Test} Test
|
|
42740
41679
|
*
|
|
41680
|
+
* @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test
|
|
41681
|
+
* Test from `unist-util-is`.
|
|
41682
|
+
*
|
|
41683
|
+
* Note: we have remove and add `undefined`, because otherwise when generating
|
|
41684
|
+
* automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
|
|
41685
|
+
* which doesn’t work when publishing on npm.
|
|
41686
|
+
*/
|
|
41687
|
+
|
|
41688
|
+
/**
|
|
42741
41689
|
* @typedef Options
|
|
42742
41690
|
* Configuration (optional).
|
|
42743
41691
|
* @property {boolean | null | undefined} [cascade=true]
|
|
42744
41692
|
* Whether to drop parent nodes if they had children, but all their children
|
|
42745
|
-
* were filtered out.
|
|
41693
|
+
* were filtered out (default: `true`).
|
|
42746
41694
|
*/
|
|
42747
41695
|
|
|
42748
41696
|
|
|
@@ -42755,98 +41703,105 @@ const unist_util_filter_lib_own = {}.hasOwnProperty
|
|
|
42755
41703
|
* The tree is walked in *preorder* (NLR), visiting the node itself, then its
|
|
42756
41704
|
* head, etc.
|
|
42757
41705
|
*
|
|
42758
|
-
* @
|
|
41706
|
+
* @template {Node} Tree
|
|
41707
|
+
* @template {Test} Check
|
|
41708
|
+
*
|
|
41709
|
+
* @overload
|
|
41710
|
+
* @param {Tree} tree
|
|
41711
|
+
* @param {Options | null | undefined} options
|
|
41712
|
+
* @param {Check} test
|
|
41713
|
+
* @returns {import('./complex-types.js').Matches<Tree, Check>}
|
|
41714
|
+
*
|
|
41715
|
+
* @overload
|
|
41716
|
+
* @param {Tree} tree
|
|
41717
|
+
* @param {Check} test
|
|
41718
|
+
* @returns {import('./complex-types.js').Matches<Tree, Check>}
|
|
41719
|
+
*
|
|
41720
|
+
* @overload
|
|
41721
|
+
* @param {Tree} tree
|
|
41722
|
+
* @param {null | undefined} [options]
|
|
41723
|
+
* @returns {Tree}
|
|
41724
|
+
*
|
|
41725
|
+
* @param {Node} tree
|
|
42759
41726
|
* Tree to filter.
|
|
42760
|
-
* @param options
|
|
41727
|
+
* @param {Options | Test} [options]
|
|
42761
41728
|
* Configuration (optional).
|
|
42762
|
-
* @param test
|
|
41729
|
+
* @param {Test} [test]
|
|
42763
41730
|
* `unist-util-is` compatible test.
|
|
42764
|
-
* @returns
|
|
41731
|
+
* @returns {Node | undefined}
|
|
42765
41732
|
* New filtered tree.
|
|
42766
41733
|
*
|
|
42767
|
-
* `
|
|
42768
|
-
* away.
|
|
41734
|
+
* `undefined` is returned if `tree` itself didn’t pass the test, or is
|
|
41735
|
+
* cascaded away.
|
|
42769
41736
|
*/
|
|
42770
|
-
|
|
42771
|
-
|
|
42772
|
-
|
|
42773
|
-
|
|
42774
|
-
|
|
42775
|
-
|
|
42776
|
-
|
|
42777
|
-
|
|
42778
|
-
(
|
|
42779
|
-
/**
|
|
42780
|
-
* @param {Node} tree
|
|
42781
|
-
* @param {Options | Test | null | undefined} [options]
|
|
42782
|
-
* @param {Test | null | undefined} [test]
|
|
42783
|
-
* @returns {Node | null}
|
|
42784
|
-
*/
|
|
42785
|
-
function (tree, options, test) {
|
|
42786
|
-
const is = unist_util_is_lib_convert(test || options)
|
|
42787
|
-
/** @type {boolean | null | undefined} */
|
|
42788
|
-
const cascadeRaw =
|
|
42789
|
-
options && typeof options === 'object' && 'cascade' in options
|
|
42790
|
-
? /** @type {boolean | null | undefined} */ (options.cascade)
|
|
42791
|
-
: undefined
|
|
42792
|
-
const cascade =
|
|
42793
|
-
cascadeRaw === undefined || cascadeRaw === null ? true : cascadeRaw
|
|
42794
|
-
|
|
42795
|
-
return preorder(tree)
|
|
41737
|
+
function filter(tree, options, test) {
|
|
41738
|
+
const is = convert(test || options)
|
|
41739
|
+
const cascadeRaw =
|
|
41740
|
+
options && typeof options === 'object' && 'cascade' in options
|
|
41741
|
+
? /** @type {boolean | null | undefined} */ (options.cascade)
|
|
41742
|
+
: undefined
|
|
41743
|
+
const cascade =
|
|
41744
|
+
cascadeRaw === undefined || cascadeRaw === null ? true : cascadeRaw
|
|
42796
41745
|
|
|
42797
|
-
|
|
42798
|
-
* @param {Node} node
|
|
42799
|
-
* Current node.
|
|
42800
|
-
* @param {number | undefined} [index]
|
|
42801
|
-
* Index of `node` in `parent`.
|
|
42802
|
-
* @param {Parent | undefined} [parent]
|
|
42803
|
-
* Parent node.
|
|
42804
|
-
* @returns {Node | null}
|
|
42805
|
-
* Shallow copy of `node`.
|
|
42806
|
-
*/
|
|
42807
|
-
function preorder(node, index, parent) {
|
|
42808
|
-
/** @type {Array<Node>} */
|
|
42809
|
-
const children = []
|
|
41746
|
+
return preorder(tree)
|
|
42810
41747
|
|
|
42811
|
-
|
|
41748
|
+
/**
|
|
41749
|
+
* @param {Node} node
|
|
41750
|
+
* Current node.
|
|
41751
|
+
* @param {number | undefined} [index]
|
|
41752
|
+
* Index of `node` in `parent`.
|
|
41753
|
+
* @param {Parent | undefined} [parentNode]
|
|
41754
|
+
* Parent node.
|
|
41755
|
+
* @returns {Node | undefined}
|
|
41756
|
+
* Shallow copy of `node`.
|
|
41757
|
+
*/
|
|
41758
|
+
function preorder(node, index, parentNode) {
|
|
41759
|
+
/** @type {Array<Node>} */
|
|
41760
|
+
const children = []
|
|
42812
41761
|
|
|
42813
|
-
|
|
42814
|
-
if (node.children) {
|
|
42815
|
-
let childIndex = -1
|
|
41762
|
+
if (!is(node, index, parentNode)) return undefined
|
|
42816
41763
|
|
|
42817
|
-
|
|
42818
|
-
|
|
42819
|
-
// @ts-expect-error Looks like a parent.
|
|
42820
|
-
const result = preorder(node.children[childIndex], childIndex, node)
|
|
41764
|
+
if (lib_parent(node)) {
|
|
41765
|
+
let childIndex = -1
|
|
42821
41766
|
|
|
42822
|
-
|
|
42823
|
-
|
|
42824
|
-
}
|
|
42825
|
-
}
|
|
41767
|
+
while (++childIndex < node.children.length) {
|
|
41768
|
+
const result = preorder(node.children[childIndex], childIndex, node)
|
|
42826
41769
|
|
|
42827
|
-
|
|
42828
|
-
|
|
42829
|
-
return null
|
|
41770
|
+
if (result) {
|
|
41771
|
+
children.push(result)
|
|
42830
41772
|
}
|
|
41773
|
+
}
|
|
42831
41774
|
|
|
42832
|
-
|
|
42833
|
-
|
|
42834
|
-
|
|
42835
|
-
|
|
42836
|
-
/** @type {string} */
|
|
42837
|
-
let key
|
|
41775
|
+
if (cascade && node.children.length > 0 && children.length === 0) {
|
|
41776
|
+
return undefined
|
|
41777
|
+
}
|
|
41778
|
+
}
|
|
42838
41779
|
|
|
42839
|
-
|
|
42840
|
-
|
|
42841
|
-
|
|
42842
|
-
|
|
42843
|
-
|
|
42844
|
-
|
|
41780
|
+
// Create a shallow clone, using the new children.
|
|
41781
|
+
/** @type {typeof node} */
|
|
41782
|
+
// @ts-expect-error all the fields will be copied over.
|
|
41783
|
+
const next = {}
|
|
41784
|
+
/** @type {string} */
|
|
41785
|
+
let key
|
|
42845
41786
|
|
|
42846
|
-
|
|
41787
|
+
for (key in node) {
|
|
41788
|
+
if (unist_util_filter_lib_own.call(node, key)) {
|
|
41789
|
+
// @ts-expect-error: Looks like a record.
|
|
41790
|
+
next[key] = key === 'children' ? children : node[key]
|
|
42847
41791
|
}
|
|
42848
41792
|
}
|
|
42849
|
-
|
|
41793
|
+
|
|
41794
|
+
return next
|
|
41795
|
+
}
|
|
41796
|
+
}
|
|
41797
|
+
|
|
41798
|
+
/**
|
|
41799
|
+
* @param {Node} node
|
|
41800
|
+
* @returns {node is Parent}
|
|
41801
|
+
*/
|
|
41802
|
+
function lib_parent(node) {
|
|
41803
|
+
return 'children' in node && node.children !== undefined
|
|
41804
|
+
}
|
|
42850
41805
|
|
|
42851
41806
|
// EXTERNAL MODULE: ../node_modules/parse-numeric-range/index.js
|
|
42852
41807
|
var parse_numeric_range = __webpack_require__(324);
|
|
@@ -70175,7 +69130,7 @@ refractor.register(zig)
|
|
|
70175
69130
|
|
|
70176
69131
|
|
|
70177
69132
|
;// CONCATENATED MODULE: ../node_modules/rehype-prism-plus/dist/index.es.js
|
|
70178
|
-
function a(){a=function(e,r){return new t(e,void 0,r)};var e=RegExp.prototype,r=new WeakMap;function t(e,n,i){var o=new RegExp(e,n);return r.set(o,i||r.get(e)),l(o,t.prototype)}function n(e,t){var n=r.get(t);return Object.keys(n).reduce(function(r,t){var i=n[t];if("number"==typeof i)r[t]=e[i];else{for(var o=0;void 0===e[i[o]]&&o+1<i.length;)o++;r[t]=e[i[o]]}return r},Object.create(null))}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&l(e,r)}(t,RegExp),t.prototype.exec=function(r){var t=e.exec.call(this,r);if(t){t.groups=n(t,this);var i=t.indices;i&&(i.groups=n(i,this))}return t},t.prototype[Symbol.replace]=function(t,i){if("string"==typeof i){var o=r.get(this);return e[Symbol.replace].call(this,t,i.replace(/\$<([^>]+)>/g,function(e,r){var t=o[r];return"$"+(Array.isArray(t)?t.join("$"):t)}))}if("function"==typeof i){var a=this;return e[Symbol.replace].call(this,t,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,a)),i.apply(this,e)})}return e[Symbol.replace].call(this,t,i)},a.apply(this,arguments)}function l(e,r){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},l(e,r)}function index_es_s(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function u(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return index_es_s(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?index_es_s(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var index_es_c=function(i){return function(o){return void 0===o&&(o={}),function(e,r){if(r&&!e.registered(r))throw new Error('The default language "'+r+'" is not registered with refractor.')}(i,o.defaultLanguage),function(r){
|
|
69133
|
+
function a(){a=function(e,r){return new t(e,void 0,r)};var e=RegExp.prototype,r=new WeakMap;function t(e,n,i){var o=new RegExp(e,n);return r.set(o,i||r.get(e)),l(o,t.prototype)}function n(e,t){var n=r.get(t);return Object.keys(n).reduce(function(r,t){var i=n[t];if("number"==typeof i)r[t]=e[i];else{for(var o=0;void 0===e[i[o]]&&o+1<i.length;)o++;r[t]=e[i[o]]}return r},Object.create(null))}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&l(e,r)}(t,RegExp),t.prototype.exec=function(r){var t=e.exec.call(this,r);if(t){t.groups=n(t,this);var i=t.indices;i&&(i.groups=n(i,this))}return t},t.prototype[Symbol.replace]=function(t,i){if("string"==typeof i){var o=r.get(this);return e[Symbol.replace].call(this,t,i.replace(/\$<([^>]+)>/g,function(e,r){var t=o[r];return"$"+(Array.isArray(t)?t.join("$"):t)}))}if("function"==typeof i){var a=this;return e[Symbol.replace].call(this,t,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,a)),i.apply(this,e)})}return e[Symbol.replace].call(this,t,i)},a.apply(this,arguments)}function l(e,r){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},l(e,r)}function index_es_s(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function u(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return index_es_s(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?index_es_s(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var index_es_c=function(i){return function(o){return void 0===o&&(o={}),function(e,r){if(r&&!e.registered(r))throw new Error('The default language "'+r+'" is not registered with refractor.')}(i,o.defaultLanguage),function(r){visit(r,"element",l)};function l(e,l,s){var c,p;if(s&&"pre"===s.tagName&&"code"===e.tagName){var f=(null==e||null==(c=e.data)?void 0:c.meta)||(null==e||null==(p=e.properties)?void 0:p.metastring)||"";e.properties.className?"boolean"==typeof e.properties.className?e.properties.className=[]:Array.isArray(e.properties.className)||(e.properties.className=[e.properties.className]):e.properties.className=[];var m,h,d=function(e){for(var r,t=u(e.properties.className);!(r=t()).done;){var n=r.value;if("language-"===n.slice(0,9))return n.slice(9).toLowerCase()}return null}(e);if(!d&&o.defaultLanguage&&e.properties.className.push("language-"+(d=o.defaultLanguage)),e.properties.className.push("code-highlight"),d)try{var g,v;v=null!=(g=d)&&g.includes("diff-")?d.split("-")[1]:d,m=i.highlight(hast_util_to_string_lib_toString(e),v),s.properties.className=(s.properties.className||[]).concat("language-"+v)}catch(r){if(!o.ignoreMissing||!/Unknown language/.test(r.message))throw r;m=e}else m=e;m.children=(h=1,function e(r){return r.reduce(function(r,t){if("text"===t.type){var n=t.value,i=(n.match(/\n/g)||"").length;if(0===i)t.position={start:{line:h,column:1},end:{line:h,column:1}},r.push(t);else for(var o,a=n.split("\n"),l=u(a.entries());!(o=l()).done;){var s=o.value,c=s[0],p=s[1];r.push({type:"text",value:c===a.length-1?p:p+"\n",position:{start:{line:h+c,column:1},end:{line:h+c,column:1}}})}return h+=i,r}if(Object.prototype.hasOwnProperty.call(t,"children")){var f=h;return t.children=e(t.children),r.push(t),t.position={start:{line:f,column:1},end:{line:h,column:1}},r}return r.push(t),r},[])})(m.children),m.position=m.children.length>0?{start:{line:m.children[0].position.start.line,column:0},end:{line:m.children[m.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var y,b=function(e){var r=/{([\d,-]+)}/,t=e.split(",").map(function(e){return e.trim()}).join();if(r.test(t)){var i=r.exec(t)[1],o=parse_numeric_range(i);return function(e){return o.includes(e+1)}}return function(){return!1}}(f),w=function(e){var r=/*#__PURE__*/a(/showLineNumbers=(\d+)/i,{lines:1});if(r.test(e)){var t=r.exec(e);return Number(t.groups.lines)}return 1}(f),N=function(e){for(var r=new Array(e),t=0;t<e;t++)r[t]={type:"element",tagName:"span",properties:{className:[]},children:[]};return r}(m.position.end.line),j=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],x=function(){var e,n,i=y.value,a=i[0],l=i[1];l.properties.className=["code-line"];var s=filter(m,function(e){return e.position.start.line<=a+1&&e.position.end.line>=a+1});l.children=s.children,!f.toLowerCase().includes("showLineNumbers".toLowerCase())&&!o.showLineNumbers||j.some(function(e){return f.toLowerCase().includes(e)})||(l.properties.line=[(a+w).toString()],l.properties.className.push("line-number")),b(a)&&l.properties.className.push("highlight-line"),("diff"===d||null!=(e=d)&&e.includes("diff-"))&&"-"===hast_util_to_string_lib_toString(l).substring(0,1)?l.properties.className.push("deleted"):("diff"===d||null!=(n=d)&&n.includes("diff-"))&&"+"===hast_util_to_string_lib_toString(l).substring(0,1)&&l.properties.className.push("inserted")},O=u(N.entries());!(y=O()).done;)x();N.length>0&&""===hast_util_to_string_lib_toString(N[N.length-1]).trim()&&N.pop(),e.children=N}}}},p=index_es_c(refractor),f=index_es_c(refractor);
|
|
70179
69134
|
//# sourceMappingURL=index.es.js.map
|
|
70180
69135
|
|
|
70181
69136
|
;// CONCATENATED MODULE: ../node_modules/css-selector-parser/dist/mjs/indexes.js
|
|
@@ -71644,63 +70599,6 @@ function direction(value) {
|
|
|
71644
70599
|
return rtl.test(source) ? 'rtl' : ltr.test(source) ? 'ltr' : 'neutral'
|
|
71645
70600
|
}
|
|
71646
70601
|
|
|
71647
|
-
;// CONCATENATED MODULE: ../node_modules/hast-util-to-string/lib/index.js
|
|
71648
|
-
/**
|
|
71649
|
-
* @typedef {import('hast').Nodes} Nodes
|
|
71650
|
-
* @typedef {import('hast').Parents} Parents
|
|
71651
|
-
*/
|
|
71652
|
-
|
|
71653
|
-
/**
|
|
71654
|
-
* Get the plain-text value of a hast node.
|
|
71655
|
-
*
|
|
71656
|
-
* @param {Nodes} node
|
|
71657
|
-
* Node to serialize.
|
|
71658
|
-
* @returns {string}
|
|
71659
|
-
* Serialized node.
|
|
71660
|
-
*/
|
|
71661
|
-
function hast_util_to_string_lib_toString(node) {
|
|
71662
|
-
// “The concatenation of data of all the Text node descendants of the context
|
|
71663
|
-
// object, in tree order.”
|
|
71664
|
-
if ('children' in node) {
|
|
71665
|
-
return hast_util_to_string_lib_all(node)
|
|
71666
|
-
}
|
|
71667
|
-
|
|
71668
|
-
// “Context object’s data.”
|
|
71669
|
-
return 'value' in node ? node.value : ''
|
|
71670
|
-
}
|
|
71671
|
-
|
|
71672
|
-
/**
|
|
71673
|
-
* @param {Nodes} node
|
|
71674
|
-
* Node.
|
|
71675
|
-
* @returns {string}
|
|
71676
|
-
* Serialized node.
|
|
71677
|
-
*/
|
|
71678
|
-
function hast_util_to_string_lib_one(node) {
|
|
71679
|
-
if (node.type === 'text') {
|
|
71680
|
-
return node.value
|
|
71681
|
-
}
|
|
71682
|
-
|
|
71683
|
-
return 'children' in node ? hast_util_to_string_lib_all(node) : ''
|
|
71684
|
-
}
|
|
71685
|
-
|
|
71686
|
-
/**
|
|
71687
|
-
* @param {Parents} node
|
|
71688
|
-
* Node.
|
|
71689
|
-
* @returns {string}
|
|
71690
|
-
* Serialized node.
|
|
71691
|
-
*/
|
|
71692
|
-
function hast_util_to_string_lib_all(node) {
|
|
71693
|
-
let index = -1
|
|
71694
|
-
/** @type {Array<string>} */
|
|
71695
|
-
const result = []
|
|
71696
|
-
|
|
71697
|
-
while (++index < node.children.length) {
|
|
71698
|
-
result[index] = hast_util_to_string_lib_one(node.children[index])
|
|
71699
|
-
}
|
|
71700
|
-
|
|
71701
|
-
return result.join('')
|
|
71702
|
-
}
|
|
71703
|
-
|
|
71704
70602
|
;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/enter-state.js
|
|
71705
70603
|
/**
|
|
71706
70604
|
* @typedef {import('hast').ElementContent} ElementContent
|
|
@@ -74394,11 +73292,11 @@ const convertElement =
|
|
|
74394
73292
|
|
|
74395
73293
|
// Assume array.
|
|
74396
73294
|
if (typeof test === 'object') {
|
|
74397
|
-
return
|
|
73295
|
+
return lib_anyFactory(test)
|
|
74398
73296
|
}
|
|
74399
73297
|
|
|
74400
73298
|
if (typeof test === 'function') {
|
|
74401
|
-
return
|
|
73299
|
+
return lib_castFactory(test)
|
|
74402
73300
|
}
|
|
74403
73301
|
|
|
74404
73302
|
throw new Error('Expected function, string, or array as `test`')
|
|
@@ -74411,7 +73309,7 @@ const convertElement =
|
|
|
74411
73309
|
* @param {Array<TestFunction | string>} tests
|
|
74412
73310
|
* @returns {Check}
|
|
74413
73311
|
*/
|
|
74414
|
-
function
|
|
73312
|
+
function lib_anyFactory(tests) {
|
|
74415
73313
|
/** @type {Array<Check>} */
|
|
74416
73314
|
const checks = []
|
|
74417
73315
|
let index = -1
|
|
@@ -74420,7 +73318,7 @@ function hast_util_is_element_lib_anyFactory(tests) {
|
|
|
74420
73318
|
checks[index] = convertElement(tests[index])
|
|
74421
73319
|
}
|
|
74422
73320
|
|
|
74423
|
-
return
|
|
73321
|
+
return lib_castFactory(any)
|
|
74424
73322
|
|
|
74425
73323
|
/**
|
|
74426
73324
|
* @this {unknown}
|
|
@@ -74444,7 +73342,7 @@ function hast_util_is_element_lib_anyFactory(tests) {
|
|
|
74444
73342
|
* @returns {Check}
|
|
74445
73343
|
*/
|
|
74446
73344
|
function tagNameFactory(check) {
|
|
74447
|
-
return
|
|
73345
|
+
return lib_castFactory(tagName)
|
|
74448
73346
|
|
|
74449
73347
|
/**
|
|
74450
73348
|
* @param {Element} element
|
|
@@ -74461,7 +73359,7 @@ function tagNameFactory(check) {
|
|
|
74461
73359
|
* @param {TestFunction} testFunction
|
|
74462
73360
|
* @returns {Check}
|
|
74463
73361
|
*/
|
|
74464
|
-
function
|
|
73362
|
+
function lib_castFactory(testFunction) {
|
|
74465
73363
|
return check
|
|
74466
73364
|
|
|
74467
73365
|
/**
|