@pubinfo/core 2.1.10-beta.2 → 2.1.11
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/{AppSetting-Dl8pVkN4.js → AppSetting-7jlhUzze.js} +42 -42
- package/dist/{HButton-CzYSwI6a.js → HButton-Dt6qGhhR.js} +7 -7
- package/dist/{HCheckList-CHR-lWIq.js → HCheckList-cPBgATmv.js} +15 -15
- package/dist/{HDivider-CXS9rl4C.js → HDivider-BwvBr5OE.js} +3 -3
- package/dist/{HInput-CSVwTg1Q.js → HInput-KJ5nFBpF.js} +10 -10
- package/dist/HSlideover-DVQDc9q6.js +3151 -0
- package/dist/{HToggle-C_iVIpxv.js → HToggle-Ce_2-yhZ.js} +8 -8
- package/dist/{HTooltip-BHBHfrCD.js → HTooltip-DjAU-Evn.js} +6 -6
- package/dist/PreferencesContent-BAIH81yS.js +701 -0
- package/dist/SettingBreadcrumb-O9-PhAFT.js +45 -0
- package/dist/SettingCopyright-DIKsWTuf.js +45 -0
- package/dist/{SettingEnableTransition-BBH52KKl.js → SettingEnableTransition-61O7W00b.js} +19 -19
- package/dist/SettingHome-Sv65TPH8.js +31 -0
- package/dist/SettingMenu-BvwJOUZV.js +111 -0
- package/dist/{SettingMode-BwhhUYlz.js → SettingMode-B8H_eQc8.js} +14 -14
- package/dist/SettingNavSearch-BHsmYBA7.js +31 -0
- package/dist/SettingOther-CyyNnaDX.js +48 -0
- package/dist/SettingPage-B82lW41P.js +22 -0
- package/dist/{SettingTabbar-DuqQVRnz.js → SettingTabbar-Bky2xvH-.js} +58 -58
- package/dist/{SettingThemes-Doo6Ax3u.js → SettingThemes-CkdzS1xt.js} +44 -44
- package/dist/SettingToolbar-CD4qns1J.js +50 -0
- package/dist/SettingTopbar-1shjoe3s.js +49 -0
- package/dist/{SettingWidthMode-VaN0CrBa.js → SettingWidthMode-DlG6lXjA.js} +14 -14
- package/dist/auth-BLGKOyc5.js +4432 -0
- package/dist/built-in/layout-component/composables/useContext.d.ts +1 -0
- package/dist/{change-organization-OjxZhWST.js → change-organization-hsqeSzDu.js} +38 -38
- package/dist/{change-password-B6kO54-d.js → change-password-EtccCDRX.js} +73 -73
- package/dist/{chunk-EsrJ1IKw.js → chunk-CD4vhpVs.js} +3 -3
- package/dist/{components-DVIyiEVI.js → components-DFNyaAb9.js} +1584 -1584
- package/dist/core/request.d.ts +1 -1
- package/dist/core-DJIGzMMM.js +4885 -0
- package/dist/dist-7OjQvlya.js +468 -0
- package/dist/engine-oniguruma-CaNXwGSv.js +243 -0
- package/dist/features/settings/index.d.ts +90 -1
- package/dist/{form-EQ9eL9hv.js → form-C3VHofnN.js} +923 -443
- package/dist/index.js +4418 -3895
- package/dist/{modal-CSWipFvB.js → modal-Bl5xHbxa.js} +15510 -15790
- package/dist/{not-found-DBe-djEg.js → not-found-BCjngLzt.js} +19 -19
- package/dist/{not-permission-DQzWCpOK.js → not-permission-C26vTMvf.js} +19 -19
- package/dist/{profile-DJ3gpjsS.js → profile-BVXIFuBG.js} +3340 -3277
- package/dist/{question-line-BKVlJGUb.js → question-line-BG__Ycfv.js} +2 -2
- package/dist/{reload-DAR8dVYw.js → reload-DHx5Vwus.js} +4 -4
- package/dist/{right-VKgVtqD5.js → right-BxBlFUwj.js} +6 -6
- package/dist/style.css +1 -1
- package/dist/{tree-select-CTjWj5WT.js → tree-select-B8cTcGLa.js} +2575 -2256
- package/dist/watchDiff-CPZFtaOC.js +655 -0
- package/package.json +41 -41
- package/src/built-in/layout-component/components/Header/HeaderMenu.vue +2 -3
- package/src/built-in/layout-component/components/Menu/item.vue +2 -2
- package/src/built-in/layout-component/components/Menu/sub.vue +20 -1
- package/src/built-in/layout-component/composables/useContext.ts +1 -0
- package/src/built-in/layout-component/composables/useLayoutVisible.ts +1 -1
- package/src/built-in/layout-component/provider.ts +5 -0
- package/src/built-in/system-info/components/SystemInfo.vue +68 -66
- package/src/built-in/system-info/index.ts +4 -4
- package/src/core/ctx.ts +2 -2
- package/src/core/request.ts +1 -1
- package/src/features/components/PubinfoApp/index.vue +1 -0
- package/types/auto-imports.d.ts +63 -63
- package/types/components.d.ts +45 -1
- package/dist/HSlideover-Bc6OHPHe.js +0 -1695
- package/dist/HeaderFullMenu-BRhGliRJ.js +0 -6
- package/dist/HeaderFullMenu-DCF-gTCZ.js +0 -249
- package/dist/HeaderThinMenu-B_7vLcQX.js +0 -6
- package/dist/HeaderThinMenu-PA12XAvb.js +0 -437
- package/dist/PreferencesContent-cll4nwwl.js +0 -695
- package/dist/SettingBreadcrumb-BvSc7VUo.js +0 -45
- package/dist/SettingCopyright-DcWLKM5d.js +0 -45
- package/dist/SettingHome-Cd43oJmB.js +0 -31
- package/dist/SettingMenu-CJsN4F1l.js +0 -111
- package/dist/SettingNavSearch-BhHUWem3.js +0 -31
- package/dist/SettingOther-CDY0jSVT.js +0 -48
- package/dist/SettingPage-B0WNvUlj.js +0 -22
- package/dist/SettingToolbar-CHV_dVJ9.js +0 -50
- package/dist/SettingTopbar-CF1K_XIt.js +0 -49
- package/dist/auth-CPSkJwBz.js +0 -3968
- package/dist/core-Bg2PEcZK.js +0 -4884
- package/dist/dist-DAb-7mqe.js +0 -468
- package/dist/engine-oniguruma-CUfGsBrF.js +0 -243
- package/dist/overlayscrollbars-vue-BOGU2FK-.js +0 -1436
- package/dist/pick-C42gkI1h.js +0 -10
- package/dist/watchDiff-C4eGkl9e.js +0 -397
- /package/dist/{_plugin-vue_export-helper-DaPiLSxE.js → _plugin-vue_export-helper-sUTDUeGO.js} +0 -0
- /package/dist/{json-S7wVLDnW.js → json-Bu_Zprin.js} +0 -0
- /package/dist/{useContext-D6pJCZez.js → useContext-DLtu9F7E.js} +0 -0
- /package/dist/{vitesse-dark-BsnBIHGG.js → vitesse-dark-CTe40QT_.js} +0 -0
- /package/dist/{vitesse-light-Cs_6DF7j.js → vitesse-light-BWXC_WeB.js} +0 -0
- /package/dist/{wasm-EvDQvzqp.js → wasm-2zDVqo-C.js} +0 -0
package/dist/core-Bg2PEcZK.js
DELETED
|
@@ -1,4884 +0,0 @@
|
|
|
1
|
-
import { n as __export } from "./chunk-EsrJ1IKw.js";
|
|
2
|
-
var ShikiError = class extends Error {
|
|
3
|
-
constructor(s) {
|
|
4
|
-
super(s), this.name = "ShikiError";
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
function clone(s) {
|
|
8
|
-
return doClone(s);
|
|
9
|
-
}
|
|
10
|
-
function doClone(s) {
|
|
11
|
-
return Array.isArray(s) ? cloneArray(s) : s instanceof RegExp ? s : typeof s == "object" ? cloneObj(s) : s;
|
|
12
|
-
}
|
|
13
|
-
function cloneArray(s) {
|
|
14
|
-
let I = [];
|
|
15
|
-
for (let L = 0, z = s.length; L < z; L++) I[L] = doClone(s[L]);
|
|
16
|
-
return I;
|
|
17
|
-
}
|
|
18
|
-
function cloneObj(s) {
|
|
19
|
-
let I = {};
|
|
20
|
-
for (let L in s) I[L] = doClone(s[L]);
|
|
21
|
-
return I;
|
|
22
|
-
}
|
|
23
|
-
function mergeObjects(s, ...I) {
|
|
24
|
-
return I.forEach((I) => {
|
|
25
|
-
for (let L in I) s[L] = I[L];
|
|
26
|
-
}), s;
|
|
27
|
-
}
|
|
28
|
-
function basename(s) {
|
|
29
|
-
let I = ~s.lastIndexOf("/") || ~s.lastIndexOf("\\");
|
|
30
|
-
return I === 0 ? s : ~I === s.length - 1 ? basename(s.substring(0, s.length - 1)) : s.substr(~I + 1);
|
|
31
|
-
}
|
|
32
|
-
var CAPTURING_REGEX_SOURCE = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g, RegexSource = class {
|
|
33
|
-
static hasCaptures(s) {
|
|
34
|
-
return s === null ? !1 : (CAPTURING_REGEX_SOURCE.lastIndex = 0, CAPTURING_REGEX_SOURCE.test(s));
|
|
35
|
-
}
|
|
36
|
-
static replaceCaptures(s, I, L) {
|
|
37
|
-
return s.replace(CAPTURING_REGEX_SOURCE, (s, R, z, B) => {
|
|
38
|
-
let V = L[parseInt(R || z, 10)];
|
|
39
|
-
if (V) {
|
|
40
|
-
let s = I.substring(V.start, V.end);
|
|
41
|
-
for (; s[0] === ".";) s = s.substring(1);
|
|
42
|
-
switch (B) {
|
|
43
|
-
case "downcase": return s.toLowerCase();
|
|
44
|
-
case "upcase": return s.toUpperCase();
|
|
45
|
-
default: return s;
|
|
46
|
-
}
|
|
47
|
-
} else return s;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
function strcmp(s, I) {
|
|
52
|
-
return s < I ? -1 : s > I ? 1 : 0;
|
|
53
|
-
}
|
|
54
|
-
function strArrCmp(s, I) {
|
|
55
|
-
if (s === null && I === null) return 0;
|
|
56
|
-
if (!s) return -1;
|
|
57
|
-
if (!I) return 1;
|
|
58
|
-
let L = s.length, R = I.length;
|
|
59
|
-
if (L === R) {
|
|
60
|
-
for (let R = 0; R < L; R++) {
|
|
61
|
-
let L = strcmp(s[R], I[R]);
|
|
62
|
-
if (L !== 0) return L;
|
|
63
|
-
}
|
|
64
|
-
return 0;
|
|
65
|
-
}
|
|
66
|
-
return L - R;
|
|
67
|
-
}
|
|
68
|
-
function isValidHexColor(s) {
|
|
69
|
-
return !!(/^#[0-9a-f]{6}$/i.test(s) || /^#[0-9a-f]{8}$/i.test(s) || /^#[0-9a-f]{3}$/i.test(s) || /^#[0-9a-f]{4}$/i.test(s));
|
|
70
|
-
}
|
|
71
|
-
function escapeRegExpCharacters(s) {
|
|
72
|
-
return s.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, "\\$&");
|
|
73
|
-
}
|
|
74
|
-
var CachedFn = class {
|
|
75
|
-
constructor(s) {
|
|
76
|
-
this.fn = s;
|
|
77
|
-
}
|
|
78
|
-
cache = /* @__PURE__ */ new Map();
|
|
79
|
-
get(s) {
|
|
80
|
-
if (this.cache.has(s)) return this.cache.get(s);
|
|
81
|
-
let I = this.fn(s);
|
|
82
|
-
return this.cache.set(s, I), I;
|
|
83
|
-
}
|
|
84
|
-
}, Theme = class {
|
|
85
|
-
constructor(s, I, L) {
|
|
86
|
-
this._colorMap = s, this._defaults = I, this._root = L;
|
|
87
|
-
}
|
|
88
|
-
static createFromRawTheme(s, I) {
|
|
89
|
-
return this.createFromParsedTheme(parseTheme(s), I);
|
|
90
|
-
}
|
|
91
|
-
static createFromParsedTheme(s, I) {
|
|
92
|
-
return resolveParsedThemeRules(s, I);
|
|
93
|
-
}
|
|
94
|
-
_cachedMatchRoot = new CachedFn((s) => this._root.match(s));
|
|
95
|
-
getColorMap() {
|
|
96
|
-
return this._colorMap.getColorMap();
|
|
97
|
-
}
|
|
98
|
-
getDefaults() {
|
|
99
|
-
return this._defaults;
|
|
100
|
-
}
|
|
101
|
-
match(s) {
|
|
102
|
-
if (s === null) return this._defaults;
|
|
103
|
-
let I = s.scopeName, L = this._cachedMatchRoot.get(I).find((I) => _scopePathMatchesParentScopes(s.parent, I.parentScopes));
|
|
104
|
-
return L ? new StyleAttributes(L.fontStyle, L.foreground, L.background) : null;
|
|
105
|
-
}
|
|
106
|
-
}, ScopeStack = class s {
|
|
107
|
-
constructor(s, I) {
|
|
108
|
-
this.parent = s, this.scopeName = I;
|
|
109
|
-
}
|
|
110
|
-
static push(I, L) {
|
|
111
|
-
for (let R of L) I = new s(I, R);
|
|
112
|
-
return I;
|
|
113
|
-
}
|
|
114
|
-
static from(...I) {
|
|
115
|
-
let L = null;
|
|
116
|
-
for (let R = 0; R < I.length; R++) L = new s(L, I[R]);
|
|
117
|
-
return L;
|
|
118
|
-
}
|
|
119
|
-
push(I) {
|
|
120
|
-
return new s(this, I);
|
|
121
|
-
}
|
|
122
|
-
getSegments() {
|
|
123
|
-
let s = this, I = [];
|
|
124
|
-
for (; s;) I.push(s.scopeName), s = s.parent;
|
|
125
|
-
return I.reverse(), I;
|
|
126
|
-
}
|
|
127
|
-
toString() {
|
|
128
|
-
return this.getSegments().join(" ");
|
|
129
|
-
}
|
|
130
|
-
extends(s) {
|
|
131
|
-
return this === s ? !0 : this.parent === null ? !1 : this.parent.extends(s);
|
|
132
|
-
}
|
|
133
|
-
getExtensionIfDefined(s) {
|
|
134
|
-
let I = [], L = this;
|
|
135
|
-
for (; L && L !== s;) I.push(L.scopeName), L = L.parent;
|
|
136
|
-
return L === s ? I.reverse() : void 0;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
function _scopePathMatchesParentScopes(s, I) {
|
|
140
|
-
if (I.length === 0) return !0;
|
|
141
|
-
for (let L = 0; L < I.length; L++) {
|
|
142
|
-
let R = I[L], z = !1;
|
|
143
|
-
if (R === ">") {
|
|
144
|
-
if (L === I.length - 1) return !1;
|
|
145
|
-
R = I[++L], z = !0;
|
|
146
|
-
}
|
|
147
|
-
for (; s && !_matchesScope(s.scopeName, R);) {
|
|
148
|
-
if (z) return !1;
|
|
149
|
-
s = s.parent;
|
|
150
|
-
}
|
|
151
|
-
if (!s) return !1;
|
|
152
|
-
s = s.parent;
|
|
153
|
-
}
|
|
154
|
-
return !0;
|
|
155
|
-
}
|
|
156
|
-
function _matchesScope(s, I) {
|
|
157
|
-
return I === s || s.startsWith(I) && s[I.length] === ".";
|
|
158
|
-
}
|
|
159
|
-
var StyleAttributes = class {
|
|
160
|
-
constructor(s, I, L) {
|
|
161
|
-
this.fontStyle = s, this.foregroundId = I, this.backgroundId = L;
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
function parseTheme(s) {
|
|
165
|
-
if (!s || !s.settings || !Array.isArray(s.settings)) return [];
|
|
166
|
-
let I = s.settings, L = [], R = 0;
|
|
167
|
-
for (let s = 0, z = I.length; s < z; s++) {
|
|
168
|
-
let z = I[s];
|
|
169
|
-
if (!z.settings) continue;
|
|
170
|
-
let B;
|
|
171
|
-
if (typeof z.scope == "string") {
|
|
172
|
-
let s = z.scope;
|
|
173
|
-
s = s.replace(/^[,]+/, ""), s = s.replace(/[,]+$/, ""), B = s.split(",");
|
|
174
|
-
} else B = Array.isArray(z.scope) ? z.scope : [""];
|
|
175
|
-
let V = -1;
|
|
176
|
-
if (typeof z.settings.fontStyle == "string") {
|
|
177
|
-
V = 0;
|
|
178
|
-
let s = z.settings.fontStyle.split(" ");
|
|
179
|
-
for (let I = 0, L = s.length; I < L; I++) switch (s[I]) {
|
|
180
|
-
case "italic":
|
|
181
|
-
V |= 1;
|
|
182
|
-
break;
|
|
183
|
-
case "bold":
|
|
184
|
-
V |= 2;
|
|
185
|
-
break;
|
|
186
|
-
case "underline":
|
|
187
|
-
V |= 4;
|
|
188
|
-
break;
|
|
189
|
-
case "strikethrough":
|
|
190
|
-
V |= 8;
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
let H = null;
|
|
195
|
-
typeof z.settings.foreground == "string" && isValidHexColor(z.settings.foreground) && (H = z.settings.foreground);
|
|
196
|
-
let U = null;
|
|
197
|
-
typeof z.settings.background == "string" && isValidHexColor(z.settings.background) && (U = z.settings.background);
|
|
198
|
-
for (let I = 0, z = B.length; I < z; I++) {
|
|
199
|
-
let z = B[I].trim().split(" "), W = z[z.length - 1], G = null;
|
|
200
|
-
z.length > 1 && (G = z.slice(0, z.length - 1), G.reverse()), L[R++] = new ParsedThemeRule(W, G, s, V, H, U);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return L;
|
|
204
|
-
}
|
|
205
|
-
var ParsedThemeRule = class {
|
|
206
|
-
constructor(s, I, L, R, z, B) {
|
|
207
|
-
this.scope = s, this.parentScopes = I, this.index = L, this.fontStyle = R, this.foreground = z, this.background = B;
|
|
208
|
-
}
|
|
209
|
-
}, FontStyle = /* @__PURE__ */ ((s) => (s[s.NotSet = -1] = "NotSet", s[s.None = 0] = "None", s[s.Italic = 1] = "Italic", s[s.Bold = 2] = "Bold", s[s.Underline = 4] = "Underline", s[s.Strikethrough = 8] = "Strikethrough", s))(FontStyle || {});
|
|
210
|
-
function resolveParsedThemeRules(s, I) {
|
|
211
|
-
s.sort((s, I) => {
|
|
212
|
-
let L = strcmp(s.scope, I.scope);
|
|
213
|
-
return L !== 0 || (L = strArrCmp(s.parentScopes, I.parentScopes), L !== 0) ? L : s.index - I.index;
|
|
214
|
-
});
|
|
215
|
-
let L = 0, R = "#000000", z = "#ffffff";
|
|
216
|
-
for (; s.length >= 1 && s[0].scope === "";) {
|
|
217
|
-
let I = s.shift();
|
|
218
|
-
I.fontStyle !== -1 && (L = I.fontStyle), I.foreground !== null && (R = I.foreground), I.background !== null && (z = I.background);
|
|
219
|
-
}
|
|
220
|
-
let B = new ColorMap(I), V = new StyleAttributes(L, B.getId(R), B.getId(z)), H = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1, 0, 0), []);
|
|
221
|
-
for (let I = 0, L = s.length; I < L; I++) {
|
|
222
|
-
let L = s[I];
|
|
223
|
-
H.insert(0, L.scope, L.parentScopes, L.fontStyle, B.getId(L.foreground), B.getId(L.background));
|
|
224
|
-
}
|
|
225
|
-
return new Theme(B, V, H);
|
|
226
|
-
}
|
|
227
|
-
var ColorMap = class {
|
|
228
|
-
_isFrozen;
|
|
229
|
-
_lastColorId;
|
|
230
|
-
_id2color;
|
|
231
|
-
_color2id;
|
|
232
|
-
constructor(s) {
|
|
233
|
-
if (this._lastColorId = 0, this._id2color = [], this._color2id = /* @__PURE__ */ Object.create(null), Array.isArray(s)) {
|
|
234
|
-
this._isFrozen = !0;
|
|
235
|
-
for (let I = 0, L = s.length; I < L; I++) this._color2id[s[I]] = I, this._id2color[I] = s[I];
|
|
236
|
-
} else this._isFrozen = !1;
|
|
237
|
-
}
|
|
238
|
-
getId(s) {
|
|
239
|
-
if (s === null) return 0;
|
|
240
|
-
s = s.toUpperCase();
|
|
241
|
-
let I = this._color2id[s];
|
|
242
|
-
if (I) return I;
|
|
243
|
-
if (this._isFrozen) throw Error(`Missing color in color map - ${s}`);
|
|
244
|
-
return I = ++this._lastColorId, this._color2id[s] = I, this._id2color[I] = s, I;
|
|
245
|
-
}
|
|
246
|
-
getColorMap() {
|
|
247
|
-
return this._id2color.slice(0);
|
|
248
|
-
}
|
|
249
|
-
}, emptyParentScopes = Object.freeze([]), ThemeTrieElementRule = class s {
|
|
250
|
-
scopeDepth;
|
|
251
|
-
parentScopes;
|
|
252
|
-
fontStyle;
|
|
253
|
-
foreground;
|
|
254
|
-
background;
|
|
255
|
-
constructor(s, I, L, R, z) {
|
|
256
|
-
this.scopeDepth = s, this.parentScopes = I || emptyParentScopes, this.fontStyle = L, this.foreground = R, this.background = z;
|
|
257
|
-
}
|
|
258
|
-
clone() {
|
|
259
|
-
return new s(this.scopeDepth, this.parentScopes, this.fontStyle, this.foreground, this.background);
|
|
260
|
-
}
|
|
261
|
-
static cloneArr(s) {
|
|
262
|
-
let I = [];
|
|
263
|
-
for (let L = 0, R = s.length; L < R; L++) I[L] = s[L].clone();
|
|
264
|
-
return I;
|
|
265
|
-
}
|
|
266
|
-
acceptOverwrite(s, I, L, R) {
|
|
267
|
-
this.scopeDepth > s ? console.log("how did this happen?") : this.scopeDepth = s, I !== -1 && (this.fontStyle = I), L !== 0 && (this.foreground = L), R !== 0 && (this.background = R);
|
|
268
|
-
}
|
|
269
|
-
}, ThemeTrieElement = class s {
|
|
270
|
-
constructor(s, I = [], L = {}) {
|
|
271
|
-
this._mainRule = s, this._children = L, this._rulesWithParentScopes = I;
|
|
272
|
-
}
|
|
273
|
-
_rulesWithParentScopes;
|
|
274
|
-
static _cmpBySpecificity(s, I) {
|
|
275
|
-
if (s.scopeDepth !== I.scopeDepth) return I.scopeDepth - s.scopeDepth;
|
|
276
|
-
let L = 0, R = 0;
|
|
277
|
-
for (; s.parentScopes[L] === ">" && L++, I.parentScopes[R] === ">" && R++, !(L >= s.parentScopes.length || R >= I.parentScopes.length);) {
|
|
278
|
-
let z = I.parentScopes[R].length - s.parentScopes[L].length;
|
|
279
|
-
if (z !== 0) return z;
|
|
280
|
-
L++, R++;
|
|
281
|
-
}
|
|
282
|
-
return I.parentScopes.length - s.parentScopes.length;
|
|
283
|
-
}
|
|
284
|
-
match(I) {
|
|
285
|
-
if (I !== "") {
|
|
286
|
-
let s = I.indexOf("."), L, R;
|
|
287
|
-
if (s === -1 ? (L = I, R = "") : (L = I.substring(0, s), R = I.substring(s + 1)), this._children.hasOwnProperty(L)) return this._children[L].match(R);
|
|
288
|
-
}
|
|
289
|
-
let L = this._rulesWithParentScopes.concat(this._mainRule);
|
|
290
|
-
return L.sort(s._cmpBySpecificity), L;
|
|
291
|
-
}
|
|
292
|
-
insert(I, L, R, z, B, V) {
|
|
293
|
-
if (L === "") {
|
|
294
|
-
this._doInsertHere(I, R, z, B, V);
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
let H = L.indexOf("."), U, W;
|
|
298
|
-
H === -1 ? (U = L, W = "") : (U = L.substring(0, H), W = L.substring(H + 1));
|
|
299
|
-
let G;
|
|
300
|
-
this._children.hasOwnProperty(U) ? G = this._children[U] : (G = new s(this._mainRule.clone(), ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes)), this._children[U] = G), G.insert(I + 1, W, R, z, B, V);
|
|
301
|
-
}
|
|
302
|
-
_doInsertHere(s, I, L, R, z) {
|
|
303
|
-
if (I === null) {
|
|
304
|
-
this._mainRule.acceptOverwrite(s, L, R, z);
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
for (let B = 0, V = this._rulesWithParentScopes.length; B < V; B++) {
|
|
308
|
-
let V = this._rulesWithParentScopes[B];
|
|
309
|
-
if (strArrCmp(V.parentScopes, I) === 0) {
|
|
310
|
-
V.acceptOverwrite(s, L, R, z);
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
L === -1 && (L = this._mainRule.fontStyle), R === 0 && (R = this._mainRule.foreground), z === 0 && (z = this._mainRule.background), this._rulesWithParentScopes.push(new ThemeTrieElementRule(s, I, L, R, z));
|
|
315
|
-
}
|
|
316
|
-
}, EncodedTokenMetadata = class s {
|
|
317
|
-
static toBinaryStr(s) {
|
|
318
|
-
return s.toString(2).padStart(32, "0");
|
|
319
|
-
}
|
|
320
|
-
static print(I) {
|
|
321
|
-
let L = s.getLanguageId(I), R = s.getTokenType(I), z = s.getFontStyle(I), B = s.getForeground(I), V = s.getBackground(I);
|
|
322
|
-
console.log({
|
|
323
|
-
languageId: L,
|
|
324
|
-
tokenType: R,
|
|
325
|
-
fontStyle: z,
|
|
326
|
-
foreground: B,
|
|
327
|
-
background: V
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
static getLanguageId(s) {
|
|
331
|
-
return (s & 255) >>> 0;
|
|
332
|
-
}
|
|
333
|
-
static getTokenType(s) {
|
|
334
|
-
return (s & 768) >>> 8;
|
|
335
|
-
}
|
|
336
|
-
static containsBalancedBrackets(s) {
|
|
337
|
-
return (s & 1024) != 0;
|
|
338
|
-
}
|
|
339
|
-
static getFontStyle(s) {
|
|
340
|
-
return (s & 30720) >>> 11;
|
|
341
|
-
}
|
|
342
|
-
static getForeground(s) {
|
|
343
|
-
return (s & 16744448) >>> 15;
|
|
344
|
-
}
|
|
345
|
-
static getBackground(s) {
|
|
346
|
-
return (s & 4278190080) >>> 24;
|
|
347
|
-
}
|
|
348
|
-
static set(I, L, R, z, B, V, H) {
|
|
349
|
-
let U = s.getLanguageId(I), W = s.getTokenType(I), G = s.containsBalancedBrackets(I) ? 1 : 0, K = s.getFontStyle(I), q = s.getForeground(I), J = s.getBackground(I);
|
|
350
|
-
return L !== 0 && (U = L), R !== 8 && (W = fromOptionalTokenType(R)), z !== null && (G = z ? 1 : 0), B !== -1 && (K = B), V !== 0 && (q = V), H !== 0 && (J = H), (U << 0 | W << 8 | G << 10 | K << 11 | q << 15 | J << 24) >>> 0;
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
function toOptionalTokenType(s) {
|
|
354
|
-
return s;
|
|
355
|
-
}
|
|
356
|
-
function fromOptionalTokenType(s) {
|
|
357
|
-
return s;
|
|
358
|
-
}
|
|
359
|
-
function createMatchers(s, I) {
|
|
360
|
-
let L = [], R = newTokenizer(s), z = R.next();
|
|
361
|
-
for (; z !== null;) {
|
|
362
|
-
let s = 0;
|
|
363
|
-
if (z.length === 2 && z.charAt(1) === ":") {
|
|
364
|
-
switch (z.charAt(0)) {
|
|
365
|
-
case "R":
|
|
366
|
-
s = 1;
|
|
367
|
-
break;
|
|
368
|
-
case "L":
|
|
369
|
-
s = -1;
|
|
370
|
-
break;
|
|
371
|
-
default: console.log(`Unknown priority ${z} in scope selector`);
|
|
372
|
-
}
|
|
373
|
-
z = R.next();
|
|
374
|
-
}
|
|
375
|
-
let I = V();
|
|
376
|
-
if (L.push({
|
|
377
|
-
matcher: I,
|
|
378
|
-
priority: s
|
|
379
|
-
}), z !== ",") break;
|
|
380
|
-
z = R.next();
|
|
381
|
-
}
|
|
382
|
-
return L;
|
|
383
|
-
function B() {
|
|
384
|
-
if (z === "-") {
|
|
385
|
-
z = R.next();
|
|
386
|
-
let s = B();
|
|
387
|
-
return (I) => !!s && !s(I);
|
|
388
|
-
}
|
|
389
|
-
if (z === "(") {
|
|
390
|
-
z = R.next();
|
|
391
|
-
let s = H();
|
|
392
|
-
return z === ")" && (z = R.next()), s;
|
|
393
|
-
}
|
|
394
|
-
if (isIdentifier(z)) {
|
|
395
|
-
let s = [];
|
|
396
|
-
do
|
|
397
|
-
s.push(z), z = R.next();
|
|
398
|
-
while (isIdentifier(z));
|
|
399
|
-
return (L) => I(s, L);
|
|
400
|
-
}
|
|
401
|
-
return null;
|
|
402
|
-
}
|
|
403
|
-
function V() {
|
|
404
|
-
let s = [], I = B();
|
|
405
|
-
for (; I;) s.push(I), I = B();
|
|
406
|
-
return (I) => s.every((s) => s(I));
|
|
407
|
-
}
|
|
408
|
-
function H() {
|
|
409
|
-
let s = [], I = V();
|
|
410
|
-
for (; I && (s.push(I), z === "|" || z === ",");) {
|
|
411
|
-
do
|
|
412
|
-
z = R.next();
|
|
413
|
-
while (z === "|" || z === ",");
|
|
414
|
-
I = V();
|
|
415
|
-
}
|
|
416
|
-
return (I) => s.some((s) => s(I));
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
function isIdentifier(s) {
|
|
420
|
-
return !!s && !!s.match(/[\w\.:]+/);
|
|
421
|
-
}
|
|
422
|
-
function newTokenizer(s) {
|
|
423
|
-
let I = /([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g, L = I.exec(s);
|
|
424
|
-
return { next: () => {
|
|
425
|
-
if (!L) return null;
|
|
426
|
-
let R = L[0];
|
|
427
|
-
return L = I.exec(s), R;
|
|
428
|
-
} };
|
|
429
|
-
}
|
|
430
|
-
function disposeOnigString(s) {
|
|
431
|
-
typeof s.dispose == "function" && s.dispose();
|
|
432
|
-
}
|
|
433
|
-
var TopLevelRuleReference = class {
|
|
434
|
-
constructor(s) {
|
|
435
|
-
this.scopeName = s;
|
|
436
|
-
}
|
|
437
|
-
toKey() {
|
|
438
|
-
return this.scopeName;
|
|
439
|
-
}
|
|
440
|
-
}, TopLevelRepositoryRuleReference = class {
|
|
441
|
-
constructor(s, I) {
|
|
442
|
-
this.scopeName = s, this.ruleName = I;
|
|
443
|
-
}
|
|
444
|
-
toKey() {
|
|
445
|
-
return `${this.scopeName}#${this.ruleName}`;
|
|
446
|
-
}
|
|
447
|
-
}, ExternalReferenceCollector = class {
|
|
448
|
-
_references = [];
|
|
449
|
-
_seenReferenceKeys = /* @__PURE__ */ new Set();
|
|
450
|
-
get references() {
|
|
451
|
-
return this._references;
|
|
452
|
-
}
|
|
453
|
-
visitedRule = /* @__PURE__ */ new Set();
|
|
454
|
-
add(s) {
|
|
455
|
-
let I = s.toKey();
|
|
456
|
-
this._seenReferenceKeys.has(I) || (this._seenReferenceKeys.add(I), this._references.push(s));
|
|
457
|
-
}
|
|
458
|
-
}, ScopeDependencyProcessor = class {
|
|
459
|
-
constructor(s, I) {
|
|
460
|
-
this.repo = s, this.initialScopeName = I, this.seenFullScopeRequests.add(this.initialScopeName), this.Q = [new TopLevelRuleReference(this.initialScopeName)];
|
|
461
|
-
}
|
|
462
|
-
seenFullScopeRequests = /* @__PURE__ */ new Set();
|
|
463
|
-
seenPartialScopeRequests = /* @__PURE__ */ new Set();
|
|
464
|
-
Q;
|
|
465
|
-
processQueue() {
|
|
466
|
-
let s = this.Q;
|
|
467
|
-
this.Q = [];
|
|
468
|
-
let I = new ExternalReferenceCollector();
|
|
469
|
-
for (let L of s) collectReferencesOfReference(L, this.initialScopeName, this.repo, I);
|
|
470
|
-
for (let s of I.references) if (s instanceof TopLevelRuleReference) {
|
|
471
|
-
if (this.seenFullScopeRequests.has(s.scopeName)) continue;
|
|
472
|
-
this.seenFullScopeRequests.add(s.scopeName), this.Q.push(s);
|
|
473
|
-
} else {
|
|
474
|
-
if (this.seenFullScopeRequests.has(s.scopeName) || this.seenPartialScopeRequests.has(s.toKey())) continue;
|
|
475
|
-
this.seenPartialScopeRequests.add(s.toKey()), this.Q.push(s);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
function collectReferencesOfReference(s, I, L, R) {
|
|
480
|
-
let z = L.lookup(s.scopeName);
|
|
481
|
-
if (!z) {
|
|
482
|
-
if (s.scopeName === I) throw Error(`No grammar provided for <${I}>`);
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
let B = L.lookup(I);
|
|
486
|
-
s instanceof TopLevelRuleReference ? collectExternalReferencesInTopLevelRule({
|
|
487
|
-
baseGrammar: B,
|
|
488
|
-
selfGrammar: z
|
|
489
|
-
}, R) : collectExternalReferencesInTopLevelRepositoryRule(s.ruleName, {
|
|
490
|
-
baseGrammar: B,
|
|
491
|
-
selfGrammar: z,
|
|
492
|
-
repository: z.repository
|
|
493
|
-
}, R);
|
|
494
|
-
let V = L.injections(s.scopeName);
|
|
495
|
-
if (V) for (let s of V) R.add(new TopLevelRuleReference(s));
|
|
496
|
-
}
|
|
497
|
-
function collectExternalReferencesInTopLevelRepositoryRule(s, I, L) {
|
|
498
|
-
if (I.repository && I.repository[s]) {
|
|
499
|
-
let R = I.repository[s];
|
|
500
|
-
collectExternalReferencesInRules([R], I, L);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
function collectExternalReferencesInTopLevelRule(s, I) {
|
|
504
|
-
s.selfGrammar.patterns && Array.isArray(s.selfGrammar.patterns) && collectExternalReferencesInRules(s.selfGrammar.patterns, {
|
|
505
|
-
...s,
|
|
506
|
-
repository: s.selfGrammar.repository
|
|
507
|
-
}, I), s.selfGrammar.injections && collectExternalReferencesInRules(Object.values(s.selfGrammar.injections), {
|
|
508
|
-
...s,
|
|
509
|
-
repository: s.selfGrammar.repository
|
|
510
|
-
}, I);
|
|
511
|
-
}
|
|
512
|
-
function collectExternalReferencesInRules(s, I, L) {
|
|
513
|
-
for (let R of s) {
|
|
514
|
-
if (L.visitedRule.has(R)) continue;
|
|
515
|
-
L.visitedRule.add(R);
|
|
516
|
-
let s = R.repository ? mergeObjects({}, I.repository, R.repository) : I.repository;
|
|
517
|
-
Array.isArray(R.patterns) && collectExternalReferencesInRules(R.patterns, {
|
|
518
|
-
...I,
|
|
519
|
-
repository: s
|
|
520
|
-
}, L);
|
|
521
|
-
let z = R.include;
|
|
522
|
-
if (!z) continue;
|
|
523
|
-
let B = parseInclude(z);
|
|
524
|
-
switch (B.kind) {
|
|
525
|
-
case 0:
|
|
526
|
-
collectExternalReferencesInTopLevelRule({
|
|
527
|
-
...I,
|
|
528
|
-
selfGrammar: I.baseGrammar
|
|
529
|
-
}, L);
|
|
530
|
-
break;
|
|
531
|
-
case 1:
|
|
532
|
-
collectExternalReferencesInTopLevelRule(I, L);
|
|
533
|
-
break;
|
|
534
|
-
case 2:
|
|
535
|
-
collectExternalReferencesInTopLevelRepositoryRule(B.ruleName, {
|
|
536
|
-
...I,
|
|
537
|
-
repository: s
|
|
538
|
-
}, L);
|
|
539
|
-
break;
|
|
540
|
-
case 3:
|
|
541
|
-
case 4:
|
|
542
|
-
let R = B.scopeName === I.selfGrammar.scopeName ? I.selfGrammar : B.scopeName === I.baseGrammar.scopeName ? I.baseGrammar : void 0;
|
|
543
|
-
if (R) {
|
|
544
|
-
let z = {
|
|
545
|
-
baseGrammar: I.baseGrammar,
|
|
546
|
-
selfGrammar: R,
|
|
547
|
-
repository: s
|
|
548
|
-
};
|
|
549
|
-
B.kind === 4 ? collectExternalReferencesInTopLevelRepositoryRule(B.ruleName, z, L) : collectExternalReferencesInTopLevelRule(z, L);
|
|
550
|
-
} else B.kind === 4 ? L.add(new TopLevelRepositoryRuleReference(B.scopeName, B.ruleName)) : L.add(new TopLevelRuleReference(B.scopeName));
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
var BaseReference = class {
|
|
556
|
-
kind = 0;
|
|
557
|
-
}, SelfReference = class {
|
|
558
|
-
kind = 1;
|
|
559
|
-
}, RelativeReference = class {
|
|
560
|
-
constructor(s) {
|
|
561
|
-
this.ruleName = s;
|
|
562
|
-
}
|
|
563
|
-
kind = 2;
|
|
564
|
-
}, TopLevelReference = class {
|
|
565
|
-
constructor(s) {
|
|
566
|
-
this.scopeName = s;
|
|
567
|
-
}
|
|
568
|
-
kind = 3;
|
|
569
|
-
}, TopLevelRepositoryReference = class {
|
|
570
|
-
constructor(s, I) {
|
|
571
|
-
this.scopeName = s, this.ruleName = I;
|
|
572
|
-
}
|
|
573
|
-
kind = 4;
|
|
574
|
-
};
|
|
575
|
-
function parseInclude(s) {
|
|
576
|
-
if (s === "$base") return new BaseReference();
|
|
577
|
-
if (s === "$self") return new SelfReference();
|
|
578
|
-
let I = s.indexOf("#");
|
|
579
|
-
return I === -1 ? new TopLevelReference(s) : I === 0 ? new RelativeReference(s.substring(1)) : new TopLevelRepositoryReference(s.substring(0, I), s.substring(I + 1));
|
|
580
|
-
}
|
|
581
|
-
var HAS_BACK_REFERENCES = /\\(\d+)/, BACK_REFERENCING_END = /\\(\d+)/g, endRuleId = -1, whileRuleId = -2;
|
|
582
|
-
function ruleIdFromNumber(s) {
|
|
583
|
-
return s;
|
|
584
|
-
}
|
|
585
|
-
function ruleIdToNumber(s) {
|
|
586
|
-
return s;
|
|
587
|
-
}
|
|
588
|
-
var Rule = class {
|
|
589
|
-
$location;
|
|
590
|
-
id;
|
|
591
|
-
_nameIsCapturing;
|
|
592
|
-
_name;
|
|
593
|
-
_contentNameIsCapturing;
|
|
594
|
-
_contentName;
|
|
595
|
-
constructor(s, I, L, R) {
|
|
596
|
-
this.$location = s, this.id = I, this._name = L || null, this._nameIsCapturing = RegexSource.hasCaptures(this._name), this._contentName = R || null, this._contentNameIsCapturing = RegexSource.hasCaptures(this._contentName);
|
|
597
|
-
}
|
|
598
|
-
get debugName() {
|
|
599
|
-
let s = this.$location ? `${basename(this.$location.filename)}:${this.$location.line}` : "unknown";
|
|
600
|
-
return `${this.constructor.name}#${this.id} @ ${s}`;
|
|
601
|
-
}
|
|
602
|
-
getName(s, I) {
|
|
603
|
-
return !this._nameIsCapturing || this._name === null || s === null || I === null ? this._name : RegexSource.replaceCaptures(this._name, s, I);
|
|
604
|
-
}
|
|
605
|
-
getContentName(s, I) {
|
|
606
|
-
return !this._contentNameIsCapturing || this._contentName === null ? this._contentName : RegexSource.replaceCaptures(this._contentName, s, I);
|
|
607
|
-
}
|
|
608
|
-
}, CaptureRule = class extends Rule {
|
|
609
|
-
retokenizeCapturedWithRuleId;
|
|
610
|
-
constructor(s, I, L, R, z) {
|
|
611
|
-
super(s, I, L, R), this.retokenizeCapturedWithRuleId = z;
|
|
612
|
-
}
|
|
613
|
-
dispose() {}
|
|
614
|
-
collectPatterns(s, I) {
|
|
615
|
-
throw Error("Not supported!");
|
|
616
|
-
}
|
|
617
|
-
compile(s, I) {
|
|
618
|
-
throw Error("Not supported!");
|
|
619
|
-
}
|
|
620
|
-
compileAG(s, I, L, R) {
|
|
621
|
-
throw Error("Not supported!");
|
|
622
|
-
}
|
|
623
|
-
}, MatchRule = class extends Rule {
|
|
624
|
-
_match;
|
|
625
|
-
captures;
|
|
626
|
-
_cachedCompiledPatterns;
|
|
627
|
-
constructor(s, I, L, R, z) {
|
|
628
|
-
super(s, I, L, null), this._match = new RegExpSource(R, this.id), this.captures = z, this._cachedCompiledPatterns = null;
|
|
629
|
-
}
|
|
630
|
-
dispose() {
|
|
631
|
-
this._cachedCompiledPatterns &&= (this._cachedCompiledPatterns.dispose(), null);
|
|
632
|
-
}
|
|
633
|
-
get debugMatchRegExp() {
|
|
634
|
-
return `${this._match.source}`;
|
|
635
|
-
}
|
|
636
|
-
collectPatterns(s, I) {
|
|
637
|
-
I.push(this._match);
|
|
638
|
-
}
|
|
639
|
-
compile(s, I) {
|
|
640
|
-
return this._getCachedCompiledPatterns(s).compile(s);
|
|
641
|
-
}
|
|
642
|
-
compileAG(s, I, L, R) {
|
|
643
|
-
return this._getCachedCompiledPatterns(s).compileAG(s, L, R);
|
|
644
|
-
}
|
|
645
|
-
_getCachedCompiledPatterns(s) {
|
|
646
|
-
return this._cachedCompiledPatterns || (this._cachedCompiledPatterns = new RegExpSourceList(), this.collectPatterns(s, this._cachedCompiledPatterns)), this._cachedCompiledPatterns;
|
|
647
|
-
}
|
|
648
|
-
}, IncludeOnlyRule = class extends Rule {
|
|
649
|
-
hasMissingPatterns;
|
|
650
|
-
patterns;
|
|
651
|
-
_cachedCompiledPatterns;
|
|
652
|
-
constructor(s, I, L, R, z) {
|
|
653
|
-
super(s, I, L, R), this.patterns = z.patterns, this.hasMissingPatterns = z.hasMissingPatterns, this._cachedCompiledPatterns = null;
|
|
654
|
-
}
|
|
655
|
-
dispose() {
|
|
656
|
-
this._cachedCompiledPatterns &&= (this._cachedCompiledPatterns.dispose(), null);
|
|
657
|
-
}
|
|
658
|
-
collectPatterns(s, I) {
|
|
659
|
-
for (let L of this.patterns) s.getRule(L).collectPatterns(s, I);
|
|
660
|
-
}
|
|
661
|
-
compile(s, I) {
|
|
662
|
-
return this._getCachedCompiledPatterns(s).compile(s);
|
|
663
|
-
}
|
|
664
|
-
compileAG(s, I, L, R) {
|
|
665
|
-
return this._getCachedCompiledPatterns(s).compileAG(s, L, R);
|
|
666
|
-
}
|
|
667
|
-
_getCachedCompiledPatterns(s) {
|
|
668
|
-
return this._cachedCompiledPatterns || (this._cachedCompiledPatterns = new RegExpSourceList(), this.collectPatterns(s, this._cachedCompiledPatterns)), this._cachedCompiledPatterns;
|
|
669
|
-
}
|
|
670
|
-
}, BeginEndRule = class extends Rule {
|
|
671
|
-
_begin;
|
|
672
|
-
beginCaptures;
|
|
673
|
-
_end;
|
|
674
|
-
endHasBackReferences;
|
|
675
|
-
endCaptures;
|
|
676
|
-
applyEndPatternLast;
|
|
677
|
-
hasMissingPatterns;
|
|
678
|
-
patterns;
|
|
679
|
-
_cachedCompiledPatterns;
|
|
680
|
-
constructor(s, I, L, R, z, B, V, H, U, W) {
|
|
681
|
-
super(s, I, L, R), this._begin = new RegExpSource(z, this.id), this.beginCaptures = B, this._end = new RegExpSource(V || "", -1), this.endHasBackReferences = this._end.hasBackReferences, this.endCaptures = H, this.applyEndPatternLast = U || !1, this.patterns = W.patterns, this.hasMissingPatterns = W.hasMissingPatterns, this._cachedCompiledPatterns = null;
|
|
682
|
-
}
|
|
683
|
-
dispose() {
|
|
684
|
-
this._cachedCompiledPatterns &&= (this._cachedCompiledPatterns.dispose(), null);
|
|
685
|
-
}
|
|
686
|
-
get debugBeginRegExp() {
|
|
687
|
-
return `${this._begin.source}`;
|
|
688
|
-
}
|
|
689
|
-
get debugEndRegExp() {
|
|
690
|
-
return `${this._end.source}`;
|
|
691
|
-
}
|
|
692
|
-
getEndWithResolvedBackReferences(s, I) {
|
|
693
|
-
return this._end.resolveBackReferences(s, I);
|
|
694
|
-
}
|
|
695
|
-
collectPatterns(s, I) {
|
|
696
|
-
I.push(this._begin);
|
|
697
|
-
}
|
|
698
|
-
compile(s, I) {
|
|
699
|
-
return this._getCachedCompiledPatterns(s, I).compile(s);
|
|
700
|
-
}
|
|
701
|
-
compileAG(s, I, L, R) {
|
|
702
|
-
return this._getCachedCompiledPatterns(s, I).compileAG(s, L, R);
|
|
703
|
-
}
|
|
704
|
-
_getCachedCompiledPatterns(s, I) {
|
|
705
|
-
if (!this._cachedCompiledPatterns) {
|
|
706
|
-
this._cachedCompiledPatterns = new RegExpSourceList();
|
|
707
|
-
for (let I of this.patterns) s.getRule(I).collectPatterns(s, this._cachedCompiledPatterns);
|
|
708
|
-
this.applyEndPatternLast ? this._cachedCompiledPatterns.push(this._end.hasBackReferences ? this._end.clone() : this._end) : this._cachedCompiledPatterns.unshift(this._end.hasBackReferences ? this._end.clone() : this._end);
|
|
709
|
-
}
|
|
710
|
-
return this._end.hasBackReferences && (this.applyEndPatternLast ? this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length() - 1, I) : this._cachedCompiledPatterns.setSource(0, I)), this._cachedCompiledPatterns;
|
|
711
|
-
}
|
|
712
|
-
}, BeginWhileRule = class extends Rule {
|
|
713
|
-
_begin;
|
|
714
|
-
beginCaptures;
|
|
715
|
-
whileCaptures;
|
|
716
|
-
_while;
|
|
717
|
-
whileHasBackReferences;
|
|
718
|
-
hasMissingPatterns;
|
|
719
|
-
patterns;
|
|
720
|
-
_cachedCompiledPatterns;
|
|
721
|
-
_cachedCompiledWhilePatterns;
|
|
722
|
-
constructor(s, I, L, R, z, B, V, H, U) {
|
|
723
|
-
super(s, I, L, R), this._begin = new RegExpSource(z, this.id), this.beginCaptures = B, this.whileCaptures = H, this._while = new RegExpSource(V, whileRuleId), this.whileHasBackReferences = this._while.hasBackReferences, this.patterns = U.patterns, this.hasMissingPatterns = U.hasMissingPatterns, this._cachedCompiledPatterns = null, this._cachedCompiledWhilePatterns = null;
|
|
724
|
-
}
|
|
725
|
-
dispose() {
|
|
726
|
-
this._cachedCompiledPatterns &&= (this._cachedCompiledPatterns.dispose(), null), this._cachedCompiledWhilePatterns &&= (this._cachedCompiledWhilePatterns.dispose(), null);
|
|
727
|
-
}
|
|
728
|
-
get debugBeginRegExp() {
|
|
729
|
-
return `${this._begin.source}`;
|
|
730
|
-
}
|
|
731
|
-
get debugWhileRegExp() {
|
|
732
|
-
return `${this._while.source}`;
|
|
733
|
-
}
|
|
734
|
-
getWhileWithResolvedBackReferences(s, I) {
|
|
735
|
-
return this._while.resolveBackReferences(s, I);
|
|
736
|
-
}
|
|
737
|
-
collectPatterns(s, I) {
|
|
738
|
-
I.push(this._begin);
|
|
739
|
-
}
|
|
740
|
-
compile(s, I) {
|
|
741
|
-
return this._getCachedCompiledPatterns(s).compile(s);
|
|
742
|
-
}
|
|
743
|
-
compileAG(s, I, L, R) {
|
|
744
|
-
return this._getCachedCompiledPatterns(s).compileAG(s, L, R);
|
|
745
|
-
}
|
|
746
|
-
_getCachedCompiledPatterns(s) {
|
|
747
|
-
if (!this._cachedCompiledPatterns) {
|
|
748
|
-
this._cachedCompiledPatterns = new RegExpSourceList();
|
|
749
|
-
for (let I of this.patterns) s.getRule(I).collectPatterns(s, this._cachedCompiledPatterns);
|
|
750
|
-
}
|
|
751
|
-
return this._cachedCompiledPatterns;
|
|
752
|
-
}
|
|
753
|
-
compileWhile(s, I) {
|
|
754
|
-
return this._getCachedCompiledWhilePatterns(s, I).compile(s);
|
|
755
|
-
}
|
|
756
|
-
compileWhileAG(s, I, L, R) {
|
|
757
|
-
return this._getCachedCompiledWhilePatterns(s, I).compileAG(s, L, R);
|
|
758
|
-
}
|
|
759
|
-
_getCachedCompiledWhilePatterns(s, I) {
|
|
760
|
-
return this._cachedCompiledWhilePatterns || (this._cachedCompiledWhilePatterns = new RegExpSourceList(), this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences ? this._while.clone() : this._while)), this._while.hasBackReferences && this._cachedCompiledWhilePatterns.setSource(0, I || ""), this._cachedCompiledWhilePatterns;
|
|
761
|
-
}
|
|
762
|
-
}, RuleFactory = class s {
|
|
763
|
-
static createCaptureRule(s, I, L, R, z) {
|
|
764
|
-
return s.registerRule((s) => new CaptureRule(I, s, L, R, z));
|
|
765
|
-
}
|
|
766
|
-
static getCompiledRuleId(I, L, R) {
|
|
767
|
-
return I.id || L.registerRule((z) => {
|
|
768
|
-
if (I.id = z, I.match) return new MatchRule(I.$vscodeTextmateLocation, I.id, I.name, I.match, s._compileCaptures(I.captures, L, R));
|
|
769
|
-
if (I.begin === void 0) {
|
|
770
|
-
I.repository && (R = mergeObjects({}, R, I.repository));
|
|
771
|
-
let z = I.patterns;
|
|
772
|
-
return z === void 0 && I.include && (z = [{ include: I.include }]), new IncludeOnlyRule(I.$vscodeTextmateLocation, I.id, I.name, I.contentName, s._compilePatterns(z, L, R));
|
|
773
|
-
}
|
|
774
|
-
return I.while ? new BeginWhileRule(I.$vscodeTextmateLocation, I.id, I.name, I.contentName, I.begin, s._compileCaptures(I.beginCaptures || I.captures, L, R), I.while, s._compileCaptures(I.whileCaptures || I.captures, L, R), s._compilePatterns(I.patterns, L, R)) : new BeginEndRule(I.$vscodeTextmateLocation, I.id, I.name, I.contentName, I.begin, s._compileCaptures(I.beginCaptures || I.captures, L, R), I.end, s._compileCaptures(I.endCaptures || I.captures, L, R), I.applyEndPatternLast, s._compilePatterns(I.patterns, L, R));
|
|
775
|
-
}), I.id;
|
|
776
|
-
}
|
|
777
|
-
static _compileCaptures(I, L, R) {
|
|
778
|
-
let z = [];
|
|
779
|
-
if (I) {
|
|
780
|
-
let B = 0;
|
|
781
|
-
for (let s in I) {
|
|
782
|
-
if (s === "$vscodeTextmateLocation") continue;
|
|
783
|
-
let I = parseInt(s, 10);
|
|
784
|
-
I > B && (B = I);
|
|
785
|
-
}
|
|
786
|
-
for (let s = 0; s <= B; s++) z[s] = null;
|
|
787
|
-
for (let B in I) {
|
|
788
|
-
if (B === "$vscodeTextmateLocation") continue;
|
|
789
|
-
let V = parseInt(B, 10), H = 0;
|
|
790
|
-
I[B].patterns && (H = s.getCompiledRuleId(I[B], L, R)), z[V] = s.createCaptureRule(L, I[B].$vscodeTextmateLocation, I[B].name, I[B].contentName, H);
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
return z;
|
|
794
|
-
}
|
|
795
|
-
static _compilePatterns(I, L, R) {
|
|
796
|
-
let z = [];
|
|
797
|
-
if (I) for (let B = 0, V = I.length; B < V; B++) {
|
|
798
|
-
let V = I[B], H = -1;
|
|
799
|
-
if (V.include) {
|
|
800
|
-
let I = parseInclude(V.include);
|
|
801
|
-
switch (I.kind) {
|
|
802
|
-
case 0:
|
|
803
|
-
case 1:
|
|
804
|
-
H = s.getCompiledRuleId(R[V.include], L, R);
|
|
805
|
-
break;
|
|
806
|
-
case 2:
|
|
807
|
-
let z = R[I.ruleName];
|
|
808
|
-
z && (H = s.getCompiledRuleId(z, L, R));
|
|
809
|
-
break;
|
|
810
|
-
case 3:
|
|
811
|
-
case 4:
|
|
812
|
-
let B = I.scopeName, U = I.kind === 4 ? I.ruleName : null, W = L.getExternalGrammar(B, R);
|
|
813
|
-
if (W) if (U) {
|
|
814
|
-
let I = W.repository[U];
|
|
815
|
-
I && (H = s.getCompiledRuleId(I, L, W.repository));
|
|
816
|
-
} else H = s.getCompiledRuleId(W.repository.$self, L, W.repository);
|
|
817
|
-
break;
|
|
818
|
-
}
|
|
819
|
-
} else H = s.getCompiledRuleId(V, L, R);
|
|
820
|
-
if (H !== -1) {
|
|
821
|
-
let s = L.getRule(H), I = !1;
|
|
822
|
-
if ((s instanceof IncludeOnlyRule || s instanceof BeginEndRule || s instanceof BeginWhileRule) && s.hasMissingPatterns && s.patterns.length === 0 && (I = !0), I) continue;
|
|
823
|
-
z.push(H);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
return {
|
|
827
|
-
patterns: z,
|
|
828
|
-
hasMissingPatterns: (I ? I.length : 0) !== z.length
|
|
829
|
-
};
|
|
830
|
-
}
|
|
831
|
-
}, RegExpSource = class s {
|
|
832
|
-
source;
|
|
833
|
-
ruleId;
|
|
834
|
-
hasAnchor;
|
|
835
|
-
hasBackReferences;
|
|
836
|
-
_anchorCache;
|
|
837
|
-
constructor(s, I) {
|
|
838
|
-
if (s && typeof s == "string") {
|
|
839
|
-
let I = s.length, L = 0, R = [], z = !1;
|
|
840
|
-
for (let B = 0; B < I; B++) if (s.charAt(B) === "\\" && B + 1 < I) {
|
|
841
|
-
let I = s.charAt(B + 1);
|
|
842
|
-
I === "z" ? (R.push(s.substring(L, B)), R.push("$(?!\\n)(?<!\\n)"), L = B + 2) : (I === "A" || I === "G") && (z = !0), B++;
|
|
843
|
-
}
|
|
844
|
-
this.hasAnchor = z, L === 0 ? this.source = s : (R.push(s.substring(L, I)), this.source = R.join(""));
|
|
845
|
-
} else this.hasAnchor = !1, this.source = s;
|
|
846
|
-
this.hasAnchor ? this._anchorCache = this._buildAnchorCache() : this._anchorCache = null, this.ruleId = I, typeof this.source == "string" ? this.hasBackReferences = HAS_BACK_REFERENCES.test(this.source) : this.hasBackReferences = !1;
|
|
847
|
-
}
|
|
848
|
-
clone() {
|
|
849
|
-
return new s(this.source, this.ruleId);
|
|
850
|
-
}
|
|
851
|
-
setSource(s) {
|
|
852
|
-
this.source !== s && (this.source = s, this.hasAnchor && (this._anchorCache = this._buildAnchorCache()));
|
|
853
|
-
}
|
|
854
|
-
resolveBackReferences(s, I) {
|
|
855
|
-
if (typeof this.source != "string") throw Error("This method should only be called if the source is a string");
|
|
856
|
-
let L = I.map((I) => s.substring(I.start, I.end));
|
|
857
|
-
return BACK_REFERENCING_END.lastIndex = 0, this.source.replace(BACK_REFERENCING_END, (s, I) => escapeRegExpCharacters(L[parseInt(I, 10)] || ""));
|
|
858
|
-
}
|
|
859
|
-
_buildAnchorCache() {
|
|
860
|
-
if (typeof this.source != "string") throw Error("This method should only be called if the source is a string");
|
|
861
|
-
let s = [], I = [], L = [], R = [], z, B, V, H;
|
|
862
|
-
for (z = 0, B = this.source.length; z < B; z++) V = this.source.charAt(z), s[z] = V, I[z] = V, L[z] = V, R[z] = V, V === "\\" && z + 1 < B && (H = this.source.charAt(z + 1), H === "A" ? (s[z + 1] = "", I[z + 1] = "", L[z + 1] = "A", R[z + 1] = "A") : H === "G" ? (s[z + 1] = "", I[z + 1] = "G", L[z + 1] = "", R[z + 1] = "G") : (s[z + 1] = H, I[z + 1] = H, L[z + 1] = H, R[z + 1] = H), z++);
|
|
863
|
-
return {
|
|
864
|
-
A0_G0: s.join(""),
|
|
865
|
-
A0_G1: I.join(""),
|
|
866
|
-
A1_G0: L.join(""),
|
|
867
|
-
A1_G1: R.join("")
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
resolveAnchors(s, I) {
|
|
871
|
-
return !this.hasAnchor || !this._anchorCache || typeof this.source != "string" ? this.source : s ? I ? this._anchorCache.A1_G1 : this._anchorCache.A1_G0 : I ? this._anchorCache.A0_G1 : this._anchorCache.A0_G0;
|
|
872
|
-
}
|
|
873
|
-
}, RegExpSourceList = class {
|
|
874
|
-
_items;
|
|
875
|
-
_hasAnchors;
|
|
876
|
-
_cached;
|
|
877
|
-
_anchorCache;
|
|
878
|
-
constructor() {
|
|
879
|
-
this._items = [], this._hasAnchors = !1, this._cached = null, this._anchorCache = {
|
|
880
|
-
A0_G0: null,
|
|
881
|
-
A0_G1: null,
|
|
882
|
-
A1_G0: null,
|
|
883
|
-
A1_G1: null
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
dispose() {
|
|
887
|
-
this._disposeCaches();
|
|
888
|
-
}
|
|
889
|
-
_disposeCaches() {
|
|
890
|
-
this._cached &&= (this._cached.dispose(), null), this._anchorCache.A0_G0 && (this._anchorCache.A0_G0.dispose(), this._anchorCache.A0_G0 = null), this._anchorCache.A0_G1 && (this._anchorCache.A0_G1.dispose(), this._anchorCache.A0_G1 = null), this._anchorCache.A1_G0 && (this._anchorCache.A1_G0.dispose(), this._anchorCache.A1_G0 = null), this._anchorCache.A1_G1 && (this._anchorCache.A1_G1.dispose(), this._anchorCache.A1_G1 = null);
|
|
891
|
-
}
|
|
892
|
-
push(s) {
|
|
893
|
-
this._items.push(s), this._hasAnchors = this._hasAnchors || s.hasAnchor;
|
|
894
|
-
}
|
|
895
|
-
unshift(s) {
|
|
896
|
-
this._items.unshift(s), this._hasAnchors = this._hasAnchors || s.hasAnchor;
|
|
897
|
-
}
|
|
898
|
-
length() {
|
|
899
|
-
return this._items.length;
|
|
900
|
-
}
|
|
901
|
-
setSource(s, I) {
|
|
902
|
-
this._items[s].source !== I && (this._disposeCaches(), this._items[s].setSource(I));
|
|
903
|
-
}
|
|
904
|
-
compile(s) {
|
|
905
|
-
return this._cached ||= new CompiledRule(s, this._items.map((s) => s.source), this._items.map((s) => s.ruleId)), this._cached;
|
|
906
|
-
}
|
|
907
|
-
compileAG(s, I, L) {
|
|
908
|
-
return this._hasAnchors ? I ? L ? (this._anchorCache.A1_G1 || (this._anchorCache.A1_G1 = this._resolveAnchors(s, I, L)), this._anchorCache.A1_G1) : (this._anchorCache.A1_G0 || (this._anchorCache.A1_G0 = this._resolveAnchors(s, I, L)), this._anchorCache.A1_G0) : L ? (this._anchorCache.A0_G1 || (this._anchorCache.A0_G1 = this._resolveAnchors(s, I, L)), this._anchorCache.A0_G1) : (this._anchorCache.A0_G0 || (this._anchorCache.A0_G0 = this._resolveAnchors(s, I, L)), this._anchorCache.A0_G0) : this.compile(s);
|
|
909
|
-
}
|
|
910
|
-
_resolveAnchors(s, I, L) {
|
|
911
|
-
return new CompiledRule(s, this._items.map((s) => s.resolveAnchors(I, L)), this._items.map((s) => s.ruleId));
|
|
912
|
-
}
|
|
913
|
-
}, CompiledRule = class {
|
|
914
|
-
constructor(s, I, L) {
|
|
915
|
-
this.regExps = I, this.rules = L, this.scanner = s.createOnigScanner(I);
|
|
916
|
-
}
|
|
917
|
-
scanner;
|
|
918
|
-
dispose() {
|
|
919
|
-
typeof this.scanner.dispose == "function" && this.scanner.dispose();
|
|
920
|
-
}
|
|
921
|
-
toString() {
|
|
922
|
-
let s = [];
|
|
923
|
-
for (let I = 0, L = this.rules.length; I < L; I++) s.push(" - " + this.rules[I] + ": " + this.regExps[I]);
|
|
924
|
-
return s.join("\n");
|
|
925
|
-
}
|
|
926
|
-
findNextMatchSync(s, I, L) {
|
|
927
|
-
let R = this.scanner.findNextMatchSync(s, I, L);
|
|
928
|
-
return R ? {
|
|
929
|
-
ruleId: this.rules[R.index],
|
|
930
|
-
captureIndices: R.captureIndices
|
|
931
|
-
} : null;
|
|
932
|
-
}
|
|
933
|
-
}, BasicScopeAttributes = class {
|
|
934
|
-
constructor(s, I) {
|
|
935
|
-
this.languageId = s, this.tokenType = I;
|
|
936
|
-
}
|
|
937
|
-
}, BasicScopeAttributesProvider = class s {
|
|
938
|
-
_defaultAttributes;
|
|
939
|
-
_embeddedLanguagesMatcher;
|
|
940
|
-
constructor(s, I) {
|
|
941
|
-
this._defaultAttributes = new BasicScopeAttributes(s, 8), this._embeddedLanguagesMatcher = new ScopeMatcher(Object.entries(I || {}));
|
|
942
|
-
}
|
|
943
|
-
getDefaultAttributes() {
|
|
944
|
-
return this._defaultAttributes;
|
|
945
|
-
}
|
|
946
|
-
getBasicScopeAttributes(I) {
|
|
947
|
-
return I === null ? s._NULL_SCOPE_METADATA : this._getBasicScopeAttributes.get(I);
|
|
948
|
-
}
|
|
949
|
-
static _NULL_SCOPE_METADATA = new BasicScopeAttributes(0, 0);
|
|
950
|
-
_getBasicScopeAttributes = new CachedFn((s) => new BasicScopeAttributes(this._scopeToLanguage(s), this._toStandardTokenType(s)));
|
|
951
|
-
_scopeToLanguage(s) {
|
|
952
|
-
return this._embeddedLanguagesMatcher.match(s) || 0;
|
|
953
|
-
}
|
|
954
|
-
_toStandardTokenType(I) {
|
|
955
|
-
let L = I.match(s.STANDARD_TOKEN_TYPE_REGEXP);
|
|
956
|
-
if (!L) return 8;
|
|
957
|
-
switch (L[1]) {
|
|
958
|
-
case "comment": return 1;
|
|
959
|
-
case "string": return 2;
|
|
960
|
-
case "regex": return 3;
|
|
961
|
-
case "meta.embedded": return 0;
|
|
962
|
-
}
|
|
963
|
-
throw Error("Unexpected match for standard token type!");
|
|
964
|
-
}
|
|
965
|
-
static STANDARD_TOKEN_TYPE_REGEXP = /\b(comment|string|regex|meta\.embedded)\b/;
|
|
966
|
-
}, ScopeMatcher = class {
|
|
967
|
-
values;
|
|
968
|
-
scopesRegExp;
|
|
969
|
-
constructor(s) {
|
|
970
|
-
if (s.length === 0) this.values = null, this.scopesRegExp = null;
|
|
971
|
-
else {
|
|
972
|
-
this.values = new Map(s);
|
|
973
|
-
let I = s.map(([s, I]) => escapeRegExpCharacters(s));
|
|
974
|
-
I.sort(), I.reverse(), this.scopesRegExp = RegExp(`^((${I.join(")|(")}))($|\\.)`, "");
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
match(s) {
|
|
978
|
-
if (!this.scopesRegExp) return;
|
|
979
|
-
let I = s.match(this.scopesRegExp);
|
|
980
|
-
if (I) return this.values.get(I[1]);
|
|
981
|
-
}
|
|
982
|
-
};
|
|
983
|
-
typeof process < "u" && process.env.VSCODE_TEXTMATE_DEBUG;
|
|
984
|
-
var UseOnigurumaFindOptions = !1, TokenizeStringResult = class {
|
|
985
|
-
constructor(s, I) {
|
|
986
|
-
this.stack = s, this.stoppedEarly = I;
|
|
987
|
-
}
|
|
988
|
-
};
|
|
989
|
-
function _tokenizeString(s, I, L, R, z, B, V, H) {
|
|
990
|
-
let U = I.content.length, W = !1, G = -1;
|
|
991
|
-
if (V) {
|
|
992
|
-
let V = _checkWhileConditions(s, I, L, R, z, B);
|
|
993
|
-
z = V.stack, R = V.linePos, L = V.isFirstLine, G = V.anchorPosition;
|
|
994
|
-
}
|
|
995
|
-
let K = Date.now();
|
|
996
|
-
for (; !W;) {
|
|
997
|
-
if (H !== 0 && Date.now() - K > H) return new TokenizeStringResult(z, !0);
|
|
998
|
-
q();
|
|
999
|
-
}
|
|
1000
|
-
return new TokenizeStringResult(z, !1);
|
|
1001
|
-
function q() {
|
|
1002
|
-
let V = matchRuleOrInjections(s, I, L, R, z, G);
|
|
1003
|
-
if (!V) {
|
|
1004
|
-
B.produce(z, U), W = !0;
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
let H = V.captureIndices, K = V.matchedRuleId, q = H && H.length > 0 ? H[0].end > R : !1;
|
|
1008
|
-
if (K === endRuleId) {
|
|
1009
|
-
let V = z.getRule(s);
|
|
1010
|
-
B.produce(z, H[0].start), z = z.withContentNameScopesList(z.nameScopesList), handleCaptures(s, I, L, z, B, V.endCaptures, H), B.produce(z, H[0].end);
|
|
1011
|
-
let K = z;
|
|
1012
|
-
if (z = z.parent, G = K.getAnchorPos(), !q && K.getEnterPos() === R) {
|
|
1013
|
-
z = K, B.produce(z, U), W = !0;
|
|
1014
|
-
return;
|
|
1015
|
-
}
|
|
1016
|
-
} else {
|
|
1017
|
-
let V = s.getRule(K);
|
|
1018
|
-
B.produce(z, H[0].start);
|
|
1019
|
-
let J = z, Y = V.getName(I.content, H), X = z.contentNameScopesList.pushAttributed(Y, s);
|
|
1020
|
-
if (z = z.push(K, R, G, H[0].end === U, null, X, X), V instanceof BeginEndRule) {
|
|
1021
|
-
let R = V;
|
|
1022
|
-
handleCaptures(s, I, L, z, B, R.beginCaptures, H), B.produce(z, H[0].end), G = H[0].end;
|
|
1023
|
-
let K = R.getContentName(I.content, H), Y = X.pushAttributed(K, s);
|
|
1024
|
-
if (z = z.withContentNameScopesList(Y), R.endHasBackReferences && (z = z.withEndRule(R.getEndWithResolvedBackReferences(I.content, H))), !q && J.hasSameRuleAs(z)) {
|
|
1025
|
-
z = z.pop(), B.produce(z, U), W = !0;
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
|
-
} else if (V instanceof BeginWhileRule) {
|
|
1029
|
-
let R = V;
|
|
1030
|
-
handleCaptures(s, I, L, z, B, R.beginCaptures, H), B.produce(z, H[0].end), G = H[0].end;
|
|
1031
|
-
let K = R.getContentName(I.content, H), Y = X.pushAttributed(K, s);
|
|
1032
|
-
if (z = z.withContentNameScopesList(Y), R.whileHasBackReferences && (z = z.withEndRule(R.getWhileWithResolvedBackReferences(I.content, H))), !q && J.hasSameRuleAs(z)) {
|
|
1033
|
-
z = z.pop(), B.produce(z, U), W = !0;
|
|
1034
|
-
return;
|
|
1035
|
-
}
|
|
1036
|
-
} else if (handleCaptures(s, I, L, z, B, V.captures, H), B.produce(z, H[0].end), z = z.pop(), !q) {
|
|
1037
|
-
z = z.safePop(), B.produce(z, U), W = !0;
|
|
1038
|
-
return;
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
H[0].end > R && (R = H[0].end, L = !1);
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
function _checkWhileConditions(s, I, L, R, z, B) {
|
|
1045
|
-
let V = z.beginRuleCapturedEOL ? 0 : -1, H = [];
|
|
1046
|
-
for (let I = z; I; I = I.pop()) {
|
|
1047
|
-
let L = I.getRule(s);
|
|
1048
|
-
L instanceof BeginWhileRule && H.push({
|
|
1049
|
-
rule: L,
|
|
1050
|
-
stack: I
|
|
1051
|
-
});
|
|
1052
|
-
}
|
|
1053
|
-
for (let U = H.pop(); U; U = H.pop()) {
|
|
1054
|
-
let { ruleScanner: H, findOptions: W } = prepareRuleWhileSearch(U.rule, s, U.stack.endRule, L, R === V), G = H.findNextMatchSync(I, R, W);
|
|
1055
|
-
if (G) {
|
|
1056
|
-
if (G.ruleId !== whileRuleId) {
|
|
1057
|
-
z = U.stack.pop();
|
|
1058
|
-
break;
|
|
1059
|
-
}
|
|
1060
|
-
G.captureIndices && G.captureIndices.length && (B.produce(U.stack, G.captureIndices[0].start), handleCaptures(s, I, L, U.stack, B, U.rule.whileCaptures, G.captureIndices), B.produce(U.stack, G.captureIndices[0].end), V = G.captureIndices[0].end, G.captureIndices[0].end > R && (R = G.captureIndices[0].end, L = !1));
|
|
1061
|
-
} else {
|
|
1062
|
-
z = U.stack.pop();
|
|
1063
|
-
break;
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
return {
|
|
1067
|
-
stack: z,
|
|
1068
|
-
linePos: R,
|
|
1069
|
-
anchorPosition: V,
|
|
1070
|
-
isFirstLine: L
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
function matchRuleOrInjections(s, I, L, R, z, B) {
|
|
1074
|
-
let V = matchRule(s, I, L, R, z, B), H = s.getInjections();
|
|
1075
|
-
if (H.length === 0) return V;
|
|
1076
|
-
let U = matchInjections(H, s, I, L, R, z, B);
|
|
1077
|
-
if (!U) return V;
|
|
1078
|
-
if (!V) return U;
|
|
1079
|
-
let W = V.captureIndices[0].start, G = U.captureIndices[0].start;
|
|
1080
|
-
return G < W || U.priorityMatch && G === W ? U : V;
|
|
1081
|
-
}
|
|
1082
|
-
function matchRule(s, I, L, R, z, B) {
|
|
1083
|
-
let { ruleScanner: V, findOptions: H } = prepareRuleSearch(z.getRule(s), s, z.endRule, L, R === B), U = V.findNextMatchSync(I, R, H);
|
|
1084
|
-
return U ? {
|
|
1085
|
-
captureIndices: U.captureIndices,
|
|
1086
|
-
matchedRuleId: U.ruleId
|
|
1087
|
-
} : null;
|
|
1088
|
-
}
|
|
1089
|
-
function matchInjections(s, I, L, R, z, B, V) {
|
|
1090
|
-
let H = Number.MAX_VALUE, U = null, W, G = 0, K = B.contentNameScopesList.getScopeNames();
|
|
1091
|
-
for (let B = 0, q = s.length; B < q; B++) {
|
|
1092
|
-
let q = s[B];
|
|
1093
|
-
if (!q.matcher(K)) continue;
|
|
1094
|
-
let { ruleScanner: J, findOptions: Y } = prepareRuleSearch(I.getRule(q.ruleId), I, null, R, z === V), X = J.findNextMatchSync(L, z, Y);
|
|
1095
|
-
if (!X) continue;
|
|
1096
|
-
let Z = X.captureIndices[0].start;
|
|
1097
|
-
if (!(Z >= H) && (H = Z, U = X.captureIndices, W = X.ruleId, G = q.priority, H === z)) break;
|
|
1098
|
-
}
|
|
1099
|
-
return U ? {
|
|
1100
|
-
priorityMatch: G === -1,
|
|
1101
|
-
captureIndices: U,
|
|
1102
|
-
matchedRuleId: W
|
|
1103
|
-
} : null;
|
|
1104
|
-
}
|
|
1105
|
-
function prepareRuleSearch(s, I, L, R, z) {
|
|
1106
|
-
return UseOnigurumaFindOptions ? {
|
|
1107
|
-
ruleScanner: s.compile(I, L),
|
|
1108
|
-
findOptions: getFindOptions(R, z)
|
|
1109
|
-
} : {
|
|
1110
|
-
ruleScanner: s.compileAG(I, L, R, z),
|
|
1111
|
-
findOptions: 0
|
|
1112
|
-
};
|
|
1113
|
-
}
|
|
1114
|
-
function prepareRuleWhileSearch(s, I, L, R, z) {
|
|
1115
|
-
return UseOnigurumaFindOptions ? {
|
|
1116
|
-
ruleScanner: s.compileWhile(I, L),
|
|
1117
|
-
findOptions: getFindOptions(R, z)
|
|
1118
|
-
} : {
|
|
1119
|
-
ruleScanner: s.compileWhileAG(I, L, R, z),
|
|
1120
|
-
findOptions: 0
|
|
1121
|
-
};
|
|
1122
|
-
}
|
|
1123
|
-
function getFindOptions(s, I) {
|
|
1124
|
-
let L = 0;
|
|
1125
|
-
return s || (L |= 1), I || (L |= 4), L;
|
|
1126
|
-
}
|
|
1127
|
-
function handleCaptures(s, I, L, R, z, B, V) {
|
|
1128
|
-
if (B.length === 0) return;
|
|
1129
|
-
let H = I.content, U = Math.min(B.length, V.length), W = [], G = V[0].end;
|
|
1130
|
-
for (let I = 0; I < U; I++) {
|
|
1131
|
-
let U = B[I];
|
|
1132
|
-
if (U === null) continue;
|
|
1133
|
-
let K = V[I];
|
|
1134
|
-
if (K.length === 0) continue;
|
|
1135
|
-
if (K.start > G) break;
|
|
1136
|
-
for (; W.length > 0 && W[W.length - 1].endPos <= K.start;) z.produceFromScopes(W[W.length - 1].scopes, W[W.length - 1].endPos), W.pop();
|
|
1137
|
-
if (W.length > 0 ? z.produceFromScopes(W[W.length - 1].scopes, K.start) : z.produce(R, K.start), U.retokenizeCapturedWithRuleId) {
|
|
1138
|
-
let I = U.getName(H, V), B = R.contentNameScopesList.pushAttributed(I, s), W = U.getContentName(H, V), G = B.pushAttributed(W, s), q = R.push(U.retokenizeCapturedWithRuleId, K.start, -1, !1, null, B, G), J = s.createOnigString(H.substring(0, K.end));
|
|
1139
|
-
_tokenizeString(s, J, L && K.start === 0, K.start, q, z, !1, 0), disposeOnigString(J);
|
|
1140
|
-
continue;
|
|
1141
|
-
}
|
|
1142
|
-
let q = U.getName(H, V);
|
|
1143
|
-
if (q !== null) {
|
|
1144
|
-
let I = (W.length > 0 ? W[W.length - 1].scopes : R.contentNameScopesList).pushAttributed(q, s);
|
|
1145
|
-
W.push(new LocalStackElement(I, K.end));
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
for (; W.length > 0;) z.produceFromScopes(W[W.length - 1].scopes, W[W.length - 1].endPos), W.pop();
|
|
1149
|
-
}
|
|
1150
|
-
var LocalStackElement = class {
|
|
1151
|
-
scopes;
|
|
1152
|
-
endPos;
|
|
1153
|
-
constructor(s, I) {
|
|
1154
|
-
this.scopes = s, this.endPos = I;
|
|
1155
|
-
}
|
|
1156
|
-
};
|
|
1157
|
-
function createGrammar(s, I, L, R, z, B, V, H) {
|
|
1158
|
-
return new Grammar(s, I, L, R, z, B, V, H);
|
|
1159
|
-
}
|
|
1160
|
-
function collectInjections(s, I, L, R, z) {
|
|
1161
|
-
let B = createMatchers(I, nameMatcher), V = RuleFactory.getCompiledRuleId(L, R, z.repository);
|
|
1162
|
-
for (let L of B) s.push({
|
|
1163
|
-
debugSelector: I,
|
|
1164
|
-
matcher: L.matcher,
|
|
1165
|
-
ruleId: V,
|
|
1166
|
-
grammar: z,
|
|
1167
|
-
priority: L.priority
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
function nameMatcher(s, I) {
|
|
1171
|
-
if (I.length < s.length) return !1;
|
|
1172
|
-
let L = 0;
|
|
1173
|
-
return s.every((s) => {
|
|
1174
|
-
for (let R = L; R < I.length; R++) if (scopesAreMatching(I[R], s)) return L = R + 1, !0;
|
|
1175
|
-
return !1;
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
|
-
function scopesAreMatching(s, I) {
|
|
1179
|
-
if (!s) return !1;
|
|
1180
|
-
if (s === I) return !0;
|
|
1181
|
-
let L = I.length;
|
|
1182
|
-
return s.length > L && s.substr(0, L) === I && s[L] === ".";
|
|
1183
|
-
}
|
|
1184
|
-
var Grammar = class {
|
|
1185
|
-
constructor(s, I, L, R, z, B, V, H) {
|
|
1186
|
-
if (this._rootScopeName = s, this.balancedBracketSelectors = B, this._onigLib = H, this._basicScopeAttributesProvider = new BasicScopeAttributesProvider(L, R), this._rootId = -1, this._lastRuleId = 0, this._ruleId2desc = [null], this._includedGrammars = {}, this._grammarRepository = V, this._grammar = initGrammar(I, null), this._injections = null, this._tokenTypeMatchers = [], z) for (let s of Object.keys(z)) {
|
|
1187
|
-
let I = createMatchers(s, nameMatcher);
|
|
1188
|
-
for (let L of I) this._tokenTypeMatchers.push({
|
|
1189
|
-
matcher: L.matcher,
|
|
1190
|
-
type: z[s]
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
_rootId;
|
|
1195
|
-
_lastRuleId;
|
|
1196
|
-
_ruleId2desc;
|
|
1197
|
-
_includedGrammars;
|
|
1198
|
-
_grammarRepository;
|
|
1199
|
-
_grammar;
|
|
1200
|
-
_injections;
|
|
1201
|
-
_basicScopeAttributesProvider;
|
|
1202
|
-
_tokenTypeMatchers;
|
|
1203
|
-
get themeProvider() {
|
|
1204
|
-
return this._grammarRepository;
|
|
1205
|
-
}
|
|
1206
|
-
dispose() {
|
|
1207
|
-
for (let s of this._ruleId2desc) s && s.dispose();
|
|
1208
|
-
}
|
|
1209
|
-
createOnigScanner(s) {
|
|
1210
|
-
return this._onigLib.createOnigScanner(s);
|
|
1211
|
-
}
|
|
1212
|
-
createOnigString(s) {
|
|
1213
|
-
return this._onigLib.createOnigString(s);
|
|
1214
|
-
}
|
|
1215
|
-
getMetadataForScope(s) {
|
|
1216
|
-
return this._basicScopeAttributesProvider.getBasicScopeAttributes(s);
|
|
1217
|
-
}
|
|
1218
|
-
_collectInjections() {
|
|
1219
|
-
let s = {
|
|
1220
|
-
lookup: (s) => s === this._rootScopeName ? this._grammar : this.getExternalGrammar(s),
|
|
1221
|
-
injections: (s) => this._grammarRepository.injections(s)
|
|
1222
|
-
}, I = [], L = this._rootScopeName, R = s.lookup(L);
|
|
1223
|
-
if (R) {
|
|
1224
|
-
let s = R.injections;
|
|
1225
|
-
if (s) for (let L in s) collectInjections(I, L, s[L], this, R);
|
|
1226
|
-
let z = this._grammarRepository.injections(L);
|
|
1227
|
-
z && z.forEach((s) => {
|
|
1228
|
-
let L = this.getExternalGrammar(s);
|
|
1229
|
-
if (L) {
|
|
1230
|
-
let s = L.injectionSelector;
|
|
1231
|
-
s && collectInjections(I, s, L, this, L);
|
|
1232
|
-
}
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
return I.sort((s, I) => s.priority - I.priority), I;
|
|
1236
|
-
}
|
|
1237
|
-
getInjections() {
|
|
1238
|
-
return this._injections === null && (this._injections = this._collectInjections()), this._injections;
|
|
1239
|
-
}
|
|
1240
|
-
registerRule(s) {
|
|
1241
|
-
let I = ++this._lastRuleId, L = s(ruleIdFromNumber(I));
|
|
1242
|
-
return this._ruleId2desc[I] = L, L;
|
|
1243
|
-
}
|
|
1244
|
-
getRule(s) {
|
|
1245
|
-
return this._ruleId2desc[ruleIdToNumber(s)];
|
|
1246
|
-
}
|
|
1247
|
-
getExternalGrammar(s, I) {
|
|
1248
|
-
if (this._includedGrammars[s]) return this._includedGrammars[s];
|
|
1249
|
-
if (this._grammarRepository) {
|
|
1250
|
-
let L = this._grammarRepository.lookup(s);
|
|
1251
|
-
if (L) return this._includedGrammars[s] = initGrammar(L, I && I.$base), this._includedGrammars[s];
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
tokenizeLine(s, I, L = 0) {
|
|
1255
|
-
let R = this._tokenize(s, I, !1, L);
|
|
1256
|
-
return {
|
|
1257
|
-
tokens: R.lineTokens.getResult(R.ruleStack, R.lineLength),
|
|
1258
|
-
ruleStack: R.ruleStack,
|
|
1259
|
-
stoppedEarly: R.stoppedEarly
|
|
1260
|
-
};
|
|
1261
|
-
}
|
|
1262
|
-
tokenizeLine2(s, I, L = 0) {
|
|
1263
|
-
let R = this._tokenize(s, I, !0, L);
|
|
1264
|
-
return {
|
|
1265
|
-
tokens: R.lineTokens.getBinaryResult(R.ruleStack, R.lineLength),
|
|
1266
|
-
ruleStack: R.ruleStack,
|
|
1267
|
-
stoppedEarly: R.stoppedEarly
|
|
1268
|
-
};
|
|
1269
|
-
}
|
|
1270
|
-
_tokenize(s, I, L, R) {
|
|
1271
|
-
this._rootId === -1 && (this._rootId = RuleFactory.getCompiledRuleId(this._grammar.repository.$self, this, this._grammar.repository), this.getInjections());
|
|
1272
|
-
let z;
|
|
1273
|
-
if (!I || I === StateStackImpl.NULL) {
|
|
1274
|
-
z = !0;
|
|
1275
|
-
let s = this._basicScopeAttributesProvider.getDefaultAttributes(), L = this.themeProvider.getDefaults(), R = EncodedTokenMetadata.set(0, s.languageId, s.tokenType, null, L.fontStyle, L.foregroundId, L.backgroundId), B = this.getRule(this._rootId).getName(null, null), V;
|
|
1276
|
-
V = B ? AttributedScopeStack.createRootAndLookUpScopeName(B, R, this) : AttributedScopeStack.createRoot("unknown", R), I = new StateStackImpl(null, this._rootId, -1, -1, !1, null, V, V);
|
|
1277
|
-
} else z = !1, I.reset();
|
|
1278
|
-
s += "\n";
|
|
1279
|
-
let B = this.createOnigString(s), V = B.content.length, H = new LineTokens(L, s, this._tokenTypeMatchers, this.balancedBracketSelectors), U = _tokenizeString(this, B, z, 0, I, H, !0, R);
|
|
1280
|
-
return disposeOnigString(B), {
|
|
1281
|
-
lineLength: V,
|
|
1282
|
-
lineTokens: H,
|
|
1283
|
-
ruleStack: U.stack,
|
|
1284
|
-
stoppedEarly: U.stoppedEarly
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
};
|
|
1288
|
-
function initGrammar(s, I) {
|
|
1289
|
-
return s = clone(s), s.repository = s.repository || {}, s.repository.$self = {
|
|
1290
|
-
$vscodeTextmateLocation: s.$vscodeTextmateLocation,
|
|
1291
|
-
patterns: s.patterns,
|
|
1292
|
-
name: s.scopeName
|
|
1293
|
-
}, s.repository.$base = I || s.repository.$self, s;
|
|
1294
|
-
}
|
|
1295
|
-
var AttributedScopeStack = class s {
|
|
1296
|
-
constructor(s, I, L) {
|
|
1297
|
-
this.parent = s, this.scopePath = I, this.tokenAttributes = L;
|
|
1298
|
-
}
|
|
1299
|
-
static fromExtension(I, L) {
|
|
1300
|
-
let R = I, z = I?.scopePath ?? null;
|
|
1301
|
-
for (let I of L) z = ScopeStack.push(z, I.scopeNames), R = new s(R, z, I.encodedTokenAttributes);
|
|
1302
|
-
return R;
|
|
1303
|
-
}
|
|
1304
|
-
static createRoot(I, L) {
|
|
1305
|
-
return new s(null, new ScopeStack(null, I), L);
|
|
1306
|
-
}
|
|
1307
|
-
static createRootAndLookUpScopeName(I, L, R) {
|
|
1308
|
-
let z = R.getMetadataForScope(I), B = new ScopeStack(null, I), V = R.themeProvider.themeMatch(B);
|
|
1309
|
-
return new s(null, B, s.mergeAttributes(L, z, V));
|
|
1310
|
-
}
|
|
1311
|
-
get scopeName() {
|
|
1312
|
-
return this.scopePath.scopeName;
|
|
1313
|
-
}
|
|
1314
|
-
toString() {
|
|
1315
|
-
return this.getScopeNames().join(" ");
|
|
1316
|
-
}
|
|
1317
|
-
equals(I) {
|
|
1318
|
-
return s.equals(this, I);
|
|
1319
|
-
}
|
|
1320
|
-
static equals(s, I) {
|
|
1321
|
-
do {
|
|
1322
|
-
if (s === I || !s && !I) return !0;
|
|
1323
|
-
if (!s || !I || s.scopeName !== I.scopeName || s.tokenAttributes !== I.tokenAttributes) return !1;
|
|
1324
|
-
s = s.parent, I = I.parent;
|
|
1325
|
-
} while (!0);
|
|
1326
|
-
}
|
|
1327
|
-
static mergeAttributes(s, I, L) {
|
|
1328
|
-
let R = -1, z = 0, B = 0;
|
|
1329
|
-
return L !== null && (R = L.fontStyle, z = L.foregroundId, B = L.backgroundId), EncodedTokenMetadata.set(s, I.languageId, I.tokenType, null, R, z, B);
|
|
1330
|
-
}
|
|
1331
|
-
pushAttributed(I, L) {
|
|
1332
|
-
if (I === null) return this;
|
|
1333
|
-
if (I.indexOf(" ") === -1) return s._pushAttributed(this, I, L);
|
|
1334
|
-
let R = I.split(/ /g), z = this;
|
|
1335
|
-
for (let I of R) z = s._pushAttributed(z, I, L);
|
|
1336
|
-
return z;
|
|
1337
|
-
}
|
|
1338
|
-
static _pushAttributed(I, L, R) {
|
|
1339
|
-
let z = R.getMetadataForScope(L), B = I.scopePath.push(L), V = R.themeProvider.themeMatch(B);
|
|
1340
|
-
return new s(I, B, s.mergeAttributes(I.tokenAttributes, z, V));
|
|
1341
|
-
}
|
|
1342
|
-
getScopeNames() {
|
|
1343
|
-
return this.scopePath.getSegments();
|
|
1344
|
-
}
|
|
1345
|
-
getExtensionIfDefined(s) {
|
|
1346
|
-
let I = [], L = this;
|
|
1347
|
-
for (; L && L !== s;) I.push({
|
|
1348
|
-
encodedTokenAttributes: L.tokenAttributes,
|
|
1349
|
-
scopeNames: L.scopePath.getExtensionIfDefined(L.parent?.scopePath ?? null)
|
|
1350
|
-
}), L = L.parent;
|
|
1351
|
-
return L === s ? I.reverse() : void 0;
|
|
1352
|
-
}
|
|
1353
|
-
}, StateStackImpl = class s {
|
|
1354
|
-
constructor(s, I, L, R, z, B, V, H) {
|
|
1355
|
-
this.parent = s, this.ruleId = I, this.beginRuleCapturedEOL = z, this.endRule = B, this.nameScopesList = V, this.contentNameScopesList = H, this.depth = this.parent ? this.parent.depth + 1 : 1, this._enterPos = L, this._anchorPos = R;
|
|
1356
|
-
}
|
|
1357
|
-
_stackElementBrand = void 0;
|
|
1358
|
-
static NULL = new s(null, 0, 0, 0, !1, null, null, null);
|
|
1359
|
-
_enterPos;
|
|
1360
|
-
_anchorPos;
|
|
1361
|
-
depth;
|
|
1362
|
-
equals(I) {
|
|
1363
|
-
return I === null ? !1 : s._equals(this, I);
|
|
1364
|
-
}
|
|
1365
|
-
static _equals(s, I) {
|
|
1366
|
-
return s === I ? !0 : this._structuralEquals(s, I) ? AttributedScopeStack.equals(s.contentNameScopesList, I.contentNameScopesList) : !1;
|
|
1367
|
-
}
|
|
1368
|
-
static _structuralEquals(s, I) {
|
|
1369
|
-
do {
|
|
1370
|
-
if (s === I || !s && !I) return !0;
|
|
1371
|
-
if (!s || !I || s.depth !== I.depth || s.ruleId !== I.ruleId || s.endRule !== I.endRule) return !1;
|
|
1372
|
-
s = s.parent, I = I.parent;
|
|
1373
|
-
} while (!0);
|
|
1374
|
-
}
|
|
1375
|
-
clone() {
|
|
1376
|
-
return this;
|
|
1377
|
-
}
|
|
1378
|
-
static _reset(s) {
|
|
1379
|
-
for (; s;) s._enterPos = -1, s._anchorPos = -1, s = s.parent;
|
|
1380
|
-
}
|
|
1381
|
-
reset() {
|
|
1382
|
-
s._reset(this);
|
|
1383
|
-
}
|
|
1384
|
-
pop() {
|
|
1385
|
-
return this.parent;
|
|
1386
|
-
}
|
|
1387
|
-
safePop() {
|
|
1388
|
-
return this.parent ? this.parent : this;
|
|
1389
|
-
}
|
|
1390
|
-
push(I, L, R, z, B, V, H) {
|
|
1391
|
-
return new s(this, I, L, R, z, B, V, H);
|
|
1392
|
-
}
|
|
1393
|
-
getEnterPos() {
|
|
1394
|
-
return this._enterPos;
|
|
1395
|
-
}
|
|
1396
|
-
getAnchorPos() {
|
|
1397
|
-
return this._anchorPos;
|
|
1398
|
-
}
|
|
1399
|
-
getRule(s) {
|
|
1400
|
-
return s.getRule(this.ruleId);
|
|
1401
|
-
}
|
|
1402
|
-
toString() {
|
|
1403
|
-
let s = [];
|
|
1404
|
-
return this._writeString(s, 0), "[" + s.join(",") + "]";
|
|
1405
|
-
}
|
|
1406
|
-
_writeString(s, I) {
|
|
1407
|
-
return this.parent && (I = this.parent._writeString(s, I)), s[I++] = `(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`, I;
|
|
1408
|
-
}
|
|
1409
|
-
withContentNameScopesList(s) {
|
|
1410
|
-
return this.contentNameScopesList === s ? this : this.parent.push(this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, this.endRule, this.nameScopesList, s);
|
|
1411
|
-
}
|
|
1412
|
-
withEndRule(I) {
|
|
1413
|
-
return this.endRule === I ? this : new s(this.parent, this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, I, this.nameScopesList, this.contentNameScopesList);
|
|
1414
|
-
}
|
|
1415
|
-
hasSameRuleAs(s) {
|
|
1416
|
-
let I = this;
|
|
1417
|
-
for (; I && I._enterPos === s._enterPos;) {
|
|
1418
|
-
if (I.ruleId === s.ruleId) return !0;
|
|
1419
|
-
I = I.parent;
|
|
1420
|
-
}
|
|
1421
|
-
return !1;
|
|
1422
|
-
}
|
|
1423
|
-
toStateStackFrame() {
|
|
1424
|
-
return {
|
|
1425
|
-
ruleId: ruleIdToNumber(this.ruleId),
|
|
1426
|
-
beginRuleCapturedEOL: this.beginRuleCapturedEOL,
|
|
1427
|
-
endRule: this.endRule,
|
|
1428
|
-
nameScopesList: this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList ?? null) ?? [],
|
|
1429
|
-
contentNameScopesList: this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList) ?? []
|
|
1430
|
-
};
|
|
1431
|
-
}
|
|
1432
|
-
static pushFrame(I, L) {
|
|
1433
|
-
let R = AttributedScopeStack.fromExtension(I?.nameScopesList ?? null, L.nameScopesList);
|
|
1434
|
-
return new s(I, ruleIdFromNumber(L.ruleId), L.enterPos ?? -1, L.anchorPos ?? -1, L.beginRuleCapturedEOL, L.endRule, R, AttributedScopeStack.fromExtension(R, L.contentNameScopesList));
|
|
1435
|
-
}
|
|
1436
|
-
}, BalancedBracketSelectors = class {
|
|
1437
|
-
balancedBracketScopes;
|
|
1438
|
-
unbalancedBracketScopes;
|
|
1439
|
-
allowAny = !1;
|
|
1440
|
-
constructor(s, I) {
|
|
1441
|
-
this.balancedBracketScopes = s.flatMap((s) => s === "*" ? (this.allowAny = !0, []) : createMatchers(s, nameMatcher).map((s) => s.matcher)), this.unbalancedBracketScopes = I.flatMap((s) => createMatchers(s, nameMatcher).map((s) => s.matcher));
|
|
1442
|
-
}
|
|
1443
|
-
get matchesAlways() {
|
|
1444
|
-
return this.allowAny && this.unbalancedBracketScopes.length === 0;
|
|
1445
|
-
}
|
|
1446
|
-
get matchesNever() {
|
|
1447
|
-
return this.balancedBracketScopes.length === 0 && !this.allowAny;
|
|
1448
|
-
}
|
|
1449
|
-
match(s) {
|
|
1450
|
-
for (let I of this.unbalancedBracketScopes) if (I(s)) return !1;
|
|
1451
|
-
for (let I of this.balancedBracketScopes) if (I(s)) return !0;
|
|
1452
|
-
return this.allowAny;
|
|
1453
|
-
}
|
|
1454
|
-
}, LineTokens = class {
|
|
1455
|
-
constructor(s, I, L, R) {
|
|
1456
|
-
this.balancedBracketSelectors = R, this._emitBinaryTokens = s, this._tokenTypeOverrides = L, this._lineText = null, this._tokens = [], this._binaryTokens = [], this._lastTokenEndIndex = 0;
|
|
1457
|
-
}
|
|
1458
|
-
_emitBinaryTokens;
|
|
1459
|
-
_lineText;
|
|
1460
|
-
_tokens;
|
|
1461
|
-
_binaryTokens;
|
|
1462
|
-
_lastTokenEndIndex;
|
|
1463
|
-
_tokenTypeOverrides;
|
|
1464
|
-
produce(s, I) {
|
|
1465
|
-
this.produceFromScopes(s.contentNameScopesList, I);
|
|
1466
|
-
}
|
|
1467
|
-
produceFromScopes(s, I) {
|
|
1468
|
-
if (this._lastTokenEndIndex >= I) return;
|
|
1469
|
-
if (this._emitBinaryTokens) {
|
|
1470
|
-
let L = s?.tokenAttributes ?? 0, R = !1;
|
|
1471
|
-
if (this.balancedBracketSelectors?.matchesAlways && (R = !0), this._tokenTypeOverrides.length > 0 || this.balancedBracketSelectors && !this.balancedBracketSelectors.matchesAlways && !this.balancedBracketSelectors.matchesNever) {
|
|
1472
|
-
let I = s?.getScopeNames() ?? [];
|
|
1473
|
-
for (let s of this._tokenTypeOverrides) s.matcher(I) && (L = EncodedTokenMetadata.set(L, 0, toOptionalTokenType(s.type), null, -1, 0, 0));
|
|
1474
|
-
this.balancedBracketSelectors && (R = this.balancedBracketSelectors.match(I));
|
|
1475
|
-
}
|
|
1476
|
-
if (R && (L = EncodedTokenMetadata.set(L, 0, 8, R, -1, 0, 0)), this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 1] === L) {
|
|
1477
|
-
this._lastTokenEndIndex = I;
|
|
1478
|
-
return;
|
|
1479
|
-
}
|
|
1480
|
-
this._binaryTokens.push(this._lastTokenEndIndex), this._binaryTokens.push(L), this._lastTokenEndIndex = I;
|
|
1481
|
-
return;
|
|
1482
|
-
}
|
|
1483
|
-
let L = s?.getScopeNames() ?? [];
|
|
1484
|
-
this._tokens.push({
|
|
1485
|
-
startIndex: this._lastTokenEndIndex,
|
|
1486
|
-
endIndex: I,
|
|
1487
|
-
scopes: L
|
|
1488
|
-
}), this._lastTokenEndIndex = I;
|
|
1489
|
-
}
|
|
1490
|
-
getResult(s, I) {
|
|
1491
|
-
return this._tokens.length > 0 && this._tokens[this._tokens.length - 1].startIndex === I - 1 && this._tokens.pop(), this._tokens.length === 0 && (this._lastTokenEndIndex = -1, this.produce(s, I), this._tokens[this._tokens.length - 1].startIndex = 0), this._tokens;
|
|
1492
|
-
}
|
|
1493
|
-
getBinaryResult(s, I) {
|
|
1494
|
-
this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 2] === I - 1 && (this._binaryTokens.pop(), this._binaryTokens.pop()), this._binaryTokens.length === 0 && (this._lastTokenEndIndex = -1, this.produce(s, I), this._binaryTokens[this._binaryTokens.length - 2] = 0);
|
|
1495
|
-
let L = new Uint32Array(this._binaryTokens.length);
|
|
1496
|
-
for (let s = 0, I = this._binaryTokens.length; s < I; s++) L[s] = this._binaryTokens[s];
|
|
1497
|
-
return L;
|
|
1498
|
-
}
|
|
1499
|
-
}, SyncRegistry = class {
|
|
1500
|
-
constructor(s, I) {
|
|
1501
|
-
this._onigLib = I, this._theme = s;
|
|
1502
|
-
}
|
|
1503
|
-
_grammars = /* @__PURE__ */ new Map();
|
|
1504
|
-
_rawGrammars = /* @__PURE__ */ new Map();
|
|
1505
|
-
_injectionGrammars = /* @__PURE__ */ new Map();
|
|
1506
|
-
_theme;
|
|
1507
|
-
dispose() {
|
|
1508
|
-
for (let s of this._grammars.values()) s.dispose();
|
|
1509
|
-
}
|
|
1510
|
-
setTheme(s) {
|
|
1511
|
-
this._theme = s;
|
|
1512
|
-
}
|
|
1513
|
-
getColorMap() {
|
|
1514
|
-
return this._theme.getColorMap();
|
|
1515
|
-
}
|
|
1516
|
-
addGrammar(s, I) {
|
|
1517
|
-
this._rawGrammars.set(s.scopeName, s), I && this._injectionGrammars.set(s.scopeName, I);
|
|
1518
|
-
}
|
|
1519
|
-
lookup(s) {
|
|
1520
|
-
return this._rawGrammars.get(s);
|
|
1521
|
-
}
|
|
1522
|
-
injections(s) {
|
|
1523
|
-
return this._injectionGrammars.get(s);
|
|
1524
|
-
}
|
|
1525
|
-
getDefaults() {
|
|
1526
|
-
return this._theme.getDefaults();
|
|
1527
|
-
}
|
|
1528
|
-
themeMatch(s) {
|
|
1529
|
-
return this._theme.match(s);
|
|
1530
|
-
}
|
|
1531
|
-
grammarForScopeName(s, I, L, R, z) {
|
|
1532
|
-
if (!this._grammars.has(s)) {
|
|
1533
|
-
let B = this._rawGrammars.get(s);
|
|
1534
|
-
if (!B) return null;
|
|
1535
|
-
this._grammars.set(s, createGrammar(s, B, I, L, R, z, this, this._onigLib));
|
|
1536
|
-
}
|
|
1537
|
-
return this._grammars.get(s);
|
|
1538
|
-
}
|
|
1539
|
-
}, Registry$1 = class {
|
|
1540
|
-
_options;
|
|
1541
|
-
_syncRegistry;
|
|
1542
|
-
_ensureGrammarCache;
|
|
1543
|
-
constructor(s) {
|
|
1544
|
-
this._options = s, this._syncRegistry = new SyncRegistry(Theme.createFromRawTheme(s.theme, s.colorMap), s.onigLib), this._ensureGrammarCache = /* @__PURE__ */ new Map();
|
|
1545
|
-
}
|
|
1546
|
-
dispose() {
|
|
1547
|
-
this._syncRegistry.dispose();
|
|
1548
|
-
}
|
|
1549
|
-
setTheme(s, I) {
|
|
1550
|
-
this._syncRegistry.setTheme(Theme.createFromRawTheme(s, I));
|
|
1551
|
-
}
|
|
1552
|
-
getColorMap() {
|
|
1553
|
-
return this._syncRegistry.getColorMap();
|
|
1554
|
-
}
|
|
1555
|
-
loadGrammarWithEmbeddedLanguages(s, I, L) {
|
|
1556
|
-
return this.loadGrammarWithConfiguration(s, I, { embeddedLanguages: L });
|
|
1557
|
-
}
|
|
1558
|
-
loadGrammarWithConfiguration(s, I, L) {
|
|
1559
|
-
return this._loadGrammar(s, I, L.embeddedLanguages, L.tokenTypes, new BalancedBracketSelectors(L.balancedBracketSelectors || [], L.unbalancedBracketSelectors || []));
|
|
1560
|
-
}
|
|
1561
|
-
loadGrammar(s) {
|
|
1562
|
-
return this._loadGrammar(s, 0, null, null, null);
|
|
1563
|
-
}
|
|
1564
|
-
_loadGrammar(s, I, L, R, z) {
|
|
1565
|
-
let B = new ScopeDependencyProcessor(this._syncRegistry, s);
|
|
1566
|
-
for (; B.Q.length > 0;) B.Q.map((s) => this._loadSingleGrammar(s.scopeName)), B.processQueue();
|
|
1567
|
-
return this._grammarForScopeName(s, I, L, R, z);
|
|
1568
|
-
}
|
|
1569
|
-
_loadSingleGrammar(s) {
|
|
1570
|
-
this._ensureGrammarCache.has(s) || (this._doLoadSingleGrammar(s), this._ensureGrammarCache.set(s, !0));
|
|
1571
|
-
}
|
|
1572
|
-
_doLoadSingleGrammar(s) {
|
|
1573
|
-
let I = this._options.loadGrammar(s);
|
|
1574
|
-
if (I) {
|
|
1575
|
-
let L = typeof this._options.getInjections == "function" ? this._options.getInjections(s) : void 0;
|
|
1576
|
-
this._syncRegistry.addGrammar(I, L);
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
addGrammar(s, I = [], L = 0, R = null) {
|
|
1580
|
-
return this._syncRegistry.addGrammar(s, I), this._grammarForScopeName(s.scopeName, L, R);
|
|
1581
|
-
}
|
|
1582
|
-
_grammarForScopeName(s, I = 0, L = null, R = null, z = null) {
|
|
1583
|
-
return this._syncRegistry.grammarForScopeName(s, I, L, R, z);
|
|
1584
|
-
}
|
|
1585
|
-
}, INITIAL = StateStackImpl.NULL;
|
|
1586
|
-
const htmlVoidElements = [
|
|
1587
|
-
"area",
|
|
1588
|
-
"base",
|
|
1589
|
-
"basefont",
|
|
1590
|
-
"bgsound",
|
|
1591
|
-
"br",
|
|
1592
|
-
"col",
|
|
1593
|
-
"command",
|
|
1594
|
-
"embed",
|
|
1595
|
-
"frame",
|
|
1596
|
-
"hr",
|
|
1597
|
-
"image",
|
|
1598
|
-
"img",
|
|
1599
|
-
"input",
|
|
1600
|
-
"keygen",
|
|
1601
|
-
"link",
|
|
1602
|
-
"meta",
|
|
1603
|
-
"param",
|
|
1604
|
-
"source",
|
|
1605
|
-
"track",
|
|
1606
|
-
"wbr"
|
|
1607
|
-
];
|
|
1608
|
-
var Schema = class {
|
|
1609
|
-
constructor(s, I, L) {
|
|
1610
|
-
this.normal = I, this.property = s, L && (this.space = L);
|
|
1611
|
-
}
|
|
1612
|
-
};
|
|
1613
|
-
Schema.prototype.normal = {}, Schema.prototype.property = {}, Schema.prototype.space = void 0;
|
|
1614
|
-
function merge(s, I) {
|
|
1615
|
-
let L = {}, R = {};
|
|
1616
|
-
for (let I of s) Object.assign(L, I.property), Object.assign(R, I.normal);
|
|
1617
|
-
return new Schema(L, R, I);
|
|
1618
|
-
}
|
|
1619
|
-
function normalize(s) {
|
|
1620
|
-
return s.toLowerCase();
|
|
1621
|
-
}
|
|
1622
|
-
var Info = class {
|
|
1623
|
-
constructor(s, I) {
|
|
1624
|
-
this.attribute = I, this.property = s;
|
|
1625
|
-
}
|
|
1626
|
-
};
|
|
1627
|
-
Info.prototype.attribute = "", Info.prototype.booleanish = !1, Info.prototype.boolean = !1, Info.prototype.commaOrSpaceSeparated = !1, Info.prototype.commaSeparated = !1, Info.prototype.defined = !1, Info.prototype.mustUseProperty = !1, Info.prototype.number = !1, Info.prototype.overloadedBoolean = !1, Info.prototype.property = "", Info.prototype.spaceSeparated = !1, Info.prototype.space = void 0;
|
|
1628
|
-
var types_exports = /* @__PURE__ */ __export({
|
|
1629
|
-
boolean: () => boolean,
|
|
1630
|
-
booleanish: () => booleanish,
|
|
1631
|
-
commaOrSpaceSeparated: () => commaOrSpaceSeparated,
|
|
1632
|
-
commaSeparated: () => commaSeparated,
|
|
1633
|
-
number: () => number,
|
|
1634
|
-
overloadedBoolean: () => overloadedBoolean,
|
|
1635
|
-
spaceSeparated: () => spaceSeparated
|
|
1636
|
-
}, 1), powers = 0;
|
|
1637
|
-
const boolean = increment(), booleanish = increment(), overloadedBoolean = increment(), number = increment(), spaceSeparated = increment(), commaSeparated = increment(), commaOrSpaceSeparated = increment();
|
|
1638
|
-
function increment() {
|
|
1639
|
-
return 2 ** ++powers;
|
|
1640
|
-
}
|
|
1641
|
-
var checks = Object.keys(types_exports), DefinedInfo = class extends Info {
|
|
1642
|
-
constructor(s, I, L, R) {
|
|
1643
|
-
let z = -1;
|
|
1644
|
-
if (super(s, I), mark(this, "space", R), typeof L == "number") for (; ++z < checks.length;) {
|
|
1645
|
-
let s = checks[z];
|
|
1646
|
-
mark(this, checks[z], (L & types_exports[s]) === types_exports[s]);
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
};
|
|
1650
|
-
DefinedInfo.prototype.defined = !0;
|
|
1651
|
-
function mark(s, I, L) {
|
|
1652
|
-
L && (s[I] = L);
|
|
1653
|
-
}
|
|
1654
|
-
function create(s) {
|
|
1655
|
-
let I = {}, L = {};
|
|
1656
|
-
for (let [R, z] of Object.entries(s.properties)) {
|
|
1657
|
-
let B = new DefinedInfo(R, s.transform(s.attributes || {}, R), z, s.space);
|
|
1658
|
-
s.mustUseProperty && s.mustUseProperty.includes(R) && (B.mustUseProperty = !0), I[R] = B, L[normalize(R)] = R, L[normalize(B.attribute)] = R;
|
|
1659
|
-
}
|
|
1660
|
-
return new Schema(I, L, s.space);
|
|
1661
|
-
}
|
|
1662
|
-
const aria = create({
|
|
1663
|
-
properties: {
|
|
1664
|
-
ariaActiveDescendant: null,
|
|
1665
|
-
ariaAtomic: booleanish,
|
|
1666
|
-
ariaAutoComplete: null,
|
|
1667
|
-
ariaBusy: booleanish,
|
|
1668
|
-
ariaChecked: booleanish,
|
|
1669
|
-
ariaColCount: number,
|
|
1670
|
-
ariaColIndex: number,
|
|
1671
|
-
ariaColSpan: number,
|
|
1672
|
-
ariaControls: spaceSeparated,
|
|
1673
|
-
ariaCurrent: null,
|
|
1674
|
-
ariaDescribedBy: spaceSeparated,
|
|
1675
|
-
ariaDetails: null,
|
|
1676
|
-
ariaDisabled: booleanish,
|
|
1677
|
-
ariaDropEffect: spaceSeparated,
|
|
1678
|
-
ariaErrorMessage: null,
|
|
1679
|
-
ariaExpanded: booleanish,
|
|
1680
|
-
ariaFlowTo: spaceSeparated,
|
|
1681
|
-
ariaGrabbed: booleanish,
|
|
1682
|
-
ariaHasPopup: null,
|
|
1683
|
-
ariaHidden: booleanish,
|
|
1684
|
-
ariaInvalid: null,
|
|
1685
|
-
ariaKeyShortcuts: null,
|
|
1686
|
-
ariaLabel: null,
|
|
1687
|
-
ariaLabelledBy: spaceSeparated,
|
|
1688
|
-
ariaLevel: number,
|
|
1689
|
-
ariaLive: null,
|
|
1690
|
-
ariaModal: booleanish,
|
|
1691
|
-
ariaMultiLine: booleanish,
|
|
1692
|
-
ariaMultiSelectable: booleanish,
|
|
1693
|
-
ariaOrientation: null,
|
|
1694
|
-
ariaOwns: spaceSeparated,
|
|
1695
|
-
ariaPlaceholder: null,
|
|
1696
|
-
ariaPosInSet: number,
|
|
1697
|
-
ariaPressed: booleanish,
|
|
1698
|
-
ariaReadOnly: booleanish,
|
|
1699
|
-
ariaRelevant: null,
|
|
1700
|
-
ariaRequired: booleanish,
|
|
1701
|
-
ariaRoleDescription: spaceSeparated,
|
|
1702
|
-
ariaRowCount: number,
|
|
1703
|
-
ariaRowIndex: number,
|
|
1704
|
-
ariaRowSpan: number,
|
|
1705
|
-
ariaSelected: booleanish,
|
|
1706
|
-
ariaSetSize: number,
|
|
1707
|
-
ariaSort: null,
|
|
1708
|
-
ariaValueMax: number,
|
|
1709
|
-
ariaValueMin: number,
|
|
1710
|
-
ariaValueNow: number,
|
|
1711
|
-
ariaValueText: null,
|
|
1712
|
-
role: null
|
|
1713
|
-
},
|
|
1714
|
-
transform(s, I) {
|
|
1715
|
-
return I === "role" ? I : "aria-" + I.slice(4).toLowerCase();
|
|
1716
|
-
}
|
|
1717
|
-
});
|
|
1718
|
-
function caseSensitiveTransform(s, I) {
|
|
1719
|
-
return I in s ? s[I] : I;
|
|
1720
|
-
}
|
|
1721
|
-
function caseInsensitiveTransform(s, I) {
|
|
1722
|
-
return caseSensitiveTransform(s, I.toLowerCase());
|
|
1723
|
-
}
|
|
1724
|
-
const html$3 = create({
|
|
1725
|
-
attributes: {
|
|
1726
|
-
acceptcharset: "accept-charset",
|
|
1727
|
-
classname: "class",
|
|
1728
|
-
htmlfor: "for",
|
|
1729
|
-
httpequiv: "http-equiv"
|
|
1730
|
-
},
|
|
1731
|
-
mustUseProperty: [
|
|
1732
|
-
"checked",
|
|
1733
|
-
"multiple",
|
|
1734
|
-
"muted",
|
|
1735
|
-
"selected"
|
|
1736
|
-
],
|
|
1737
|
-
properties: {
|
|
1738
|
-
abbr: null,
|
|
1739
|
-
accept: commaSeparated,
|
|
1740
|
-
acceptCharset: spaceSeparated,
|
|
1741
|
-
accessKey: spaceSeparated,
|
|
1742
|
-
action: null,
|
|
1743
|
-
allow: null,
|
|
1744
|
-
allowFullScreen: boolean,
|
|
1745
|
-
allowPaymentRequest: boolean,
|
|
1746
|
-
allowUserMedia: boolean,
|
|
1747
|
-
alt: null,
|
|
1748
|
-
as: null,
|
|
1749
|
-
async: boolean,
|
|
1750
|
-
autoCapitalize: null,
|
|
1751
|
-
autoComplete: spaceSeparated,
|
|
1752
|
-
autoFocus: boolean,
|
|
1753
|
-
autoPlay: boolean,
|
|
1754
|
-
blocking: spaceSeparated,
|
|
1755
|
-
capture: null,
|
|
1756
|
-
charSet: null,
|
|
1757
|
-
checked: boolean,
|
|
1758
|
-
cite: null,
|
|
1759
|
-
className: spaceSeparated,
|
|
1760
|
-
cols: number,
|
|
1761
|
-
colSpan: null,
|
|
1762
|
-
content: null,
|
|
1763
|
-
contentEditable: booleanish,
|
|
1764
|
-
controls: boolean,
|
|
1765
|
-
controlsList: spaceSeparated,
|
|
1766
|
-
coords: number | commaSeparated,
|
|
1767
|
-
crossOrigin: null,
|
|
1768
|
-
data: null,
|
|
1769
|
-
dateTime: null,
|
|
1770
|
-
decoding: null,
|
|
1771
|
-
default: boolean,
|
|
1772
|
-
defer: boolean,
|
|
1773
|
-
dir: null,
|
|
1774
|
-
dirName: null,
|
|
1775
|
-
disabled: boolean,
|
|
1776
|
-
download: overloadedBoolean,
|
|
1777
|
-
draggable: booleanish,
|
|
1778
|
-
encType: null,
|
|
1779
|
-
enterKeyHint: null,
|
|
1780
|
-
fetchPriority: null,
|
|
1781
|
-
form: null,
|
|
1782
|
-
formAction: null,
|
|
1783
|
-
formEncType: null,
|
|
1784
|
-
formMethod: null,
|
|
1785
|
-
formNoValidate: boolean,
|
|
1786
|
-
formTarget: null,
|
|
1787
|
-
headers: spaceSeparated,
|
|
1788
|
-
height: number,
|
|
1789
|
-
hidden: overloadedBoolean,
|
|
1790
|
-
high: number,
|
|
1791
|
-
href: null,
|
|
1792
|
-
hrefLang: null,
|
|
1793
|
-
htmlFor: spaceSeparated,
|
|
1794
|
-
httpEquiv: spaceSeparated,
|
|
1795
|
-
id: null,
|
|
1796
|
-
imageSizes: null,
|
|
1797
|
-
imageSrcSet: null,
|
|
1798
|
-
inert: boolean,
|
|
1799
|
-
inputMode: null,
|
|
1800
|
-
integrity: null,
|
|
1801
|
-
is: null,
|
|
1802
|
-
isMap: boolean,
|
|
1803
|
-
itemId: null,
|
|
1804
|
-
itemProp: spaceSeparated,
|
|
1805
|
-
itemRef: spaceSeparated,
|
|
1806
|
-
itemScope: boolean,
|
|
1807
|
-
itemType: spaceSeparated,
|
|
1808
|
-
kind: null,
|
|
1809
|
-
label: null,
|
|
1810
|
-
lang: null,
|
|
1811
|
-
language: null,
|
|
1812
|
-
list: null,
|
|
1813
|
-
loading: null,
|
|
1814
|
-
loop: boolean,
|
|
1815
|
-
low: number,
|
|
1816
|
-
manifest: null,
|
|
1817
|
-
max: null,
|
|
1818
|
-
maxLength: number,
|
|
1819
|
-
media: null,
|
|
1820
|
-
method: null,
|
|
1821
|
-
min: null,
|
|
1822
|
-
minLength: number,
|
|
1823
|
-
multiple: boolean,
|
|
1824
|
-
muted: boolean,
|
|
1825
|
-
name: null,
|
|
1826
|
-
nonce: null,
|
|
1827
|
-
noModule: boolean,
|
|
1828
|
-
noValidate: boolean,
|
|
1829
|
-
onAbort: null,
|
|
1830
|
-
onAfterPrint: null,
|
|
1831
|
-
onAuxClick: null,
|
|
1832
|
-
onBeforeMatch: null,
|
|
1833
|
-
onBeforePrint: null,
|
|
1834
|
-
onBeforeToggle: null,
|
|
1835
|
-
onBeforeUnload: null,
|
|
1836
|
-
onBlur: null,
|
|
1837
|
-
onCancel: null,
|
|
1838
|
-
onCanPlay: null,
|
|
1839
|
-
onCanPlayThrough: null,
|
|
1840
|
-
onChange: null,
|
|
1841
|
-
onClick: null,
|
|
1842
|
-
onClose: null,
|
|
1843
|
-
onContextLost: null,
|
|
1844
|
-
onContextMenu: null,
|
|
1845
|
-
onContextRestored: null,
|
|
1846
|
-
onCopy: null,
|
|
1847
|
-
onCueChange: null,
|
|
1848
|
-
onCut: null,
|
|
1849
|
-
onDblClick: null,
|
|
1850
|
-
onDrag: null,
|
|
1851
|
-
onDragEnd: null,
|
|
1852
|
-
onDragEnter: null,
|
|
1853
|
-
onDragExit: null,
|
|
1854
|
-
onDragLeave: null,
|
|
1855
|
-
onDragOver: null,
|
|
1856
|
-
onDragStart: null,
|
|
1857
|
-
onDrop: null,
|
|
1858
|
-
onDurationChange: null,
|
|
1859
|
-
onEmptied: null,
|
|
1860
|
-
onEnded: null,
|
|
1861
|
-
onError: null,
|
|
1862
|
-
onFocus: null,
|
|
1863
|
-
onFormData: null,
|
|
1864
|
-
onHashChange: null,
|
|
1865
|
-
onInput: null,
|
|
1866
|
-
onInvalid: null,
|
|
1867
|
-
onKeyDown: null,
|
|
1868
|
-
onKeyPress: null,
|
|
1869
|
-
onKeyUp: null,
|
|
1870
|
-
onLanguageChange: null,
|
|
1871
|
-
onLoad: null,
|
|
1872
|
-
onLoadedData: null,
|
|
1873
|
-
onLoadedMetadata: null,
|
|
1874
|
-
onLoadEnd: null,
|
|
1875
|
-
onLoadStart: null,
|
|
1876
|
-
onMessage: null,
|
|
1877
|
-
onMessageError: null,
|
|
1878
|
-
onMouseDown: null,
|
|
1879
|
-
onMouseEnter: null,
|
|
1880
|
-
onMouseLeave: null,
|
|
1881
|
-
onMouseMove: null,
|
|
1882
|
-
onMouseOut: null,
|
|
1883
|
-
onMouseOver: null,
|
|
1884
|
-
onMouseUp: null,
|
|
1885
|
-
onOffline: null,
|
|
1886
|
-
onOnline: null,
|
|
1887
|
-
onPageHide: null,
|
|
1888
|
-
onPageShow: null,
|
|
1889
|
-
onPaste: null,
|
|
1890
|
-
onPause: null,
|
|
1891
|
-
onPlay: null,
|
|
1892
|
-
onPlaying: null,
|
|
1893
|
-
onPopState: null,
|
|
1894
|
-
onProgress: null,
|
|
1895
|
-
onRateChange: null,
|
|
1896
|
-
onRejectionHandled: null,
|
|
1897
|
-
onReset: null,
|
|
1898
|
-
onResize: null,
|
|
1899
|
-
onScroll: null,
|
|
1900
|
-
onScrollEnd: null,
|
|
1901
|
-
onSecurityPolicyViolation: null,
|
|
1902
|
-
onSeeked: null,
|
|
1903
|
-
onSeeking: null,
|
|
1904
|
-
onSelect: null,
|
|
1905
|
-
onSlotChange: null,
|
|
1906
|
-
onStalled: null,
|
|
1907
|
-
onStorage: null,
|
|
1908
|
-
onSubmit: null,
|
|
1909
|
-
onSuspend: null,
|
|
1910
|
-
onTimeUpdate: null,
|
|
1911
|
-
onToggle: null,
|
|
1912
|
-
onUnhandledRejection: null,
|
|
1913
|
-
onUnload: null,
|
|
1914
|
-
onVolumeChange: null,
|
|
1915
|
-
onWaiting: null,
|
|
1916
|
-
onWheel: null,
|
|
1917
|
-
open: boolean,
|
|
1918
|
-
optimum: number,
|
|
1919
|
-
pattern: null,
|
|
1920
|
-
ping: spaceSeparated,
|
|
1921
|
-
placeholder: null,
|
|
1922
|
-
playsInline: boolean,
|
|
1923
|
-
popover: null,
|
|
1924
|
-
popoverTarget: null,
|
|
1925
|
-
popoverTargetAction: null,
|
|
1926
|
-
poster: null,
|
|
1927
|
-
preload: null,
|
|
1928
|
-
readOnly: boolean,
|
|
1929
|
-
referrerPolicy: null,
|
|
1930
|
-
rel: spaceSeparated,
|
|
1931
|
-
required: boolean,
|
|
1932
|
-
reversed: boolean,
|
|
1933
|
-
rows: number,
|
|
1934
|
-
rowSpan: number,
|
|
1935
|
-
sandbox: spaceSeparated,
|
|
1936
|
-
scope: null,
|
|
1937
|
-
scoped: boolean,
|
|
1938
|
-
seamless: boolean,
|
|
1939
|
-
selected: boolean,
|
|
1940
|
-
shadowRootClonable: boolean,
|
|
1941
|
-
shadowRootDelegatesFocus: boolean,
|
|
1942
|
-
shadowRootMode: null,
|
|
1943
|
-
shape: null,
|
|
1944
|
-
size: number,
|
|
1945
|
-
sizes: null,
|
|
1946
|
-
slot: null,
|
|
1947
|
-
span: number,
|
|
1948
|
-
spellCheck: booleanish,
|
|
1949
|
-
src: null,
|
|
1950
|
-
srcDoc: null,
|
|
1951
|
-
srcLang: null,
|
|
1952
|
-
srcSet: null,
|
|
1953
|
-
start: number,
|
|
1954
|
-
step: null,
|
|
1955
|
-
style: null,
|
|
1956
|
-
tabIndex: number,
|
|
1957
|
-
target: null,
|
|
1958
|
-
title: null,
|
|
1959
|
-
translate: null,
|
|
1960
|
-
type: null,
|
|
1961
|
-
typeMustMatch: boolean,
|
|
1962
|
-
useMap: null,
|
|
1963
|
-
value: booleanish,
|
|
1964
|
-
width: number,
|
|
1965
|
-
wrap: null,
|
|
1966
|
-
writingSuggestions: null,
|
|
1967
|
-
align: null,
|
|
1968
|
-
aLink: null,
|
|
1969
|
-
archive: spaceSeparated,
|
|
1970
|
-
axis: null,
|
|
1971
|
-
background: null,
|
|
1972
|
-
bgColor: null,
|
|
1973
|
-
border: number,
|
|
1974
|
-
borderColor: null,
|
|
1975
|
-
bottomMargin: number,
|
|
1976
|
-
cellPadding: null,
|
|
1977
|
-
cellSpacing: null,
|
|
1978
|
-
char: null,
|
|
1979
|
-
charOff: null,
|
|
1980
|
-
classId: null,
|
|
1981
|
-
clear: null,
|
|
1982
|
-
code: null,
|
|
1983
|
-
codeBase: null,
|
|
1984
|
-
codeType: null,
|
|
1985
|
-
color: null,
|
|
1986
|
-
compact: boolean,
|
|
1987
|
-
declare: boolean,
|
|
1988
|
-
event: null,
|
|
1989
|
-
face: null,
|
|
1990
|
-
frame: null,
|
|
1991
|
-
frameBorder: null,
|
|
1992
|
-
hSpace: number,
|
|
1993
|
-
leftMargin: number,
|
|
1994
|
-
link: null,
|
|
1995
|
-
longDesc: null,
|
|
1996
|
-
lowSrc: null,
|
|
1997
|
-
marginHeight: number,
|
|
1998
|
-
marginWidth: number,
|
|
1999
|
-
noResize: boolean,
|
|
2000
|
-
noHref: boolean,
|
|
2001
|
-
noShade: boolean,
|
|
2002
|
-
noWrap: boolean,
|
|
2003
|
-
object: null,
|
|
2004
|
-
profile: null,
|
|
2005
|
-
prompt: null,
|
|
2006
|
-
rev: null,
|
|
2007
|
-
rightMargin: number,
|
|
2008
|
-
rules: null,
|
|
2009
|
-
scheme: null,
|
|
2010
|
-
scrolling: booleanish,
|
|
2011
|
-
standby: null,
|
|
2012
|
-
summary: null,
|
|
2013
|
-
text: null,
|
|
2014
|
-
topMargin: number,
|
|
2015
|
-
valueType: null,
|
|
2016
|
-
version: null,
|
|
2017
|
-
vAlign: null,
|
|
2018
|
-
vLink: null,
|
|
2019
|
-
vSpace: number,
|
|
2020
|
-
allowTransparency: null,
|
|
2021
|
-
autoCorrect: null,
|
|
2022
|
-
autoSave: null,
|
|
2023
|
-
disablePictureInPicture: boolean,
|
|
2024
|
-
disableRemotePlayback: boolean,
|
|
2025
|
-
prefix: null,
|
|
2026
|
-
property: null,
|
|
2027
|
-
results: number,
|
|
2028
|
-
security: null,
|
|
2029
|
-
unselectable: null
|
|
2030
|
-
},
|
|
2031
|
-
space: "html",
|
|
2032
|
-
transform: caseInsensitiveTransform
|
|
2033
|
-
}), svg$1 = create({
|
|
2034
|
-
attributes: {
|
|
2035
|
-
accentHeight: "accent-height",
|
|
2036
|
-
alignmentBaseline: "alignment-baseline",
|
|
2037
|
-
arabicForm: "arabic-form",
|
|
2038
|
-
baselineShift: "baseline-shift",
|
|
2039
|
-
capHeight: "cap-height",
|
|
2040
|
-
className: "class",
|
|
2041
|
-
clipPath: "clip-path",
|
|
2042
|
-
clipRule: "clip-rule",
|
|
2043
|
-
colorInterpolation: "color-interpolation",
|
|
2044
|
-
colorInterpolationFilters: "color-interpolation-filters",
|
|
2045
|
-
colorProfile: "color-profile",
|
|
2046
|
-
colorRendering: "color-rendering",
|
|
2047
|
-
crossOrigin: "crossorigin",
|
|
2048
|
-
dataType: "datatype",
|
|
2049
|
-
dominantBaseline: "dominant-baseline",
|
|
2050
|
-
enableBackground: "enable-background",
|
|
2051
|
-
fillOpacity: "fill-opacity",
|
|
2052
|
-
fillRule: "fill-rule",
|
|
2053
|
-
floodColor: "flood-color",
|
|
2054
|
-
floodOpacity: "flood-opacity",
|
|
2055
|
-
fontFamily: "font-family",
|
|
2056
|
-
fontSize: "font-size",
|
|
2057
|
-
fontSizeAdjust: "font-size-adjust",
|
|
2058
|
-
fontStretch: "font-stretch",
|
|
2059
|
-
fontStyle: "font-style",
|
|
2060
|
-
fontVariant: "font-variant",
|
|
2061
|
-
fontWeight: "font-weight",
|
|
2062
|
-
glyphName: "glyph-name",
|
|
2063
|
-
glyphOrientationHorizontal: "glyph-orientation-horizontal",
|
|
2064
|
-
glyphOrientationVertical: "glyph-orientation-vertical",
|
|
2065
|
-
hrefLang: "hreflang",
|
|
2066
|
-
horizAdvX: "horiz-adv-x",
|
|
2067
|
-
horizOriginX: "horiz-origin-x",
|
|
2068
|
-
horizOriginY: "horiz-origin-y",
|
|
2069
|
-
imageRendering: "image-rendering",
|
|
2070
|
-
letterSpacing: "letter-spacing",
|
|
2071
|
-
lightingColor: "lighting-color",
|
|
2072
|
-
markerEnd: "marker-end",
|
|
2073
|
-
markerMid: "marker-mid",
|
|
2074
|
-
markerStart: "marker-start",
|
|
2075
|
-
navDown: "nav-down",
|
|
2076
|
-
navDownLeft: "nav-down-left",
|
|
2077
|
-
navDownRight: "nav-down-right",
|
|
2078
|
-
navLeft: "nav-left",
|
|
2079
|
-
navNext: "nav-next",
|
|
2080
|
-
navPrev: "nav-prev",
|
|
2081
|
-
navRight: "nav-right",
|
|
2082
|
-
navUp: "nav-up",
|
|
2083
|
-
navUpLeft: "nav-up-left",
|
|
2084
|
-
navUpRight: "nav-up-right",
|
|
2085
|
-
onAbort: "onabort",
|
|
2086
|
-
onActivate: "onactivate",
|
|
2087
|
-
onAfterPrint: "onafterprint",
|
|
2088
|
-
onBeforePrint: "onbeforeprint",
|
|
2089
|
-
onBegin: "onbegin",
|
|
2090
|
-
onCancel: "oncancel",
|
|
2091
|
-
onCanPlay: "oncanplay",
|
|
2092
|
-
onCanPlayThrough: "oncanplaythrough",
|
|
2093
|
-
onChange: "onchange",
|
|
2094
|
-
onClick: "onclick",
|
|
2095
|
-
onClose: "onclose",
|
|
2096
|
-
onCopy: "oncopy",
|
|
2097
|
-
onCueChange: "oncuechange",
|
|
2098
|
-
onCut: "oncut",
|
|
2099
|
-
onDblClick: "ondblclick",
|
|
2100
|
-
onDrag: "ondrag",
|
|
2101
|
-
onDragEnd: "ondragend",
|
|
2102
|
-
onDragEnter: "ondragenter",
|
|
2103
|
-
onDragExit: "ondragexit",
|
|
2104
|
-
onDragLeave: "ondragleave",
|
|
2105
|
-
onDragOver: "ondragover",
|
|
2106
|
-
onDragStart: "ondragstart",
|
|
2107
|
-
onDrop: "ondrop",
|
|
2108
|
-
onDurationChange: "ondurationchange",
|
|
2109
|
-
onEmptied: "onemptied",
|
|
2110
|
-
onEnd: "onend",
|
|
2111
|
-
onEnded: "onended",
|
|
2112
|
-
onError: "onerror",
|
|
2113
|
-
onFocus: "onfocus",
|
|
2114
|
-
onFocusIn: "onfocusin",
|
|
2115
|
-
onFocusOut: "onfocusout",
|
|
2116
|
-
onHashChange: "onhashchange",
|
|
2117
|
-
onInput: "oninput",
|
|
2118
|
-
onInvalid: "oninvalid",
|
|
2119
|
-
onKeyDown: "onkeydown",
|
|
2120
|
-
onKeyPress: "onkeypress",
|
|
2121
|
-
onKeyUp: "onkeyup",
|
|
2122
|
-
onLoad: "onload",
|
|
2123
|
-
onLoadedData: "onloadeddata",
|
|
2124
|
-
onLoadedMetadata: "onloadedmetadata",
|
|
2125
|
-
onLoadStart: "onloadstart",
|
|
2126
|
-
onMessage: "onmessage",
|
|
2127
|
-
onMouseDown: "onmousedown",
|
|
2128
|
-
onMouseEnter: "onmouseenter",
|
|
2129
|
-
onMouseLeave: "onmouseleave",
|
|
2130
|
-
onMouseMove: "onmousemove",
|
|
2131
|
-
onMouseOut: "onmouseout",
|
|
2132
|
-
onMouseOver: "onmouseover",
|
|
2133
|
-
onMouseUp: "onmouseup",
|
|
2134
|
-
onMouseWheel: "onmousewheel",
|
|
2135
|
-
onOffline: "onoffline",
|
|
2136
|
-
onOnline: "ononline",
|
|
2137
|
-
onPageHide: "onpagehide",
|
|
2138
|
-
onPageShow: "onpageshow",
|
|
2139
|
-
onPaste: "onpaste",
|
|
2140
|
-
onPause: "onpause",
|
|
2141
|
-
onPlay: "onplay",
|
|
2142
|
-
onPlaying: "onplaying",
|
|
2143
|
-
onPopState: "onpopstate",
|
|
2144
|
-
onProgress: "onprogress",
|
|
2145
|
-
onRateChange: "onratechange",
|
|
2146
|
-
onRepeat: "onrepeat",
|
|
2147
|
-
onReset: "onreset",
|
|
2148
|
-
onResize: "onresize",
|
|
2149
|
-
onScroll: "onscroll",
|
|
2150
|
-
onSeeked: "onseeked",
|
|
2151
|
-
onSeeking: "onseeking",
|
|
2152
|
-
onSelect: "onselect",
|
|
2153
|
-
onShow: "onshow",
|
|
2154
|
-
onStalled: "onstalled",
|
|
2155
|
-
onStorage: "onstorage",
|
|
2156
|
-
onSubmit: "onsubmit",
|
|
2157
|
-
onSuspend: "onsuspend",
|
|
2158
|
-
onTimeUpdate: "ontimeupdate",
|
|
2159
|
-
onToggle: "ontoggle",
|
|
2160
|
-
onUnload: "onunload",
|
|
2161
|
-
onVolumeChange: "onvolumechange",
|
|
2162
|
-
onWaiting: "onwaiting",
|
|
2163
|
-
onZoom: "onzoom",
|
|
2164
|
-
overlinePosition: "overline-position",
|
|
2165
|
-
overlineThickness: "overline-thickness",
|
|
2166
|
-
paintOrder: "paint-order",
|
|
2167
|
-
panose1: "panose-1",
|
|
2168
|
-
pointerEvents: "pointer-events",
|
|
2169
|
-
referrerPolicy: "referrerpolicy",
|
|
2170
|
-
renderingIntent: "rendering-intent",
|
|
2171
|
-
shapeRendering: "shape-rendering",
|
|
2172
|
-
stopColor: "stop-color",
|
|
2173
|
-
stopOpacity: "stop-opacity",
|
|
2174
|
-
strikethroughPosition: "strikethrough-position",
|
|
2175
|
-
strikethroughThickness: "strikethrough-thickness",
|
|
2176
|
-
strokeDashArray: "stroke-dasharray",
|
|
2177
|
-
strokeDashOffset: "stroke-dashoffset",
|
|
2178
|
-
strokeLineCap: "stroke-linecap",
|
|
2179
|
-
strokeLineJoin: "stroke-linejoin",
|
|
2180
|
-
strokeMiterLimit: "stroke-miterlimit",
|
|
2181
|
-
strokeOpacity: "stroke-opacity",
|
|
2182
|
-
strokeWidth: "stroke-width",
|
|
2183
|
-
tabIndex: "tabindex",
|
|
2184
|
-
textAnchor: "text-anchor",
|
|
2185
|
-
textDecoration: "text-decoration",
|
|
2186
|
-
textRendering: "text-rendering",
|
|
2187
|
-
transformOrigin: "transform-origin",
|
|
2188
|
-
typeOf: "typeof",
|
|
2189
|
-
underlinePosition: "underline-position",
|
|
2190
|
-
underlineThickness: "underline-thickness",
|
|
2191
|
-
unicodeBidi: "unicode-bidi",
|
|
2192
|
-
unicodeRange: "unicode-range",
|
|
2193
|
-
unitsPerEm: "units-per-em",
|
|
2194
|
-
vAlphabetic: "v-alphabetic",
|
|
2195
|
-
vHanging: "v-hanging",
|
|
2196
|
-
vIdeographic: "v-ideographic",
|
|
2197
|
-
vMathematical: "v-mathematical",
|
|
2198
|
-
vectorEffect: "vector-effect",
|
|
2199
|
-
vertAdvY: "vert-adv-y",
|
|
2200
|
-
vertOriginX: "vert-origin-x",
|
|
2201
|
-
vertOriginY: "vert-origin-y",
|
|
2202
|
-
wordSpacing: "word-spacing",
|
|
2203
|
-
writingMode: "writing-mode",
|
|
2204
|
-
xHeight: "x-height",
|
|
2205
|
-
playbackOrder: "playbackorder",
|
|
2206
|
-
timelineBegin: "timelinebegin"
|
|
2207
|
-
},
|
|
2208
|
-
properties: {
|
|
2209
|
-
about: commaOrSpaceSeparated,
|
|
2210
|
-
accentHeight: number,
|
|
2211
|
-
accumulate: null,
|
|
2212
|
-
additive: null,
|
|
2213
|
-
alignmentBaseline: null,
|
|
2214
|
-
alphabetic: number,
|
|
2215
|
-
amplitude: number,
|
|
2216
|
-
arabicForm: null,
|
|
2217
|
-
ascent: number,
|
|
2218
|
-
attributeName: null,
|
|
2219
|
-
attributeType: null,
|
|
2220
|
-
azimuth: number,
|
|
2221
|
-
bandwidth: null,
|
|
2222
|
-
baselineShift: null,
|
|
2223
|
-
baseFrequency: null,
|
|
2224
|
-
baseProfile: null,
|
|
2225
|
-
bbox: null,
|
|
2226
|
-
begin: null,
|
|
2227
|
-
bias: number,
|
|
2228
|
-
by: null,
|
|
2229
|
-
calcMode: null,
|
|
2230
|
-
capHeight: number,
|
|
2231
|
-
className: spaceSeparated,
|
|
2232
|
-
clip: null,
|
|
2233
|
-
clipPath: null,
|
|
2234
|
-
clipPathUnits: null,
|
|
2235
|
-
clipRule: null,
|
|
2236
|
-
color: null,
|
|
2237
|
-
colorInterpolation: null,
|
|
2238
|
-
colorInterpolationFilters: null,
|
|
2239
|
-
colorProfile: null,
|
|
2240
|
-
colorRendering: null,
|
|
2241
|
-
content: null,
|
|
2242
|
-
contentScriptType: null,
|
|
2243
|
-
contentStyleType: null,
|
|
2244
|
-
crossOrigin: null,
|
|
2245
|
-
cursor: null,
|
|
2246
|
-
cx: null,
|
|
2247
|
-
cy: null,
|
|
2248
|
-
d: null,
|
|
2249
|
-
dataType: null,
|
|
2250
|
-
defaultAction: null,
|
|
2251
|
-
descent: number,
|
|
2252
|
-
diffuseConstant: number,
|
|
2253
|
-
direction: null,
|
|
2254
|
-
display: null,
|
|
2255
|
-
dur: null,
|
|
2256
|
-
divisor: number,
|
|
2257
|
-
dominantBaseline: null,
|
|
2258
|
-
download: boolean,
|
|
2259
|
-
dx: null,
|
|
2260
|
-
dy: null,
|
|
2261
|
-
edgeMode: null,
|
|
2262
|
-
editable: null,
|
|
2263
|
-
elevation: number,
|
|
2264
|
-
enableBackground: null,
|
|
2265
|
-
end: null,
|
|
2266
|
-
event: null,
|
|
2267
|
-
exponent: number,
|
|
2268
|
-
externalResourcesRequired: null,
|
|
2269
|
-
fill: null,
|
|
2270
|
-
fillOpacity: number,
|
|
2271
|
-
fillRule: null,
|
|
2272
|
-
filter: null,
|
|
2273
|
-
filterRes: null,
|
|
2274
|
-
filterUnits: null,
|
|
2275
|
-
floodColor: null,
|
|
2276
|
-
floodOpacity: null,
|
|
2277
|
-
focusable: null,
|
|
2278
|
-
focusHighlight: null,
|
|
2279
|
-
fontFamily: null,
|
|
2280
|
-
fontSize: null,
|
|
2281
|
-
fontSizeAdjust: null,
|
|
2282
|
-
fontStretch: null,
|
|
2283
|
-
fontStyle: null,
|
|
2284
|
-
fontVariant: null,
|
|
2285
|
-
fontWeight: null,
|
|
2286
|
-
format: null,
|
|
2287
|
-
fr: null,
|
|
2288
|
-
from: null,
|
|
2289
|
-
fx: null,
|
|
2290
|
-
fy: null,
|
|
2291
|
-
g1: commaSeparated,
|
|
2292
|
-
g2: commaSeparated,
|
|
2293
|
-
glyphName: commaSeparated,
|
|
2294
|
-
glyphOrientationHorizontal: null,
|
|
2295
|
-
glyphOrientationVertical: null,
|
|
2296
|
-
glyphRef: null,
|
|
2297
|
-
gradientTransform: null,
|
|
2298
|
-
gradientUnits: null,
|
|
2299
|
-
handler: null,
|
|
2300
|
-
hanging: number,
|
|
2301
|
-
hatchContentUnits: null,
|
|
2302
|
-
hatchUnits: null,
|
|
2303
|
-
height: null,
|
|
2304
|
-
href: null,
|
|
2305
|
-
hrefLang: null,
|
|
2306
|
-
horizAdvX: number,
|
|
2307
|
-
horizOriginX: number,
|
|
2308
|
-
horizOriginY: number,
|
|
2309
|
-
id: null,
|
|
2310
|
-
ideographic: number,
|
|
2311
|
-
imageRendering: null,
|
|
2312
|
-
initialVisibility: null,
|
|
2313
|
-
in: null,
|
|
2314
|
-
in2: null,
|
|
2315
|
-
intercept: number,
|
|
2316
|
-
k: number,
|
|
2317
|
-
k1: number,
|
|
2318
|
-
k2: number,
|
|
2319
|
-
k3: number,
|
|
2320
|
-
k4: number,
|
|
2321
|
-
kernelMatrix: commaOrSpaceSeparated,
|
|
2322
|
-
kernelUnitLength: null,
|
|
2323
|
-
keyPoints: null,
|
|
2324
|
-
keySplines: null,
|
|
2325
|
-
keyTimes: null,
|
|
2326
|
-
kerning: null,
|
|
2327
|
-
lang: null,
|
|
2328
|
-
lengthAdjust: null,
|
|
2329
|
-
letterSpacing: null,
|
|
2330
|
-
lightingColor: null,
|
|
2331
|
-
limitingConeAngle: number,
|
|
2332
|
-
local: null,
|
|
2333
|
-
markerEnd: null,
|
|
2334
|
-
markerMid: null,
|
|
2335
|
-
markerStart: null,
|
|
2336
|
-
markerHeight: null,
|
|
2337
|
-
markerUnits: null,
|
|
2338
|
-
markerWidth: null,
|
|
2339
|
-
mask: null,
|
|
2340
|
-
maskContentUnits: null,
|
|
2341
|
-
maskUnits: null,
|
|
2342
|
-
mathematical: null,
|
|
2343
|
-
max: null,
|
|
2344
|
-
media: null,
|
|
2345
|
-
mediaCharacterEncoding: null,
|
|
2346
|
-
mediaContentEncodings: null,
|
|
2347
|
-
mediaSize: number,
|
|
2348
|
-
mediaTime: null,
|
|
2349
|
-
method: null,
|
|
2350
|
-
min: null,
|
|
2351
|
-
mode: null,
|
|
2352
|
-
name: null,
|
|
2353
|
-
navDown: null,
|
|
2354
|
-
navDownLeft: null,
|
|
2355
|
-
navDownRight: null,
|
|
2356
|
-
navLeft: null,
|
|
2357
|
-
navNext: null,
|
|
2358
|
-
navPrev: null,
|
|
2359
|
-
navRight: null,
|
|
2360
|
-
navUp: null,
|
|
2361
|
-
navUpLeft: null,
|
|
2362
|
-
navUpRight: null,
|
|
2363
|
-
numOctaves: null,
|
|
2364
|
-
observer: null,
|
|
2365
|
-
offset: null,
|
|
2366
|
-
onAbort: null,
|
|
2367
|
-
onActivate: null,
|
|
2368
|
-
onAfterPrint: null,
|
|
2369
|
-
onBeforePrint: null,
|
|
2370
|
-
onBegin: null,
|
|
2371
|
-
onCancel: null,
|
|
2372
|
-
onCanPlay: null,
|
|
2373
|
-
onCanPlayThrough: null,
|
|
2374
|
-
onChange: null,
|
|
2375
|
-
onClick: null,
|
|
2376
|
-
onClose: null,
|
|
2377
|
-
onCopy: null,
|
|
2378
|
-
onCueChange: null,
|
|
2379
|
-
onCut: null,
|
|
2380
|
-
onDblClick: null,
|
|
2381
|
-
onDrag: null,
|
|
2382
|
-
onDragEnd: null,
|
|
2383
|
-
onDragEnter: null,
|
|
2384
|
-
onDragExit: null,
|
|
2385
|
-
onDragLeave: null,
|
|
2386
|
-
onDragOver: null,
|
|
2387
|
-
onDragStart: null,
|
|
2388
|
-
onDrop: null,
|
|
2389
|
-
onDurationChange: null,
|
|
2390
|
-
onEmptied: null,
|
|
2391
|
-
onEnd: null,
|
|
2392
|
-
onEnded: null,
|
|
2393
|
-
onError: null,
|
|
2394
|
-
onFocus: null,
|
|
2395
|
-
onFocusIn: null,
|
|
2396
|
-
onFocusOut: null,
|
|
2397
|
-
onHashChange: null,
|
|
2398
|
-
onInput: null,
|
|
2399
|
-
onInvalid: null,
|
|
2400
|
-
onKeyDown: null,
|
|
2401
|
-
onKeyPress: null,
|
|
2402
|
-
onKeyUp: null,
|
|
2403
|
-
onLoad: null,
|
|
2404
|
-
onLoadedData: null,
|
|
2405
|
-
onLoadedMetadata: null,
|
|
2406
|
-
onLoadStart: null,
|
|
2407
|
-
onMessage: null,
|
|
2408
|
-
onMouseDown: null,
|
|
2409
|
-
onMouseEnter: null,
|
|
2410
|
-
onMouseLeave: null,
|
|
2411
|
-
onMouseMove: null,
|
|
2412
|
-
onMouseOut: null,
|
|
2413
|
-
onMouseOver: null,
|
|
2414
|
-
onMouseUp: null,
|
|
2415
|
-
onMouseWheel: null,
|
|
2416
|
-
onOffline: null,
|
|
2417
|
-
onOnline: null,
|
|
2418
|
-
onPageHide: null,
|
|
2419
|
-
onPageShow: null,
|
|
2420
|
-
onPaste: null,
|
|
2421
|
-
onPause: null,
|
|
2422
|
-
onPlay: null,
|
|
2423
|
-
onPlaying: null,
|
|
2424
|
-
onPopState: null,
|
|
2425
|
-
onProgress: null,
|
|
2426
|
-
onRateChange: null,
|
|
2427
|
-
onRepeat: null,
|
|
2428
|
-
onReset: null,
|
|
2429
|
-
onResize: null,
|
|
2430
|
-
onScroll: null,
|
|
2431
|
-
onSeeked: null,
|
|
2432
|
-
onSeeking: null,
|
|
2433
|
-
onSelect: null,
|
|
2434
|
-
onShow: null,
|
|
2435
|
-
onStalled: null,
|
|
2436
|
-
onStorage: null,
|
|
2437
|
-
onSubmit: null,
|
|
2438
|
-
onSuspend: null,
|
|
2439
|
-
onTimeUpdate: null,
|
|
2440
|
-
onToggle: null,
|
|
2441
|
-
onUnload: null,
|
|
2442
|
-
onVolumeChange: null,
|
|
2443
|
-
onWaiting: null,
|
|
2444
|
-
onZoom: null,
|
|
2445
|
-
opacity: null,
|
|
2446
|
-
operator: null,
|
|
2447
|
-
order: null,
|
|
2448
|
-
orient: null,
|
|
2449
|
-
orientation: null,
|
|
2450
|
-
origin: null,
|
|
2451
|
-
overflow: null,
|
|
2452
|
-
overlay: null,
|
|
2453
|
-
overlinePosition: number,
|
|
2454
|
-
overlineThickness: number,
|
|
2455
|
-
paintOrder: null,
|
|
2456
|
-
panose1: null,
|
|
2457
|
-
path: null,
|
|
2458
|
-
pathLength: number,
|
|
2459
|
-
patternContentUnits: null,
|
|
2460
|
-
patternTransform: null,
|
|
2461
|
-
patternUnits: null,
|
|
2462
|
-
phase: null,
|
|
2463
|
-
ping: spaceSeparated,
|
|
2464
|
-
pitch: null,
|
|
2465
|
-
playbackOrder: null,
|
|
2466
|
-
pointerEvents: null,
|
|
2467
|
-
points: null,
|
|
2468
|
-
pointsAtX: number,
|
|
2469
|
-
pointsAtY: number,
|
|
2470
|
-
pointsAtZ: number,
|
|
2471
|
-
preserveAlpha: null,
|
|
2472
|
-
preserveAspectRatio: null,
|
|
2473
|
-
primitiveUnits: null,
|
|
2474
|
-
propagate: null,
|
|
2475
|
-
property: commaOrSpaceSeparated,
|
|
2476
|
-
r: null,
|
|
2477
|
-
radius: null,
|
|
2478
|
-
referrerPolicy: null,
|
|
2479
|
-
refX: null,
|
|
2480
|
-
refY: null,
|
|
2481
|
-
rel: commaOrSpaceSeparated,
|
|
2482
|
-
rev: commaOrSpaceSeparated,
|
|
2483
|
-
renderingIntent: null,
|
|
2484
|
-
repeatCount: null,
|
|
2485
|
-
repeatDur: null,
|
|
2486
|
-
requiredExtensions: commaOrSpaceSeparated,
|
|
2487
|
-
requiredFeatures: commaOrSpaceSeparated,
|
|
2488
|
-
requiredFonts: commaOrSpaceSeparated,
|
|
2489
|
-
requiredFormats: commaOrSpaceSeparated,
|
|
2490
|
-
resource: null,
|
|
2491
|
-
restart: null,
|
|
2492
|
-
result: null,
|
|
2493
|
-
rotate: null,
|
|
2494
|
-
rx: null,
|
|
2495
|
-
ry: null,
|
|
2496
|
-
scale: null,
|
|
2497
|
-
seed: null,
|
|
2498
|
-
shapeRendering: null,
|
|
2499
|
-
side: null,
|
|
2500
|
-
slope: null,
|
|
2501
|
-
snapshotTime: null,
|
|
2502
|
-
specularConstant: number,
|
|
2503
|
-
specularExponent: number,
|
|
2504
|
-
spreadMethod: null,
|
|
2505
|
-
spacing: null,
|
|
2506
|
-
startOffset: null,
|
|
2507
|
-
stdDeviation: null,
|
|
2508
|
-
stemh: null,
|
|
2509
|
-
stemv: null,
|
|
2510
|
-
stitchTiles: null,
|
|
2511
|
-
stopColor: null,
|
|
2512
|
-
stopOpacity: null,
|
|
2513
|
-
strikethroughPosition: number,
|
|
2514
|
-
strikethroughThickness: number,
|
|
2515
|
-
string: null,
|
|
2516
|
-
stroke: null,
|
|
2517
|
-
strokeDashArray: commaOrSpaceSeparated,
|
|
2518
|
-
strokeDashOffset: null,
|
|
2519
|
-
strokeLineCap: null,
|
|
2520
|
-
strokeLineJoin: null,
|
|
2521
|
-
strokeMiterLimit: number,
|
|
2522
|
-
strokeOpacity: number,
|
|
2523
|
-
strokeWidth: null,
|
|
2524
|
-
style: null,
|
|
2525
|
-
surfaceScale: number,
|
|
2526
|
-
syncBehavior: null,
|
|
2527
|
-
syncBehaviorDefault: null,
|
|
2528
|
-
syncMaster: null,
|
|
2529
|
-
syncTolerance: null,
|
|
2530
|
-
syncToleranceDefault: null,
|
|
2531
|
-
systemLanguage: commaOrSpaceSeparated,
|
|
2532
|
-
tabIndex: number,
|
|
2533
|
-
tableValues: null,
|
|
2534
|
-
target: null,
|
|
2535
|
-
targetX: number,
|
|
2536
|
-
targetY: number,
|
|
2537
|
-
textAnchor: null,
|
|
2538
|
-
textDecoration: null,
|
|
2539
|
-
textRendering: null,
|
|
2540
|
-
textLength: null,
|
|
2541
|
-
timelineBegin: null,
|
|
2542
|
-
title: null,
|
|
2543
|
-
transformBehavior: null,
|
|
2544
|
-
type: null,
|
|
2545
|
-
typeOf: commaOrSpaceSeparated,
|
|
2546
|
-
to: null,
|
|
2547
|
-
transform: null,
|
|
2548
|
-
transformOrigin: null,
|
|
2549
|
-
u1: null,
|
|
2550
|
-
u2: null,
|
|
2551
|
-
underlinePosition: number,
|
|
2552
|
-
underlineThickness: number,
|
|
2553
|
-
unicode: null,
|
|
2554
|
-
unicodeBidi: null,
|
|
2555
|
-
unicodeRange: null,
|
|
2556
|
-
unitsPerEm: number,
|
|
2557
|
-
values: null,
|
|
2558
|
-
vAlphabetic: number,
|
|
2559
|
-
vMathematical: number,
|
|
2560
|
-
vectorEffect: null,
|
|
2561
|
-
vHanging: number,
|
|
2562
|
-
vIdeographic: number,
|
|
2563
|
-
version: null,
|
|
2564
|
-
vertAdvY: number,
|
|
2565
|
-
vertOriginX: number,
|
|
2566
|
-
vertOriginY: number,
|
|
2567
|
-
viewBox: null,
|
|
2568
|
-
viewTarget: null,
|
|
2569
|
-
visibility: null,
|
|
2570
|
-
width: null,
|
|
2571
|
-
widths: null,
|
|
2572
|
-
wordSpacing: null,
|
|
2573
|
-
writingMode: null,
|
|
2574
|
-
x: null,
|
|
2575
|
-
x1: null,
|
|
2576
|
-
x2: null,
|
|
2577
|
-
xChannelSelector: null,
|
|
2578
|
-
xHeight: number,
|
|
2579
|
-
y: null,
|
|
2580
|
-
y1: null,
|
|
2581
|
-
y2: null,
|
|
2582
|
-
yChannelSelector: null,
|
|
2583
|
-
z: null,
|
|
2584
|
-
zoomAndPan: null
|
|
2585
|
-
},
|
|
2586
|
-
space: "svg",
|
|
2587
|
-
transform: caseSensitiveTransform
|
|
2588
|
-
}), xlink = create({
|
|
2589
|
-
properties: {
|
|
2590
|
-
xLinkActuate: null,
|
|
2591
|
-
xLinkArcRole: null,
|
|
2592
|
-
xLinkHref: null,
|
|
2593
|
-
xLinkRole: null,
|
|
2594
|
-
xLinkShow: null,
|
|
2595
|
-
xLinkTitle: null,
|
|
2596
|
-
xLinkType: null
|
|
2597
|
-
},
|
|
2598
|
-
space: "xlink",
|
|
2599
|
-
transform(s, I) {
|
|
2600
|
-
return "xlink:" + I.slice(5).toLowerCase();
|
|
2601
|
-
}
|
|
2602
|
-
}), xmlns = create({
|
|
2603
|
-
attributes: { xmlnsxlink: "xmlns:xlink" },
|
|
2604
|
-
properties: {
|
|
2605
|
-
xmlnsXLink: null,
|
|
2606
|
-
xmlns: null
|
|
2607
|
-
},
|
|
2608
|
-
space: "xmlns",
|
|
2609
|
-
transform: caseInsensitiveTransform
|
|
2610
|
-
}), xml = create({
|
|
2611
|
-
properties: {
|
|
2612
|
-
xmlBase: null,
|
|
2613
|
-
xmlLang: null,
|
|
2614
|
-
xmlSpace: null
|
|
2615
|
-
},
|
|
2616
|
-
space: "xml",
|
|
2617
|
-
transform(s, I) {
|
|
2618
|
-
return "xml:" + I.slice(3).toLowerCase();
|
|
2619
|
-
}
|
|
2620
|
-
});
|
|
2621
|
-
var cap = /[A-Z]/g, dash = /-[a-z]/g, valid = /^data[-\w.:]+$/i;
|
|
2622
|
-
function find(s, I) {
|
|
2623
|
-
let L = normalize(I), R = I, z = Info;
|
|
2624
|
-
if (L in s.normal) return s.property[s.normal[L]];
|
|
2625
|
-
if (L.length > 4 && L.slice(0, 4) === "data" && valid.test(I)) {
|
|
2626
|
-
if (I.charAt(4) === "-") {
|
|
2627
|
-
let s = I.slice(5).replace(dash, camelcase);
|
|
2628
|
-
R = "data" + s.charAt(0).toUpperCase() + s.slice(1);
|
|
2629
|
-
} else {
|
|
2630
|
-
let s = I.slice(4);
|
|
2631
|
-
if (!dash.test(s)) {
|
|
2632
|
-
let L = s.replace(cap, kebab);
|
|
2633
|
-
L.charAt(0) !== "-" && (L = "-" + L), I = "data" + L;
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
z = DefinedInfo;
|
|
2637
|
-
}
|
|
2638
|
-
return new z(R, I);
|
|
2639
|
-
}
|
|
2640
|
-
function kebab(s) {
|
|
2641
|
-
return "-" + s.toLowerCase();
|
|
2642
|
-
}
|
|
2643
|
-
function camelcase(s) {
|
|
2644
|
-
return s.charAt(1).toUpperCase();
|
|
2645
|
-
}
|
|
2646
|
-
const html$2 = merge([
|
|
2647
|
-
aria,
|
|
2648
|
-
html$3,
|
|
2649
|
-
xlink,
|
|
2650
|
-
xmlns,
|
|
2651
|
-
xml
|
|
2652
|
-
], "html"), svg = merge([
|
|
2653
|
-
aria,
|
|
2654
|
-
svg$1,
|
|
2655
|
-
xlink,
|
|
2656
|
-
xmlns,
|
|
2657
|
-
xml
|
|
2658
|
-
], "svg");
|
|
2659
|
-
var own$2 = {}.hasOwnProperty;
|
|
2660
|
-
function zwitch(s, I) {
|
|
2661
|
-
let L = I || {};
|
|
2662
|
-
function R(I, ...L) {
|
|
2663
|
-
let z = R.invalid, B = R.handlers;
|
|
2664
|
-
if (I && own$2.call(I, s)) {
|
|
2665
|
-
let L = String(I[s]);
|
|
2666
|
-
z = own$2.call(B, L) ? B[L] : R.unknown;
|
|
2667
|
-
}
|
|
2668
|
-
if (z) return z.call(this, I, ...L);
|
|
2669
|
-
}
|
|
2670
|
-
return R.handlers = L.handlers || {}, R.invalid = L.invalid, R.unknown = L.unknown, R;
|
|
2671
|
-
}
|
|
2672
|
-
var defaultSubsetRegex = /["&'<>`]/g, surrogatePairsRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, controlCharactersRegex = /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g, regexEscapeRegex = /[|\\{}()[\]^$+*?.]/g, subsetToRegexCache = /* @__PURE__ */ new WeakMap();
|
|
2673
|
-
function core(s, I) {
|
|
2674
|
-
if (s = s.replace(I.subset ? charactersToExpressionCached(I.subset) : defaultSubsetRegex, R), I.subset || I.escapeOnly) return s;
|
|
2675
|
-
return s.replace(surrogatePairsRegex, L).replace(controlCharactersRegex, R);
|
|
2676
|
-
function L(s, L, R) {
|
|
2677
|
-
return I.format((s.charCodeAt(0) - 55296) * 1024 + s.charCodeAt(1) - 56320 + 65536, R.charCodeAt(L + 2), I);
|
|
2678
|
-
}
|
|
2679
|
-
function R(s, L, R) {
|
|
2680
|
-
return I.format(s.charCodeAt(0), R.charCodeAt(L + 1), I);
|
|
2681
|
-
}
|
|
2682
|
-
}
|
|
2683
|
-
function charactersToExpressionCached(s) {
|
|
2684
|
-
let I = subsetToRegexCache.get(s);
|
|
2685
|
-
return I || (I = charactersToExpression(s), subsetToRegexCache.set(s, I)), I;
|
|
2686
|
-
}
|
|
2687
|
-
function charactersToExpression(s) {
|
|
2688
|
-
let I = [], L = -1;
|
|
2689
|
-
for (; ++L < s.length;) I.push(s[L].replace(regexEscapeRegex, "\\$&"));
|
|
2690
|
-
return RegExp("(?:" + I.join("|") + ")", "g");
|
|
2691
|
-
}
|
|
2692
|
-
var hexadecimalRegex = /[\dA-Fa-f]/;
|
|
2693
|
-
function toHexadecimal(s, I, L) {
|
|
2694
|
-
let R = "&#x" + s.toString(16).toUpperCase();
|
|
2695
|
-
return L && I && !hexadecimalRegex.test(String.fromCharCode(I)) ? R : R + ";";
|
|
2696
|
-
}
|
|
2697
|
-
var decimalRegex = /\d/;
|
|
2698
|
-
function toDecimal(s, I, L) {
|
|
2699
|
-
let R = "&#" + String(s);
|
|
2700
|
-
return L && I && !decimalRegex.test(String.fromCharCode(I)) ? R : R + ";";
|
|
2701
|
-
}
|
|
2702
|
-
const characterEntitiesLegacy = /* @__PURE__ */ "AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml".split("."), characterEntitiesHtml4 = {
|
|
2703
|
-
nbsp: "\xA0",
|
|
2704
|
-
iexcl: "¡",
|
|
2705
|
-
cent: "¢",
|
|
2706
|
-
pound: "£",
|
|
2707
|
-
curren: "¤",
|
|
2708
|
-
yen: "¥",
|
|
2709
|
-
brvbar: "¦",
|
|
2710
|
-
sect: "§",
|
|
2711
|
-
uml: "¨",
|
|
2712
|
-
copy: "©",
|
|
2713
|
-
ordf: "ª",
|
|
2714
|
-
laquo: "«",
|
|
2715
|
-
not: "¬",
|
|
2716
|
-
shy: "",
|
|
2717
|
-
reg: "®",
|
|
2718
|
-
macr: "¯",
|
|
2719
|
-
deg: "°",
|
|
2720
|
-
plusmn: "±",
|
|
2721
|
-
sup2: "²",
|
|
2722
|
-
sup3: "³",
|
|
2723
|
-
acute: "´",
|
|
2724
|
-
micro: "µ",
|
|
2725
|
-
para: "¶",
|
|
2726
|
-
middot: "·",
|
|
2727
|
-
cedil: "¸",
|
|
2728
|
-
sup1: "¹",
|
|
2729
|
-
ordm: "º",
|
|
2730
|
-
raquo: "»",
|
|
2731
|
-
frac14: "¼",
|
|
2732
|
-
frac12: "½",
|
|
2733
|
-
frac34: "¾",
|
|
2734
|
-
iquest: "¿",
|
|
2735
|
-
Agrave: "À",
|
|
2736
|
-
Aacute: "Á",
|
|
2737
|
-
Acirc: "Â",
|
|
2738
|
-
Atilde: "Ã",
|
|
2739
|
-
Auml: "Ä",
|
|
2740
|
-
Aring: "Å",
|
|
2741
|
-
AElig: "Æ",
|
|
2742
|
-
Ccedil: "Ç",
|
|
2743
|
-
Egrave: "È",
|
|
2744
|
-
Eacute: "É",
|
|
2745
|
-
Ecirc: "Ê",
|
|
2746
|
-
Euml: "Ë",
|
|
2747
|
-
Igrave: "Ì",
|
|
2748
|
-
Iacute: "Í",
|
|
2749
|
-
Icirc: "Î",
|
|
2750
|
-
Iuml: "Ï",
|
|
2751
|
-
ETH: "Ð",
|
|
2752
|
-
Ntilde: "Ñ",
|
|
2753
|
-
Ograve: "Ò",
|
|
2754
|
-
Oacute: "Ó",
|
|
2755
|
-
Ocirc: "Ô",
|
|
2756
|
-
Otilde: "Õ",
|
|
2757
|
-
Ouml: "Ö",
|
|
2758
|
-
times: "×",
|
|
2759
|
-
Oslash: "Ø",
|
|
2760
|
-
Ugrave: "Ù",
|
|
2761
|
-
Uacute: "Ú",
|
|
2762
|
-
Ucirc: "Û",
|
|
2763
|
-
Uuml: "Ü",
|
|
2764
|
-
Yacute: "Ý",
|
|
2765
|
-
THORN: "Þ",
|
|
2766
|
-
szlig: "ß",
|
|
2767
|
-
agrave: "à",
|
|
2768
|
-
aacute: "á",
|
|
2769
|
-
acirc: "â",
|
|
2770
|
-
atilde: "ã",
|
|
2771
|
-
auml: "ä",
|
|
2772
|
-
aring: "å",
|
|
2773
|
-
aelig: "æ",
|
|
2774
|
-
ccedil: "ç",
|
|
2775
|
-
egrave: "è",
|
|
2776
|
-
eacute: "é",
|
|
2777
|
-
ecirc: "ê",
|
|
2778
|
-
euml: "ë",
|
|
2779
|
-
igrave: "ì",
|
|
2780
|
-
iacute: "í",
|
|
2781
|
-
icirc: "î",
|
|
2782
|
-
iuml: "ï",
|
|
2783
|
-
eth: "ð",
|
|
2784
|
-
ntilde: "ñ",
|
|
2785
|
-
ograve: "ò",
|
|
2786
|
-
oacute: "ó",
|
|
2787
|
-
ocirc: "ô",
|
|
2788
|
-
otilde: "õ",
|
|
2789
|
-
ouml: "ö",
|
|
2790
|
-
divide: "÷",
|
|
2791
|
-
oslash: "ø",
|
|
2792
|
-
ugrave: "ù",
|
|
2793
|
-
uacute: "ú",
|
|
2794
|
-
ucirc: "û",
|
|
2795
|
-
uuml: "ü",
|
|
2796
|
-
yacute: "ý",
|
|
2797
|
-
thorn: "þ",
|
|
2798
|
-
yuml: "ÿ",
|
|
2799
|
-
fnof: "ƒ",
|
|
2800
|
-
Alpha: "Α",
|
|
2801
|
-
Beta: "Β",
|
|
2802
|
-
Gamma: "Γ",
|
|
2803
|
-
Delta: "Δ",
|
|
2804
|
-
Epsilon: "Ε",
|
|
2805
|
-
Zeta: "Ζ",
|
|
2806
|
-
Eta: "Η",
|
|
2807
|
-
Theta: "Θ",
|
|
2808
|
-
Iota: "Ι",
|
|
2809
|
-
Kappa: "Κ",
|
|
2810
|
-
Lambda: "Λ",
|
|
2811
|
-
Mu: "Μ",
|
|
2812
|
-
Nu: "Ν",
|
|
2813
|
-
Xi: "Ξ",
|
|
2814
|
-
Omicron: "Ο",
|
|
2815
|
-
Pi: "Π",
|
|
2816
|
-
Rho: "Ρ",
|
|
2817
|
-
Sigma: "Σ",
|
|
2818
|
-
Tau: "Τ",
|
|
2819
|
-
Upsilon: "Υ",
|
|
2820
|
-
Phi: "Φ",
|
|
2821
|
-
Chi: "Χ",
|
|
2822
|
-
Psi: "Ψ",
|
|
2823
|
-
Omega: "Ω",
|
|
2824
|
-
alpha: "α",
|
|
2825
|
-
beta: "β",
|
|
2826
|
-
gamma: "γ",
|
|
2827
|
-
delta: "δ",
|
|
2828
|
-
epsilon: "ε",
|
|
2829
|
-
zeta: "ζ",
|
|
2830
|
-
eta: "η",
|
|
2831
|
-
theta: "θ",
|
|
2832
|
-
iota: "ι",
|
|
2833
|
-
kappa: "κ",
|
|
2834
|
-
lambda: "λ",
|
|
2835
|
-
mu: "μ",
|
|
2836
|
-
nu: "ν",
|
|
2837
|
-
xi: "ξ",
|
|
2838
|
-
omicron: "ο",
|
|
2839
|
-
pi: "π",
|
|
2840
|
-
rho: "ρ",
|
|
2841
|
-
sigmaf: "ς",
|
|
2842
|
-
sigma: "σ",
|
|
2843
|
-
tau: "τ",
|
|
2844
|
-
upsilon: "υ",
|
|
2845
|
-
phi: "φ",
|
|
2846
|
-
chi: "χ",
|
|
2847
|
-
psi: "ψ",
|
|
2848
|
-
omega: "ω",
|
|
2849
|
-
thetasym: "ϑ",
|
|
2850
|
-
upsih: "ϒ",
|
|
2851
|
-
piv: "ϖ",
|
|
2852
|
-
bull: "•",
|
|
2853
|
-
hellip: "…",
|
|
2854
|
-
prime: "′",
|
|
2855
|
-
Prime: "″",
|
|
2856
|
-
oline: "‾",
|
|
2857
|
-
frasl: "⁄",
|
|
2858
|
-
weierp: "℘",
|
|
2859
|
-
image: "ℑ",
|
|
2860
|
-
real: "ℜ",
|
|
2861
|
-
trade: "™",
|
|
2862
|
-
alefsym: "ℵ",
|
|
2863
|
-
larr: "←",
|
|
2864
|
-
uarr: "↑",
|
|
2865
|
-
rarr: "→",
|
|
2866
|
-
darr: "↓",
|
|
2867
|
-
harr: "↔",
|
|
2868
|
-
crarr: "↵",
|
|
2869
|
-
lArr: "⇐",
|
|
2870
|
-
uArr: "⇑",
|
|
2871
|
-
rArr: "⇒",
|
|
2872
|
-
dArr: "⇓",
|
|
2873
|
-
hArr: "⇔",
|
|
2874
|
-
forall: "∀",
|
|
2875
|
-
part: "∂",
|
|
2876
|
-
exist: "∃",
|
|
2877
|
-
empty: "∅",
|
|
2878
|
-
nabla: "∇",
|
|
2879
|
-
isin: "∈",
|
|
2880
|
-
notin: "∉",
|
|
2881
|
-
ni: "∋",
|
|
2882
|
-
prod: "∏",
|
|
2883
|
-
sum: "∑",
|
|
2884
|
-
minus: "−",
|
|
2885
|
-
lowast: "∗",
|
|
2886
|
-
radic: "√",
|
|
2887
|
-
prop: "∝",
|
|
2888
|
-
infin: "∞",
|
|
2889
|
-
ang: "∠",
|
|
2890
|
-
and: "∧",
|
|
2891
|
-
or: "∨",
|
|
2892
|
-
cap: "∩",
|
|
2893
|
-
cup: "∪",
|
|
2894
|
-
int: "∫",
|
|
2895
|
-
there4: "∴",
|
|
2896
|
-
sim: "∼",
|
|
2897
|
-
cong: "≅",
|
|
2898
|
-
asymp: "≈",
|
|
2899
|
-
ne: "≠",
|
|
2900
|
-
equiv: "≡",
|
|
2901
|
-
le: "≤",
|
|
2902
|
-
ge: "≥",
|
|
2903
|
-
sub: "⊂",
|
|
2904
|
-
sup: "⊃",
|
|
2905
|
-
nsub: "⊄",
|
|
2906
|
-
sube: "⊆",
|
|
2907
|
-
supe: "⊇",
|
|
2908
|
-
oplus: "⊕",
|
|
2909
|
-
otimes: "⊗",
|
|
2910
|
-
perp: "⊥",
|
|
2911
|
-
sdot: "⋅",
|
|
2912
|
-
lceil: "⌈",
|
|
2913
|
-
rceil: "⌉",
|
|
2914
|
-
lfloor: "⌊",
|
|
2915
|
-
rfloor: "⌋",
|
|
2916
|
-
lang: "〈",
|
|
2917
|
-
rang: "〉",
|
|
2918
|
-
loz: "◊",
|
|
2919
|
-
spades: "♠",
|
|
2920
|
-
clubs: "♣",
|
|
2921
|
-
hearts: "♥",
|
|
2922
|
-
diams: "♦",
|
|
2923
|
-
quot: "\"",
|
|
2924
|
-
amp: "&",
|
|
2925
|
-
lt: "<",
|
|
2926
|
-
gt: ">",
|
|
2927
|
-
OElig: "Œ",
|
|
2928
|
-
oelig: "œ",
|
|
2929
|
-
Scaron: "Š",
|
|
2930
|
-
scaron: "š",
|
|
2931
|
-
Yuml: "Ÿ",
|
|
2932
|
-
circ: "ˆ",
|
|
2933
|
-
tilde: "˜",
|
|
2934
|
-
ensp: " ",
|
|
2935
|
-
emsp: " ",
|
|
2936
|
-
thinsp: " ",
|
|
2937
|
-
zwnj: "",
|
|
2938
|
-
zwj: "",
|
|
2939
|
-
lrm: "",
|
|
2940
|
-
rlm: "",
|
|
2941
|
-
ndash: "–",
|
|
2942
|
-
mdash: "—",
|
|
2943
|
-
lsquo: "‘",
|
|
2944
|
-
rsquo: "’",
|
|
2945
|
-
sbquo: "‚",
|
|
2946
|
-
ldquo: "“",
|
|
2947
|
-
rdquo: "”",
|
|
2948
|
-
bdquo: "„",
|
|
2949
|
-
dagger: "†",
|
|
2950
|
-
Dagger: "‡",
|
|
2951
|
-
permil: "‰",
|
|
2952
|
-
lsaquo: "‹",
|
|
2953
|
-
rsaquo: "›",
|
|
2954
|
-
euro: "€"
|
|
2955
|
-
}, dangerous = [
|
|
2956
|
-
"cent",
|
|
2957
|
-
"copy",
|
|
2958
|
-
"divide",
|
|
2959
|
-
"gt",
|
|
2960
|
-
"lt",
|
|
2961
|
-
"not",
|
|
2962
|
-
"para",
|
|
2963
|
-
"times"
|
|
2964
|
-
];
|
|
2965
|
-
var own$1 = {}.hasOwnProperty, characters = {}, key;
|
|
2966
|
-
for (key in characterEntitiesHtml4) own$1.call(characterEntitiesHtml4, key) && (characters[characterEntitiesHtml4[key]] = key);
|
|
2967
|
-
var notAlphanumericRegex = /[^\dA-Za-z]/;
|
|
2968
|
-
function toNamed(s, I, L, R) {
|
|
2969
|
-
let z = String.fromCharCode(s);
|
|
2970
|
-
if (own$1.call(characters, z)) {
|
|
2971
|
-
let s = characters[z], B = "&" + s;
|
|
2972
|
-
return L && characterEntitiesLegacy.includes(s) && !dangerous.includes(s) && (!R || I && I !== 61 && notAlphanumericRegex.test(String.fromCharCode(I))) ? B : B + ";";
|
|
2973
|
-
}
|
|
2974
|
-
return "";
|
|
2975
|
-
}
|
|
2976
|
-
function formatSmart(s, I, L) {
|
|
2977
|
-
let R = toHexadecimal(s, I, L.omitOptionalSemicolons), z;
|
|
2978
|
-
if ((L.useNamedReferences || L.useShortestReferences) && (z = toNamed(s, I, L.omitOptionalSemicolons, L.attribute)), (L.useShortestReferences || !z) && L.useShortestReferences) {
|
|
2979
|
-
let z = toDecimal(s, I, L.omitOptionalSemicolons);
|
|
2980
|
-
z.length < R.length && (R = z);
|
|
2981
|
-
}
|
|
2982
|
-
return z && (!L.useShortestReferences || z.length < R.length) ? z : R;
|
|
2983
|
-
}
|
|
2984
|
-
function stringifyEntities(s, I) {
|
|
2985
|
-
return core(s, Object.assign({ format: formatSmart }, I));
|
|
2986
|
-
}
|
|
2987
|
-
var htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g, bogusCommentEntitySubset = [">"], commentEntitySubset = ["<", ">"];
|
|
2988
|
-
function comment(s, I, L, R) {
|
|
2989
|
-
return R.settings.bogusComments ? "<?" + stringifyEntities(s.value, Object.assign({}, R.settings.characterReferences, { subset: bogusCommentEntitySubset })) + ">" : "<!--" + s.value.replace(htmlCommentRegex, z) + "-->";
|
|
2990
|
-
function z(s) {
|
|
2991
|
-
return stringifyEntities(s, Object.assign({}, R.settings.characterReferences, { subset: commentEntitySubset }));
|
|
2992
|
-
}
|
|
2993
|
-
}
|
|
2994
|
-
function doctype(s, I, L, R) {
|
|
2995
|
-
return "<!" + (R.settings.upperDoctype ? "DOCTYPE" : "doctype") + (R.settings.tightDoctype ? "" : " ") + "html>";
|
|
2996
|
-
}
|
|
2997
|
-
function ccount(s, I) {
|
|
2998
|
-
let L = String(s);
|
|
2999
|
-
if (typeof I != "string") throw TypeError("Expected character");
|
|
3000
|
-
let R = 0, z = L.indexOf(I);
|
|
3001
|
-
for (; z !== -1;) R++, z = L.indexOf(I, z + I.length);
|
|
3002
|
-
return R;
|
|
3003
|
-
}
|
|
3004
|
-
function stringify$2(s, I) {
|
|
3005
|
-
let L = I || {};
|
|
3006
|
-
return (s[s.length - 1] === "" ? [...s, ""] : s).join((L.padRight ? " " : "") + "," + (L.padLeft === !1 ? "" : " ")).trim();
|
|
3007
|
-
}
|
|
3008
|
-
function stringify$1(s) {
|
|
3009
|
-
return s.join(" ").trim();
|
|
3010
|
-
}
|
|
3011
|
-
var re = /[ \t\n\f\r]/g;
|
|
3012
|
-
function whitespace(s) {
|
|
3013
|
-
return typeof s == "object" ? s.type === "text" ? empty(s.value) : !1 : empty(s);
|
|
3014
|
-
}
|
|
3015
|
-
function empty(s) {
|
|
3016
|
-
return s.replace(re, "") === "";
|
|
3017
|
-
}
|
|
3018
|
-
const siblingAfter = siblings(1), siblingBefore = siblings(-1);
|
|
3019
|
-
var emptyChildren$1 = [];
|
|
3020
|
-
function siblings(s) {
|
|
3021
|
-
return I;
|
|
3022
|
-
function I(I, L, R) {
|
|
3023
|
-
let z = I ? I.children : emptyChildren$1, B = (L || 0) + s, V = z[B];
|
|
3024
|
-
if (!R) for (; V && whitespace(V);) B += s, V = z[B];
|
|
3025
|
-
return V;
|
|
3026
|
-
}
|
|
3027
|
-
}
|
|
3028
|
-
var own = {}.hasOwnProperty;
|
|
3029
|
-
function omission(s) {
|
|
3030
|
-
return I;
|
|
3031
|
-
function I(I, L, R) {
|
|
3032
|
-
return own.call(s, I.tagName) && s[I.tagName](I, L, R);
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
const closing = omission({
|
|
3036
|
-
body: body$1,
|
|
3037
|
-
caption: headOrColgroupOrCaption,
|
|
3038
|
-
colgroup: headOrColgroupOrCaption,
|
|
3039
|
-
dd,
|
|
3040
|
-
dt,
|
|
3041
|
-
head: headOrColgroupOrCaption,
|
|
3042
|
-
html: html$1,
|
|
3043
|
-
li,
|
|
3044
|
-
optgroup,
|
|
3045
|
-
option,
|
|
3046
|
-
p,
|
|
3047
|
-
rp: rubyElement,
|
|
3048
|
-
rt: rubyElement,
|
|
3049
|
-
tbody: tbody$1,
|
|
3050
|
-
td: cells,
|
|
3051
|
-
tfoot,
|
|
3052
|
-
th: cells,
|
|
3053
|
-
thead,
|
|
3054
|
-
tr
|
|
3055
|
-
});
|
|
3056
|
-
function headOrColgroupOrCaption(s, I, L) {
|
|
3057
|
-
let R = siblingAfter(L, I, !0);
|
|
3058
|
-
return !R || R.type !== "comment" && !(R.type === "text" && whitespace(R.value.charAt(0)));
|
|
3059
|
-
}
|
|
3060
|
-
function html$1(s, I, L) {
|
|
3061
|
-
let R = siblingAfter(L, I);
|
|
3062
|
-
return !R || R.type !== "comment";
|
|
3063
|
-
}
|
|
3064
|
-
function body$1(s, I, L) {
|
|
3065
|
-
let R = siblingAfter(L, I);
|
|
3066
|
-
return !R || R.type !== "comment";
|
|
3067
|
-
}
|
|
3068
|
-
function p(s, I, L) {
|
|
3069
|
-
let R = siblingAfter(L, I);
|
|
3070
|
-
return R ? R.type === "element" && (R.tagName === "address" || R.tagName === "article" || R.tagName === "aside" || R.tagName === "blockquote" || R.tagName === "details" || R.tagName === "div" || R.tagName === "dl" || R.tagName === "fieldset" || R.tagName === "figcaption" || R.tagName === "figure" || R.tagName === "footer" || R.tagName === "form" || R.tagName === "h1" || R.tagName === "h2" || R.tagName === "h3" || R.tagName === "h4" || R.tagName === "h5" || R.tagName === "h6" || R.tagName === "header" || R.tagName === "hgroup" || R.tagName === "hr" || R.tagName === "main" || R.tagName === "menu" || R.tagName === "nav" || R.tagName === "ol" || R.tagName === "p" || R.tagName === "pre" || R.tagName === "section" || R.tagName === "table" || R.tagName === "ul") : !L || !(L.type === "element" && (L.tagName === "a" || L.tagName === "audio" || L.tagName === "del" || L.tagName === "ins" || L.tagName === "map" || L.tagName === "noscript" || L.tagName === "video"));
|
|
3071
|
-
}
|
|
3072
|
-
function li(s, I, L) {
|
|
3073
|
-
let R = siblingAfter(L, I);
|
|
3074
|
-
return !R || R.type === "element" && R.tagName === "li";
|
|
3075
|
-
}
|
|
3076
|
-
function dt(s, I, L) {
|
|
3077
|
-
let R = siblingAfter(L, I);
|
|
3078
|
-
return !!(R && R.type === "element" && (R.tagName === "dt" || R.tagName === "dd"));
|
|
3079
|
-
}
|
|
3080
|
-
function dd(s, I, L) {
|
|
3081
|
-
let R = siblingAfter(L, I);
|
|
3082
|
-
return !R || R.type === "element" && (R.tagName === "dt" || R.tagName === "dd");
|
|
3083
|
-
}
|
|
3084
|
-
function rubyElement(s, I, L) {
|
|
3085
|
-
let R = siblingAfter(L, I);
|
|
3086
|
-
return !R || R.type === "element" && (R.tagName === "rp" || R.tagName === "rt");
|
|
3087
|
-
}
|
|
3088
|
-
function optgroup(s, I, L) {
|
|
3089
|
-
let R = siblingAfter(L, I);
|
|
3090
|
-
return !R || R.type === "element" && R.tagName === "optgroup";
|
|
3091
|
-
}
|
|
3092
|
-
function option(s, I, L) {
|
|
3093
|
-
let R = siblingAfter(L, I);
|
|
3094
|
-
return !R || R.type === "element" && (R.tagName === "option" || R.tagName === "optgroup");
|
|
3095
|
-
}
|
|
3096
|
-
function thead(s, I, L) {
|
|
3097
|
-
let R = siblingAfter(L, I);
|
|
3098
|
-
return !!(R && R.type === "element" && (R.tagName === "tbody" || R.tagName === "tfoot"));
|
|
3099
|
-
}
|
|
3100
|
-
function tbody$1(s, I, L) {
|
|
3101
|
-
let R = siblingAfter(L, I);
|
|
3102
|
-
return !R || R.type === "element" && (R.tagName === "tbody" || R.tagName === "tfoot");
|
|
3103
|
-
}
|
|
3104
|
-
function tfoot(s, I, L) {
|
|
3105
|
-
return !siblingAfter(L, I);
|
|
3106
|
-
}
|
|
3107
|
-
function tr(s, I, L) {
|
|
3108
|
-
let R = siblingAfter(L, I);
|
|
3109
|
-
return !R || R.type === "element" && R.tagName === "tr";
|
|
3110
|
-
}
|
|
3111
|
-
function cells(s, I, L) {
|
|
3112
|
-
let R = siblingAfter(L, I);
|
|
3113
|
-
return !R || R.type === "element" && (R.tagName === "td" || R.tagName === "th");
|
|
3114
|
-
}
|
|
3115
|
-
const opening = omission({
|
|
3116
|
-
body,
|
|
3117
|
-
colgroup,
|
|
3118
|
-
head,
|
|
3119
|
-
html,
|
|
3120
|
-
tbody
|
|
3121
|
-
});
|
|
3122
|
-
function html(s) {
|
|
3123
|
-
let I = siblingAfter(s, -1);
|
|
3124
|
-
return !I || I.type !== "comment";
|
|
3125
|
-
}
|
|
3126
|
-
function head(s) {
|
|
3127
|
-
let I = /* @__PURE__ */ new Set();
|
|
3128
|
-
for (let L of s.children) if (L.type === "element" && (L.tagName === "base" || L.tagName === "title")) {
|
|
3129
|
-
if (I.has(L.tagName)) return !1;
|
|
3130
|
-
I.add(L.tagName);
|
|
3131
|
-
}
|
|
3132
|
-
let L = s.children[0];
|
|
3133
|
-
return !L || L.type === "element";
|
|
3134
|
-
}
|
|
3135
|
-
function body(s) {
|
|
3136
|
-
let I = siblingAfter(s, -1, !0);
|
|
3137
|
-
return !I || I.type !== "comment" && !(I.type === "text" && whitespace(I.value.charAt(0))) && !(I.type === "element" && (I.tagName === "meta" || I.tagName === "link" || I.tagName === "script" || I.tagName === "style" || I.tagName === "template"));
|
|
3138
|
-
}
|
|
3139
|
-
function colgroup(s, I, L) {
|
|
3140
|
-
let R = siblingBefore(L, I), z = siblingAfter(s, -1, !0);
|
|
3141
|
-
return L && R && R.type === "element" && R.tagName === "colgroup" && closing(R, L.children.indexOf(R), L) ? !1 : !!(z && z.type === "element" && z.tagName === "col");
|
|
3142
|
-
}
|
|
3143
|
-
function tbody(s, I, L) {
|
|
3144
|
-
let R = siblingBefore(L, I), z = siblingAfter(s, -1);
|
|
3145
|
-
return L && R && R.type === "element" && (R.tagName === "thead" || R.tagName === "tbody") && closing(R, L.children.indexOf(R), L) ? !1 : !!(z && z.type === "element" && z.tagName === "tr");
|
|
3146
|
-
}
|
|
3147
|
-
var constants = {
|
|
3148
|
-
name: [[" \n\f\r &/=>".split(""), " \n\f\r \"&'/=>`".split("")], ["\0 \n\f\r \"&'/<=>".split(""), "\0 \n\f\r \"&'/<=>`".split("")]],
|
|
3149
|
-
unquoted: [[" \n\f\r &>".split(""), "\0 \n\f\r \"&'<=>`".split("")], ["\0 \n\f\r \"&'<=>`".split(""), "\0 \n\f\r \"&'<=>`".split("")]],
|
|
3150
|
-
single: [["&'".split(""), "\"&'`".split("")], ["\0&'".split(""), "\0\"&'`".split("")]],
|
|
3151
|
-
double: [["\"&".split(""), "\"&'`".split("")], ["\0\"&".split(""), "\0\"&'`".split("")]]
|
|
3152
|
-
};
|
|
3153
|
-
function element(s, I, L, R) {
|
|
3154
|
-
let z = R.schema, B = z.space === "svg" ? !1 : R.settings.omitOptionalTags, V = z.space === "svg" ? R.settings.closeEmptyElements : R.settings.voids.includes(s.tagName.toLowerCase()), H = [], U;
|
|
3155
|
-
z.space === "html" && s.tagName === "svg" && (R.schema = svg);
|
|
3156
|
-
let W = serializeAttributes(R, s.properties), G = R.all(z.space === "html" && s.tagName === "template" ? s.content : s);
|
|
3157
|
-
return R.schema = z, G && (V = !1), (W || !B || !opening(s, I, L)) && (H.push("<", s.tagName, W ? " " + W : ""), V && (z.space === "svg" || R.settings.closeSelfClosing) && (U = W.charAt(W.length - 1), (!R.settings.tightSelfClosing || U === "/" || U && U !== "\"" && U !== "'") && H.push(" "), H.push("/")), H.push(">")), H.push(G), !V && (!B || !closing(s, I, L)) && H.push("</" + s.tagName + ">"), H.join("");
|
|
3158
|
-
}
|
|
3159
|
-
function serializeAttributes(s, I) {
|
|
3160
|
-
let L = [], R = -1, z;
|
|
3161
|
-
if (I) {
|
|
3162
|
-
for (z in I) if (I[z] !== null && I[z] !== void 0) {
|
|
3163
|
-
let R = serializeAttribute(s, z, I[z]);
|
|
3164
|
-
R && L.push(R);
|
|
3165
|
-
}
|
|
3166
|
-
}
|
|
3167
|
-
for (; ++R < L.length;) {
|
|
3168
|
-
let I = s.settings.tightAttributes ? L[R].charAt(L[R].length - 1) : void 0;
|
|
3169
|
-
R !== L.length - 1 && I !== "\"" && I !== "'" && (L[R] += " ");
|
|
3170
|
-
}
|
|
3171
|
-
return L.join("");
|
|
3172
|
-
}
|
|
3173
|
-
function serializeAttribute(s, I, L) {
|
|
3174
|
-
let R = find(s.schema, I), z = s.settings.allowParseErrors && s.schema.space === "html" ? 0 : 1, B = s.settings.allowDangerousCharacters ? 0 : 1, V = s.quote, H;
|
|
3175
|
-
if (R.overloadedBoolean && (L === R.attribute || L === "") ? L = !0 : (R.boolean || R.overloadedBoolean) && (typeof L != "string" || L === R.attribute || L === "") && (L = !!L), L == null || L === !1 || typeof L == "number" && Number.isNaN(L)) return "";
|
|
3176
|
-
let U = stringifyEntities(R.attribute, Object.assign({}, s.settings.characterReferences, { subset: constants.name[z][B] }));
|
|
3177
|
-
return L === !0 || (L = Array.isArray(L) ? (R.commaSeparated ? stringify$2 : stringify$1)(L, { padLeft: !s.settings.tightCommaSeparatedLists }) : String(L), s.settings.collapseEmptyAttributes && !L) ? U : (s.settings.preferUnquoted && (H = stringifyEntities(L, Object.assign({}, s.settings.characterReferences, {
|
|
3178
|
-
attribute: !0,
|
|
3179
|
-
subset: constants.unquoted[z][B]
|
|
3180
|
-
}))), H !== L && (s.settings.quoteSmart && ccount(L, V) > ccount(L, s.alternative) && (V = s.alternative), H = V + stringifyEntities(L, Object.assign({}, s.settings.characterReferences, {
|
|
3181
|
-
subset: (V === "'" ? constants.single : constants.double)[z][B],
|
|
3182
|
-
attribute: !0
|
|
3183
|
-
})) + V), U + (H && "=" + H));
|
|
3184
|
-
}
|
|
3185
|
-
var textEntitySubset = ["<", "&"];
|
|
3186
|
-
function text(s, I, L, R) {
|
|
3187
|
-
return L && L.type === "element" && (L.tagName === "script" || L.tagName === "style") ? s.value : stringifyEntities(s.value, Object.assign({}, R.settings.characterReferences, { subset: textEntitySubset }));
|
|
3188
|
-
}
|
|
3189
|
-
function raw(s, I, L, R) {
|
|
3190
|
-
return R.settings.allowDangerousHtml ? s.value : text(s, I, L, R);
|
|
3191
|
-
}
|
|
3192
|
-
function root(s, I, L, R) {
|
|
3193
|
-
return R.all(s);
|
|
3194
|
-
}
|
|
3195
|
-
const handle = zwitch("type", {
|
|
3196
|
-
invalid,
|
|
3197
|
-
unknown,
|
|
3198
|
-
handlers: {
|
|
3199
|
-
comment,
|
|
3200
|
-
doctype,
|
|
3201
|
-
element,
|
|
3202
|
-
raw,
|
|
3203
|
-
root,
|
|
3204
|
-
text
|
|
3205
|
-
}
|
|
3206
|
-
});
|
|
3207
|
-
function invalid(s) {
|
|
3208
|
-
throw Error("Expected node, not `" + s + "`");
|
|
3209
|
-
}
|
|
3210
|
-
function unknown(s) {
|
|
3211
|
-
let I = s;
|
|
3212
|
-
throw Error("Cannot compile unknown node `" + I.type + "`");
|
|
3213
|
-
}
|
|
3214
|
-
var emptyOptions = {}, emptyCharacterReferences = {}, emptyChildren = [];
|
|
3215
|
-
function toHtml(s, I) {
|
|
3216
|
-
let L = I || emptyOptions, R = L.quote || "\"", z = R === "\"" ? "'" : "\"";
|
|
3217
|
-
if (R !== "\"" && R !== "'") throw Error("Invalid quote `" + R + "`, expected `'` or `\"`");
|
|
3218
|
-
return {
|
|
3219
|
-
one,
|
|
3220
|
-
all,
|
|
3221
|
-
settings: {
|
|
3222
|
-
omitOptionalTags: L.omitOptionalTags || !1,
|
|
3223
|
-
allowParseErrors: L.allowParseErrors || !1,
|
|
3224
|
-
allowDangerousCharacters: L.allowDangerousCharacters || !1,
|
|
3225
|
-
quoteSmart: L.quoteSmart || !1,
|
|
3226
|
-
preferUnquoted: L.preferUnquoted || !1,
|
|
3227
|
-
tightAttributes: L.tightAttributes || !1,
|
|
3228
|
-
upperDoctype: L.upperDoctype || !1,
|
|
3229
|
-
tightDoctype: L.tightDoctype || !1,
|
|
3230
|
-
bogusComments: L.bogusComments || !1,
|
|
3231
|
-
tightCommaSeparatedLists: L.tightCommaSeparatedLists || !1,
|
|
3232
|
-
tightSelfClosing: L.tightSelfClosing || !1,
|
|
3233
|
-
collapseEmptyAttributes: L.collapseEmptyAttributes || !1,
|
|
3234
|
-
allowDangerousHtml: L.allowDangerousHtml || !1,
|
|
3235
|
-
voids: L.voids || htmlVoidElements,
|
|
3236
|
-
characterReferences: L.characterReferences || emptyCharacterReferences,
|
|
3237
|
-
closeSelfClosing: L.closeSelfClosing || !1,
|
|
3238
|
-
closeEmptyElements: L.closeEmptyElements || !1
|
|
3239
|
-
},
|
|
3240
|
-
schema: L.space === "svg" ? svg : html$2,
|
|
3241
|
-
quote: R,
|
|
3242
|
-
alternative: z
|
|
3243
|
-
}.one(Array.isArray(s) ? {
|
|
3244
|
-
type: "root",
|
|
3245
|
-
children: s
|
|
3246
|
-
} : s, void 0, void 0);
|
|
3247
|
-
}
|
|
3248
|
-
function one(s, I, L) {
|
|
3249
|
-
return handle(s, I, L, this);
|
|
3250
|
-
}
|
|
3251
|
-
function all(s) {
|
|
3252
|
-
let I = [], L = s && s.children || emptyChildren, R = -1;
|
|
3253
|
-
for (; ++R < L.length;) I[R] = this.one(L[R], R, s);
|
|
3254
|
-
return I.join("");
|
|
3255
|
-
}
|
|
3256
|
-
function resolveColorReplacements(s, I) {
|
|
3257
|
-
let L = typeof s == "string" ? {} : { ...s.colorReplacements }, R = typeof s == "string" ? s : s.name;
|
|
3258
|
-
for (let [s, z] of Object.entries(I?.colorReplacements || {})) typeof z == "string" ? L[s] = z : s === R && Object.assign(L, z);
|
|
3259
|
-
return L;
|
|
3260
|
-
}
|
|
3261
|
-
function applyColorReplacements(s, I) {
|
|
3262
|
-
return s && (I?.[s?.toLowerCase()] || s);
|
|
3263
|
-
}
|
|
3264
|
-
function toArray(s) {
|
|
3265
|
-
return Array.isArray(s) ? s : [s];
|
|
3266
|
-
}
|
|
3267
|
-
async function normalizeGetter(s) {
|
|
3268
|
-
return Promise.resolve(typeof s == "function" ? s() : s).then((s) => s.default || s);
|
|
3269
|
-
}
|
|
3270
|
-
function isPlainLang(s) {
|
|
3271
|
-
return !s || [
|
|
3272
|
-
"plaintext",
|
|
3273
|
-
"txt",
|
|
3274
|
-
"text",
|
|
3275
|
-
"plain"
|
|
3276
|
-
].includes(s);
|
|
3277
|
-
}
|
|
3278
|
-
function isSpecialLang(s) {
|
|
3279
|
-
return s === "ansi" || isPlainLang(s);
|
|
3280
|
-
}
|
|
3281
|
-
function isNoneTheme(s) {
|
|
3282
|
-
return s === "none";
|
|
3283
|
-
}
|
|
3284
|
-
function isSpecialTheme(s) {
|
|
3285
|
-
return isNoneTheme(s);
|
|
3286
|
-
}
|
|
3287
|
-
function addClassToHast(s, I) {
|
|
3288
|
-
if (!I) return s;
|
|
3289
|
-
s.properties ||= {}, s.properties.class ||= [], typeof s.properties.class == "string" && (s.properties.class = s.properties.class.split(/\s+/g)), Array.isArray(s.properties.class) || (s.properties.class = []);
|
|
3290
|
-
let L = Array.isArray(I) ? I : I.split(/\s+/g);
|
|
3291
|
-
for (let I of L) I && !s.properties.class.includes(I) && s.properties.class.push(I);
|
|
3292
|
-
return s;
|
|
3293
|
-
}
|
|
3294
|
-
function splitLines(s, I = !1) {
|
|
3295
|
-
if (s.length === 0) return [["", 0]];
|
|
3296
|
-
let L = s.split(/(\r?\n)/g), R = 0, z = [];
|
|
3297
|
-
for (let s = 0; s < L.length; s += 2) {
|
|
3298
|
-
let B = I ? L[s] + (L[s + 1] || "") : L[s];
|
|
3299
|
-
z.push([B, R]), R += L[s].length, R += L[s + 1]?.length || 0;
|
|
3300
|
-
}
|
|
3301
|
-
return z;
|
|
3302
|
-
}
|
|
3303
|
-
function createPositionConverter(s) {
|
|
3304
|
-
let I = splitLines(s, !0).map(([s]) => s);
|
|
3305
|
-
function L(L) {
|
|
3306
|
-
if (L === s.length) return {
|
|
3307
|
-
line: I.length - 1,
|
|
3308
|
-
character: I[I.length - 1].length
|
|
3309
|
-
};
|
|
3310
|
-
let R = L, z = 0;
|
|
3311
|
-
for (let s of I) {
|
|
3312
|
-
if (R < s.length) break;
|
|
3313
|
-
R -= s.length, z++;
|
|
3314
|
-
}
|
|
3315
|
-
return {
|
|
3316
|
-
line: z,
|
|
3317
|
-
character: R
|
|
3318
|
-
};
|
|
3319
|
-
}
|
|
3320
|
-
function R(s, L) {
|
|
3321
|
-
let R = 0;
|
|
3322
|
-
for (let L = 0; L < s; L++) R += I[L].length;
|
|
3323
|
-
return R += L, R;
|
|
3324
|
-
}
|
|
3325
|
-
return {
|
|
3326
|
-
lines: I,
|
|
3327
|
-
indexToPos: L,
|
|
3328
|
-
posToIndex: R
|
|
3329
|
-
};
|
|
3330
|
-
}
|
|
3331
|
-
function guessEmbeddedLanguages(s, I, L) {
|
|
3332
|
-
let R = /* @__PURE__ */ new Set();
|
|
3333
|
-
for (let I of s.matchAll(/:?lang=["']([^"']+)["']/g)) {
|
|
3334
|
-
let s = I[1].toLowerCase().trim();
|
|
3335
|
-
s && R.add(s);
|
|
3336
|
-
}
|
|
3337
|
-
for (let I of s.matchAll(/(?:```|~~~)([\w-]+)/g)) {
|
|
3338
|
-
let s = I[1].toLowerCase().trim();
|
|
3339
|
-
s && R.add(s);
|
|
3340
|
-
}
|
|
3341
|
-
for (let I of s.matchAll(/\\begin\{([\w-]+)\}/g)) {
|
|
3342
|
-
let s = I[1].toLowerCase().trim();
|
|
3343
|
-
s && R.add(s);
|
|
3344
|
-
}
|
|
3345
|
-
for (let I of s.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)) {
|
|
3346
|
-
let s = I[1].toLowerCase().trim(), L = s.includes("/") ? s.split("/").pop() : s;
|
|
3347
|
-
L && R.add(L);
|
|
3348
|
-
}
|
|
3349
|
-
if (!L) return Array.from(R);
|
|
3350
|
-
let z = L.getBundledLanguages();
|
|
3351
|
-
return Array.from(R).filter((s) => s && z[s]);
|
|
3352
|
-
}
|
|
3353
|
-
var DEFAULT_COLOR_LIGHT_DARK = "light-dark()", COLOR_KEYS = ["color", "background-color"];
|
|
3354
|
-
function splitToken(s, I) {
|
|
3355
|
-
let L = 0, R = [];
|
|
3356
|
-
for (let z of I) z > L && R.push({
|
|
3357
|
-
...s,
|
|
3358
|
-
content: s.content.slice(L, z),
|
|
3359
|
-
offset: s.offset + L
|
|
3360
|
-
}), L = z;
|
|
3361
|
-
return L < s.content.length && R.push({
|
|
3362
|
-
...s,
|
|
3363
|
-
content: s.content.slice(L),
|
|
3364
|
-
offset: s.offset + L
|
|
3365
|
-
}), R;
|
|
3366
|
-
}
|
|
3367
|
-
function splitTokens(s, I) {
|
|
3368
|
-
let L = Array.from(I instanceof Set ? I : new Set(I)).sort((s, I) => s - I);
|
|
3369
|
-
return L.length ? s.map((s) => s.flatMap((s) => {
|
|
3370
|
-
let I = L.filter((I) => s.offset < I && I < s.offset + s.content.length).map((I) => I - s.offset).sort((s, I) => s - I);
|
|
3371
|
-
return I.length ? splitToken(s, I) : s;
|
|
3372
|
-
})) : s;
|
|
3373
|
-
}
|
|
3374
|
-
function flatTokenVariants(s, L, R, z, B = "css-vars") {
|
|
3375
|
-
let V = {
|
|
3376
|
-
content: s.content,
|
|
3377
|
-
explanation: s.explanation,
|
|
3378
|
-
offset: s.offset
|
|
3379
|
-
}, H = L.map((I) => getTokenStyleObject(s.variants[I])), U = new Set(H.flatMap((s) => Object.keys(s))), W = {}, G = (s, I) => {
|
|
3380
|
-
let z = I === "color" ? "" : I === "background-color" ? "-bg" : `-${I}`;
|
|
3381
|
-
return R + L[s] + (I === "color" ? "" : z);
|
|
3382
|
-
};
|
|
3383
|
-
return H.forEach((s, R) => {
|
|
3384
|
-
for (let V of U) {
|
|
3385
|
-
let U = s[V] || "inherit";
|
|
3386
|
-
if (R === 0 && z && COLOR_KEYS.includes(V)) if (z === DEFAULT_COLOR_LIGHT_DARK && H.length > 1) {
|
|
3387
|
-
let s = L.findIndex((s) => s === "light"), z = L.findIndex((s) => s === "dark");
|
|
3388
|
-
if (s === -1 || z === -1) throw new ShikiError("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
3389
|
-
W[V] = `light-dark(${H[s][V] || "inherit"}, ${H[z][V] || "inherit"})`, B === "css-vars" && (W[G(R, V)] = U);
|
|
3390
|
-
} else W[V] = U;
|
|
3391
|
-
else B === "css-vars" && (W[G(R, V)] = U);
|
|
3392
|
-
}
|
|
3393
|
-
}), V.htmlStyle = W, V;
|
|
3394
|
-
}
|
|
3395
|
-
function getTokenStyleObject(s) {
|
|
3396
|
-
let I = {};
|
|
3397
|
-
if (s.color && (I.color = s.color), s.bgColor && (I["background-color"] = s.bgColor), s.fontStyle) {
|
|
3398
|
-
s.fontStyle & FontStyle.Italic && (I["font-style"] = "italic"), s.fontStyle & FontStyle.Bold && (I["font-weight"] = "bold");
|
|
3399
|
-
let L = [];
|
|
3400
|
-
s.fontStyle & FontStyle.Underline && L.push("underline"), s.fontStyle & FontStyle.Strikethrough && L.push("line-through"), L.length && (I["text-decoration"] = L.join(" "));
|
|
3401
|
-
}
|
|
3402
|
-
return I;
|
|
3403
|
-
}
|
|
3404
|
-
function stringifyTokenStyle(s) {
|
|
3405
|
-
return typeof s == "string" ? s : Object.entries(s).map(([s, I]) => `${s}:${I}`).join(";");
|
|
3406
|
-
}
|
|
3407
|
-
var _grammarStateMap = /* @__PURE__ */ new WeakMap();
|
|
3408
|
-
function setLastGrammarStateToMap(s, I) {
|
|
3409
|
-
_grammarStateMap.set(s, I);
|
|
3410
|
-
}
|
|
3411
|
-
function getLastGrammarStateFromMap(s) {
|
|
3412
|
-
return _grammarStateMap.get(s);
|
|
3413
|
-
}
|
|
3414
|
-
var GrammarState = class s {
|
|
3415
|
-
_stacks = {};
|
|
3416
|
-
lang;
|
|
3417
|
-
get themes() {
|
|
3418
|
-
return Object.keys(this._stacks);
|
|
3419
|
-
}
|
|
3420
|
-
get theme() {
|
|
3421
|
-
return this.themes[0];
|
|
3422
|
-
}
|
|
3423
|
-
get _stack() {
|
|
3424
|
-
return this._stacks[this.theme];
|
|
3425
|
-
}
|
|
3426
|
-
static initial(I, L) {
|
|
3427
|
-
return new s(Object.fromEntries(toArray(L).map((s) => [s, INITIAL])), I);
|
|
3428
|
-
}
|
|
3429
|
-
constructor(...s) {
|
|
3430
|
-
if (s.length === 2) {
|
|
3431
|
-
let [I, L] = s;
|
|
3432
|
-
this.lang = L, this._stacks = I;
|
|
3433
|
-
} else {
|
|
3434
|
-
let [I, L, R] = s;
|
|
3435
|
-
this.lang = L, this._stacks = { [R]: I };
|
|
3436
|
-
}
|
|
3437
|
-
}
|
|
3438
|
-
getInternalStack(s = this.theme) {
|
|
3439
|
-
return this._stacks[s];
|
|
3440
|
-
}
|
|
3441
|
-
getScopes(s = this.theme) {
|
|
3442
|
-
return getScopes(this._stacks[s]);
|
|
3443
|
-
}
|
|
3444
|
-
toJSON() {
|
|
3445
|
-
return {
|
|
3446
|
-
lang: this.lang,
|
|
3447
|
-
theme: this.theme,
|
|
3448
|
-
themes: this.themes,
|
|
3449
|
-
scopes: this.getScopes()
|
|
3450
|
-
};
|
|
3451
|
-
}
|
|
3452
|
-
};
|
|
3453
|
-
function getScopes(s) {
|
|
3454
|
-
let I = [], L = /* @__PURE__ */ new Set();
|
|
3455
|
-
function R(s) {
|
|
3456
|
-
if (L.has(s)) return;
|
|
3457
|
-
L.add(s);
|
|
3458
|
-
let z = s?.nameScopesList?.scopeName;
|
|
3459
|
-
z && I.push(z), s.parent && R(s.parent);
|
|
3460
|
-
}
|
|
3461
|
-
return R(s), I;
|
|
3462
|
-
}
|
|
3463
|
-
function getGrammarStack(s, L) {
|
|
3464
|
-
if (!(s instanceof GrammarState)) throw new ShikiError("Invalid grammar state");
|
|
3465
|
-
return s.getInternalStack(L);
|
|
3466
|
-
}
|
|
3467
|
-
function transformerDecorations() {
|
|
3468
|
-
let s = /* @__PURE__ */ new WeakMap();
|
|
3469
|
-
function L(L) {
|
|
3470
|
-
if (!s.has(L.meta)) {
|
|
3471
|
-
let R = function(s) {
|
|
3472
|
-
if (typeof s == "number") {
|
|
3473
|
-
if (s < 0 || s > L.source.length) throw new ShikiError(`Invalid decoration offset: ${s}. Code length: ${L.source.length}`);
|
|
3474
|
-
return {
|
|
3475
|
-
...z.indexToPos(s),
|
|
3476
|
-
offset: s
|
|
3477
|
-
};
|
|
3478
|
-
} else {
|
|
3479
|
-
let L = z.lines[s.line];
|
|
3480
|
-
if (L === void 0) throw new ShikiError(`Invalid decoration position ${JSON.stringify(s)}. Lines length: ${z.lines.length}`);
|
|
3481
|
-
let R = s.character;
|
|
3482
|
-
if (R < 0 && (R = L.length + R), R < 0 || R > L.length) throw new ShikiError(`Invalid decoration position ${JSON.stringify(s)}. Line ${s.line} length: ${L.length}`);
|
|
3483
|
-
return {
|
|
3484
|
-
...s,
|
|
3485
|
-
character: R,
|
|
3486
|
-
offset: z.posToIndex(s.line, R)
|
|
3487
|
-
};
|
|
3488
|
-
}
|
|
3489
|
-
}, z = createPositionConverter(L.source), B = (L.options.decorations || []).map((s) => ({
|
|
3490
|
-
...s,
|
|
3491
|
-
start: R(s.start),
|
|
3492
|
-
end: R(s.end)
|
|
3493
|
-
}));
|
|
3494
|
-
verifyIntersections(B), s.set(L.meta, {
|
|
3495
|
-
decorations: B,
|
|
3496
|
-
converter: z,
|
|
3497
|
-
source: L.source
|
|
3498
|
-
});
|
|
3499
|
-
}
|
|
3500
|
-
return s.get(L.meta);
|
|
3501
|
-
}
|
|
3502
|
-
return {
|
|
3503
|
-
name: "shiki:decorations",
|
|
3504
|
-
tokens(s) {
|
|
3505
|
-
if (this.options.decorations?.length) return splitTokens(s, L(this).decorations.flatMap((s) => [s.start.offset, s.end.offset]));
|
|
3506
|
-
},
|
|
3507
|
-
code(s) {
|
|
3508
|
-
if (!this.options.decorations?.length) return;
|
|
3509
|
-
let R = L(this), z = Array.from(s.children).filter((s) => s.type === "element" && s.tagName === "span");
|
|
3510
|
-
if (z.length !== R.converter.lines.length) throw new ShikiError(`Number of lines in code element (${z.length}) does not match the number of lines in the source (${R.converter.lines.length}). Failed to apply decorations.`);
|
|
3511
|
-
function B(s, L, R, B) {
|
|
3512
|
-
let V = z[s], U = "", W = -1, G = -1;
|
|
3513
|
-
if (L === 0 && (W = 0), R === 0 && (G = 0), R === Infinity && (G = V.children.length), W === -1 || G === -1) for (let s = 0; s < V.children.length; s++) U += stringify(V.children[s]), W === -1 && U.length === L && (W = s + 1), G === -1 && U.length === R && (G = s + 1);
|
|
3514
|
-
if (W === -1) throw new ShikiError(`Failed to find start index for decoration ${JSON.stringify(B.start)}`);
|
|
3515
|
-
if (G === -1) throw new ShikiError(`Failed to find end index for decoration ${JSON.stringify(B.end)}`);
|
|
3516
|
-
let K = V.children.slice(W, G);
|
|
3517
|
-
if (!B.alwaysWrap && K.length === V.children.length) H(V, B, "line");
|
|
3518
|
-
else if (!B.alwaysWrap && K.length === 1 && K[0].type === "element") H(K[0], B, "token");
|
|
3519
|
-
else {
|
|
3520
|
-
let s = {
|
|
3521
|
-
type: "element",
|
|
3522
|
-
tagName: "span",
|
|
3523
|
-
properties: {},
|
|
3524
|
-
children: K
|
|
3525
|
-
};
|
|
3526
|
-
H(s, B, "wrapper"), V.children.splice(W, K.length, s);
|
|
3527
|
-
}
|
|
3528
|
-
}
|
|
3529
|
-
function V(s, I) {
|
|
3530
|
-
z[s] = H(z[s], I, "line");
|
|
3531
|
-
}
|
|
3532
|
-
function H(s, I, L) {
|
|
3533
|
-
let R = I.properties || {}, z = I.transform || ((s) => s);
|
|
3534
|
-
return s.tagName = I.tagName || "span", s.properties = {
|
|
3535
|
-
...s.properties,
|
|
3536
|
-
...R,
|
|
3537
|
-
class: s.properties.class
|
|
3538
|
-
}, I.properties?.class && addClassToHast(s, I.properties.class), s = z(s, L) || s, s;
|
|
3539
|
-
}
|
|
3540
|
-
let U = [], W = R.decorations.sort((s, I) => I.start.offset - s.start.offset || s.end.offset - I.end.offset);
|
|
3541
|
-
for (let s of W) {
|
|
3542
|
-
let { start: I, end: L } = s;
|
|
3543
|
-
if (I.line === L.line) B(I.line, I.character, L.character, s);
|
|
3544
|
-
else if (I.line < L.line) {
|
|
3545
|
-
B(I.line, I.character, Infinity, s);
|
|
3546
|
-
for (let R = I.line + 1; R < L.line; R++) U.unshift(() => V(R, s));
|
|
3547
|
-
B(L.line, 0, L.character, s);
|
|
3548
|
-
}
|
|
3549
|
-
}
|
|
3550
|
-
U.forEach((s) => s());
|
|
3551
|
-
}
|
|
3552
|
-
};
|
|
3553
|
-
}
|
|
3554
|
-
function verifyIntersections(s) {
|
|
3555
|
-
for (let L = 0; L < s.length; L++) {
|
|
3556
|
-
let R = s[L];
|
|
3557
|
-
if (R.start.offset > R.end.offset) throw new ShikiError(`Invalid decoration range: ${JSON.stringify(R.start)} - ${JSON.stringify(R.end)}`);
|
|
3558
|
-
for (let z = L + 1; z < s.length; z++) {
|
|
3559
|
-
let L = s[z], B = R.start.offset <= L.start.offset && L.start.offset < R.end.offset, V = R.start.offset < L.end.offset && L.end.offset <= R.end.offset, H = L.start.offset <= R.start.offset && R.start.offset < L.end.offset, U = L.start.offset < R.end.offset && R.end.offset <= L.end.offset;
|
|
3560
|
-
if (B || V || H || U) {
|
|
3561
|
-
if (B && V || H && U || H && R.start.offset === R.end.offset || V && L.start.offset === L.end.offset) continue;
|
|
3562
|
-
throw new ShikiError(`Decorations ${JSON.stringify(R.start)} and ${JSON.stringify(L.start)} intersect.`);
|
|
3563
|
-
}
|
|
3564
|
-
}
|
|
3565
|
-
}
|
|
3566
|
-
}
|
|
3567
|
-
function stringify(s) {
|
|
3568
|
-
return s.type === "text" ? s.value : s.type === "element" ? s.children.map(stringify).join("") : "";
|
|
3569
|
-
}
|
|
3570
|
-
var builtInTransformers = [/* @__PURE__ */ transformerDecorations()];
|
|
3571
|
-
function getTransformers(s) {
|
|
3572
|
-
let I = sortTransformersByEnforcement(s.transformers || []);
|
|
3573
|
-
return [
|
|
3574
|
-
...I.pre,
|
|
3575
|
-
...I.normal,
|
|
3576
|
-
...I.post,
|
|
3577
|
-
...builtInTransformers
|
|
3578
|
-
];
|
|
3579
|
-
}
|
|
3580
|
-
function sortTransformersByEnforcement(s) {
|
|
3581
|
-
let I = [], L = [], R = [];
|
|
3582
|
-
for (let z of s) switch (z.enforce) {
|
|
3583
|
-
case "pre":
|
|
3584
|
-
I.push(z);
|
|
3585
|
-
break;
|
|
3586
|
-
case "post":
|
|
3587
|
-
L.push(z);
|
|
3588
|
-
break;
|
|
3589
|
-
default: R.push(z);
|
|
3590
|
-
}
|
|
3591
|
-
return {
|
|
3592
|
-
pre: I,
|
|
3593
|
-
post: L,
|
|
3594
|
-
normal: R
|
|
3595
|
-
};
|
|
3596
|
-
}
|
|
3597
|
-
var namedColors = [
|
|
3598
|
-
"black",
|
|
3599
|
-
"red",
|
|
3600
|
-
"green",
|
|
3601
|
-
"yellow",
|
|
3602
|
-
"blue",
|
|
3603
|
-
"magenta",
|
|
3604
|
-
"cyan",
|
|
3605
|
-
"white",
|
|
3606
|
-
"brightBlack",
|
|
3607
|
-
"brightRed",
|
|
3608
|
-
"brightGreen",
|
|
3609
|
-
"brightYellow",
|
|
3610
|
-
"brightBlue",
|
|
3611
|
-
"brightMagenta",
|
|
3612
|
-
"brightCyan",
|
|
3613
|
-
"brightWhite"
|
|
3614
|
-
], decorations = {
|
|
3615
|
-
1: "bold",
|
|
3616
|
-
2: "dim",
|
|
3617
|
-
3: "italic",
|
|
3618
|
-
4: "underline",
|
|
3619
|
-
7: "reverse",
|
|
3620
|
-
8: "hidden",
|
|
3621
|
-
9: "strikethrough"
|
|
3622
|
-
};
|
|
3623
|
-
function findSequence(s, I) {
|
|
3624
|
-
let L = s.indexOf("\x1B", I);
|
|
3625
|
-
if (L !== -1 && s[L + 1] === "[") {
|
|
3626
|
-
let I = s.indexOf("m", L);
|
|
3627
|
-
if (I !== -1) return {
|
|
3628
|
-
sequence: s.substring(L + 2, I).split(";"),
|
|
3629
|
-
startPosition: L,
|
|
3630
|
-
position: I + 1
|
|
3631
|
-
};
|
|
3632
|
-
}
|
|
3633
|
-
return { position: s.length };
|
|
3634
|
-
}
|
|
3635
|
-
function parseColor(s) {
|
|
3636
|
-
let I = s.shift();
|
|
3637
|
-
if (I === "2") {
|
|
3638
|
-
let I = s.splice(0, 3).map((s) => Number.parseInt(s));
|
|
3639
|
-
return I.length !== 3 || I.some((s) => Number.isNaN(s)) ? void 0 : {
|
|
3640
|
-
type: "rgb",
|
|
3641
|
-
rgb: I
|
|
3642
|
-
};
|
|
3643
|
-
} else if (I === "5") {
|
|
3644
|
-
let I = s.shift();
|
|
3645
|
-
if (I) return {
|
|
3646
|
-
type: "table",
|
|
3647
|
-
index: Number(I)
|
|
3648
|
-
};
|
|
3649
|
-
}
|
|
3650
|
-
}
|
|
3651
|
-
function parseSequence(s) {
|
|
3652
|
-
let I = [];
|
|
3653
|
-
for (; s.length > 0;) {
|
|
3654
|
-
let L = s.shift();
|
|
3655
|
-
if (!L) continue;
|
|
3656
|
-
let R = Number.parseInt(L);
|
|
3657
|
-
if (!Number.isNaN(R)) if (R === 0) I.push({ type: "resetAll" });
|
|
3658
|
-
else if (R <= 9) decorations[R] && I.push({
|
|
3659
|
-
type: "setDecoration",
|
|
3660
|
-
value: decorations[R]
|
|
3661
|
-
});
|
|
3662
|
-
else if (R <= 29) {
|
|
3663
|
-
let s = decorations[R - 20];
|
|
3664
|
-
s && (I.push({
|
|
3665
|
-
type: "resetDecoration",
|
|
3666
|
-
value: s
|
|
3667
|
-
}), s === "dim" && I.push({
|
|
3668
|
-
type: "resetDecoration",
|
|
3669
|
-
value: "bold"
|
|
3670
|
-
}));
|
|
3671
|
-
} else if (R <= 37) I.push({
|
|
3672
|
-
type: "setForegroundColor",
|
|
3673
|
-
value: {
|
|
3674
|
-
type: "named",
|
|
3675
|
-
name: namedColors[R - 30]
|
|
3676
|
-
}
|
|
3677
|
-
});
|
|
3678
|
-
else if (R === 38) {
|
|
3679
|
-
let L = parseColor(s);
|
|
3680
|
-
L && I.push({
|
|
3681
|
-
type: "setForegroundColor",
|
|
3682
|
-
value: L
|
|
3683
|
-
});
|
|
3684
|
-
} else if (R === 39) I.push({ type: "resetForegroundColor" });
|
|
3685
|
-
else if (R <= 47) I.push({
|
|
3686
|
-
type: "setBackgroundColor",
|
|
3687
|
-
value: {
|
|
3688
|
-
type: "named",
|
|
3689
|
-
name: namedColors[R - 40]
|
|
3690
|
-
}
|
|
3691
|
-
});
|
|
3692
|
-
else if (R === 48) {
|
|
3693
|
-
let L = parseColor(s);
|
|
3694
|
-
L && I.push({
|
|
3695
|
-
type: "setBackgroundColor",
|
|
3696
|
-
value: L
|
|
3697
|
-
});
|
|
3698
|
-
} else R === 49 ? I.push({ type: "resetBackgroundColor" }) : R === 53 ? I.push({
|
|
3699
|
-
type: "setDecoration",
|
|
3700
|
-
value: "overline"
|
|
3701
|
-
}) : R === 55 ? I.push({
|
|
3702
|
-
type: "resetDecoration",
|
|
3703
|
-
value: "overline"
|
|
3704
|
-
}) : R >= 90 && R <= 97 ? I.push({
|
|
3705
|
-
type: "setForegroundColor",
|
|
3706
|
-
value: {
|
|
3707
|
-
type: "named",
|
|
3708
|
-
name: namedColors[R - 90 + 8]
|
|
3709
|
-
}
|
|
3710
|
-
}) : R >= 100 && R <= 107 && I.push({
|
|
3711
|
-
type: "setBackgroundColor",
|
|
3712
|
-
value: {
|
|
3713
|
-
type: "named",
|
|
3714
|
-
name: namedColors[R - 100 + 8]
|
|
3715
|
-
}
|
|
3716
|
-
});
|
|
3717
|
-
}
|
|
3718
|
-
return I;
|
|
3719
|
-
}
|
|
3720
|
-
function createAnsiSequenceParser() {
|
|
3721
|
-
let s = null, I = null, L = /* @__PURE__ */ new Set();
|
|
3722
|
-
return { parse(R) {
|
|
3723
|
-
let z = [], B = 0;
|
|
3724
|
-
do {
|
|
3725
|
-
let V = findSequence(R, B), H = V.sequence ? R.substring(B, V.startPosition) : R.substring(B);
|
|
3726
|
-
if (H.length > 0 && z.push({
|
|
3727
|
-
value: H,
|
|
3728
|
-
foreground: s,
|
|
3729
|
-
background: I,
|
|
3730
|
-
decorations: new Set(L)
|
|
3731
|
-
}), V.sequence) {
|
|
3732
|
-
let R = parseSequence(V.sequence);
|
|
3733
|
-
for (let z of R) z.type === "resetAll" ? (s = null, I = null, L.clear()) : z.type === "resetForegroundColor" ? s = null : z.type === "resetBackgroundColor" ? I = null : z.type === "resetDecoration" && L.delete(z.value);
|
|
3734
|
-
for (let z of R) z.type === "setForegroundColor" ? s = z.value : z.type === "setBackgroundColor" ? I = z.value : z.type === "setDecoration" && L.add(z.value);
|
|
3735
|
-
}
|
|
3736
|
-
B = V.position;
|
|
3737
|
-
} while (B < R.length);
|
|
3738
|
-
return z;
|
|
3739
|
-
} };
|
|
3740
|
-
}
|
|
3741
|
-
var defaultNamedColorsMap = {
|
|
3742
|
-
black: "#000000",
|
|
3743
|
-
red: "#bb0000",
|
|
3744
|
-
green: "#00bb00",
|
|
3745
|
-
yellow: "#bbbb00",
|
|
3746
|
-
blue: "#0000bb",
|
|
3747
|
-
magenta: "#ff00ff",
|
|
3748
|
-
cyan: "#00bbbb",
|
|
3749
|
-
white: "#eeeeee",
|
|
3750
|
-
brightBlack: "#555555",
|
|
3751
|
-
brightRed: "#ff5555",
|
|
3752
|
-
brightGreen: "#00ff00",
|
|
3753
|
-
brightYellow: "#ffff55",
|
|
3754
|
-
brightBlue: "#5555ff",
|
|
3755
|
-
brightMagenta: "#ff55ff",
|
|
3756
|
-
brightCyan: "#55ffff",
|
|
3757
|
-
brightWhite: "#ffffff"
|
|
3758
|
-
};
|
|
3759
|
-
function createColorPalette(s = defaultNamedColorsMap) {
|
|
3760
|
-
function I(I) {
|
|
3761
|
-
return s[I];
|
|
3762
|
-
}
|
|
3763
|
-
function L(s) {
|
|
3764
|
-
return `#${s.map((s) => Math.max(0, Math.min(s, 255)).toString(16).padStart(2, "0")).join("")}`;
|
|
3765
|
-
}
|
|
3766
|
-
let R;
|
|
3767
|
-
function z() {
|
|
3768
|
-
if (R) return R;
|
|
3769
|
-
R = [];
|
|
3770
|
-
for (let s = 0; s < namedColors.length; s++) R.push(I(namedColors[s]));
|
|
3771
|
-
let s = [
|
|
3772
|
-
0,
|
|
3773
|
-
95,
|
|
3774
|
-
135,
|
|
3775
|
-
175,
|
|
3776
|
-
215,
|
|
3777
|
-
255
|
|
3778
|
-
];
|
|
3779
|
-
for (let I = 0; I < 6; I++) for (let z = 0; z < 6; z++) for (let B = 0; B < 6; B++) R.push(L([
|
|
3780
|
-
s[I],
|
|
3781
|
-
s[z],
|
|
3782
|
-
s[B]
|
|
3783
|
-
]));
|
|
3784
|
-
let z = 8;
|
|
3785
|
-
for (let s = 0; s < 24; s++, z += 10) R.push(L([
|
|
3786
|
-
z,
|
|
3787
|
-
z,
|
|
3788
|
-
z
|
|
3789
|
-
]));
|
|
3790
|
-
return R;
|
|
3791
|
-
}
|
|
3792
|
-
function B(s) {
|
|
3793
|
-
return z()[s];
|
|
3794
|
-
}
|
|
3795
|
-
function V(s) {
|
|
3796
|
-
switch (s.type) {
|
|
3797
|
-
case "named": return I(s.name);
|
|
3798
|
-
case "rgb": return L(s.rgb);
|
|
3799
|
-
case "table": return B(s.index);
|
|
3800
|
-
}
|
|
3801
|
-
}
|
|
3802
|
-
return { value: V };
|
|
3803
|
-
}
|
|
3804
|
-
var defaultAnsiColors = {
|
|
3805
|
-
black: "#000000",
|
|
3806
|
-
red: "#cd3131",
|
|
3807
|
-
green: "#0DBC79",
|
|
3808
|
-
yellow: "#E5E510",
|
|
3809
|
-
blue: "#2472C8",
|
|
3810
|
-
magenta: "#BC3FBC",
|
|
3811
|
-
cyan: "#11A8CD",
|
|
3812
|
-
white: "#E5E5E5",
|
|
3813
|
-
brightBlack: "#666666",
|
|
3814
|
-
brightRed: "#F14C4C",
|
|
3815
|
-
brightGreen: "#23D18B",
|
|
3816
|
-
brightYellow: "#F5F543",
|
|
3817
|
-
brightBlue: "#3B8EEA",
|
|
3818
|
-
brightMagenta: "#D670D6",
|
|
3819
|
-
brightCyan: "#29B8DB",
|
|
3820
|
-
brightWhite: "#FFFFFF"
|
|
3821
|
-
};
|
|
3822
|
-
function tokenizeAnsiWithTheme(s, I, L) {
|
|
3823
|
-
let R = resolveColorReplacements(s, L), z = splitLines(I), B = createColorPalette(Object.fromEntries(namedColors.map((I) => {
|
|
3824
|
-
let L = `terminal.ansi${I[0].toUpperCase()}${I.substring(1)}`;
|
|
3825
|
-
return [I, s.colors?.[L] || defaultAnsiColors[I]];
|
|
3826
|
-
}))), V = createAnsiSequenceParser();
|
|
3827
|
-
return z.map((I) => V.parse(I[0]).map((L) => {
|
|
3828
|
-
let z, V;
|
|
3829
|
-
L.decorations.has("reverse") ? (z = L.background ? B.value(L.background) : s.bg, V = L.foreground ? B.value(L.foreground) : s.fg) : (z = L.foreground ? B.value(L.foreground) : s.fg, V = L.background ? B.value(L.background) : void 0), z = applyColorReplacements(z, R), V = applyColorReplacements(V, R), L.decorations.has("dim") && (z = dimColor(z));
|
|
3830
|
-
let H = FontStyle.None;
|
|
3831
|
-
return L.decorations.has("bold") && (H |= FontStyle.Bold), L.decorations.has("italic") && (H |= FontStyle.Italic), L.decorations.has("underline") && (H |= FontStyle.Underline), L.decorations.has("strikethrough") && (H |= FontStyle.Strikethrough), {
|
|
3832
|
-
content: L.value,
|
|
3833
|
-
offset: I[1],
|
|
3834
|
-
color: z,
|
|
3835
|
-
bgColor: V,
|
|
3836
|
-
fontStyle: H
|
|
3837
|
-
};
|
|
3838
|
-
}));
|
|
3839
|
-
}
|
|
3840
|
-
function dimColor(s) {
|
|
3841
|
-
let I = s.match(/#([0-9a-f]{3,8})/i);
|
|
3842
|
-
if (I) {
|
|
3843
|
-
let s = I[1];
|
|
3844
|
-
if (s.length === 8) {
|
|
3845
|
-
let I = Math.round(Number.parseInt(s.slice(6, 8), 16) / 2).toString(16).padStart(2, "0");
|
|
3846
|
-
return `#${s.slice(0, 6)}${I}`;
|
|
3847
|
-
} else if (s.length === 6) return `#${s}80`;
|
|
3848
|
-
else if (s.length === 4) {
|
|
3849
|
-
let I = s[0], L = s[1], R = s[2], z = s[3];
|
|
3850
|
-
return `#${I}${I}${L}${L}${R}${R}${Math.round(Number.parseInt(`${z}${z}`, 16) / 2).toString(16).padStart(2, "0")}`;
|
|
3851
|
-
} else if (s.length === 3) {
|
|
3852
|
-
let I = s[0], L = s[1], R = s[2];
|
|
3853
|
-
return `#${I}${I}${L}${L}${R}${R}80`;
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3856
|
-
let L = s.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);
|
|
3857
|
-
return L ? `var(${L[1]}-dim)` : s;
|
|
3858
|
-
}
|
|
3859
|
-
function codeToTokensBase(s, L, R = {}) {
|
|
3860
|
-
let { theme: z = s.getLoadedThemes()[0] } = R, B = s.resolveLangAlias(R.lang || "text");
|
|
3861
|
-
if (isPlainLang(B) || isNoneTheme(z)) return splitLines(L).map((s) => [{
|
|
3862
|
-
content: s[0],
|
|
3863
|
-
offset: s[1]
|
|
3864
|
-
}]);
|
|
3865
|
-
let { theme: V, colorMap: H } = s.setTheme(z);
|
|
3866
|
-
if (B === "ansi") return tokenizeAnsiWithTheme(V, L, R);
|
|
3867
|
-
let U = s.getLanguage(R.lang || "text");
|
|
3868
|
-
if (R.grammarState) {
|
|
3869
|
-
if (R.grammarState.lang !== U.name) throw new ShikiError(`Grammar state language "${R.grammarState.lang}" does not match highlight language "${U.name}"`);
|
|
3870
|
-
if (!R.grammarState.themes.includes(V.name)) throw new ShikiError(`Grammar state themes "${R.grammarState.themes}" do not contain highlight theme "${V.name}"`);
|
|
3871
|
-
}
|
|
3872
|
-
return tokenizeWithTheme(L, U, V, H, R);
|
|
3873
|
-
}
|
|
3874
|
-
function getLastGrammarState(...s) {
|
|
3875
|
-
if (s.length === 2) return getLastGrammarStateFromMap(s[1]);
|
|
3876
|
-
let [L, R, z = {}] = s, { lang: B = "text", theme: V = L.getLoadedThemes()[0] } = z;
|
|
3877
|
-
if (isPlainLang(B) || isNoneTheme(V)) throw new ShikiError("Plain language does not have grammar state");
|
|
3878
|
-
if (B === "ansi") throw new ShikiError("ANSI language does not have grammar state");
|
|
3879
|
-
let { theme: H, colorMap: U } = L.setTheme(V), W = L.getLanguage(B);
|
|
3880
|
-
return new GrammarState(_tokenizeWithTheme(R, W, H, U, z).stateStack, W.name, H.name);
|
|
3881
|
-
}
|
|
3882
|
-
function tokenizeWithTheme(s, I, L, R, z) {
|
|
3883
|
-
let B = _tokenizeWithTheme(s, I, L, R, z), V = new GrammarState(B.stateStack, I.name, L.name);
|
|
3884
|
-
return setLastGrammarStateToMap(B.tokens, V), B.tokens;
|
|
3885
|
-
}
|
|
3886
|
-
function _tokenizeWithTheme(s, I, L, R, z) {
|
|
3887
|
-
let B = resolveColorReplacements(L, z), { tokenizeMaxLineLength: V = 0, tokenizeTimeLimit: H = 500 } = z, U = splitLines(s), W = z.grammarState ? getGrammarStack(z.grammarState, L.name) ?? INITIAL : z.grammarContextCode == null ? INITIAL : _tokenizeWithTheme(z.grammarContextCode, I, L, R, {
|
|
3888
|
-
...z,
|
|
3889
|
-
grammarState: void 0,
|
|
3890
|
-
grammarContextCode: void 0
|
|
3891
|
-
}).stateStack, G = [], K = [];
|
|
3892
|
-
for (let s = 0, q = U.length; s < q; s++) {
|
|
3893
|
-
let [q, J] = U[s];
|
|
3894
|
-
if (q === "") {
|
|
3895
|
-
G = [], K.push([]);
|
|
3896
|
-
continue;
|
|
3897
|
-
}
|
|
3898
|
-
if (V > 0 && q.length >= V) {
|
|
3899
|
-
G = [], K.push([{
|
|
3900
|
-
content: q,
|
|
3901
|
-
offset: J,
|
|
3902
|
-
color: "",
|
|
3903
|
-
fontStyle: 0
|
|
3904
|
-
}]);
|
|
3905
|
-
continue;
|
|
3906
|
-
}
|
|
3907
|
-
let Y, X, Z;
|
|
3908
|
-
z.includeExplanation && (Y = I.tokenizeLine(q, W, H), X = Y.tokens, Z = 0);
|
|
3909
|
-
let Q = I.tokenizeLine2(q, W, H), $ = Q.tokens.length / 2;
|
|
3910
|
-
for (let s = 0; s < $; s++) {
|
|
3911
|
-
let I = Q.tokens[2 * s], V = s + 1 < $ ? Q.tokens[2 * s + 2] : q.length;
|
|
3912
|
-
if (I === V) continue;
|
|
3913
|
-
let H = Q.tokens[2 * s + 1], U = applyColorReplacements(R[EncodedTokenMetadata.getForeground(H)], B), W = EncodedTokenMetadata.getFontStyle(H), K = {
|
|
3914
|
-
content: q.substring(I, V),
|
|
3915
|
-
offset: J + I,
|
|
3916
|
-
color: U,
|
|
3917
|
-
fontStyle: W
|
|
3918
|
-
};
|
|
3919
|
-
if (z.includeExplanation) {
|
|
3920
|
-
let s = [];
|
|
3921
|
-
if (z.includeExplanation !== "scopeName") for (let I of L.settings) {
|
|
3922
|
-
let L;
|
|
3923
|
-
switch (typeof I.scope) {
|
|
3924
|
-
case "string":
|
|
3925
|
-
L = I.scope.split(/,/).map((s) => s.trim());
|
|
3926
|
-
break;
|
|
3927
|
-
case "object":
|
|
3928
|
-
L = I.scope;
|
|
3929
|
-
break;
|
|
3930
|
-
default: continue;
|
|
3931
|
-
}
|
|
3932
|
-
s.push({
|
|
3933
|
-
settings: I,
|
|
3934
|
-
selectors: L.map((s) => s.split(/ /))
|
|
3935
|
-
});
|
|
3936
|
-
}
|
|
3937
|
-
K.explanation = [];
|
|
3938
|
-
let R = 0;
|
|
3939
|
-
for (; I + R < V;) {
|
|
3940
|
-
let I = X[Z], L = q.substring(I.startIndex, I.endIndex);
|
|
3941
|
-
R += L.length, K.explanation.push({
|
|
3942
|
-
content: L,
|
|
3943
|
-
scopes: z.includeExplanation === "scopeName" ? explainThemeScopesNameOnly(I.scopes) : explainThemeScopesFull(s, I.scopes)
|
|
3944
|
-
}), Z += 1;
|
|
3945
|
-
}
|
|
3946
|
-
}
|
|
3947
|
-
G.push(K);
|
|
3948
|
-
}
|
|
3949
|
-
K.push(G), G = [], W = Q.ruleStack;
|
|
3950
|
-
}
|
|
3951
|
-
return {
|
|
3952
|
-
tokens: K,
|
|
3953
|
-
stateStack: W
|
|
3954
|
-
};
|
|
3955
|
-
}
|
|
3956
|
-
function explainThemeScopesNameOnly(s) {
|
|
3957
|
-
return s.map((s) => ({ scopeName: s }));
|
|
3958
|
-
}
|
|
3959
|
-
function explainThemeScopesFull(s, I) {
|
|
3960
|
-
let L = [];
|
|
3961
|
-
for (let R = 0, z = I.length; R < z; R++) {
|
|
3962
|
-
let z = I[R];
|
|
3963
|
-
L[R] = {
|
|
3964
|
-
scopeName: z,
|
|
3965
|
-
themeMatches: explainThemeScope(s, z, I.slice(0, R))
|
|
3966
|
-
};
|
|
3967
|
-
}
|
|
3968
|
-
return L;
|
|
3969
|
-
}
|
|
3970
|
-
function matchesOne(s, I) {
|
|
3971
|
-
return s === I || I.substring(0, s.length) === s && I[s.length] === ".";
|
|
3972
|
-
}
|
|
3973
|
-
function matches(s, I, L) {
|
|
3974
|
-
if (!matchesOne(s[s.length - 1], I)) return !1;
|
|
3975
|
-
let R = s.length - 2, z = L.length - 1;
|
|
3976
|
-
for (; R >= 0 && z >= 0;) matchesOne(s[R], L[z]) && --R, --z;
|
|
3977
|
-
return R === -1;
|
|
3978
|
-
}
|
|
3979
|
-
function explainThemeScope(s, I, L) {
|
|
3980
|
-
let R = [];
|
|
3981
|
-
for (let { selectors: z, settings: B } of s) for (let s of z) if (matches(s, I, L)) {
|
|
3982
|
-
R.push(B);
|
|
3983
|
-
break;
|
|
3984
|
-
}
|
|
3985
|
-
return R;
|
|
3986
|
-
}
|
|
3987
|
-
function codeToTokensWithThemes(s, I, L) {
|
|
3988
|
-
let R = Object.entries(L.themes).filter((s) => s[1]).map((s) => ({
|
|
3989
|
-
color: s[0],
|
|
3990
|
-
theme: s[1]
|
|
3991
|
-
})), z = R.map((R) => {
|
|
3992
|
-
let z = codeToTokensBase(s, I, {
|
|
3993
|
-
...L,
|
|
3994
|
-
theme: R.theme
|
|
3995
|
-
});
|
|
3996
|
-
return {
|
|
3997
|
-
tokens: z,
|
|
3998
|
-
state: getLastGrammarStateFromMap(z),
|
|
3999
|
-
theme: typeof R.theme == "string" ? R.theme : R.theme.name
|
|
4000
|
-
};
|
|
4001
|
-
}), B = syncThemesTokenization(...z.map((s) => s.tokens)), V = B[0].map((s, I) => s.map((s, z) => {
|
|
4002
|
-
let V = {
|
|
4003
|
-
content: s.content,
|
|
4004
|
-
variants: {},
|
|
4005
|
-
offset: s.offset
|
|
4006
|
-
};
|
|
4007
|
-
return "includeExplanation" in L && L.includeExplanation && (V.explanation = s.explanation), B.forEach((s, L) => {
|
|
4008
|
-
let { content: B, explanation: H, offset: U, ...W } = s[I][z];
|
|
4009
|
-
V.variants[R[L].color] = W;
|
|
4010
|
-
}), V;
|
|
4011
|
-
})), H = z[0].state ? new GrammarState(Object.fromEntries(z.map((s) => [s.theme, s.state?.getInternalStack(s.theme)])), z[0].state.lang) : void 0;
|
|
4012
|
-
return H && setLastGrammarStateToMap(V, H), V;
|
|
4013
|
-
}
|
|
4014
|
-
function syncThemesTokenization(...s) {
|
|
4015
|
-
let I = s.map(() => []), L = s.length;
|
|
4016
|
-
for (let R = 0; R < s[0].length; R++) {
|
|
4017
|
-
let z = s.map((s) => s[R]), B = I.map(() => []);
|
|
4018
|
-
I.forEach((s, I) => s.push(B[I]));
|
|
4019
|
-
let V = z.map(() => 0), H = z.map((s) => s[0]);
|
|
4020
|
-
for (; H.every((s) => s);) {
|
|
4021
|
-
let s = Math.min(...H.map((s) => s.content.length));
|
|
4022
|
-
for (let I = 0; I < L; I++) {
|
|
4023
|
-
let L = H[I];
|
|
4024
|
-
L.content.length === s ? (B[I].push(L), V[I] += 1, H[I] = z[I][V[I]]) : (B[I].push({
|
|
4025
|
-
...L,
|
|
4026
|
-
content: L.content.slice(0, s)
|
|
4027
|
-
}), H[I] = {
|
|
4028
|
-
...L,
|
|
4029
|
-
content: L.content.slice(s),
|
|
4030
|
-
offset: L.offset + s
|
|
4031
|
-
});
|
|
4032
|
-
}
|
|
4033
|
-
}
|
|
4034
|
-
}
|
|
4035
|
-
return I;
|
|
4036
|
-
}
|
|
4037
|
-
function codeToTokens(s, L, R) {
|
|
4038
|
-
let z, B, V, H, U, W;
|
|
4039
|
-
if ("themes" in R) {
|
|
4040
|
-
let { defaultColor: G = "light", cssVariablePrefix: K = "--shiki-", colorsRendering: q = "css-vars" } = R, J = Object.entries(R.themes).filter((s) => s[1]).map((s) => ({
|
|
4041
|
-
color: s[0],
|
|
4042
|
-
theme: s[1]
|
|
4043
|
-
})).sort((s, I) => s.color === G ? -1 : I.color === G ? 1 : 0);
|
|
4044
|
-
if (J.length === 0) throw new ShikiError("`themes` option must not be empty");
|
|
4045
|
-
let Y = codeToTokensWithThemes(s, L, R);
|
|
4046
|
-
if (W = getLastGrammarStateFromMap(Y), G && DEFAULT_COLOR_LIGHT_DARK !== G && !J.find((s) => s.color === G)) throw new ShikiError(`\`themes\` option must contain the defaultColor key \`${G}\``);
|
|
4047
|
-
let X = J.map((I) => s.getTheme(I.theme)), Z = J.map((s) => s.color);
|
|
4048
|
-
V = Y.map((s) => s.map((s) => flatTokenVariants(s, Z, K, G, q))), W && setLastGrammarStateToMap(V, W);
|
|
4049
|
-
let Q = J.map((s) => resolveColorReplacements(s.theme, R));
|
|
4050
|
-
B = mapThemeColors(J, X, Q, K, G, "fg", q), z = mapThemeColors(J, X, Q, K, G, "bg", q), H = `shiki-themes ${X.map((s) => s.name).join(" ")}`, U = G ? void 0 : [B, z].join(";");
|
|
4051
|
-
} else if ("theme" in R) {
|
|
4052
|
-
let I = resolveColorReplacements(R.theme, R);
|
|
4053
|
-
V = codeToTokensBase(s, L, R);
|
|
4054
|
-
let U = s.getTheme(R.theme);
|
|
4055
|
-
z = applyColorReplacements(U.bg, I), B = applyColorReplacements(U.fg, I), H = U.name, W = getLastGrammarStateFromMap(V);
|
|
4056
|
-
} else throw new ShikiError("Invalid options, either `theme` or `themes` must be provided");
|
|
4057
|
-
return {
|
|
4058
|
-
tokens: V,
|
|
4059
|
-
fg: B,
|
|
4060
|
-
bg: z,
|
|
4061
|
-
themeName: H,
|
|
4062
|
-
rootStyle: U,
|
|
4063
|
-
grammarState: W
|
|
4064
|
-
};
|
|
4065
|
-
}
|
|
4066
|
-
function mapThemeColors(s, L, R, z, B, V, H) {
|
|
4067
|
-
return s.map((U, W) => {
|
|
4068
|
-
let G = applyColorReplacements(L[W][V], R[W]) || "inherit", K = `${z + U.color}${V === "bg" ? "-bg" : ""}:${G}`;
|
|
4069
|
-
if (W === 0 && B) {
|
|
4070
|
-
if (B === DEFAULT_COLOR_LIGHT_DARK && s.length > 1) {
|
|
4071
|
-
let z = s.findIndex((s) => s.color === "light"), B = s.findIndex((s) => s.color === "dark");
|
|
4072
|
-
if (z === -1 || B === -1) throw new ShikiError("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
4073
|
-
return `light-dark(${applyColorReplacements(L[z][V], R[z]) || "inherit"}, ${applyColorReplacements(L[B][V], R[B]) || "inherit"});${K}`;
|
|
4074
|
-
}
|
|
4075
|
-
return G;
|
|
4076
|
-
}
|
|
4077
|
-
return H === "css-vars" ? K : null;
|
|
4078
|
-
}).filter((s) => !!s).join(";");
|
|
4079
|
-
}
|
|
4080
|
-
function codeToHast(s, I, L, R = {
|
|
4081
|
-
meta: {},
|
|
4082
|
-
options: L,
|
|
4083
|
-
codeToHast: (I, L) => codeToHast(s, I, L),
|
|
4084
|
-
codeToTokens: (I, L) => codeToTokens(s, I, L)
|
|
4085
|
-
}) {
|
|
4086
|
-
let z = I;
|
|
4087
|
-
for (let s of getTransformers(L)) z = s.preprocess?.call(R, z, L) || z;
|
|
4088
|
-
let { tokens: B, fg: V, bg: H, themeName: U, rootStyle: W, grammarState: G } = codeToTokens(s, z, L), { mergeWhitespaces: K = !0, mergeSameStyleTokens: q = !1 } = L;
|
|
4089
|
-
K === !0 ? B = mergeWhitespaceTokens(B) : K === "never" && (B = splitWhitespaceTokens(B)), q && (B = mergeAdjacentStyledTokens(B));
|
|
4090
|
-
let J = {
|
|
4091
|
-
...R,
|
|
4092
|
-
get source() {
|
|
4093
|
-
return z;
|
|
4094
|
-
}
|
|
4095
|
-
};
|
|
4096
|
-
for (let s of getTransformers(L)) B = s.tokens?.call(J, B) || B;
|
|
4097
|
-
return tokensToHast(B, {
|
|
4098
|
-
...L,
|
|
4099
|
-
fg: V,
|
|
4100
|
-
bg: H,
|
|
4101
|
-
themeName: U,
|
|
4102
|
-
rootStyle: L.rootStyle === !1 ? !1 : L.rootStyle ?? W
|
|
4103
|
-
}, J, G);
|
|
4104
|
-
}
|
|
4105
|
-
function tokensToHast(s, I, L, R = getLastGrammarStateFromMap(s)) {
|
|
4106
|
-
let z = getTransformers(I), B = [], V = {
|
|
4107
|
-
type: "root",
|
|
4108
|
-
children: []
|
|
4109
|
-
}, { structure: H = "classic", tabindex: U = "0" } = I, W = { class: `shiki ${I.themeName || ""}` };
|
|
4110
|
-
I.rootStyle !== !1 && (I.rootStyle == null ? W.style = `background-color:${I.bg};color:${I.fg}` : W.style = I.rootStyle), U !== !1 && U != null && (W.tabindex = U.toString());
|
|
4111
|
-
for (let [s, L] of Object.entries(I.meta || {})) s.startsWith("_") || (W[s] = L);
|
|
4112
|
-
let G = {
|
|
4113
|
-
type: "element",
|
|
4114
|
-
tagName: "pre",
|
|
4115
|
-
properties: W,
|
|
4116
|
-
children: []
|
|
4117
|
-
}, K = {
|
|
4118
|
-
type: "element",
|
|
4119
|
-
tagName: "code",
|
|
4120
|
-
properties: {},
|
|
4121
|
-
children: B
|
|
4122
|
-
}, q = [], J = {
|
|
4123
|
-
...L,
|
|
4124
|
-
structure: H,
|
|
4125
|
-
addClassToHast,
|
|
4126
|
-
get source() {
|
|
4127
|
-
return L.source;
|
|
4128
|
-
},
|
|
4129
|
-
get tokens() {
|
|
4130
|
-
return s;
|
|
4131
|
-
},
|
|
4132
|
-
get options() {
|
|
4133
|
-
return I;
|
|
4134
|
-
},
|
|
4135
|
-
get root() {
|
|
4136
|
-
return V;
|
|
4137
|
-
},
|
|
4138
|
-
get pre() {
|
|
4139
|
-
return G;
|
|
4140
|
-
},
|
|
4141
|
-
get code() {
|
|
4142
|
-
return K;
|
|
4143
|
-
},
|
|
4144
|
-
get lines() {
|
|
4145
|
-
return q;
|
|
4146
|
-
}
|
|
4147
|
-
};
|
|
4148
|
-
if (s.forEach((s, I) => {
|
|
4149
|
-
I && (H === "inline" ? V.children.push({
|
|
4150
|
-
type: "element",
|
|
4151
|
-
tagName: "br",
|
|
4152
|
-
properties: {},
|
|
4153
|
-
children: []
|
|
4154
|
-
}) : H === "classic" && B.push({
|
|
4155
|
-
type: "text",
|
|
4156
|
-
value: "\n"
|
|
4157
|
-
}));
|
|
4158
|
-
let L = {
|
|
4159
|
-
type: "element",
|
|
4160
|
-
tagName: "span",
|
|
4161
|
-
properties: { class: "line" },
|
|
4162
|
-
children: []
|
|
4163
|
-
}, R = 0;
|
|
4164
|
-
for (let B of s) {
|
|
4165
|
-
let s = {
|
|
4166
|
-
type: "element",
|
|
4167
|
-
tagName: "span",
|
|
4168
|
-
properties: { ...B.htmlAttrs },
|
|
4169
|
-
children: [{
|
|
4170
|
-
type: "text",
|
|
4171
|
-
value: B.content
|
|
4172
|
-
}]
|
|
4173
|
-
}, U = stringifyTokenStyle(B.htmlStyle || getTokenStyleObject(B));
|
|
4174
|
-
U && (s.properties.style = U);
|
|
4175
|
-
for (let V of z) s = V?.span?.call(J, s, I + 1, R, L, B) || s;
|
|
4176
|
-
H === "inline" ? V.children.push(s) : H === "classic" && L.children.push(s), R += B.content.length;
|
|
4177
|
-
}
|
|
4178
|
-
if (H === "classic") {
|
|
4179
|
-
for (let s of z) L = s?.line?.call(J, L, I + 1) || L;
|
|
4180
|
-
q.push(L), B.push(L);
|
|
4181
|
-
} else H === "inline" && q.push(L);
|
|
4182
|
-
}), H === "classic") {
|
|
4183
|
-
for (let s of z) K = s?.code?.call(J, K) || K;
|
|
4184
|
-
G.children.push(K);
|
|
4185
|
-
for (let s of z) G = s?.pre?.call(J, G) || G;
|
|
4186
|
-
V.children.push(G);
|
|
4187
|
-
} else if (H === "inline") {
|
|
4188
|
-
let s = [], I = {
|
|
4189
|
-
type: "element",
|
|
4190
|
-
tagName: "span",
|
|
4191
|
-
properties: { class: "line" },
|
|
4192
|
-
children: []
|
|
4193
|
-
};
|
|
4194
|
-
for (let L of V.children) L.type === "element" && L.tagName === "br" ? (s.push(I), I = {
|
|
4195
|
-
type: "element",
|
|
4196
|
-
tagName: "span",
|
|
4197
|
-
properties: { class: "line" },
|
|
4198
|
-
children: []
|
|
4199
|
-
}) : (L.type === "element" || L.type === "text") && I.children.push(L);
|
|
4200
|
-
s.push(I);
|
|
4201
|
-
let L = {
|
|
4202
|
-
type: "element",
|
|
4203
|
-
tagName: "code",
|
|
4204
|
-
properties: {},
|
|
4205
|
-
children: s
|
|
4206
|
-
};
|
|
4207
|
-
for (let s of z) L = s?.code?.call(J, L) || L;
|
|
4208
|
-
V.children = [];
|
|
4209
|
-
for (let s = 0; s < L.children.length; s++) {
|
|
4210
|
-
s > 0 && V.children.push({
|
|
4211
|
-
type: "element",
|
|
4212
|
-
tagName: "br",
|
|
4213
|
-
properties: {},
|
|
4214
|
-
children: []
|
|
4215
|
-
});
|
|
4216
|
-
let I = L.children[s];
|
|
4217
|
-
I.type === "element" && V.children.push(...I.children);
|
|
4218
|
-
}
|
|
4219
|
-
}
|
|
4220
|
-
let Y = V;
|
|
4221
|
-
for (let s of z) Y = s?.root?.call(J, Y) || Y;
|
|
4222
|
-
return R && setLastGrammarStateToMap(Y, R), Y;
|
|
4223
|
-
}
|
|
4224
|
-
function mergeWhitespaceTokens(s) {
|
|
4225
|
-
return s.map((s) => {
|
|
4226
|
-
let I = [], L = "", R;
|
|
4227
|
-
return s.forEach((z, B) => {
|
|
4228
|
-
let V = !(z.fontStyle && (z.fontStyle & FontStyle.Underline || z.fontStyle & FontStyle.Strikethrough));
|
|
4229
|
-
V && z.content.match(/^\s+$/) && s[B + 1] ? (R === void 0 && (R = z.offset), L += z.content) : L ? (V ? I.push({
|
|
4230
|
-
...z,
|
|
4231
|
-
offset: R,
|
|
4232
|
-
content: L + z.content
|
|
4233
|
-
}) : I.push({
|
|
4234
|
-
content: L,
|
|
4235
|
-
offset: R
|
|
4236
|
-
}, z), R = void 0, L = "") : I.push(z);
|
|
4237
|
-
}), I;
|
|
4238
|
-
});
|
|
4239
|
-
}
|
|
4240
|
-
function splitWhitespaceTokens(s) {
|
|
4241
|
-
return s.map((s) => s.flatMap((s) => {
|
|
4242
|
-
if (s.content.match(/^\s+$/)) return s;
|
|
4243
|
-
let I = s.content.match(/^(\s*)(.*?)(\s*)$/);
|
|
4244
|
-
if (!I) return s;
|
|
4245
|
-
let [, L, R, z] = I;
|
|
4246
|
-
if (!L && !z) return s;
|
|
4247
|
-
let B = [{
|
|
4248
|
-
...s,
|
|
4249
|
-
offset: s.offset + L.length,
|
|
4250
|
-
content: R
|
|
4251
|
-
}];
|
|
4252
|
-
return L && B.unshift({
|
|
4253
|
-
content: L,
|
|
4254
|
-
offset: s.offset
|
|
4255
|
-
}), z && B.push({
|
|
4256
|
-
content: z,
|
|
4257
|
-
offset: s.offset + L.length + R.length
|
|
4258
|
-
}), B;
|
|
4259
|
-
}));
|
|
4260
|
-
}
|
|
4261
|
-
function mergeAdjacentStyledTokens(s) {
|
|
4262
|
-
return s.map((s) => {
|
|
4263
|
-
let I = [];
|
|
4264
|
-
for (let L of s) {
|
|
4265
|
-
if (I.length === 0) {
|
|
4266
|
-
I.push({ ...L });
|
|
4267
|
-
continue;
|
|
4268
|
-
}
|
|
4269
|
-
let s = I[I.length - 1], R = stringifyTokenStyle(s.htmlStyle || getTokenStyleObject(s)), z = stringifyTokenStyle(L.htmlStyle || getTokenStyleObject(L)), B = s.fontStyle && (s.fontStyle & FontStyle.Underline || s.fontStyle & FontStyle.Strikethrough), V = L.fontStyle && (L.fontStyle & FontStyle.Underline || L.fontStyle & FontStyle.Strikethrough);
|
|
4270
|
-
!B && !V && R === z ? s.content += L.content : I.push({ ...L });
|
|
4271
|
-
}
|
|
4272
|
-
return I;
|
|
4273
|
-
});
|
|
4274
|
-
}
|
|
4275
|
-
var hastToHtml = toHtml;
|
|
4276
|
-
function codeToHtml(s, I, L) {
|
|
4277
|
-
let R = {
|
|
4278
|
-
meta: {},
|
|
4279
|
-
options: L,
|
|
4280
|
-
codeToHast: (I, L) => codeToHast(s, I, L),
|
|
4281
|
-
codeToTokens: (I, L) => codeToTokens(s, I, L)
|
|
4282
|
-
}, z = hastToHtml(codeToHast(s, I, L, R));
|
|
4283
|
-
for (let s of getTransformers(L)) z = s.postprocess?.call(R, z, L) || z;
|
|
4284
|
-
return z;
|
|
4285
|
-
}
|
|
4286
|
-
var VSCODE_FALLBACK_EDITOR_FG = {
|
|
4287
|
-
light: "#333333",
|
|
4288
|
-
dark: "#bbbbbb"
|
|
4289
|
-
}, VSCODE_FALLBACK_EDITOR_BG = {
|
|
4290
|
-
light: "#fffffe",
|
|
4291
|
-
dark: "#1e1e1e"
|
|
4292
|
-
}, RESOLVED_KEY = "__shiki_resolved";
|
|
4293
|
-
function normalizeTheme(s) {
|
|
4294
|
-
if (s?.[RESOLVED_KEY]) return s;
|
|
4295
|
-
let I = { ...s };
|
|
4296
|
-
I.tokenColors && !I.settings && (I.settings = I.tokenColors, delete I.tokenColors), I.type ||= "dark", I.colorReplacements = { ...I.colorReplacements }, I.settings ||= [];
|
|
4297
|
-
let { bg: L, fg: R } = I;
|
|
4298
|
-
if (!L || !R) {
|
|
4299
|
-
let s = I.settings ? I.settings.find((s) => !s.name && !s.scope) : void 0;
|
|
4300
|
-
s?.settings?.foreground && (R = s.settings.foreground), s?.settings?.background && (L = s.settings.background), !R && I?.colors?.["editor.foreground"] && (R = I.colors["editor.foreground"]), !L && I?.colors?.["editor.background"] && (L = I.colors["editor.background"]), R ||= I.type === "light" ? VSCODE_FALLBACK_EDITOR_FG.light : VSCODE_FALLBACK_EDITOR_FG.dark, L ||= I.type === "light" ? VSCODE_FALLBACK_EDITOR_BG.light : VSCODE_FALLBACK_EDITOR_BG.dark, I.fg = R, I.bg = L;
|
|
4301
|
-
}
|
|
4302
|
-
I.settings[0] && I.settings[0].settings && !I.settings[0].scope || I.settings.unshift({ settings: {
|
|
4303
|
-
foreground: I.fg,
|
|
4304
|
-
background: I.bg
|
|
4305
|
-
} });
|
|
4306
|
-
let z = 0, B = /* @__PURE__ */ new Map();
|
|
4307
|
-
function V(s) {
|
|
4308
|
-
if (B.has(s)) return B.get(s);
|
|
4309
|
-
z += 1;
|
|
4310
|
-
let L = `#${z.toString(16).padStart(8, "0").toLowerCase()}`;
|
|
4311
|
-
return I.colorReplacements?.[`#${L}`] ? V(s) : (B.set(s, L), L);
|
|
4312
|
-
}
|
|
4313
|
-
I.settings = I.settings.map((s) => {
|
|
4314
|
-
let L = s.settings?.foreground && !s.settings.foreground.startsWith("#"), R = s.settings?.background && !s.settings.background.startsWith("#");
|
|
4315
|
-
if (!L && !R) return s;
|
|
4316
|
-
let z = {
|
|
4317
|
-
...s,
|
|
4318
|
-
settings: { ...s.settings }
|
|
4319
|
-
};
|
|
4320
|
-
if (L) {
|
|
4321
|
-
let L = V(s.settings.foreground);
|
|
4322
|
-
I.colorReplacements[L] = s.settings.foreground, z.settings.foreground = L;
|
|
4323
|
-
}
|
|
4324
|
-
if (R) {
|
|
4325
|
-
let L = V(s.settings.background);
|
|
4326
|
-
I.colorReplacements[L] = s.settings.background, z.settings.background = L;
|
|
4327
|
-
}
|
|
4328
|
-
return z;
|
|
4329
|
-
});
|
|
4330
|
-
for (let s of Object.keys(I.colors || {})) if ((s === "editor.foreground" || s === "editor.background" || s.startsWith("terminal.ansi")) && !I.colors[s]?.startsWith("#")) {
|
|
4331
|
-
let L = V(I.colors[s]);
|
|
4332
|
-
I.colorReplacements[L] = I.colors[s], I.colors[s] = L;
|
|
4333
|
-
}
|
|
4334
|
-
return Object.defineProperty(I, RESOLVED_KEY, {
|
|
4335
|
-
enumerable: !1,
|
|
4336
|
-
writable: !1,
|
|
4337
|
-
value: !0
|
|
4338
|
-
}), I;
|
|
4339
|
-
}
|
|
4340
|
-
async function resolveLangs(s) {
|
|
4341
|
-
return Array.from(new Set((await Promise.all(s.filter((s) => !isSpecialLang(s)).map(async (s) => await normalizeGetter(s).then((s) => Array.isArray(s) ? s : [s])))).flat()));
|
|
4342
|
-
}
|
|
4343
|
-
async function resolveThemes(s) {
|
|
4344
|
-
return (await Promise.all(s.map(async (s) => isSpecialTheme(s) ? null : normalizeTheme(await normalizeGetter(s))))).filter((s) => !!s);
|
|
4345
|
-
}
|
|
4346
|
-
var _emitDeprecation = 3, _emitError = !1;
|
|
4347
|
-
function enableDeprecationWarnings(s = !0, I = !1) {
|
|
4348
|
-
_emitDeprecation = s, _emitError = I;
|
|
4349
|
-
}
|
|
4350
|
-
function warnDeprecated(s, I = 3) {
|
|
4351
|
-
if (_emitDeprecation && !(typeof _emitDeprecation == "number" && I > _emitDeprecation)) {
|
|
4352
|
-
if (_emitError) throw Error(`[SHIKI DEPRECATE]: ${s}`);
|
|
4353
|
-
console.trace(`[SHIKI DEPRECATE]: ${s}`);
|
|
4354
|
-
}
|
|
4355
|
-
}
|
|
4356
|
-
var ShikiError$1 = class extends Error {
|
|
4357
|
-
constructor(s) {
|
|
4358
|
-
super(s), this.name = "ShikiError";
|
|
4359
|
-
}
|
|
4360
|
-
};
|
|
4361
|
-
function resolveLangAlias(s, I) {
|
|
4362
|
-
if (!I) return s;
|
|
4363
|
-
if (I[s]) {
|
|
4364
|
-
let L = /* @__PURE__ */ new Set([s]);
|
|
4365
|
-
for (; I[s];) {
|
|
4366
|
-
if (s = I[s], L.has(s)) throw new ShikiError$1(`Circular alias \`${Array.from(L).join(" -> ")} -> ${s}\``);
|
|
4367
|
-
L.add(s);
|
|
4368
|
-
}
|
|
4369
|
-
}
|
|
4370
|
-
return s;
|
|
4371
|
-
}
|
|
4372
|
-
var Registry = class extends Registry$1 {
|
|
4373
|
-
constructor(s, I, L, R = {}) {
|
|
4374
|
-
super(s), this._resolver = s, this._themes = I, this._langs = L, this._alias = R, this._themes.map((s) => this.loadTheme(s)), this.loadLanguages(this._langs);
|
|
4375
|
-
}
|
|
4376
|
-
_resolvedThemes = /* @__PURE__ */ new Map();
|
|
4377
|
-
_resolvedGrammars = /* @__PURE__ */ new Map();
|
|
4378
|
-
_langMap = /* @__PURE__ */ new Map();
|
|
4379
|
-
_langGraph = /* @__PURE__ */ new Map();
|
|
4380
|
-
_textmateThemeCache = /* @__PURE__ */ new WeakMap();
|
|
4381
|
-
_loadedThemesCache = null;
|
|
4382
|
-
_loadedLanguagesCache = null;
|
|
4383
|
-
getTheme(s) {
|
|
4384
|
-
return typeof s == "string" ? this._resolvedThemes.get(s) : this.loadTheme(s);
|
|
4385
|
-
}
|
|
4386
|
-
loadTheme(s) {
|
|
4387
|
-
let I = normalizeTheme(s);
|
|
4388
|
-
return I.name && (this._resolvedThemes.set(I.name, I), this._loadedThemesCache = null), I;
|
|
4389
|
-
}
|
|
4390
|
-
getLoadedThemes() {
|
|
4391
|
-
return this._loadedThemesCache ||= [...this._resolvedThemes.keys()], this._loadedThemesCache;
|
|
4392
|
-
}
|
|
4393
|
-
setTheme(s) {
|
|
4394
|
-
let I = this._textmateThemeCache.get(s);
|
|
4395
|
-
I || (I = Theme.createFromRawTheme(s), this._textmateThemeCache.set(s, I)), this._syncRegistry.setTheme(I);
|
|
4396
|
-
}
|
|
4397
|
-
getGrammar(s) {
|
|
4398
|
-
return s = resolveLangAlias(s, this._alias), this._resolvedGrammars.get(s);
|
|
4399
|
-
}
|
|
4400
|
-
loadLanguage(s) {
|
|
4401
|
-
if (this.getGrammar(s.name)) return;
|
|
4402
|
-
let I = new Set([...this._langMap.values()].filter((I) => I.embeddedLangsLazy?.includes(s.name)));
|
|
4403
|
-
this._resolver.addLanguage(s);
|
|
4404
|
-
let L = {
|
|
4405
|
-
balancedBracketSelectors: s.balancedBracketSelectors || ["*"],
|
|
4406
|
-
unbalancedBracketSelectors: s.unbalancedBracketSelectors || []
|
|
4407
|
-
};
|
|
4408
|
-
this._syncRegistry._rawGrammars.set(s.scopeName, s);
|
|
4409
|
-
let R = this.loadGrammarWithConfiguration(s.scopeName, 1, L);
|
|
4410
|
-
if (R.name = s.name, this._resolvedGrammars.set(s.name, R), s.aliases && s.aliases.forEach((I) => {
|
|
4411
|
-
this._alias[I] = s.name;
|
|
4412
|
-
}), this._loadedLanguagesCache = null, I.size) for (let s of I) this._resolvedGrammars.delete(s.name), this._loadedLanguagesCache = null, this._syncRegistry?._injectionGrammars?.delete(s.scopeName), this._syncRegistry?._grammars?.delete(s.scopeName), this.loadLanguage(this._langMap.get(s.name));
|
|
4413
|
-
}
|
|
4414
|
-
dispose() {
|
|
4415
|
-
super.dispose(), this._resolvedThemes.clear(), this._resolvedGrammars.clear(), this._langMap.clear(), this._langGraph.clear(), this._loadedThemesCache = null;
|
|
4416
|
-
}
|
|
4417
|
-
loadLanguages(s) {
|
|
4418
|
-
for (let I of s) this.resolveEmbeddedLanguages(I);
|
|
4419
|
-
let I = Array.from(this._langGraph.entries()), L = I.filter(([s, I]) => !I);
|
|
4420
|
-
if (L.length) {
|
|
4421
|
-
let s = I.filter(([s, I]) => I ? (I.embeddedLanguages || I.embeddedLangs)?.some((s) => L.map(([s]) => s).includes(s)) : !1).filter((s) => !L.includes(s));
|
|
4422
|
-
throw new ShikiError$1(`Missing languages ${L.map(([s]) => `\`${s}\``).join(", ")}, required by ${s.map(([s]) => `\`${s}\``).join(", ")}`);
|
|
4423
|
-
}
|
|
4424
|
-
for (let [s, L] of I) this._resolver.addLanguage(L);
|
|
4425
|
-
for (let [s, L] of I) this.loadLanguage(L);
|
|
4426
|
-
}
|
|
4427
|
-
getLoadedLanguages() {
|
|
4428
|
-
return this._loadedLanguagesCache ||= [.../* @__PURE__ */ new Set([...this._resolvedGrammars.keys(), ...Object.keys(this._alias)])], this._loadedLanguagesCache;
|
|
4429
|
-
}
|
|
4430
|
-
resolveEmbeddedLanguages(s) {
|
|
4431
|
-
this._langMap.set(s.name, s), this._langGraph.set(s.name, s);
|
|
4432
|
-
let I = s.embeddedLanguages ?? s.embeddedLangs;
|
|
4433
|
-
if (I) for (let s of I) this._langGraph.set(s, this._langMap.get(s));
|
|
4434
|
-
}
|
|
4435
|
-
}, Resolver = class {
|
|
4436
|
-
_langs = /* @__PURE__ */ new Map();
|
|
4437
|
-
_scopeToLang = /* @__PURE__ */ new Map();
|
|
4438
|
-
_injections = /* @__PURE__ */ new Map();
|
|
4439
|
-
_onigLib;
|
|
4440
|
-
constructor(s, I) {
|
|
4441
|
-
this._onigLib = {
|
|
4442
|
-
createOnigScanner: (I) => s.createScanner(I),
|
|
4443
|
-
createOnigString: (I) => s.createString(I)
|
|
4444
|
-
}, I.forEach((s) => this.addLanguage(s));
|
|
4445
|
-
}
|
|
4446
|
-
get onigLib() {
|
|
4447
|
-
return this._onigLib;
|
|
4448
|
-
}
|
|
4449
|
-
getLangRegistration(s) {
|
|
4450
|
-
return this._langs.get(s);
|
|
4451
|
-
}
|
|
4452
|
-
loadGrammar(s) {
|
|
4453
|
-
return this._scopeToLang.get(s);
|
|
4454
|
-
}
|
|
4455
|
-
addLanguage(s) {
|
|
4456
|
-
this._langs.set(s.name, s), s.aliases && s.aliases.forEach((I) => {
|
|
4457
|
-
this._langs.set(I, s);
|
|
4458
|
-
}), this._scopeToLang.set(s.scopeName, s), s.injectTo && s.injectTo.forEach((I) => {
|
|
4459
|
-
this._injections.get(I) || this._injections.set(I, []), this._injections.get(I).push(s.scopeName);
|
|
4460
|
-
});
|
|
4461
|
-
}
|
|
4462
|
-
getInjections(s) {
|
|
4463
|
-
let I = s.split("."), L = [];
|
|
4464
|
-
for (let s = 1; s <= I.length; s++) {
|
|
4465
|
-
let R = I.slice(0, s).join(".");
|
|
4466
|
-
L = [...L, ...this._injections.get(R) || []];
|
|
4467
|
-
}
|
|
4468
|
-
return L;
|
|
4469
|
-
}
|
|
4470
|
-
}, instancesCount = 0;
|
|
4471
|
-
function createShikiInternalSync(s) {
|
|
4472
|
-
instancesCount += 1, s.warnings !== !1 && instancesCount >= 10 && instancesCount % 10 == 0 && console.warn(`[Shiki] ${instancesCount} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);
|
|
4473
|
-
let I = !1;
|
|
4474
|
-
if (!s.engine) throw new ShikiError$1("`engine` option is required for synchronous mode");
|
|
4475
|
-
let L = (s.langs || []).flat(1), R = (s.themes || []).flat(1).map(normalizeTheme), z = new Registry(new Resolver(s.engine, L), R, L, s.langAlias), B;
|
|
4476
|
-
function V(I) {
|
|
4477
|
-
return resolveLangAlias(I, s.langAlias);
|
|
4478
|
-
}
|
|
4479
|
-
function H(s) {
|
|
4480
|
-
Z();
|
|
4481
|
-
let I = z.getGrammar(typeof s == "string" ? s : s.name);
|
|
4482
|
-
if (!I) throw new ShikiError$1(`Language \`${s}\` not found, you may need to load it first`);
|
|
4483
|
-
return I;
|
|
4484
|
-
}
|
|
4485
|
-
function U(s) {
|
|
4486
|
-
if (s === "none") return {
|
|
4487
|
-
bg: "",
|
|
4488
|
-
fg: "",
|
|
4489
|
-
name: "none",
|
|
4490
|
-
settings: [],
|
|
4491
|
-
type: "dark"
|
|
4492
|
-
};
|
|
4493
|
-
Z();
|
|
4494
|
-
let I = z.getTheme(s);
|
|
4495
|
-
if (!I) throw new ShikiError$1(`Theme \`${s}\` not found, you may need to load it first`);
|
|
4496
|
-
return I;
|
|
4497
|
-
}
|
|
4498
|
-
function W(s) {
|
|
4499
|
-
Z();
|
|
4500
|
-
let I = U(s);
|
|
4501
|
-
return B !== s && (z.setTheme(I), B = s), {
|
|
4502
|
-
theme: I,
|
|
4503
|
-
colorMap: z.getColorMap()
|
|
4504
|
-
};
|
|
4505
|
-
}
|
|
4506
|
-
function G() {
|
|
4507
|
-
return Z(), z.getLoadedThemes();
|
|
4508
|
-
}
|
|
4509
|
-
function K() {
|
|
4510
|
-
return Z(), z.getLoadedLanguages();
|
|
4511
|
-
}
|
|
4512
|
-
function q(...s) {
|
|
4513
|
-
Z(), z.loadLanguages(s.flat(1));
|
|
4514
|
-
}
|
|
4515
|
-
async function J(...s) {
|
|
4516
|
-
return q(await resolveLangs(s));
|
|
4517
|
-
}
|
|
4518
|
-
function Y(...s) {
|
|
4519
|
-
Z();
|
|
4520
|
-
for (let I of s.flat(1)) z.loadTheme(I);
|
|
4521
|
-
}
|
|
4522
|
-
async function X(...s) {
|
|
4523
|
-
return Z(), Y(await resolveThemes(s));
|
|
4524
|
-
}
|
|
4525
|
-
function Z() {
|
|
4526
|
-
if (I) throw new ShikiError$1("Shiki instance has been disposed");
|
|
4527
|
-
}
|
|
4528
|
-
function Q() {
|
|
4529
|
-
I || (I = !0, z.dispose(), --instancesCount);
|
|
4530
|
-
}
|
|
4531
|
-
return {
|
|
4532
|
-
setTheme: W,
|
|
4533
|
-
getTheme: U,
|
|
4534
|
-
getLanguage: H,
|
|
4535
|
-
getLoadedThemes: G,
|
|
4536
|
-
getLoadedLanguages: K,
|
|
4537
|
-
resolveLangAlias: V,
|
|
4538
|
-
loadLanguage: J,
|
|
4539
|
-
loadLanguageSync: q,
|
|
4540
|
-
loadTheme: X,
|
|
4541
|
-
loadThemeSync: Y,
|
|
4542
|
-
dispose: Q,
|
|
4543
|
-
[Symbol.dispose]: Q
|
|
4544
|
-
};
|
|
4545
|
-
}
|
|
4546
|
-
async function createShikiInternal(s) {
|
|
4547
|
-
s.engine || warnDeprecated("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");
|
|
4548
|
-
let [I, L, R] = await Promise.all([
|
|
4549
|
-
resolveThemes(s.themes || []),
|
|
4550
|
-
resolveLangs(s.langs || []),
|
|
4551
|
-
s.engine
|
|
4552
|
-
]);
|
|
4553
|
-
return createShikiInternalSync({
|
|
4554
|
-
...s,
|
|
4555
|
-
themes: I,
|
|
4556
|
-
langs: L,
|
|
4557
|
-
engine: R
|
|
4558
|
-
});
|
|
4559
|
-
}
|
|
4560
|
-
async function createHighlighterCore(s) {
|
|
4561
|
-
let I = await createShikiInternal(s);
|
|
4562
|
-
return {
|
|
4563
|
-
getLastGrammarState: (...s) => getLastGrammarState(I, ...s),
|
|
4564
|
-
codeToTokensBase: (s, L) => codeToTokensBase(I, s, L),
|
|
4565
|
-
codeToTokensWithThemes: (s, L) => codeToTokensWithThemes(I, s, L),
|
|
4566
|
-
codeToTokens: (s, L) => codeToTokens(I, s, L),
|
|
4567
|
-
codeToHast: (s, L) => codeToHast(I, s, L),
|
|
4568
|
-
codeToHtml: (s, L) => codeToHtml(I, s, L),
|
|
4569
|
-
getBundledLanguages: () => ({}),
|
|
4570
|
-
getBundledThemes: () => ({}),
|
|
4571
|
-
...I,
|
|
4572
|
-
getInternalContext: () => I
|
|
4573
|
-
};
|
|
4574
|
-
}
|
|
4575
|
-
function createHighlighterCoreSync(s) {
|
|
4576
|
-
let I = createShikiInternalSync(s);
|
|
4577
|
-
return {
|
|
4578
|
-
getLastGrammarState: (...s) => getLastGrammarState(I, ...s),
|
|
4579
|
-
codeToTokensBase: (s, L) => codeToTokensBase(I, s, L),
|
|
4580
|
-
codeToTokensWithThemes: (s, L) => codeToTokensWithThemes(I, s, L),
|
|
4581
|
-
codeToTokens: (s, L) => codeToTokens(I, s, L),
|
|
4582
|
-
codeToHast: (s, L) => codeToHast(I, s, L),
|
|
4583
|
-
codeToHtml: (s, L) => codeToHtml(I, s, L),
|
|
4584
|
-
getBundledLanguages: () => ({}),
|
|
4585
|
-
getBundledThemes: () => ({}),
|
|
4586
|
-
...I,
|
|
4587
|
-
getInternalContext: () => I
|
|
4588
|
-
};
|
|
4589
|
-
}
|
|
4590
|
-
function makeSingletonHighlighterCore(s) {
|
|
4591
|
-
let I;
|
|
4592
|
-
async function L(L) {
|
|
4593
|
-
if (I) {
|
|
4594
|
-
let s = await I;
|
|
4595
|
-
return await Promise.all([s.loadTheme(...L.themes || []), s.loadLanguage(...L.langs || [])]), s;
|
|
4596
|
-
} else return I = s({
|
|
4597
|
-
...L,
|
|
4598
|
-
themes: L.themes || [],
|
|
4599
|
-
langs: L.langs || []
|
|
4600
|
-
}), I;
|
|
4601
|
-
}
|
|
4602
|
-
return L;
|
|
4603
|
-
}
|
|
4604
|
-
var getSingletonHighlighterCore = /* @__PURE__ */ makeSingletonHighlighterCore(createHighlighterCore);
|
|
4605
|
-
function createBundledHighlighter(s) {
|
|
4606
|
-
let L = s.langs, R = s.themes, z = s.engine;
|
|
4607
|
-
async function B(s) {
|
|
4608
|
-
function B(R) {
|
|
4609
|
-
if (typeof R == "string") {
|
|
4610
|
-
if (R = s.langAlias?.[R] || R, isSpecialLang(R)) return [];
|
|
4611
|
-
let z = L[R];
|
|
4612
|
-
if (!z) throw new ShikiError(`Language \`${R}\` is not included in this bundle. You may want to load it from external source.`);
|
|
4613
|
-
return z;
|
|
4614
|
-
}
|
|
4615
|
-
return R;
|
|
4616
|
-
}
|
|
4617
|
-
function V(s) {
|
|
4618
|
-
if (isSpecialTheme(s)) return "none";
|
|
4619
|
-
if (typeof s == "string") {
|
|
4620
|
-
let L = R[s];
|
|
4621
|
-
if (!L) throw new ShikiError(`Theme \`${s}\` is not included in this bundle. You may want to load it from external source.`);
|
|
4622
|
-
return L;
|
|
4623
|
-
}
|
|
4624
|
-
return s;
|
|
4625
|
-
}
|
|
4626
|
-
let H = (s.themes ?? []).map((s) => V(s)), U = (s.langs ?? []).map((s) => B(s)), W = await createHighlighterCore({
|
|
4627
|
-
engine: s.engine ?? z(),
|
|
4628
|
-
...s,
|
|
4629
|
-
themes: H,
|
|
4630
|
-
langs: U
|
|
4631
|
-
});
|
|
4632
|
-
return {
|
|
4633
|
-
...W,
|
|
4634
|
-
loadLanguage(...s) {
|
|
4635
|
-
return W.loadLanguage(...s.map(B));
|
|
4636
|
-
},
|
|
4637
|
-
loadTheme(...s) {
|
|
4638
|
-
return W.loadTheme(...s.map(V));
|
|
4639
|
-
},
|
|
4640
|
-
getBundledLanguages() {
|
|
4641
|
-
return L;
|
|
4642
|
-
},
|
|
4643
|
-
getBundledThemes() {
|
|
4644
|
-
return R;
|
|
4645
|
-
}
|
|
4646
|
-
};
|
|
4647
|
-
}
|
|
4648
|
-
return B;
|
|
4649
|
-
}
|
|
4650
|
-
function makeSingletonHighlighter(s) {
|
|
4651
|
-
let I;
|
|
4652
|
-
async function L(L = {}) {
|
|
4653
|
-
if (I) {
|
|
4654
|
-
let s = await I;
|
|
4655
|
-
return await Promise.all([s.loadTheme(...L.themes || []), s.loadLanguage(...L.langs || [])]), s;
|
|
4656
|
-
} else {
|
|
4657
|
-
I = s({
|
|
4658
|
-
...L,
|
|
4659
|
-
themes: [],
|
|
4660
|
-
langs: []
|
|
4661
|
-
});
|
|
4662
|
-
let R = await I;
|
|
4663
|
-
return await Promise.all([R.loadTheme(...L.themes || []), R.loadLanguage(...L.langs || [])]), R;
|
|
4664
|
-
}
|
|
4665
|
-
}
|
|
4666
|
-
return L;
|
|
4667
|
-
}
|
|
4668
|
-
function createSingletonShorthands(s, I) {
|
|
4669
|
-
let L = makeSingletonHighlighter(s);
|
|
4670
|
-
async function R(s, R) {
|
|
4671
|
-
let z = await L({
|
|
4672
|
-
langs: [R.lang],
|
|
4673
|
-
themes: "theme" in R ? [R.theme] : Object.values(R.themes)
|
|
4674
|
-
}), B = await I?.guessEmbeddedLanguages?.(s, R.lang, z);
|
|
4675
|
-
return B && await z.loadLanguage(...B), z;
|
|
4676
|
-
}
|
|
4677
|
-
return {
|
|
4678
|
-
getSingletonHighlighter(s) {
|
|
4679
|
-
return L(s);
|
|
4680
|
-
},
|
|
4681
|
-
async codeToHtml(s, I) {
|
|
4682
|
-
return (await R(s, I)).codeToHtml(s, I);
|
|
4683
|
-
},
|
|
4684
|
-
async codeToHast(s, I) {
|
|
4685
|
-
return (await R(s, I)).codeToHast(s, I);
|
|
4686
|
-
},
|
|
4687
|
-
async codeToTokens(s, I) {
|
|
4688
|
-
return (await R(s, I)).codeToTokens(s, I);
|
|
4689
|
-
},
|
|
4690
|
-
async codeToTokensBase(s, I) {
|
|
4691
|
-
return (await R(s, I)).codeToTokensBase(s, I);
|
|
4692
|
-
},
|
|
4693
|
-
async codeToTokensWithThemes(s, I) {
|
|
4694
|
-
return (await R(s, I)).codeToTokensWithThemes(s, I);
|
|
4695
|
-
},
|
|
4696
|
-
async getLastGrammarState(s, I) {
|
|
4697
|
-
return (await L({
|
|
4698
|
-
langs: [I.lang],
|
|
4699
|
-
themes: [I.theme]
|
|
4700
|
-
})).getLastGrammarState(s, I);
|
|
4701
|
-
}
|
|
4702
|
-
};
|
|
4703
|
-
}
|
|
4704
|
-
var createdBundledHighlighter = createBundledHighlighter;
|
|
4705
|
-
function createCssVariablesTheme(s = {}) {
|
|
4706
|
-
let { name: I = "css-variables", variablePrefix: L = "--shiki-", fontStyle: R = !0 } = s, z = (I) => s.variableDefaults?.[I] ? `var(${L}${I}, ${s.variableDefaults[I]})` : `var(${L}${I})`, B = {
|
|
4707
|
-
name: I,
|
|
4708
|
-
type: "dark",
|
|
4709
|
-
colors: {
|
|
4710
|
-
"editor.foreground": z("foreground"),
|
|
4711
|
-
"editor.background": z("background"),
|
|
4712
|
-
"terminal.ansiBlack": z("ansi-black"),
|
|
4713
|
-
"terminal.ansiRed": z("ansi-red"),
|
|
4714
|
-
"terminal.ansiGreen": z("ansi-green"),
|
|
4715
|
-
"terminal.ansiYellow": z("ansi-yellow"),
|
|
4716
|
-
"terminal.ansiBlue": z("ansi-blue"),
|
|
4717
|
-
"terminal.ansiMagenta": z("ansi-magenta"),
|
|
4718
|
-
"terminal.ansiCyan": z("ansi-cyan"),
|
|
4719
|
-
"terminal.ansiWhite": z("ansi-white"),
|
|
4720
|
-
"terminal.ansiBrightBlack": z("ansi-bright-black"),
|
|
4721
|
-
"terminal.ansiBrightRed": z("ansi-bright-red"),
|
|
4722
|
-
"terminal.ansiBrightGreen": z("ansi-bright-green"),
|
|
4723
|
-
"terminal.ansiBrightYellow": z("ansi-bright-yellow"),
|
|
4724
|
-
"terminal.ansiBrightBlue": z("ansi-bright-blue"),
|
|
4725
|
-
"terminal.ansiBrightMagenta": z("ansi-bright-magenta"),
|
|
4726
|
-
"terminal.ansiBrightCyan": z("ansi-bright-cyan"),
|
|
4727
|
-
"terminal.ansiBrightWhite": z("ansi-bright-white")
|
|
4728
|
-
},
|
|
4729
|
-
tokenColors: [
|
|
4730
|
-
{
|
|
4731
|
-
scope: [
|
|
4732
|
-
"keyword.operator.accessor",
|
|
4733
|
-
"meta.group.braces.round.function.arguments",
|
|
4734
|
-
"meta.template.expression",
|
|
4735
|
-
"markup.fenced_code meta.embedded.block"
|
|
4736
|
-
],
|
|
4737
|
-
settings: { foreground: z("foreground") }
|
|
4738
|
-
},
|
|
4739
|
-
{
|
|
4740
|
-
scope: "emphasis",
|
|
4741
|
-
settings: { fontStyle: "italic" }
|
|
4742
|
-
},
|
|
4743
|
-
{
|
|
4744
|
-
scope: [
|
|
4745
|
-
"strong",
|
|
4746
|
-
"markup.heading.markdown",
|
|
4747
|
-
"markup.bold.markdown"
|
|
4748
|
-
],
|
|
4749
|
-
settings: { fontStyle: "bold" }
|
|
4750
|
-
},
|
|
4751
|
-
{
|
|
4752
|
-
scope: ["markup.italic.markdown"],
|
|
4753
|
-
settings: { fontStyle: "italic" }
|
|
4754
|
-
},
|
|
4755
|
-
{
|
|
4756
|
-
scope: "meta.link.inline.markdown",
|
|
4757
|
-
settings: {
|
|
4758
|
-
fontStyle: "underline",
|
|
4759
|
-
foreground: z("token-link")
|
|
4760
|
-
}
|
|
4761
|
-
},
|
|
4762
|
-
{
|
|
4763
|
-
scope: [
|
|
4764
|
-
"string",
|
|
4765
|
-
"markup.fenced_code",
|
|
4766
|
-
"markup.inline"
|
|
4767
|
-
],
|
|
4768
|
-
settings: { foreground: z("token-string") }
|
|
4769
|
-
},
|
|
4770
|
-
{
|
|
4771
|
-
scope: ["comment", "string.quoted.docstring.multi"],
|
|
4772
|
-
settings: { foreground: z("token-comment") }
|
|
4773
|
-
},
|
|
4774
|
-
{
|
|
4775
|
-
scope: [
|
|
4776
|
-
"constant.numeric",
|
|
4777
|
-
"constant.language",
|
|
4778
|
-
"constant.other.placeholder",
|
|
4779
|
-
"constant.character.format.placeholder",
|
|
4780
|
-
"variable.language.this",
|
|
4781
|
-
"variable.other.object",
|
|
4782
|
-
"variable.other.class",
|
|
4783
|
-
"variable.other.constant",
|
|
4784
|
-
"meta.property-name",
|
|
4785
|
-
"meta.property-value",
|
|
4786
|
-
"support"
|
|
4787
|
-
],
|
|
4788
|
-
settings: { foreground: z("token-constant") }
|
|
4789
|
-
},
|
|
4790
|
-
{
|
|
4791
|
-
scope: [
|
|
4792
|
-
"keyword",
|
|
4793
|
-
"storage.modifier",
|
|
4794
|
-
"storage.type",
|
|
4795
|
-
"storage.control.clojure",
|
|
4796
|
-
"entity.name.function.clojure",
|
|
4797
|
-
"entity.name.tag.yaml",
|
|
4798
|
-
"support.function.node",
|
|
4799
|
-
"support.type.property-name.json",
|
|
4800
|
-
"punctuation.separator.key-value",
|
|
4801
|
-
"punctuation.definition.template-expression"
|
|
4802
|
-
],
|
|
4803
|
-
settings: { foreground: z("token-keyword") }
|
|
4804
|
-
},
|
|
4805
|
-
{
|
|
4806
|
-
scope: "variable.parameter.function",
|
|
4807
|
-
settings: { foreground: z("token-parameter") }
|
|
4808
|
-
},
|
|
4809
|
-
{
|
|
4810
|
-
scope: [
|
|
4811
|
-
"support.function",
|
|
4812
|
-
"entity.name.type",
|
|
4813
|
-
"entity.other.inherited-class",
|
|
4814
|
-
"meta.function-call",
|
|
4815
|
-
"meta.instance.constructor",
|
|
4816
|
-
"entity.other.attribute-name",
|
|
4817
|
-
"entity.name.function",
|
|
4818
|
-
"constant.keyword.clojure"
|
|
4819
|
-
],
|
|
4820
|
-
settings: { foreground: z("token-function") }
|
|
4821
|
-
},
|
|
4822
|
-
{
|
|
4823
|
-
scope: [
|
|
4824
|
-
"entity.name.tag",
|
|
4825
|
-
"string.quoted",
|
|
4826
|
-
"string.regexp",
|
|
4827
|
-
"string.interpolated",
|
|
4828
|
-
"string.template",
|
|
4829
|
-
"string.unquoted.plain.out.yaml",
|
|
4830
|
-
"keyword.other.template"
|
|
4831
|
-
],
|
|
4832
|
-
settings: { foreground: z("token-string-expression") }
|
|
4833
|
-
},
|
|
4834
|
-
{
|
|
4835
|
-
scope: [
|
|
4836
|
-
"punctuation.definition.arguments",
|
|
4837
|
-
"punctuation.definition.dict",
|
|
4838
|
-
"punctuation.separator",
|
|
4839
|
-
"meta.function-call.arguments"
|
|
4840
|
-
],
|
|
4841
|
-
settings: { foreground: z("token-punctuation") }
|
|
4842
|
-
},
|
|
4843
|
-
{
|
|
4844
|
-
scope: ["markup.underline.link", "punctuation.definition.metadata.markdown"],
|
|
4845
|
-
settings: { foreground: z("token-link") }
|
|
4846
|
-
},
|
|
4847
|
-
{
|
|
4848
|
-
scope: ["beginning.punctuation.definition.list.markdown"],
|
|
4849
|
-
settings: { foreground: z("token-string") }
|
|
4850
|
-
},
|
|
4851
|
-
{
|
|
4852
|
-
scope: [
|
|
4853
|
-
"punctuation.definition.string.begin.markdown",
|
|
4854
|
-
"punctuation.definition.string.end.markdown",
|
|
4855
|
-
"string.other.link.title.markdown",
|
|
4856
|
-
"string.other.link.description.markdown"
|
|
4857
|
-
],
|
|
4858
|
-
settings: { foreground: z("token-keyword") }
|
|
4859
|
-
},
|
|
4860
|
-
{
|
|
4861
|
-
scope: [
|
|
4862
|
-
"markup.inserted",
|
|
4863
|
-
"meta.diff.header.to-file",
|
|
4864
|
-
"punctuation.definition.inserted"
|
|
4865
|
-
],
|
|
4866
|
-
settings: { foreground: z("token-inserted") }
|
|
4867
|
-
},
|
|
4868
|
-
{
|
|
4869
|
-
scope: [
|
|
4870
|
-
"markup.deleted",
|
|
4871
|
-
"meta.diff.header.from-file",
|
|
4872
|
-
"punctuation.definition.deleted"
|
|
4873
|
-
],
|
|
4874
|
-
settings: { foreground: z("token-deleted") }
|
|
4875
|
-
},
|
|
4876
|
-
{
|
|
4877
|
-
scope: ["markup.changed", "punctuation.definition.changed"],
|
|
4878
|
-
settings: { foreground: z("token-changed") }
|
|
4879
|
-
}
|
|
4880
|
-
]
|
|
4881
|
-
};
|
|
4882
|
-
return R || (B.tokenColors = B.tokenColors?.map((s) => (s.settings?.fontStyle && delete s.settings.fontStyle, s))), B;
|
|
4883
|
-
}
|
|
4884
|
-
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 };
|