markmap-lib 0.17.2 → 0.17.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.iife.js +688 -808
- package/dist/browser/index.mjs +180 -37
- package/dist/index.js +3 -8
- package/dist/index.mjs +3 -8
- package/dist/index.no-plugins.js +3 -5
- package/dist/index.no-plugins.mjs +3 -5
- package/dist/plugins.js +22 -33
- package/dist/plugins.mjs +22 -33
- package/package.json +4 -4
|
@@ -79,8 +79,7 @@
|
|
|
79
79
|
}
|
|
80
80
|
revoke(fn) {
|
|
81
81
|
const i = this.listeners.indexOf(fn);
|
|
82
|
-
if (i >= 0)
|
|
83
|
-
this.listeners.splice(i, 1);
|
|
82
|
+
if (i >= 0) this.listeners.splice(i, 1);
|
|
84
83
|
}
|
|
85
84
|
revokeAll() {
|
|
86
85
|
this.listeners.splice(0);
|
|
@@ -151,12 +150,9 @@
|
|
|
151
150
|
}
|
|
152
151
|
function jsx(type, props) {
|
|
153
152
|
let vtype;
|
|
154
|
-
if (typeof type === "string")
|
|
155
|
-
|
|
156
|
-
else
|
|
157
|
-
vtype = VTYPE_FUNCTION;
|
|
158
|
-
else
|
|
159
|
-
throw new Error("Invalid VNode type");
|
|
153
|
+
if (typeof type === "string") vtype = VTYPE_ELEMENT;
|
|
154
|
+
else if (typeof type === "function") vtype = VTYPE_FUNCTION;
|
|
155
|
+
else throw new Error("Invalid VNode type");
|
|
160
156
|
return {
|
|
161
157
|
vtype,
|
|
162
158
|
type,
|
|
@@ -170,22 +166,18 @@
|
|
|
170
166
|
isSvg: false
|
|
171
167
|
};
|
|
172
168
|
function insertDom(parent2, nodes) {
|
|
173
|
-
if (!Array.isArray(nodes))
|
|
174
|
-
nodes = [nodes];
|
|
169
|
+
if (!Array.isArray(nodes)) nodes = [nodes];
|
|
175
170
|
nodes = nodes.filter(Boolean);
|
|
176
|
-
if (nodes.length)
|
|
177
|
-
parent2.append(...nodes);
|
|
171
|
+
if (nodes.length) parent2.append(...nodes);
|
|
178
172
|
}
|
|
179
173
|
function mountAttributes(domElement, props, env) {
|
|
180
174
|
for (const key in props) {
|
|
181
|
-
if (key === "key" || key === "children" || key === "ref")
|
|
182
|
-
continue;
|
|
175
|
+
if (key === "key" || key === "children" || key === "ref") continue;
|
|
183
176
|
if (key === "dangerouslySetInnerHTML") {
|
|
184
177
|
domElement.innerHTML = props[key].__html;
|
|
185
178
|
} else if (key === "innerHTML" || key === "textContent" || key === "innerText" || key === "value" && ["textarea", "select"].includes(domElement.tagName)) {
|
|
186
179
|
const value = props[key];
|
|
187
|
-
if (value != null)
|
|
188
|
-
domElement[key] = value;
|
|
180
|
+
if (value != null) domElement[key] = value;
|
|
189
181
|
} else if (key.startsWith("on")) {
|
|
190
182
|
domElement[key.toLowerCase()] = props[key];
|
|
191
183
|
} else {
|
|
@@ -212,11 +204,11 @@
|
|
|
212
204
|
}
|
|
213
205
|
}
|
|
214
206
|
}
|
|
215
|
-
function flatten
|
|
207
|
+
function flatten(arr) {
|
|
216
208
|
return arr.reduce((prev2, item) => prev2.concat(item), []);
|
|
217
209
|
}
|
|
218
210
|
function mountChildren(children2, env) {
|
|
219
|
-
return Array.isArray(children2) ? flatten
|
|
211
|
+
return Array.isArray(children2) ? flatten(children2.map((child) => mountChildren(child, env))) : mount(children2, env);
|
|
220
212
|
}
|
|
221
213
|
function mount(vnode, env = DEFAULT_ENV) {
|
|
222
214
|
if (vnode == null || typeof vnode === "boolean") {
|
|
@@ -269,14 +261,12 @@
|
|
|
269
261
|
});
|
|
270
262
|
}
|
|
271
263
|
const children2 = mountChildren(props.children, childEnv);
|
|
272
|
-
if (children2 != null)
|
|
273
|
-
insertDom(node, children2);
|
|
264
|
+
if (children2 != null) insertDom(node, children2);
|
|
274
265
|
}
|
|
275
266
|
const {
|
|
276
267
|
ref
|
|
277
268
|
} = props;
|
|
278
|
-
if (typeof ref === "function")
|
|
279
|
-
ref(node);
|
|
269
|
+
if (typeof ref === "function") ref(node);
|
|
280
270
|
return node;
|
|
281
271
|
}
|
|
282
272
|
throw new Error("mount: Invalid Vnode!");
|
|
@@ -357,17 +347,6 @@
|
|
|
357
347
|
}
|
|
358
348
|
};
|
|
359
349
|
}
|
|
360
|
-
const defaultOpts$2 = {
|
|
361
|
-
xml: false,
|
|
362
|
-
decodeEntities: true
|
|
363
|
-
};
|
|
364
|
-
const xmlModeDefault = {
|
|
365
|
-
_useHtmlParser2: true,
|
|
366
|
-
xmlMode: true
|
|
367
|
-
};
|
|
368
|
-
function flatten(options) {
|
|
369
|
-
return (options === null || options === void 0 ? void 0 : options.xml) ? typeof options.xml === "boolean" ? xmlModeDefault : { ...xmlModeDefault, ...options.xml } : options !== null && options !== void 0 ? options : void 0;
|
|
370
|
-
}
|
|
371
350
|
var ElementType;
|
|
372
351
|
(function(ElementType2) {
|
|
373
352
|
ElementType2["Root"] = "root";
|
|
@@ -653,7 +632,7 @@
|
|
|
653
632
|
}
|
|
654
633
|
return children2;
|
|
655
634
|
}
|
|
656
|
-
const defaultOpts$
|
|
635
|
+
const defaultOpts$2 = {
|
|
657
636
|
withStartIndices: false,
|
|
658
637
|
withEndIndices: false,
|
|
659
638
|
xmlMode: false
|
|
@@ -673,14 +652,14 @@
|
|
|
673
652
|
this.parser = null;
|
|
674
653
|
if (typeof options === "function") {
|
|
675
654
|
elementCB = options;
|
|
676
|
-
options = defaultOpts$
|
|
655
|
+
options = defaultOpts$2;
|
|
677
656
|
}
|
|
678
657
|
if (typeof callback === "object") {
|
|
679
658
|
options = callback;
|
|
680
659
|
callback = void 0;
|
|
681
660
|
}
|
|
682
661
|
this.callback = callback !== null && callback !== void 0 ? callback : null;
|
|
683
|
-
this.options = options !== null && options !== void 0 ? options : defaultOpts$
|
|
662
|
+
this.options = options !== null && options !== void 0 ? options : defaultOpts$2;
|
|
684
663
|
this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;
|
|
685
664
|
}
|
|
686
665
|
onparserinit(parser) {
|
|
@@ -867,14 +846,14 @@
|
|
|
867
846
|
BinTrieFlags2[BinTrieFlags2["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
|
|
868
847
|
BinTrieFlags2[BinTrieFlags2["JUMP_TABLE"] = 127] = "JUMP_TABLE";
|
|
869
848
|
})(BinTrieFlags || (BinTrieFlags = {}));
|
|
870
|
-
function isNumber
|
|
849
|
+
function isNumber(code2) {
|
|
871
850
|
return code2 >= CharCodes$1.ZERO && code2 <= CharCodes$1.NINE;
|
|
872
851
|
}
|
|
873
852
|
function isHexadecimalCharacter(code2) {
|
|
874
853
|
return code2 >= CharCodes$1.UPPER_A && code2 <= CharCodes$1.UPPER_F || code2 >= CharCodes$1.LOWER_A && code2 <= CharCodes$1.LOWER_F;
|
|
875
854
|
}
|
|
876
855
|
function isAsciiAlphaNumeric$1(code2) {
|
|
877
|
-
return code2 >= CharCodes$1.UPPER_A && code2 <= CharCodes$1.UPPER_Z || code2 >= CharCodes$1.LOWER_A && code2 <= CharCodes$1.LOWER_Z || isNumber
|
|
856
|
+
return code2 >= CharCodes$1.UPPER_A && code2 <= CharCodes$1.UPPER_Z || code2 >= CharCodes$1.LOWER_A && code2 <= CharCodes$1.LOWER_Z || isNumber(code2);
|
|
878
857
|
}
|
|
879
858
|
function isEntityInAttributeInvalidEnd$1(code2) {
|
|
880
859
|
return code2 === CharCodes$1.EQUALS || isAsciiAlphaNumeric$1(code2);
|
|
@@ -991,7 +970,7 @@
|
|
|
991
970
|
const startIdx = offset;
|
|
992
971
|
while (offset < str.length) {
|
|
993
972
|
const char = str.charCodeAt(offset);
|
|
994
|
-
if (isNumber
|
|
973
|
+
if (isNumber(char) || isHexadecimalCharacter(char)) {
|
|
995
974
|
offset += 1;
|
|
996
975
|
} else {
|
|
997
976
|
this.addToNumericResult(str, startIdx, offset, 16);
|
|
@@ -1014,7 +993,7 @@
|
|
|
1014
993
|
const startIdx = offset;
|
|
1015
994
|
while (offset < str.length) {
|
|
1016
995
|
const char = str.charCodeAt(offset);
|
|
1017
|
-
if (isNumber
|
|
996
|
+
if (isNumber(char)) {
|
|
1018
997
|
offset += 1;
|
|
1019
998
|
} else {
|
|
1020
999
|
this.addToNumericResult(str, startIdx, offset, 10);
|
|
@@ -2055,20 +2034,42 @@
|
|
|
2055
2034
|
textContent,
|
|
2056
2035
|
uniqueSort
|
|
2057
2036
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2037
|
+
const defaultOpts$1 = {
|
|
2038
|
+
_useHtmlParser2: false
|
|
2039
|
+
};
|
|
2040
|
+
function flattenOptions(options, baseOptions) {
|
|
2041
|
+
if (!options) {
|
|
2042
|
+
return baseOptions !== null && baseOptions !== void 0 ? baseOptions : defaultOpts$1;
|
|
2043
|
+
}
|
|
2044
|
+
const opts = {
|
|
2045
|
+
_useHtmlParser2: !!options.xmlMode,
|
|
2046
|
+
...baseOptions,
|
|
2047
|
+
...options
|
|
2048
|
+
};
|
|
2049
|
+
if (options.xml) {
|
|
2050
|
+
opts._useHtmlParser2 = true;
|
|
2051
|
+
opts.xmlMode = true;
|
|
2052
|
+
if (options.xml !== true) {
|
|
2053
|
+
Object.assign(opts, options.xml);
|
|
2054
|
+
}
|
|
2055
|
+
} else if (options.xmlMode) {
|
|
2056
|
+
opts._useHtmlParser2 = true;
|
|
2057
|
+
}
|
|
2058
|
+
return opts;
|
|
2059
|
+
}
|
|
2058
2060
|
function render(that, dom, options) {
|
|
2059
2061
|
if (!that)
|
|
2060
2062
|
return "";
|
|
2061
2063
|
return that(dom !== null && dom !== void 0 ? dom : that._root.children, null, void 0, options).toString();
|
|
2062
2064
|
}
|
|
2063
2065
|
function isOptions(dom, options) {
|
|
2064
|
-
return
|
|
2066
|
+
return typeof dom === "object" && dom != null && !("length" in dom) && !("type" in dom);
|
|
2065
2067
|
}
|
|
2066
2068
|
function html$1(dom, options) {
|
|
2067
2069
|
const toRender = isOptions(dom) ? (options = dom, void 0) : dom;
|
|
2068
2070
|
const opts = {
|
|
2069
|
-
...defaultOpts$2,
|
|
2070
2071
|
...this === null || this === void 0 ? void 0 : this._options,
|
|
2071
|
-
...
|
|
2072
|
+
...flattenOptions(options)
|
|
2072
2073
|
};
|
|
2073
2074
|
return render(this, toRender, opts);
|
|
2074
2075
|
}
|
|
@@ -2077,7 +2078,7 @@
|
|
|
2077
2078
|
return render(this, dom, options);
|
|
2078
2079
|
}
|
|
2079
2080
|
function text$2(elements) {
|
|
2080
|
-
const elems = elements ? elements : this ? this.root() : [];
|
|
2081
|
+
const elems = elements !== null && elements !== void 0 ? elements : this ? this.root() : [];
|
|
2081
2082
|
let ret = "";
|
|
2082
2083
|
for (let i = 0; i < elems.length; i++) {
|
|
2083
2084
|
ret += textContent(elems[i]);
|
|
@@ -2091,11 +2092,11 @@
|
|
|
2091
2092
|
if (typeof context === "boolean") {
|
|
2092
2093
|
keepScripts = context;
|
|
2093
2094
|
}
|
|
2094
|
-
const parsed = this.load(data2,
|
|
2095
|
+
const parsed = this.load(data2, this._options, false);
|
|
2095
2096
|
if (!keepScripts) {
|
|
2096
2097
|
parsed("script").remove();
|
|
2097
2098
|
}
|
|
2098
|
-
return parsed.root()[0].children
|
|
2099
|
+
return [...parsed.root()[0].children];
|
|
2099
2100
|
}
|
|
2100
2101
|
function root() {
|
|
2101
2102
|
return this(this._root);
|
|
@@ -2113,6 +2114,9 @@
|
|
|
2113
2114
|
}
|
|
2114
2115
|
return false;
|
|
2115
2116
|
}
|
|
2117
|
+
function extract$1(map2) {
|
|
2118
|
+
return this.root().extract(map2);
|
|
2119
|
+
}
|
|
2116
2120
|
function merge(arr1, arr2) {
|
|
2117
2121
|
if (!isArrayLike(arr1) || !isArrayLike(arr2)) {
|
|
2118
2122
|
return;
|
|
@@ -2129,7 +2133,7 @@
|
|
|
2129
2133
|
if (Array.isArray(item)) {
|
|
2130
2134
|
return true;
|
|
2131
2135
|
}
|
|
2132
|
-
if (typeof item !== "object" || !
|
|
2136
|
+
if (typeof item !== "object" || item === null || !("length" in item) || typeof item.length !== "number" || item.length < 0) {
|
|
2133
2137
|
return false;
|
|
2134
2138
|
}
|
|
2135
2139
|
for (let i = 0; i < item.length; i++) {
|
|
@@ -2142,6 +2146,7 @@
|
|
|
2142
2146
|
const staticMethods = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2143
2147
|
__proto__: null,
|
|
2144
2148
|
contains,
|
|
2149
|
+
extract: extract$1,
|
|
2145
2150
|
html: html$1,
|
|
2146
2151
|
merge,
|
|
2147
2152
|
parseHTML,
|
|
@@ -2153,7 +2158,7 @@
|
|
|
2153
2158
|
return maybeCheerio.cheerio != null;
|
|
2154
2159
|
}
|
|
2155
2160
|
function camelCase(str) {
|
|
2156
|
-
return str.replace(/[_
|
|
2161
|
+
return str.replace(/[._-](\w|$)/g, (_, x) => x.toUpperCase());
|
|
2157
2162
|
}
|
|
2158
2163
|
function cssCase(str) {
|
|
2159
2164
|
return str.replace(/[A-Z]/g, "-$&").toLowerCase();
|
|
@@ -2164,14 +2169,6 @@
|
|
|
2164
2169
|
fn(array[i], i);
|
|
2165
2170
|
return array;
|
|
2166
2171
|
}
|
|
2167
|
-
function cloneDom(dom) {
|
|
2168
|
-
const clone2 = "length" in dom ? Array.prototype.map.call(dom, (el) => cloneNode(el, true)) : [cloneNode(dom, true)];
|
|
2169
|
-
const root2 = new Document$1(clone2);
|
|
2170
|
-
clone2.forEach((node) => {
|
|
2171
|
-
node.parent = root2;
|
|
2172
|
-
});
|
|
2173
|
-
return clone2;
|
|
2174
|
-
}
|
|
2175
2172
|
var CharacterCodes;
|
|
2176
2173
|
(function(CharacterCodes2) {
|
|
2177
2174
|
CharacterCodes2[CharacterCodes2["LowerA"] = 97] = "LowerA";
|
|
@@ -2190,11 +2187,6 @@
|
|
|
2190
2187
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
2191
2188
|
const rspace = /\s+/;
|
|
2192
2189
|
const dataAttrPrefix = "data-";
|
|
2193
|
-
const primitives = {
|
|
2194
|
-
null: null,
|
|
2195
|
-
true: true,
|
|
2196
|
-
false: false
|
|
2197
|
-
};
|
|
2198
2190
|
const rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i;
|
|
2199
2191
|
const rbrace = /^{[^]*}$|^\[[^]*]$/;
|
|
2200
2192
|
function getAttr(elem, name2, xmlMode) {
|
|
@@ -2240,10 +2232,10 @@
|
|
|
2240
2232
|
if (!isTag(el))
|
|
2241
2233
|
return;
|
|
2242
2234
|
if (typeof name2 === "object") {
|
|
2243
|
-
Object.keys(name2)
|
|
2235
|
+
for (const objName of Object.keys(name2)) {
|
|
2244
2236
|
const objValue = name2[objName];
|
|
2245
2237
|
setAttr(el, objName, objValue);
|
|
2246
|
-
}
|
|
2238
|
+
}
|
|
2247
2239
|
} else {
|
|
2248
2240
|
setAttr(el, name2, value);
|
|
2249
2241
|
}
|
|
@@ -2274,9 +2266,9 @@
|
|
|
2274
2266
|
case "style": {
|
|
2275
2267
|
const property = this.css();
|
|
2276
2268
|
const keys = Object.keys(property);
|
|
2277
|
-
keys.
|
|
2278
|
-
property[i] =
|
|
2279
|
-
}
|
|
2269
|
+
for (let i = 0; i < keys.length; i++) {
|
|
2270
|
+
property[i] = keys[i];
|
|
2271
|
+
}
|
|
2280
2272
|
property.length = keys.length;
|
|
2281
2273
|
return property;
|
|
2282
2274
|
}
|
|
@@ -2287,7 +2279,7 @@
|
|
|
2287
2279
|
case "href":
|
|
2288
2280
|
case "src": {
|
|
2289
2281
|
const prop2 = (_a2 = el.attribs) === null || _a2 === void 0 ? void 0 : _a2[name2];
|
|
2290
|
-
if (typeof URL !== "undefined" && (name2 === "href" && (el.tagName === "a" || el.
|
|
2282
|
+
if (typeof URL !== "undefined" && (name2 === "href" && (el.tagName === "a" || el.tagName === "link") || name2 === "src" && (el.tagName === "img" || el.tagName === "iframe" || el.tagName === "audio" || el.tagName === "video" || el.tagName === "source")) && prop2 !== void 0 && this.options.baseURI) {
|
|
2291
2283
|
return new URL(prop2, this.options.baseURI).href;
|
|
2292
2284
|
}
|
|
2293
2285
|
return prop2;
|
|
@@ -2298,18 +2290,21 @@
|
|
|
2298
2290
|
case "textContent": {
|
|
2299
2291
|
return textContent(el);
|
|
2300
2292
|
}
|
|
2301
|
-
case "outerHTML":
|
|
2293
|
+
case "outerHTML": {
|
|
2302
2294
|
return this.clone().wrap("<container />").parent().html();
|
|
2303
|
-
|
|
2295
|
+
}
|
|
2296
|
+
case "innerHTML": {
|
|
2304
2297
|
return this.html();
|
|
2305
|
-
|
|
2298
|
+
}
|
|
2299
|
+
default: {
|
|
2306
2300
|
return getProp(el, name2, this.options.xmlMode);
|
|
2301
|
+
}
|
|
2307
2302
|
}
|
|
2308
2303
|
}
|
|
2309
2304
|
if (typeof name2 === "object" || value !== void 0) {
|
|
2310
2305
|
if (typeof value === "function") {
|
|
2311
2306
|
if (typeof name2 === "object") {
|
|
2312
|
-
throw new
|
|
2307
|
+
throw new TypeError("Bad combination of arguments.");
|
|
2313
2308
|
}
|
|
2314
2309
|
return domEach(this, (el, i) => {
|
|
2315
2310
|
if (isTag(el)) {
|
|
@@ -2321,10 +2316,10 @@
|
|
|
2321
2316
|
if (!isTag(el))
|
|
2322
2317
|
return;
|
|
2323
2318
|
if (typeof name2 === "object") {
|
|
2324
|
-
Object.keys(name2)
|
|
2319
|
+
for (const key of Object.keys(name2)) {
|
|
2325
2320
|
const val2 = name2[key];
|
|
2326
2321
|
setProp(el, key, val2, this.options.xmlMode);
|
|
2327
|
-
}
|
|
2322
|
+
}
|
|
2328
2323
|
} else {
|
|
2329
2324
|
setProp(el, name2, value, this.options.xmlMode);
|
|
2330
2325
|
}
|
|
@@ -2332,9 +2327,8 @@
|
|
|
2332
2327
|
}
|
|
2333
2328
|
return void 0;
|
|
2334
2329
|
}
|
|
2335
|
-
function setData(
|
|
2330
|
+
function setData(elem, name2, value) {
|
|
2336
2331
|
var _a2;
|
|
2337
|
-
const elem = el;
|
|
2338
2332
|
(_a2 = elem.data) !== null && _a2 !== void 0 ? _a2 : elem.data = {};
|
|
2339
2333
|
if (typeof name2 === "object")
|
|
2340
2334
|
Object.assign(elem.data, name2);
|
|
@@ -2342,36 +2336,46 @@
|
|
|
2342
2336
|
elem.data[name2] = value;
|
|
2343
2337
|
}
|
|
2344
2338
|
}
|
|
2339
|
+
function readAllData(el) {
|
|
2340
|
+
for (const domName of Object.keys(el.attribs)) {
|
|
2341
|
+
if (!domName.startsWith(dataAttrPrefix)) {
|
|
2342
|
+
continue;
|
|
2343
|
+
}
|
|
2344
|
+
const jsName = camelCase(domName.slice(dataAttrPrefix.length));
|
|
2345
|
+
if (!hasOwn.call(el.data, jsName)) {
|
|
2346
|
+
el.data[jsName] = parseDataValue(el.attribs[domName]);
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
return el.data;
|
|
2350
|
+
}
|
|
2345
2351
|
function readData(el, name2) {
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
}
|
|
2371
|
-
el.data[jsName] = value;
|
|
2352
|
+
const domName = dataAttrPrefix + cssCase(name2);
|
|
2353
|
+
const data2 = el.data;
|
|
2354
|
+
if (hasOwn.call(data2, name2)) {
|
|
2355
|
+
return data2[name2];
|
|
2356
|
+
}
|
|
2357
|
+
if (hasOwn.call(el.attribs, domName)) {
|
|
2358
|
+
return data2[name2] = parseDataValue(el.attribs[domName]);
|
|
2359
|
+
}
|
|
2360
|
+
return void 0;
|
|
2361
|
+
}
|
|
2362
|
+
function parseDataValue(value) {
|
|
2363
|
+
if (value === "null")
|
|
2364
|
+
return null;
|
|
2365
|
+
if (value === "true")
|
|
2366
|
+
return true;
|
|
2367
|
+
if (value === "false")
|
|
2368
|
+
return false;
|
|
2369
|
+
const num = Number(value);
|
|
2370
|
+
if (value === String(num))
|
|
2371
|
+
return num;
|
|
2372
|
+
if (rbrace.test(value)) {
|
|
2373
|
+
try {
|
|
2374
|
+
return JSON.parse(value);
|
|
2375
|
+
} catch {
|
|
2372
2376
|
}
|
|
2373
2377
|
}
|
|
2374
|
-
return
|
|
2378
|
+
return value;
|
|
2375
2379
|
}
|
|
2376
2380
|
function data(name2, value) {
|
|
2377
2381
|
var _a2;
|
|
@@ -2380,8 +2384,8 @@
|
|
|
2380
2384
|
return;
|
|
2381
2385
|
const dataEl = elem;
|
|
2382
2386
|
(_a2 = dataEl.data) !== null && _a2 !== void 0 ? _a2 : dataEl.data = {};
|
|
2383
|
-
if (
|
|
2384
|
-
return
|
|
2387
|
+
if (name2 == null) {
|
|
2388
|
+
return readAllData(dataEl);
|
|
2385
2389
|
}
|
|
2386
2390
|
if (typeof name2 === "object" || value !== void 0) {
|
|
2387
2391
|
domEach(this, (el) => {
|
|
@@ -2394,9 +2398,6 @@
|
|
|
2394
2398
|
});
|
|
2395
2399
|
return this;
|
|
2396
2400
|
}
|
|
2397
|
-
if (hasOwn.call(dataEl.data, name2)) {
|
|
2398
|
-
return dataEl.data[name2];
|
|
2399
|
-
}
|
|
2400
2401
|
return readData(dataEl, name2);
|
|
2401
2402
|
}
|
|
2402
2403
|
function val(value) {
|
|
@@ -2405,8 +2406,9 @@
|
|
|
2405
2406
|
if (!element || !isTag(element))
|
|
2406
2407
|
return querying ? void 0 : this;
|
|
2407
2408
|
switch (element.name) {
|
|
2408
|
-
case "textarea":
|
|
2409
|
+
case "textarea": {
|
|
2409
2410
|
return this.text(value);
|
|
2411
|
+
}
|
|
2410
2412
|
case "select": {
|
|
2411
2413
|
const option = this.find("option:selected");
|
|
2412
2414
|
if (!querying) {
|
|
@@ -2414,17 +2416,18 @@
|
|
|
2414
2416
|
return this;
|
|
2415
2417
|
}
|
|
2416
2418
|
this.find("option").removeAttr("selected");
|
|
2417
|
-
const values = typeof value
|
|
2418
|
-
for (
|
|
2419
|
-
this.find(`option[value="${
|
|
2419
|
+
const values = typeof value === "object" ? value : [value];
|
|
2420
|
+
for (const val2 of values) {
|
|
2421
|
+
this.find(`option[value="${val2}"]`).attr("selected", "");
|
|
2420
2422
|
}
|
|
2421
2423
|
return this;
|
|
2422
2424
|
}
|
|
2423
2425
|
return this.attr("multiple") ? option.toArray().map((el) => text$2(el.children)) : option.attr("value");
|
|
2424
2426
|
}
|
|
2425
2427
|
case "input":
|
|
2426
|
-
case "option":
|
|
2428
|
+
case "option": {
|
|
2427
2429
|
return querying ? this.attr("value") : this.attr("value", value);
|
|
2430
|
+
}
|
|
2428
2431
|
}
|
|
2429
2432
|
return void 0;
|
|
2430
2433
|
}
|
|
@@ -2438,10 +2441,10 @@
|
|
|
2438
2441
|
}
|
|
2439
2442
|
function removeAttr(name2) {
|
|
2440
2443
|
const attrNames = splitNames(name2);
|
|
2441
|
-
for (
|
|
2444
|
+
for (const attrName of attrNames) {
|
|
2442
2445
|
domEach(this, (elem) => {
|
|
2443
2446
|
if (isTag(elem))
|
|
2444
|
-
removeAttribute(elem,
|
|
2447
|
+
removeAttribute(elem, attrName);
|
|
2445
2448
|
});
|
|
2446
2449
|
}
|
|
2447
2450
|
return this;
|
|
@@ -2450,7 +2453,7 @@
|
|
|
2450
2453
|
return this.toArray().some((elem) => {
|
|
2451
2454
|
const clazz = isTag(elem) && elem.attribs["class"];
|
|
2452
2455
|
let idx = -1;
|
|
2453
|
-
if (clazz && className.length) {
|
|
2456
|
+
if (clazz && className.length > 0) {
|
|
2454
2457
|
while ((idx = clazz.indexOf(className, idx + 1)) > -1) {
|
|
2455
2458
|
const end2 = idx + className.length;
|
|
2456
2459
|
if ((idx === 0 || rspace.test(clazz[idx - 1])) && (end2 === clazz.length || rspace.test(clazz[end2]))) {
|
|
@@ -2479,16 +2482,16 @@
|
|
|
2479
2482
|
if (!isTag(el))
|
|
2480
2483
|
continue;
|
|
2481
2484
|
const className = getAttr(el, "class", false);
|
|
2482
|
-
if (
|
|
2483
|
-
setAttr(el, "class", classNames.join(" ").trim());
|
|
2484
|
-
} else {
|
|
2485
|
+
if (className) {
|
|
2485
2486
|
let setClass = ` ${className} `;
|
|
2486
|
-
for (
|
|
2487
|
-
const appendClass = `${
|
|
2487
|
+
for (const cn of classNames) {
|
|
2488
|
+
const appendClass = `${cn} `;
|
|
2488
2489
|
if (!setClass.includes(` ${appendClass}`))
|
|
2489
2490
|
setClass += appendClass;
|
|
2490
2491
|
}
|
|
2491
2492
|
setAttr(el, "class", setClass.trim());
|
|
2493
|
+
} else {
|
|
2494
|
+
setAttr(el, "class", classNames.join(" ").trim());
|
|
2492
2495
|
}
|
|
2493
2496
|
}
|
|
2494
2497
|
return this;
|
|
@@ -2729,209 +2732,208 @@
|
|
|
2729
2732
|
if (selector.length === selectorIndex) {
|
|
2730
2733
|
return selectorIndex;
|
|
2731
2734
|
}
|
|
2732
|
-
loop:
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
tokens.push({ type: SelectorType.Descendant });
|
|
2744
|
-
}
|
|
2745
|
-
stripWhitespace(1);
|
|
2746
|
-
break;
|
|
2747
|
-
}
|
|
2748
|
-
case 62: {
|
|
2749
|
-
addTraversal(SelectorType.Child);
|
|
2750
|
-
stripWhitespace(1);
|
|
2751
|
-
break;
|
|
2735
|
+
loop: while (selectorIndex < selector.length) {
|
|
2736
|
+
const firstChar = selector.charCodeAt(selectorIndex);
|
|
2737
|
+
switch (firstChar) {
|
|
2738
|
+
case 32:
|
|
2739
|
+
case 9:
|
|
2740
|
+
case 10:
|
|
2741
|
+
case 12:
|
|
2742
|
+
case 13: {
|
|
2743
|
+
if (tokens.length === 0 || tokens[0].type !== SelectorType.Descendant) {
|
|
2744
|
+
ensureNotTraversal();
|
|
2745
|
+
tokens.push({ type: SelectorType.Descendant });
|
|
2752
2746
|
}
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2747
|
+
stripWhitespace(1);
|
|
2748
|
+
break;
|
|
2749
|
+
}
|
|
2750
|
+
case 62: {
|
|
2751
|
+
addTraversal(SelectorType.Child);
|
|
2752
|
+
stripWhitespace(1);
|
|
2753
|
+
break;
|
|
2754
|
+
}
|
|
2755
|
+
case 60: {
|
|
2756
|
+
addTraversal(SelectorType.Parent);
|
|
2757
|
+
stripWhitespace(1);
|
|
2758
|
+
break;
|
|
2759
|
+
}
|
|
2760
|
+
case 126: {
|
|
2761
|
+
addTraversal(SelectorType.Sibling);
|
|
2762
|
+
stripWhitespace(1);
|
|
2763
|
+
break;
|
|
2764
|
+
}
|
|
2765
|
+
case 43: {
|
|
2766
|
+
addTraversal(SelectorType.Adjacent);
|
|
2767
|
+
stripWhitespace(1);
|
|
2768
|
+
break;
|
|
2769
|
+
}
|
|
2770
|
+
case 46: {
|
|
2771
|
+
addSpecialAttribute("class", AttributeAction.Element);
|
|
2772
|
+
break;
|
|
2773
|
+
}
|
|
2774
|
+
case 35: {
|
|
2775
|
+
addSpecialAttribute("id", AttributeAction.Equals);
|
|
2776
|
+
break;
|
|
2777
|
+
}
|
|
2778
|
+
case 91: {
|
|
2779
|
+
stripWhitespace(1);
|
|
2780
|
+
let name2;
|
|
2781
|
+
let namespace = null;
|
|
2782
|
+
if (selector.charCodeAt(selectorIndex) === 124) {
|
|
2783
|
+
name2 = getName2(1);
|
|
2784
|
+
} else if (selector.startsWith("*|", selectorIndex)) {
|
|
2785
|
+
namespace = "*";
|
|
2786
|
+
name2 = getName2(2);
|
|
2787
|
+
} else {
|
|
2788
|
+
name2 = getName2(0);
|
|
2789
|
+
if (selector.charCodeAt(selectorIndex) === 124 && selector.charCodeAt(selectorIndex + 1) !== 61) {
|
|
2790
|
+
namespace = name2;
|
|
2791
|
+
name2 = getName2(1);
|
|
2792
|
+
}
|
|
2762
2793
|
}
|
|
2763
|
-
|
|
2764
|
-
|
|
2794
|
+
stripWhitespace(0);
|
|
2795
|
+
let action = AttributeAction.Exists;
|
|
2796
|
+
const possibleAction = actionTypes.get(selector.charCodeAt(selectorIndex));
|
|
2797
|
+
if (possibleAction) {
|
|
2798
|
+
action = possibleAction;
|
|
2799
|
+
if (selector.charCodeAt(selectorIndex + 1) !== 61) {
|
|
2800
|
+
throw new Error("Expected `=`");
|
|
2801
|
+
}
|
|
2802
|
+
stripWhitespace(2);
|
|
2803
|
+
} else if (selector.charCodeAt(selectorIndex) === 61) {
|
|
2804
|
+
action = AttributeAction.Equals;
|
|
2765
2805
|
stripWhitespace(1);
|
|
2766
|
-
break;
|
|
2767
|
-
}
|
|
2768
|
-
case 46: {
|
|
2769
|
-
addSpecialAttribute("class", AttributeAction.Element);
|
|
2770
|
-
break;
|
|
2771
|
-
}
|
|
2772
|
-
case 35: {
|
|
2773
|
-
addSpecialAttribute("id", AttributeAction.Equals);
|
|
2774
|
-
break;
|
|
2775
2806
|
}
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2807
|
+
let value = "";
|
|
2808
|
+
let ignoreCase = null;
|
|
2809
|
+
if (action !== "exists") {
|
|
2810
|
+
if (isQuote(selector.charCodeAt(selectorIndex))) {
|
|
2811
|
+
const quote = selector.charCodeAt(selectorIndex);
|
|
2812
|
+
let sectionEnd = selectorIndex + 1;
|
|
2813
|
+
while (sectionEnd < selector.length && (selector.charCodeAt(sectionEnd) !== quote || isEscaped(sectionEnd))) {
|
|
2814
|
+
sectionEnd += 1;
|
|
2815
|
+
}
|
|
2816
|
+
if (selector.charCodeAt(sectionEnd) !== quote) {
|
|
2817
|
+
throw new Error("Attribute value didn't end");
|
|
2818
|
+
}
|
|
2819
|
+
value = unescapeCSS(selector.slice(selectorIndex + 1, sectionEnd));
|
|
2820
|
+
selectorIndex = sectionEnd + 1;
|
|
2785
2821
|
} else {
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
name2 = getName2(1);
|
|
2822
|
+
const valueStart = selectorIndex;
|
|
2823
|
+
while (selectorIndex < selector.length && (!isWhitespace$2(selector.charCodeAt(selectorIndex)) && selector.charCodeAt(selectorIndex) !== 93 || isEscaped(selectorIndex))) {
|
|
2824
|
+
selectorIndex += 1;
|
|
2790
2825
|
}
|
|
2826
|
+
value = unescapeCSS(selector.slice(valueStart, selectorIndex));
|
|
2791
2827
|
}
|
|
2792
2828
|
stripWhitespace(0);
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
}
|
|
2800
|
-
stripWhitespace(2);
|
|
2801
|
-
} else if (selector.charCodeAt(selectorIndex) === 61) {
|
|
2802
|
-
action = AttributeAction.Equals;
|
|
2829
|
+
const forceIgnore = selector.charCodeAt(selectorIndex) | 32;
|
|
2830
|
+
if (forceIgnore === 115) {
|
|
2831
|
+
ignoreCase = false;
|
|
2832
|
+
stripWhitespace(1);
|
|
2833
|
+
} else if (forceIgnore === 105) {
|
|
2834
|
+
ignoreCase = true;
|
|
2803
2835
|
stripWhitespace(1);
|
|
2804
2836
|
}
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2837
|
+
}
|
|
2838
|
+
if (selector.charCodeAt(selectorIndex) !== 93) {
|
|
2839
|
+
throw new Error("Attribute selector didn't terminate");
|
|
2840
|
+
}
|
|
2841
|
+
selectorIndex += 1;
|
|
2842
|
+
const attributeSelector = {
|
|
2843
|
+
type: SelectorType.Attribute,
|
|
2844
|
+
name: name2,
|
|
2845
|
+
action,
|
|
2846
|
+
value,
|
|
2847
|
+
namespace,
|
|
2848
|
+
ignoreCase
|
|
2849
|
+
};
|
|
2850
|
+
tokens.push(attributeSelector);
|
|
2851
|
+
break;
|
|
2852
|
+
}
|
|
2853
|
+
case 58: {
|
|
2854
|
+
if (selector.charCodeAt(selectorIndex + 1) === 58) {
|
|
2855
|
+
tokens.push({
|
|
2856
|
+
type: SelectorType.PseudoElement,
|
|
2857
|
+
name: getName2(2).toLowerCase(),
|
|
2858
|
+
data: selector.charCodeAt(selectorIndex) === 40 ? readValueWithParenthesis() : null
|
|
2859
|
+
});
|
|
2860
|
+
continue;
|
|
2861
|
+
}
|
|
2862
|
+
const name2 = getName2(1).toLowerCase();
|
|
2863
|
+
let data2 = null;
|
|
2864
|
+
if (selector.charCodeAt(selectorIndex) === 40) {
|
|
2865
|
+
if (unpackPseudos.has(name2)) {
|
|
2866
|
+
if (isQuote(selector.charCodeAt(selectorIndex + 1))) {
|
|
2867
|
+
throw new Error(`Pseudo-selector ${name2} cannot be quoted`);
|
|
2825
2868
|
}
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
if (
|
|
2829
|
-
|
|
2830
|
-
stripWhitespace(1);
|
|
2831
|
-
} else if (forceIgnore === 105) {
|
|
2832
|
-
ignoreCase = true;
|
|
2833
|
-
stripWhitespace(1);
|
|
2869
|
+
data2 = [];
|
|
2870
|
+
selectorIndex = parseSelector(data2, selector, selectorIndex + 1);
|
|
2871
|
+
if (selector.charCodeAt(selectorIndex) !== 41) {
|
|
2872
|
+
throw new Error(`Missing closing parenthesis in :${name2} (${selector})`);
|
|
2834
2873
|
}
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
name: name2,
|
|
2843
|
-
action,
|
|
2844
|
-
value,
|
|
2845
|
-
namespace,
|
|
2846
|
-
ignoreCase
|
|
2847
|
-
};
|
|
2848
|
-
tokens.push(attributeSelector);
|
|
2849
|
-
break;
|
|
2850
|
-
}
|
|
2851
|
-
case 58: {
|
|
2852
|
-
if (selector.charCodeAt(selectorIndex + 1) === 58) {
|
|
2853
|
-
tokens.push({
|
|
2854
|
-
type: SelectorType.PseudoElement,
|
|
2855
|
-
name: getName2(2).toLowerCase(),
|
|
2856
|
-
data: selector.charCodeAt(selectorIndex) === 40 ? readValueWithParenthesis() : null
|
|
2857
|
-
});
|
|
2858
|
-
continue;
|
|
2859
|
-
}
|
|
2860
|
-
const name2 = getName2(1).toLowerCase();
|
|
2861
|
-
let data2 = null;
|
|
2862
|
-
if (selector.charCodeAt(selectorIndex) === 40) {
|
|
2863
|
-
if (unpackPseudos.has(name2)) {
|
|
2864
|
-
if (isQuote(selector.charCodeAt(selectorIndex + 1))) {
|
|
2865
|
-
throw new Error(`Pseudo-selector ${name2} cannot be quoted`);
|
|
2866
|
-
}
|
|
2867
|
-
data2 = [];
|
|
2868
|
-
selectorIndex = parseSelector(data2, selector, selectorIndex + 1);
|
|
2869
|
-
if (selector.charCodeAt(selectorIndex) !== 41) {
|
|
2870
|
-
throw new Error(`Missing closing parenthesis in :${name2} (${selector})`);
|
|
2871
|
-
}
|
|
2872
|
-
selectorIndex += 1;
|
|
2873
|
-
} else {
|
|
2874
|
-
data2 = readValueWithParenthesis();
|
|
2875
|
-
if (stripQuotesFromPseudos.has(name2)) {
|
|
2876
|
-
const quot = data2.charCodeAt(0);
|
|
2877
|
-
if (quot === data2.charCodeAt(data2.length - 1) && isQuote(quot)) {
|
|
2878
|
-
data2 = data2.slice(1, -1);
|
|
2879
|
-
}
|
|
2874
|
+
selectorIndex += 1;
|
|
2875
|
+
} else {
|
|
2876
|
+
data2 = readValueWithParenthesis();
|
|
2877
|
+
if (stripQuotesFromPseudos.has(name2)) {
|
|
2878
|
+
const quot = data2.charCodeAt(0);
|
|
2879
|
+
if (quot === data2.charCodeAt(data2.length - 1) && isQuote(quot)) {
|
|
2880
|
+
data2 = data2.slice(1, -1);
|
|
2880
2881
|
}
|
|
2881
|
-
data2 = unescapeCSS(data2);
|
|
2882
2882
|
}
|
|
2883
|
+
data2 = unescapeCSS(data2);
|
|
2883
2884
|
}
|
|
2884
|
-
tokens.push({ type: SelectorType.Pseudo, name: name2, data: data2 });
|
|
2885
|
-
break;
|
|
2886
2885
|
}
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2886
|
+
tokens.push({ type: SelectorType.Pseudo, name: name2, data: data2 });
|
|
2887
|
+
break;
|
|
2888
|
+
}
|
|
2889
|
+
case 44: {
|
|
2890
|
+
finalizeSubselector();
|
|
2891
|
+
tokens = [];
|
|
2892
|
+
stripWhitespace(1);
|
|
2893
|
+
break;
|
|
2894
|
+
}
|
|
2895
|
+
default: {
|
|
2896
|
+
if (selector.startsWith("/*", selectorIndex)) {
|
|
2897
|
+
const endIndex = selector.indexOf("*/", selectorIndex + 2);
|
|
2898
|
+
if (endIndex < 0) {
|
|
2899
|
+
throw new Error("Comment was not terminated");
|
|
2900
|
+
}
|
|
2901
|
+
selectorIndex = endIndex + 2;
|
|
2902
|
+
if (tokens.length === 0) {
|
|
2903
|
+
stripWhitespace(0);
|
|
2904
|
+
}
|
|
2891
2905
|
break;
|
|
2892
2906
|
}
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2907
|
+
let namespace = null;
|
|
2908
|
+
let name2;
|
|
2909
|
+
if (firstChar === 42) {
|
|
2910
|
+
selectorIndex += 1;
|
|
2911
|
+
name2 = "*";
|
|
2912
|
+
} else if (firstChar === 124) {
|
|
2913
|
+
name2 = "";
|
|
2914
|
+
if (selector.charCodeAt(selectorIndex + 1) === 124) {
|
|
2915
|
+
addTraversal(SelectorType.ColumnCombinator);
|
|
2916
|
+
stripWhitespace(2);
|
|
2903
2917
|
break;
|
|
2904
2918
|
}
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2919
|
+
} else if (reName.test(selector.slice(selectorIndex))) {
|
|
2920
|
+
name2 = getName2(0);
|
|
2921
|
+
} else {
|
|
2922
|
+
break loop;
|
|
2923
|
+
}
|
|
2924
|
+
if (selector.charCodeAt(selectorIndex) === 124 && selector.charCodeAt(selectorIndex + 1) !== 124) {
|
|
2925
|
+
namespace = name2;
|
|
2926
|
+
if (selector.charCodeAt(selectorIndex + 1) === 42) {
|
|
2909
2927
|
name2 = "*";
|
|
2910
|
-
|
|
2911
|
-
name2 = "";
|
|
2912
|
-
if (selector.charCodeAt(selectorIndex + 1) === 124) {
|
|
2913
|
-
addTraversal(SelectorType.ColumnCombinator);
|
|
2914
|
-
stripWhitespace(2);
|
|
2915
|
-
break;
|
|
2916
|
-
}
|
|
2917
|
-
} else if (reName.test(selector.slice(selectorIndex))) {
|
|
2918
|
-
name2 = getName2(0);
|
|
2928
|
+
selectorIndex += 2;
|
|
2919
2929
|
} else {
|
|
2920
|
-
|
|
2921
|
-
}
|
|
2922
|
-
if (selector.charCodeAt(selectorIndex) === 124 && selector.charCodeAt(selectorIndex + 1) !== 124) {
|
|
2923
|
-
namespace = name2;
|
|
2924
|
-
if (selector.charCodeAt(selectorIndex + 1) === 42) {
|
|
2925
|
-
name2 = "*";
|
|
2926
|
-
selectorIndex += 2;
|
|
2927
|
-
} else {
|
|
2928
|
-
name2 = getName2(1);
|
|
2929
|
-
}
|
|
2930
|
+
name2 = getName2(1);
|
|
2930
2931
|
}
|
|
2931
|
-
tokens.push(name2 === "*" ? { type: SelectorType.Universal, namespace } : { type: SelectorType.Tag, name: name2, namespace });
|
|
2932
2932
|
}
|
|
2933
|
+
tokens.push(name2 === "*" ? { type: SelectorType.Universal, namespace } : { type: SelectorType.Tag, name: name2, namespace });
|
|
2933
2934
|
}
|
|
2934
2935
|
}
|
|
2936
|
+
}
|
|
2935
2937
|
finalizeSubselector();
|
|
2936
2938
|
return selectorIndex;
|
|
2937
2939
|
}
|
|
@@ -3729,8 +3731,7 @@
|
|
|
3729
3731
|
return e === PLACEHOLDER_ELEMENT || parent2 && adapter2.isTag(parent2);
|
|
3730
3732
|
}));
|
|
3731
3733
|
for (const t of token) {
|
|
3732
|
-
if (t.length > 0 && isTraversal(t[0]) && t[0].type !== SelectorType.Descendant)
|
|
3733
|
-
;
|
|
3734
|
+
if (t.length > 0 && isTraversal(t[0]) && t[0].type !== SelectorType.Descendant) ;
|
|
3734
3735
|
else if (hasContext && !t.some(includesScopePseudo)) {
|
|
3735
3736
|
t.unshift(DESCENDANT_TOKEN);
|
|
3736
3737
|
} else {
|
|
@@ -3754,8 +3755,7 @@
|
|
|
3754
3755
|
const query = token.map((rules) => {
|
|
3755
3756
|
if (rules.length >= 2) {
|
|
3756
3757
|
const [first2, second] = rules;
|
|
3757
|
-
if (first2.type !== SelectorType.Pseudo || first2.name !== "scope")
|
|
3758
|
-
;
|
|
3758
|
+
if (first2.type !== SelectorType.Pseudo || first2.name !== "scope") ;
|
|
3759
3759
|
else if (isArrayContext && second.type === SelectorType.Descendant) {
|
|
3760
3760
|
rules[1] = FLEXIBLE_DESCENDANT_TOKEN;
|
|
3761
3761
|
} else if (second.type === SelectorType.Adjacent || second.type === SelectorType.Sibling) {
|
|
@@ -4041,18 +4041,22 @@
|
|
|
4041
4041
|
const query = _compileToken(sel, options);
|
|
4042
4042
|
return query === boolbase.trueFunc ? els : els.filter(query);
|
|
4043
4043
|
}
|
|
4044
|
-
const reSiblingSelector = /^\s*[
|
|
4044
|
+
const reSiblingSelector = /^\s*[+~]/;
|
|
4045
4045
|
function find(selectorOrHaystack) {
|
|
4046
|
-
var _a2;
|
|
4047
4046
|
if (!selectorOrHaystack) {
|
|
4048
4047
|
return this._make([]);
|
|
4049
4048
|
}
|
|
4050
|
-
const context = this.toArray();
|
|
4051
4049
|
if (typeof selectorOrHaystack !== "string") {
|
|
4052
4050
|
const haystack = isCheerio(selectorOrHaystack) ? selectorOrHaystack.toArray() : [selectorOrHaystack];
|
|
4051
|
+
const context = this.toArray();
|
|
4053
4052
|
return this._make(haystack.filter((elem) => context.some((node) => contains(node, elem))));
|
|
4054
4053
|
}
|
|
4055
|
-
|
|
4054
|
+
return this._findBySelector(selectorOrHaystack, Number.POSITIVE_INFINITY);
|
|
4055
|
+
}
|
|
4056
|
+
function _findBySelector(selector, limit) {
|
|
4057
|
+
var _a2;
|
|
4058
|
+
const context = this.toArray();
|
|
4059
|
+
const elems = reSiblingSelector.test(selector) ? context : this.children().toArray();
|
|
4056
4060
|
const options = {
|
|
4057
4061
|
context,
|
|
4058
4062
|
root: (_a2 = this._root) === null || _a2 === void 0 ? void 0 : _a2[0],
|
|
@@ -4063,7 +4067,7 @@
|
|
|
4063
4067
|
pseudos: this.options.pseudos,
|
|
4064
4068
|
quirksMode: this.options.quirksMode
|
|
4065
4069
|
};
|
|
4066
|
-
return this._make(select(
|
|
4070
|
+
return this._make(select(selector, elems, options, limit));
|
|
4067
4071
|
}
|
|
4068
4072
|
function _getMatcher(matchMap) {
|
|
4069
4073
|
return function(fn, ...postFns) {
|
|
@@ -4081,12 +4085,13 @@
|
|
|
4081
4085
|
};
|
|
4082
4086
|
}
|
|
4083
4087
|
const _matcher = _getMatcher((fn, elems) => {
|
|
4084
|
-
|
|
4088
|
+
let ret = [];
|
|
4085
4089
|
for (let i = 0; i < elems.length; i++) {
|
|
4086
4090
|
const value = fn(elems[i]);
|
|
4087
|
-
|
|
4091
|
+
if (value.length > 0)
|
|
4092
|
+
ret = ret.concat(value);
|
|
4088
4093
|
}
|
|
4089
|
-
return
|
|
4094
|
+
return ret;
|
|
4090
4095
|
});
|
|
4091
4096
|
const _singleMatcher = _getMatcher((fn, elems) => {
|
|
4092
4097
|
const ret = [];
|
|
@@ -4119,7 +4124,7 @@
|
|
|
4119
4124
|
};
|
|
4120
4125
|
}
|
|
4121
4126
|
function _removeDuplicates(elems) {
|
|
4122
|
-
return Array.from(new Set(elems));
|
|
4127
|
+
return elems.length > 1 ? Array.from(new Set(elems)) : elems;
|
|
4123
4128
|
}
|
|
4124
4129
|
const parent = _singleMatcher(({ parent: parent2 }) => parent2 && !isDocument$1(parent2) ? parent2 : null, _removeDuplicates);
|
|
4125
4130
|
const parents = _matcher((elem) => {
|
|
@@ -4143,6 +4148,9 @@
|
|
|
4143
4148
|
};
|
|
4144
4149
|
const selectFn = typeof selector === "string" ? (elem) => is$1(elem, selector, selectOpts) : getFilterFn(selector);
|
|
4145
4150
|
domEach(this, (elem) => {
|
|
4151
|
+
if (elem && !isDocument$1(elem) && !isTag(elem)) {
|
|
4152
|
+
elem = elem.parent;
|
|
4153
|
+
}
|
|
4146
4154
|
while (elem && isTag(elem)) {
|
|
4147
4155
|
if (selectFn(elem, 0)) {
|
|
4148
4156
|
if (!set2.includes(elem)) {
|
|
@@ -4296,6 +4304,7 @@
|
|
|
4296
4304
|
}
|
|
4297
4305
|
const Traversing = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4298
4306
|
__proto__: null,
|
|
4307
|
+
_findBySelector,
|
|
4299
4308
|
add,
|
|
4300
4309
|
addBack,
|
|
4301
4310
|
children,
|
|
@@ -4371,16 +4380,30 @@
|
|
|
4371
4380
|
if (elem == null) {
|
|
4372
4381
|
return [];
|
|
4373
4382
|
}
|
|
4374
|
-
if (isCheerio(elem)) {
|
|
4375
|
-
return clone2 ? cloneDom(elem.get()) : elem.get();
|
|
4376
|
-
}
|
|
4377
|
-
if (Array.isArray(elem)) {
|
|
4378
|
-
return elem.reduce((newElems, el) => newElems.concat(this._makeDomArray(el, clone2)), []);
|
|
4379
|
-
}
|
|
4380
4383
|
if (typeof elem === "string") {
|
|
4381
|
-
return this._parse(elem, this.options, false, null).children;
|
|
4384
|
+
return this._parse(elem, this.options, false, null).children.slice(0);
|
|
4382
4385
|
}
|
|
4383
|
-
|
|
4386
|
+
if ("length" in elem) {
|
|
4387
|
+
if (elem.length === 1) {
|
|
4388
|
+
return this._makeDomArray(elem[0], clone2);
|
|
4389
|
+
}
|
|
4390
|
+
const result = [];
|
|
4391
|
+
for (let i = 0; i < elem.length; i++) {
|
|
4392
|
+
const el = elem[i];
|
|
4393
|
+
if (typeof el === "object") {
|
|
4394
|
+
if (el == null) {
|
|
4395
|
+
continue;
|
|
4396
|
+
}
|
|
4397
|
+
if (!("length" in el)) {
|
|
4398
|
+
result.push(clone2 ? cloneNode(el, true) : el);
|
|
4399
|
+
continue;
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
result.push(...this._makeDomArray(el, clone2));
|
|
4403
|
+
}
|
|
4404
|
+
return result;
|
|
4405
|
+
}
|
|
4406
|
+
return [clone2 ? cloneNode(elem, true) : elem];
|
|
4384
4407
|
}
|
|
4385
4408
|
function _insert(concatenator) {
|
|
4386
4409
|
return function(...elems) {
|
|
@@ -4524,17 +4547,16 @@
|
|
|
4524
4547
|
function after(...elems) {
|
|
4525
4548
|
const lastIdx = this.length - 1;
|
|
4526
4549
|
return domEach(this, (el, i) => {
|
|
4527
|
-
|
|
4528
|
-
if (!hasChildren(el) || !parent2) {
|
|
4550
|
+
if (!hasChildren(el) || !el.parent) {
|
|
4529
4551
|
return;
|
|
4530
4552
|
}
|
|
4531
|
-
const siblings2 =
|
|
4553
|
+
const siblings2 = el.parent.children;
|
|
4532
4554
|
const index2 = siblings2.indexOf(el);
|
|
4533
4555
|
if (index2 < 0)
|
|
4534
4556
|
return;
|
|
4535
4557
|
const domSrc = typeof elems[0] === "function" ? elems[0].call(el, i, this._render(el.children)) : elems;
|
|
4536
4558
|
const dom = this._makeDomArray(domSrc, i < lastIdx);
|
|
4537
|
-
uniqueSplice(siblings2, index2 + 1, 0, dom,
|
|
4559
|
+
uniqueSplice(siblings2, index2 + 1, 0, dom, el.parent);
|
|
4538
4560
|
});
|
|
4539
4561
|
}
|
|
4540
4562
|
function insertAfter(target) {
|
|
@@ -4543,35 +4565,34 @@
|
|
|
4543
4565
|
}
|
|
4544
4566
|
this.remove();
|
|
4545
4567
|
const clones = [];
|
|
4546
|
-
this._makeDomArray(target)
|
|
4568
|
+
for (const el of this._makeDomArray(target)) {
|
|
4547
4569
|
const clonedSelf = this.clone().toArray();
|
|
4548
4570
|
const { parent: parent2 } = el;
|
|
4549
4571
|
if (!parent2) {
|
|
4550
|
-
|
|
4572
|
+
continue;
|
|
4551
4573
|
}
|
|
4552
4574
|
const siblings2 = parent2.children;
|
|
4553
4575
|
const index2 = siblings2.indexOf(el);
|
|
4554
4576
|
if (index2 < 0)
|
|
4555
|
-
|
|
4577
|
+
continue;
|
|
4556
4578
|
uniqueSplice(siblings2, index2 + 1, 0, clonedSelf, parent2);
|
|
4557
4579
|
clones.push(...clonedSelf);
|
|
4558
|
-
}
|
|
4580
|
+
}
|
|
4559
4581
|
return this._make(clones);
|
|
4560
4582
|
}
|
|
4561
4583
|
function before(...elems) {
|
|
4562
4584
|
const lastIdx = this.length - 1;
|
|
4563
4585
|
return domEach(this, (el, i) => {
|
|
4564
|
-
|
|
4565
|
-
if (!hasChildren(el) || !parent2) {
|
|
4586
|
+
if (!hasChildren(el) || !el.parent) {
|
|
4566
4587
|
return;
|
|
4567
4588
|
}
|
|
4568
|
-
const siblings2 =
|
|
4589
|
+
const siblings2 = el.parent.children;
|
|
4569
4590
|
const index2 = siblings2.indexOf(el);
|
|
4570
4591
|
if (index2 < 0)
|
|
4571
4592
|
return;
|
|
4572
4593
|
const domSrc = typeof elems[0] === "function" ? elems[0].call(el, i, this._render(el.children)) : elems;
|
|
4573
4594
|
const dom = this._makeDomArray(domSrc, i < lastIdx);
|
|
4574
|
-
uniqueSplice(siblings2, index2, 0, dom,
|
|
4595
|
+
uniqueSplice(siblings2, index2, 0, dom, el.parent);
|
|
4575
4596
|
});
|
|
4576
4597
|
}
|
|
4577
4598
|
function insertBefore(target) {
|
|
@@ -4622,9 +4643,9 @@
|
|
|
4622
4643
|
return domEach(this, (el) => {
|
|
4623
4644
|
if (!hasChildren(el))
|
|
4624
4645
|
return;
|
|
4625
|
-
el.children
|
|
4646
|
+
for (const child of el.children) {
|
|
4626
4647
|
child.next = child.prev = child.parent = null;
|
|
4627
|
-
}
|
|
4648
|
+
}
|
|
4628
4649
|
el.children.length = 0;
|
|
4629
4650
|
});
|
|
4630
4651
|
}
|
|
@@ -4638,9 +4659,9 @@
|
|
|
4638
4659
|
return domEach(this, (el) => {
|
|
4639
4660
|
if (!hasChildren(el))
|
|
4640
4661
|
return;
|
|
4641
|
-
el.children
|
|
4662
|
+
for (const child of el.children) {
|
|
4642
4663
|
child.next = child.prev = child.parent = null;
|
|
4643
|
-
}
|
|
4664
|
+
}
|
|
4644
4665
|
const content = isCheerio(str) ? str.toArray() : this._parse(`${str}`, this.options, false, el).children;
|
|
4645
4666
|
update(content, el);
|
|
4646
4667
|
});
|
|
@@ -4658,15 +4679,20 @@
|
|
|
4658
4679
|
return domEach(this, (el) => {
|
|
4659
4680
|
if (!hasChildren(el))
|
|
4660
4681
|
return;
|
|
4661
|
-
el.children
|
|
4682
|
+
for (const child of el.children) {
|
|
4662
4683
|
child.next = child.prev = child.parent = null;
|
|
4663
|
-
}
|
|
4684
|
+
}
|
|
4664
4685
|
const textNode = new Text(`${str}`);
|
|
4665
4686
|
update(textNode, el);
|
|
4666
4687
|
});
|
|
4667
4688
|
}
|
|
4668
4689
|
function clone() {
|
|
4669
|
-
|
|
4690
|
+
const clone2 = Array.prototype.map.call(this.get(), (el) => cloneNode(el, true));
|
|
4691
|
+
const root2 = new Document$1(clone2);
|
|
4692
|
+
for (const node of clone2) {
|
|
4693
|
+
node.parent = root2;
|
|
4694
|
+
}
|
|
4695
|
+
return this._make(clone2);
|
|
4670
4696
|
}
|
|
4671
4697
|
const Manipulation = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4672
4698
|
__proto__: null,
|
|
@@ -4716,9 +4742,11 @@
|
|
|
4716
4742
|
}
|
|
4717
4743
|
el.attribs["style"] = stringify$1(styles2);
|
|
4718
4744
|
} else if (typeof prop2 === "object") {
|
|
4719
|
-
Object.keys(prop2)
|
|
4745
|
+
const keys = Object.keys(prop2);
|
|
4746
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4747
|
+
const k = keys[i];
|
|
4720
4748
|
setCss(el, k, prop2[k], i);
|
|
4721
|
-
}
|
|
4749
|
+
}
|
|
4722
4750
|
}
|
|
4723
4751
|
}
|
|
4724
4752
|
function getCss(el, prop2) {
|
|
@@ -4730,11 +4758,11 @@
|
|
|
4730
4758
|
}
|
|
4731
4759
|
if (Array.isArray(prop2)) {
|
|
4732
4760
|
const newStyles = {};
|
|
4733
|
-
|
|
4761
|
+
for (const item of prop2) {
|
|
4734
4762
|
if (styles2[item] != null) {
|
|
4735
4763
|
newStyles[item] = styles2[item];
|
|
4736
4764
|
}
|
|
4737
|
-
}
|
|
4765
|
+
}
|
|
4738
4766
|
return newStyles;
|
|
4739
4767
|
}
|
|
4740
4768
|
return styles2;
|
|
@@ -4784,7 +4812,6 @@
|
|
|
4784
4812
|
}).filter(
|
|
4785
4813
|
// Verify elements have a name (`attr.name`) and are not disabled (`:enabled`)
|
|
4786
4814
|
'[name!=""]:enabled:not(:submit, :button, :image, :reset, :file):matches([checked], :not(:checkbox, :radio))'
|
|
4787
|
-
// Convert each of the elements to its value(s)
|
|
4788
4815
|
).map((_, elem) => {
|
|
4789
4816
|
var _a2;
|
|
4790
4817
|
const $elem = this._make(elem);
|
|
@@ -4807,6 +4834,36 @@
|
|
|
4807
4834
|
serialize,
|
|
4808
4835
|
serializeArray
|
|
4809
4836
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4837
|
+
function getExtractDescr(descr) {
|
|
4838
|
+
var _a2;
|
|
4839
|
+
if (typeof descr === "string") {
|
|
4840
|
+
return { selector: descr, value: "textContent" };
|
|
4841
|
+
}
|
|
4842
|
+
return {
|
|
4843
|
+
selector: descr.selector,
|
|
4844
|
+
value: (_a2 = descr.value) !== null && _a2 !== void 0 ? _a2 : "textContent"
|
|
4845
|
+
};
|
|
4846
|
+
}
|
|
4847
|
+
function extract(map2) {
|
|
4848
|
+
const ret = {};
|
|
4849
|
+
for (const key in map2) {
|
|
4850
|
+
const descr = map2[key];
|
|
4851
|
+
const isArray = Array.isArray(descr);
|
|
4852
|
+
const { selector, value } = getExtractDescr(isArray ? descr[0] : descr);
|
|
4853
|
+
const fn = typeof value === "function" ? value : typeof value === "string" ? (el) => this._make(el).prop(value) : (el) => this._make(el).extract(value);
|
|
4854
|
+
if (isArray) {
|
|
4855
|
+
ret[key] = this._findBySelector(selector, Number.POSITIVE_INFINITY).map((_, el) => fn(el, key, ret)).get();
|
|
4856
|
+
} else {
|
|
4857
|
+
const $2 = this._findBySelector(selector, 1);
|
|
4858
|
+
ret[key] = $2.length > 0 ? fn($2[0], key, ret) : void 0;
|
|
4859
|
+
}
|
|
4860
|
+
}
|
|
4861
|
+
return ret;
|
|
4862
|
+
}
|
|
4863
|
+
const Extract = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4864
|
+
__proto__: null,
|
|
4865
|
+
extract
|
|
4866
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4810
4867
|
class Cheerio {
|
|
4811
4868
|
/**
|
|
4812
4869
|
* Instance of cheerio. Methods are specified in the modules. Usage of this
|
|
@@ -4832,13 +4889,13 @@
|
|
|
4832
4889
|
Cheerio.prototype.cheerio = "[cheerio object]";
|
|
4833
4890
|
Cheerio.prototype.splice = Array.prototype.splice;
|
|
4834
4891
|
Cheerio.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
|
|
4835
|
-
Object.assign(Cheerio.prototype, Attributes, Traversing, Manipulation, Css, Forms);
|
|
4892
|
+
Object.assign(Cheerio.prototype, Attributes, Traversing, Manipulation, Css, Forms, Extract);
|
|
4836
4893
|
function getLoad(parse2, render2) {
|
|
4837
4894
|
return function load2(content, options, isDocument2 = true) {
|
|
4838
4895
|
if (content == null) {
|
|
4839
4896
|
throw new Error("cheerio.load() expects a string");
|
|
4840
4897
|
}
|
|
4841
|
-
const internalOpts =
|
|
4898
|
+
const internalOpts = flattenOptions(options);
|
|
4842
4899
|
const initialRoot = parse2(content, internalOpts, isDocument2, null);
|
|
4843
4900
|
class LoadedCheerio extends Cheerio {
|
|
4844
4901
|
_make(selector, context) {
|
|
@@ -4856,10 +4913,7 @@
|
|
|
4856
4913
|
function initialize(selector, context, root2 = initialRoot, opts) {
|
|
4857
4914
|
if (selector && isCheerio(selector))
|
|
4858
4915
|
return selector;
|
|
4859
|
-
const options2 =
|
|
4860
|
-
...internalOpts,
|
|
4861
|
-
...flatten(opts)
|
|
4862
|
-
};
|
|
4916
|
+
const options2 = flattenOptions(opts, internalOpts);
|
|
4863
4917
|
const r = typeof root2 === "string" ? [parse2(root2, options2, false, null)] : "length" in root2 ? root2 : [root2];
|
|
4864
4918
|
const rootInstance = isCheerio(r) ? r : new LoadedCheerio(r, null, options2);
|
|
4865
4919
|
rootInstance._root = rootInstance;
|
|
@@ -4881,25 +4935,25 @@
|
|
|
4881
4935
|
return instance;
|
|
4882
4936
|
}
|
|
4883
4937
|
if (typeof selector !== "string") {
|
|
4884
|
-
throw new
|
|
4938
|
+
throw new TypeError("Unexpected type of selector");
|
|
4885
4939
|
}
|
|
4886
4940
|
let search = selector;
|
|
4887
|
-
const searchContext =
|
|
4941
|
+
const searchContext = context ? (
|
|
4888
4942
|
// If we don't have a context, maybe we have a root, from loading
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
);
|
|
4943
|
+
typeof context === "string" ? isHtml(context) ? (
|
|
4944
|
+
// $('li', '<ul>...</ul>')
|
|
4945
|
+
new LoadedCheerio([parse2(context, options2, false, null)], rootInstance, options2)
|
|
4946
|
+
) : (
|
|
4947
|
+
// $('li', 'ul')
|
|
4948
|
+
(search = `${context} ${search}`, rootInstance)
|
|
4949
|
+
) : isCheerio(context) ? (
|
|
4950
|
+
// $('li', $)
|
|
4951
|
+
context
|
|
4952
|
+
) : (
|
|
4953
|
+
// $('li', node), $('li', [nodes])
|
|
4954
|
+
new LoadedCheerio(Array.isArray(context) ? context : [context], rootInstance, options2)
|
|
4955
|
+
)
|
|
4956
|
+
) : rootInstance;
|
|
4903
4957
|
if (!searchContext)
|
|
4904
4958
|
return instance;
|
|
4905
4959
|
return searchContext.find(search);
|
|
@@ -8448,8 +8502,7 @@
|
|
|
8448
8502
|
//------------------------------------------------------------------
|
|
8449
8503
|
_stateNamedCharacterReference(cp) {
|
|
8450
8504
|
const matchResult = this._matchNamedCharacterReference(cp);
|
|
8451
|
-
if (this._ensureHibernation())
|
|
8452
|
-
;
|
|
8505
|
+
if (this._ensureHibernation()) ;
|
|
8453
8506
|
else if (matchResult) {
|
|
8454
8507
|
for (let i = 0; i < matchResult.length; i++) {
|
|
8455
8508
|
this._flushCodePointConsumedAsCharacterReference(matchResult[i]);
|
|
@@ -12729,12 +12782,12 @@
|
|
|
12729
12782
|
}
|
|
12730
12783
|
};
|
|
12731
12784
|
function parseWithParse5(content, options, isDocument2, context) {
|
|
12732
|
-
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
}
|
|
12737
|
-
return isDocument2 ? parse$2(content,
|
|
12785
|
+
var _a2;
|
|
12786
|
+
(_a2 = options.treeAdapter) !== null && _a2 !== void 0 ? _a2 : options.treeAdapter = adapter;
|
|
12787
|
+
if (options.scriptingEnabled !== false) {
|
|
12788
|
+
options.scriptingEnabled = true;
|
|
12789
|
+
}
|
|
12790
|
+
return isDocument2 ? parse$2(content, options) : parseFragment(context, content, options);
|
|
12738
12791
|
}
|
|
12739
12792
|
const renderOpts = { treeAdapter: adapter };
|
|
12740
12793
|
function renderWithParse5(dom) {
|
|
@@ -12806,13 +12859,10 @@
|
|
|
12806
12859
|
State2[State2["InSpecialComment"] = 20] = "InSpecialComment";
|
|
12807
12860
|
State2[State2["InCommentLike"] = 21] = "InCommentLike";
|
|
12808
12861
|
State2[State2["BeforeSpecialS"] = 22] = "BeforeSpecialS";
|
|
12809
|
-
State2[State2["
|
|
12810
|
-
State2[State2["
|
|
12811
|
-
State2[State2["
|
|
12812
|
-
State2[State2["
|
|
12813
|
-
State2[State2["InNamedEntity"] = 27] = "InNamedEntity";
|
|
12814
|
-
State2[State2["InNumericEntity"] = 28] = "InNumericEntity";
|
|
12815
|
-
State2[State2["InHexEntity"] = 29] = "InHexEntity";
|
|
12862
|
+
State2[State2["BeforeSpecialT"] = 23] = "BeforeSpecialT";
|
|
12863
|
+
State2[State2["SpecialStartSequence"] = 24] = "SpecialStartSequence";
|
|
12864
|
+
State2[State2["InSpecialTag"] = 25] = "InSpecialTag";
|
|
12865
|
+
State2[State2["InEntity"] = 26] = "InEntity";
|
|
12816
12866
|
})(State || (State = {}));
|
|
12817
12867
|
function isWhitespace(c) {
|
|
12818
12868
|
return c === CharCodes.Space || c === CharCodes.NewLine || c === CharCodes.Tab || c === CharCodes.FormFeed || c === CharCodes.CarriageReturn;
|
|
@@ -12820,15 +12870,9 @@
|
|
|
12820
12870
|
function isEndOfTagSection(c) {
|
|
12821
12871
|
return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace(c);
|
|
12822
12872
|
}
|
|
12823
|
-
function isNumber(c) {
|
|
12824
|
-
return c >= CharCodes.Zero && c <= CharCodes.Nine;
|
|
12825
|
-
}
|
|
12826
12873
|
function isASCIIAlpha(c) {
|
|
12827
12874
|
return c >= CharCodes.LowerA && c <= CharCodes.LowerZ || c >= CharCodes.UpperA && c <= CharCodes.UpperZ;
|
|
12828
12875
|
}
|
|
12829
|
-
function isHexDigit(c) {
|
|
12830
|
-
return c >= CharCodes.UpperA && c <= CharCodes.UpperF || c >= CharCodes.LowerA && c <= CharCodes.LowerF;
|
|
12831
|
-
}
|
|
12832
12876
|
var QuoteType;
|
|
12833
12877
|
(function(QuoteType2) {
|
|
12834
12878
|
QuoteType2[QuoteType2["NoValue"] = 0] = "NoValue";
|
|
@@ -12838,12 +12882,30 @@
|
|
|
12838
12882
|
})(QuoteType || (QuoteType = {}));
|
|
12839
12883
|
const Sequences = {
|
|
12840
12884
|
Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
|
|
12885
|
+
// CDATA[
|
|
12841
12886
|
CdataEnd: new Uint8Array([93, 93, 62]),
|
|
12887
|
+
// ]]>
|
|
12842
12888
|
CommentEnd: new Uint8Array([45, 45, 62]),
|
|
12889
|
+
// `-->`
|
|
12843
12890
|
ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
|
|
12891
|
+
// `<\/script`
|
|
12844
12892
|
StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
|
|
12845
|
-
|
|
12893
|
+
// `</style`
|
|
12894
|
+
TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
|
|
12846
12895
|
// `</title`
|
|
12896
|
+
TextareaEnd: new Uint8Array([
|
|
12897
|
+
60,
|
|
12898
|
+
47,
|
|
12899
|
+
116,
|
|
12900
|
+
101,
|
|
12901
|
+
120,
|
|
12902
|
+
116,
|
|
12903
|
+
97,
|
|
12904
|
+
114,
|
|
12905
|
+
101,
|
|
12906
|
+
97
|
|
12907
|
+
])
|
|
12908
|
+
// `</textarea`
|
|
12847
12909
|
};
|
|
12848
12910
|
class Tokenizer {
|
|
12849
12911
|
constructor({ xmlMode = false, decodeEntities = true }, cbs) {
|
|
@@ -12852,19 +12914,16 @@
|
|
|
12852
12914
|
this.buffer = "";
|
|
12853
12915
|
this.sectionStart = 0;
|
|
12854
12916
|
this.index = 0;
|
|
12917
|
+
this.entityStart = 0;
|
|
12855
12918
|
this.baseState = State.Text;
|
|
12856
12919
|
this.isSpecial = false;
|
|
12857
12920
|
this.running = true;
|
|
12858
12921
|
this.offset = 0;
|
|
12859
12922
|
this.currentSequence = void 0;
|
|
12860
12923
|
this.sequenceIndex = 0;
|
|
12861
|
-
this.trieIndex = 0;
|
|
12862
|
-
this.trieCurrent = 0;
|
|
12863
|
-
this.entityResult = 0;
|
|
12864
|
-
this.entityExcess = 0;
|
|
12865
12924
|
this.xmlMode = xmlMode;
|
|
12866
12925
|
this.decodeEntities = decodeEntities;
|
|
12867
|
-
this.
|
|
12926
|
+
this.entityDecoder = new EntityDecoder(xmlMode ? xmlDecodeTree : htmlDecodeTree, (cp, consumed) => this.emitCodePoint(cp, consumed));
|
|
12868
12927
|
}
|
|
12869
12928
|
reset() {
|
|
12870
12929
|
this.state = State.Text;
|
|
@@ -12894,18 +12953,6 @@
|
|
|
12894
12953
|
this.parse();
|
|
12895
12954
|
}
|
|
12896
12955
|
}
|
|
12897
|
-
/**
|
|
12898
|
-
* The current index within all of the written data.
|
|
12899
|
-
*/
|
|
12900
|
-
getIndex() {
|
|
12901
|
-
return this.index;
|
|
12902
|
-
}
|
|
12903
|
-
/**
|
|
12904
|
-
* The start of the current section.
|
|
12905
|
-
*/
|
|
12906
|
-
getSectionStart() {
|
|
12907
|
-
return this.sectionStart;
|
|
12908
|
-
}
|
|
12909
12956
|
stateText(c) {
|
|
12910
12957
|
if (c === CharCodes.Lt || !this.decodeEntities && this.fastForwardTo(CharCodes.Lt)) {
|
|
12911
12958
|
if (this.index > this.sectionStart) {
|
|
@@ -12914,7 +12961,7 @@
|
|
|
12914
12961
|
this.state = State.BeforeTagName;
|
|
12915
12962
|
this.sectionStart = this.index;
|
|
12916
12963
|
} else if (this.decodeEntities && c === CharCodes.Amp) {
|
|
12917
|
-
this.
|
|
12964
|
+
this.startEntity();
|
|
12918
12965
|
}
|
|
12919
12966
|
}
|
|
12920
12967
|
stateSpecialStartSequence(c) {
|
|
@@ -12959,7 +13006,7 @@
|
|
|
12959
13006
|
} else if (this.sequenceIndex === 0) {
|
|
12960
13007
|
if (this.currentSequence === Sequences.TitleEnd) {
|
|
12961
13008
|
if (this.decodeEntities && c === CharCodes.Amp) {
|
|
12962
|
-
this.
|
|
13009
|
+
this.startEntity();
|
|
12963
13010
|
}
|
|
12964
13011
|
} else if (this.fastForwardTo(CharCodes.Lt)) {
|
|
12965
13012
|
this.sequenceIndex = 1;
|
|
@@ -13050,10 +13097,14 @@
|
|
|
13050
13097
|
} else if (this.isTagStartChar(c)) {
|
|
13051
13098
|
const lower = c | 32;
|
|
13052
13099
|
this.sectionStart = this.index;
|
|
13053
|
-
if (
|
|
13054
|
-
this.
|
|
13100
|
+
if (this.xmlMode) {
|
|
13101
|
+
this.state = State.InTagName;
|
|
13102
|
+
} else if (lower === Sequences.ScriptEnd[2]) {
|
|
13103
|
+
this.state = State.BeforeSpecialS;
|
|
13104
|
+
} else if (lower === Sequences.TitleEnd[2]) {
|
|
13105
|
+
this.state = State.BeforeSpecialT;
|
|
13055
13106
|
} else {
|
|
13056
|
-
this.state =
|
|
13107
|
+
this.state = State.InTagName;
|
|
13057
13108
|
}
|
|
13058
13109
|
} else if (c === CharCodes.Slash) {
|
|
13059
13110
|
this.state = State.BeforeClosingTagName;
|
|
@@ -13071,8 +13122,7 @@
|
|
|
13071
13122
|
}
|
|
13072
13123
|
}
|
|
13073
13124
|
stateBeforeClosingTagName(c) {
|
|
13074
|
-
if (isWhitespace(c))
|
|
13075
|
-
;
|
|
13125
|
+
if (isWhitespace(c)) ;
|
|
13076
13126
|
else if (c === CharCodes.Gt) {
|
|
13077
13127
|
this.state = State.Text;
|
|
13078
13128
|
} else {
|
|
@@ -13091,7 +13141,6 @@
|
|
|
13091
13141
|
stateAfterClosingTagName(c) {
|
|
13092
13142
|
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
|
|
13093
13143
|
this.state = State.Text;
|
|
13094
|
-
this.baseState = State.Text;
|
|
13095
13144
|
this.sectionStart = this.index + 1;
|
|
13096
13145
|
}
|
|
13097
13146
|
}
|
|
@@ -13104,7 +13153,6 @@
|
|
|
13104
13153
|
} else {
|
|
13105
13154
|
this.state = State.Text;
|
|
13106
13155
|
}
|
|
13107
|
-
this.baseState = this.state;
|
|
13108
13156
|
this.sectionStart = this.index + 1;
|
|
13109
13157
|
} else if (c === CharCodes.Slash) {
|
|
13110
13158
|
this.state = State.InSelfClosingTag;
|
|
@@ -13117,7 +13165,6 @@
|
|
|
13117
13165
|
if (c === CharCodes.Gt) {
|
|
13118
13166
|
this.cbs.onselfclosingtag(this.index);
|
|
13119
13167
|
this.state = State.Text;
|
|
13120
|
-
this.baseState = State.Text;
|
|
13121
13168
|
this.sectionStart = this.index + 1;
|
|
13122
13169
|
this.isSpecial = false;
|
|
13123
13170
|
} else if (!isWhitespace(c)) {
|
|
@@ -13128,7 +13175,7 @@
|
|
|
13128
13175
|
stateInAttributeName(c) {
|
|
13129
13176
|
if (c === CharCodes.Eq || isEndOfTagSection(c)) {
|
|
13130
13177
|
this.cbs.onattribname(this.sectionStart, this.index);
|
|
13131
|
-
this.sectionStart =
|
|
13178
|
+
this.sectionStart = this.index;
|
|
13132
13179
|
this.state = State.AfterAttributeName;
|
|
13133
13180
|
this.stateAfterAttributeName(c);
|
|
13134
13181
|
}
|
|
@@ -13137,11 +13184,12 @@
|
|
|
13137
13184
|
if (c === CharCodes.Eq) {
|
|
13138
13185
|
this.state = State.BeforeAttributeValue;
|
|
13139
13186
|
} else if (c === CharCodes.Slash || c === CharCodes.Gt) {
|
|
13140
|
-
this.cbs.onattribend(QuoteType.NoValue, this.
|
|
13187
|
+
this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
|
|
13188
|
+
this.sectionStart = -1;
|
|
13141
13189
|
this.state = State.BeforeAttributeName;
|
|
13142
13190
|
this.stateBeforeAttributeName(c);
|
|
13143
13191
|
} else if (!isWhitespace(c)) {
|
|
13144
|
-
this.cbs.onattribend(QuoteType.NoValue, this.
|
|
13192
|
+
this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
|
|
13145
13193
|
this.state = State.InAttributeName;
|
|
13146
13194
|
this.sectionStart = this.index;
|
|
13147
13195
|
}
|
|
@@ -13163,11 +13211,10 @@
|
|
|
13163
13211
|
if (c === quote || !this.decodeEntities && this.fastForwardTo(quote)) {
|
|
13164
13212
|
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
13165
13213
|
this.sectionStart = -1;
|
|
13166
|
-
this.cbs.onattribend(quote === CharCodes.DoubleQuote ? QuoteType.Double : QuoteType.Single, this.index);
|
|
13214
|
+
this.cbs.onattribend(quote === CharCodes.DoubleQuote ? QuoteType.Double : QuoteType.Single, this.index + 1);
|
|
13167
13215
|
this.state = State.BeforeAttributeName;
|
|
13168
13216
|
} else if (this.decodeEntities && c === CharCodes.Amp) {
|
|
13169
|
-
this.
|
|
13170
|
-
this.state = State.BeforeEntity;
|
|
13217
|
+
this.startEntity();
|
|
13171
13218
|
}
|
|
13172
13219
|
}
|
|
13173
13220
|
stateInAttributeValueDoubleQuotes(c) {
|
|
@@ -13184,8 +13231,7 @@
|
|
|
13184
13231
|
this.state = State.BeforeAttributeName;
|
|
13185
13232
|
this.stateBeforeAttributeName(c);
|
|
13186
13233
|
} else if (this.decodeEntities && c === CharCodes.Amp) {
|
|
13187
|
-
this.
|
|
13188
|
-
this.state = State.BeforeEntity;
|
|
13234
|
+
this.startEntity();
|
|
13189
13235
|
}
|
|
13190
13236
|
}
|
|
13191
13237
|
stateBeforeDeclaration(c) {
|
|
@@ -13238,127 +13284,34 @@
|
|
|
13238
13284
|
this.stateInTagName(c);
|
|
13239
13285
|
}
|
|
13240
13286
|
}
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
;
|
|
13248
|
-
else {
|
|
13249
|
-
this.trieIndex = 0;
|
|
13250
|
-
this.trieCurrent = this.entityTrie[0];
|
|
13251
|
-
this.state = State.InNamedEntity;
|
|
13252
|
-
this.stateInNamedEntity(c);
|
|
13253
|
-
}
|
|
13254
|
-
}
|
|
13255
|
-
stateInNamedEntity(c) {
|
|
13256
|
-
this.entityExcess += 1;
|
|
13257
|
-
this.trieIndex = determineBranch(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);
|
|
13258
|
-
if (this.trieIndex < 0) {
|
|
13259
|
-
this.emitNamedEntity();
|
|
13260
|
-
this.index--;
|
|
13261
|
-
return;
|
|
13262
|
-
}
|
|
13263
|
-
this.trieCurrent = this.entityTrie[this.trieIndex];
|
|
13264
|
-
const masked = this.trieCurrent & BinTrieFlags.VALUE_LENGTH;
|
|
13265
|
-
if (masked) {
|
|
13266
|
-
const valueLength = (masked >> 14) - 1;
|
|
13267
|
-
if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {
|
|
13268
|
-
this.trieIndex += valueLength;
|
|
13269
|
-
} else {
|
|
13270
|
-
const entityStart = this.index - this.entityExcess + 1;
|
|
13271
|
-
if (entityStart > this.sectionStart) {
|
|
13272
|
-
this.emitPartial(this.sectionStart, entityStart);
|
|
13273
|
-
}
|
|
13274
|
-
this.entityResult = this.trieIndex;
|
|
13275
|
-
this.trieIndex += valueLength;
|
|
13276
|
-
this.entityExcess = 0;
|
|
13277
|
-
this.sectionStart = this.index + 1;
|
|
13278
|
-
if (valueLength === 0) {
|
|
13279
|
-
this.emitNamedEntity();
|
|
13280
|
-
}
|
|
13281
|
-
}
|
|
13282
|
-
}
|
|
13283
|
-
}
|
|
13284
|
-
emitNamedEntity() {
|
|
13285
|
-
this.state = this.baseState;
|
|
13286
|
-
if (this.entityResult === 0) {
|
|
13287
|
-
return;
|
|
13288
|
-
}
|
|
13289
|
-
const valueLength = (this.entityTrie[this.entityResult] & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
13290
|
-
switch (valueLength) {
|
|
13291
|
-
case 1: {
|
|
13292
|
-
this.emitCodePoint(this.entityTrie[this.entityResult] & ~BinTrieFlags.VALUE_LENGTH);
|
|
13293
|
-
break;
|
|
13294
|
-
}
|
|
13295
|
-
case 2: {
|
|
13296
|
-
this.emitCodePoint(this.entityTrie[this.entityResult + 1]);
|
|
13297
|
-
break;
|
|
13298
|
-
}
|
|
13299
|
-
case 3: {
|
|
13300
|
-
this.emitCodePoint(this.entityTrie[this.entityResult + 1]);
|
|
13301
|
-
this.emitCodePoint(this.entityTrie[this.entityResult + 2]);
|
|
13302
|
-
}
|
|
13303
|
-
}
|
|
13304
|
-
}
|
|
13305
|
-
stateBeforeNumericEntity(c) {
|
|
13306
|
-
if ((c | 32) === CharCodes.LowerX) {
|
|
13307
|
-
this.entityExcess++;
|
|
13308
|
-
this.state = State.InHexEntity;
|
|
13287
|
+
stateBeforeSpecialT(c) {
|
|
13288
|
+
const lower = c | 32;
|
|
13289
|
+
if (lower === Sequences.TitleEnd[3]) {
|
|
13290
|
+
this.startSpecial(Sequences.TitleEnd, 4);
|
|
13291
|
+
} else if (lower === Sequences.TextareaEnd[3]) {
|
|
13292
|
+
this.startSpecial(Sequences.TextareaEnd, 4);
|
|
13309
13293
|
} else {
|
|
13310
|
-
this.state = State.
|
|
13311
|
-
this.
|
|
13294
|
+
this.state = State.InTagName;
|
|
13295
|
+
this.stateInTagName(c);
|
|
13312
13296
|
}
|
|
13313
13297
|
}
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13319
|
-
this.emitPartial(this.sectionStart, entityStart);
|
|
13320
|
-
}
|
|
13321
|
-
this.sectionStart = this.index + Number(strict);
|
|
13322
|
-
this.emitCodePoint(replaceCodePoint(this.entityResult));
|
|
13323
|
-
}
|
|
13324
|
-
this.state = this.baseState;
|
|
13298
|
+
startEntity() {
|
|
13299
|
+
this.baseState = this.state;
|
|
13300
|
+
this.state = State.InEntity;
|
|
13301
|
+
this.entityStart = this.index;
|
|
13302
|
+
this.entityDecoder.startEntity(this.xmlMode ? DecodingMode.Strict : this.baseState === State.Text || this.baseState === State.InSpecialTag ? DecodingMode.Legacy : DecodingMode.Attribute);
|
|
13325
13303
|
}
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
} else {
|
|
13333
|
-
if (this.allowLegacyEntity()) {
|
|
13334
|
-
this.emitNumericEntity(false);
|
|
13335
|
-
} else {
|
|
13336
|
-
this.state = this.baseState;
|
|
13304
|
+
stateInEntity() {
|
|
13305
|
+
const length = this.entityDecoder.write(this.buffer, this.index - this.offset);
|
|
13306
|
+
if (length >= 0) {
|
|
13307
|
+
this.state = this.baseState;
|
|
13308
|
+
if (length === 0) {
|
|
13309
|
+
this.index = this.entityStart;
|
|
13337
13310
|
}
|
|
13338
|
-
this.index--;
|
|
13339
|
-
}
|
|
13340
|
-
}
|
|
13341
|
-
stateInHexEntity(c) {
|
|
13342
|
-
if (c === CharCodes.Semi) {
|
|
13343
|
-
this.emitNumericEntity(true);
|
|
13344
|
-
} else if (isNumber(c)) {
|
|
13345
|
-
this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);
|
|
13346
|
-
this.entityExcess++;
|
|
13347
|
-
} else if (isHexDigit(c)) {
|
|
13348
|
-
this.entityResult = this.entityResult * 16 + ((c | 32) - CharCodes.LowerA + 10);
|
|
13349
|
-
this.entityExcess++;
|
|
13350
13311
|
} else {
|
|
13351
|
-
|
|
13352
|
-
this.emitNumericEntity(false);
|
|
13353
|
-
} else {
|
|
13354
|
-
this.state = this.baseState;
|
|
13355
|
-
}
|
|
13356
|
-
this.index--;
|
|
13312
|
+
this.index = this.offset + this.buffer.length - 1;
|
|
13357
13313
|
}
|
|
13358
13314
|
}
|
|
13359
|
-
allowLegacyEntity() {
|
|
13360
|
-
return !this.xmlMode && (this.baseState === State.Text || this.baseState === State.InSpecialTag);
|
|
13361
|
-
}
|
|
13362
13315
|
/**
|
|
13363
13316
|
* Remove data that has already been consumed from the buffer.
|
|
13364
13317
|
*/
|
|
@@ -13457,6 +13410,10 @@
|
|
|
13457
13410
|
this.stateBeforeSpecialS(c);
|
|
13458
13411
|
break;
|
|
13459
13412
|
}
|
|
13413
|
+
case State.BeforeSpecialT: {
|
|
13414
|
+
this.stateBeforeSpecialT(c);
|
|
13415
|
+
break;
|
|
13416
|
+
}
|
|
13460
13417
|
case State.InAttributeValueNq: {
|
|
13461
13418
|
this.stateInAttributeValueNoQuotes(c);
|
|
13462
13419
|
break;
|
|
@@ -13481,70 +13438,55 @@
|
|
|
13481
13438
|
this.stateInProcessingInstruction(c);
|
|
13482
13439
|
break;
|
|
13483
13440
|
}
|
|
13484
|
-
case State.
|
|
13485
|
-
this.
|
|
13441
|
+
case State.InEntity: {
|
|
13442
|
+
this.stateInEntity();
|
|
13486
13443
|
break;
|
|
13487
13444
|
}
|
|
13488
|
-
case State.BeforeEntity: {
|
|
13489
|
-
this.stateBeforeEntity(c);
|
|
13490
|
-
break;
|
|
13491
|
-
}
|
|
13492
|
-
case State.InHexEntity: {
|
|
13493
|
-
this.stateInHexEntity(c);
|
|
13494
|
-
break;
|
|
13495
|
-
}
|
|
13496
|
-
case State.InNumericEntity: {
|
|
13497
|
-
this.stateInNumericEntity(c);
|
|
13498
|
-
break;
|
|
13499
|
-
}
|
|
13500
|
-
default: {
|
|
13501
|
-
this.stateBeforeNumericEntity(c);
|
|
13502
|
-
}
|
|
13503
13445
|
}
|
|
13504
13446
|
this.index++;
|
|
13505
13447
|
}
|
|
13506
13448
|
this.cleanup();
|
|
13507
13449
|
}
|
|
13508
13450
|
finish() {
|
|
13509
|
-
if (this.state === State.
|
|
13510
|
-
this.
|
|
13511
|
-
|
|
13512
|
-
if (this.sectionStart < this.index) {
|
|
13513
|
-
this.handleTrailingData();
|
|
13451
|
+
if (this.state === State.InEntity) {
|
|
13452
|
+
this.entityDecoder.end();
|
|
13453
|
+
this.state = this.baseState;
|
|
13514
13454
|
}
|
|
13455
|
+
this.handleTrailingData();
|
|
13515
13456
|
this.cbs.onend();
|
|
13516
13457
|
}
|
|
13517
13458
|
/** Handle any trailing data. */
|
|
13518
13459
|
handleTrailingData() {
|
|
13519
13460
|
const endIndex = this.buffer.length + this.offset;
|
|
13461
|
+
if (this.sectionStart >= endIndex) {
|
|
13462
|
+
return;
|
|
13463
|
+
}
|
|
13520
13464
|
if (this.state === State.InCommentLike) {
|
|
13521
13465
|
if (this.currentSequence === Sequences.CdataEnd) {
|
|
13522
13466
|
this.cbs.oncdata(this.sectionStart, endIndex, 0);
|
|
13523
13467
|
} else {
|
|
13524
13468
|
this.cbs.oncomment(this.sectionStart, endIndex, 0);
|
|
13525
13469
|
}
|
|
13526
|
-
} else if (this.state === State.
|
|
13527
|
-
this.emitNumericEntity(false);
|
|
13528
|
-
} else if (this.state === State.InHexEntity && this.allowLegacyEntity()) {
|
|
13529
|
-
this.emitNumericEntity(false);
|
|
13530
|
-
} else if (this.state === State.InTagName || this.state === State.BeforeAttributeName || this.state === State.BeforeAttributeValue || this.state === State.AfterAttributeName || this.state === State.InAttributeName || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueDq || this.state === State.InAttributeValueNq || this.state === State.InClosingTagName)
|
|
13531
|
-
;
|
|
13470
|
+
} else if (this.state === State.InTagName || this.state === State.BeforeAttributeName || this.state === State.BeforeAttributeValue || this.state === State.AfterAttributeName || this.state === State.InAttributeName || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueDq || this.state === State.InAttributeValueNq || this.state === State.InClosingTagName) ;
|
|
13532
13471
|
else {
|
|
13533
13472
|
this.cbs.ontext(this.sectionStart, endIndex);
|
|
13534
13473
|
}
|
|
13535
13474
|
}
|
|
13536
|
-
|
|
13537
|
-
if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) {
|
|
13538
|
-
this.cbs.onattribdata(start, endIndex);
|
|
13539
|
-
} else {
|
|
13540
|
-
this.cbs.ontext(start, endIndex);
|
|
13541
|
-
}
|
|
13542
|
-
}
|
|
13543
|
-
emitCodePoint(cp) {
|
|
13475
|
+
emitCodePoint(cp, consumed) {
|
|
13544
13476
|
if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) {
|
|
13477
|
+
if (this.sectionStart < this.entityStart) {
|
|
13478
|
+
this.cbs.onattribdata(this.sectionStart, this.entityStart);
|
|
13479
|
+
}
|
|
13480
|
+
this.sectionStart = this.entityStart + consumed;
|
|
13481
|
+
this.index = this.sectionStart - 1;
|
|
13545
13482
|
this.cbs.onattribentity(cp);
|
|
13546
13483
|
} else {
|
|
13547
|
-
this.
|
|
13484
|
+
if (this.sectionStart < this.entityStart) {
|
|
13485
|
+
this.cbs.ontext(this.sectionStart, this.entityStart);
|
|
13486
|
+
}
|
|
13487
|
+
this.sectionStart = this.entityStart + consumed;
|
|
13488
|
+
this.index = this.sectionStart - 1;
|
|
13489
|
+
this.cbs.ontextentity(cp, this.sectionStart);
|
|
13548
13490
|
}
|
|
13549
13491
|
}
|
|
13550
13492
|
}
|
|
@@ -13646,7 +13588,7 @@
|
|
|
13646
13588
|
const reNameEnd = /\s|\//;
|
|
13647
13589
|
let Parser$1 = class Parser {
|
|
13648
13590
|
constructor(cbs, options = {}) {
|
|
13649
|
-
var _a2, _b, _c, _d, _e;
|
|
13591
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
13650
13592
|
this.options = options;
|
|
13651
13593
|
this.startIndex = 0;
|
|
13652
13594
|
this.endIndex = 0;
|
|
@@ -13656,16 +13598,18 @@
|
|
|
13656
13598
|
this.attribvalue = "";
|
|
13657
13599
|
this.attribs = null;
|
|
13658
13600
|
this.stack = [];
|
|
13659
|
-
this.foreignContext = [];
|
|
13660
13601
|
this.buffers = [];
|
|
13661
13602
|
this.bufferOffset = 0;
|
|
13662
13603
|
this.writeIndex = 0;
|
|
13663
13604
|
this.ended = false;
|
|
13664
13605
|
this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};
|
|
13665
|
-
this.
|
|
13666
|
-
this.
|
|
13667
|
-
this.
|
|
13668
|
-
|
|
13606
|
+
this.htmlMode = !this.options.xmlMode;
|
|
13607
|
+
this.lowerCaseTagNames = (_a2 = options.lowerCaseTags) !== null && _a2 !== void 0 ? _a2 : this.htmlMode;
|
|
13608
|
+
this.lowerCaseAttributeNames = (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : this.htmlMode;
|
|
13609
|
+
this.recognizeSelfClosing = (_c = options.recognizeSelfClosing) !== null && _c !== void 0 ? _c : !this.htmlMode;
|
|
13610
|
+
this.tokenizer = new ((_d = options.Tokenizer) !== null && _d !== void 0 ? _d : Tokenizer)(this.options, this);
|
|
13611
|
+
this.foreignContext = [!this.htmlMode];
|
|
13612
|
+
(_f = (_e = this.cbs).onparserinit) === null || _f === void 0 ? void 0 : _f.call(_e, this);
|
|
13669
13613
|
}
|
|
13670
13614
|
// Tokenizer event handlers
|
|
13671
13615
|
/** @internal */
|
|
@@ -13677,15 +13621,18 @@
|
|
|
13677
13621
|
this.startIndex = endIndex;
|
|
13678
13622
|
}
|
|
13679
13623
|
/** @internal */
|
|
13680
|
-
ontextentity(cp) {
|
|
13624
|
+
ontextentity(cp, endIndex) {
|
|
13681
13625
|
var _a2, _b;
|
|
13682
|
-
|
|
13683
|
-
this.endIndex = index2 - 1;
|
|
13626
|
+
this.endIndex = endIndex - 1;
|
|
13684
13627
|
(_b = (_a2 = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a2, fromCodePoint$1(cp));
|
|
13685
|
-
this.startIndex =
|
|
13628
|
+
this.startIndex = endIndex;
|
|
13686
13629
|
}
|
|
13630
|
+
/**
|
|
13631
|
+
* Checks if the current tag is a void element. Override this if you want
|
|
13632
|
+
* to specify your own additional void elements.
|
|
13633
|
+
*/
|
|
13687
13634
|
isVoidElement(name2) {
|
|
13688
|
-
return
|
|
13635
|
+
return this.htmlMode && voidElements.has(name2);
|
|
13689
13636
|
}
|
|
13690
13637
|
/** @internal */
|
|
13691
13638
|
onopentagname(start, endIndex) {
|
|
@@ -13700,19 +13647,21 @@
|
|
|
13700
13647
|
var _a2, _b, _c, _d;
|
|
13701
13648
|
this.openTagStart = this.startIndex;
|
|
13702
13649
|
this.tagname = name2;
|
|
13703
|
-
const impliesClose =
|
|
13650
|
+
const impliesClose = this.htmlMode && openImpliesClose.get(name2);
|
|
13704
13651
|
if (impliesClose) {
|
|
13705
|
-
while (this.stack.length > 0 && impliesClose.has(this.stack[
|
|
13706
|
-
const element = this.stack.
|
|
13652
|
+
while (this.stack.length > 0 && impliesClose.has(this.stack[0])) {
|
|
13653
|
+
const element = this.stack.shift();
|
|
13707
13654
|
(_b = (_a2 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a2, element, true);
|
|
13708
13655
|
}
|
|
13709
13656
|
}
|
|
13710
13657
|
if (!this.isVoidElement(name2)) {
|
|
13711
|
-
this.stack.
|
|
13712
|
-
if (
|
|
13713
|
-
|
|
13714
|
-
|
|
13715
|
-
|
|
13658
|
+
this.stack.unshift(name2);
|
|
13659
|
+
if (this.htmlMode) {
|
|
13660
|
+
if (foreignContextElements.has(name2)) {
|
|
13661
|
+
this.foreignContext.unshift(true);
|
|
13662
|
+
} else if (htmlIntegrationElements.has(name2)) {
|
|
13663
|
+
this.foreignContext.unshift(false);
|
|
13664
|
+
}
|
|
13716
13665
|
}
|
|
13717
13666
|
}
|
|
13718
13667
|
(_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name2);
|
|
@@ -13739,40 +13688,37 @@
|
|
|
13739
13688
|
}
|
|
13740
13689
|
/** @internal */
|
|
13741
13690
|
onclosetag(start, endIndex) {
|
|
13742
|
-
var _a2, _b, _c, _d, _e, _f;
|
|
13691
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
13743
13692
|
this.endIndex = endIndex;
|
|
13744
13693
|
let name2 = this.getSlice(start, endIndex);
|
|
13745
13694
|
if (this.lowerCaseTagNames) {
|
|
13746
13695
|
name2 = name2.toLowerCase();
|
|
13747
13696
|
}
|
|
13748
|
-
if (foreignContextElements.has(name2) || htmlIntegrationElements.has(name2)) {
|
|
13749
|
-
this.foreignContext.
|
|
13697
|
+
if (this.htmlMode && (foreignContextElements.has(name2) || htmlIntegrationElements.has(name2))) {
|
|
13698
|
+
this.foreignContext.shift();
|
|
13750
13699
|
}
|
|
13751
13700
|
if (!this.isVoidElement(name2)) {
|
|
13752
|
-
const pos = this.stack.
|
|
13701
|
+
const pos = this.stack.indexOf(name2);
|
|
13753
13702
|
if (pos !== -1) {
|
|
13754
|
-
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
} else
|
|
13760
|
-
this.stack.length = pos;
|
|
13761
|
-
} else if (!this.options.xmlMode && name2 === "p") {
|
|
13703
|
+
for (let index2 = 0; index2 <= pos; index2++) {
|
|
13704
|
+
const element = this.stack.shift();
|
|
13705
|
+
(_b = (_a2 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a2, element, index2 !== pos);
|
|
13706
|
+
}
|
|
13707
|
+
} else if (this.htmlMode && name2 === "p") {
|
|
13762
13708
|
this.emitOpenTag("p");
|
|
13763
13709
|
this.closeCurrentTag(true);
|
|
13764
13710
|
}
|
|
13765
|
-
} else if (
|
|
13766
|
-
(
|
|
13767
|
-
(
|
|
13768
|
-
(
|
|
13711
|
+
} else if (this.htmlMode && name2 === "br") {
|
|
13712
|
+
(_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, "br");
|
|
13713
|
+
(_f = (_e = this.cbs).onopentag) === null || _f === void 0 ? void 0 : _f.call(_e, "br", {}, true);
|
|
13714
|
+
(_h = (_g = this.cbs).onclosetag) === null || _h === void 0 ? void 0 : _h.call(_g, "br", false);
|
|
13769
13715
|
}
|
|
13770
13716
|
this.startIndex = endIndex + 1;
|
|
13771
13717
|
}
|
|
13772
13718
|
/** @internal */
|
|
13773
13719
|
onselfclosingtag(endIndex) {
|
|
13774
13720
|
this.endIndex = endIndex;
|
|
13775
|
-
if (this.
|
|
13721
|
+
if (this.recognizeSelfClosing || this.foreignContext[0]) {
|
|
13776
13722
|
this.closeCurrentTag(false);
|
|
13777
13723
|
this.startIndex = endIndex + 1;
|
|
13778
13724
|
} else {
|
|
@@ -13783,9 +13729,9 @@
|
|
|
13783
13729
|
var _a2, _b;
|
|
13784
13730
|
const name2 = this.tagname;
|
|
13785
13731
|
this.endOpenTag(isOpenImplied);
|
|
13786
|
-
if (this.stack[
|
|
13732
|
+
if (this.stack[0] === name2) {
|
|
13787
13733
|
(_b = (_a2 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a2, name2, !isOpenImplied);
|
|
13788
|
-
this.stack.
|
|
13734
|
+
this.stack.shift();
|
|
13789
13735
|
}
|
|
13790
13736
|
}
|
|
13791
13737
|
/** @internal */
|
|
@@ -13853,7 +13799,7 @@
|
|
|
13853
13799
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
13854
13800
|
this.endIndex = endIndex;
|
|
13855
13801
|
const value = this.getSlice(start, endIndex - offset);
|
|
13856
|
-
if (this.
|
|
13802
|
+
if (!this.htmlMode || this.options.recognizeCDATA) {
|
|
13857
13803
|
(_b = (_a2 = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a2);
|
|
13858
13804
|
(_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);
|
|
13859
13805
|
(_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);
|
|
@@ -13868,8 +13814,9 @@
|
|
|
13868
13814
|
var _a2, _b;
|
|
13869
13815
|
if (this.cbs.onclosetag) {
|
|
13870
13816
|
this.endIndex = this.startIndex;
|
|
13871
|
-
for (let index2 =
|
|
13872
|
-
;
|
|
13817
|
+
for (let index2 = 0; index2 < this.stack.length; index2++) {
|
|
13818
|
+
this.cbs.onclosetag(this.stack[index2], true);
|
|
13819
|
+
}
|
|
13873
13820
|
}
|
|
13874
13821
|
(_b = (_a2 = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a2);
|
|
13875
13822
|
}
|
|
@@ -13888,6 +13835,8 @@
|
|
|
13888
13835
|
this.endIndex = 0;
|
|
13889
13836
|
(_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);
|
|
13890
13837
|
this.buffers.length = 0;
|
|
13838
|
+
this.foreignContext.length = 0;
|
|
13839
|
+
this.foreignContext.unshift(!this.htmlMode);
|
|
13891
13840
|
this.bufferOffset = 0;
|
|
13892
13841
|
this.writeIndex = 0;
|
|
13893
13842
|
this.ended = false;
|
|
@@ -13992,9 +13941,8 @@
|
|
|
13992
13941
|
new Parser$1(handler, options).end(data2);
|
|
13993
13942
|
return handler.root;
|
|
13994
13943
|
}
|
|
13995
|
-
const parse$1 = getParse((content, options, isDocument2, context) => options.
|
|
13996
|
-
const load = getLoad(parse$1, (dom, options) => options.
|
|
13997
|
-
load([]);
|
|
13944
|
+
const parse$1 = getParse((content, options, isDocument2, context) => options._useHtmlParser2 ? parseDocument$1(content, options) : parseWithParse5(content, options, isDocument2, context));
|
|
13945
|
+
const load = getLoad(parse$1, (dom, options) => options._useHtmlParser2 ? render$1(dom, options) : renderWithParse5(dom));
|
|
13998
13946
|
const defaultSelectorRules = {
|
|
13999
13947
|
"div,p": ({ $node }) => ({
|
|
14000
13948
|
queue: $node.children()
|
|
@@ -14014,8 +13962,7 @@
|
|
|
14014
13962
|
} else {
|
|
14015
13963
|
let $contents = $node.contents();
|
|
14016
13964
|
const i = $contents.index(queue);
|
|
14017
|
-
if (i >= 0)
|
|
14018
|
-
$contents = $contents.slice(0, i);
|
|
13965
|
+
if (i >= 0) $contents = $contents.slice(0, i);
|
|
14019
13966
|
content = getContent($contents);
|
|
14020
13967
|
}
|
|
14021
13968
|
return {
|
|
@@ -14037,12 +13984,9 @@
|
|
|
14037
13984
|
const SELECTOR_LIST = /^[uo]l$/;
|
|
14038
13985
|
const SELECTOR_LIST_ITEM = /^li$/;
|
|
14039
13986
|
function getLevel(tagName) {
|
|
14040
|
-
if (SELECTOR_HEADING.test(tagName))
|
|
14041
|
-
|
|
14042
|
-
if (
|
|
14043
|
-
return 8;
|
|
14044
|
-
if (SELECTOR_LIST_ITEM.test(tagName))
|
|
14045
|
-
return 9;
|
|
13987
|
+
if (SELECTOR_HEADING.test(tagName)) return +tagName[1];
|
|
13988
|
+
if (SELECTOR_LIST.test(tagName)) return 8;
|
|
13989
|
+
if (SELECTOR_LIST_ITEM.test(tagName)) return 9;
|
|
14046
13990
|
return 7;
|
|
14047
13991
|
}
|
|
14048
13992
|
function parseHtml(html2, opts) {
|
|
@@ -14141,13 +14085,21 @@
|
|
|
14141
14085
|
}
|
|
14142
14086
|
return;
|
|
14143
14087
|
}
|
|
14144
|
-
if (skippingHeading > 0 && level > skippingHeading)
|
|
14145
|
-
|
|
14146
|
-
if (!$child.is(options.selector))
|
|
14147
|
-
return;
|
|
14088
|
+
if (skippingHeading > 0 && level > skippingHeading) return;
|
|
14089
|
+
if (!$child.is(options.selector)) return;
|
|
14148
14090
|
skippingHeading = 0;
|
|
14149
14091
|
const isHeading = level <= 6;
|
|
14150
14092
|
let data2 = $child.data();
|
|
14093
|
+
let html22 = result.html || "";
|
|
14094
|
+
if ($child.is("ol>li") && (node == null ? void 0 : node.children)) {
|
|
14095
|
+
const start = +($child.parent().attr("start") || 1);
|
|
14096
|
+
const listIndex = start + node.children.length;
|
|
14097
|
+
html22 = `${listIndex}. ${html22}`;
|
|
14098
|
+
data2 = {
|
|
14099
|
+
...data2,
|
|
14100
|
+
listIndex
|
|
14101
|
+
};
|
|
14102
|
+
}
|
|
14151
14103
|
if ($child.children("code:only-child").length) {
|
|
14152
14104
|
data2 = {
|
|
14153
14105
|
...data2,
|
|
@@ -14159,14 +14111,12 @@
|
|
|
14159
14111
|
nesting: !!result.queue || isHeading,
|
|
14160
14112
|
tagName: child.tagName,
|
|
14161
14113
|
level,
|
|
14162
|
-
html:
|
|
14114
|
+
html: html22,
|
|
14163
14115
|
comments: result.comments,
|
|
14164
14116
|
data: data2
|
|
14165
14117
|
});
|
|
14166
|
-
if (isHeading)
|
|
14167
|
-
|
|
14168
|
-
if (result.queue)
|
|
14169
|
-
checkNodes(result.queue, childNode);
|
|
14118
|
+
if (isHeading) headingStack.push(childNode);
|
|
14119
|
+
if (result.queue) checkNodes(result.queue, childNode);
|
|
14170
14120
|
});
|
|
14171
14121
|
}
|
|
14172
14122
|
}
|
|
@@ -14390,8 +14340,7 @@
|
|
|
14390
14340
|
"file:": true
|
|
14391
14341
|
};
|
|
14392
14342
|
function urlParse(url, slashesDenoteHost) {
|
|
14393
|
-
if (url && url instanceof Url)
|
|
14394
|
-
return url;
|
|
14343
|
+
if (url && url instanceof Url) return url;
|
|
14395
14344
|
const u = new Url();
|
|
14396
14345
|
u.parse(url, slashesDenoteHost);
|
|
14397
14346
|
return u;
|
|
@@ -15526,10 +15475,8 @@
|
|
|
15526
15475
|
lastChar = text2.charCodeAt(t.index - 1);
|
|
15527
15476
|
} else {
|
|
15528
15477
|
for (j = i - 1; j >= 0; j--) {
|
|
15529
|
-
if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak")
|
|
15530
|
-
|
|
15531
|
-
if (!tokens[j].content)
|
|
15532
|
-
continue;
|
|
15478
|
+
if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
|
|
15479
|
+
if (!tokens[j].content) continue;
|
|
15533
15480
|
lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
|
|
15534
15481
|
break;
|
|
15535
15482
|
}
|
|
@@ -15539,10 +15486,8 @@
|
|
|
15539
15486
|
nextChar = text2.charCodeAt(pos);
|
|
15540
15487
|
} else {
|
|
15541
15488
|
for (j = i + 1; j < tokens.length; j++) {
|
|
15542
|
-
if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak")
|
|
15543
|
-
|
|
15544
|
-
if (!tokens[j].content)
|
|
15545
|
-
continue;
|
|
15489
|
+
if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
|
|
15490
|
+
if (!tokens[j].content) continue;
|
|
15546
15491
|
nextChar = tokens[j].content.charCodeAt(0);
|
|
15547
15492
|
break;
|
|
15548
15493
|
}
|
|
@@ -15643,8 +15588,7 @@
|
|
|
15643
15588
|
const blockTokens = state.tokens;
|
|
15644
15589
|
const l = blockTokens.length;
|
|
15645
15590
|
for (let j = 0; j < l; j++) {
|
|
15646
|
-
if (blockTokens[j].type !== "inline")
|
|
15647
|
-
continue;
|
|
15591
|
+
if (blockTokens[j].type !== "inline") continue;
|
|
15648
15592
|
const tokens = blockTokens[j].children;
|
|
15649
15593
|
const max = tokens.length;
|
|
15650
15594
|
for (curr = 0; curr < max; curr++) {
|
|
@@ -15750,11 +15694,9 @@
|
|
|
15750
15694
|
StateBlock.prototype.push = function(type, tag, nesting) {
|
|
15751
15695
|
const token = new Token(type, tag, nesting);
|
|
15752
15696
|
token.block = true;
|
|
15753
|
-
if (nesting < 0)
|
|
15754
|
-
this.level--;
|
|
15697
|
+
if (nesting < 0) this.level--;
|
|
15755
15698
|
token.level = this.level;
|
|
15756
|
-
if (nesting > 0)
|
|
15757
|
-
this.level++;
|
|
15699
|
+
if (nesting > 0) this.level++;
|
|
15758
15700
|
this.tokens.push(token);
|
|
15759
15701
|
return token;
|
|
15760
15702
|
};
|
|
@@ -15946,10 +15888,8 @@
|
|
|
15946
15888
|
return false;
|
|
15947
15889
|
}
|
|
15948
15890
|
columns = escapedSplit(lineText);
|
|
15949
|
-
if (columns.length && columns[0] === "")
|
|
15950
|
-
|
|
15951
|
-
if (columns.length && columns[columns.length - 1] === "")
|
|
15952
|
-
columns.pop();
|
|
15891
|
+
if (columns.length && columns[0] === "") columns.shift();
|
|
15892
|
+
if (columns.length && columns[columns.length - 1] === "") columns.pop();
|
|
15953
15893
|
const columnCount = columns.length;
|
|
15954
15894
|
if (columnCount === 0 || columnCount !== aligns.length) {
|
|
15955
15895
|
return false;
|
|
@@ -16003,10 +15943,8 @@
|
|
|
16003
15943
|
break;
|
|
16004
15944
|
}
|
|
16005
15945
|
columns = escapedSplit(lineText);
|
|
16006
|
-
if (columns.length && columns[0] === "")
|
|
16007
|
-
|
|
16008
|
-
if (columns.length && columns[columns.length - 1] === "")
|
|
16009
|
-
columns.pop();
|
|
15946
|
+
if (columns.length && columns[0] === "") columns.shift();
|
|
15947
|
+
if (columns.length && columns[columns.length - 1] === "") columns.pop();
|
|
16010
15948
|
autocompletedCells += columnCount - columns.length;
|
|
16011
15949
|
if (autocompletedCells > MAX_AUTOCOMPLETED_CELLS) {
|
|
16012
15950
|
break;
|
|
@@ -16368,16 +16306,14 @@
|
|
|
16368
16306
|
isOrdered = true;
|
|
16369
16307
|
start = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
16370
16308
|
markerValue = Number(state.src.slice(start, posAfterMarker - 1));
|
|
16371
|
-
if (isTerminatingParagraph && markerValue !== 1)
|
|
16372
|
-
return false;
|
|
16309
|
+
if (isTerminatingParagraph && markerValue !== 1) return false;
|
|
16373
16310
|
} else if ((posAfterMarker = skipBulletListMarker(state, nextLine)) >= 0) {
|
|
16374
16311
|
isOrdered = false;
|
|
16375
16312
|
} else {
|
|
16376
16313
|
return false;
|
|
16377
16314
|
}
|
|
16378
16315
|
if (isTerminatingParagraph) {
|
|
16379
|
-
if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine])
|
|
16380
|
-
return false;
|
|
16316
|
+
if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine]) return false;
|
|
16381
16317
|
}
|
|
16382
16318
|
if (silent) {
|
|
16383
16319
|
return true;
|
|
@@ -16592,8 +16528,7 @@
|
|
|
16592
16528
|
max = str.length;
|
|
16593
16529
|
nextLine++;
|
|
16594
16530
|
}
|
|
16595
|
-
} else if (isSpace(ch))
|
|
16596
|
-
;
|
|
16531
|
+
} else if (isSpace(ch)) ;
|
|
16597
16532
|
else {
|
|
16598
16533
|
break;
|
|
16599
16534
|
}
|
|
@@ -16619,8 +16554,7 @@
|
|
|
16619
16554
|
max = str.length;
|
|
16620
16555
|
nextLine++;
|
|
16621
16556
|
}
|
|
16622
|
-
} else if (isSpace(ch))
|
|
16623
|
-
;
|
|
16557
|
+
} else if (isSpace(ch)) ;
|
|
16624
16558
|
else {
|
|
16625
16559
|
break;
|
|
16626
16560
|
}
|
|
@@ -16628,8 +16562,7 @@
|
|
|
16628
16562
|
let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
|
|
16629
16563
|
while (titleRes.can_continue) {
|
|
16630
16564
|
const lineContent = getNextLine(nextLine);
|
|
16631
|
-
if (lineContent === null)
|
|
16632
|
-
break;
|
|
16565
|
+
if (lineContent === null) break;
|
|
16633
16566
|
str += lineContent;
|
|
16634
16567
|
pos = max;
|
|
16635
16568
|
max = str.length;
|
|
@@ -17004,8 +16937,7 @@
|
|
|
17004
16937
|
break;
|
|
17005
16938
|
}
|
|
17006
16939
|
}
|
|
17007
|
-
if (!ok)
|
|
17008
|
-
throw new Error("none of the block rules matched");
|
|
16940
|
+
if (!ok) throw new Error("none of the block rules matched");
|
|
17009
16941
|
state.tight = !hasEmptyLines;
|
|
17010
16942
|
if (state.isEmpty(state.line - 1)) {
|
|
17011
16943
|
hasEmptyLines = true;
|
|
@@ -17141,34 +17073,24 @@
|
|
|
17141
17073
|
}
|
|
17142
17074
|
const SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
|
|
17143
17075
|
function linkify(state, silent) {
|
|
17144
|
-
if (!state.md.options.linkify)
|
|
17145
|
-
|
|
17146
|
-
if (state.linkLevel > 0)
|
|
17147
|
-
return false;
|
|
17076
|
+
if (!state.md.options.linkify) return false;
|
|
17077
|
+
if (state.linkLevel > 0) return false;
|
|
17148
17078
|
const pos = state.pos;
|
|
17149
17079
|
const max = state.posMax;
|
|
17150
|
-
if (pos + 3 > max)
|
|
17151
|
-
|
|
17152
|
-
if (state.src.charCodeAt(pos) !==
|
|
17153
|
-
|
|
17154
|
-
if (state.src.charCodeAt(pos + 1) !== 47)
|
|
17155
|
-
return false;
|
|
17156
|
-
if (state.src.charCodeAt(pos + 2) !== 47)
|
|
17157
|
-
return false;
|
|
17080
|
+
if (pos + 3 > max) return false;
|
|
17081
|
+
if (state.src.charCodeAt(pos) !== 58) return false;
|
|
17082
|
+
if (state.src.charCodeAt(pos + 1) !== 47) return false;
|
|
17083
|
+
if (state.src.charCodeAt(pos + 2) !== 47) return false;
|
|
17158
17084
|
const match = state.pending.match(SCHEME_RE);
|
|
17159
|
-
if (!match)
|
|
17160
|
-
return false;
|
|
17085
|
+
if (!match) return false;
|
|
17161
17086
|
const proto = match[1];
|
|
17162
17087
|
const link2 = state.md.linkify.matchAtStart(state.src.slice(pos - proto.length));
|
|
17163
|
-
if (!link2)
|
|
17164
|
-
return false;
|
|
17088
|
+
if (!link2) return false;
|
|
17165
17089
|
let url = link2.url;
|
|
17166
|
-
if (url.length <= proto.length)
|
|
17167
|
-
return false;
|
|
17090
|
+
if (url.length <= proto.length) return false;
|
|
17168
17091
|
url = url.replace(/\*+$/, "");
|
|
17169
17092
|
const fullUrl = state.md.normalizeLink(url);
|
|
17170
|
-
if (!state.md.validateLink(fullUrl))
|
|
17171
|
-
return false;
|
|
17093
|
+
if (!state.md.validateLink(fullUrl)) return false;
|
|
17172
17094
|
if (!silent) {
|
|
17173
17095
|
state.pending = state.pending.slice(0, -proto.length);
|
|
17174
17096
|
const token_o = state.push("link_open", "a", 1);
|
|
@@ -17195,8 +17117,7 @@
|
|
|
17195
17117
|
if (pmax >= 0 && state.pending.charCodeAt(pmax) === 32) {
|
|
17196
17118
|
if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 32) {
|
|
17197
17119
|
let ws = pmax - 1;
|
|
17198
|
-
while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 32)
|
|
17199
|
-
ws--;
|
|
17120
|
+
while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 32) ws--;
|
|
17200
17121
|
state.pending = state.pending.slice(0, ws);
|
|
17201
17122
|
state.push("hardbreak", "br", 0);
|
|
17202
17123
|
} else {
|
|
@@ -17224,11 +17145,9 @@
|
|
|
17224
17145
|
function escape(state, silent) {
|
|
17225
17146
|
let pos = state.pos;
|
|
17226
17147
|
const max = state.posMax;
|
|
17227
|
-
if (state.src.charCodeAt(pos) !== 92)
|
|
17228
|
-
return false;
|
|
17148
|
+
if (state.src.charCodeAt(pos) !== 92) return false;
|
|
17229
17149
|
pos++;
|
|
17230
|
-
if (pos >= max)
|
|
17231
|
-
return false;
|
|
17150
|
+
if (pos >= max) return false;
|
|
17232
17151
|
let ch1 = state.src.charCodeAt(pos);
|
|
17233
17152
|
if (ch1 === 10) {
|
|
17234
17153
|
if (!silent) {
|
|
@@ -17237,8 +17156,7 @@
|
|
|
17237
17156
|
pos++;
|
|
17238
17157
|
while (pos < max) {
|
|
17239
17158
|
ch1 = state.src.charCodeAt(pos);
|
|
17240
|
-
if (!isSpace(ch1))
|
|
17241
|
-
break;
|
|
17159
|
+
if (!isSpace(ch1)) break;
|
|
17242
17160
|
pos++;
|
|
17243
17161
|
}
|
|
17244
17162
|
state.pos = pos;
|
|
@@ -17281,8 +17199,7 @@
|
|
|
17281
17199
|
const marker = state.src.slice(start, pos);
|
|
17282
17200
|
const openerLength = marker.length;
|
|
17283
17201
|
if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
|
|
17284
|
-
if (!silent)
|
|
17285
|
-
state.pending += marker;
|
|
17202
|
+
if (!silent) state.pending += marker;
|
|
17286
17203
|
state.pos += openerLength;
|
|
17287
17204
|
return true;
|
|
17288
17205
|
}
|
|
@@ -17306,8 +17223,7 @@
|
|
|
17306
17223
|
state.backticks[closerLength] = matchStart;
|
|
17307
17224
|
}
|
|
17308
17225
|
state.backticksScanned = true;
|
|
17309
|
-
if (!silent)
|
|
17310
|
-
state.pending += marker;
|
|
17226
|
+
if (!silent) state.pending += marker;
|
|
17311
17227
|
state.pos += openerLength;
|
|
17312
17228
|
return true;
|
|
17313
17229
|
}
|
|
@@ -17717,13 +17633,10 @@
|
|
|
17717
17633
|
const start = state.pos;
|
|
17718
17634
|
const max = state.posMax;
|
|
17719
17635
|
for (; ; ) {
|
|
17720
|
-
if (++pos >= max)
|
|
17721
|
-
return false;
|
|
17636
|
+
if (++pos >= max) return false;
|
|
17722
17637
|
const ch = state.src.charCodeAt(pos);
|
|
17723
|
-
if (ch === 60)
|
|
17724
|
-
|
|
17725
|
-
if (ch === 62)
|
|
17726
|
-
break;
|
|
17638
|
+
if (ch === 60) return false;
|
|
17639
|
+
if (ch === 62) break;
|
|
17727
17640
|
}
|
|
17728
17641
|
const url = state.src.slice(start + 1, pos);
|
|
17729
17642
|
if (AUTOLINK_RE.test(url)) {
|
|
@@ -17796,10 +17709,8 @@
|
|
|
17796
17709
|
if (!silent) {
|
|
17797
17710
|
const token = state.push("html_inline", "", 0);
|
|
17798
17711
|
token.content = match[0];
|
|
17799
|
-
if (isLinkOpen(token.content))
|
|
17800
|
-
|
|
17801
|
-
if (isLinkClose(token.content))
|
|
17802
|
-
state.linkLevel--;
|
|
17712
|
+
if (isLinkOpen(token.content)) state.linkLevel++;
|
|
17713
|
+
if (isLinkClose(token.content)) state.linkLevel--;
|
|
17803
17714
|
}
|
|
17804
17715
|
state.pos += match[0].length;
|
|
17805
17716
|
return true;
|
|
@@ -17809,10 +17720,8 @@
|
|
|
17809
17720
|
function entity(state, silent) {
|
|
17810
17721
|
const pos = state.pos;
|
|
17811
17722
|
const max = state.posMax;
|
|
17812
|
-
if (state.src.charCodeAt(pos) !== 38)
|
|
17813
|
-
|
|
17814
|
-
if (pos + 1 >= max)
|
|
17815
|
-
return false;
|
|
17723
|
+
if (state.src.charCodeAt(pos) !== 38) return false;
|
|
17724
|
+
if (pos + 1 >= max) return false;
|
|
17816
17725
|
const ch = state.src.charCodeAt(pos + 1);
|
|
17817
17726
|
if (ch === 35) {
|
|
17818
17727
|
const match = state.src.slice(pos).match(DIGITAL_RE);
|
|
@@ -17848,8 +17757,7 @@
|
|
|
17848
17757
|
function processDelimiters(delimiters) {
|
|
17849
17758
|
const openersBottom = {};
|
|
17850
17759
|
const max = delimiters.length;
|
|
17851
|
-
if (!max)
|
|
17852
|
-
return;
|
|
17760
|
+
if (!max) return;
|
|
17853
17761
|
let headerIdx = 0;
|
|
17854
17762
|
let lastTokenIdx = -2;
|
|
17855
17763
|
const jumps = [];
|
|
@@ -17861,8 +17769,7 @@
|
|
|
17861
17769
|
}
|
|
17862
17770
|
lastTokenIdx = closer.token;
|
|
17863
17771
|
closer.length = closer.length || 0;
|
|
17864
|
-
if (!closer.close)
|
|
17865
|
-
continue;
|
|
17772
|
+
if (!closer.close) continue;
|
|
17866
17773
|
if (!openersBottom.hasOwnProperty(closer.marker)) {
|
|
17867
17774
|
openersBottom[closer.marker] = [-1, -1, -1, -1, -1, -1];
|
|
17868
17775
|
}
|
|
@@ -17871,8 +17778,7 @@
|
|
|
17871
17778
|
let newMinOpenerIdx = openerIdx;
|
|
17872
17779
|
for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {
|
|
17873
17780
|
const opener = delimiters[openerIdx];
|
|
17874
|
-
if (opener.marker !== closer.marker)
|
|
17875
|
-
continue;
|
|
17781
|
+
if (opener.marker !== closer.marker) continue;
|
|
17876
17782
|
if (opener.open && opener.end < 0) {
|
|
17877
17783
|
let isOddMatch = false;
|
|
17878
17784
|
if (opener.close || closer.open) {
|
|
@@ -17916,11 +17822,9 @@
|
|
|
17916
17822
|
const tokens = state.tokens;
|
|
17917
17823
|
const max = state.tokens.length;
|
|
17918
17824
|
for (curr = last2 = 0; curr < max; curr++) {
|
|
17919
|
-
if (tokens[curr].nesting < 0)
|
|
17920
|
-
level--;
|
|
17825
|
+
if (tokens[curr].nesting < 0) level--;
|
|
17921
17826
|
tokens[curr].level = level;
|
|
17922
|
-
if (tokens[curr].nesting > 0)
|
|
17923
|
-
level++;
|
|
17827
|
+
if (tokens[curr].nesting > 0) level++;
|
|
17924
17828
|
if (tokens[curr].type === "text" && curr + 1 < max && tokens[curr + 1].type === "text") {
|
|
17925
17829
|
tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
|
|
17926
17830
|
} else {
|
|
@@ -18394,14 +18298,11 @@
|
|
|
18394
18298
|
LinkifyIt.prototype.matchAtStart = function matchAtStart(text2) {
|
|
18395
18299
|
this.__text_cache__ = text2;
|
|
18396
18300
|
this.__index__ = -1;
|
|
18397
|
-
if (!text2.length)
|
|
18398
|
-
return null;
|
|
18301
|
+
if (!text2.length) return null;
|
|
18399
18302
|
const m = this.re.schema_at_start.exec(text2);
|
|
18400
|
-
if (!m)
|
|
18401
|
-
return null;
|
|
18303
|
+
if (!m) return null;
|
|
18402
18304
|
const len = this.testSchemaAt(text2, m[2], m[0].length);
|
|
18403
|
-
if (!len)
|
|
18404
|
-
return null;
|
|
18305
|
+
if (!len) return null;
|
|
18405
18306
|
this.__schema__ = m[2];
|
|
18406
18307
|
this.__index__ = m.index + m[1].length;
|
|
18407
18308
|
this.__last_index__ = m.index + m[0].length + len;
|
|
@@ -19321,7 +19222,6 @@
|
|
|
19321
19222
|
return {};
|
|
19322
19223
|
}
|
|
19323
19224
|
});
|
|
19324
|
-
const pluginCheckbox = plugin$3;
|
|
19325
19225
|
const ALIAS = Symbol.for("yaml.alias");
|
|
19326
19226
|
const DOC = Symbol.for("yaml.document");
|
|
19327
19227
|
const MAP = Symbol.for("yaml.map");
|
|
@@ -22776,19 +22676,18 @@ ${pointer}
|
|
|
22776
22676
|
onError(props.start, "MISSING_CHAR", `Missing , between ${fcName} items`);
|
|
22777
22677
|
if (props.comment) {
|
|
22778
22678
|
let prevItemComment = "";
|
|
22779
|
-
loop:
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22786
|
-
|
|
22787
|
-
|
|
22788
|
-
|
|
22789
|
-
break loop;
|
|
22790
|
-
}
|
|
22679
|
+
loop: for (const st of start) {
|
|
22680
|
+
switch (st.type) {
|
|
22681
|
+
case "comma":
|
|
22682
|
+
case "space":
|
|
22683
|
+
break;
|
|
22684
|
+
case "comment":
|
|
22685
|
+
prevItemComment = st.source.substring(1);
|
|
22686
|
+
break loop;
|
|
22687
|
+
default:
|
|
22688
|
+
break loop;
|
|
22791
22689
|
}
|
|
22690
|
+
}
|
|
22792
22691
|
if (prevItemComment) {
|
|
22793
22692
|
let prev2 = coll.items[coll.items.length - 1];
|
|
22794
22693
|
if (isPair(prev2))
|
|
@@ -24147,27 +24046,26 @@ ${end2.comment}` : end2.comment;
|
|
|
24147
24046
|
let nl = this.pos - 1;
|
|
24148
24047
|
let indent = 0;
|
|
24149
24048
|
let ch;
|
|
24150
|
-
loop:
|
|
24151
|
-
|
|
24152
|
-
|
|
24153
|
-
|
|
24154
|
-
|
|
24155
|
-
|
|
24156
|
-
|
|
24157
|
-
|
|
24158
|
-
|
|
24049
|
+
loop: for (let i2 = this.pos; ch = this.buffer[i2]; ++i2) {
|
|
24050
|
+
switch (ch) {
|
|
24051
|
+
case " ":
|
|
24052
|
+
indent += 1;
|
|
24053
|
+
break;
|
|
24054
|
+
case "\n":
|
|
24055
|
+
nl = i2;
|
|
24056
|
+
indent = 0;
|
|
24057
|
+
break;
|
|
24058
|
+
case "\r": {
|
|
24059
|
+
const next2 = this.buffer[i2 + 1];
|
|
24060
|
+
if (!next2 && !this.atEnd)
|
|
24061
|
+
return this.setNext("block-scalar");
|
|
24062
|
+
if (next2 === "\n")
|
|
24159
24063
|
break;
|
|
24160
|
-
case "\r": {
|
|
24161
|
-
const next2 = this.buffer[i2 + 1];
|
|
24162
|
-
if (!next2 && !this.atEnd)
|
|
24163
|
-
return this.setNext("block-scalar");
|
|
24164
|
-
if (next2 === "\n")
|
|
24165
|
-
break;
|
|
24166
|
-
}
|
|
24167
|
-
default:
|
|
24168
|
-
break loop;
|
|
24169
24064
|
}
|
|
24065
|
+
default:
|
|
24066
|
+
break loop;
|
|
24170
24067
|
}
|
|
24068
|
+
}
|
|
24171
24069
|
if (!ch && !this.atEnd)
|
|
24172
24070
|
return this.setNext("block-scalar");
|
|
24173
24071
|
if (indent >= this.indentNext) {
|
|
@@ -24420,17 +24318,16 @@ ${end2.comment}` : end2.comment;
|
|
|
24420
24318
|
if (prev2.length === 0)
|
|
24421
24319
|
return [];
|
|
24422
24320
|
let i = prev2.length;
|
|
24423
|
-
loop:
|
|
24424
|
-
|
|
24425
|
-
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
break loop;
|
|
24432
|
-
}
|
|
24321
|
+
loop: while (--i >= 0) {
|
|
24322
|
+
switch (prev2[i].type) {
|
|
24323
|
+
case "doc-start":
|
|
24324
|
+
case "explicit-key-ind":
|
|
24325
|
+
case "map-value-ind":
|
|
24326
|
+
case "seq-item-ind":
|
|
24327
|
+
case "newline":
|
|
24328
|
+
break loop;
|
|
24433
24329
|
}
|
|
24330
|
+
}
|
|
24434
24331
|
while (((_a2 = prev2[++i]) == null ? void 0 : _a2.type) === "space") {
|
|
24435
24332
|
}
|
|
24436
24333
|
return prev2.splice(i, prev2.length);
|
|
@@ -25240,11 +25137,6 @@ ${end2.comment}` : end2.comment;
|
|
|
25240
25137
|
}
|
|
25241
25138
|
function parse(src, reviver, options) {
|
|
25242
25139
|
let _reviver = void 0;
|
|
25243
|
-
if (typeof reviver === "function") {
|
|
25244
|
-
_reviver = reviver;
|
|
25245
|
-
} else if (options === void 0 && reviver && typeof reviver === "object") {
|
|
25246
|
-
options = reviver;
|
|
25247
|
-
}
|
|
25248
25140
|
const doc = parseDocument(src, options);
|
|
25249
25141
|
if (!doc)
|
|
25250
25142
|
return null;
|
|
@@ -25264,11 +25156,9 @@ ${end2.comment}` : end2.comment;
|
|
|
25264
25156
|
transformHooks.beforeParse.tap((_md, context) => {
|
|
25265
25157
|
var _a2;
|
|
25266
25158
|
const { content } = context;
|
|
25267
|
-
if (!/^---\r?\n/.test(content))
|
|
25268
|
-
return;
|
|
25159
|
+
if (!/^---\r?\n/.test(content)) return;
|
|
25269
25160
|
const match = /\n---\r?\n/.exec(content);
|
|
25270
|
-
if (!match)
|
|
25271
|
-
return;
|
|
25161
|
+
if (!match) return;
|
|
25272
25162
|
const raw = content.slice(4, match.index).trimEnd();
|
|
25273
25163
|
let frontmatter;
|
|
25274
25164
|
try {
|
|
@@ -25293,29 +25183,24 @@ ${end2.comment}` : end2.comment;
|
|
|
25293
25183
|
}
|
|
25294
25184
|
});
|
|
25295
25185
|
function normalizeMarkmapJsonOptions(options) {
|
|
25296
|
-
if (!options)
|
|
25297
|
-
return;
|
|
25186
|
+
if (!options) return;
|
|
25298
25187
|
["color", "extraJs", "extraCss"].forEach((key) => {
|
|
25299
|
-
if (options[key] != null)
|
|
25300
|
-
options[key] = normalizeStringArray(options[key]);
|
|
25188
|
+
if (options[key] != null) options[key] = normalizeStringArray(options[key]);
|
|
25301
25189
|
});
|
|
25302
25190
|
["duration", "maxWidth", "initialExpandLevel"].forEach((key) => {
|
|
25303
|
-
if (options[key] != null)
|
|
25304
|
-
options[key] = normalizeNumber(options[key]);
|
|
25191
|
+
if (options[key] != null) options[key] = normalizeNumber(options[key]);
|
|
25305
25192
|
});
|
|
25306
25193
|
return options;
|
|
25307
25194
|
}
|
|
25308
25195
|
function normalizeStringArray(value) {
|
|
25309
25196
|
let result;
|
|
25310
|
-
if (typeof value === "string")
|
|
25311
|
-
result = [value];
|
|
25197
|
+
if (typeof value === "string") result = [value];
|
|
25312
25198
|
else if (Array.isArray(value))
|
|
25313
25199
|
result = value.filter((item) => item && typeof item === "string");
|
|
25314
25200
|
return (result == null ? void 0 : result.length) ? result : void 0;
|
|
25315
25201
|
}
|
|
25316
25202
|
function normalizeNumber(value) {
|
|
25317
|
-
if (isNaN(+value))
|
|
25318
|
-
return;
|
|
25203
|
+
if (isNaN(+value)) return;
|
|
25319
25204
|
return +value;
|
|
25320
25205
|
}
|
|
25321
25206
|
function patchJSItem(urlBuilder, item) {
|
|
@@ -25344,14 +25229,14 @@ ${end2.comment}` : end2.comment;
|
|
|
25344
25229
|
}
|
|
25345
25230
|
const name$3 = "hljs";
|
|
25346
25231
|
const preloadScripts$1 = [
|
|
25347
|
-
`@highlightjs/cdn-assets@${"11.
|
|
25232
|
+
`@highlightjs/cdn-assets@${"11.10.0"}/highlight.min.js`
|
|
25348
25233
|
].map((path) => buildJSItem(path));
|
|
25349
25234
|
const styles$1 = [
|
|
25350
|
-
`@highlightjs/cdn-assets@${"11.
|
|
25235
|
+
`@highlightjs/cdn-assets@${"11.10.0"}/styles/default.min.css`
|
|
25351
25236
|
].map((path) => buildCSSItem(path));
|
|
25352
25237
|
const config$1 = {
|
|
25353
25238
|
versions: {
|
|
25354
|
-
hljs: "11.
|
|
25239
|
+
hljs: "11.10.0"
|
|
25355
25240
|
},
|
|
25356
25241
|
preloadScripts: preloadScripts$1,
|
|
25357
25242
|
styles: styles$1
|
|
@@ -25395,7 +25280,6 @@ ${end2.comment}` : end2.comment;
|
|
|
25395
25280
|
};
|
|
25396
25281
|
}
|
|
25397
25282
|
});
|
|
25398
|
-
const pluginHljs = plugin$2;
|
|
25399
25283
|
var katex = require$$0;
|
|
25400
25284
|
function isValidDelim(state, pos) {
|
|
25401
25285
|
var prevChar, nextChar, max = state.posMax, can_open = true, can_close = true;
|
|
@@ -25567,18 +25451,18 @@ ${end2.comment}` : end2.comment;
|
|
|
25567
25451
|
}
|
|
25568
25452
|
const name$2 = "katex";
|
|
25569
25453
|
const preloadScripts = [
|
|
25570
|
-
`katex@${"0.16.
|
|
25454
|
+
`katex@${"0.16.11"}/dist/katex.min.js`
|
|
25571
25455
|
].map((path) => buildJSItem(path));
|
|
25572
25456
|
const webfontloader = buildJSItem(
|
|
25573
25457
|
`webfontloader@${"1.6.28"}/webfontloader.js`
|
|
25574
25458
|
);
|
|
25575
25459
|
webfontloader.data.defer = true;
|
|
25576
|
-
const styles = [`katex@${"0.16.
|
|
25460
|
+
const styles = [`katex@${"0.16.11"}/dist/katex.min.css`].map(
|
|
25577
25461
|
(path) => buildCSSItem(path)
|
|
25578
25462
|
);
|
|
25579
25463
|
const config = {
|
|
25580
25464
|
versions: {
|
|
25581
|
-
katex: "0.16.
|
|
25465
|
+
katex: "0.16.11",
|
|
25582
25466
|
webfontloader: "1.6.28"
|
|
25583
25467
|
},
|
|
25584
25468
|
preloadScripts,
|
|
@@ -25684,7 +25568,6 @@ ${end2.comment}` : end2.comment;
|
|
|
25684
25568
|
};
|
|
25685
25569
|
}
|
|
25686
25570
|
});
|
|
25687
|
-
const pluginKatex = plugin$1;
|
|
25688
25571
|
const name$1 = "npmUrl";
|
|
25689
25572
|
const pluginNpmUrl = definePlugin({
|
|
25690
25573
|
name: name$1,
|
|
@@ -25730,14 +25613,13 @@ ${end2.comment}` : end2.comment;
|
|
|
25730
25613
|
return {};
|
|
25731
25614
|
}
|
|
25732
25615
|
});
|
|
25733
|
-
const pluginSourceLines = plugin;
|
|
25734
25616
|
const plugins = [
|
|
25735
25617
|
pluginFrontmatter,
|
|
25736
|
-
|
|
25737
|
-
|
|
25618
|
+
plugin$1,
|
|
25619
|
+
plugin$2,
|
|
25738
25620
|
pluginNpmUrl,
|
|
25739
|
-
|
|
25740
|
-
|
|
25621
|
+
plugin$3,
|
|
25622
|
+
plugin
|
|
25741
25623
|
];
|
|
25742
25624
|
const builtInPlugins = plugins;
|
|
25743
25625
|
function cleanNode(node) {
|
|
@@ -25796,10 +25678,8 @@ ${end2.comment}` : end2.comment;
|
|
|
25796
25678
|
keys ?? (keys = this.plugins.map((plugin2) => plugin2.name));
|
|
25797
25679
|
for (const assets of keys.map((key) => this.assetsMap[key])) {
|
|
25798
25680
|
if (assets) {
|
|
25799
|
-
if (assets.styles)
|
|
25800
|
-
|
|
25801
|
-
if (assets.scripts)
|
|
25802
|
-
scripts.push(...assets.scripts);
|
|
25681
|
+
if (assets.styles) styles2.push(...assets.styles);
|
|
25682
|
+
if (assets.scripts) scripts.push(...assets.scripts);
|
|
25803
25683
|
}
|
|
25804
25684
|
}
|
|
25805
25685
|
return {
|
|
@@ -25816,7 +25696,7 @@ ${end2.comment}` : end2.comment;
|
|
|
25816
25696
|
}
|
|
25817
25697
|
}
|
|
25818
25698
|
const transformerVersions = {
|
|
25819
|
-
"markmap-lib": "0.17.2"
|
|
25699
|
+
"markmap-lib": "0.17.3-alpha.2"
|
|
25820
25700
|
};
|
|
25821
25701
|
exports.Transformer = Transformer;
|
|
25822
25702
|
exports.builtInPlugins = builtInPlugins;
|