@pubinfo/devtools 2.1.10 → 2.1.12
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/client/assets/{Navbar-BQK6jUhq.js → Navbar-DYyO71VR.js} +27 -3
- package/dist/client/assets/{PanelGrids-Bd6D6enp.js → PanelGrids-rTFcKhN6.js} +4 -2
- package/dist/client/assets/{SelectTabs-CTO4P53M.js → SelectTabs-Ba4fEjYh.js} +17 -2
- package/dist/client/assets/{_plugin-vue_export-helper-D8E0syuh.js → _plugin-vue_export-helper-Ctigiz3_.js} +2 -0
- package/dist/client/assets/{component-D5gKG7wj.js → component-Cy0W8Ddj.js} +39 -4
- package/dist/client/assets/{core-D6JqxgYq.js → core-CrqZ8qrs.js} +1300 -24
- package/dist/client/assets/{css-DbgpCiOq.js → css-3PrNsnPt.js} +1 -0
- package/dist/client/assets/css-mRoPUXX2.js +2 -0
- package/dist/client/assets/{engine-oniguruma-n-bafM3H.js → engine-oniguruma-C1mOz3PQ.js} +2 -0
- package/dist/client/assets/{fetch-CFHiXvGO.js → fetch-Bz1BNH1Z.js} +159 -5
- package/dist/client/assets/{html-Tu6OX5Eq.js → html-B5Ny8iin.js} +4 -2
- package/dist/client/assets/html-g0uz4re7.js +2 -0
- package/dist/client/assets/{import-w1c5mo52.js → import-gNFdeWVi.js} +33 -4
- package/dist/client/assets/index-CWvhvxM4.js +5208 -0
- package/dist/client/assets/{issue-CCThaaVh.js → issue-Yr5hL5Lv.js} +22 -3
- package/dist/client/assets/{javascript-_FvKZjd1.js → javascript-D9OtNJpI.js} +1 -0
- package/dist/client/assets/javascript-yBXmlTMV.js +2 -0
- package/dist/client/assets/json-CDHOIUIc.js +2 -0
- package/dist/client/assets/{json-CzPoZe0r.js → json-DFv6u-UA.js} +1 -0
- package/dist/client/assets/{pages-Cq5pNVp0.js → pages-CuyX8oYZ.js} +33 -9
- package/dist/client/assets/{index-D_HRlfbv.js → runtime-core.esm-bundler-CsZVtwV7.js} +153 -4755
- package/dist/client/assets/{server-router-BJdAYxdf.js → server-router-BkLhbRZZ.js} +177 -18
- package/dist/client/assets/{typescript-BEfC8S_c.js → typescript-C6a_X60d.js} +1 -0
- package/dist/client/assets/typescript-jte7_wp4.js +2 -0
- package/dist/client/assets/{vitesse-dark-Bz6RXfkV.js → vitesse-dark-Dd6LUkEf.js} +2 -0
- package/dist/client/assets/{vitesse-light-NvDlvJl2.js → vitesse-light-LEkeIfQx.js} +2 -0
- package/dist/client/assets/{vue-DZSPIjN6.js → vue-BvqQiUzU.js} +11 -5
- package/dist/client/assets/{wasm-D0Echd05.js → wasm-bCjRd0-o.js} +2 -0
- package/dist/client/index.html +2 -1
- package/package.json +3 -3
- package/dist/client/assets/css-D-vtiAqw.js +0 -2
- package/dist/client/assets/html-74krLQbR.js +0 -2
- package/dist/client/assets/javascript-QnJdw8u5.js +0 -2
- package/dist/client/assets/json-WgRhEAOB.js +0 -2
- package/dist/client/assets/typescript-C5tShSk5.js +0 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __exportAll = (all, no_symbols) => {
|
|
3
4
|
let target = {};
|
|
@@ -8,12 +9,16 @@ var __exportAll = (all, no_symbols) => {
|
|
|
8
9
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
9
10
|
return target;
|
|
10
11
|
};
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ../../node_modules/.pnpm/@shikijs+types@3.22.0/node_modules/@shikijs/types/dist/index.mjs
|
|
11
14
|
var ShikiError = class extends Error {
|
|
12
15
|
constructor(message) {
|
|
13
16
|
super(message);
|
|
14
17
|
this.name = "ShikiError";
|
|
15
18
|
}
|
|
16
19
|
};
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ../../node_modules/.pnpm/@shikijs+vscode-textmate@10.0.2/node_modules/@shikijs/vscode-textmate/dist/index.js
|
|
17
22
|
function clone(something) {
|
|
18
23
|
return doClone(something);
|
|
19
24
|
}
|
|
@@ -487,6 +492,10 @@ var EncodedTokenMetadata = class _EncodedTokenMetadata {
|
|
|
487
492
|
static getBackground(encodedTokenAttributes) {
|
|
488
493
|
return (encodedTokenAttributes & 4278190080) >>> 24;
|
|
489
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* Updates the fields in `metadata`.
|
|
497
|
+
* A value of `0`, `NotSet` or `null` indicates that the corresponding field should be left as is.
|
|
498
|
+
*/
|
|
490
499
|
static set(encodedTokenAttributes, languageId, tokenType, containsBalancedBrackets, fontStyle, foreground, background) {
|
|
491
500
|
let _languageId = _EncodedTokenMetadata.getLanguageId(encodedTokenAttributes);
|
|
492
501
|
let _tokenType = _EncodedTokenMetadata.getTokenType(encodedTokenAttributes);
|
|
@@ -1346,6 +1355,10 @@ var BasicScopeAttributesProvider = class _BasicScopeAttributesProvider {
|
|
|
1346
1355
|
_getBasicScopeAttributes = new CachedFn((scopeName) => {
|
|
1347
1356
|
return new BasicScopeAttributes(this._scopeToLanguage(scopeName), this._toStandardTokenType(scopeName));
|
|
1348
1357
|
});
|
|
1358
|
+
/**
|
|
1359
|
+
* Given a produced TM scope, return the language that token describes or null if unknown.
|
|
1360
|
+
* e.g. source.html => html, source.css.embedded.html => css, punctuation.definition.tag.html => null
|
|
1361
|
+
*/
|
|
1349
1362
|
_scopeToLanguage(scope) {
|
|
1350
1363
|
return this._embeddedLanguagesMatcher.match(scope) || 0;
|
|
1351
1364
|
}
|
|
@@ -1843,6 +1856,14 @@ function initGrammar(grammar, base) {
|
|
|
1843
1856
|
return grammar;
|
|
1844
1857
|
}
|
|
1845
1858
|
var AttributedScopeStack = class _AttributedScopeStack {
|
|
1859
|
+
/**
|
|
1860
|
+
* Invariant:
|
|
1861
|
+
* ```
|
|
1862
|
+
* if (parent && !scopePath.extends(parent.scopePath)) {
|
|
1863
|
+
* throw new Error();
|
|
1864
|
+
* }
|
|
1865
|
+
* ```
|
|
1866
|
+
*/
|
|
1846
1867
|
constructor(parent, scopePath, tokenAttributes) {
|
|
1847
1868
|
this.parent = parent;
|
|
1848
1869
|
this.scopePath = scopePath;
|
|
@@ -1927,6 +1948,17 @@ var AttributedScopeStack = class _AttributedScopeStack {
|
|
|
1927
1948
|
}
|
|
1928
1949
|
};
|
|
1929
1950
|
var StateStackImpl = class _StateStackImpl {
|
|
1951
|
+
/**
|
|
1952
|
+
* Invariant:
|
|
1953
|
+
* ```
|
|
1954
|
+
* if (contentNameScopesList !== nameScopesList && contentNameScopesList?.parent !== nameScopesList) {
|
|
1955
|
+
* throw new Error();
|
|
1956
|
+
* }
|
|
1957
|
+
* if (this.parent && !nameScopesList.extends(this.parent.contentNameScopesList)) {
|
|
1958
|
+
* throw new Error();
|
|
1959
|
+
* }
|
|
1960
|
+
* ```
|
|
1961
|
+
*/
|
|
1930
1962
|
constructor(parent, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {
|
|
1931
1963
|
this.parent = parent;
|
|
1932
1964
|
this.ruleId = ruleId;
|
|
@@ -1940,8 +1972,21 @@ var StateStackImpl = class _StateStackImpl {
|
|
|
1940
1972
|
}
|
|
1941
1973
|
_stackElementBrand = void 0;
|
|
1942
1974
|
static NULL = new _StateStackImpl(null, 0, 0, 0, false, null, null, null);
|
|
1975
|
+
/**
|
|
1976
|
+
* The position on the current line where this state was pushed.
|
|
1977
|
+
* This is relevant only while tokenizing a line, to detect endless loops.
|
|
1978
|
+
* Its value is meaningless across lines.
|
|
1979
|
+
*/
|
|
1943
1980
|
_enterPos;
|
|
1981
|
+
/**
|
|
1982
|
+
* The captured anchor position when this stack element was pushed.
|
|
1983
|
+
* This is relevant only while tokenizing a line, to restore the anchor position when popping.
|
|
1984
|
+
* Its value is meaningless across lines.
|
|
1985
|
+
*/
|
|
1944
1986
|
_anchorPos;
|
|
1987
|
+
/**
|
|
1988
|
+
* The depth of the stack.
|
|
1989
|
+
*/
|
|
1945
1990
|
depth;
|
|
1946
1991
|
equals(other) {
|
|
1947
1992
|
if (other === null) return false;
|
|
@@ -1952,6 +1997,9 @@ var StateStackImpl = class _StateStackImpl {
|
|
|
1952
1997
|
if (!this._structuralEquals(a, b)) return false;
|
|
1953
1998
|
return AttributedScopeStack.equals(a.contentNameScopesList, b.contentNameScopesList);
|
|
1954
1999
|
}
|
|
2000
|
+
/**
|
|
2001
|
+
* A structural equals check. Does not take into account `scopes`.
|
|
2002
|
+
*/
|
|
1955
2003
|
static _structuralEquals(a, b) {
|
|
1956
2004
|
do {
|
|
1957
2005
|
if (a === b) return true;
|
|
@@ -2071,8 +2119,17 @@ var LineTokens = class {
|
|
|
2071
2119
|
this._lastTokenEndIndex = 0;
|
|
2072
2120
|
}
|
|
2073
2121
|
_emitBinaryTokens;
|
|
2122
|
+
/**
|
|
2123
|
+
* defined only if `false`.
|
|
2124
|
+
*/
|
|
2074
2125
|
_lineText;
|
|
2126
|
+
/**
|
|
2127
|
+
* used only if `_emitBinaryTokens` is false.
|
|
2128
|
+
*/
|
|
2075
2129
|
_tokens;
|
|
2130
|
+
/**
|
|
2131
|
+
* used only if `_emitBinaryTokens` is true.
|
|
2132
|
+
*/
|
|
2076
2133
|
_binaryTokens;
|
|
2077
2134
|
_lastTokenEndIndex;
|
|
2078
2135
|
_tokenTypeOverrides;
|
|
@@ -2150,22 +2207,40 @@ var SyncRegistry = class {
|
|
|
2150
2207
|
getColorMap() {
|
|
2151
2208
|
return this._theme.getColorMap();
|
|
2152
2209
|
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Add `grammar` to registry and return a list of referenced scope names
|
|
2212
|
+
*/
|
|
2153
2213
|
addGrammar(grammar, injectionScopeNames) {
|
|
2154
2214
|
this._rawGrammars.set(grammar.scopeName, grammar);
|
|
2155
2215
|
if (injectionScopeNames) this._injectionGrammars.set(grammar.scopeName, injectionScopeNames);
|
|
2156
2216
|
}
|
|
2217
|
+
/**
|
|
2218
|
+
* Lookup a raw grammar.
|
|
2219
|
+
*/
|
|
2157
2220
|
lookup(scopeName) {
|
|
2158
2221
|
return this._rawGrammars.get(scopeName);
|
|
2159
2222
|
}
|
|
2223
|
+
/**
|
|
2224
|
+
* Returns the injections for the given grammar
|
|
2225
|
+
*/
|
|
2160
2226
|
injections(targetScope) {
|
|
2161
2227
|
return this._injectionGrammars.get(targetScope);
|
|
2162
2228
|
}
|
|
2229
|
+
/**
|
|
2230
|
+
* Get the default theme settings
|
|
2231
|
+
*/
|
|
2163
2232
|
getDefaults() {
|
|
2164
2233
|
return this._theme.getDefaults();
|
|
2165
2234
|
}
|
|
2235
|
+
/**
|
|
2236
|
+
* Match a scope in the theme.
|
|
2237
|
+
*/
|
|
2166
2238
|
themeMatch(scopePath) {
|
|
2167
2239
|
return this._theme.match(scopePath);
|
|
2168
2240
|
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Lookup a grammar.
|
|
2243
|
+
*/
|
|
2169
2244
|
grammarForScopeName(scopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors) {
|
|
2170
2245
|
if (!this._grammars.has(scopeName)) {
|
|
2171
2246
|
let rawGrammar = this._rawGrammars.get(scopeName);
|
|
@@ -2187,18 +2262,35 @@ var Registry$1 = class {
|
|
|
2187
2262
|
dispose() {
|
|
2188
2263
|
this._syncRegistry.dispose();
|
|
2189
2264
|
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Change the theme. Once called, no previous `ruleStack` should be used anymore.
|
|
2267
|
+
*/
|
|
2190
2268
|
setTheme(theme, colorMap) {
|
|
2191
2269
|
this._syncRegistry.setTheme(Theme.createFromRawTheme(theme, colorMap));
|
|
2192
2270
|
}
|
|
2271
|
+
/**
|
|
2272
|
+
* Returns a lookup array for color ids.
|
|
2273
|
+
*/
|
|
2193
2274
|
getColorMap() {
|
|
2194
2275
|
return this._syncRegistry.getColorMap();
|
|
2195
2276
|
}
|
|
2277
|
+
/**
|
|
2278
|
+
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
|
|
2279
|
+
* Please do not use language id 0.
|
|
2280
|
+
*/
|
|
2196
2281
|
loadGrammarWithEmbeddedLanguages(initialScopeName, initialLanguage, embeddedLanguages) {
|
|
2197
2282
|
return this.loadGrammarWithConfiguration(initialScopeName, initialLanguage, { embeddedLanguages });
|
|
2198
2283
|
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
|
|
2286
|
+
* Please do not use language id 0.
|
|
2287
|
+
*/
|
|
2199
2288
|
loadGrammarWithConfiguration(initialScopeName, initialLanguage, configuration) {
|
|
2200
2289
|
return this._loadGrammar(initialScopeName, initialLanguage, configuration.embeddedLanguages, configuration.tokenTypes, new BalancedBracketSelectors(configuration.balancedBracketSelectors || [], configuration.unbalancedBracketSelectors || []));
|
|
2201
2290
|
}
|
|
2291
|
+
/**
|
|
2292
|
+
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
|
|
2293
|
+
*/
|
|
2202
2294
|
loadGrammar(initialScopeName) {
|
|
2203
2295
|
return this._loadGrammar(initialScopeName, 0, null, null, null);
|
|
2204
2296
|
}
|
|
@@ -2223,16 +2315,29 @@ var Registry$1 = class {
|
|
|
2223
2315
|
this._syncRegistry.addGrammar(grammar, injections);
|
|
2224
2316
|
}
|
|
2225
2317
|
}
|
|
2318
|
+
/**
|
|
2319
|
+
* Adds a rawGrammar.
|
|
2320
|
+
*/
|
|
2226
2321
|
addGrammar(rawGrammar, injections = [], initialLanguage = 0, embeddedLanguages = null) {
|
|
2227
2322
|
this._syncRegistry.addGrammar(rawGrammar, injections);
|
|
2228
2323
|
return this._grammarForScopeName(rawGrammar.scopeName, initialLanguage, embeddedLanguages);
|
|
2229
2324
|
}
|
|
2325
|
+
/**
|
|
2326
|
+
* Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `addGrammar`.
|
|
2327
|
+
*/
|
|
2230
2328
|
_grammarForScopeName(scopeName, initialLanguage = 0, embeddedLanguages = null, tokenTypes = null, balancedBracketSelectors = null) {
|
|
2231
2329
|
return this._syncRegistry.grammarForScopeName(scopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors);
|
|
2232
2330
|
}
|
|
2233
2331
|
};
|
|
2234
2332
|
var INITIAL = StateStackImpl.NULL;
|
|
2235
|
-
|
|
2333
|
+
//#endregion
|
|
2334
|
+
//#region ../../node_modules/.pnpm/html-void-elements@3.0.0/node_modules/html-void-elements/index.js
|
|
2335
|
+
/**
|
|
2336
|
+
* List of HTML void tag names.
|
|
2337
|
+
*
|
|
2338
|
+
* @type {Array<string>}
|
|
2339
|
+
*/
|
|
2340
|
+
var htmlVoidElements = [
|
|
2236
2341
|
"area",
|
|
2237
2342
|
"base",
|
|
2238
2343
|
"basefont",
|
|
@@ -2254,7 +2359,23 @@ const htmlVoidElements = [
|
|
|
2254
2359
|
"track",
|
|
2255
2360
|
"wbr"
|
|
2256
2361
|
];
|
|
2362
|
+
//#endregion
|
|
2363
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/util/schema.js
|
|
2364
|
+
/**
|
|
2365
|
+
* @import {Schema as SchemaType, Space} from 'property-information'
|
|
2366
|
+
*/
|
|
2367
|
+
/** @type {SchemaType} */
|
|
2257
2368
|
var Schema = class {
|
|
2369
|
+
/**
|
|
2370
|
+
* @param {SchemaType['property']} property
|
|
2371
|
+
* Property.
|
|
2372
|
+
* @param {SchemaType['normal']} normal
|
|
2373
|
+
* Normal.
|
|
2374
|
+
* @param {Space | undefined} [space]
|
|
2375
|
+
* Space.
|
|
2376
|
+
* @returns
|
|
2377
|
+
* Schema.
|
|
2378
|
+
*/
|
|
2258
2379
|
constructor(property, normal, space) {
|
|
2259
2380
|
this.normal = normal;
|
|
2260
2381
|
this.property = property;
|
|
@@ -2264,8 +2385,23 @@ var Schema = class {
|
|
|
2264
2385
|
Schema.prototype.normal = {};
|
|
2265
2386
|
Schema.prototype.property = {};
|
|
2266
2387
|
Schema.prototype.space = void 0;
|
|
2388
|
+
//#endregion
|
|
2389
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/util/merge.js
|
|
2390
|
+
/**
|
|
2391
|
+
* @import {Info, Space} from 'property-information'
|
|
2392
|
+
*/
|
|
2393
|
+
/**
|
|
2394
|
+
* @param {ReadonlyArray<Schema>} definitions
|
|
2395
|
+
* Definitions.
|
|
2396
|
+
* @param {Space | undefined} [space]
|
|
2397
|
+
* Space.
|
|
2398
|
+
* @returns {Schema}
|
|
2399
|
+
* Schema.
|
|
2400
|
+
*/
|
|
2267
2401
|
function merge(definitions, space) {
|
|
2402
|
+
/** @type {Record<string, Info>} */
|
|
2268
2403
|
const property = {};
|
|
2404
|
+
/** @type {Record<string, string>} */
|
|
2269
2405
|
const normal = {};
|
|
2270
2406
|
for (const definition of definitions) {
|
|
2271
2407
|
Object.assign(property, definition.property);
|
|
@@ -2273,10 +2409,35 @@ function merge(definitions, space) {
|
|
|
2273
2409
|
}
|
|
2274
2410
|
return new Schema(property, normal, space);
|
|
2275
2411
|
}
|
|
2412
|
+
//#endregion
|
|
2413
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/normalize.js
|
|
2414
|
+
/**
|
|
2415
|
+
* Get the cleaned case insensitive form of an attribute or property.
|
|
2416
|
+
*
|
|
2417
|
+
* @param {string} value
|
|
2418
|
+
* An attribute-like or property-like name.
|
|
2419
|
+
* @returns {string}
|
|
2420
|
+
* Value that can be used to look up the properly cased property on a
|
|
2421
|
+
* `Schema`.
|
|
2422
|
+
*/
|
|
2276
2423
|
function normalize(value) {
|
|
2277
2424
|
return value.toLowerCase();
|
|
2278
2425
|
}
|
|
2426
|
+
//#endregion
|
|
2427
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/util/info.js
|
|
2428
|
+
/**
|
|
2429
|
+
* @import {Info as InfoType} from 'property-information'
|
|
2430
|
+
*/
|
|
2431
|
+
/** @type {InfoType} */
|
|
2279
2432
|
var Info = class {
|
|
2433
|
+
/**
|
|
2434
|
+
* @param {string} property
|
|
2435
|
+
* Property.
|
|
2436
|
+
* @param {string} attribute
|
|
2437
|
+
* Attribute.
|
|
2438
|
+
* @returns
|
|
2439
|
+
* Info.
|
|
2440
|
+
*/
|
|
2280
2441
|
constructor(property, attribute) {
|
|
2281
2442
|
this.attribute = attribute;
|
|
2282
2443
|
this.property = property;
|
|
@@ -2294,6 +2455,8 @@ Info.prototype.overloadedBoolean = false;
|
|
|
2294
2455
|
Info.prototype.property = "";
|
|
2295
2456
|
Info.prototype.spaceSeparated = false;
|
|
2296
2457
|
Info.prototype.space = void 0;
|
|
2458
|
+
//#endregion
|
|
2459
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/util/types.js
|
|
2297
2460
|
var types_exports = /* @__PURE__ */ __exportAll({
|
|
2298
2461
|
boolean: () => boolean,
|
|
2299
2462
|
booleanish: () => booleanish,
|
|
@@ -2304,18 +2467,36 @@ var types_exports = /* @__PURE__ */ __exportAll({
|
|
|
2304
2467
|
spaceSeparated: () => spaceSeparated
|
|
2305
2468
|
});
|
|
2306
2469
|
var powers = 0;
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2470
|
+
var boolean = increment();
|
|
2471
|
+
var booleanish = increment();
|
|
2472
|
+
var overloadedBoolean = increment();
|
|
2473
|
+
var number = increment();
|
|
2474
|
+
var spaceSeparated = increment();
|
|
2475
|
+
var commaSeparated = increment();
|
|
2476
|
+
var commaOrSpaceSeparated = increment();
|
|
2314
2477
|
function increment() {
|
|
2315
2478
|
return 2 ** ++powers;
|
|
2316
2479
|
}
|
|
2480
|
+
//#endregion
|
|
2481
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/util/defined-info.js
|
|
2482
|
+
/**
|
|
2483
|
+
* @import {Space} from 'property-information'
|
|
2484
|
+
*/
|
|
2317
2485
|
var checks = Object.keys(types_exports);
|
|
2318
2486
|
var DefinedInfo = class extends Info {
|
|
2487
|
+
/**
|
|
2488
|
+
* @constructor
|
|
2489
|
+
* @param {string} property
|
|
2490
|
+
* Property.
|
|
2491
|
+
* @param {string} attribute
|
|
2492
|
+
* Attribute.
|
|
2493
|
+
* @param {number | null | undefined} [mask]
|
|
2494
|
+
* Mask.
|
|
2495
|
+
* @param {Space | undefined} [space]
|
|
2496
|
+
* Space.
|
|
2497
|
+
* @returns
|
|
2498
|
+
* Info.
|
|
2499
|
+
*/
|
|
2319
2500
|
constructor(property, attribute, mask, space) {
|
|
2320
2501
|
let index = -1;
|
|
2321
2502
|
super(property, attribute);
|
|
@@ -2327,11 +2508,60 @@ var DefinedInfo = class extends Info {
|
|
|
2327
2508
|
}
|
|
2328
2509
|
};
|
|
2329
2510
|
DefinedInfo.prototype.defined = true;
|
|
2511
|
+
/**
|
|
2512
|
+
* @template {keyof DefinedInfo} Key
|
|
2513
|
+
* Key type.
|
|
2514
|
+
* @param {DefinedInfo} values
|
|
2515
|
+
* Info.
|
|
2516
|
+
* @param {Key} key
|
|
2517
|
+
* Key.
|
|
2518
|
+
* @param {DefinedInfo[Key]} value
|
|
2519
|
+
* Value.
|
|
2520
|
+
* @returns {undefined}
|
|
2521
|
+
* Nothing.
|
|
2522
|
+
*/
|
|
2330
2523
|
function mark(values, key, value) {
|
|
2331
2524
|
if (value) values[key] = value;
|
|
2332
2525
|
}
|
|
2526
|
+
//#endregion
|
|
2527
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/util/create.js
|
|
2528
|
+
/**
|
|
2529
|
+
* @import {Info, Space} from 'property-information'
|
|
2530
|
+
*/
|
|
2531
|
+
/**
|
|
2532
|
+
* @typedef Definition
|
|
2533
|
+
* Definition of a schema.
|
|
2534
|
+
* @property {Record<string, string> | undefined} [attributes]
|
|
2535
|
+
* Normalzed names to special attribute case.
|
|
2536
|
+
* @property {ReadonlyArray<string> | undefined} [mustUseProperty]
|
|
2537
|
+
* Normalized names that must be set as properties.
|
|
2538
|
+
* @property {Record<string, number | null>} properties
|
|
2539
|
+
* Property names to their types.
|
|
2540
|
+
* @property {Space | undefined} [space]
|
|
2541
|
+
* Space.
|
|
2542
|
+
* @property {Transform} transform
|
|
2543
|
+
* Transform a property name.
|
|
2544
|
+
*/
|
|
2545
|
+
/**
|
|
2546
|
+
* @callback Transform
|
|
2547
|
+
* Transform.
|
|
2548
|
+
* @param {Record<string, string>} attributes
|
|
2549
|
+
* Attributes.
|
|
2550
|
+
* @param {string} property
|
|
2551
|
+
* Property.
|
|
2552
|
+
* @returns {string}
|
|
2553
|
+
* Attribute.
|
|
2554
|
+
*/
|
|
2555
|
+
/**
|
|
2556
|
+
* @param {Definition} definition
|
|
2557
|
+
* Definition.
|
|
2558
|
+
* @returns {Schema}
|
|
2559
|
+
* Schema.
|
|
2560
|
+
*/
|
|
2333
2561
|
function create(definition) {
|
|
2562
|
+
/** @type {Record<string, Info>} */
|
|
2334
2563
|
const properties = {};
|
|
2564
|
+
/** @type {Record<string, string>} */
|
|
2335
2565
|
const normals = {};
|
|
2336
2566
|
for (const [property, value] of Object.entries(definition.properties)) {
|
|
2337
2567
|
const info = new DefinedInfo(property, definition.transform(definition.attributes || {}, property), value, definition.space);
|
|
@@ -2342,7 +2572,9 @@ function create(definition) {
|
|
|
2342
2572
|
}
|
|
2343
2573
|
return new Schema(properties, normals, definition.space);
|
|
2344
2574
|
}
|
|
2345
|
-
|
|
2575
|
+
//#endregion
|
|
2576
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/aria.js
|
|
2577
|
+
var aria = create({
|
|
2346
2578
|
properties: {
|
|
2347
2579
|
ariaActiveDescendant: null,
|
|
2348
2580
|
ariaAtomic: booleanish,
|
|
@@ -2398,13 +2630,35 @@ const aria = create({
|
|
|
2398
2630
|
return property === "role" ? property : "aria-" + property.slice(4).toLowerCase();
|
|
2399
2631
|
}
|
|
2400
2632
|
});
|
|
2633
|
+
//#endregion
|
|
2634
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/util/case-sensitive-transform.js
|
|
2635
|
+
/**
|
|
2636
|
+
* @param {Record<string, string>} attributes
|
|
2637
|
+
* Attributes.
|
|
2638
|
+
* @param {string} attribute
|
|
2639
|
+
* Attribute.
|
|
2640
|
+
* @returns {string}
|
|
2641
|
+
* Transformed attribute.
|
|
2642
|
+
*/
|
|
2401
2643
|
function caseSensitiveTransform(attributes, attribute) {
|
|
2402
2644
|
return attribute in attributes ? attributes[attribute] : attribute;
|
|
2403
2645
|
}
|
|
2646
|
+
//#endregion
|
|
2647
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/util/case-insensitive-transform.js
|
|
2648
|
+
/**
|
|
2649
|
+
* @param {Record<string, string>} attributes
|
|
2650
|
+
* Attributes.
|
|
2651
|
+
* @param {string} property
|
|
2652
|
+
* Property.
|
|
2653
|
+
* @returns {string}
|
|
2654
|
+
* Transformed property.
|
|
2655
|
+
*/
|
|
2404
2656
|
function caseInsensitiveTransform(attributes, property) {
|
|
2405
2657
|
return caseSensitiveTransform(attributes, property.toLowerCase());
|
|
2406
2658
|
}
|
|
2407
|
-
|
|
2659
|
+
//#endregion
|
|
2660
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/html.js
|
|
2661
|
+
var html$3 = create({
|
|
2408
2662
|
attributes: {
|
|
2409
2663
|
acceptcharset: "accept-charset",
|
|
2410
2664
|
classname: "class",
|
|
@@ -2714,7 +2968,9 @@ const html$3 = create({
|
|
|
2714
2968
|
space: "html",
|
|
2715
2969
|
transform: caseInsensitiveTransform
|
|
2716
2970
|
});
|
|
2717
|
-
|
|
2971
|
+
//#endregion
|
|
2972
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/svg.js
|
|
2973
|
+
var svg$1 = create({
|
|
2718
2974
|
attributes: {
|
|
2719
2975
|
accentHeight: "accent-height",
|
|
2720
2976
|
alignmentBaseline: "alignment-baseline",
|
|
@@ -3270,7 +3526,9 @@ const svg$1 = create({
|
|
|
3270
3526
|
space: "svg",
|
|
3271
3527
|
transform: caseSensitiveTransform
|
|
3272
3528
|
});
|
|
3273
|
-
|
|
3529
|
+
//#endregion
|
|
3530
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/xlink.js
|
|
3531
|
+
var xlink = create({
|
|
3274
3532
|
properties: {
|
|
3275
3533
|
xLinkActuate: null,
|
|
3276
3534
|
xLinkArcRole: null,
|
|
@@ -3285,7 +3543,9 @@ const xlink = create({
|
|
|
3285
3543
|
return "xlink:" + property.slice(5).toLowerCase();
|
|
3286
3544
|
}
|
|
3287
3545
|
});
|
|
3288
|
-
|
|
3546
|
+
//#endregion
|
|
3547
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/xmlns.js
|
|
3548
|
+
var xmlns = create({
|
|
3289
3549
|
attributes: { xmlnsxlink: "xmlns:xlink" },
|
|
3290
3550
|
properties: {
|
|
3291
3551
|
xmlnsXLink: null,
|
|
@@ -3294,7 +3554,9 @@ const xmlns = create({
|
|
|
3294
3554
|
space: "xmlns",
|
|
3295
3555
|
transform: caseInsensitiveTransform
|
|
3296
3556
|
});
|
|
3297
|
-
|
|
3557
|
+
//#endregion
|
|
3558
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/xml.js
|
|
3559
|
+
var xml = create({
|
|
3298
3560
|
properties: {
|
|
3299
3561
|
xmlBase: null,
|
|
3300
3562
|
xmlLang: null,
|
|
@@ -3305,9 +3567,44 @@ const xml = create({
|
|
|
3305
3567
|
return "xml:" + property.slice(3).toLowerCase();
|
|
3306
3568
|
}
|
|
3307
3569
|
});
|
|
3570
|
+
//#endregion
|
|
3571
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/lib/find.js
|
|
3572
|
+
/**
|
|
3573
|
+
* @import {Schema} from 'property-information'
|
|
3574
|
+
*/
|
|
3308
3575
|
var cap = /[A-Z]/g;
|
|
3309
3576
|
var dash = /-[a-z]/g;
|
|
3310
3577
|
var valid = /^data[-\w.:]+$/i;
|
|
3578
|
+
/**
|
|
3579
|
+
* Look up info on a property.
|
|
3580
|
+
*
|
|
3581
|
+
* In most cases the given `schema` contains info on the property.
|
|
3582
|
+
* All standard,
|
|
3583
|
+
* most legacy,
|
|
3584
|
+
* and some non-standard properties are supported.
|
|
3585
|
+
* For these cases,
|
|
3586
|
+
* the returned `Info` has hints about the value of the property.
|
|
3587
|
+
*
|
|
3588
|
+
* `name` can also be a valid data attribute or property,
|
|
3589
|
+
* in which case an `Info` object with the correctly cased `attribute` and
|
|
3590
|
+
* `property` is returned.
|
|
3591
|
+
*
|
|
3592
|
+
* `name` can be an unknown attribute,
|
|
3593
|
+
* in which case an `Info` object with `attribute` and `property` set to the
|
|
3594
|
+
* given name is returned.
|
|
3595
|
+
* It is not recommended to provide unsupported legacy or recently specced
|
|
3596
|
+
* properties.
|
|
3597
|
+
*
|
|
3598
|
+
*
|
|
3599
|
+
* @param {Schema} schema
|
|
3600
|
+
* Schema;
|
|
3601
|
+
* either the `html` or `svg` export.
|
|
3602
|
+
* @param {string} value
|
|
3603
|
+
* An attribute-like or property-like name;
|
|
3604
|
+
* it will be passed through `normalize` to hopefully find the correct info.
|
|
3605
|
+
* @returns {Info}
|
|
3606
|
+
* Info.
|
|
3607
|
+
*/
|
|
3311
3608
|
function find(schema, value) {
|
|
3312
3609
|
const normal = normalize(value);
|
|
3313
3610
|
let property = value;
|
|
@@ -3329,30 +3626,132 @@ function find(schema, value) {
|
|
|
3329
3626
|
}
|
|
3330
3627
|
return new Type(property, value);
|
|
3331
3628
|
}
|
|
3629
|
+
/**
|
|
3630
|
+
* @param {string} $0
|
|
3631
|
+
* Value.
|
|
3632
|
+
* @returns {string}
|
|
3633
|
+
* Kebab.
|
|
3634
|
+
*/
|
|
3332
3635
|
function kebab($0) {
|
|
3333
3636
|
return "-" + $0.toLowerCase();
|
|
3334
3637
|
}
|
|
3638
|
+
/**
|
|
3639
|
+
* @param {string} $0
|
|
3640
|
+
* Value.
|
|
3641
|
+
* @returns {string}
|
|
3642
|
+
* Camel.
|
|
3643
|
+
*/
|
|
3335
3644
|
function camelcase($0) {
|
|
3336
3645
|
return $0.charAt(1).toUpperCase();
|
|
3337
3646
|
}
|
|
3338
|
-
|
|
3647
|
+
//#endregion
|
|
3648
|
+
//#region ../../node_modules/.pnpm/property-information@7.1.0/node_modules/property-information/index.js
|
|
3649
|
+
var html$2 = merge([
|
|
3339
3650
|
aria,
|
|
3340
3651
|
html$3,
|
|
3341
3652
|
xlink,
|
|
3342
3653
|
xmlns,
|
|
3343
3654
|
xml
|
|
3344
3655
|
], "html");
|
|
3345
|
-
|
|
3656
|
+
var svg = merge([
|
|
3346
3657
|
aria,
|
|
3347
3658
|
svg$1,
|
|
3348
3659
|
xlink,
|
|
3349
3660
|
xmlns,
|
|
3350
3661
|
xml
|
|
3351
3662
|
], "svg");
|
|
3663
|
+
//#endregion
|
|
3664
|
+
//#region ../../node_modules/.pnpm/zwitch@2.0.4/node_modules/zwitch/index.js
|
|
3665
|
+
/**
|
|
3666
|
+
* @callback Handler
|
|
3667
|
+
* Handle a value, with a certain ID field set to a certain value.
|
|
3668
|
+
* The ID field is passed to `zwitch`, and it’s value is this function’s
|
|
3669
|
+
* place on the `handlers` record.
|
|
3670
|
+
* @param {...any} parameters
|
|
3671
|
+
* Arbitrary parameters passed to the zwitch.
|
|
3672
|
+
* The first will be an object with a certain ID field set to a certain value.
|
|
3673
|
+
* @returns {any}
|
|
3674
|
+
* Anything!
|
|
3675
|
+
*/
|
|
3676
|
+
/**
|
|
3677
|
+
* @callback UnknownHandler
|
|
3678
|
+
* Handle values that do have a certain ID field, but it’s set to a value
|
|
3679
|
+
* that is not listed in the `handlers` record.
|
|
3680
|
+
* @param {unknown} value
|
|
3681
|
+
* An object with a certain ID field set to an unknown value.
|
|
3682
|
+
* @param {...any} rest
|
|
3683
|
+
* Arbitrary parameters passed to the zwitch.
|
|
3684
|
+
* @returns {any}
|
|
3685
|
+
* Anything!
|
|
3686
|
+
*/
|
|
3687
|
+
/**
|
|
3688
|
+
* @callback InvalidHandler
|
|
3689
|
+
* Handle values that do not have a certain ID field.
|
|
3690
|
+
* @param {unknown} value
|
|
3691
|
+
* Any unknown value.
|
|
3692
|
+
* @param {...any} rest
|
|
3693
|
+
* Arbitrary parameters passed to the zwitch.
|
|
3694
|
+
* @returns {void|null|undefined|never}
|
|
3695
|
+
* This should crash or return nothing.
|
|
3696
|
+
*/
|
|
3697
|
+
/**
|
|
3698
|
+
* @template {InvalidHandler} [Invalid=InvalidHandler]
|
|
3699
|
+
* @template {UnknownHandler} [Unknown=UnknownHandler]
|
|
3700
|
+
* @template {Record<string, Handler>} [Handlers=Record<string, Handler>]
|
|
3701
|
+
* @typedef Options
|
|
3702
|
+
* Configuration (required).
|
|
3703
|
+
* @property {Invalid} [invalid]
|
|
3704
|
+
* Handler to use for invalid values.
|
|
3705
|
+
* @property {Unknown} [unknown]
|
|
3706
|
+
* Handler to use for unknown values.
|
|
3707
|
+
* @property {Handlers} [handlers]
|
|
3708
|
+
* Handlers to use.
|
|
3709
|
+
*/
|
|
3352
3710
|
var own$2 = {}.hasOwnProperty;
|
|
3711
|
+
/**
|
|
3712
|
+
* Handle values based on a field.
|
|
3713
|
+
*
|
|
3714
|
+
* @template {InvalidHandler} [Invalid=InvalidHandler]
|
|
3715
|
+
* @template {UnknownHandler} [Unknown=UnknownHandler]
|
|
3716
|
+
* @template {Record<string, Handler>} [Handlers=Record<string, Handler>]
|
|
3717
|
+
* @param {string} key
|
|
3718
|
+
* Field to switch on.
|
|
3719
|
+
* @param {Options<Invalid, Unknown, Handlers>} [options]
|
|
3720
|
+
* Configuration (required).
|
|
3721
|
+
* @returns {{unknown: Unknown, invalid: Invalid, handlers: Handlers, (...parameters: Parameters<Handlers[keyof Handlers]>): ReturnType<Handlers[keyof Handlers]>, (...parameters: Parameters<Unknown>): ReturnType<Unknown>}}
|
|
3722
|
+
*/
|
|
3353
3723
|
function zwitch(key, options) {
|
|
3354
3724
|
const settings = options || {};
|
|
3725
|
+
/**
|
|
3726
|
+
* Handle one value.
|
|
3727
|
+
*
|
|
3728
|
+
* Based on the bound `key`, a respective handler will be called.
|
|
3729
|
+
* If `value` is not an object, or doesn’t have a `key` property, the special
|
|
3730
|
+
* “invalid” handler will be called.
|
|
3731
|
+
* If `value` has an unknown `key`, the special “unknown” handler will be
|
|
3732
|
+
* called.
|
|
3733
|
+
*
|
|
3734
|
+
* All arguments, and the context object, are passed through to the handler,
|
|
3735
|
+
* and it’s result is returned.
|
|
3736
|
+
*
|
|
3737
|
+
* @this {unknown}
|
|
3738
|
+
* Any context object.
|
|
3739
|
+
* @param {unknown} [value]
|
|
3740
|
+
* Any value.
|
|
3741
|
+
* @param {...unknown} parameters
|
|
3742
|
+
* Arbitrary parameters passed to the zwitch.
|
|
3743
|
+
* @property {Handler} invalid
|
|
3744
|
+
* Handle for values that do not have a certain ID field.
|
|
3745
|
+
* @property {Handler} unknown
|
|
3746
|
+
* Handle values that do have a certain ID field, but it’s set to a value
|
|
3747
|
+
* that is not listed in the `handlers` record.
|
|
3748
|
+
* @property {Handlers} handlers
|
|
3749
|
+
* Record of handlers.
|
|
3750
|
+
* @returns {unknown}
|
|
3751
|
+
* Anything.
|
|
3752
|
+
*/
|
|
3355
3753
|
function one(value, ...parameters) {
|
|
3754
|
+
/** @type {Handler|undefined} */
|
|
3356
3755
|
let fn = one.invalid;
|
|
3357
3756
|
const handlers = one.handlers;
|
|
3358
3757
|
if (value && own$2.call(value, key)) {
|
|
@@ -3366,22 +3765,64 @@ function zwitch(key, options) {
|
|
|
3366
3765
|
one.unknown = settings.unknown;
|
|
3367
3766
|
return one;
|
|
3368
3767
|
}
|
|
3768
|
+
//#endregion
|
|
3769
|
+
//#region ../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/core.js
|
|
3770
|
+
/**
|
|
3771
|
+
* @typedef CoreOptions
|
|
3772
|
+
* @property {ReadonlyArray<string>} [subset=[]]
|
|
3773
|
+
* Whether to only escape the given subset of characters.
|
|
3774
|
+
* @property {boolean} [escapeOnly=false]
|
|
3775
|
+
* Whether to only escape possibly dangerous characters.
|
|
3776
|
+
* Those characters are `"`, `&`, `'`, `<`, `>`, and `` ` ``.
|
|
3777
|
+
*
|
|
3778
|
+
* @typedef FormatOptions
|
|
3779
|
+
* @property {(code: number, next: number, options: CoreWithFormatOptions) => string} format
|
|
3780
|
+
* Format strategy.
|
|
3781
|
+
*
|
|
3782
|
+
* @typedef {CoreOptions & FormatOptions & import('./util/format-smart.js').FormatSmartOptions} CoreWithFormatOptions
|
|
3783
|
+
*/
|
|
3369
3784
|
var defaultSubsetRegex = /["&'<>`]/g;
|
|
3370
3785
|
var surrogatePairsRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
3371
3786
|
var controlCharactersRegex = /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
|
|
3372
3787
|
var regexEscapeRegex = /[|\\{}()[\]^$+*?.]/g;
|
|
3788
|
+
/** @type {WeakMap<ReadonlyArray<string>, RegExp>} */
|
|
3373
3789
|
var subsetToRegexCache = /* @__PURE__ */ new WeakMap();
|
|
3790
|
+
/**
|
|
3791
|
+
* Encode certain characters in `value`.
|
|
3792
|
+
*
|
|
3793
|
+
* @param {string} value
|
|
3794
|
+
* @param {CoreWithFormatOptions} options
|
|
3795
|
+
* @returns {string}
|
|
3796
|
+
*/
|
|
3374
3797
|
function core(value, options) {
|
|
3375
3798
|
value = value.replace(options.subset ? charactersToExpressionCached(options.subset) : defaultSubsetRegex, basic);
|
|
3376
3799
|
if (options.subset || options.escapeOnly) return value;
|
|
3377
3800
|
return value.replace(surrogatePairsRegex, surrogate).replace(controlCharactersRegex, basic);
|
|
3801
|
+
/**
|
|
3802
|
+
* @param {string} pair
|
|
3803
|
+
* @param {number} index
|
|
3804
|
+
* @param {string} all
|
|
3805
|
+
*/
|
|
3378
3806
|
function surrogate(pair, index, all) {
|
|
3379
3807
|
return options.format((pair.charCodeAt(0) - 55296) * 1024 + pair.charCodeAt(1) - 56320 + 65536, all.charCodeAt(index + 2), options);
|
|
3380
3808
|
}
|
|
3809
|
+
/**
|
|
3810
|
+
* @param {string} character
|
|
3811
|
+
* @param {number} index
|
|
3812
|
+
* @param {string} all
|
|
3813
|
+
*/
|
|
3381
3814
|
function basic(character, index, all) {
|
|
3382
3815
|
return options.format(character.charCodeAt(0), all.charCodeAt(index + 1), options);
|
|
3383
3816
|
}
|
|
3384
3817
|
}
|
|
3818
|
+
/**
|
|
3819
|
+
* A wrapper function that caches the result of `charactersToExpression` with a WeakMap.
|
|
3820
|
+
* This can improve performance when tooling calls `charactersToExpression` repeatedly
|
|
3821
|
+
* with the same subset.
|
|
3822
|
+
*
|
|
3823
|
+
* @param {ReadonlyArray<string>} subset
|
|
3824
|
+
* @returns {RegExp}
|
|
3825
|
+
*/
|
|
3385
3826
|
function charactersToExpressionCached(subset) {
|
|
3386
3827
|
let cached = subsetToRegexCache.get(subset);
|
|
3387
3828
|
if (!cached) {
|
|
@@ -3390,23 +3831,55 @@ function charactersToExpressionCached(subset) {
|
|
|
3390
3831
|
}
|
|
3391
3832
|
return cached;
|
|
3392
3833
|
}
|
|
3834
|
+
/**
|
|
3835
|
+
* @param {ReadonlyArray<string>} subset
|
|
3836
|
+
* @returns {RegExp}
|
|
3837
|
+
*/
|
|
3393
3838
|
function charactersToExpression(subset) {
|
|
3839
|
+
/** @type {Array<string>} */
|
|
3394
3840
|
const groups = [];
|
|
3395
3841
|
let index = -1;
|
|
3396
3842
|
while (++index < subset.length) groups.push(subset[index].replace(regexEscapeRegex, "\\$&"));
|
|
3397
3843
|
return new RegExp("(?:" + groups.join("|") + ")", "g");
|
|
3398
3844
|
}
|
|
3845
|
+
//#endregion
|
|
3846
|
+
//#region ../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-hexadecimal.js
|
|
3399
3847
|
var hexadecimalRegex = /[\dA-Fa-f]/;
|
|
3848
|
+
/**
|
|
3849
|
+
* Configurable ways to encode characters as hexadecimal references.
|
|
3850
|
+
*
|
|
3851
|
+
* @param {number} code
|
|
3852
|
+
* @param {number} next
|
|
3853
|
+
* @param {boolean|undefined} omit
|
|
3854
|
+
* @returns {string}
|
|
3855
|
+
*/
|
|
3400
3856
|
function toHexadecimal(code, next, omit) {
|
|
3401
3857
|
const value = "&#x" + code.toString(16).toUpperCase();
|
|
3402
3858
|
return omit && next && !hexadecimalRegex.test(String.fromCharCode(next)) ? value : value + ";";
|
|
3403
3859
|
}
|
|
3860
|
+
//#endregion
|
|
3861
|
+
//#region ../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-decimal.js
|
|
3404
3862
|
var decimalRegex = /\d/;
|
|
3863
|
+
/**
|
|
3864
|
+
* Configurable ways to encode characters as decimal references.
|
|
3865
|
+
*
|
|
3866
|
+
* @param {number} code
|
|
3867
|
+
* @param {number} next
|
|
3868
|
+
* @param {boolean|undefined} omit
|
|
3869
|
+
* @returns {string}
|
|
3870
|
+
*/
|
|
3405
3871
|
function toDecimal(code, next, omit) {
|
|
3406
3872
|
const value = "&#" + String(code);
|
|
3407
3873
|
return omit && next && !decimalRegex.test(String.fromCharCode(next)) ? value : value + ";";
|
|
3408
3874
|
}
|
|
3409
|
-
|
|
3875
|
+
//#endregion
|
|
3876
|
+
//#region ../../node_modules/.pnpm/character-entities-legacy@3.0.0/node_modules/character-entities-legacy/index.js
|
|
3877
|
+
/**
|
|
3878
|
+
* List of legacy HTML named character references that don’t need a trailing semicolon.
|
|
3879
|
+
*
|
|
3880
|
+
* @type {Array<string>}
|
|
3881
|
+
*/
|
|
3882
|
+
var characterEntitiesLegacy = [
|
|
3410
3883
|
"AElig",
|
|
3411
3884
|
"AMP",
|
|
3412
3885
|
"Aacute",
|
|
@@ -3514,7 +3987,14 @@ const characterEntitiesLegacy = [
|
|
|
3514
3987
|
"yen",
|
|
3515
3988
|
"yuml"
|
|
3516
3989
|
];
|
|
3517
|
-
|
|
3990
|
+
//#endregion
|
|
3991
|
+
//#region ../../node_modules/.pnpm/character-entities-html4@2.1.0/node_modules/character-entities-html4/index.js
|
|
3992
|
+
/**
|
|
3993
|
+
* Map of named character references from HTML 4.
|
|
3994
|
+
*
|
|
3995
|
+
* @type {Record<string, string>}
|
|
3996
|
+
*/
|
|
3997
|
+
var characterEntitiesHtml4 = {
|
|
3518
3998
|
nbsp: "\xA0",
|
|
3519
3999
|
iexcl: "¡",
|
|
3520
4000
|
cent: "¢",
|
|
@@ -3768,7 +4248,15 @@ const characterEntitiesHtml4 = {
|
|
|
3768
4248
|
rsaquo: "›",
|
|
3769
4249
|
euro: "€"
|
|
3770
4250
|
};
|
|
3771
|
-
|
|
4251
|
+
//#endregion
|
|
4252
|
+
//#region ../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/constant/dangerous.js
|
|
4253
|
+
/**
|
|
4254
|
+
* List of legacy (that don’t need a trailing `;`) named references which could,
|
|
4255
|
+
* depending on what follows them, turn into a different meaning
|
|
4256
|
+
*
|
|
4257
|
+
* @type {Array<string>}
|
|
4258
|
+
*/
|
|
4259
|
+
var dangerous = [
|
|
3772
4260
|
"cent",
|
|
3773
4261
|
"copy",
|
|
3774
4262
|
"divide",
|
|
@@ -3778,11 +4266,28 @@ const dangerous = [
|
|
|
3778
4266
|
"para",
|
|
3779
4267
|
"times"
|
|
3780
4268
|
];
|
|
4269
|
+
//#endregion
|
|
4270
|
+
//#region ../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-named.js
|
|
3781
4271
|
var own$1 = {}.hasOwnProperty;
|
|
4272
|
+
/**
|
|
4273
|
+
* `characterEntitiesHtml4` but inverted.
|
|
4274
|
+
*
|
|
4275
|
+
* @type {Record<string, string>}
|
|
4276
|
+
*/
|
|
3782
4277
|
var characters = {};
|
|
4278
|
+
/** @type {string} */
|
|
3783
4279
|
var key;
|
|
3784
4280
|
for (key in characterEntitiesHtml4) if (own$1.call(characterEntitiesHtml4, key)) characters[characterEntitiesHtml4[key]] = key;
|
|
3785
4281
|
var notAlphanumericRegex = /[^\dA-Za-z]/;
|
|
4282
|
+
/**
|
|
4283
|
+
* Configurable ways to encode characters as named references.
|
|
4284
|
+
*
|
|
4285
|
+
* @param {number} code
|
|
4286
|
+
* @param {number} next
|
|
4287
|
+
* @param {boolean|undefined} omit
|
|
4288
|
+
* @param {boolean|undefined} attribute
|
|
4289
|
+
* @returns {string}
|
|
4290
|
+
*/
|
|
3786
4291
|
function toNamed(code, next, omit, attribute) {
|
|
3787
4292
|
const character = String.fromCharCode(code);
|
|
3788
4293
|
if (own$1.call(characters, character)) {
|
|
@@ -3793,8 +4298,35 @@ function toNamed(code, next, omit, attribute) {
|
|
|
3793
4298
|
}
|
|
3794
4299
|
return "";
|
|
3795
4300
|
}
|
|
4301
|
+
//#endregion
|
|
4302
|
+
//#region ../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/format-smart.js
|
|
4303
|
+
/**
|
|
4304
|
+
* @typedef FormatSmartOptions
|
|
4305
|
+
* @property {boolean} [useNamedReferences=false]
|
|
4306
|
+
* Prefer named character references (`&`) where possible.
|
|
4307
|
+
* @property {boolean} [useShortestReferences=false]
|
|
4308
|
+
* Prefer the shortest possible reference, if that results in less bytes.
|
|
4309
|
+
* **Note**: `useNamedReferences` can be omitted when using `useShortestReferences`.
|
|
4310
|
+
* @property {boolean} [omitOptionalSemicolons=false]
|
|
4311
|
+
* Whether to omit semicolons when possible.
|
|
4312
|
+
* **Note**: This creates what HTML calls “parse errors” but is otherwise still valid HTML — don’t use this except when building a minifier.
|
|
4313
|
+
* Omitting semicolons is possible for certain named and numeric references in some cases.
|
|
4314
|
+
* @property {boolean} [attribute=false]
|
|
4315
|
+
* Create character references which don’t fail in attributes.
|
|
4316
|
+
* **Note**: `attribute` only applies when operating dangerously with
|
|
4317
|
+
* `omitOptionalSemicolons: true`.
|
|
4318
|
+
*/
|
|
4319
|
+
/**
|
|
4320
|
+
* Configurable ways to encode a character yielding pretty or small results.
|
|
4321
|
+
*
|
|
4322
|
+
* @param {number} code
|
|
4323
|
+
* @param {number} next
|
|
4324
|
+
* @param {FormatSmartOptions} options
|
|
4325
|
+
* @returns {string}
|
|
4326
|
+
*/
|
|
3796
4327
|
function formatSmart(code, next, options) {
|
|
3797
4328
|
let numeric = toHexadecimal(code, next, options.omitOptionalSemicolons);
|
|
4329
|
+
/** @type {string|undefined} */
|
|
3798
4330
|
let named;
|
|
3799
4331
|
if (options.useNamedReferences || options.useShortestReferences) named = toNamed(code, next, options.omitOptionalSemicolons, options.attribute);
|
|
3800
4332
|
if ((options.useShortestReferences || !named) && options.useShortestReferences) {
|
|
@@ -3803,21 +4335,92 @@ function formatSmart(code, next, options) {
|
|
|
3803
4335
|
}
|
|
3804
4336
|
return named && (!options.useShortestReferences || named.length < numeric.length) ? named : numeric;
|
|
3805
4337
|
}
|
|
4338
|
+
//#endregion
|
|
4339
|
+
//#region ../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/index.js
|
|
4340
|
+
/**
|
|
4341
|
+
* @typedef {import('./core.js').CoreOptions & import('./util/format-smart.js').FormatSmartOptions} Options
|
|
4342
|
+
* @typedef {import('./core.js').CoreOptions} LightOptions
|
|
4343
|
+
*/
|
|
4344
|
+
/**
|
|
4345
|
+
* Encode special characters in `value`.
|
|
4346
|
+
*
|
|
4347
|
+
* @param {string} value
|
|
4348
|
+
* Value to encode.
|
|
4349
|
+
* @param {Options} [options]
|
|
4350
|
+
* Configuration.
|
|
4351
|
+
* @returns {string}
|
|
4352
|
+
* Encoded value.
|
|
4353
|
+
*/
|
|
3806
4354
|
function stringifyEntities(value, options) {
|
|
3807
4355
|
return core(value, Object.assign({ format: formatSmart }, options));
|
|
3808
4356
|
}
|
|
4357
|
+
//#endregion
|
|
4358
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/comment.js
|
|
4359
|
+
/**
|
|
4360
|
+
* @import {Comment, Parents} from 'hast'
|
|
4361
|
+
* @import {State} from '../index.js'
|
|
4362
|
+
*/
|
|
3809
4363
|
var htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
3810
4364
|
var bogusCommentEntitySubset = [">"];
|
|
3811
4365
|
var commentEntitySubset = ["<", ">"];
|
|
4366
|
+
/**
|
|
4367
|
+
* Serialize a comment.
|
|
4368
|
+
*
|
|
4369
|
+
* @param {Comment} node
|
|
4370
|
+
* Node to handle.
|
|
4371
|
+
* @param {number | undefined} _1
|
|
4372
|
+
* Index of `node` in `parent.
|
|
4373
|
+
* @param {Parents | undefined} _2
|
|
4374
|
+
* Parent of `node`.
|
|
4375
|
+
* @param {State} state
|
|
4376
|
+
* Info passed around about the current state.
|
|
4377
|
+
* @returns {string}
|
|
4378
|
+
* Serialized node.
|
|
4379
|
+
*/
|
|
3812
4380
|
function comment(node, _1, _2, state) {
|
|
3813
4381
|
return state.settings.bogusComments ? "<?" + stringifyEntities(node.value, Object.assign({}, state.settings.characterReferences, { subset: bogusCommentEntitySubset })) + ">" : "<!--" + node.value.replace(htmlCommentRegex, encode) + "-->";
|
|
4382
|
+
/**
|
|
4383
|
+
* @param {string} $0
|
|
4384
|
+
*/
|
|
3814
4385
|
function encode($0) {
|
|
3815
4386
|
return stringifyEntities($0, Object.assign({}, state.settings.characterReferences, { subset: commentEntitySubset }));
|
|
3816
4387
|
}
|
|
3817
4388
|
}
|
|
4389
|
+
//#endregion
|
|
4390
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/doctype.js
|
|
4391
|
+
/**
|
|
4392
|
+
* @import {Doctype, Parents} from 'hast'
|
|
4393
|
+
* @import {State} from '../index.js'
|
|
4394
|
+
*/
|
|
4395
|
+
/**
|
|
4396
|
+
* Serialize a doctype.
|
|
4397
|
+
*
|
|
4398
|
+
* @param {Doctype} _1
|
|
4399
|
+
* Node to handle.
|
|
4400
|
+
* @param {number | undefined} _2
|
|
4401
|
+
* Index of `node` in `parent.
|
|
4402
|
+
* @param {Parents | undefined} _3
|
|
4403
|
+
* Parent of `node`.
|
|
4404
|
+
* @param {State} state
|
|
4405
|
+
* Info passed around about the current state.
|
|
4406
|
+
* @returns {string}
|
|
4407
|
+
* Serialized node.
|
|
4408
|
+
*/
|
|
3818
4409
|
function doctype(_1, _2, _3, state) {
|
|
3819
4410
|
return "<!" + (state.settings.upperDoctype ? "DOCTYPE" : "doctype") + (state.settings.tightDoctype ? "" : " ") + "html>";
|
|
3820
4411
|
}
|
|
4412
|
+
//#endregion
|
|
4413
|
+
//#region ../../node_modules/.pnpm/ccount@2.0.1/node_modules/ccount/index.js
|
|
4414
|
+
/**
|
|
4415
|
+
* Count how often a character (or substring) is used in a string.
|
|
4416
|
+
*
|
|
4417
|
+
* @param {string} value
|
|
4418
|
+
* Value to search in.
|
|
4419
|
+
* @param {string} character
|
|
4420
|
+
* Character (or substring) to look for.
|
|
4421
|
+
* @return {number}
|
|
4422
|
+
* Number of times `character` occurred in `value`.
|
|
4423
|
+
*/
|
|
3821
4424
|
function ccount(value, character) {
|
|
3822
4425
|
const source = String(value);
|
|
3823
4426
|
if (typeof character !== "string") throw new TypeError("Expected character");
|
|
@@ -3829,25 +4432,92 @@ function ccount(value, character) {
|
|
|
3829
4432
|
}
|
|
3830
4433
|
return count;
|
|
3831
4434
|
}
|
|
4435
|
+
//#endregion
|
|
4436
|
+
//#region ../../node_modules/.pnpm/comma-separated-tokens@2.0.3/node_modules/comma-separated-tokens/index.js
|
|
4437
|
+
/**
|
|
4438
|
+
* Serialize an array of strings or numbers to comma-separated tokens.
|
|
4439
|
+
*
|
|
4440
|
+
* @param {Array<string|number>} values
|
|
4441
|
+
* List of tokens.
|
|
4442
|
+
* @param {Options} [options]
|
|
4443
|
+
* Configuration for `stringify` (optional).
|
|
4444
|
+
* @returns {string}
|
|
4445
|
+
* Comma-separated tokens.
|
|
4446
|
+
*/
|
|
3832
4447
|
function stringify$2(values, options) {
|
|
3833
4448
|
const settings = options || {};
|
|
3834
4449
|
return (values[values.length - 1] === "" ? [...values, ""] : values).join((settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")).trim();
|
|
3835
4450
|
}
|
|
4451
|
+
//#endregion
|
|
4452
|
+
//#region ../../node_modules/.pnpm/space-separated-tokens@2.0.2/node_modules/space-separated-tokens/index.js
|
|
4453
|
+
/**
|
|
4454
|
+
* Serialize an array of strings as space separated-tokens.
|
|
4455
|
+
*
|
|
4456
|
+
* @param {Array<string|number>} values
|
|
4457
|
+
* List of tokens.
|
|
4458
|
+
* @returns {string}
|
|
4459
|
+
* Space-separated tokens.
|
|
4460
|
+
*/
|
|
3836
4461
|
function stringify$1(values) {
|
|
3837
4462
|
return values.join(" ").trim();
|
|
3838
4463
|
}
|
|
4464
|
+
//#endregion
|
|
4465
|
+
//#region ../../node_modules/.pnpm/hast-util-whitespace@3.0.0/node_modules/hast-util-whitespace/lib/index.js
|
|
4466
|
+
/**
|
|
4467
|
+
* @typedef {import('hast').Nodes} Nodes
|
|
4468
|
+
*/
|
|
3839
4469
|
var re = /[ \t\n\f\r]/g;
|
|
4470
|
+
/**
|
|
4471
|
+
* Check if the given value is *inter-element whitespace*.
|
|
4472
|
+
*
|
|
4473
|
+
* @param {Nodes | string} thing
|
|
4474
|
+
* Thing to check (`Node` or `string`).
|
|
4475
|
+
* @returns {boolean}
|
|
4476
|
+
* Whether the `value` is inter-element whitespace (`boolean`): consisting of
|
|
4477
|
+
* zero or more of space, tab (`\t`), line feed (`\n`), carriage return
|
|
4478
|
+
* (`\r`), or form feed (`\f`); if a node is passed it must be a `Text` node,
|
|
4479
|
+
* whose `value` field is checked.
|
|
4480
|
+
*/
|
|
3840
4481
|
function whitespace(thing) {
|
|
3841
4482
|
return typeof thing === "object" ? thing.type === "text" ? empty(thing.value) : false : empty(thing);
|
|
3842
4483
|
}
|
|
4484
|
+
/**
|
|
4485
|
+
* @param {string} value
|
|
4486
|
+
* @returns {boolean}
|
|
4487
|
+
*/
|
|
3843
4488
|
function empty(value) {
|
|
3844
4489
|
return value.replace(re, "") === "";
|
|
3845
4490
|
}
|
|
3846
|
-
|
|
3847
|
-
|
|
4491
|
+
//#endregion
|
|
4492
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/util/siblings.js
|
|
4493
|
+
/**
|
|
4494
|
+
* @import {Parents, RootContent} from 'hast'
|
|
4495
|
+
*/
|
|
4496
|
+
var siblingAfter = siblings(1);
|
|
4497
|
+
var siblingBefore = siblings(-1);
|
|
4498
|
+
/** @type {Array<RootContent>} */
|
|
3848
4499
|
var emptyChildren$1 = [];
|
|
4500
|
+
/**
|
|
4501
|
+
* Factory to check siblings in a direction.
|
|
4502
|
+
*
|
|
4503
|
+
* @param {number} increment
|
|
4504
|
+
*/
|
|
3849
4505
|
function siblings(increment) {
|
|
3850
4506
|
return sibling;
|
|
4507
|
+
/**
|
|
4508
|
+
* Find applicable siblings in a direction.
|
|
4509
|
+
*
|
|
4510
|
+
* @template {Parents} Parent
|
|
4511
|
+
* Parent type.
|
|
4512
|
+
* @param {Parent | undefined} parent
|
|
4513
|
+
* Parent.
|
|
4514
|
+
* @param {number | undefined} index
|
|
4515
|
+
* Index of child in `parent`.
|
|
4516
|
+
* @param {boolean | undefined} [includeWhitespace=false]
|
|
4517
|
+
* Whether to include whitespace (default: `false`).
|
|
4518
|
+
* @returns {Parent extends {children: Array<infer Child>} ? Child | undefined : never}
|
|
4519
|
+
* Child of parent.
|
|
4520
|
+
*/
|
|
3851
4521
|
function sibling(parent, index, includeWhitespace) {
|
|
3852
4522
|
const siblings = parent ? parent.children : emptyChildren$1;
|
|
3853
4523
|
let offset = (index || 0) + increment;
|
|
@@ -3859,14 +4529,51 @@ function siblings(increment) {
|
|
|
3859
4529
|
return next;
|
|
3860
4530
|
}
|
|
3861
4531
|
}
|
|
4532
|
+
//#endregion
|
|
4533
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/omission.js
|
|
4534
|
+
/**
|
|
4535
|
+
* @import {Element, Parents} from 'hast'
|
|
4536
|
+
*/
|
|
4537
|
+
/**
|
|
4538
|
+
* @callback OmitHandle
|
|
4539
|
+
* Check if a tag can be omitted.
|
|
4540
|
+
* @param {Element} element
|
|
4541
|
+
* Element to check.
|
|
4542
|
+
* @param {number | undefined} index
|
|
4543
|
+
* Index of element in parent.
|
|
4544
|
+
* @param {Parents | undefined} parent
|
|
4545
|
+
* Parent of element.
|
|
4546
|
+
* @returns {boolean}
|
|
4547
|
+
* Whether to omit a tag.
|
|
4548
|
+
*
|
|
4549
|
+
*/
|
|
3862
4550
|
var own = {}.hasOwnProperty;
|
|
4551
|
+
/**
|
|
4552
|
+
* Factory to check if a given node can have a tag omitted.
|
|
4553
|
+
*
|
|
4554
|
+
* @param {Record<string, OmitHandle>} handlers
|
|
4555
|
+
* Omission handlers, where each key is a tag name, and each value is the
|
|
4556
|
+
* corresponding handler.
|
|
4557
|
+
* @returns {OmitHandle}
|
|
4558
|
+
* Whether to omit a tag of an element.
|
|
4559
|
+
*/
|
|
3863
4560
|
function omission(handlers) {
|
|
3864
4561
|
return omit;
|
|
4562
|
+
/**
|
|
4563
|
+
* Check if a given node can have a tag omitted.
|
|
4564
|
+
*
|
|
4565
|
+
* @type {OmitHandle}
|
|
4566
|
+
*/
|
|
3865
4567
|
function omit(node, index, parent) {
|
|
3866
4568
|
return own.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
|
|
3867
4569
|
}
|
|
3868
4570
|
}
|
|
3869
|
-
|
|
4571
|
+
//#endregion
|
|
4572
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/closing.js
|
|
4573
|
+
/**
|
|
4574
|
+
* @import {Element, Parents} from 'hast'
|
|
4575
|
+
*/
|
|
4576
|
+
var closing = omission({
|
|
3870
4577
|
body: body$1,
|
|
3871
4578
|
caption: headOrColgroupOrCaption,
|
|
3872
4579
|
colgroup: headOrColgroupOrCaption,
|
|
@@ -3887,77 +4594,279 @@ const closing = omission({
|
|
|
3887
4594
|
thead,
|
|
3888
4595
|
tr
|
|
3889
4596
|
});
|
|
4597
|
+
/**
|
|
4598
|
+
* Macro for `</head>`, `</colgroup>`, and `</caption>`.
|
|
4599
|
+
*
|
|
4600
|
+
* @param {Element} _
|
|
4601
|
+
* Element.
|
|
4602
|
+
* @param {number | undefined} index
|
|
4603
|
+
* Index of element in parent.
|
|
4604
|
+
* @param {Parents | undefined} parent
|
|
4605
|
+
* Parent of element.
|
|
4606
|
+
* @returns {boolean}
|
|
4607
|
+
* Whether the closing tag can be omitted.
|
|
4608
|
+
*/
|
|
3890
4609
|
function headOrColgroupOrCaption(_, index, parent) {
|
|
3891
4610
|
const next = siblingAfter(parent, index, true);
|
|
3892
4611
|
return !next || next.type !== "comment" && !(next.type === "text" && whitespace(next.value.charAt(0)));
|
|
3893
4612
|
}
|
|
4613
|
+
/**
|
|
4614
|
+
* Whether to omit `</html>`.
|
|
4615
|
+
*
|
|
4616
|
+
* @param {Element} _
|
|
4617
|
+
* Element.
|
|
4618
|
+
* @param {number | undefined} index
|
|
4619
|
+
* Index of element in parent.
|
|
4620
|
+
* @param {Parents | undefined} parent
|
|
4621
|
+
* Parent of element.
|
|
4622
|
+
* @returns {boolean}
|
|
4623
|
+
* Whether the closing tag can be omitted.
|
|
4624
|
+
*/
|
|
3894
4625
|
function html$1(_, index, parent) {
|
|
3895
4626
|
const next = siblingAfter(parent, index);
|
|
3896
4627
|
return !next || next.type !== "comment";
|
|
3897
4628
|
}
|
|
4629
|
+
/**
|
|
4630
|
+
* Whether to omit `</body>`.
|
|
4631
|
+
*
|
|
4632
|
+
* @param {Element} _
|
|
4633
|
+
* Element.
|
|
4634
|
+
* @param {number | undefined} index
|
|
4635
|
+
* Index of element in parent.
|
|
4636
|
+
* @param {Parents | undefined} parent
|
|
4637
|
+
* Parent of element.
|
|
4638
|
+
* @returns {boolean}
|
|
4639
|
+
* Whether the closing tag can be omitted.
|
|
4640
|
+
*/
|
|
3898
4641
|
function body$1(_, index, parent) {
|
|
3899
4642
|
const next = siblingAfter(parent, index);
|
|
3900
4643
|
return !next || next.type !== "comment";
|
|
3901
4644
|
}
|
|
4645
|
+
/**
|
|
4646
|
+
* Whether to omit `</p>`.
|
|
4647
|
+
*
|
|
4648
|
+
* @param {Element} _
|
|
4649
|
+
* Element.
|
|
4650
|
+
* @param {number | undefined} index
|
|
4651
|
+
* Index of element in parent.
|
|
4652
|
+
* @param {Parents | undefined} parent
|
|
4653
|
+
* Parent of element.
|
|
4654
|
+
* @returns {boolean}
|
|
4655
|
+
* Whether the closing tag can be omitted.
|
|
4656
|
+
*/
|
|
3902
4657
|
function p(_, index, parent) {
|
|
3903
4658
|
const next = siblingAfter(parent, index);
|
|
3904
4659
|
return next ? next.type === "element" && (next.tagName === "address" || next.tagName === "article" || next.tagName === "aside" || next.tagName === "blockquote" || next.tagName === "details" || next.tagName === "div" || next.tagName === "dl" || next.tagName === "fieldset" || next.tagName === "figcaption" || next.tagName === "figure" || next.tagName === "footer" || next.tagName === "form" || next.tagName === "h1" || next.tagName === "h2" || next.tagName === "h3" || next.tagName === "h4" || next.tagName === "h5" || next.tagName === "h6" || next.tagName === "header" || next.tagName === "hgroup" || next.tagName === "hr" || next.tagName === "main" || next.tagName === "menu" || next.tagName === "nav" || next.tagName === "ol" || next.tagName === "p" || next.tagName === "pre" || next.tagName === "section" || next.tagName === "table" || next.tagName === "ul") : !parent || !(parent.type === "element" && (parent.tagName === "a" || parent.tagName === "audio" || parent.tagName === "del" || parent.tagName === "ins" || parent.tagName === "map" || parent.tagName === "noscript" || parent.tagName === "video"));
|
|
3905
4660
|
}
|
|
4661
|
+
/**
|
|
4662
|
+
* Whether to omit `</li>`.
|
|
4663
|
+
*
|
|
4664
|
+
* @param {Element} _
|
|
4665
|
+
* Element.
|
|
4666
|
+
* @param {number | undefined} index
|
|
4667
|
+
* Index of element in parent.
|
|
4668
|
+
* @param {Parents | undefined} parent
|
|
4669
|
+
* Parent of element.
|
|
4670
|
+
* @returns {boolean}
|
|
4671
|
+
* Whether the closing tag can be omitted.
|
|
4672
|
+
*/
|
|
3906
4673
|
function li(_, index, parent) {
|
|
3907
4674
|
const next = siblingAfter(parent, index);
|
|
3908
4675
|
return !next || next.type === "element" && next.tagName === "li";
|
|
3909
4676
|
}
|
|
4677
|
+
/**
|
|
4678
|
+
* Whether to omit `</dt>`.
|
|
4679
|
+
*
|
|
4680
|
+
* @param {Element} _
|
|
4681
|
+
* Element.
|
|
4682
|
+
* @param {number | undefined} index
|
|
4683
|
+
* Index of element in parent.
|
|
4684
|
+
* @param {Parents | undefined} parent
|
|
4685
|
+
* Parent of element.
|
|
4686
|
+
* @returns {boolean}
|
|
4687
|
+
* Whether the closing tag can be omitted.
|
|
4688
|
+
*/
|
|
3910
4689
|
function dt(_, index, parent) {
|
|
3911
4690
|
const next = siblingAfter(parent, index);
|
|
3912
4691
|
return Boolean(next && next.type === "element" && (next.tagName === "dt" || next.tagName === "dd"));
|
|
3913
4692
|
}
|
|
4693
|
+
/**
|
|
4694
|
+
* Whether to omit `</dd>`.
|
|
4695
|
+
*
|
|
4696
|
+
* @param {Element} _
|
|
4697
|
+
* Element.
|
|
4698
|
+
* @param {number | undefined} index
|
|
4699
|
+
* Index of element in parent.
|
|
4700
|
+
* @param {Parents | undefined} parent
|
|
4701
|
+
* Parent of element.
|
|
4702
|
+
* @returns {boolean}
|
|
4703
|
+
* Whether the closing tag can be omitted.
|
|
4704
|
+
*/
|
|
3914
4705
|
function dd(_, index, parent) {
|
|
3915
4706
|
const next = siblingAfter(parent, index);
|
|
3916
4707
|
return !next || next.type === "element" && (next.tagName === "dt" || next.tagName === "dd");
|
|
3917
4708
|
}
|
|
4709
|
+
/**
|
|
4710
|
+
* Whether to omit `</rt>` or `</rp>`.
|
|
4711
|
+
*
|
|
4712
|
+
* @param {Element} _
|
|
4713
|
+
* Element.
|
|
4714
|
+
* @param {number | undefined} index
|
|
4715
|
+
* Index of element in parent.
|
|
4716
|
+
* @param {Parents | undefined} parent
|
|
4717
|
+
* Parent of element.
|
|
4718
|
+
* @returns {boolean}
|
|
4719
|
+
* Whether the closing tag can be omitted.
|
|
4720
|
+
*/
|
|
3918
4721
|
function rubyElement(_, index, parent) {
|
|
3919
4722
|
const next = siblingAfter(parent, index);
|
|
3920
4723
|
return !next || next.type === "element" && (next.tagName === "rp" || next.tagName === "rt");
|
|
3921
4724
|
}
|
|
4725
|
+
/**
|
|
4726
|
+
* Whether to omit `</optgroup>`.
|
|
4727
|
+
*
|
|
4728
|
+
* @param {Element} _
|
|
4729
|
+
* Element.
|
|
4730
|
+
* @param {number | undefined} index
|
|
4731
|
+
* Index of element in parent.
|
|
4732
|
+
* @param {Parents | undefined} parent
|
|
4733
|
+
* Parent of element.
|
|
4734
|
+
* @returns {boolean}
|
|
4735
|
+
* Whether the closing tag can be omitted.
|
|
4736
|
+
*/
|
|
3922
4737
|
function optgroup(_, index, parent) {
|
|
3923
4738
|
const next = siblingAfter(parent, index);
|
|
3924
4739
|
return !next || next.type === "element" && next.tagName === "optgroup";
|
|
3925
4740
|
}
|
|
4741
|
+
/**
|
|
4742
|
+
* Whether to omit `</option>`.
|
|
4743
|
+
*
|
|
4744
|
+
* @param {Element} _
|
|
4745
|
+
* Element.
|
|
4746
|
+
* @param {number | undefined} index
|
|
4747
|
+
* Index of element in parent.
|
|
4748
|
+
* @param {Parents | undefined} parent
|
|
4749
|
+
* Parent of element.
|
|
4750
|
+
* @returns {boolean}
|
|
4751
|
+
* Whether the closing tag can be omitted.
|
|
4752
|
+
*/
|
|
3926
4753
|
function option(_, index, parent) {
|
|
3927
4754
|
const next = siblingAfter(parent, index);
|
|
3928
4755
|
return !next || next.type === "element" && (next.tagName === "option" || next.tagName === "optgroup");
|
|
3929
4756
|
}
|
|
4757
|
+
/**
|
|
4758
|
+
* Whether to omit `</thead>`.
|
|
4759
|
+
*
|
|
4760
|
+
* @param {Element} _
|
|
4761
|
+
* Element.
|
|
4762
|
+
* @param {number | undefined} index
|
|
4763
|
+
* Index of element in parent.
|
|
4764
|
+
* @param {Parents | undefined} parent
|
|
4765
|
+
* Parent of element.
|
|
4766
|
+
* @returns {boolean}
|
|
4767
|
+
* Whether the closing tag can be omitted.
|
|
4768
|
+
*/
|
|
3930
4769
|
function thead(_, index, parent) {
|
|
3931
4770
|
const next = siblingAfter(parent, index);
|
|
3932
4771
|
return Boolean(next && next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot"));
|
|
3933
4772
|
}
|
|
4773
|
+
/**
|
|
4774
|
+
* Whether to omit `</tbody>`.
|
|
4775
|
+
*
|
|
4776
|
+
* @param {Element} _
|
|
4777
|
+
* Element.
|
|
4778
|
+
* @param {number | undefined} index
|
|
4779
|
+
* Index of element in parent.
|
|
4780
|
+
* @param {Parents | undefined} parent
|
|
4781
|
+
* Parent of element.
|
|
4782
|
+
* @returns {boolean}
|
|
4783
|
+
* Whether the closing tag can be omitted.
|
|
4784
|
+
*/
|
|
3934
4785
|
function tbody$1(_, index, parent) {
|
|
3935
4786
|
const next = siblingAfter(parent, index);
|
|
3936
4787
|
return !next || next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot");
|
|
3937
4788
|
}
|
|
4789
|
+
/**
|
|
4790
|
+
* Whether to omit `</tfoot>`.
|
|
4791
|
+
*
|
|
4792
|
+
* @param {Element} _
|
|
4793
|
+
* Element.
|
|
4794
|
+
* @param {number | undefined} index
|
|
4795
|
+
* Index of element in parent.
|
|
4796
|
+
* @param {Parents | undefined} parent
|
|
4797
|
+
* Parent of element.
|
|
4798
|
+
* @returns {boolean}
|
|
4799
|
+
* Whether the closing tag can be omitted.
|
|
4800
|
+
*/
|
|
3938
4801
|
function tfoot(_, index, parent) {
|
|
3939
4802
|
return !siblingAfter(parent, index);
|
|
3940
4803
|
}
|
|
4804
|
+
/**
|
|
4805
|
+
* Whether to omit `</tr>`.
|
|
4806
|
+
*
|
|
4807
|
+
* @param {Element} _
|
|
4808
|
+
* Element.
|
|
4809
|
+
* @param {number | undefined} index
|
|
4810
|
+
* Index of element in parent.
|
|
4811
|
+
* @param {Parents | undefined} parent
|
|
4812
|
+
* Parent of element.
|
|
4813
|
+
* @returns {boolean}
|
|
4814
|
+
* Whether the closing tag can be omitted.
|
|
4815
|
+
*/
|
|
3941
4816
|
function tr(_, index, parent) {
|
|
3942
4817
|
const next = siblingAfter(parent, index);
|
|
3943
4818
|
return !next || next.type === "element" && next.tagName === "tr";
|
|
3944
4819
|
}
|
|
4820
|
+
/**
|
|
4821
|
+
* Whether to omit `</td>` or `</th>`.
|
|
4822
|
+
*
|
|
4823
|
+
* @param {Element} _
|
|
4824
|
+
* Element.
|
|
4825
|
+
* @param {number | undefined} index
|
|
4826
|
+
* Index of element in parent.
|
|
4827
|
+
* @param {Parents | undefined} parent
|
|
4828
|
+
* Parent of element.
|
|
4829
|
+
* @returns {boolean}
|
|
4830
|
+
* Whether the closing tag can be omitted.
|
|
4831
|
+
*/
|
|
3945
4832
|
function cells(_, index, parent) {
|
|
3946
4833
|
const next = siblingAfter(parent, index);
|
|
3947
4834
|
return !next || next.type === "element" && (next.tagName === "td" || next.tagName === "th");
|
|
3948
4835
|
}
|
|
3949
|
-
|
|
4836
|
+
//#endregion
|
|
4837
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/opening.js
|
|
4838
|
+
/**
|
|
4839
|
+
* @import {Element, Parents} from 'hast'
|
|
4840
|
+
*/
|
|
4841
|
+
var opening = omission({
|
|
3950
4842
|
body,
|
|
3951
4843
|
colgroup,
|
|
3952
4844
|
head,
|
|
3953
4845
|
html,
|
|
3954
4846
|
tbody
|
|
3955
4847
|
});
|
|
4848
|
+
/**
|
|
4849
|
+
* Whether to omit `<html>`.
|
|
4850
|
+
*
|
|
4851
|
+
* @param {Element} node
|
|
4852
|
+
* Element.
|
|
4853
|
+
* @returns {boolean}
|
|
4854
|
+
* Whether the opening tag can be omitted.
|
|
4855
|
+
*/
|
|
3956
4856
|
function html(node) {
|
|
3957
4857
|
const head = siblingAfter(node, -1);
|
|
3958
4858
|
return !head || head.type !== "comment";
|
|
3959
4859
|
}
|
|
4860
|
+
/**
|
|
4861
|
+
* Whether to omit `<head>`.
|
|
4862
|
+
*
|
|
4863
|
+
* @param {Element} node
|
|
4864
|
+
* Element.
|
|
4865
|
+
* @returns {boolean}
|
|
4866
|
+
* Whether the opening tag can be omitted.
|
|
4867
|
+
*/
|
|
3960
4868
|
function head(node) {
|
|
4869
|
+
/** @type {Set<string>} */
|
|
3961
4870
|
const seen = /* @__PURE__ */ new Set();
|
|
3962
4871
|
for (const child of node.children) if (child.type === "element" && (child.tagName === "base" || child.tagName === "title")) {
|
|
3963
4872
|
if (seen.has(child.tagName)) return false;
|
|
@@ -3966,33 +4875,99 @@ function head(node) {
|
|
|
3966
4875
|
const child = node.children[0];
|
|
3967
4876
|
return !child || child.type === "element";
|
|
3968
4877
|
}
|
|
4878
|
+
/**
|
|
4879
|
+
* Whether to omit `<body>`.
|
|
4880
|
+
*
|
|
4881
|
+
* @param {Element} node
|
|
4882
|
+
* Element.
|
|
4883
|
+
* @returns {boolean}
|
|
4884
|
+
* Whether the opening tag can be omitted.
|
|
4885
|
+
*/
|
|
3969
4886
|
function body(node) {
|
|
3970
4887
|
const head = siblingAfter(node, -1, true);
|
|
3971
4888
|
return !head || head.type !== "comment" && !(head.type === "text" && whitespace(head.value.charAt(0))) && !(head.type === "element" && (head.tagName === "meta" || head.tagName === "link" || head.tagName === "script" || head.tagName === "style" || head.tagName === "template"));
|
|
3972
4889
|
}
|
|
4890
|
+
/**
|
|
4891
|
+
* Whether to omit `<colgroup>`.
|
|
4892
|
+
* The spec describes some logic for the opening tag, but it’s easier to
|
|
4893
|
+
* implement in the closing tag, to the same effect, so we handle it there
|
|
4894
|
+
* instead.
|
|
4895
|
+
*
|
|
4896
|
+
* @param {Element} node
|
|
4897
|
+
* Element.
|
|
4898
|
+
* @param {number | undefined} index
|
|
4899
|
+
* Index of element in parent.
|
|
4900
|
+
* @param {Parents | undefined} parent
|
|
4901
|
+
* Parent of element.
|
|
4902
|
+
* @returns {boolean}
|
|
4903
|
+
* Whether the opening tag can be omitted.
|
|
4904
|
+
*/
|
|
3973
4905
|
function colgroup(node, index, parent) {
|
|
3974
4906
|
const previous = siblingBefore(parent, index);
|
|
3975
4907
|
const head = siblingAfter(node, -1, true);
|
|
3976
4908
|
if (parent && previous && previous.type === "element" && previous.tagName === "colgroup" && closing(previous, parent.children.indexOf(previous), parent)) return false;
|
|
3977
4909
|
return Boolean(head && head.type === "element" && head.tagName === "col");
|
|
3978
4910
|
}
|
|
4911
|
+
/**
|
|
4912
|
+
* Whether to omit `<tbody>`.
|
|
4913
|
+
*
|
|
4914
|
+
* @param {Element} node
|
|
4915
|
+
* Element.
|
|
4916
|
+
* @param {number | undefined} index
|
|
4917
|
+
* Index of element in parent.
|
|
4918
|
+
* @param {Parents | undefined} parent
|
|
4919
|
+
* Parent of element.
|
|
4920
|
+
* @returns {boolean}
|
|
4921
|
+
* Whether the opening tag can be omitted.
|
|
4922
|
+
*/
|
|
3979
4923
|
function tbody(node, index, parent) {
|
|
3980
4924
|
const previous = siblingBefore(parent, index);
|
|
3981
4925
|
const head = siblingAfter(node, -1);
|
|
3982
4926
|
if (parent && previous && previous.type === "element" && (previous.tagName === "thead" || previous.tagName === "tbody") && closing(previous, parent.children.indexOf(previous), parent)) return false;
|
|
3983
4927
|
return Boolean(head && head.type === "element" && head.tagName === "tr");
|
|
3984
4928
|
}
|
|
4929
|
+
//#endregion
|
|
4930
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/element.js
|
|
4931
|
+
/**
|
|
4932
|
+
* @import {Element, Parents, Properties} from 'hast'
|
|
4933
|
+
* @import {State} from '../index.js'
|
|
4934
|
+
*/
|
|
4935
|
+
/**
|
|
4936
|
+
* Maps of subsets.
|
|
4937
|
+
*
|
|
4938
|
+
* Each value is a matrix of tuples.
|
|
4939
|
+
* The value at `0` causes parse errors, the value at `1` is valid.
|
|
4940
|
+
* Of both, the value at `0` is unsafe, and the value at `1` is safe.
|
|
4941
|
+
*
|
|
4942
|
+
* @type {Record<'double' | 'name' | 'single' | 'unquoted', Array<[Array<string>, Array<string>]>>}
|
|
4943
|
+
*/
|
|
3985
4944
|
var constants = {
|
|
3986
4945
|
name: [[" \n\f\r &/=>".split(""), " \n\f\r \"&'/=>`".split("")], ["\0 \n\f\r \"&'/<=>".split(""), "\0 \n\f\r \"&'/<=>`".split("")]],
|
|
3987
4946
|
unquoted: [[" \n\f\r &>".split(""), "\0 \n\f\r \"&'<=>`".split("")], ["\0 \n\f\r \"&'<=>`".split(""), "\0 \n\f\r \"&'<=>`".split("")]],
|
|
3988
4947
|
single: [["&'".split(""), "\"&'`".split("")], ["\0&'".split(""), "\0\"&'`".split("")]],
|
|
3989
4948
|
double: [["\"&".split(""), "\"&'`".split("")], ["\0\"&".split(""), "\0\"&'`".split("")]]
|
|
3990
4949
|
};
|
|
4950
|
+
/**
|
|
4951
|
+
* Serialize an element node.
|
|
4952
|
+
*
|
|
4953
|
+
* @param {Element} node
|
|
4954
|
+
* Node to handle.
|
|
4955
|
+
* @param {number | undefined} index
|
|
4956
|
+
* Index of `node` in `parent.
|
|
4957
|
+
* @param {Parents | undefined} parent
|
|
4958
|
+
* Parent of `node`.
|
|
4959
|
+
* @param {State} state
|
|
4960
|
+
* Info passed around about the current state.
|
|
4961
|
+
* @returns {string}
|
|
4962
|
+
* Serialized node.
|
|
4963
|
+
*/
|
|
3991
4964
|
function element(node, index, parent, state) {
|
|
3992
4965
|
const schema = state.schema;
|
|
3993
4966
|
const omit = schema.space === "svg" ? false : state.settings.omitOptionalTags;
|
|
3994
4967
|
let selfClosing = schema.space === "svg" ? state.settings.closeEmptyElements : state.settings.voids.includes(node.tagName.toLowerCase());
|
|
4968
|
+
/** @type {Array<string>} */
|
|
3995
4969
|
const parts = [];
|
|
4970
|
+
/** @type {string} */
|
|
3996
4971
|
let last;
|
|
3997
4972
|
if (schema.space === "html" && node.tagName === "svg") state.schema = svg;
|
|
3998
4973
|
const attributes = serializeAttributes(state, node.properties);
|
|
@@ -4012,9 +4987,16 @@ function element(node, index, parent, state) {
|
|
|
4012
4987
|
if (!selfClosing && (!omit || !closing(node, index, parent))) parts.push("</" + node.tagName + ">");
|
|
4013
4988
|
return parts.join("");
|
|
4014
4989
|
}
|
|
4990
|
+
/**
|
|
4991
|
+
* @param {State} state
|
|
4992
|
+
* @param {Properties | null | undefined} properties
|
|
4993
|
+
* @returns {string}
|
|
4994
|
+
*/
|
|
4015
4995
|
function serializeAttributes(state, properties) {
|
|
4996
|
+
/** @type {Array<string>} */
|
|
4016
4997
|
const values = [];
|
|
4017
4998
|
let index = -1;
|
|
4999
|
+
/** @type {string} */
|
|
4018
5000
|
let key;
|
|
4019
5001
|
if (properties) {
|
|
4020
5002
|
for (key in properties) if (properties[key] !== null && properties[key] !== void 0) {
|
|
@@ -4028,11 +5010,18 @@ function serializeAttributes(state, properties) {
|
|
|
4028
5010
|
}
|
|
4029
5011
|
return values.join("");
|
|
4030
5012
|
}
|
|
5013
|
+
/**
|
|
5014
|
+
* @param {State} state
|
|
5015
|
+
* @param {string} key
|
|
5016
|
+
* @param {Properties[keyof Properties]} value
|
|
5017
|
+
* @returns {string}
|
|
5018
|
+
*/
|
|
4031
5019
|
function serializeAttribute(state, key, value) {
|
|
4032
5020
|
const info = find(state.schema, key);
|
|
4033
5021
|
const x = state.settings.allowParseErrors && state.schema.space === "html" ? 0 : 1;
|
|
4034
5022
|
const y = state.settings.allowDangerousCharacters ? 0 : 1;
|
|
4035
5023
|
let quote = state.quote;
|
|
5024
|
+
/** @type {string | undefined} */
|
|
4036
5025
|
let result;
|
|
4037
5026
|
if (info.overloadedBoolean && (value === info.attribute || value === "")) value = true;
|
|
4038
5027
|
else if ((info.boolean || info.overloadedBoolean) && (typeof value !== "string" || value === info.attribute || value === "")) value = Boolean(value);
|
|
@@ -4054,17 +5043,88 @@ function serializeAttribute(state, key, value) {
|
|
|
4054
5043
|
}
|
|
4055
5044
|
return name + (result ? "=" + result : result);
|
|
4056
5045
|
}
|
|
5046
|
+
//#endregion
|
|
5047
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/text.js
|
|
5048
|
+
/**
|
|
5049
|
+
* @import {Parents, Text} from 'hast'
|
|
5050
|
+
* @import {Raw} from 'mdast-util-to-hast'
|
|
5051
|
+
* @import {State} from '../index.js'
|
|
5052
|
+
*/
|
|
4057
5053
|
var textEntitySubset = ["<", "&"];
|
|
5054
|
+
/**
|
|
5055
|
+
* Serialize a text node.
|
|
5056
|
+
*
|
|
5057
|
+
* @param {Raw | Text} node
|
|
5058
|
+
* Node to handle.
|
|
5059
|
+
* @param {number | undefined} _
|
|
5060
|
+
* Index of `node` in `parent.
|
|
5061
|
+
* @param {Parents | undefined} parent
|
|
5062
|
+
* Parent of `node`.
|
|
5063
|
+
* @param {State} state
|
|
5064
|
+
* Info passed around about the current state.
|
|
5065
|
+
* @returns {string}
|
|
5066
|
+
* Serialized node.
|
|
5067
|
+
*/
|
|
4058
5068
|
function text(node, _, parent, state) {
|
|
4059
5069
|
return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node.value : stringifyEntities(node.value, Object.assign({}, state.settings.characterReferences, { subset: textEntitySubset }));
|
|
4060
5070
|
}
|
|
5071
|
+
//#endregion
|
|
5072
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/raw.js
|
|
5073
|
+
/**
|
|
5074
|
+
* @import {Parents} from 'hast'
|
|
5075
|
+
* @import {Raw} from 'mdast-util-to-hast'
|
|
5076
|
+
* @import {State} from '../index.js'
|
|
5077
|
+
*/
|
|
5078
|
+
/**
|
|
5079
|
+
* Serialize a raw node.
|
|
5080
|
+
*
|
|
5081
|
+
* @param {Raw} node
|
|
5082
|
+
* Node to handle.
|
|
5083
|
+
* @param {number | undefined} index
|
|
5084
|
+
* Index of `node` in `parent.
|
|
5085
|
+
* @param {Parents | undefined} parent
|
|
5086
|
+
* Parent of `node`.
|
|
5087
|
+
* @param {State} state
|
|
5088
|
+
* Info passed around about the current state.
|
|
5089
|
+
* @returns {string}
|
|
5090
|
+
* Serialized node.
|
|
5091
|
+
*/
|
|
4061
5092
|
function raw(node, index, parent, state) {
|
|
4062
5093
|
return state.settings.allowDangerousHtml ? node.value : text(node, index, parent, state);
|
|
4063
5094
|
}
|
|
5095
|
+
//#endregion
|
|
5096
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/root.js
|
|
5097
|
+
/**
|
|
5098
|
+
* @import {Parents, Root} from 'hast'
|
|
5099
|
+
* @import {State} from '../index.js'
|
|
5100
|
+
*/
|
|
5101
|
+
/**
|
|
5102
|
+
* Serialize a root.
|
|
5103
|
+
*
|
|
5104
|
+
* @param {Root} node
|
|
5105
|
+
* Node to handle.
|
|
5106
|
+
* @param {number | undefined} _1
|
|
5107
|
+
* Index of `node` in `parent.
|
|
5108
|
+
* @param {Parents | undefined} _2
|
|
5109
|
+
* Parent of `node`.
|
|
5110
|
+
* @param {State} state
|
|
5111
|
+
* Info passed around about the current state.
|
|
5112
|
+
* @returns {string}
|
|
5113
|
+
* Serialized node.
|
|
5114
|
+
*/
|
|
4064
5115
|
function root(node, _1, _2, state) {
|
|
4065
5116
|
return state.all(node);
|
|
4066
5117
|
}
|
|
4067
|
-
|
|
5118
|
+
//#endregion
|
|
5119
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/index.js
|
|
5120
|
+
/**
|
|
5121
|
+
* @import {Nodes, Parents} from 'hast'
|
|
5122
|
+
* @import {State} from '../index.js'
|
|
5123
|
+
*/
|
|
5124
|
+
/**
|
|
5125
|
+
* @type {(node: Nodes, index: number | undefined, parent: Parents | undefined, state: State) => string}
|
|
5126
|
+
*/
|
|
5127
|
+
var handle = zwitch("type", {
|
|
4068
5128
|
invalid,
|
|
4069
5129
|
unknown,
|
|
4070
5130
|
handlers: {
|
|
@@ -4076,16 +5136,195 @@ const handle = zwitch("type", {
|
|
|
4076
5136
|
text
|
|
4077
5137
|
}
|
|
4078
5138
|
});
|
|
5139
|
+
/**
|
|
5140
|
+
* Fail when a non-node is found in the tree.
|
|
5141
|
+
*
|
|
5142
|
+
* @param {unknown} node
|
|
5143
|
+
* Unknown value.
|
|
5144
|
+
* @returns {never}
|
|
5145
|
+
* Never.
|
|
5146
|
+
*/
|
|
4079
5147
|
function invalid(node) {
|
|
4080
5148
|
throw new Error("Expected node, not `" + node + "`");
|
|
4081
5149
|
}
|
|
5150
|
+
/**
|
|
5151
|
+
* Fail when a node with an unknown type is found in the tree.
|
|
5152
|
+
*
|
|
5153
|
+
* @param {unknown} node_
|
|
5154
|
+
* Unknown node.
|
|
5155
|
+
* @returns {never}
|
|
5156
|
+
* Never.
|
|
5157
|
+
*/
|
|
4082
5158
|
function unknown(node_) {
|
|
4083
5159
|
const node = node_;
|
|
4084
5160
|
throw new Error("Cannot compile unknown node `" + node.type + "`");
|
|
4085
5161
|
}
|
|
5162
|
+
//#endregion
|
|
5163
|
+
//#region ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/index.js
|
|
5164
|
+
/**
|
|
5165
|
+
* @import {Nodes, Parents, RootContent} from 'hast'
|
|
5166
|
+
* @import {Schema} from 'property-information'
|
|
5167
|
+
* @import {Options as StringifyEntitiesOptions} from 'stringify-entities'
|
|
5168
|
+
*/
|
|
5169
|
+
/**
|
|
5170
|
+
* @typedef {Omit<StringifyEntitiesOptions, 'attribute' | 'escapeOnly' | 'subset'>} CharacterReferences
|
|
5171
|
+
*
|
|
5172
|
+
* @typedef Options
|
|
5173
|
+
* Configuration.
|
|
5174
|
+
* @property {boolean | null | undefined} [allowDangerousCharacters=false]
|
|
5175
|
+
* Do not encode some characters which cause XSS vulnerabilities in older
|
|
5176
|
+
* browsers (default: `false`).
|
|
5177
|
+
*
|
|
5178
|
+
* > ⚠️ **Danger**: only set this if you completely trust the content.
|
|
5179
|
+
* @property {boolean | null | undefined} [allowDangerousHtml=false]
|
|
5180
|
+
* Allow `raw` nodes and insert them as raw HTML (default: `false`).
|
|
5181
|
+
*
|
|
5182
|
+
* When `false`, `Raw` nodes are encoded.
|
|
5183
|
+
*
|
|
5184
|
+
* > ⚠️ **Danger**: only set this if you completely trust the content.
|
|
5185
|
+
* @property {boolean | null | undefined} [allowParseErrors=false]
|
|
5186
|
+
* Do not encode characters which cause parse errors (even though they work),
|
|
5187
|
+
* to save bytes (default: `false`).
|
|
5188
|
+
*
|
|
5189
|
+
* Not used in the SVG space.
|
|
5190
|
+
*
|
|
5191
|
+
* > 👉 **Note**: intentionally creates parse errors in markup (how parse
|
|
5192
|
+
* > errors are handled is well defined, so this works but isn’t pretty).
|
|
5193
|
+
* @property {boolean | null | undefined} [bogusComments=false]
|
|
5194
|
+
* Use “bogus comments” instead of comments to save byes: `<?charlie>`
|
|
5195
|
+
* instead of `<!--charlie-->` (default: `false`).
|
|
5196
|
+
*
|
|
5197
|
+
* > 👉 **Note**: intentionally creates parse errors in markup (how parse
|
|
5198
|
+
* > errors are handled is well defined, so this works but isn’t pretty).
|
|
5199
|
+
* @property {CharacterReferences | null | undefined} [characterReferences]
|
|
5200
|
+
* Configure how to serialize character references (optional).
|
|
5201
|
+
* @property {boolean | null | undefined} [closeEmptyElements=false]
|
|
5202
|
+
* Close SVG elements without any content with slash (`/`) on the opening tag
|
|
5203
|
+
* instead of an end tag: `<circle />` instead of `<circle></circle>`
|
|
5204
|
+
* (default: `false`).
|
|
5205
|
+
*
|
|
5206
|
+
* See `tightSelfClosing` to control whether a space is used before the
|
|
5207
|
+
* slash.
|
|
5208
|
+
*
|
|
5209
|
+
* Not used in the HTML space.
|
|
5210
|
+
* @property {boolean | null | undefined} [closeSelfClosing=false]
|
|
5211
|
+
* Close self-closing nodes with an extra slash (`/`): `<img />` instead of
|
|
5212
|
+
* `<img>` (default: `false`).
|
|
5213
|
+
*
|
|
5214
|
+
* See `tightSelfClosing` to control whether a space is used before the
|
|
5215
|
+
* slash.
|
|
5216
|
+
*
|
|
5217
|
+
* Not used in the SVG space.
|
|
5218
|
+
* @property {boolean | null | undefined} [collapseEmptyAttributes=false]
|
|
5219
|
+
* Collapse empty attributes: get `class` instead of `class=""` (default:
|
|
5220
|
+
* `false`).
|
|
5221
|
+
*
|
|
5222
|
+
* Not used in the SVG space.
|
|
5223
|
+
*
|
|
5224
|
+
* > 👉 **Note**: boolean attributes (such as `hidden`) are always collapsed.
|
|
5225
|
+
* @property {boolean | null | undefined} [omitOptionalTags=false]
|
|
5226
|
+
* Omit optional opening and closing tags (default: `false`).
|
|
5227
|
+
*
|
|
5228
|
+
* For example, in `<ol><li>one</li><li>two</li></ol>`, both `</li>` closing
|
|
5229
|
+
* tags can be omitted.
|
|
5230
|
+
* The first because it’s followed by another `li`, the last because it’s
|
|
5231
|
+
* followed by nothing.
|
|
5232
|
+
*
|
|
5233
|
+
* Not used in the SVG space.
|
|
5234
|
+
* @property {boolean | null | undefined} [preferUnquoted=false]
|
|
5235
|
+
* Leave attributes unquoted if that results in less bytes (default: `false`).
|
|
5236
|
+
*
|
|
5237
|
+
* Not used in the SVG space.
|
|
5238
|
+
* @property {boolean | null | undefined} [quoteSmart=false]
|
|
5239
|
+
* Use the other quote if that results in less bytes (default: `false`).
|
|
5240
|
+
* @property {Quote | null | undefined} [quote='"']
|
|
5241
|
+
* Preferred quote to use (default: `'"'`).
|
|
5242
|
+
* @property {Space | null | undefined} [space='html']
|
|
5243
|
+
* When an `<svg>` element is found in the HTML space, this package already
|
|
5244
|
+
* automatically switches to and from the SVG space when entering and exiting
|
|
5245
|
+
* it (default: `'html'`).
|
|
5246
|
+
*
|
|
5247
|
+
* > 👉 **Note**: hast is not XML.
|
|
5248
|
+
* > It supports SVG as embedded in HTML.
|
|
5249
|
+
* > It does not support the features available in XML.
|
|
5250
|
+
* > Passing SVG might break but fragments of modern SVG should be fine.
|
|
5251
|
+
* > Use [`xast`][xast] if you need to support SVG as XML.
|
|
5252
|
+
* @property {boolean | null | undefined} [tightAttributes=false]
|
|
5253
|
+
* Join attributes together, without whitespace, if possible: get
|
|
5254
|
+
* `class="a b"title="c d"` instead of `class="a b" title="c d"` to save
|
|
5255
|
+
* bytes (default: `false`).
|
|
5256
|
+
*
|
|
5257
|
+
* Not used in the SVG space.
|
|
5258
|
+
*
|
|
5259
|
+
* > 👉 **Note**: intentionally creates parse errors in markup (how parse
|
|
5260
|
+
* > errors are handled is well defined, so this works but isn’t pretty).
|
|
5261
|
+
* @property {boolean | null | undefined} [tightCommaSeparatedLists=false]
|
|
5262
|
+
* Join known comma-separated attribute values with just a comma (`,`),
|
|
5263
|
+
* instead of padding them on the right as well (`,␠`, where `␠` represents a
|
|
5264
|
+
* space) (default: `false`).
|
|
5265
|
+
* @property {boolean | null | undefined} [tightDoctype=false]
|
|
5266
|
+
* Drop unneeded spaces in doctypes: `<!doctypehtml>` instead of
|
|
5267
|
+
* `<!doctype html>` to save bytes (default: `false`).
|
|
5268
|
+
*
|
|
5269
|
+
* > 👉 **Note**: intentionally creates parse errors in markup (how parse
|
|
5270
|
+
* > errors are handled is well defined, so this works but isn’t pretty).
|
|
5271
|
+
* @property {boolean | null | undefined} [tightSelfClosing=false]
|
|
5272
|
+
* Do not use an extra space when closing self-closing elements: `<img/>`
|
|
5273
|
+
* instead of `<img />` (default: `false`).
|
|
5274
|
+
*
|
|
5275
|
+
* > 👉 **Note**: only used if `closeSelfClosing: true` or
|
|
5276
|
+
* > `closeEmptyElements: true`.
|
|
5277
|
+
* @property {boolean | null | undefined} [upperDoctype=false]
|
|
5278
|
+
* Use a `<!DOCTYPE…` instead of `<!doctype…` (default: `false`).
|
|
5279
|
+
*
|
|
5280
|
+
* Useless except for XHTML.
|
|
5281
|
+
* @property {ReadonlyArray<string> | null | undefined} [voids]
|
|
5282
|
+
* Tag names of elements to serialize without closing tag (default: `html-void-elements`).
|
|
5283
|
+
*
|
|
5284
|
+
* Not used in the SVG space.
|
|
5285
|
+
*
|
|
5286
|
+
* > 👉 **Note**: It’s highly unlikely that you want to pass this, because
|
|
5287
|
+
* > hast is not for XML, and HTML will not add more void elements.
|
|
5288
|
+
*
|
|
5289
|
+
* @typedef {'"' | "'"} Quote
|
|
5290
|
+
* HTML quotes for attribute values.
|
|
5291
|
+
*
|
|
5292
|
+
* @typedef {Omit<Required<{[key in keyof Options]: Exclude<Options[key], null | undefined>}>, 'space' | 'quote'>} Settings
|
|
5293
|
+
*
|
|
5294
|
+
* @typedef {'html' | 'svg'} Space
|
|
5295
|
+
* Namespace.
|
|
5296
|
+
*
|
|
5297
|
+
* @typedef State
|
|
5298
|
+
* Info passed around about the current state.
|
|
5299
|
+
* @property {(node: Parents | undefined) => string} all
|
|
5300
|
+
* Serialize the children of a parent node.
|
|
5301
|
+
* @property {Quote} alternative
|
|
5302
|
+
* Alternative quote.
|
|
5303
|
+
* @property {(node: Nodes, index: number | undefined, parent: Parents | undefined) => string} one
|
|
5304
|
+
* Serialize one node.
|
|
5305
|
+
* @property {Quote} quote
|
|
5306
|
+
* Preferred quote.
|
|
5307
|
+
* @property {Schema} schema
|
|
5308
|
+
* Current schema.
|
|
5309
|
+
* @property {Settings} settings
|
|
5310
|
+
* User configuration.
|
|
5311
|
+
*/
|
|
5312
|
+
/** @type {Options} */
|
|
4086
5313
|
var emptyOptions = {};
|
|
5314
|
+
/** @type {CharacterReferences} */
|
|
4087
5315
|
var emptyCharacterReferences = {};
|
|
5316
|
+
/** @type {Array<never>} */
|
|
4088
5317
|
var emptyChildren = [];
|
|
5318
|
+
/**
|
|
5319
|
+
* Serialize hast as HTML.
|
|
5320
|
+
*
|
|
5321
|
+
* @param {Array<RootContent> | Nodes} tree
|
|
5322
|
+
* Tree to serialize.
|
|
5323
|
+
* @param {Options | null | undefined} [options]
|
|
5324
|
+
* Configuration (optional).
|
|
5325
|
+
* @returns {string}
|
|
5326
|
+
* Serialized HTML.
|
|
5327
|
+
*/
|
|
4089
5328
|
function toHtml(tree, options) {
|
|
4090
5329
|
const options_ = options || emptyOptions;
|
|
4091
5330
|
const quote = options_.quote || "\"";
|
|
@@ -4121,16 +5360,42 @@ function toHtml(tree, options) {
|
|
|
4121
5360
|
children: tree
|
|
4122
5361
|
} : tree, void 0, void 0);
|
|
4123
5362
|
}
|
|
5363
|
+
/**
|
|
5364
|
+
* Serialize a node.
|
|
5365
|
+
*
|
|
5366
|
+
* @this {State}
|
|
5367
|
+
* Info passed around about the current state.
|
|
5368
|
+
* @param {Nodes} node
|
|
5369
|
+
* Node to handle.
|
|
5370
|
+
* @param {number | undefined} index
|
|
5371
|
+
* Index of `node` in `parent.
|
|
5372
|
+
* @param {Parents | undefined} parent
|
|
5373
|
+
* Parent of `node`.
|
|
5374
|
+
* @returns {string}
|
|
5375
|
+
* Serialized node.
|
|
5376
|
+
*/
|
|
4124
5377
|
function one(node, index, parent) {
|
|
4125
5378
|
return handle(node, index, parent, this);
|
|
4126
5379
|
}
|
|
5380
|
+
/**
|
|
5381
|
+
* Serialize all children of `parent`.
|
|
5382
|
+
*
|
|
5383
|
+
* @this {State}
|
|
5384
|
+
* Info passed around about the current state.
|
|
5385
|
+
* @param {Parents | undefined} parent
|
|
5386
|
+
* Parent whose children to serialize.
|
|
5387
|
+
* @returns {string}
|
|
5388
|
+
*/
|
|
4127
5389
|
function all(parent) {
|
|
5390
|
+
/** @type {Array<string>} */
|
|
4128
5391
|
const results = [];
|
|
4129
5392
|
const children = parent && parent.children || emptyChildren;
|
|
4130
5393
|
let index = -1;
|
|
4131
5394
|
while (++index < children.length) results[index] = this.one(children[index], index, parent);
|
|
4132
5395
|
return results.join("");
|
|
4133
5396
|
}
|
|
5397
|
+
//#endregion
|
|
5398
|
+
//#region ../../node_modules/.pnpm/@shikijs+core@3.22.0/node_modules/@shikijs/core/dist/index.mjs
|
|
4134
5399
|
function resolveColorReplacements(theme, options) {
|
|
4135
5400
|
const replacements = typeof theme === "string" ? {} : { ...theme.colorReplacements };
|
|
4136
5401
|
const themeName = typeof theme === "string" ? theme : theme.name;
|
|
@@ -4328,6 +5593,9 @@ function getLastGrammarStateFromMap(keys) {
|
|
|
4328
5593
|
return _grammarStateMap.get(keys);
|
|
4329
5594
|
}
|
|
4330
5595
|
var GrammarState = class GrammarState {
|
|
5596
|
+
/**
|
|
5597
|
+
* Theme to Stack mapping
|
|
5598
|
+
*/
|
|
4331
5599
|
_stacks = {};
|
|
4332
5600
|
lang;
|
|
4333
5601
|
get themes() {
|
|
@@ -4339,6 +5607,9 @@ var GrammarState = class GrammarState {
|
|
|
4339
5607
|
get _stack() {
|
|
4340
5608
|
return this._stacks[this.theme];
|
|
4341
5609
|
}
|
|
5610
|
+
/**
|
|
5611
|
+
* Static method to create a initial grammar state.
|
|
5612
|
+
*/
|
|
4342
5613
|
static initial(lang, themes) {
|
|
4343
5614
|
return new GrammarState(Object.fromEntries(toArray(themes).map((theme) => [theme, INITIAL])), lang);
|
|
4344
5615
|
}
|
|
@@ -4353,6 +5624,10 @@ var GrammarState = class GrammarState {
|
|
|
4353
5624
|
this._stacks = { [theme]: stack };
|
|
4354
5625
|
}
|
|
4355
5626
|
}
|
|
5627
|
+
/**
|
|
5628
|
+
* Get the internal stack object.
|
|
5629
|
+
* @internal
|
|
5630
|
+
*/
|
|
4356
5631
|
getInternalStack(theme = this.theme) {
|
|
4357
5632
|
return this._stacks[theme];
|
|
4358
5633
|
}
|
|
@@ -6113,4 +7388,5 @@ function createCssVariablesTheme(options = {}) {
|
|
|
6113
7388
|
});
|
|
6114
7389
|
return theme;
|
|
6115
7390
|
}
|
|
7391
|
+
//#endregion
|
|
6116
7392
|
export { ShikiError, addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createBundledHighlighter, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createdBundledHighlighter, enableDeprecationWarnings, flatTokenVariants, getSingletonHighlighterCore, getTokenStyleObject, guessEmbeddedLanguages, hastToHtml, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
|