@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
|
@@ -0,0 +1,4885 @@
|
|
|
1
|
+
import { n as __exportAll } from "./chunk-CD4vhpVs.js";
|
|
2
|
+
var ShikiError = class extends Error {
|
|
3
|
+
constructor(e) {
|
|
4
|
+
super(e), this.name = "ShikiError";
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
function clone(e) {
|
|
8
|
+
return doClone(e);
|
|
9
|
+
}
|
|
10
|
+
function doClone(e) {
|
|
11
|
+
return Array.isArray(e) ? cloneArray(e) : e instanceof RegExp ? e : typeof e == "object" ? cloneObj(e) : e;
|
|
12
|
+
}
|
|
13
|
+
function cloneArray(e) {
|
|
14
|
+
let t = [];
|
|
15
|
+
for (let n = 0, i = e.length; n < i; n++) t[n] = doClone(e[n]);
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
function cloneObj(e) {
|
|
19
|
+
let t = {};
|
|
20
|
+
for (let n in e) t[n] = doClone(e[n]);
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
function mergeObjects(e, ...t) {
|
|
24
|
+
return t.forEach((t) => {
|
|
25
|
+
for (let n in t) e[n] = t[n];
|
|
26
|
+
}), e;
|
|
27
|
+
}
|
|
28
|
+
function basename(e) {
|
|
29
|
+
let t = ~e.lastIndexOf("/") || ~e.lastIndexOf("\\");
|
|
30
|
+
return t === 0 ? e : ~t === e.length - 1 ? basename(e.substring(0, e.length - 1)) : e.substr(~t + 1);
|
|
31
|
+
}
|
|
32
|
+
var CAPTURING_REGEX_SOURCE = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g, RegexSource = class {
|
|
33
|
+
static hasCaptures(e) {
|
|
34
|
+
return e === null ? !1 : (CAPTURING_REGEX_SOURCE.lastIndex = 0, CAPTURING_REGEX_SOURCE.test(e));
|
|
35
|
+
}
|
|
36
|
+
static replaceCaptures(e, t, n) {
|
|
37
|
+
return e.replace(CAPTURING_REGEX_SOURCE, (e, r, i, a) => {
|
|
38
|
+
let o = n[parseInt(r || i, 10)];
|
|
39
|
+
if (o) {
|
|
40
|
+
let e = t.substring(o.start, o.end);
|
|
41
|
+
for (; e[0] === ".";) e = e.substring(1);
|
|
42
|
+
switch (a) {
|
|
43
|
+
case "downcase": return e.toLowerCase();
|
|
44
|
+
case "upcase": return e.toUpperCase();
|
|
45
|
+
default: return e;
|
|
46
|
+
}
|
|
47
|
+
} else return e;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function strcmp(e, t) {
|
|
52
|
+
return e < t ? -1 : e > t ? 1 : 0;
|
|
53
|
+
}
|
|
54
|
+
function strArrCmp(e, t) {
|
|
55
|
+
if (e === null && t === null) return 0;
|
|
56
|
+
if (!e) return -1;
|
|
57
|
+
if (!t) return 1;
|
|
58
|
+
let n = e.length, r = t.length;
|
|
59
|
+
if (n === r) {
|
|
60
|
+
for (let r = 0; r < n; r++) {
|
|
61
|
+
let n = strcmp(e[r], t[r]);
|
|
62
|
+
if (n !== 0) return n;
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
return n - r;
|
|
67
|
+
}
|
|
68
|
+
function isValidHexColor(e) {
|
|
69
|
+
return !!(/^#[0-9a-f]{6}$/i.test(e) || /^#[0-9a-f]{8}$/i.test(e) || /^#[0-9a-f]{3}$/i.test(e) || /^#[0-9a-f]{4}$/i.test(e));
|
|
70
|
+
}
|
|
71
|
+
function escapeRegExpCharacters(e) {
|
|
72
|
+
return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, "\\$&");
|
|
73
|
+
}
|
|
74
|
+
var CachedFn = class {
|
|
75
|
+
constructor(e) {
|
|
76
|
+
this.fn = e;
|
|
77
|
+
}
|
|
78
|
+
cache = /* @__PURE__ */ new Map();
|
|
79
|
+
get(e) {
|
|
80
|
+
if (this.cache.has(e)) return this.cache.get(e);
|
|
81
|
+
let t = this.fn(e);
|
|
82
|
+
return this.cache.set(e, t), t;
|
|
83
|
+
}
|
|
84
|
+
}, Theme = class {
|
|
85
|
+
constructor(e, t, n) {
|
|
86
|
+
this._colorMap = e, this._defaults = t, this._root = n;
|
|
87
|
+
}
|
|
88
|
+
static createFromRawTheme(e, t) {
|
|
89
|
+
return this.createFromParsedTheme(parseTheme(e), t);
|
|
90
|
+
}
|
|
91
|
+
static createFromParsedTheme(e, t) {
|
|
92
|
+
return resolveParsedThemeRules(e, t);
|
|
93
|
+
}
|
|
94
|
+
_cachedMatchRoot = new CachedFn((e) => this._root.match(e));
|
|
95
|
+
getColorMap() {
|
|
96
|
+
return this._colorMap.getColorMap();
|
|
97
|
+
}
|
|
98
|
+
getDefaults() {
|
|
99
|
+
return this._defaults;
|
|
100
|
+
}
|
|
101
|
+
match(e) {
|
|
102
|
+
if (e === null) return this._defaults;
|
|
103
|
+
let t = e.scopeName, n = this._cachedMatchRoot.get(t).find((t) => _scopePathMatchesParentScopes(e.parent, t.parentScopes));
|
|
104
|
+
return n ? new StyleAttributes(n.fontStyle, n.foreground, n.background) : null;
|
|
105
|
+
}
|
|
106
|
+
}, ScopeStack = class e {
|
|
107
|
+
constructor(e, t) {
|
|
108
|
+
this.parent = e, this.scopeName = t;
|
|
109
|
+
}
|
|
110
|
+
static push(t, n) {
|
|
111
|
+
for (let r of n) t = new e(t, r);
|
|
112
|
+
return t;
|
|
113
|
+
}
|
|
114
|
+
static from(...t) {
|
|
115
|
+
let n = null;
|
|
116
|
+
for (let r = 0; r < t.length; r++) n = new e(n, t[r]);
|
|
117
|
+
return n;
|
|
118
|
+
}
|
|
119
|
+
push(t) {
|
|
120
|
+
return new e(this, t);
|
|
121
|
+
}
|
|
122
|
+
getSegments() {
|
|
123
|
+
let e = this, t = [];
|
|
124
|
+
for (; e;) t.push(e.scopeName), e = e.parent;
|
|
125
|
+
return t.reverse(), t;
|
|
126
|
+
}
|
|
127
|
+
toString() {
|
|
128
|
+
return this.getSegments().join(" ");
|
|
129
|
+
}
|
|
130
|
+
extends(e) {
|
|
131
|
+
return this === e ? !0 : this.parent === null ? !1 : this.parent.extends(e);
|
|
132
|
+
}
|
|
133
|
+
getExtensionIfDefined(e) {
|
|
134
|
+
let t = [], n = this;
|
|
135
|
+
for (; n && n !== e;) t.push(n.scopeName), n = n.parent;
|
|
136
|
+
return n === e ? t.reverse() : void 0;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
function _scopePathMatchesParentScopes(e, t) {
|
|
140
|
+
if (t.length === 0) return !0;
|
|
141
|
+
for (let n = 0; n < t.length; n++) {
|
|
142
|
+
let r = t[n], i = !1;
|
|
143
|
+
if (r === ">") {
|
|
144
|
+
if (n === t.length - 1) return !1;
|
|
145
|
+
r = t[++n], i = !0;
|
|
146
|
+
}
|
|
147
|
+
for (; e && !_matchesScope(e.scopeName, r);) {
|
|
148
|
+
if (i) return !1;
|
|
149
|
+
e = e.parent;
|
|
150
|
+
}
|
|
151
|
+
if (!e) return !1;
|
|
152
|
+
e = e.parent;
|
|
153
|
+
}
|
|
154
|
+
return !0;
|
|
155
|
+
}
|
|
156
|
+
function _matchesScope(e, t) {
|
|
157
|
+
return t === e || e.startsWith(t) && e[t.length] === ".";
|
|
158
|
+
}
|
|
159
|
+
var StyleAttributes = class {
|
|
160
|
+
constructor(e, t, n) {
|
|
161
|
+
this.fontStyle = e, this.foregroundId = t, this.backgroundId = n;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
function parseTheme(e) {
|
|
165
|
+
if (!e || !e.settings || !Array.isArray(e.settings)) return [];
|
|
166
|
+
let t = e.settings, n = [], r = 0;
|
|
167
|
+
for (let e = 0, i = t.length; e < i; e++) {
|
|
168
|
+
let i = t[e];
|
|
169
|
+
if (!i.settings) continue;
|
|
170
|
+
let a;
|
|
171
|
+
if (typeof i.scope == "string") {
|
|
172
|
+
let e = i.scope;
|
|
173
|
+
e = e.replace(/^[,]+/, ""), e = e.replace(/[,]+$/, ""), a = e.split(",");
|
|
174
|
+
} else a = Array.isArray(i.scope) ? i.scope : [""];
|
|
175
|
+
let o = -1;
|
|
176
|
+
if (typeof i.settings.fontStyle == "string") {
|
|
177
|
+
o = 0;
|
|
178
|
+
let e = i.settings.fontStyle.split(" ");
|
|
179
|
+
for (let t = 0, n = e.length; t < n; t++) switch (e[t]) {
|
|
180
|
+
case "italic":
|
|
181
|
+
o |= 1;
|
|
182
|
+
break;
|
|
183
|
+
case "bold":
|
|
184
|
+
o |= 2;
|
|
185
|
+
break;
|
|
186
|
+
case "underline":
|
|
187
|
+
o |= 4;
|
|
188
|
+
break;
|
|
189
|
+
case "strikethrough":
|
|
190
|
+
o |= 8;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
let s = null;
|
|
195
|
+
typeof i.settings.foreground == "string" && isValidHexColor(i.settings.foreground) && (s = i.settings.foreground);
|
|
196
|
+
let c = null;
|
|
197
|
+
typeof i.settings.background == "string" && isValidHexColor(i.settings.background) && (c = i.settings.background);
|
|
198
|
+
for (let t = 0, i = a.length; t < i; t++) {
|
|
199
|
+
let i = a[t].trim().split(" "), l = i[i.length - 1], u = null;
|
|
200
|
+
i.length > 1 && (u = i.slice(0, i.length - 1), u.reverse()), n[r++] = new ParsedThemeRule(l, u, e, o, s, c);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return n;
|
|
204
|
+
}
|
|
205
|
+
var ParsedThemeRule = class {
|
|
206
|
+
constructor(e, t, n, r, i, a) {
|
|
207
|
+
this.scope = e, this.parentScopes = t, this.index = n, this.fontStyle = r, this.foreground = i, this.background = a;
|
|
208
|
+
}
|
|
209
|
+
}, FontStyle = /* @__PURE__ */ ((e) => (e[e.NotSet = -1] = "NotSet", e[e.None = 0] = "None", e[e.Italic = 1] = "Italic", e[e.Bold = 2] = "Bold", e[e.Underline = 4] = "Underline", e[e.Strikethrough = 8] = "Strikethrough", e))(FontStyle || {});
|
|
210
|
+
function resolveParsedThemeRules(e, t) {
|
|
211
|
+
e.sort((e, t) => {
|
|
212
|
+
let n = strcmp(e.scope, t.scope);
|
|
213
|
+
return n !== 0 || (n = strArrCmp(e.parentScopes, t.parentScopes), n !== 0) ? n : e.index - t.index;
|
|
214
|
+
});
|
|
215
|
+
let n = 0, r = "#000000", i = "#ffffff";
|
|
216
|
+
for (; e.length >= 1 && e[0].scope === "";) {
|
|
217
|
+
let t = e.shift();
|
|
218
|
+
t.fontStyle !== -1 && (n = t.fontStyle), t.foreground !== null && (r = t.foreground), t.background !== null && (i = t.background);
|
|
219
|
+
}
|
|
220
|
+
let a = new ColorMap(t), o = new StyleAttributes(n, a.getId(r), a.getId(i)), s = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1, 0, 0), []);
|
|
221
|
+
for (let t = 0, n = e.length; t < n; t++) {
|
|
222
|
+
let n = e[t];
|
|
223
|
+
s.insert(0, n.scope, n.parentScopes, n.fontStyle, a.getId(n.foreground), a.getId(n.background));
|
|
224
|
+
}
|
|
225
|
+
return new Theme(a, o, s);
|
|
226
|
+
}
|
|
227
|
+
var ColorMap = class {
|
|
228
|
+
_isFrozen;
|
|
229
|
+
_lastColorId;
|
|
230
|
+
_id2color;
|
|
231
|
+
_color2id;
|
|
232
|
+
constructor(e) {
|
|
233
|
+
if (this._lastColorId = 0, this._id2color = [], this._color2id = /* @__PURE__ */ Object.create(null), Array.isArray(e)) {
|
|
234
|
+
this._isFrozen = !0;
|
|
235
|
+
for (let t = 0, n = e.length; t < n; t++) this._color2id[e[t]] = t, this._id2color[t] = e[t];
|
|
236
|
+
} else this._isFrozen = !1;
|
|
237
|
+
}
|
|
238
|
+
getId(e) {
|
|
239
|
+
if (e === null) return 0;
|
|
240
|
+
e = e.toUpperCase();
|
|
241
|
+
let t = this._color2id[e];
|
|
242
|
+
if (t) return t;
|
|
243
|
+
if (this._isFrozen) throw Error(`Missing color in color map - ${e}`);
|
|
244
|
+
return t = ++this._lastColorId, this._color2id[e] = t, this._id2color[t] = e, t;
|
|
245
|
+
}
|
|
246
|
+
getColorMap() {
|
|
247
|
+
return this._id2color.slice(0);
|
|
248
|
+
}
|
|
249
|
+
}, emptyParentScopes = Object.freeze([]), ThemeTrieElementRule = class e {
|
|
250
|
+
scopeDepth;
|
|
251
|
+
parentScopes;
|
|
252
|
+
fontStyle;
|
|
253
|
+
foreground;
|
|
254
|
+
background;
|
|
255
|
+
constructor(e, t, n, r, i) {
|
|
256
|
+
this.scopeDepth = e, this.parentScopes = t || emptyParentScopes, this.fontStyle = n, this.foreground = r, this.background = i;
|
|
257
|
+
}
|
|
258
|
+
clone() {
|
|
259
|
+
return new e(this.scopeDepth, this.parentScopes, this.fontStyle, this.foreground, this.background);
|
|
260
|
+
}
|
|
261
|
+
static cloneArr(e) {
|
|
262
|
+
let t = [];
|
|
263
|
+
for (let n = 0, r = e.length; n < r; n++) t[n] = e[n].clone();
|
|
264
|
+
return t;
|
|
265
|
+
}
|
|
266
|
+
acceptOverwrite(e, t, n, r) {
|
|
267
|
+
this.scopeDepth > e ? console.log("how did this happen?") : this.scopeDepth = e, t !== -1 && (this.fontStyle = t), n !== 0 && (this.foreground = n), r !== 0 && (this.background = r);
|
|
268
|
+
}
|
|
269
|
+
}, ThemeTrieElement = class e {
|
|
270
|
+
constructor(e, t = [], n = {}) {
|
|
271
|
+
this._mainRule = e, this._children = n, this._rulesWithParentScopes = t;
|
|
272
|
+
}
|
|
273
|
+
_rulesWithParentScopes;
|
|
274
|
+
static _cmpBySpecificity(e, t) {
|
|
275
|
+
if (e.scopeDepth !== t.scopeDepth) return t.scopeDepth - e.scopeDepth;
|
|
276
|
+
let n = 0, r = 0;
|
|
277
|
+
for (; e.parentScopes[n] === ">" && n++, t.parentScopes[r] === ">" && r++, !(n >= e.parentScopes.length || r >= t.parentScopes.length);) {
|
|
278
|
+
let i = t.parentScopes[r].length - e.parentScopes[n].length;
|
|
279
|
+
if (i !== 0) return i;
|
|
280
|
+
n++, r++;
|
|
281
|
+
}
|
|
282
|
+
return t.parentScopes.length - e.parentScopes.length;
|
|
283
|
+
}
|
|
284
|
+
match(t) {
|
|
285
|
+
if (t !== "") {
|
|
286
|
+
let e = t.indexOf("."), n, r;
|
|
287
|
+
if (e === -1 ? (n = t, r = "") : (n = t.substring(0, e), r = t.substring(e + 1)), this._children.hasOwnProperty(n)) return this._children[n].match(r);
|
|
288
|
+
}
|
|
289
|
+
let n = this._rulesWithParentScopes.concat(this._mainRule);
|
|
290
|
+
return n.sort(e._cmpBySpecificity), n;
|
|
291
|
+
}
|
|
292
|
+
insert(t, n, r, i, a, o) {
|
|
293
|
+
if (n === "") {
|
|
294
|
+
this._doInsertHere(t, r, i, a, o);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
let s = n.indexOf("."), c, l;
|
|
298
|
+
s === -1 ? (c = n, l = "") : (c = n.substring(0, s), l = n.substring(s + 1));
|
|
299
|
+
let u;
|
|
300
|
+
this._children.hasOwnProperty(c) ? u = this._children[c] : (u = new e(this._mainRule.clone(), ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes)), this._children[c] = u), u.insert(t + 1, l, r, i, a, o);
|
|
301
|
+
}
|
|
302
|
+
_doInsertHere(e, t, n, r, i) {
|
|
303
|
+
if (t === null) {
|
|
304
|
+
this._mainRule.acceptOverwrite(e, n, r, i);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
for (let a = 0, o = this._rulesWithParentScopes.length; a < o; a++) {
|
|
308
|
+
let o = this._rulesWithParentScopes[a];
|
|
309
|
+
if (strArrCmp(o.parentScopes, t) === 0) {
|
|
310
|
+
o.acceptOverwrite(e, n, r, i);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
n === -1 && (n = this._mainRule.fontStyle), r === 0 && (r = this._mainRule.foreground), i === 0 && (i = this._mainRule.background), this._rulesWithParentScopes.push(new ThemeTrieElementRule(e, t, n, r, i));
|
|
315
|
+
}
|
|
316
|
+
}, EncodedTokenMetadata = class e {
|
|
317
|
+
static toBinaryStr(e) {
|
|
318
|
+
return e.toString(2).padStart(32, "0");
|
|
319
|
+
}
|
|
320
|
+
static print(t) {
|
|
321
|
+
let n = e.getLanguageId(t), r = e.getTokenType(t), i = e.getFontStyle(t), a = e.getForeground(t), o = e.getBackground(t);
|
|
322
|
+
console.log({
|
|
323
|
+
languageId: n,
|
|
324
|
+
tokenType: r,
|
|
325
|
+
fontStyle: i,
|
|
326
|
+
foreground: a,
|
|
327
|
+
background: o
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
static getLanguageId(e) {
|
|
331
|
+
return (e & 255) >>> 0;
|
|
332
|
+
}
|
|
333
|
+
static getTokenType(e) {
|
|
334
|
+
return (e & 768) >>> 8;
|
|
335
|
+
}
|
|
336
|
+
static containsBalancedBrackets(e) {
|
|
337
|
+
return (e & 1024) != 0;
|
|
338
|
+
}
|
|
339
|
+
static getFontStyle(e) {
|
|
340
|
+
return (e & 30720) >>> 11;
|
|
341
|
+
}
|
|
342
|
+
static getForeground(e) {
|
|
343
|
+
return (e & 16744448) >>> 15;
|
|
344
|
+
}
|
|
345
|
+
static getBackground(e) {
|
|
346
|
+
return (e & 4278190080) >>> 24;
|
|
347
|
+
}
|
|
348
|
+
static set(t, n, r, i, a, o, s) {
|
|
349
|
+
let c = e.getLanguageId(t), l = e.getTokenType(t), u = e.containsBalancedBrackets(t) ? 1 : 0, d = e.getFontStyle(t), f = e.getForeground(t), m = e.getBackground(t);
|
|
350
|
+
return n !== 0 && (c = n), r !== 8 && (l = fromOptionalTokenType(r)), i !== null && (u = i ? 1 : 0), a !== -1 && (d = a), o !== 0 && (f = o), s !== 0 && (m = s), (c << 0 | l << 8 | u << 10 | d << 11 | f << 15 | m << 24) >>> 0;
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
function toOptionalTokenType(e) {
|
|
354
|
+
return e;
|
|
355
|
+
}
|
|
356
|
+
function fromOptionalTokenType(e) {
|
|
357
|
+
return e;
|
|
358
|
+
}
|
|
359
|
+
function createMatchers(e, t) {
|
|
360
|
+
let n = [], r = newTokenizer(e), i = r.next();
|
|
361
|
+
for (; i !== null;) {
|
|
362
|
+
let e = 0;
|
|
363
|
+
if (i.length === 2 && i.charAt(1) === ":") {
|
|
364
|
+
switch (i.charAt(0)) {
|
|
365
|
+
case "R":
|
|
366
|
+
e = 1;
|
|
367
|
+
break;
|
|
368
|
+
case "L":
|
|
369
|
+
e = -1;
|
|
370
|
+
break;
|
|
371
|
+
default: console.log(`Unknown priority ${i} in scope selector`);
|
|
372
|
+
}
|
|
373
|
+
i = r.next();
|
|
374
|
+
}
|
|
375
|
+
let t = o();
|
|
376
|
+
if (n.push({
|
|
377
|
+
matcher: t,
|
|
378
|
+
priority: e
|
|
379
|
+
}), i !== ",") break;
|
|
380
|
+
i = r.next();
|
|
381
|
+
}
|
|
382
|
+
return n;
|
|
383
|
+
function a() {
|
|
384
|
+
if (i === "-") {
|
|
385
|
+
i = r.next();
|
|
386
|
+
let e = a();
|
|
387
|
+
return (t) => !!e && !e(t);
|
|
388
|
+
}
|
|
389
|
+
if (i === "(") {
|
|
390
|
+
i = r.next();
|
|
391
|
+
let e = s();
|
|
392
|
+
return i === ")" && (i = r.next()), e;
|
|
393
|
+
}
|
|
394
|
+
if (isIdentifier(i)) {
|
|
395
|
+
let e = [];
|
|
396
|
+
do
|
|
397
|
+
e.push(i), i = r.next();
|
|
398
|
+
while (isIdentifier(i));
|
|
399
|
+
return (n) => t(e, n);
|
|
400
|
+
}
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
function o() {
|
|
404
|
+
let e = [], t = a();
|
|
405
|
+
for (; t;) e.push(t), t = a();
|
|
406
|
+
return (t) => e.every((e) => e(t));
|
|
407
|
+
}
|
|
408
|
+
function s() {
|
|
409
|
+
let e = [], t = o();
|
|
410
|
+
for (; t && (e.push(t), i === "|" || i === ",");) {
|
|
411
|
+
do
|
|
412
|
+
i = r.next();
|
|
413
|
+
while (i === "|" || i === ",");
|
|
414
|
+
t = o();
|
|
415
|
+
}
|
|
416
|
+
return (t) => e.some((e) => e(t));
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function isIdentifier(e) {
|
|
420
|
+
return !!e && !!e.match(/[\w\.:]+/);
|
|
421
|
+
}
|
|
422
|
+
function newTokenizer(e) {
|
|
423
|
+
let t = /([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g, n = t.exec(e);
|
|
424
|
+
return { next: () => {
|
|
425
|
+
if (!n) return null;
|
|
426
|
+
let r = n[0];
|
|
427
|
+
return n = t.exec(e), r;
|
|
428
|
+
} };
|
|
429
|
+
}
|
|
430
|
+
function disposeOnigString(e) {
|
|
431
|
+
typeof e.dispose == "function" && e.dispose();
|
|
432
|
+
}
|
|
433
|
+
var TopLevelRuleReference = class {
|
|
434
|
+
constructor(e) {
|
|
435
|
+
this.scopeName = e;
|
|
436
|
+
}
|
|
437
|
+
toKey() {
|
|
438
|
+
return this.scopeName;
|
|
439
|
+
}
|
|
440
|
+
}, TopLevelRepositoryRuleReference = class {
|
|
441
|
+
constructor(e, t) {
|
|
442
|
+
this.scopeName = e, this.ruleName = t;
|
|
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(e) {
|
|
455
|
+
let t = e.toKey();
|
|
456
|
+
this._seenReferenceKeys.has(t) || (this._seenReferenceKeys.add(t), this._references.push(e));
|
|
457
|
+
}
|
|
458
|
+
}, ScopeDependencyProcessor = class {
|
|
459
|
+
constructor(e, t) {
|
|
460
|
+
this.repo = e, this.initialScopeName = t, 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 e = this.Q;
|
|
467
|
+
this.Q = [];
|
|
468
|
+
let t = new ExternalReferenceCollector();
|
|
469
|
+
for (let n of e) collectReferencesOfReference(n, this.initialScopeName, this.repo, t);
|
|
470
|
+
for (let e of t.references) if (e instanceof TopLevelRuleReference) {
|
|
471
|
+
if (this.seenFullScopeRequests.has(e.scopeName)) continue;
|
|
472
|
+
this.seenFullScopeRequests.add(e.scopeName), this.Q.push(e);
|
|
473
|
+
} else {
|
|
474
|
+
if (this.seenFullScopeRequests.has(e.scopeName) || this.seenPartialScopeRequests.has(e.toKey())) continue;
|
|
475
|
+
this.seenPartialScopeRequests.add(e.toKey()), this.Q.push(e);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
function collectReferencesOfReference(e, t, n, r) {
|
|
480
|
+
let i = n.lookup(e.scopeName);
|
|
481
|
+
if (!i) {
|
|
482
|
+
if (e.scopeName === t) throw Error(`No grammar provided for <${t}>`);
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
let a = n.lookup(t);
|
|
486
|
+
e instanceof TopLevelRuleReference ? collectExternalReferencesInTopLevelRule({
|
|
487
|
+
baseGrammar: a,
|
|
488
|
+
selfGrammar: i
|
|
489
|
+
}, r) : collectExternalReferencesInTopLevelRepositoryRule(e.ruleName, {
|
|
490
|
+
baseGrammar: a,
|
|
491
|
+
selfGrammar: i,
|
|
492
|
+
repository: i.repository
|
|
493
|
+
}, r);
|
|
494
|
+
let o = n.injections(e.scopeName);
|
|
495
|
+
if (o) for (let e of o) r.add(new TopLevelRuleReference(e));
|
|
496
|
+
}
|
|
497
|
+
function collectExternalReferencesInTopLevelRepositoryRule(e, t, n) {
|
|
498
|
+
if (t.repository && t.repository[e]) {
|
|
499
|
+
let r = t.repository[e];
|
|
500
|
+
collectExternalReferencesInRules([r], t, n);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function collectExternalReferencesInTopLevelRule(e, t) {
|
|
504
|
+
e.selfGrammar.patterns && Array.isArray(e.selfGrammar.patterns) && collectExternalReferencesInRules(e.selfGrammar.patterns, {
|
|
505
|
+
...e,
|
|
506
|
+
repository: e.selfGrammar.repository
|
|
507
|
+
}, t), e.selfGrammar.injections && collectExternalReferencesInRules(Object.values(e.selfGrammar.injections), {
|
|
508
|
+
...e,
|
|
509
|
+
repository: e.selfGrammar.repository
|
|
510
|
+
}, t);
|
|
511
|
+
}
|
|
512
|
+
function collectExternalReferencesInRules(e, t, n) {
|
|
513
|
+
for (let r of e) {
|
|
514
|
+
if (n.visitedRule.has(r)) continue;
|
|
515
|
+
n.visitedRule.add(r);
|
|
516
|
+
let e = r.repository ? mergeObjects({}, t.repository, r.repository) : t.repository;
|
|
517
|
+
Array.isArray(r.patterns) && collectExternalReferencesInRules(r.patterns, {
|
|
518
|
+
...t,
|
|
519
|
+
repository: e
|
|
520
|
+
}, n);
|
|
521
|
+
let i = r.include;
|
|
522
|
+
if (!i) continue;
|
|
523
|
+
let a = parseInclude(i);
|
|
524
|
+
switch (a.kind) {
|
|
525
|
+
case 0:
|
|
526
|
+
collectExternalReferencesInTopLevelRule({
|
|
527
|
+
...t,
|
|
528
|
+
selfGrammar: t.baseGrammar
|
|
529
|
+
}, n);
|
|
530
|
+
break;
|
|
531
|
+
case 1:
|
|
532
|
+
collectExternalReferencesInTopLevelRule(t, n);
|
|
533
|
+
break;
|
|
534
|
+
case 2:
|
|
535
|
+
collectExternalReferencesInTopLevelRepositoryRule(a.ruleName, {
|
|
536
|
+
...t,
|
|
537
|
+
repository: e
|
|
538
|
+
}, n);
|
|
539
|
+
break;
|
|
540
|
+
case 3:
|
|
541
|
+
case 4:
|
|
542
|
+
let r = a.scopeName === t.selfGrammar.scopeName ? t.selfGrammar : a.scopeName === t.baseGrammar.scopeName ? t.baseGrammar : void 0;
|
|
543
|
+
if (r) {
|
|
544
|
+
let i = {
|
|
545
|
+
baseGrammar: t.baseGrammar,
|
|
546
|
+
selfGrammar: r,
|
|
547
|
+
repository: e
|
|
548
|
+
};
|
|
549
|
+
a.kind === 4 ? collectExternalReferencesInTopLevelRepositoryRule(a.ruleName, i, n) : collectExternalReferencesInTopLevelRule(i, n);
|
|
550
|
+
} else a.kind === 4 ? n.add(new TopLevelRepositoryRuleReference(a.scopeName, a.ruleName)) : n.add(new TopLevelRuleReference(a.scopeName));
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
var BaseReference = class {
|
|
556
|
+
kind = 0;
|
|
557
|
+
}, SelfReference = class {
|
|
558
|
+
kind = 1;
|
|
559
|
+
}, RelativeReference = class {
|
|
560
|
+
constructor(e) {
|
|
561
|
+
this.ruleName = e;
|
|
562
|
+
}
|
|
563
|
+
kind = 2;
|
|
564
|
+
}, TopLevelReference = class {
|
|
565
|
+
constructor(e) {
|
|
566
|
+
this.scopeName = e;
|
|
567
|
+
}
|
|
568
|
+
kind = 3;
|
|
569
|
+
}, TopLevelRepositoryReference = class {
|
|
570
|
+
constructor(e, t) {
|
|
571
|
+
this.scopeName = e, this.ruleName = t;
|
|
572
|
+
}
|
|
573
|
+
kind = 4;
|
|
574
|
+
};
|
|
575
|
+
function parseInclude(e) {
|
|
576
|
+
if (e === "$base") return new BaseReference();
|
|
577
|
+
if (e === "$self") return new SelfReference();
|
|
578
|
+
let t = e.indexOf("#");
|
|
579
|
+
return t === -1 ? new TopLevelReference(e) : t === 0 ? new RelativeReference(e.substring(1)) : new TopLevelRepositoryReference(e.substring(0, t), e.substring(t + 1));
|
|
580
|
+
}
|
|
581
|
+
var HAS_BACK_REFERENCES = /\\(\d+)/, BACK_REFERENCING_END = /\\(\d+)/g, endRuleId = -1, whileRuleId = -2;
|
|
582
|
+
function ruleIdFromNumber(e) {
|
|
583
|
+
return e;
|
|
584
|
+
}
|
|
585
|
+
function ruleIdToNumber(e) {
|
|
586
|
+
return e;
|
|
587
|
+
}
|
|
588
|
+
var Rule = class {
|
|
589
|
+
$location;
|
|
590
|
+
id;
|
|
591
|
+
_nameIsCapturing;
|
|
592
|
+
_name;
|
|
593
|
+
_contentNameIsCapturing;
|
|
594
|
+
_contentName;
|
|
595
|
+
constructor(e, t, n, r) {
|
|
596
|
+
this.$location = e, this.id = t, this._name = n || null, this._nameIsCapturing = RegexSource.hasCaptures(this._name), this._contentName = r || null, this._contentNameIsCapturing = RegexSource.hasCaptures(this._contentName);
|
|
597
|
+
}
|
|
598
|
+
get debugName() {
|
|
599
|
+
let e = this.$location ? `${basename(this.$location.filename)}:${this.$location.line}` : "unknown";
|
|
600
|
+
return `${this.constructor.name}#${this.id} @ ${e}`;
|
|
601
|
+
}
|
|
602
|
+
getName(e, t) {
|
|
603
|
+
return !this._nameIsCapturing || this._name === null || e === null || t === null ? this._name : RegexSource.replaceCaptures(this._name, e, t);
|
|
604
|
+
}
|
|
605
|
+
getContentName(e, t) {
|
|
606
|
+
return !this._contentNameIsCapturing || this._contentName === null ? this._contentName : RegexSource.replaceCaptures(this._contentName, e, t);
|
|
607
|
+
}
|
|
608
|
+
}, CaptureRule = class extends Rule {
|
|
609
|
+
retokenizeCapturedWithRuleId;
|
|
610
|
+
constructor(e, t, n, r, i) {
|
|
611
|
+
super(e, t, n, r), this.retokenizeCapturedWithRuleId = i;
|
|
612
|
+
}
|
|
613
|
+
dispose() {}
|
|
614
|
+
collectPatterns(e, t) {
|
|
615
|
+
throw Error("Not supported!");
|
|
616
|
+
}
|
|
617
|
+
compile(e, t) {
|
|
618
|
+
throw Error("Not supported!");
|
|
619
|
+
}
|
|
620
|
+
compileAG(e, t, n, r) {
|
|
621
|
+
throw Error("Not supported!");
|
|
622
|
+
}
|
|
623
|
+
}, MatchRule = class extends Rule {
|
|
624
|
+
_match;
|
|
625
|
+
captures;
|
|
626
|
+
_cachedCompiledPatterns;
|
|
627
|
+
constructor(e, t, n, r, i) {
|
|
628
|
+
super(e, t, n, null), this._match = new RegExpSource(r, this.id), this.captures = i, 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(e, t) {
|
|
637
|
+
t.push(this._match);
|
|
638
|
+
}
|
|
639
|
+
compile(e, t) {
|
|
640
|
+
return this._getCachedCompiledPatterns(e).compile(e);
|
|
641
|
+
}
|
|
642
|
+
compileAG(e, t, n, r) {
|
|
643
|
+
return this._getCachedCompiledPatterns(e).compileAG(e, n, r);
|
|
644
|
+
}
|
|
645
|
+
_getCachedCompiledPatterns(e) {
|
|
646
|
+
return this._cachedCompiledPatterns || (this._cachedCompiledPatterns = new RegExpSourceList(), this.collectPatterns(e, this._cachedCompiledPatterns)), this._cachedCompiledPatterns;
|
|
647
|
+
}
|
|
648
|
+
}, IncludeOnlyRule = class extends Rule {
|
|
649
|
+
hasMissingPatterns;
|
|
650
|
+
patterns;
|
|
651
|
+
_cachedCompiledPatterns;
|
|
652
|
+
constructor(e, t, n, r, i) {
|
|
653
|
+
super(e, t, n, r), this.patterns = i.patterns, this.hasMissingPatterns = i.hasMissingPatterns, this._cachedCompiledPatterns = null;
|
|
654
|
+
}
|
|
655
|
+
dispose() {
|
|
656
|
+
this._cachedCompiledPatterns &&= (this._cachedCompiledPatterns.dispose(), null);
|
|
657
|
+
}
|
|
658
|
+
collectPatterns(e, t) {
|
|
659
|
+
for (let n of this.patterns) e.getRule(n).collectPatterns(e, t);
|
|
660
|
+
}
|
|
661
|
+
compile(e, t) {
|
|
662
|
+
return this._getCachedCompiledPatterns(e).compile(e);
|
|
663
|
+
}
|
|
664
|
+
compileAG(e, t, n, r) {
|
|
665
|
+
return this._getCachedCompiledPatterns(e).compileAG(e, n, r);
|
|
666
|
+
}
|
|
667
|
+
_getCachedCompiledPatterns(e) {
|
|
668
|
+
return this._cachedCompiledPatterns || (this._cachedCompiledPatterns = new RegExpSourceList(), this.collectPatterns(e, 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(e, t, n, r, i, a, o, s, c, l) {
|
|
681
|
+
super(e, t, n, r), this._begin = new RegExpSource(i, this.id), this.beginCaptures = a, this._end = new RegExpSource(o || "", -1), this.endHasBackReferences = this._end.hasBackReferences, this.endCaptures = s, this.applyEndPatternLast = c || !1, this.patterns = l.patterns, this.hasMissingPatterns = l.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(e, t) {
|
|
693
|
+
return this._end.resolveBackReferences(e, t);
|
|
694
|
+
}
|
|
695
|
+
collectPatterns(e, t) {
|
|
696
|
+
t.push(this._begin);
|
|
697
|
+
}
|
|
698
|
+
compile(e, t) {
|
|
699
|
+
return this._getCachedCompiledPatterns(e, t).compile(e);
|
|
700
|
+
}
|
|
701
|
+
compileAG(e, t, n, r) {
|
|
702
|
+
return this._getCachedCompiledPatterns(e, t).compileAG(e, n, r);
|
|
703
|
+
}
|
|
704
|
+
_getCachedCompiledPatterns(e, t) {
|
|
705
|
+
if (!this._cachedCompiledPatterns) {
|
|
706
|
+
this._cachedCompiledPatterns = new RegExpSourceList();
|
|
707
|
+
for (let t of this.patterns) e.getRule(t).collectPatterns(e, 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, t) : this._cachedCompiledPatterns.setSource(0, t)), 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(e, t, n, r, i, a, o, s, c) {
|
|
723
|
+
super(e, t, n, r), this._begin = new RegExpSource(i, this.id), this.beginCaptures = a, this.whileCaptures = s, this._while = new RegExpSource(o, whileRuleId), this.whileHasBackReferences = this._while.hasBackReferences, this.patterns = c.patterns, this.hasMissingPatterns = c.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(e, t) {
|
|
735
|
+
return this._while.resolveBackReferences(e, t);
|
|
736
|
+
}
|
|
737
|
+
collectPatterns(e, t) {
|
|
738
|
+
t.push(this._begin);
|
|
739
|
+
}
|
|
740
|
+
compile(e, t) {
|
|
741
|
+
return this._getCachedCompiledPatterns(e).compile(e);
|
|
742
|
+
}
|
|
743
|
+
compileAG(e, t, n, r) {
|
|
744
|
+
return this._getCachedCompiledPatterns(e).compileAG(e, n, r);
|
|
745
|
+
}
|
|
746
|
+
_getCachedCompiledPatterns(e) {
|
|
747
|
+
if (!this._cachedCompiledPatterns) {
|
|
748
|
+
this._cachedCompiledPatterns = new RegExpSourceList();
|
|
749
|
+
for (let t of this.patterns) e.getRule(t).collectPatterns(e, this._cachedCompiledPatterns);
|
|
750
|
+
}
|
|
751
|
+
return this._cachedCompiledPatterns;
|
|
752
|
+
}
|
|
753
|
+
compileWhile(e, t) {
|
|
754
|
+
return this._getCachedCompiledWhilePatterns(e, t).compile(e);
|
|
755
|
+
}
|
|
756
|
+
compileWhileAG(e, t, n, r) {
|
|
757
|
+
return this._getCachedCompiledWhilePatterns(e, t).compileAG(e, n, r);
|
|
758
|
+
}
|
|
759
|
+
_getCachedCompiledWhilePatterns(e, t) {
|
|
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, t || ""), this._cachedCompiledWhilePatterns;
|
|
761
|
+
}
|
|
762
|
+
}, RuleFactory = class e {
|
|
763
|
+
static createCaptureRule(e, t, n, r, i) {
|
|
764
|
+
return e.registerRule((e) => new CaptureRule(t, e, n, r, i));
|
|
765
|
+
}
|
|
766
|
+
static getCompiledRuleId(t, n, r) {
|
|
767
|
+
return t.id || n.registerRule((i) => {
|
|
768
|
+
if (t.id = i, t.match) return new MatchRule(t.$vscodeTextmateLocation, t.id, t.name, t.match, e._compileCaptures(t.captures, n, r));
|
|
769
|
+
if (t.begin === void 0) {
|
|
770
|
+
t.repository && (r = mergeObjects({}, r, t.repository));
|
|
771
|
+
let i = t.patterns;
|
|
772
|
+
return i === void 0 && t.include && (i = [{ include: t.include }]), new IncludeOnlyRule(t.$vscodeTextmateLocation, t.id, t.name, t.contentName, e._compilePatterns(i, n, r));
|
|
773
|
+
}
|
|
774
|
+
return t.while ? new BeginWhileRule(t.$vscodeTextmateLocation, t.id, t.name, t.contentName, t.begin, e._compileCaptures(t.beginCaptures || t.captures, n, r), t.while, e._compileCaptures(t.whileCaptures || t.captures, n, r), e._compilePatterns(t.patterns, n, r)) : new BeginEndRule(t.$vscodeTextmateLocation, t.id, t.name, t.contentName, t.begin, e._compileCaptures(t.beginCaptures || t.captures, n, r), t.end, e._compileCaptures(t.endCaptures || t.captures, n, r), t.applyEndPatternLast, e._compilePatterns(t.patterns, n, r));
|
|
775
|
+
}), t.id;
|
|
776
|
+
}
|
|
777
|
+
static _compileCaptures(t, n, r) {
|
|
778
|
+
let i = [];
|
|
779
|
+
if (t) {
|
|
780
|
+
let a = 0;
|
|
781
|
+
for (let e in t) {
|
|
782
|
+
if (e === "$vscodeTextmateLocation") continue;
|
|
783
|
+
let t = parseInt(e, 10);
|
|
784
|
+
t > a && (a = t);
|
|
785
|
+
}
|
|
786
|
+
for (let e = 0; e <= a; e++) i[e] = null;
|
|
787
|
+
for (let a in t) {
|
|
788
|
+
if (a === "$vscodeTextmateLocation") continue;
|
|
789
|
+
let o = parseInt(a, 10), s = 0;
|
|
790
|
+
t[a].patterns && (s = e.getCompiledRuleId(t[a], n, r)), i[o] = e.createCaptureRule(n, t[a].$vscodeTextmateLocation, t[a].name, t[a].contentName, s);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
return i;
|
|
794
|
+
}
|
|
795
|
+
static _compilePatterns(t, n, r) {
|
|
796
|
+
let i = [];
|
|
797
|
+
if (t) for (let a = 0, o = t.length; a < o; a++) {
|
|
798
|
+
let o = t[a], s = -1;
|
|
799
|
+
if (o.include) {
|
|
800
|
+
let t = parseInclude(o.include);
|
|
801
|
+
switch (t.kind) {
|
|
802
|
+
case 0:
|
|
803
|
+
case 1:
|
|
804
|
+
s = e.getCompiledRuleId(r[o.include], n, r);
|
|
805
|
+
break;
|
|
806
|
+
case 2:
|
|
807
|
+
let i = r[t.ruleName];
|
|
808
|
+
i && (s = e.getCompiledRuleId(i, n, r));
|
|
809
|
+
break;
|
|
810
|
+
case 3:
|
|
811
|
+
case 4:
|
|
812
|
+
let a = t.scopeName, c = t.kind === 4 ? t.ruleName : null, l = n.getExternalGrammar(a, r);
|
|
813
|
+
if (l) if (c) {
|
|
814
|
+
let t = l.repository[c];
|
|
815
|
+
t && (s = e.getCompiledRuleId(t, n, l.repository));
|
|
816
|
+
} else s = e.getCompiledRuleId(l.repository.$self, n, l.repository);
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
} else s = e.getCompiledRuleId(o, n, r);
|
|
820
|
+
if (s !== -1) {
|
|
821
|
+
let e = n.getRule(s), t = !1;
|
|
822
|
+
if ((e instanceof IncludeOnlyRule || e instanceof BeginEndRule || e instanceof BeginWhileRule) && e.hasMissingPatterns && e.patterns.length === 0 && (t = !0), t) continue;
|
|
823
|
+
i.push(s);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
return {
|
|
827
|
+
patterns: i,
|
|
828
|
+
hasMissingPatterns: (t ? t.length : 0) !== i.length
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
}, RegExpSource = class e {
|
|
832
|
+
source;
|
|
833
|
+
ruleId;
|
|
834
|
+
hasAnchor;
|
|
835
|
+
hasBackReferences;
|
|
836
|
+
_anchorCache;
|
|
837
|
+
constructor(e, t) {
|
|
838
|
+
if (e && typeof e == "string") {
|
|
839
|
+
let t = e.length, n = 0, r = [], i = !1;
|
|
840
|
+
for (let a = 0; a < t; a++) if (e.charAt(a) === "\\" && a + 1 < t) {
|
|
841
|
+
let t = e.charAt(a + 1);
|
|
842
|
+
t === "z" ? (r.push(e.substring(n, a)), r.push("$(?!\\n)(?<!\\n)"), n = a + 2) : (t === "A" || t === "G") && (i = !0), a++;
|
|
843
|
+
}
|
|
844
|
+
this.hasAnchor = i, n === 0 ? this.source = e : (r.push(e.substring(n, t)), this.source = r.join(""));
|
|
845
|
+
} else this.hasAnchor = !1, this.source = e;
|
|
846
|
+
this.hasAnchor ? this._anchorCache = this._buildAnchorCache() : this._anchorCache = null, this.ruleId = t, typeof this.source == "string" ? this.hasBackReferences = HAS_BACK_REFERENCES.test(this.source) : this.hasBackReferences = !1;
|
|
847
|
+
}
|
|
848
|
+
clone() {
|
|
849
|
+
return new e(this.source, this.ruleId);
|
|
850
|
+
}
|
|
851
|
+
setSource(e) {
|
|
852
|
+
this.source !== e && (this.source = e, this.hasAnchor && (this._anchorCache = this._buildAnchorCache()));
|
|
853
|
+
}
|
|
854
|
+
resolveBackReferences(e, t) {
|
|
855
|
+
if (typeof this.source != "string") throw Error("This method should only be called if the source is a string");
|
|
856
|
+
let n = t.map((t) => e.substring(t.start, t.end));
|
|
857
|
+
return BACK_REFERENCING_END.lastIndex = 0, this.source.replace(BACK_REFERENCING_END, (e, t) => escapeRegExpCharacters(n[parseInt(t, 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 e = [], t = [], n = [], r = [], i, a, o, s;
|
|
862
|
+
for (i = 0, a = this.source.length; i < a; i++) o = this.source.charAt(i), e[i] = o, t[i] = o, n[i] = o, r[i] = o, o === "\\" && i + 1 < a && (s = this.source.charAt(i + 1), s === "A" ? (e[i + 1] = "", t[i + 1] = "", n[i + 1] = "A", r[i + 1] = "A") : s === "G" ? (e[i + 1] = "", t[i + 1] = "G", n[i + 1] = "", r[i + 1] = "G") : (e[i + 1] = s, t[i + 1] = s, n[i + 1] = s, r[i + 1] = s), i++);
|
|
863
|
+
return {
|
|
864
|
+
A0_G0: e.join(""),
|
|
865
|
+
A0_G1: t.join(""),
|
|
866
|
+
A1_G0: n.join(""),
|
|
867
|
+
A1_G1: r.join("")
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
resolveAnchors(e, t) {
|
|
871
|
+
return !this.hasAnchor || !this._anchorCache || typeof this.source != "string" ? this.source : e ? t ? this._anchorCache.A1_G1 : this._anchorCache.A1_G0 : t ? 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(e) {
|
|
893
|
+
this._items.push(e), this._hasAnchors = this._hasAnchors || e.hasAnchor;
|
|
894
|
+
}
|
|
895
|
+
unshift(e) {
|
|
896
|
+
this._items.unshift(e), this._hasAnchors = this._hasAnchors || e.hasAnchor;
|
|
897
|
+
}
|
|
898
|
+
length() {
|
|
899
|
+
return this._items.length;
|
|
900
|
+
}
|
|
901
|
+
setSource(e, t) {
|
|
902
|
+
this._items[e].source !== t && (this._disposeCaches(), this._items[e].setSource(t));
|
|
903
|
+
}
|
|
904
|
+
compile(e) {
|
|
905
|
+
return this._cached ||= new CompiledRule(e, this._items.map((e) => e.source), this._items.map((e) => e.ruleId)), this._cached;
|
|
906
|
+
}
|
|
907
|
+
compileAG(e, t, n) {
|
|
908
|
+
return this._hasAnchors ? t ? n ? (this._anchorCache.A1_G1 || (this._anchorCache.A1_G1 = this._resolveAnchors(e, t, n)), this._anchorCache.A1_G1) : (this._anchorCache.A1_G0 || (this._anchorCache.A1_G0 = this._resolveAnchors(e, t, n)), this._anchorCache.A1_G0) : n ? (this._anchorCache.A0_G1 || (this._anchorCache.A0_G1 = this._resolveAnchors(e, t, n)), this._anchorCache.A0_G1) : (this._anchorCache.A0_G0 || (this._anchorCache.A0_G0 = this._resolveAnchors(e, t, n)), this._anchorCache.A0_G0) : this.compile(e);
|
|
909
|
+
}
|
|
910
|
+
_resolveAnchors(e, t, n) {
|
|
911
|
+
return new CompiledRule(e, this._items.map((e) => e.resolveAnchors(t, n)), this._items.map((e) => e.ruleId));
|
|
912
|
+
}
|
|
913
|
+
}, CompiledRule = class {
|
|
914
|
+
constructor(e, t, n) {
|
|
915
|
+
this.regExps = t, this.rules = n, this.scanner = e.createOnigScanner(t);
|
|
916
|
+
}
|
|
917
|
+
scanner;
|
|
918
|
+
dispose() {
|
|
919
|
+
typeof this.scanner.dispose == "function" && this.scanner.dispose();
|
|
920
|
+
}
|
|
921
|
+
toString() {
|
|
922
|
+
let e = [];
|
|
923
|
+
for (let t = 0, n = this.rules.length; t < n; t++) e.push(" - " + this.rules[t] + ": " + this.regExps[t]);
|
|
924
|
+
return e.join("\n");
|
|
925
|
+
}
|
|
926
|
+
findNextMatchSync(e, t, n) {
|
|
927
|
+
let r = this.scanner.findNextMatchSync(e, t, n);
|
|
928
|
+
return r ? {
|
|
929
|
+
ruleId: this.rules[r.index],
|
|
930
|
+
captureIndices: r.captureIndices
|
|
931
|
+
} : null;
|
|
932
|
+
}
|
|
933
|
+
}, BasicScopeAttributes = class {
|
|
934
|
+
constructor(e, t) {
|
|
935
|
+
this.languageId = e, this.tokenType = t;
|
|
936
|
+
}
|
|
937
|
+
}, BasicScopeAttributesProvider = class e {
|
|
938
|
+
_defaultAttributes;
|
|
939
|
+
_embeddedLanguagesMatcher;
|
|
940
|
+
constructor(e, t) {
|
|
941
|
+
this._defaultAttributes = new BasicScopeAttributes(e, 8), this._embeddedLanguagesMatcher = new ScopeMatcher(Object.entries(t || {}));
|
|
942
|
+
}
|
|
943
|
+
getDefaultAttributes() {
|
|
944
|
+
return this._defaultAttributes;
|
|
945
|
+
}
|
|
946
|
+
getBasicScopeAttributes(t) {
|
|
947
|
+
return t === null ? e._NULL_SCOPE_METADATA : this._getBasicScopeAttributes.get(t);
|
|
948
|
+
}
|
|
949
|
+
static _NULL_SCOPE_METADATA = new BasicScopeAttributes(0, 0);
|
|
950
|
+
_getBasicScopeAttributes = new CachedFn((e) => new BasicScopeAttributes(this._scopeToLanguage(e), this._toStandardTokenType(e)));
|
|
951
|
+
_scopeToLanguage(e) {
|
|
952
|
+
return this._embeddedLanguagesMatcher.match(e) || 0;
|
|
953
|
+
}
|
|
954
|
+
_toStandardTokenType(t) {
|
|
955
|
+
let n = t.match(e.STANDARD_TOKEN_TYPE_REGEXP);
|
|
956
|
+
if (!n) return 8;
|
|
957
|
+
switch (n[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(e) {
|
|
970
|
+
if (e.length === 0) this.values = null, this.scopesRegExp = null;
|
|
971
|
+
else {
|
|
972
|
+
this.values = new Map(e);
|
|
973
|
+
let t = e.map(([e, t]) => escapeRegExpCharacters(e));
|
|
974
|
+
t.sort(), t.reverse(), this.scopesRegExp = RegExp(`^((${t.join(")|(")}))($|\\.)`, "");
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
match(e) {
|
|
978
|
+
if (!this.scopesRegExp) return;
|
|
979
|
+
let t = e.match(this.scopesRegExp);
|
|
980
|
+
if (t) return this.values.get(t[1]);
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
typeof process < "u" && process.env.VSCODE_TEXTMATE_DEBUG;
|
|
984
|
+
var UseOnigurumaFindOptions = !1, TokenizeStringResult = class {
|
|
985
|
+
constructor(e, t) {
|
|
986
|
+
this.stack = e, this.stoppedEarly = t;
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
function _tokenizeString(e, t, n, r, i, a, o, s) {
|
|
990
|
+
let c = t.content.length, l = !1, u = -1;
|
|
991
|
+
if (o) {
|
|
992
|
+
let o = _checkWhileConditions(e, t, n, r, i, a);
|
|
993
|
+
i = o.stack, r = o.linePos, n = o.isFirstLine, u = o.anchorPosition;
|
|
994
|
+
}
|
|
995
|
+
let d = Date.now();
|
|
996
|
+
for (; !l;) {
|
|
997
|
+
if (s !== 0 && Date.now() - d > s) return new TokenizeStringResult(i, !0);
|
|
998
|
+
f();
|
|
999
|
+
}
|
|
1000
|
+
return new TokenizeStringResult(i, !1);
|
|
1001
|
+
function f() {
|
|
1002
|
+
let o = matchRuleOrInjections(e, t, n, r, i, u);
|
|
1003
|
+
if (!o) {
|
|
1004
|
+
a.produce(i, c), l = !0;
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
let s = o.captureIndices, d = o.matchedRuleId, f = s && s.length > 0 ? s[0].end > r : !1;
|
|
1008
|
+
if (d === endRuleId) {
|
|
1009
|
+
let o = i.getRule(e);
|
|
1010
|
+
a.produce(i, s[0].start), i = i.withContentNameScopesList(i.nameScopesList), handleCaptures(e, t, n, i, a, o.endCaptures, s), a.produce(i, s[0].end);
|
|
1011
|
+
let d = i;
|
|
1012
|
+
if (i = i.parent, u = d.getAnchorPos(), !f && d.getEnterPos() === r) {
|
|
1013
|
+
i = d, a.produce(i, c), l = !0;
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
} else {
|
|
1017
|
+
let o = e.getRule(d);
|
|
1018
|
+
a.produce(i, s[0].start);
|
|
1019
|
+
let m = i, h = o.getName(t.content, s), g = i.contentNameScopesList.pushAttributed(h, e);
|
|
1020
|
+
if (i = i.push(d, r, u, s[0].end === c, null, g, g), o instanceof BeginEndRule) {
|
|
1021
|
+
let r = o;
|
|
1022
|
+
handleCaptures(e, t, n, i, a, r.beginCaptures, s), a.produce(i, s[0].end), u = s[0].end;
|
|
1023
|
+
let d = r.getContentName(t.content, s), h = g.pushAttributed(d, e);
|
|
1024
|
+
if (i = i.withContentNameScopesList(h), r.endHasBackReferences && (i = i.withEndRule(r.getEndWithResolvedBackReferences(t.content, s))), !f && m.hasSameRuleAs(i)) {
|
|
1025
|
+
i = i.pop(), a.produce(i, c), l = !0;
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
} else if (o instanceof BeginWhileRule) {
|
|
1029
|
+
let r = o;
|
|
1030
|
+
handleCaptures(e, t, n, i, a, r.beginCaptures, s), a.produce(i, s[0].end), u = s[0].end;
|
|
1031
|
+
let d = r.getContentName(t.content, s), h = g.pushAttributed(d, e);
|
|
1032
|
+
if (i = i.withContentNameScopesList(h), r.whileHasBackReferences && (i = i.withEndRule(r.getWhileWithResolvedBackReferences(t.content, s))), !f && m.hasSameRuleAs(i)) {
|
|
1033
|
+
i = i.pop(), a.produce(i, c), l = !0;
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
} else if (handleCaptures(e, t, n, i, a, o.captures, s), a.produce(i, s[0].end), i = i.pop(), !f) {
|
|
1037
|
+
i = i.safePop(), a.produce(i, c), l = !0;
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
s[0].end > r && (r = s[0].end, n = !1);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
function _checkWhileConditions(e, t, n, r, i, a) {
|
|
1045
|
+
let o = i.beginRuleCapturedEOL ? 0 : -1, s = [];
|
|
1046
|
+
for (let t = i; t; t = t.pop()) {
|
|
1047
|
+
let n = t.getRule(e);
|
|
1048
|
+
n instanceof BeginWhileRule && s.push({
|
|
1049
|
+
rule: n,
|
|
1050
|
+
stack: t
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
for (let c = s.pop(); c; c = s.pop()) {
|
|
1054
|
+
let { ruleScanner: s, findOptions: l } = prepareRuleWhileSearch(c.rule, e, c.stack.endRule, n, r === o), u = s.findNextMatchSync(t, r, l);
|
|
1055
|
+
if (u) {
|
|
1056
|
+
if (u.ruleId !== whileRuleId) {
|
|
1057
|
+
i = c.stack.pop();
|
|
1058
|
+
break;
|
|
1059
|
+
}
|
|
1060
|
+
u.captureIndices && u.captureIndices.length && (a.produce(c.stack, u.captureIndices[0].start), handleCaptures(e, t, n, c.stack, a, c.rule.whileCaptures, u.captureIndices), a.produce(c.stack, u.captureIndices[0].end), o = u.captureIndices[0].end, u.captureIndices[0].end > r && (r = u.captureIndices[0].end, n = !1));
|
|
1061
|
+
} else {
|
|
1062
|
+
i = c.stack.pop();
|
|
1063
|
+
break;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
return {
|
|
1067
|
+
stack: i,
|
|
1068
|
+
linePos: r,
|
|
1069
|
+
anchorPosition: o,
|
|
1070
|
+
isFirstLine: n
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
function matchRuleOrInjections(e, t, n, r, i, a) {
|
|
1074
|
+
let o = matchRule(e, t, n, r, i, a), s = e.getInjections();
|
|
1075
|
+
if (s.length === 0) return o;
|
|
1076
|
+
let c = matchInjections(s, e, t, n, r, i, a);
|
|
1077
|
+
if (!c) return o;
|
|
1078
|
+
if (!o) return c;
|
|
1079
|
+
let l = o.captureIndices[0].start, u = c.captureIndices[0].start;
|
|
1080
|
+
return u < l || c.priorityMatch && u === l ? c : o;
|
|
1081
|
+
}
|
|
1082
|
+
function matchRule(e, t, n, r, i, a) {
|
|
1083
|
+
let { ruleScanner: o, findOptions: s } = prepareRuleSearch(i.getRule(e), e, i.endRule, n, r === a), c = o.findNextMatchSync(t, r, s);
|
|
1084
|
+
return c ? {
|
|
1085
|
+
captureIndices: c.captureIndices,
|
|
1086
|
+
matchedRuleId: c.ruleId
|
|
1087
|
+
} : null;
|
|
1088
|
+
}
|
|
1089
|
+
function matchInjections(e, t, n, r, i, a, o) {
|
|
1090
|
+
let s = Number.MAX_VALUE, c = null, l, u = 0, d = a.contentNameScopesList.getScopeNames();
|
|
1091
|
+
for (let a = 0, f = e.length; a < f; a++) {
|
|
1092
|
+
let f = e[a];
|
|
1093
|
+
if (!f.matcher(d)) continue;
|
|
1094
|
+
let { ruleScanner: m, findOptions: h } = prepareRuleSearch(t.getRule(f.ruleId), t, null, r, i === o), g = m.findNextMatchSync(n, i, h);
|
|
1095
|
+
if (!g) continue;
|
|
1096
|
+
let _ = g.captureIndices[0].start;
|
|
1097
|
+
if (!(_ >= s) && (s = _, c = g.captureIndices, l = g.ruleId, u = f.priority, s === i)) break;
|
|
1098
|
+
}
|
|
1099
|
+
return c ? {
|
|
1100
|
+
priorityMatch: u === -1,
|
|
1101
|
+
captureIndices: c,
|
|
1102
|
+
matchedRuleId: l
|
|
1103
|
+
} : null;
|
|
1104
|
+
}
|
|
1105
|
+
function prepareRuleSearch(e, t, n, r, i) {
|
|
1106
|
+
return UseOnigurumaFindOptions ? {
|
|
1107
|
+
ruleScanner: e.compile(t, n),
|
|
1108
|
+
findOptions: getFindOptions(r, i)
|
|
1109
|
+
} : {
|
|
1110
|
+
ruleScanner: e.compileAG(t, n, r, i),
|
|
1111
|
+
findOptions: 0
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
function prepareRuleWhileSearch(e, t, n, r, i) {
|
|
1115
|
+
return UseOnigurumaFindOptions ? {
|
|
1116
|
+
ruleScanner: e.compileWhile(t, n),
|
|
1117
|
+
findOptions: getFindOptions(r, i)
|
|
1118
|
+
} : {
|
|
1119
|
+
ruleScanner: e.compileWhileAG(t, n, r, i),
|
|
1120
|
+
findOptions: 0
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
function getFindOptions(e, t) {
|
|
1124
|
+
let n = 0;
|
|
1125
|
+
return e || (n |= 1), t || (n |= 4), n;
|
|
1126
|
+
}
|
|
1127
|
+
function handleCaptures(e, t, n, r, i, a, o) {
|
|
1128
|
+
if (a.length === 0) return;
|
|
1129
|
+
let s = t.content, c = Math.min(a.length, o.length), l = [], u = o[0].end;
|
|
1130
|
+
for (let t = 0; t < c; t++) {
|
|
1131
|
+
let c = a[t];
|
|
1132
|
+
if (c === null) continue;
|
|
1133
|
+
let d = o[t];
|
|
1134
|
+
if (d.length === 0) continue;
|
|
1135
|
+
if (d.start > u) break;
|
|
1136
|
+
for (; l.length > 0 && l[l.length - 1].endPos <= d.start;) i.produceFromScopes(l[l.length - 1].scopes, l[l.length - 1].endPos), l.pop();
|
|
1137
|
+
if (l.length > 0 ? i.produceFromScopes(l[l.length - 1].scopes, d.start) : i.produce(r, d.start), c.retokenizeCapturedWithRuleId) {
|
|
1138
|
+
let t = c.getName(s, o), a = r.contentNameScopesList.pushAttributed(t, e), l = c.getContentName(s, o), u = a.pushAttributed(l, e), f = r.push(c.retokenizeCapturedWithRuleId, d.start, -1, !1, null, a, u), m = e.createOnigString(s.substring(0, d.end));
|
|
1139
|
+
_tokenizeString(e, m, n && d.start === 0, d.start, f, i, !1, 0), disposeOnigString(m);
|
|
1140
|
+
continue;
|
|
1141
|
+
}
|
|
1142
|
+
let f = c.getName(s, o);
|
|
1143
|
+
if (f !== null) {
|
|
1144
|
+
let t = (l.length > 0 ? l[l.length - 1].scopes : r.contentNameScopesList).pushAttributed(f, e);
|
|
1145
|
+
l.push(new LocalStackElement(t, d.end));
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
for (; l.length > 0;) i.produceFromScopes(l[l.length - 1].scopes, l[l.length - 1].endPos), l.pop();
|
|
1149
|
+
}
|
|
1150
|
+
var LocalStackElement = class {
|
|
1151
|
+
scopes;
|
|
1152
|
+
endPos;
|
|
1153
|
+
constructor(e, t) {
|
|
1154
|
+
this.scopes = e, this.endPos = t;
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
function createGrammar(e, t, n, r, i, a, o, s) {
|
|
1158
|
+
return new Grammar(e, t, n, r, i, a, o, s);
|
|
1159
|
+
}
|
|
1160
|
+
function collectInjections(e, t, n, r, i) {
|
|
1161
|
+
let a = createMatchers(t, nameMatcher), o = RuleFactory.getCompiledRuleId(n, r, i.repository);
|
|
1162
|
+
for (let n of a) e.push({
|
|
1163
|
+
debugSelector: t,
|
|
1164
|
+
matcher: n.matcher,
|
|
1165
|
+
ruleId: o,
|
|
1166
|
+
grammar: i,
|
|
1167
|
+
priority: n.priority
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
function nameMatcher(e, t) {
|
|
1171
|
+
if (t.length < e.length) return !1;
|
|
1172
|
+
let n = 0;
|
|
1173
|
+
return e.every((e) => {
|
|
1174
|
+
for (let r = n; r < t.length; r++) if (scopesAreMatching(t[r], e)) return n = r + 1, !0;
|
|
1175
|
+
return !1;
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
function scopesAreMatching(e, t) {
|
|
1179
|
+
if (!e) return !1;
|
|
1180
|
+
if (e === t) return !0;
|
|
1181
|
+
let n = t.length;
|
|
1182
|
+
return e.length > n && e.substr(0, n) === t && e[n] === ".";
|
|
1183
|
+
}
|
|
1184
|
+
var Grammar = class {
|
|
1185
|
+
constructor(e, t, n, r, i, a, o, s) {
|
|
1186
|
+
if (this._rootScopeName = e, this.balancedBracketSelectors = a, this._onigLib = s, this._basicScopeAttributesProvider = new BasicScopeAttributesProvider(n, r), this._rootId = -1, this._lastRuleId = 0, this._ruleId2desc = [null], this._includedGrammars = {}, this._grammarRepository = o, this._grammar = initGrammar(t, null), this._injections = null, this._tokenTypeMatchers = [], i) for (let e of Object.keys(i)) {
|
|
1187
|
+
let t = createMatchers(e, nameMatcher);
|
|
1188
|
+
for (let n of t) this._tokenTypeMatchers.push({
|
|
1189
|
+
matcher: n.matcher,
|
|
1190
|
+
type: i[e]
|
|
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 e of this._ruleId2desc) e && e.dispose();
|
|
1208
|
+
}
|
|
1209
|
+
createOnigScanner(e) {
|
|
1210
|
+
return this._onigLib.createOnigScanner(e);
|
|
1211
|
+
}
|
|
1212
|
+
createOnigString(e) {
|
|
1213
|
+
return this._onigLib.createOnigString(e);
|
|
1214
|
+
}
|
|
1215
|
+
getMetadataForScope(e) {
|
|
1216
|
+
return this._basicScopeAttributesProvider.getBasicScopeAttributes(e);
|
|
1217
|
+
}
|
|
1218
|
+
_collectInjections() {
|
|
1219
|
+
let e = {
|
|
1220
|
+
lookup: (e) => e === this._rootScopeName ? this._grammar : this.getExternalGrammar(e),
|
|
1221
|
+
injections: (e) => this._grammarRepository.injections(e)
|
|
1222
|
+
}, t = [], n = this._rootScopeName, r = e.lookup(n);
|
|
1223
|
+
if (r) {
|
|
1224
|
+
let e = r.injections;
|
|
1225
|
+
if (e) for (let n in e) collectInjections(t, n, e[n], this, r);
|
|
1226
|
+
let i = this._grammarRepository.injections(n);
|
|
1227
|
+
i && i.forEach((e) => {
|
|
1228
|
+
let n = this.getExternalGrammar(e);
|
|
1229
|
+
if (n) {
|
|
1230
|
+
let e = n.injectionSelector;
|
|
1231
|
+
e && collectInjections(t, e, n, this, n);
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
return t.sort((e, t) => e.priority - t.priority), t;
|
|
1236
|
+
}
|
|
1237
|
+
getInjections() {
|
|
1238
|
+
return this._injections === null && (this._injections = this._collectInjections()), this._injections;
|
|
1239
|
+
}
|
|
1240
|
+
registerRule(e) {
|
|
1241
|
+
let t = ++this._lastRuleId, n = e(ruleIdFromNumber(t));
|
|
1242
|
+
return this._ruleId2desc[t] = n, n;
|
|
1243
|
+
}
|
|
1244
|
+
getRule(e) {
|
|
1245
|
+
return this._ruleId2desc[ruleIdToNumber(e)];
|
|
1246
|
+
}
|
|
1247
|
+
getExternalGrammar(e, t) {
|
|
1248
|
+
if (this._includedGrammars[e]) return this._includedGrammars[e];
|
|
1249
|
+
if (this._grammarRepository) {
|
|
1250
|
+
let n = this._grammarRepository.lookup(e);
|
|
1251
|
+
if (n) return this._includedGrammars[e] = initGrammar(n, t && t.$base), this._includedGrammars[e];
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
tokenizeLine(e, t, n = 0) {
|
|
1255
|
+
let r = this._tokenize(e, t, !1, n);
|
|
1256
|
+
return {
|
|
1257
|
+
tokens: r.lineTokens.getResult(r.ruleStack, r.lineLength),
|
|
1258
|
+
ruleStack: r.ruleStack,
|
|
1259
|
+
stoppedEarly: r.stoppedEarly
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
tokenizeLine2(e, t, n = 0) {
|
|
1263
|
+
let r = this._tokenize(e, t, !0, n);
|
|
1264
|
+
return {
|
|
1265
|
+
tokens: r.lineTokens.getBinaryResult(r.ruleStack, r.lineLength),
|
|
1266
|
+
ruleStack: r.ruleStack,
|
|
1267
|
+
stoppedEarly: r.stoppedEarly
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
_tokenize(e, t, n, r) {
|
|
1271
|
+
this._rootId === -1 && (this._rootId = RuleFactory.getCompiledRuleId(this._grammar.repository.$self, this, this._grammar.repository), this.getInjections());
|
|
1272
|
+
let i;
|
|
1273
|
+
if (!t || t === StateStackImpl.NULL) {
|
|
1274
|
+
i = !0;
|
|
1275
|
+
let e = this._basicScopeAttributesProvider.getDefaultAttributes(), n = this.themeProvider.getDefaults(), r = EncodedTokenMetadata.set(0, e.languageId, e.tokenType, null, n.fontStyle, n.foregroundId, n.backgroundId), a = this.getRule(this._rootId).getName(null, null), o;
|
|
1276
|
+
o = a ? AttributedScopeStack.createRootAndLookUpScopeName(a, r, this) : AttributedScopeStack.createRoot("unknown", r), t = new StateStackImpl(null, this._rootId, -1, -1, !1, null, o, o);
|
|
1277
|
+
} else i = !1, t.reset();
|
|
1278
|
+
e += "\n";
|
|
1279
|
+
let a = this.createOnigString(e), o = a.content.length, s = new LineTokens(n, e, this._tokenTypeMatchers, this.balancedBracketSelectors), c = _tokenizeString(this, a, i, 0, t, s, !0, r);
|
|
1280
|
+
return disposeOnigString(a), {
|
|
1281
|
+
lineLength: o,
|
|
1282
|
+
lineTokens: s,
|
|
1283
|
+
ruleStack: c.stack,
|
|
1284
|
+
stoppedEarly: c.stoppedEarly
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
};
|
|
1288
|
+
function initGrammar(e, t) {
|
|
1289
|
+
return e = clone(e), e.repository = e.repository || {}, e.repository.$self = {
|
|
1290
|
+
$vscodeTextmateLocation: e.$vscodeTextmateLocation,
|
|
1291
|
+
patterns: e.patterns,
|
|
1292
|
+
name: e.scopeName
|
|
1293
|
+
}, e.repository.$base = t || e.repository.$self, e;
|
|
1294
|
+
}
|
|
1295
|
+
var AttributedScopeStack = class e {
|
|
1296
|
+
constructor(e, t, n) {
|
|
1297
|
+
this.parent = e, this.scopePath = t, this.tokenAttributes = n;
|
|
1298
|
+
}
|
|
1299
|
+
static fromExtension(t, n) {
|
|
1300
|
+
let r = t, i = t?.scopePath ?? null;
|
|
1301
|
+
for (let t of n) i = ScopeStack.push(i, t.scopeNames), r = new e(r, i, t.encodedTokenAttributes);
|
|
1302
|
+
return r;
|
|
1303
|
+
}
|
|
1304
|
+
static createRoot(t, n) {
|
|
1305
|
+
return new e(null, new ScopeStack(null, t), n);
|
|
1306
|
+
}
|
|
1307
|
+
static createRootAndLookUpScopeName(t, n, r) {
|
|
1308
|
+
let i = r.getMetadataForScope(t), a = new ScopeStack(null, t), o = r.themeProvider.themeMatch(a);
|
|
1309
|
+
return new e(null, a, e.mergeAttributes(n, i, o));
|
|
1310
|
+
}
|
|
1311
|
+
get scopeName() {
|
|
1312
|
+
return this.scopePath.scopeName;
|
|
1313
|
+
}
|
|
1314
|
+
toString() {
|
|
1315
|
+
return this.getScopeNames().join(" ");
|
|
1316
|
+
}
|
|
1317
|
+
equals(t) {
|
|
1318
|
+
return e.equals(this, t);
|
|
1319
|
+
}
|
|
1320
|
+
static equals(e, t) {
|
|
1321
|
+
do {
|
|
1322
|
+
if (e === t || !e && !t) return !0;
|
|
1323
|
+
if (!e || !t || e.scopeName !== t.scopeName || e.tokenAttributes !== t.tokenAttributes) return !1;
|
|
1324
|
+
e = e.parent, t = t.parent;
|
|
1325
|
+
} while (!0);
|
|
1326
|
+
}
|
|
1327
|
+
static mergeAttributes(e, t, n) {
|
|
1328
|
+
let r = -1, i = 0, a = 0;
|
|
1329
|
+
return n !== null && (r = n.fontStyle, i = n.foregroundId, a = n.backgroundId), EncodedTokenMetadata.set(e, t.languageId, t.tokenType, null, r, i, a);
|
|
1330
|
+
}
|
|
1331
|
+
pushAttributed(t, n) {
|
|
1332
|
+
if (t === null) return this;
|
|
1333
|
+
if (t.indexOf(" ") === -1) return e._pushAttributed(this, t, n);
|
|
1334
|
+
let r = t.split(/ /g), i = this;
|
|
1335
|
+
for (let t of r) i = e._pushAttributed(i, t, n);
|
|
1336
|
+
return i;
|
|
1337
|
+
}
|
|
1338
|
+
static _pushAttributed(t, n, r) {
|
|
1339
|
+
let i = r.getMetadataForScope(n), a = t.scopePath.push(n), o = r.themeProvider.themeMatch(a);
|
|
1340
|
+
return new e(t, a, e.mergeAttributes(t.tokenAttributes, i, o));
|
|
1341
|
+
}
|
|
1342
|
+
getScopeNames() {
|
|
1343
|
+
return this.scopePath.getSegments();
|
|
1344
|
+
}
|
|
1345
|
+
getExtensionIfDefined(e) {
|
|
1346
|
+
let t = [], n = this;
|
|
1347
|
+
for (; n && n !== e;) t.push({
|
|
1348
|
+
encodedTokenAttributes: n.tokenAttributes,
|
|
1349
|
+
scopeNames: n.scopePath.getExtensionIfDefined(n.parent?.scopePath ?? null)
|
|
1350
|
+
}), n = n.parent;
|
|
1351
|
+
return n === e ? t.reverse() : void 0;
|
|
1352
|
+
}
|
|
1353
|
+
}, StateStackImpl = class e {
|
|
1354
|
+
constructor(e, t, n, r, i, a, o, s) {
|
|
1355
|
+
this.parent = e, this.ruleId = t, this.beginRuleCapturedEOL = i, this.endRule = a, this.nameScopesList = o, this.contentNameScopesList = s, this.depth = this.parent ? this.parent.depth + 1 : 1, this._enterPos = n, this._anchorPos = r;
|
|
1356
|
+
}
|
|
1357
|
+
_stackElementBrand = void 0;
|
|
1358
|
+
static NULL = new e(null, 0, 0, 0, !1, null, null, null);
|
|
1359
|
+
_enterPos;
|
|
1360
|
+
_anchorPos;
|
|
1361
|
+
depth;
|
|
1362
|
+
equals(t) {
|
|
1363
|
+
return t === null ? !1 : e._equals(this, t);
|
|
1364
|
+
}
|
|
1365
|
+
static _equals(e, t) {
|
|
1366
|
+
return e === t ? !0 : this._structuralEquals(e, t) ? AttributedScopeStack.equals(e.contentNameScopesList, t.contentNameScopesList) : !1;
|
|
1367
|
+
}
|
|
1368
|
+
static _structuralEquals(e, t) {
|
|
1369
|
+
do {
|
|
1370
|
+
if (e === t || !e && !t) return !0;
|
|
1371
|
+
if (!e || !t || e.depth !== t.depth || e.ruleId !== t.ruleId || e.endRule !== t.endRule) return !1;
|
|
1372
|
+
e = e.parent, t = t.parent;
|
|
1373
|
+
} while (!0);
|
|
1374
|
+
}
|
|
1375
|
+
clone() {
|
|
1376
|
+
return this;
|
|
1377
|
+
}
|
|
1378
|
+
static _reset(e) {
|
|
1379
|
+
for (; e;) e._enterPos = -1, e._anchorPos = -1, e = e.parent;
|
|
1380
|
+
}
|
|
1381
|
+
reset() {
|
|
1382
|
+
e._reset(this);
|
|
1383
|
+
}
|
|
1384
|
+
pop() {
|
|
1385
|
+
return this.parent;
|
|
1386
|
+
}
|
|
1387
|
+
safePop() {
|
|
1388
|
+
return this.parent ? this.parent : this;
|
|
1389
|
+
}
|
|
1390
|
+
push(t, n, r, i, a, o, s) {
|
|
1391
|
+
return new e(this, t, n, r, i, a, o, s);
|
|
1392
|
+
}
|
|
1393
|
+
getEnterPos() {
|
|
1394
|
+
return this._enterPos;
|
|
1395
|
+
}
|
|
1396
|
+
getAnchorPos() {
|
|
1397
|
+
return this._anchorPos;
|
|
1398
|
+
}
|
|
1399
|
+
getRule(e) {
|
|
1400
|
+
return e.getRule(this.ruleId);
|
|
1401
|
+
}
|
|
1402
|
+
toString() {
|
|
1403
|
+
let e = [];
|
|
1404
|
+
return this._writeString(e, 0), "[" + e.join(",") + "]";
|
|
1405
|
+
}
|
|
1406
|
+
_writeString(e, t) {
|
|
1407
|
+
return this.parent && (t = this.parent._writeString(e, t)), e[t++] = `(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`, t;
|
|
1408
|
+
}
|
|
1409
|
+
withContentNameScopesList(e) {
|
|
1410
|
+
return this.contentNameScopesList === e ? this : this.parent.push(this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, this.endRule, this.nameScopesList, e);
|
|
1411
|
+
}
|
|
1412
|
+
withEndRule(t) {
|
|
1413
|
+
return this.endRule === t ? this : new e(this.parent, this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, t, this.nameScopesList, this.contentNameScopesList);
|
|
1414
|
+
}
|
|
1415
|
+
hasSameRuleAs(e) {
|
|
1416
|
+
let t = this;
|
|
1417
|
+
for (; t && t._enterPos === e._enterPos;) {
|
|
1418
|
+
if (t.ruleId === e.ruleId) return !0;
|
|
1419
|
+
t = t.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(t, n) {
|
|
1433
|
+
let r = AttributedScopeStack.fromExtension(t?.nameScopesList ?? null, n.nameScopesList);
|
|
1434
|
+
return new e(t, ruleIdFromNumber(n.ruleId), n.enterPos ?? -1, n.anchorPos ?? -1, n.beginRuleCapturedEOL, n.endRule, r, AttributedScopeStack.fromExtension(r, n.contentNameScopesList));
|
|
1435
|
+
}
|
|
1436
|
+
}, BalancedBracketSelectors = class {
|
|
1437
|
+
balancedBracketScopes;
|
|
1438
|
+
unbalancedBracketScopes;
|
|
1439
|
+
allowAny = !1;
|
|
1440
|
+
constructor(e, t) {
|
|
1441
|
+
this.balancedBracketScopes = e.flatMap((e) => e === "*" ? (this.allowAny = !0, []) : createMatchers(e, nameMatcher).map((e) => e.matcher)), this.unbalancedBracketScopes = t.flatMap((e) => createMatchers(e, nameMatcher).map((e) => e.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(e) {
|
|
1450
|
+
for (let t of this.unbalancedBracketScopes) if (t(e)) return !1;
|
|
1451
|
+
for (let t of this.balancedBracketScopes) if (t(e)) return !0;
|
|
1452
|
+
return this.allowAny;
|
|
1453
|
+
}
|
|
1454
|
+
}, LineTokens = class {
|
|
1455
|
+
constructor(e, t, n, r) {
|
|
1456
|
+
this.balancedBracketSelectors = r, this._emitBinaryTokens = e, this._tokenTypeOverrides = n, 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(e, t) {
|
|
1465
|
+
this.produceFromScopes(e.contentNameScopesList, t);
|
|
1466
|
+
}
|
|
1467
|
+
produceFromScopes(e, t) {
|
|
1468
|
+
if (this._lastTokenEndIndex >= t) return;
|
|
1469
|
+
if (this._emitBinaryTokens) {
|
|
1470
|
+
let n = e?.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 t = e?.getScopeNames() ?? [];
|
|
1473
|
+
for (let e of this._tokenTypeOverrides) e.matcher(t) && (n = EncodedTokenMetadata.set(n, 0, toOptionalTokenType(e.type), null, -1, 0, 0));
|
|
1474
|
+
this.balancedBracketSelectors && (r = this.balancedBracketSelectors.match(t));
|
|
1475
|
+
}
|
|
1476
|
+
if (r && (n = EncodedTokenMetadata.set(n, 0, 8, r, -1, 0, 0)), this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 1] === n) {
|
|
1477
|
+
this._lastTokenEndIndex = t;
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
this._binaryTokens.push(this._lastTokenEndIndex), this._binaryTokens.push(n), this._lastTokenEndIndex = t;
|
|
1481
|
+
return;
|
|
1482
|
+
}
|
|
1483
|
+
let n = e?.getScopeNames() ?? [];
|
|
1484
|
+
this._tokens.push({
|
|
1485
|
+
startIndex: this._lastTokenEndIndex,
|
|
1486
|
+
endIndex: t,
|
|
1487
|
+
scopes: n
|
|
1488
|
+
}), this._lastTokenEndIndex = t;
|
|
1489
|
+
}
|
|
1490
|
+
getResult(e, t) {
|
|
1491
|
+
return this._tokens.length > 0 && this._tokens[this._tokens.length - 1].startIndex === t - 1 && this._tokens.pop(), this._tokens.length === 0 && (this._lastTokenEndIndex = -1, this.produce(e, t), this._tokens[this._tokens.length - 1].startIndex = 0), this._tokens;
|
|
1492
|
+
}
|
|
1493
|
+
getBinaryResult(e, t) {
|
|
1494
|
+
this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 2] === t - 1 && (this._binaryTokens.pop(), this._binaryTokens.pop()), this._binaryTokens.length === 0 && (this._lastTokenEndIndex = -1, this.produce(e, t), this._binaryTokens[this._binaryTokens.length - 2] = 0);
|
|
1495
|
+
let n = new Uint32Array(this._binaryTokens.length);
|
|
1496
|
+
for (let e = 0, t = this._binaryTokens.length; e < t; e++) n[e] = this._binaryTokens[e];
|
|
1497
|
+
return n;
|
|
1498
|
+
}
|
|
1499
|
+
}, SyncRegistry = class {
|
|
1500
|
+
constructor(e, t) {
|
|
1501
|
+
this._onigLib = t, this._theme = e;
|
|
1502
|
+
}
|
|
1503
|
+
_grammars = /* @__PURE__ */ new Map();
|
|
1504
|
+
_rawGrammars = /* @__PURE__ */ new Map();
|
|
1505
|
+
_injectionGrammars = /* @__PURE__ */ new Map();
|
|
1506
|
+
_theme;
|
|
1507
|
+
dispose() {
|
|
1508
|
+
for (let e of this._grammars.values()) e.dispose();
|
|
1509
|
+
}
|
|
1510
|
+
setTheme(e) {
|
|
1511
|
+
this._theme = e;
|
|
1512
|
+
}
|
|
1513
|
+
getColorMap() {
|
|
1514
|
+
return this._theme.getColorMap();
|
|
1515
|
+
}
|
|
1516
|
+
addGrammar(e, t) {
|
|
1517
|
+
this._rawGrammars.set(e.scopeName, e), t && this._injectionGrammars.set(e.scopeName, t);
|
|
1518
|
+
}
|
|
1519
|
+
lookup(e) {
|
|
1520
|
+
return this._rawGrammars.get(e);
|
|
1521
|
+
}
|
|
1522
|
+
injections(e) {
|
|
1523
|
+
return this._injectionGrammars.get(e);
|
|
1524
|
+
}
|
|
1525
|
+
getDefaults() {
|
|
1526
|
+
return this._theme.getDefaults();
|
|
1527
|
+
}
|
|
1528
|
+
themeMatch(e) {
|
|
1529
|
+
return this._theme.match(e);
|
|
1530
|
+
}
|
|
1531
|
+
grammarForScopeName(e, t, n, r, i) {
|
|
1532
|
+
if (!this._grammars.has(e)) {
|
|
1533
|
+
let a = this._rawGrammars.get(e);
|
|
1534
|
+
if (!a) return null;
|
|
1535
|
+
this._grammars.set(e, createGrammar(e, a, t, n, r, i, this, this._onigLib));
|
|
1536
|
+
}
|
|
1537
|
+
return this._grammars.get(e);
|
|
1538
|
+
}
|
|
1539
|
+
}, Registry$1 = class {
|
|
1540
|
+
_options;
|
|
1541
|
+
_syncRegistry;
|
|
1542
|
+
_ensureGrammarCache;
|
|
1543
|
+
constructor(e) {
|
|
1544
|
+
this._options = e, this._syncRegistry = new SyncRegistry(Theme.createFromRawTheme(e.theme, e.colorMap), e.onigLib), this._ensureGrammarCache = /* @__PURE__ */ new Map();
|
|
1545
|
+
}
|
|
1546
|
+
dispose() {
|
|
1547
|
+
this._syncRegistry.dispose();
|
|
1548
|
+
}
|
|
1549
|
+
setTheme(e, t) {
|
|
1550
|
+
this._syncRegistry.setTheme(Theme.createFromRawTheme(e, t));
|
|
1551
|
+
}
|
|
1552
|
+
getColorMap() {
|
|
1553
|
+
return this._syncRegistry.getColorMap();
|
|
1554
|
+
}
|
|
1555
|
+
loadGrammarWithEmbeddedLanguages(e, t, n) {
|
|
1556
|
+
return this.loadGrammarWithConfiguration(e, t, { embeddedLanguages: n });
|
|
1557
|
+
}
|
|
1558
|
+
loadGrammarWithConfiguration(e, t, n) {
|
|
1559
|
+
return this._loadGrammar(e, t, n.embeddedLanguages, n.tokenTypes, new BalancedBracketSelectors(n.balancedBracketSelectors || [], n.unbalancedBracketSelectors || []));
|
|
1560
|
+
}
|
|
1561
|
+
loadGrammar(e) {
|
|
1562
|
+
return this._loadGrammar(e, 0, null, null, null);
|
|
1563
|
+
}
|
|
1564
|
+
_loadGrammar(e, t, n, r, i) {
|
|
1565
|
+
let a = new ScopeDependencyProcessor(this._syncRegistry, e);
|
|
1566
|
+
for (; a.Q.length > 0;) a.Q.map((e) => this._loadSingleGrammar(e.scopeName)), a.processQueue();
|
|
1567
|
+
return this._grammarForScopeName(e, t, n, r, i);
|
|
1568
|
+
}
|
|
1569
|
+
_loadSingleGrammar(e) {
|
|
1570
|
+
this._ensureGrammarCache.has(e) || (this._doLoadSingleGrammar(e), this._ensureGrammarCache.set(e, !0));
|
|
1571
|
+
}
|
|
1572
|
+
_doLoadSingleGrammar(e) {
|
|
1573
|
+
let t = this._options.loadGrammar(e);
|
|
1574
|
+
if (t) {
|
|
1575
|
+
let n = typeof this._options.getInjections == "function" ? this._options.getInjections(e) : void 0;
|
|
1576
|
+
this._syncRegistry.addGrammar(t, n);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
addGrammar(e, t = [], n = 0, r = null) {
|
|
1580
|
+
return this._syncRegistry.addGrammar(e, t), this._grammarForScopeName(e.scopeName, n, r);
|
|
1581
|
+
}
|
|
1582
|
+
_grammarForScopeName(e, t = 0, n = null, r = null, i = null) {
|
|
1583
|
+
return this._syncRegistry.grammarForScopeName(e, t, n, r, i);
|
|
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(e, t, n) {
|
|
1610
|
+
this.normal = t, this.property = e, n && (this.space = n);
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
Schema.prototype.normal = {}, Schema.prototype.property = {}, Schema.prototype.space = void 0;
|
|
1614
|
+
function merge(e, t) {
|
|
1615
|
+
let n = {}, r = {};
|
|
1616
|
+
for (let t of e) Object.assign(n, t.property), Object.assign(r, t.normal);
|
|
1617
|
+
return new Schema(n, r, t);
|
|
1618
|
+
}
|
|
1619
|
+
function normalize(e) {
|
|
1620
|
+
return e.toLowerCase();
|
|
1621
|
+
}
|
|
1622
|
+
var Info = class {
|
|
1623
|
+
constructor(e, t) {
|
|
1624
|
+
this.attribute = t, this.property = e;
|
|
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__ */ __exportAll({
|
|
1629
|
+
boolean: () => boolean,
|
|
1630
|
+
booleanish: () => booleanish,
|
|
1631
|
+
commaOrSpaceSeparated: () => commaOrSpaceSeparated,
|
|
1632
|
+
commaSeparated: () => commaSeparated,
|
|
1633
|
+
number: () => number,
|
|
1634
|
+
overloadedBoolean: () => overloadedBoolean,
|
|
1635
|
+
spaceSeparated: () => spaceSeparated
|
|
1636
|
+
}), 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(e, t, n, r) {
|
|
1643
|
+
let i = -1;
|
|
1644
|
+
if (super(e, t), mark(this, "space", r), typeof n == "number") for (; ++i < checks.length;) {
|
|
1645
|
+
let e = checks[i];
|
|
1646
|
+
mark(this, checks[i], (n & types_exports[e]) === types_exports[e]);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1650
|
+
DefinedInfo.prototype.defined = !0;
|
|
1651
|
+
function mark(e, t, n) {
|
|
1652
|
+
n && (e[t] = n);
|
|
1653
|
+
}
|
|
1654
|
+
function create(e) {
|
|
1655
|
+
let t = {}, n = {};
|
|
1656
|
+
for (let [r, i] of Object.entries(e.properties)) {
|
|
1657
|
+
let a = new DefinedInfo(r, e.transform(e.attributes || {}, r), i, e.space);
|
|
1658
|
+
e.mustUseProperty && e.mustUseProperty.includes(r) && (a.mustUseProperty = !0), t[r] = a, n[normalize(r)] = r, n[normalize(a.attribute)] = r;
|
|
1659
|
+
}
|
|
1660
|
+
return new Schema(t, n, e.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(e, t) {
|
|
1715
|
+
return t === "role" ? t : "aria-" + t.slice(4).toLowerCase();
|
|
1716
|
+
}
|
|
1717
|
+
});
|
|
1718
|
+
function caseSensitiveTransform(e, t) {
|
|
1719
|
+
return t in e ? e[t] : t;
|
|
1720
|
+
}
|
|
1721
|
+
function caseInsensitiveTransform(e, t) {
|
|
1722
|
+
return caseSensitiveTransform(e, t.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(e, t) {
|
|
2600
|
+
return "xlink:" + t.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(e, t) {
|
|
2618
|
+
return "xml:" + t.slice(3).toLowerCase();
|
|
2619
|
+
}
|
|
2620
|
+
});
|
|
2621
|
+
var cap = /[A-Z]/g, dash = /-[a-z]/g, valid = /^data[-\w.:]+$/i;
|
|
2622
|
+
function find(e, t) {
|
|
2623
|
+
let n = normalize(t), r = t, i = Info;
|
|
2624
|
+
if (n in e.normal) return e.property[e.normal[n]];
|
|
2625
|
+
if (n.length > 4 && n.slice(0, 4) === "data" && valid.test(t)) {
|
|
2626
|
+
if (t.charAt(4) === "-") {
|
|
2627
|
+
let e = t.slice(5).replace(dash, camelcase);
|
|
2628
|
+
r = "data" + e.charAt(0).toUpperCase() + e.slice(1);
|
|
2629
|
+
} else {
|
|
2630
|
+
let e = t.slice(4);
|
|
2631
|
+
if (!dash.test(e)) {
|
|
2632
|
+
let n = e.replace(cap, kebab);
|
|
2633
|
+
n.charAt(0) !== "-" && (n = "-" + n), t = "data" + n;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
i = DefinedInfo;
|
|
2637
|
+
}
|
|
2638
|
+
return new i(r, t);
|
|
2639
|
+
}
|
|
2640
|
+
function kebab(e) {
|
|
2641
|
+
return "-" + e.toLowerCase();
|
|
2642
|
+
}
|
|
2643
|
+
function camelcase(e) {
|
|
2644
|
+
return e.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(e, t) {
|
|
2661
|
+
let n = t || {};
|
|
2662
|
+
function r(t, ...n) {
|
|
2663
|
+
let i = r.invalid, a = r.handlers;
|
|
2664
|
+
if (t && own$2.call(t, e)) {
|
|
2665
|
+
let n = String(t[e]);
|
|
2666
|
+
i = own$2.call(a, n) ? a[n] : r.unknown;
|
|
2667
|
+
}
|
|
2668
|
+
if (i) return i.call(this, t, ...n);
|
|
2669
|
+
}
|
|
2670
|
+
return r.handlers = n.handlers || {}, r.invalid = n.invalid, r.unknown = n.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(e, t) {
|
|
2674
|
+
if (e = e.replace(t.subset ? charactersToExpressionCached(t.subset) : defaultSubsetRegex, r), t.subset || t.escapeOnly) return e;
|
|
2675
|
+
return e.replace(surrogatePairsRegex, n).replace(controlCharactersRegex, r);
|
|
2676
|
+
function n(e, n, r) {
|
|
2677
|
+
return t.format((e.charCodeAt(0) - 55296) * 1024 + e.charCodeAt(1) - 56320 + 65536, r.charCodeAt(n + 2), t);
|
|
2678
|
+
}
|
|
2679
|
+
function r(e, n, r) {
|
|
2680
|
+
return t.format(e.charCodeAt(0), r.charCodeAt(n + 1), t);
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
function charactersToExpressionCached(e) {
|
|
2684
|
+
let t = subsetToRegexCache.get(e);
|
|
2685
|
+
return t || (t = charactersToExpression(e), subsetToRegexCache.set(e, t)), t;
|
|
2686
|
+
}
|
|
2687
|
+
function charactersToExpression(e) {
|
|
2688
|
+
let t = [], n = -1;
|
|
2689
|
+
for (; ++n < e.length;) t.push(e[n].replace(regexEscapeRegex, "\\$&"));
|
|
2690
|
+
return RegExp("(?:" + t.join("|") + ")", "g");
|
|
2691
|
+
}
|
|
2692
|
+
var hexadecimalRegex = /[\dA-Fa-f]/;
|
|
2693
|
+
function toHexadecimal(e, t, n) {
|
|
2694
|
+
let r = "&#x" + e.toString(16).toUpperCase();
|
|
2695
|
+
return n && t && !hexadecimalRegex.test(String.fromCharCode(t)) ? r : r + ";";
|
|
2696
|
+
}
|
|
2697
|
+
var decimalRegex = /\d/;
|
|
2698
|
+
function toDecimal(e, t, n) {
|
|
2699
|
+
let r = "&#" + String(e);
|
|
2700
|
+
return n && t && !decimalRegex.test(String.fromCharCode(t)) ? 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(e, t, n, r) {
|
|
2969
|
+
let i = String.fromCharCode(e);
|
|
2970
|
+
if (own$1.call(characters, i)) {
|
|
2971
|
+
let e = characters[i], a = "&" + e;
|
|
2972
|
+
return n && characterEntitiesLegacy.includes(e) && !dangerous.includes(e) && (!r || t && t !== 61 && notAlphanumericRegex.test(String.fromCharCode(t))) ? a : a + ";";
|
|
2973
|
+
}
|
|
2974
|
+
return "";
|
|
2975
|
+
}
|
|
2976
|
+
function formatSmart(e, t, n) {
|
|
2977
|
+
let r = toHexadecimal(e, t, n.omitOptionalSemicolons), i;
|
|
2978
|
+
if ((n.useNamedReferences || n.useShortestReferences) && (i = toNamed(e, t, n.omitOptionalSemicolons, n.attribute)), (n.useShortestReferences || !i) && n.useShortestReferences) {
|
|
2979
|
+
let i = toDecimal(e, t, n.omitOptionalSemicolons);
|
|
2980
|
+
i.length < r.length && (r = i);
|
|
2981
|
+
}
|
|
2982
|
+
return i && (!n.useShortestReferences || i.length < r.length) ? i : r;
|
|
2983
|
+
}
|
|
2984
|
+
function stringifyEntities(e, t) {
|
|
2985
|
+
return core(e, Object.assign({ format: formatSmart }, t));
|
|
2986
|
+
}
|
|
2987
|
+
var htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g, bogusCommentEntitySubset = [">"], commentEntitySubset = ["<", ">"];
|
|
2988
|
+
function comment(e, t, n, r) {
|
|
2989
|
+
return r.settings.bogusComments ? "<?" + stringifyEntities(e.value, Object.assign({}, r.settings.characterReferences, { subset: bogusCommentEntitySubset })) + ">" : "<!--" + e.value.replace(htmlCommentRegex, i) + "-->";
|
|
2990
|
+
function i(e) {
|
|
2991
|
+
return stringifyEntities(e, Object.assign({}, r.settings.characterReferences, { subset: commentEntitySubset }));
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
function doctype(e, t, n, r) {
|
|
2995
|
+
return "<!" + (r.settings.upperDoctype ? "DOCTYPE" : "doctype") + (r.settings.tightDoctype ? "" : " ") + "html>";
|
|
2996
|
+
}
|
|
2997
|
+
function ccount(e, t) {
|
|
2998
|
+
let n = String(e);
|
|
2999
|
+
if (typeof t != "string") throw TypeError("Expected character");
|
|
3000
|
+
let r = 0, i = n.indexOf(t);
|
|
3001
|
+
for (; i !== -1;) r++, i = n.indexOf(t, i + t.length);
|
|
3002
|
+
return r;
|
|
3003
|
+
}
|
|
3004
|
+
function stringify$2(e, t) {
|
|
3005
|
+
let n = t || {};
|
|
3006
|
+
return (e[e.length - 1] === "" ? [...e, ""] : e).join((n.padRight ? " " : "") + "," + (n.padLeft === !1 ? "" : " ")).trim();
|
|
3007
|
+
}
|
|
3008
|
+
function stringify$1(e) {
|
|
3009
|
+
return e.join(" ").trim();
|
|
3010
|
+
}
|
|
3011
|
+
var re = /[ \t\n\f\r]/g;
|
|
3012
|
+
function whitespace(e) {
|
|
3013
|
+
return typeof e == "object" ? e.type === "text" ? empty(e.value) : !1 : empty(e);
|
|
3014
|
+
}
|
|
3015
|
+
function empty(e) {
|
|
3016
|
+
return e.replace(re, "") === "";
|
|
3017
|
+
}
|
|
3018
|
+
const siblingAfter = siblings(1), siblingBefore = siblings(-1);
|
|
3019
|
+
var emptyChildren$1 = [];
|
|
3020
|
+
function siblings(e) {
|
|
3021
|
+
return t;
|
|
3022
|
+
function t(t, n, r) {
|
|
3023
|
+
let i = t ? t.children : emptyChildren$1, a = (n || 0) + e, o = i[a];
|
|
3024
|
+
if (!r) for (; o && whitespace(o);) a += e, o = i[a];
|
|
3025
|
+
return o;
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
var own = {}.hasOwnProperty;
|
|
3029
|
+
function omission(e) {
|
|
3030
|
+
return t;
|
|
3031
|
+
function t(t, n, r) {
|
|
3032
|
+
return own.call(e, t.tagName) && e[t.tagName](t, n, 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(e, t, n) {
|
|
3057
|
+
let r = siblingAfter(n, t, !0);
|
|
3058
|
+
return !r || r.type !== "comment" && !(r.type === "text" && whitespace(r.value.charAt(0)));
|
|
3059
|
+
}
|
|
3060
|
+
function html$1(e, t, n) {
|
|
3061
|
+
let r = siblingAfter(n, t);
|
|
3062
|
+
return !r || r.type !== "comment";
|
|
3063
|
+
}
|
|
3064
|
+
function body$1(e, t, n) {
|
|
3065
|
+
let r = siblingAfter(n, t);
|
|
3066
|
+
return !r || r.type !== "comment";
|
|
3067
|
+
}
|
|
3068
|
+
function p(e, t, n) {
|
|
3069
|
+
let r = siblingAfter(n, t);
|
|
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") : !n || !(n.type === "element" && (n.tagName === "a" || n.tagName === "audio" || n.tagName === "del" || n.tagName === "ins" || n.tagName === "map" || n.tagName === "noscript" || n.tagName === "video"));
|
|
3071
|
+
}
|
|
3072
|
+
function li(e, t, n) {
|
|
3073
|
+
let r = siblingAfter(n, t);
|
|
3074
|
+
return !r || r.type === "element" && r.tagName === "li";
|
|
3075
|
+
}
|
|
3076
|
+
function dt(e, t, n) {
|
|
3077
|
+
let r = siblingAfter(n, t);
|
|
3078
|
+
return !!(r && r.type === "element" && (r.tagName === "dt" || r.tagName === "dd"));
|
|
3079
|
+
}
|
|
3080
|
+
function dd(e, t, n) {
|
|
3081
|
+
let r = siblingAfter(n, t);
|
|
3082
|
+
return !r || r.type === "element" && (r.tagName === "dt" || r.tagName === "dd");
|
|
3083
|
+
}
|
|
3084
|
+
function rubyElement(e, t, n) {
|
|
3085
|
+
let r = siblingAfter(n, t);
|
|
3086
|
+
return !r || r.type === "element" && (r.tagName === "rp" || r.tagName === "rt");
|
|
3087
|
+
}
|
|
3088
|
+
function optgroup(e, t, n) {
|
|
3089
|
+
let r = siblingAfter(n, t);
|
|
3090
|
+
return !r || r.type === "element" && r.tagName === "optgroup";
|
|
3091
|
+
}
|
|
3092
|
+
function option(e, t, n) {
|
|
3093
|
+
let r = siblingAfter(n, t);
|
|
3094
|
+
return !r || r.type === "element" && (r.tagName === "option" || r.tagName === "optgroup");
|
|
3095
|
+
}
|
|
3096
|
+
function thead(e, t, n) {
|
|
3097
|
+
let r = siblingAfter(n, t);
|
|
3098
|
+
return !!(r && r.type === "element" && (r.tagName === "tbody" || r.tagName === "tfoot"));
|
|
3099
|
+
}
|
|
3100
|
+
function tbody$1(e, t, n) {
|
|
3101
|
+
let r = siblingAfter(n, t);
|
|
3102
|
+
return !r || r.type === "element" && (r.tagName === "tbody" || r.tagName === "tfoot");
|
|
3103
|
+
}
|
|
3104
|
+
function tfoot(e, t, n) {
|
|
3105
|
+
return !siblingAfter(n, t);
|
|
3106
|
+
}
|
|
3107
|
+
function tr(e, t, n) {
|
|
3108
|
+
let r = siblingAfter(n, t);
|
|
3109
|
+
return !r || r.type === "element" && r.tagName === "tr";
|
|
3110
|
+
}
|
|
3111
|
+
function cells(e, t, n) {
|
|
3112
|
+
let r = siblingAfter(n, t);
|
|
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(e) {
|
|
3123
|
+
let t = siblingAfter(e, -1);
|
|
3124
|
+
return !t || t.type !== "comment";
|
|
3125
|
+
}
|
|
3126
|
+
function head(e) {
|
|
3127
|
+
let t = /* @__PURE__ */ new Set();
|
|
3128
|
+
for (let n of e.children) if (n.type === "element" && (n.tagName === "base" || n.tagName === "title")) {
|
|
3129
|
+
if (t.has(n.tagName)) return !1;
|
|
3130
|
+
t.add(n.tagName);
|
|
3131
|
+
}
|
|
3132
|
+
let n = e.children[0];
|
|
3133
|
+
return !n || n.type === "element";
|
|
3134
|
+
}
|
|
3135
|
+
function body(e) {
|
|
3136
|
+
let t = siblingAfter(e, -1, !0);
|
|
3137
|
+
return !t || t.type !== "comment" && !(t.type === "text" && whitespace(t.value.charAt(0))) && !(t.type === "element" && (t.tagName === "meta" || t.tagName === "link" || t.tagName === "script" || t.tagName === "style" || t.tagName === "template"));
|
|
3138
|
+
}
|
|
3139
|
+
function colgroup(e, t, n) {
|
|
3140
|
+
let r = siblingBefore(n, t), i = siblingAfter(e, -1, !0);
|
|
3141
|
+
return n && r && r.type === "element" && r.tagName === "colgroup" && closing(r, n.children.indexOf(r), n) ? !1 : !!(i && i.type === "element" && i.tagName === "col");
|
|
3142
|
+
}
|
|
3143
|
+
function tbody(e, t, n) {
|
|
3144
|
+
let r = siblingBefore(n, t), i = siblingAfter(e, -1);
|
|
3145
|
+
return n && r && r.type === "element" && (r.tagName === "thead" || r.tagName === "tbody") && closing(r, n.children.indexOf(r), n) ? !1 : !!(i && i.type === "element" && i.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(e, t, n, r) {
|
|
3154
|
+
let i = r.schema, a = i.space === "svg" ? !1 : r.settings.omitOptionalTags, o = i.space === "svg" ? r.settings.closeEmptyElements : r.settings.voids.includes(e.tagName.toLowerCase()), s = [], c;
|
|
3155
|
+
i.space === "html" && e.tagName === "svg" && (r.schema = svg);
|
|
3156
|
+
let l = serializeAttributes(r, e.properties), u = r.all(i.space === "html" && e.tagName === "template" ? e.content : e);
|
|
3157
|
+
return r.schema = i, u && (o = !1), (l || !a || !opening(e, t, n)) && (s.push("<", e.tagName, l ? " " + l : ""), o && (i.space === "svg" || r.settings.closeSelfClosing) && (c = l.charAt(l.length - 1), (!r.settings.tightSelfClosing || c === "/" || c && c !== "\"" && c !== "'") && s.push(" "), s.push("/")), s.push(">")), s.push(u), !o && (!a || !closing(e, t, n)) && s.push("</" + e.tagName + ">"), s.join("");
|
|
3158
|
+
}
|
|
3159
|
+
function serializeAttributes(e, t) {
|
|
3160
|
+
let n = [], r = -1, i;
|
|
3161
|
+
if (t) {
|
|
3162
|
+
for (i in t) if (t[i] !== null && t[i] !== void 0) {
|
|
3163
|
+
let r = serializeAttribute(e, i, t[i]);
|
|
3164
|
+
r && n.push(r);
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
for (; ++r < n.length;) {
|
|
3168
|
+
let t = e.settings.tightAttributes ? n[r].charAt(n[r].length - 1) : void 0;
|
|
3169
|
+
r !== n.length - 1 && t !== "\"" && t !== "'" && (n[r] += " ");
|
|
3170
|
+
}
|
|
3171
|
+
return n.join("");
|
|
3172
|
+
}
|
|
3173
|
+
function serializeAttribute(e, t, n) {
|
|
3174
|
+
let r = find(e.schema, t), i = e.settings.allowParseErrors && e.schema.space === "html" ? 0 : 1, a = e.settings.allowDangerousCharacters ? 0 : 1, o = e.quote, s;
|
|
3175
|
+
if (r.overloadedBoolean && (n === r.attribute || n === "") ? n = !0 : (r.boolean || r.overloadedBoolean) && (typeof n != "string" || n === r.attribute || n === "") && (n = !!n), n == null || n === !1 || typeof n == "number" && Number.isNaN(n)) return "";
|
|
3176
|
+
let c = stringifyEntities(r.attribute, Object.assign({}, e.settings.characterReferences, { subset: constants.name[i][a] }));
|
|
3177
|
+
return n === !0 || (n = Array.isArray(n) ? (r.commaSeparated ? stringify$2 : stringify$1)(n, { padLeft: !e.settings.tightCommaSeparatedLists }) : String(n), e.settings.collapseEmptyAttributes && !n) ? c : (e.settings.preferUnquoted && (s = stringifyEntities(n, Object.assign({}, e.settings.characterReferences, {
|
|
3178
|
+
attribute: !0,
|
|
3179
|
+
subset: constants.unquoted[i][a]
|
|
3180
|
+
}))), s !== n && (e.settings.quoteSmart && ccount(n, o) > ccount(n, e.alternative) && (o = e.alternative), s = o + stringifyEntities(n, Object.assign({}, e.settings.characterReferences, {
|
|
3181
|
+
subset: (o === "'" ? constants.single : constants.double)[i][a],
|
|
3182
|
+
attribute: !0
|
|
3183
|
+
})) + o), c + (s && "=" + s));
|
|
3184
|
+
}
|
|
3185
|
+
var textEntitySubset = ["<", "&"];
|
|
3186
|
+
function text(e, t, n, r) {
|
|
3187
|
+
return n && n.type === "element" && (n.tagName === "script" || n.tagName === "style") ? e.value : stringifyEntities(e.value, Object.assign({}, r.settings.characterReferences, { subset: textEntitySubset }));
|
|
3188
|
+
}
|
|
3189
|
+
function raw(e, t, n, r) {
|
|
3190
|
+
return r.settings.allowDangerousHtml ? e.value : text(e, t, n, r);
|
|
3191
|
+
}
|
|
3192
|
+
function root(e, t, n, r) {
|
|
3193
|
+
return r.all(e);
|
|
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(e) {
|
|
3208
|
+
throw Error("Expected node, not `" + e + "`");
|
|
3209
|
+
}
|
|
3210
|
+
function unknown(e) {
|
|
3211
|
+
let t = e;
|
|
3212
|
+
throw Error("Cannot compile unknown node `" + t.type + "`");
|
|
3213
|
+
}
|
|
3214
|
+
var emptyOptions = {}, emptyCharacterReferences = {}, emptyChildren = [];
|
|
3215
|
+
function toHtml(e, t) {
|
|
3216
|
+
let n = t || emptyOptions, r = n.quote || "\"", i = r === "\"" ? "'" : "\"";
|
|
3217
|
+
if (r !== "\"" && r !== "'") throw Error("Invalid quote `" + r + "`, expected `'` or `\"`");
|
|
3218
|
+
return {
|
|
3219
|
+
one,
|
|
3220
|
+
all,
|
|
3221
|
+
settings: {
|
|
3222
|
+
omitOptionalTags: n.omitOptionalTags || !1,
|
|
3223
|
+
allowParseErrors: n.allowParseErrors || !1,
|
|
3224
|
+
allowDangerousCharacters: n.allowDangerousCharacters || !1,
|
|
3225
|
+
quoteSmart: n.quoteSmart || !1,
|
|
3226
|
+
preferUnquoted: n.preferUnquoted || !1,
|
|
3227
|
+
tightAttributes: n.tightAttributes || !1,
|
|
3228
|
+
upperDoctype: n.upperDoctype || !1,
|
|
3229
|
+
tightDoctype: n.tightDoctype || !1,
|
|
3230
|
+
bogusComments: n.bogusComments || !1,
|
|
3231
|
+
tightCommaSeparatedLists: n.tightCommaSeparatedLists || !1,
|
|
3232
|
+
tightSelfClosing: n.tightSelfClosing || !1,
|
|
3233
|
+
collapseEmptyAttributes: n.collapseEmptyAttributes || !1,
|
|
3234
|
+
allowDangerousHtml: n.allowDangerousHtml || !1,
|
|
3235
|
+
voids: n.voids || htmlVoidElements,
|
|
3236
|
+
characterReferences: n.characterReferences || emptyCharacterReferences,
|
|
3237
|
+
closeSelfClosing: n.closeSelfClosing || !1,
|
|
3238
|
+
closeEmptyElements: n.closeEmptyElements || !1
|
|
3239
|
+
},
|
|
3240
|
+
schema: n.space === "svg" ? svg : html$2,
|
|
3241
|
+
quote: r,
|
|
3242
|
+
alternative: i
|
|
3243
|
+
}.one(Array.isArray(e) ? {
|
|
3244
|
+
type: "root",
|
|
3245
|
+
children: e
|
|
3246
|
+
} : e, void 0, void 0);
|
|
3247
|
+
}
|
|
3248
|
+
function one(e, t, n) {
|
|
3249
|
+
return handle(e, t, n, this);
|
|
3250
|
+
}
|
|
3251
|
+
function all(e) {
|
|
3252
|
+
let t = [], n = e && e.children || emptyChildren, r = -1;
|
|
3253
|
+
for (; ++r < n.length;) t[r] = this.one(n[r], r, e);
|
|
3254
|
+
return t.join("");
|
|
3255
|
+
}
|
|
3256
|
+
function resolveColorReplacements(e, t) {
|
|
3257
|
+
let n = typeof e == "string" ? {} : { ...e.colorReplacements }, r = typeof e == "string" ? e : e.name;
|
|
3258
|
+
for (let [e, i] of Object.entries(t?.colorReplacements || {})) typeof i == "string" ? n[e] = i : e === r && Object.assign(n, i);
|
|
3259
|
+
return n;
|
|
3260
|
+
}
|
|
3261
|
+
function applyColorReplacements(e, t) {
|
|
3262
|
+
return e && (t?.[e?.toLowerCase()] || e);
|
|
3263
|
+
}
|
|
3264
|
+
function toArray(e) {
|
|
3265
|
+
return Array.isArray(e) ? e : [e];
|
|
3266
|
+
}
|
|
3267
|
+
async function normalizeGetter(e) {
|
|
3268
|
+
return Promise.resolve(typeof e == "function" ? e() : e).then((e) => e.default || e);
|
|
3269
|
+
}
|
|
3270
|
+
function isPlainLang(e) {
|
|
3271
|
+
return !e || [
|
|
3272
|
+
"plaintext",
|
|
3273
|
+
"txt",
|
|
3274
|
+
"text",
|
|
3275
|
+
"plain"
|
|
3276
|
+
].includes(e);
|
|
3277
|
+
}
|
|
3278
|
+
function isSpecialLang(e) {
|
|
3279
|
+
return e === "ansi" || isPlainLang(e);
|
|
3280
|
+
}
|
|
3281
|
+
function isNoneTheme(e) {
|
|
3282
|
+
return e === "none";
|
|
3283
|
+
}
|
|
3284
|
+
function isSpecialTheme(e) {
|
|
3285
|
+
return isNoneTheme(e);
|
|
3286
|
+
}
|
|
3287
|
+
function addClassToHast(e, t) {
|
|
3288
|
+
if (!t) return e;
|
|
3289
|
+
e.properties ||= {}, e.properties.class ||= [], typeof e.properties.class == "string" && (e.properties.class = e.properties.class.split(/\s+/g)), Array.isArray(e.properties.class) || (e.properties.class = []);
|
|
3290
|
+
let n = Array.isArray(t) ? t : t.split(/\s+/g);
|
|
3291
|
+
for (let t of n) t && !e.properties.class.includes(t) && e.properties.class.push(t);
|
|
3292
|
+
return e;
|
|
3293
|
+
}
|
|
3294
|
+
function splitLines(e, t = !1) {
|
|
3295
|
+
if (e.length === 0) return [["", 0]];
|
|
3296
|
+
let n = e.split(/(\r?\n)/g), r = 0, i = [];
|
|
3297
|
+
for (let e = 0; e < n.length; e += 2) {
|
|
3298
|
+
let a = t ? n[e] + (n[e + 1] || "") : n[e];
|
|
3299
|
+
i.push([a, r]), r += n[e].length, r += n[e + 1]?.length || 0;
|
|
3300
|
+
}
|
|
3301
|
+
return i;
|
|
3302
|
+
}
|
|
3303
|
+
function createPositionConverter(e) {
|
|
3304
|
+
let t = splitLines(e, !0).map(([e]) => e);
|
|
3305
|
+
function n(n) {
|
|
3306
|
+
if (n === e.length) return {
|
|
3307
|
+
line: t.length - 1,
|
|
3308
|
+
character: t[t.length - 1].length
|
|
3309
|
+
};
|
|
3310
|
+
let r = n, i = 0;
|
|
3311
|
+
for (let e of t) {
|
|
3312
|
+
if (r < e.length) break;
|
|
3313
|
+
r -= e.length, i++;
|
|
3314
|
+
}
|
|
3315
|
+
return {
|
|
3316
|
+
line: i,
|
|
3317
|
+
character: r
|
|
3318
|
+
};
|
|
3319
|
+
}
|
|
3320
|
+
function r(e, n) {
|
|
3321
|
+
let r = 0;
|
|
3322
|
+
for (let n = 0; n < e; n++) r += t[n].length;
|
|
3323
|
+
return r += n, r;
|
|
3324
|
+
}
|
|
3325
|
+
return {
|
|
3326
|
+
lines: t,
|
|
3327
|
+
indexToPos: n,
|
|
3328
|
+
posToIndex: r
|
|
3329
|
+
};
|
|
3330
|
+
}
|
|
3331
|
+
function guessEmbeddedLanguages(e, t, n) {
|
|
3332
|
+
let r = /* @__PURE__ */ new Set();
|
|
3333
|
+
for (let t of e.matchAll(/:?lang=["']([^"']+)["']/g)) {
|
|
3334
|
+
let e = t[1].toLowerCase().trim();
|
|
3335
|
+
e && r.add(e);
|
|
3336
|
+
}
|
|
3337
|
+
for (let t of e.matchAll(/(?:```|~~~)([\w-]+)/g)) {
|
|
3338
|
+
let e = t[1].toLowerCase().trim();
|
|
3339
|
+
e && r.add(e);
|
|
3340
|
+
}
|
|
3341
|
+
for (let t of e.matchAll(/\\begin\{([\w-]+)\}/g)) {
|
|
3342
|
+
let e = t[1].toLowerCase().trim();
|
|
3343
|
+
e && r.add(e);
|
|
3344
|
+
}
|
|
3345
|
+
for (let t of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)) {
|
|
3346
|
+
let e = t[1].toLowerCase().trim(), n = e.includes("/") ? e.split("/").pop() : e;
|
|
3347
|
+
n && r.add(n);
|
|
3348
|
+
}
|
|
3349
|
+
if (!n) return Array.from(r);
|
|
3350
|
+
let i = n.getBundledLanguages();
|
|
3351
|
+
return Array.from(r).filter((e) => e && i[e]);
|
|
3352
|
+
}
|
|
3353
|
+
var DEFAULT_COLOR_LIGHT_DARK = "light-dark()", COLOR_KEYS = ["color", "background-color"];
|
|
3354
|
+
function splitToken(e, t) {
|
|
3355
|
+
let n = 0, r = [];
|
|
3356
|
+
for (let i of t) i > n && r.push({
|
|
3357
|
+
...e,
|
|
3358
|
+
content: e.content.slice(n, i),
|
|
3359
|
+
offset: e.offset + n
|
|
3360
|
+
}), n = i;
|
|
3361
|
+
return n < e.content.length && r.push({
|
|
3362
|
+
...e,
|
|
3363
|
+
content: e.content.slice(n),
|
|
3364
|
+
offset: e.offset + n
|
|
3365
|
+
}), r;
|
|
3366
|
+
}
|
|
3367
|
+
function splitTokens(e, t) {
|
|
3368
|
+
let n = Array.from(t instanceof Set ? t : new Set(t)).sort((e, t) => e - t);
|
|
3369
|
+
return n.length ? e.map((e) => e.flatMap((e) => {
|
|
3370
|
+
let t = n.filter((t) => e.offset < t && t < e.offset + e.content.length).map((t) => t - e.offset).sort((e, t) => e - t);
|
|
3371
|
+
return t.length ? splitToken(e, t) : e;
|
|
3372
|
+
})) : e;
|
|
3373
|
+
}
|
|
3374
|
+
function flatTokenVariants(e, n, r, i, a = "css-vars") {
|
|
3375
|
+
let o = {
|
|
3376
|
+
content: e.content,
|
|
3377
|
+
explanation: e.explanation,
|
|
3378
|
+
offset: e.offset
|
|
3379
|
+
}, s = n.map((t) => getTokenStyleObject(e.variants[t])), c = new Set(s.flatMap((e) => Object.keys(e))), l = {}, u = (e, t) => {
|
|
3380
|
+
let i = t === "color" ? "" : t === "background-color" ? "-bg" : `-${t}`;
|
|
3381
|
+
return r + n[e] + (t === "color" ? "" : i);
|
|
3382
|
+
};
|
|
3383
|
+
return s.forEach((e, r) => {
|
|
3384
|
+
for (let o of c) {
|
|
3385
|
+
let c = e[o] || "inherit";
|
|
3386
|
+
if (r === 0 && i && COLOR_KEYS.includes(o)) if (i === DEFAULT_COLOR_LIGHT_DARK && s.length > 1) {
|
|
3387
|
+
let e = n.findIndex((e) => e === "light"), i = n.findIndex((e) => e === "dark");
|
|
3388
|
+
if (e === -1 || i === -1) throw new ShikiError("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
3389
|
+
l[o] = `light-dark(${s[e][o] || "inherit"}, ${s[i][o] || "inherit"})`, a === "css-vars" && (l[u(r, o)] = c);
|
|
3390
|
+
} else l[o] = c;
|
|
3391
|
+
else a === "css-vars" && (l[u(r, o)] = c);
|
|
3392
|
+
}
|
|
3393
|
+
}), o.htmlStyle = l, o;
|
|
3394
|
+
}
|
|
3395
|
+
function getTokenStyleObject(e) {
|
|
3396
|
+
let t = {};
|
|
3397
|
+
if (e.color && (t.color = e.color), e.bgColor && (t["background-color"] = e.bgColor), e.fontStyle) {
|
|
3398
|
+
e.fontStyle & FontStyle.Italic && (t["font-style"] = "italic"), e.fontStyle & FontStyle.Bold && (t["font-weight"] = "bold");
|
|
3399
|
+
let n = [];
|
|
3400
|
+
e.fontStyle & FontStyle.Underline && n.push("underline"), e.fontStyle & FontStyle.Strikethrough && n.push("line-through"), n.length && (t["text-decoration"] = n.join(" "));
|
|
3401
|
+
}
|
|
3402
|
+
return t;
|
|
3403
|
+
}
|
|
3404
|
+
function stringifyTokenStyle(e) {
|
|
3405
|
+
return typeof e == "string" ? e : Object.entries(e).map(([e, t]) => `${e}:${t}`).join(";");
|
|
3406
|
+
}
|
|
3407
|
+
var _grammarStateMap = /* @__PURE__ */ new WeakMap();
|
|
3408
|
+
function setLastGrammarStateToMap(e, t) {
|
|
3409
|
+
_grammarStateMap.set(e, t);
|
|
3410
|
+
}
|
|
3411
|
+
function getLastGrammarStateFromMap(e) {
|
|
3412
|
+
return _grammarStateMap.get(e);
|
|
3413
|
+
}
|
|
3414
|
+
var GrammarState = class e {
|
|
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(t, n) {
|
|
3427
|
+
return new e(Object.fromEntries(toArray(n).map((e) => [e, INITIAL])), t);
|
|
3428
|
+
}
|
|
3429
|
+
constructor(...e) {
|
|
3430
|
+
if (e.length === 2) {
|
|
3431
|
+
let [t, n] = e;
|
|
3432
|
+
this.lang = n, this._stacks = t;
|
|
3433
|
+
} else {
|
|
3434
|
+
let [t, n, r] = e;
|
|
3435
|
+
this.lang = n, this._stacks = { [r]: t };
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
getInternalStack(e = this.theme) {
|
|
3439
|
+
return this._stacks[e];
|
|
3440
|
+
}
|
|
3441
|
+
getScopes(e = this.theme) {
|
|
3442
|
+
return getScopes(this._stacks[e]);
|
|
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(e) {
|
|
3454
|
+
let t = [], n = /* @__PURE__ */ new Set();
|
|
3455
|
+
function r(e) {
|
|
3456
|
+
if (n.has(e)) return;
|
|
3457
|
+
n.add(e);
|
|
3458
|
+
let i = e?.nameScopesList?.scopeName;
|
|
3459
|
+
i && t.push(i), e.parent && r(e.parent);
|
|
3460
|
+
}
|
|
3461
|
+
return r(e), t;
|
|
3462
|
+
}
|
|
3463
|
+
function getGrammarStack(e, n) {
|
|
3464
|
+
if (!(e instanceof GrammarState)) throw new ShikiError("Invalid grammar state");
|
|
3465
|
+
return e.getInternalStack(n);
|
|
3466
|
+
}
|
|
3467
|
+
function transformerDecorations() {
|
|
3468
|
+
let e = /* @__PURE__ */ new WeakMap();
|
|
3469
|
+
function n(n) {
|
|
3470
|
+
if (!e.has(n.meta)) {
|
|
3471
|
+
let r = function(e) {
|
|
3472
|
+
if (typeof e == "number") {
|
|
3473
|
+
if (e < 0 || e > n.source.length) throw new ShikiError(`Invalid decoration offset: ${e}. Code length: ${n.source.length}`);
|
|
3474
|
+
return {
|
|
3475
|
+
...i.indexToPos(e),
|
|
3476
|
+
offset: e
|
|
3477
|
+
};
|
|
3478
|
+
} else {
|
|
3479
|
+
let n = i.lines[e.line];
|
|
3480
|
+
if (n === void 0) throw new ShikiError(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${i.lines.length}`);
|
|
3481
|
+
let r = e.character;
|
|
3482
|
+
if (r < 0 && (r = n.length + r), r < 0 || r > n.length) throw new ShikiError(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${n.length}`);
|
|
3483
|
+
return {
|
|
3484
|
+
...e,
|
|
3485
|
+
character: r,
|
|
3486
|
+
offset: i.posToIndex(e.line, r)
|
|
3487
|
+
};
|
|
3488
|
+
}
|
|
3489
|
+
}, i = createPositionConverter(n.source), a = (n.options.decorations || []).map((e) => ({
|
|
3490
|
+
...e,
|
|
3491
|
+
start: r(e.start),
|
|
3492
|
+
end: r(e.end)
|
|
3493
|
+
}));
|
|
3494
|
+
verifyIntersections(a), e.set(n.meta, {
|
|
3495
|
+
decorations: a,
|
|
3496
|
+
converter: i,
|
|
3497
|
+
source: n.source
|
|
3498
|
+
});
|
|
3499
|
+
}
|
|
3500
|
+
return e.get(n.meta);
|
|
3501
|
+
}
|
|
3502
|
+
return {
|
|
3503
|
+
name: "shiki:decorations",
|
|
3504
|
+
tokens(e) {
|
|
3505
|
+
if (this.options.decorations?.length) return splitTokens(e, n(this).decorations.flatMap((e) => [e.start.offset, e.end.offset]));
|
|
3506
|
+
},
|
|
3507
|
+
code(e) {
|
|
3508
|
+
if (!this.options.decorations?.length) return;
|
|
3509
|
+
let r = n(this), i = Array.from(e.children).filter((e) => e.type === "element" && e.tagName === "span");
|
|
3510
|
+
if (i.length !== r.converter.lines.length) throw new ShikiError(`Number of lines in code element (${i.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);
|
|
3511
|
+
function a(e, n, r, a) {
|
|
3512
|
+
let o = i[e], c = "", l = -1, u = -1;
|
|
3513
|
+
if (n === 0 && (l = 0), r === 0 && (u = 0), r === Infinity && (u = o.children.length), l === -1 || u === -1) for (let e = 0; e < o.children.length; e++) c += stringify(o.children[e]), l === -1 && c.length === n && (l = e + 1), u === -1 && c.length === r && (u = e + 1);
|
|
3514
|
+
if (l === -1) throw new ShikiError(`Failed to find start index for decoration ${JSON.stringify(a.start)}`);
|
|
3515
|
+
if (u === -1) throw new ShikiError(`Failed to find end index for decoration ${JSON.stringify(a.end)}`);
|
|
3516
|
+
let d = o.children.slice(l, u);
|
|
3517
|
+
if (!a.alwaysWrap && d.length === o.children.length) s(o, a, "line");
|
|
3518
|
+
else if (!a.alwaysWrap && d.length === 1 && d[0].type === "element") s(d[0], a, "token");
|
|
3519
|
+
else {
|
|
3520
|
+
let e = {
|
|
3521
|
+
type: "element",
|
|
3522
|
+
tagName: "span",
|
|
3523
|
+
properties: {},
|
|
3524
|
+
children: d
|
|
3525
|
+
};
|
|
3526
|
+
s(e, a, "wrapper"), o.children.splice(l, d.length, e);
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
function o(e, t) {
|
|
3530
|
+
i[e] = s(i[e], t, "line");
|
|
3531
|
+
}
|
|
3532
|
+
function s(e, t, n) {
|
|
3533
|
+
let r = t.properties || {}, i = t.transform || ((e) => e);
|
|
3534
|
+
return e.tagName = t.tagName || "span", e.properties = {
|
|
3535
|
+
...e.properties,
|
|
3536
|
+
...r,
|
|
3537
|
+
class: e.properties.class
|
|
3538
|
+
}, t.properties?.class && addClassToHast(e, t.properties.class), e = i(e, n) || e, e;
|
|
3539
|
+
}
|
|
3540
|
+
let c = [], l = r.decorations.sort((e, t) => t.start.offset - e.start.offset || e.end.offset - t.end.offset);
|
|
3541
|
+
for (let e of l) {
|
|
3542
|
+
let { start: t, end: n } = e;
|
|
3543
|
+
if (t.line === n.line) a(t.line, t.character, n.character, e);
|
|
3544
|
+
else if (t.line < n.line) {
|
|
3545
|
+
a(t.line, t.character, Infinity, e);
|
|
3546
|
+
for (let r = t.line + 1; r < n.line; r++) c.unshift(() => o(r, e));
|
|
3547
|
+
a(n.line, 0, n.character, e);
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
c.forEach((e) => e());
|
|
3551
|
+
}
|
|
3552
|
+
};
|
|
3553
|
+
}
|
|
3554
|
+
function verifyIntersections(e) {
|
|
3555
|
+
for (let n = 0; n < e.length; n++) {
|
|
3556
|
+
let r = e[n];
|
|
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 i = n + 1; i < e.length; i++) {
|
|
3559
|
+
let n = e[i], a = r.start.offset <= n.start.offset && n.start.offset < r.end.offset, o = r.start.offset < n.end.offset && n.end.offset <= r.end.offset, s = n.start.offset <= r.start.offset && r.start.offset < n.end.offset, c = n.start.offset < r.end.offset && r.end.offset <= n.end.offset;
|
|
3560
|
+
if (a || o || s || c) {
|
|
3561
|
+
if (a && o || s && c || s && r.start.offset === r.end.offset || o && n.start.offset === n.end.offset) continue;
|
|
3562
|
+
throw new ShikiError(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(n.start)} intersect.`);
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
function stringify(e) {
|
|
3568
|
+
return e.type === "text" ? e.value : e.type === "element" ? e.children.map(stringify).join("") : "";
|
|
3569
|
+
}
|
|
3570
|
+
var builtInTransformers = [/* @__PURE__ */ transformerDecorations()];
|
|
3571
|
+
function getTransformers(e) {
|
|
3572
|
+
let t = sortTransformersByEnforcement(e.transformers || []);
|
|
3573
|
+
return [
|
|
3574
|
+
...t.pre,
|
|
3575
|
+
...t.normal,
|
|
3576
|
+
...t.post,
|
|
3577
|
+
...builtInTransformers
|
|
3578
|
+
];
|
|
3579
|
+
}
|
|
3580
|
+
function sortTransformersByEnforcement(e) {
|
|
3581
|
+
let t = [], n = [], r = [];
|
|
3582
|
+
for (let i of e) switch (i.enforce) {
|
|
3583
|
+
case "pre":
|
|
3584
|
+
t.push(i);
|
|
3585
|
+
break;
|
|
3586
|
+
case "post":
|
|
3587
|
+
n.push(i);
|
|
3588
|
+
break;
|
|
3589
|
+
default: r.push(i);
|
|
3590
|
+
}
|
|
3591
|
+
return {
|
|
3592
|
+
pre: t,
|
|
3593
|
+
post: n,
|
|
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(e, t) {
|
|
3624
|
+
let n = e.indexOf("\x1B", t);
|
|
3625
|
+
if (n !== -1 && e[n + 1] === "[") {
|
|
3626
|
+
let t = e.indexOf("m", n);
|
|
3627
|
+
if (t !== -1) return {
|
|
3628
|
+
sequence: e.substring(n + 2, t).split(";"),
|
|
3629
|
+
startPosition: n,
|
|
3630
|
+
position: t + 1
|
|
3631
|
+
};
|
|
3632
|
+
}
|
|
3633
|
+
return { position: e.length };
|
|
3634
|
+
}
|
|
3635
|
+
function parseColor(e) {
|
|
3636
|
+
let t = e.shift();
|
|
3637
|
+
if (t === "2") {
|
|
3638
|
+
let t = e.splice(0, 3).map((e) => Number.parseInt(e));
|
|
3639
|
+
return t.length !== 3 || t.some((e) => Number.isNaN(e)) ? void 0 : {
|
|
3640
|
+
type: "rgb",
|
|
3641
|
+
rgb: t
|
|
3642
|
+
};
|
|
3643
|
+
} else if (t === "5") {
|
|
3644
|
+
let t = e.shift();
|
|
3645
|
+
if (t) return {
|
|
3646
|
+
type: "table",
|
|
3647
|
+
index: Number(t)
|
|
3648
|
+
};
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
function parseSequence(e) {
|
|
3652
|
+
let t = [];
|
|
3653
|
+
for (; e.length > 0;) {
|
|
3654
|
+
let n = e.shift();
|
|
3655
|
+
if (!n) continue;
|
|
3656
|
+
let r = Number.parseInt(n);
|
|
3657
|
+
if (!Number.isNaN(r)) if (r === 0) t.push({ type: "resetAll" });
|
|
3658
|
+
else if (r <= 9) decorations[r] && t.push({
|
|
3659
|
+
type: "setDecoration",
|
|
3660
|
+
value: decorations[r]
|
|
3661
|
+
});
|
|
3662
|
+
else if (r <= 29) {
|
|
3663
|
+
let e = decorations[r - 20];
|
|
3664
|
+
e && (t.push({
|
|
3665
|
+
type: "resetDecoration",
|
|
3666
|
+
value: e
|
|
3667
|
+
}), e === "dim" && t.push({
|
|
3668
|
+
type: "resetDecoration",
|
|
3669
|
+
value: "bold"
|
|
3670
|
+
}));
|
|
3671
|
+
} else if (r <= 37) t.push({
|
|
3672
|
+
type: "setForegroundColor",
|
|
3673
|
+
value: {
|
|
3674
|
+
type: "named",
|
|
3675
|
+
name: namedColors[r - 30]
|
|
3676
|
+
}
|
|
3677
|
+
});
|
|
3678
|
+
else if (r === 38) {
|
|
3679
|
+
let n = parseColor(e);
|
|
3680
|
+
n && t.push({
|
|
3681
|
+
type: "setForegroundColor",
|
|
3682
|
+
value: n
|
|
3683
|
+
});
|
|
3684
|
+
} else if (r === 39) t.push({ type: "resetForegroundColor" });
|
|
3685
|
+
else if (r <= 47) t.push({
|
|
3686
|
+
type: "setBackgroundColor",
|
|
3687
|
+
value: {
|
|
3688
|
+
type: "named",
|
|
3689
|
+
name: namedColors[r - 40]
|
|
3690
|
+
}
|
|
3691
|
+
});
|
|
3692
|
+
else if (r === 48) {
|
|
3693
|
+
let n = parseColor(e);
|
|
3694
|
+
n && t.push({
|
|
3695
|
+
type: "setBackgroundColor",
|
|
3696
|
+
value: n
|
|
3697
|
+
});
|
|
3698
|
+
} else r === 49 ? t.push({ type: "resetBackgroundColor" }) : r === 53 ? t.push({
|
|
3699
|
+
type: "setDecoration",
|
|
3700
|
+
value: "overline"
|
|
3701
|
+
}) : r === 55 ? t.push({
|
|
3702
|
+
type: "resetDecoration",
|
|
3703
|
+
value: "overline"
|
|
3704
|
+
}) : r >= 90 && r <= 97 ? t.push({
|
|
3705
|
+
type: "setForegroundColor",
|
|
3706
|
+
value: {
|
|
3707
|
+
type: "named",
|
|
3708
|
+
name: namedColors[r - 90 + 8]
|
|
3709
|
+
}
|
|
3710
|
+
}) : r >= 100 && r <= 107 && t.push({
|
|
3711
|
+
type: "setBackgroundColor",
|
|
3712
|
+
value: {
|
|
3713
|
+
type: "named",
|
|
3714
|
+
name: namedColors[r - 100 + 8]
|
|
3715
|
+
}
|
|
3716
|
+
});
|
|
3717
|
+
}
|
|
3718
|
+
return t;
|
|
3719
|
+
}
|
|
3720
|
+
function createAnsiSequenceParser() {
|
|
3721
|
+
let e = null, t = null, n = /* @__PURE__ */ new Set();
|
|
3722
|
+
return { parse(r) {
|
|
3723
|
+
let i = [], a = 0;
|
|
3724
|
+
do {
|
|
3725
|
+
let o = findSequence(r, a), s = o.sequence ? r.substring(a, o.startPosition) : r.substring(a);
|
|
3726
|
+
if (s.length > 0 && i.push({
|
|
3727
|
+
value: s,
|
|
3728
|
+
foreground: e,
|
|
3729
|
+
background: t,
|
|
3730
|
+
decorations: new Set(n)
|
|
3731
|
+
}), o.sequence) {
|
|
3732
|
+
let r = parseSequence(o.sequence);
|
|
3733
|
+
for (let i of r) i.type === "resetAll" ? (e = null, t = null, n.clear()) : i.type === "resetForegroundColor" ? e = null : i.type === "resetBackgroundColor" ? t = null : i.type === "resetDecoration" && n.delete(i.value);
|
|
3734
|
+
for (let i of r) i.type === "setForegroundColor" ? e = i.value : i.type === "setBackgroundColor" ? t = i.value : i.type === "setDecoration" && n.add(i.value);
|
|
3735
|
+
}
|
|
3736
|
+
a = o.position;
|
|
3737
|
+
} while (a < r.length);
|
|
3738
|
+
return i;
|
|
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(e = defaultNamedColorsMap) {
|
|
3760
|
+
function t(t) {
|
|
3761
|
+
return e[t];
|
|
3762
|
+
}
|
|
3763
|
+
function n(e) {
|
|
3764
|
+
return `#${e.map((e) => Math.max(0, Math.min(e, 255)).toString(16).padStart(2, "0")).join("")}`;
|
|
3765
|
+
}
|
|
3766
|
+
let r;
|
|
3767
|
+
function i() {
|
|
3768
|
+
if (r) return r;
|
|
3769
|
+
r = [];
|
|
3770
|
+
for (let e = 0; e < namedColors.length; e++) r.push(t(namedColors[e]));
|
|
3771
|
+
let e = [
|
|
3772
|
+
0,
|
|
3773
|
+
95,
|
|
3774
|
+
135,
|
|
3775
|
+
175,
|
|
3776
|
+
215,
|
|
3777
|
+
255
|
|
3778
|
+
];
|
|
3779
|
+
for (let t = 0; t < 6; t++) for (let i = 0; i < 6; i++) for (let a = 0; a < 6; a++) r.push(n([
|
|
3780
|
+
e[t],
|
|
3781
|
+
e[i],
|
|
3782
|
+
e[a]
|
|
3783
|
+
]));
|
|
3784
|
+
let i = 8;
|
|
3785
|
+
for (let e = 0; e < 24; e++, i += 10) r.push(n([
|
|
3786
|
+
i,
|
|
3787
|
+
i,
|
|
3788
|
+
i
|
|
3789
|
+
]));
|
|
3790
|
+
return r;
|
|
3791
|
+
}
|
|
3792
|
+
function a(e) {
|
|
3793
|
+
return i()[e];
|
|
3794
|
+
}
|
|
3795
|
+
function o(e) {
|
|
3796
|
+
switch (e.type) {
|
|
3797
|
+
case "named": return t(e.name);
|
|
3798
|
+
case "rgb": return n(e.rgb);
|
|
3799
|
+
case "table": return a(e.index);
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
return { value: o };
|
|
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(e, t, n) {
|
|
3823
|
+
let r = resolveColorReplacements(e, n), i = splitLines(t), a = createColorPalette(Object.fromEntries(namedColors.map((t) => {
|
|
3824
|
+
let n = `terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;
|
|
3825
|
+
return [t, e.colors?.[n] || defaultAnsiColors[t]];
|
|
3826
|
+
}))), o = createAnsiSequenceParser();
|
|
3827
|
+
return i.map((t) => o.parse(t[0]).map((n) => {
|
|
3828
|
+
let i, o;
|
|
3829
|
+
n.decorations.has("reverse") ? (i = n.background ? a.value(n.background) : e.bg, o = n.foreground ? a.value(n.foreground) : e.fg) : (i = n.foreground ? a.value(n.foreground) : e.fg, o = n.background ? a.value(n.background) : void 0), i = applyColorReplacements(i, r), o = applyColorReplacements(o, r), n.decorations.has("dim") && (i = dimColor(i));
|
|
3830
|
+
let s = FontStyle.None;
|
|
3831
|
+
return n.decorations.has("bold") && (s |= FontStyle.Bold), n.decorations.has("italic") && (s |= FontStyle.Italic), n.decorations.has("underline") && (s |= FontStyle.Underline), n.decorations.has("strikethrough") && (s |= FontStyle.Strikethrough), {
|
|
3832
|
+
content: n.value,
|
|
3833
|
+
offset: t[1],
|
|
3834
|
+
color: i,
|
|
3835
|
+
bgColor: o,
|
|
3836
|
+
fontStyle: s
|
|
3837
|
+
};
|
|
3838
|
+
}));
|
|
3839
|
+
}
|
|
3840
|
+
function dimColor(e) {
|
|
3841
|
+
let t = e.match(/#([0-9a-f]{3,8})/i);
|
|
3842
|
+
if (t) {
|
|
3843
|
+
let e = t[1];
|
|
3844
|
+
if (e.length === 8) {
|
|
3845
|
+
let t = Math.round(Number.parseInt(e.slice(6, 8), 16) / 2).toString(16).padStart(2, "0");
|
|
3846
|
+
return `#${e.slice(0, 6)}${t}`;
|
|
3847
|
+
} else if (e.length === 6) return `#${e}80`;
|
|
3848
|
+
else if (e.length === 4) {
|
|
3849
|
+
let t = e[0], n = e[1], r = e[2], i = e[3];
|
|
3850
|
+
return `#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`, 16) / 2).toString(16).padStart(2, "0")}`;
|
|
3851
|
+
} else if (e.length === 3) {
|
|
3852
|
+
let t = e[0], n = e[1], r = e[2];
|
|
3853
|
+
return `#${t}${t}${n}${n}${r}${r}80`;
|
|
3854
|
+
}
|
|
3855
|
+
}
|
|
3856
|
+
let n = e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);
|
|
3857
|
+
return n ? `var(${n[1]}-dim)` : e;
|
|
3858
|
+
}
|
|
3859
|
+
function codeToTokensBase(e, n, r = {}) {
|
|
3860
|
+
let { theme: i = e.getLoadedThemes()[0] } = r, a = e.resolveLangAlias(r.lang || "text");
|
|
3861
|
+
if (isPlainLang(a) || isNoneTheme(i)) return splitLines(n).map((e) => [{
|
|
3862
|
+
content: e[0],
|
|
3863
|
+
offset: e[1]
|
|
3864
|
+
}]);
|
|
3865
|
+
let { theme: o, colorMap: s } = e.setTheme(i);
|
|
3866
|
+
if (a === "ansi") return tokenizeAnsiWithTheme(o, n, r);
|
|
3867
|
+
let c = e.getLanguage(r.lang || "text");
|
|
3868
|
+
if (r.grammarState) {
|
|
3869
|
+
if (r.grammarState.lang !== c.name) throw new ShikiError(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${c.name}"`);
|
|
3870
|
+
if (!r.grammarState.themes.includes(o.name)) throw new ShikiError(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${o.name}"`);
|
|
3871
|
+
}
|
|
3872
|
+
return tokenizeWithTheme(n, c, o, s, r);
|
|
3873
|
+
}
|
|
3874
|
+
function getLastGrammarState(...e) {
|
|
3875
|
+
if (e.length === 2) return getLastGrammarStateFromMap(e[1]);
|
|
3876
|
+
let [n, r, i = {}] = e, { lang: a = "text", theme: o = n.getLoadedThemes()[0] } = i;
|
|
3877
|
+
if (isPlainLang(a) || isNoneTheme(o)) throw new ShikiError("Plain language does not have grammar state");
|
|
3878
|
+
if (a === "ansi") throw new ShikiError("ANSI language does not have grammar state");
|
|
3879
|
+
let { theme: s, colorMap: c } = n.setTheme(o), l = n.getLanguage(a);
|
|
3880
|
+
return new GrammarState(_tokenizeWithTheme(r, l, s, c, i).stateStack, l.name, s.name);
|
|
3881
|
+
}
|
|
3882
|
+
function tokenizeWithTheme(e, t, n, r, i) {
|
|
3883
|
+
let a = _tokenizeWithTheme(e, t, n, r, i), o = new GrammarState(a.stateStack, t.name, n.name);
|
|
3884
|
+
return setLastGrammarStateToMap(a.tokens, o), a.tokens;
|
|
3885
|
+
}
|
|
3886
|
+
function _tokenizeWithTheme(e, t, n, r, i) {
|
|
3887
|
+
let a = resolveColorReplacements(n, i), { tokenizeMaxLineLength: o = 0, tokenizeTimeLimit: s = 500 } = i, c = splitLines(e), l = i.grammarState ? getGrammarStack(i.grammarState, n.name) ?? INITIAL : i.grammarContextCode == null ? INITIAL : _tokenizeWithTheme(i.grammarContextCode, t, n, r, {
|
|
3888
|
+
...i,
|
|
3889
|
+
grammarState: void 0,
|
|
3890
|
+
grammarContextCode: void 0
|
|
3891
|
+
}).stateStack, u = [], d = [];
|
|
3892
|
+
for (let e = 0, f = c.length; e < f; e++) {
|
|
3893
|
+
let [f, m] = c[e];
|
|
3894
|
+
if (f === "") {
|
|
3895
|
+
u = [], d.push([]);
|
|
3896
|
+
continue;
|
|
3897
|
+
}
|
|
3898
|
+
if (o > 0 && f.length >= o) {
|
|
3899
|
+
u = [], d.push([{
|
|
3900
|
+
content: f,
|
|
3901
|
+
offset: m,
|
|
3902
|
+
color: "",
|
|
3903
|
+
fontStyle: 0
|
|
3904
|
+
}]);
|
|
3905
|
+
continue;
|
|
3906
|
+
}
|
|
3907
|
+
let h, g, _;
|
|
3908
|
+
i.includeExplanation && (h = t.tokenizeLine(f, l, s), g = h.tokens, _ = 0);
|
|
3909
|
+
let v = t.tokenizeLine2(f, l, s), y = v.tokens.length / 2;
|
|
3910
|
+
for (let e = 0; e < y; e++) {
|
|
3911
|
+
let t = v.tokens[2 * e], o = e + 1 < y ? v.tokens[2 * e + 2] : f.length;
|
|
3912
|
+
if (t === o) continue;
|
|
3913
|
+
let s = v.tokens[2 * e + 1], c = applyColorReplacements(r[EncodedTokenMetadata.getForeground(s)], a), l = EncodedTokenMetadata.getFontStyle(s), d = {
|
|
3914
|
+
content: f.substring(t, o),
|
|
3915
|
+
offset: m + t,
|
|
3916
|
+
color: c,
|
|
3917
|
+
fontStyle: l
|
|
3918
|
+
};
|
|
3919
|
+
if (i.includeExplanation) {
|
|
3920
|
+
let e = [];
|
|
3921
|
+
if (i.includeExplanation !== "scopeName") for (let t of n.settings) {
|
|
3922
|
+
let n;
|
|
3923
|
+
switch (typeof t.scope) {
|
|
3924
|
+
case "string":
|
|
3925
|
+
n = t.scope.split(/,/).map((e) => e.trim());
|
|
3926
|
+
break;
|
|
3927
|
+
case "object":
|
|
3928
|
+
n = t.scope;
|
|
3929
|
+
break;
|
|
3930
|
+
default: continue;
|
|
3931
|
+
}
|
|
3932
|
+
e.push({
|
|
3933
|
+
settings: t,
|
|
3934
|
+
selectors: n.map((e) => e.split(/ /))
|
|
3935
|
+
});
|
|
3936
|
+
}
|
|
3937
|
+
d.explanation = [];
|
|
3938
|
+
let r = 0;
|
|
3939
|
+
for (; t + r < o;) {
|
|
3940
|
+
let t = g[_], n = f.substring(t.startIndex, t.endIndex);
|
|
3941
|
+
r += n.length, d.explanation.push({
|
|
3942
|
+
content: n,
|
|
3943
|
+
scopes: i.includeExplanation === "scopeName" ? explainThemeScopesNameOnly(t.scopes) : explainThemeScopesFull(e, t.scopes)
|
|
3944
|
+
}), _ += 1;
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
u.push(d);
|
|
3948
|
+
}
|
|
3949
|
+
d.push(u), u = [], l = v.ruleStack;
|
|
3950
|
+
}
|
|
3951
|
+
return {
|
|
3952
|
+
tokens: d,
|
|
3953
|
+
stateStack: l
|
|
3954
|
+
};
|
|
3955
|
+
}
|
|
3956
|
+
function explainThemeScopesNameOnly(e) {
|
|
3957
|
+
return e.map((e) => ({ scopeName: e }));
|
|
3958
|
+
}
|
|
3959
|
+
function explainThemeScopesFull(e, t) {
|
|
3960
|
+
let n = [];
|
|
3961
|
+
for (let r = 0, i = t.length; r < i; r++) {
|
|
3962
|
+
let i = t[r];
|
|
3963
|
+
n[r] = {
|
|
3964
|
+
scopeName: i,
|
|
3965
|
+
themeMatches: explainThemeScope(e, i, t.slice(0, r))
|
|
3966
|
+
};
|
|
3967
|
+
}
|
|
3968
|
+
return n;
|
|
3969
|
+
}
|
|
3970
|
+
function matchesOne(e, t) {
|
|
3971
|
+
return e === t || t.substring(0, e.length) === e && t[e.length] === ".";
|
|
3972
|
+
}
|
|
3973
|
+
function matches(e, t, n) {
|
|
3974
|
+
if (!matchesOne(e[e.length - 1], t)) return !1;
|
|
3975
|
+
let r = e.length - 2, i = n.length - 1;
|
|
3976
|
+
for (; r >= 0 && i >= 0;) matchesOne(e[r], n[i]) && --r, --i;
|
|
3977
|
+
return r === -1;
|
|
3978
|
+
}
|
|
3979
|
+
function explainThemeScope(e, t, n) {
|
|
3980
|
+
let r = [];
|
|
3981
|
+
for (let { selectors: i, settings: a } of e) for (let e of i) if (matches(e, t, n)) {
|
|
3982
|
+
r.push(a);
|
|
3983
|
+
break;
|
|
3984
|
+
}
|
|
3985
|
+
return r;
|
|
3986
|
+
}
|
|
3987
|
+
function codeToTokensWithThemes(e, t, n) {
|
|
3988
|
+
let r = Object.entries(n.themes).filter((e) => e[1]).map((e) => ({
|
|
3989
|
+
color: e[0],
|
|
3990
|
+
theme: e[1]
|
|
3991
|
+
})), i = r.map((r) => {
|
|
3992
|
+
let i = codeToTokensBase(e, t, {
|
|
3993
|
+
...n,
|
|
3994
|
+
theme: r.theme
|
|
3995
|
+
});
|
|
3996
|
+
return {
|
|
3997
|
+
tokens: i,
|
|
3998
|
+
state: getLastGrammarStateFromMap(i),
|
|
3999
|
+
theme: typeof r.theme == "string" ? r.theme : r.theme.name
|
|
4000
|
+
};
|
|
4001
|
+
}), a = syncThemesTokenization(...i.map((e) => e.tokens)), o = a[0].map((e, t) => e.map((e, i) => {
|
|
4002
|
+
let o = {
|
|
4003
|
+
content: e.content,
|
|
4004
|
+
variants: {},
|
|
4005
|
+
offset: e.offset
|
|
4006
|
+
};
|
|
4007
|
+
return "includeExplanation" in n && n.includeExplanation && (o.explanation = e.explanation), a.forEach((e, n) => {
|
|
4008
|
+
let { content: a, explanation: s, offset: c, ...l } = e[t][i];
|
|
4009
|
+
o.variants[r[n].color] = l;
|
|
4010
|
+
}), o;
|
|
4011
|
+
})), s = i[0].state ? new GrammarState(Object.fromEntries(i.map((e) => [e.theme, e.state?.getInternalStack(e.theme)])), i[0].state.lang) : void 0;
|
|
4012
|
+
return s && setLastGrammarStateToMap(o, s), o;
|
|
4013
|
+
}
|
|
4014
|
+
function syncThemesTokenization(...e) {
|
|
4015
|
+
let t = e.map(() => []), n = e.length;
|
|
4016
|
+
for (let r = 0; r < e[0].length; r++) {
|
|
4017
|
+
let i = e.map((e) => e[r]), a = t.map(() => []);
|
|
4018
|
+
t.forEach((e, t) => e.push(a[t]));
|
|
4019
|
+
let o = i.map(() => 0), s = i.map((e) => e[0]);
|
|
4020
|
+
for (; s.every((e) => e);) {
|
|
4021
|
+
let e = Math.min(...s.map((e) => e.content.length));
|
|
4022
|
+
for (let t = 0; t < n; t++) {
|
|
4023
|
+
let n = s[t];
|
|
4024
|
+
n.content.length === e ? (a[t].push(n), o[t] += 1, s[t] = i[t][o[t]]) : (a[t].push({
|
|
4025
|
+
...n,
|
|
4026
|
+
content: n.content.slice(0, e)
|
|
4027
|
+
}), s[t] = {
|
|
4028
|
+
...n,
|
|
4029
|
+
content: n.content.slice(e),
|
|
4030
|
+
offset: n.offset + e
|
|
4031
|
+
});
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
return t;
|
|
4036
|
+
}
|
|
4037
|
+
function codeToTokens(e, n, r) {
|
|
4038
|
+
let i, a, o, s, c, l;
|
|
4039
|
+
if ("themes" in r) {
|
|
4040
|
+
let { defaultColor: u = "light", cssVariablePrefix: d = "--shiki-", colorsRendering: f = "css-vars" } = r, m = Object.entries(r.themes).filter((e) => e[1]).map((e) => ({
|
|
4041
|
+
color: e[0],
|
|
4042
|
+
theme: e[1]
|
|
4043
|
+
})).sort((e, t) => e.color === u ? -1 : t.color === u ? 1 : 0);
|
|
4044
|
+
if (m.length === 0) throw new ShikiError("`themes` option must not be empty");
|
|
4045
|
+
let h = codeToTokensWithThemes(e, n, r);
|
|
4046
|
+
if (l = getLastGrammarStateFromMap(h), u && DEFAULT_COLOR_LIGHT_DARK !== u && !m.find((e) => e.color === u)) throw new ShikiError(`\`themes\` option must contain the defaultColor key \`${u}\``);
|
|
4047
|
+
let g = m.map((t) => e.getTheme(t.theme)), _ = m.map((e) => e.color);
|
|
4048
|
+
o = h.map((e) => e.map((e) => flatTokenVariants(e, _, d, u, f))), l && setLastGrammarStateToMap(o, l);
|
|
4049
|
+
let v = m.map((e) => resolveColorReplacements(e.theme, r));
|
|
4050
|
+
a = mapThemeColors(m, g, v, d, u, "fg", f), i = mapThemeColors(m, g, v, d, u, "bg", f), s = `shiki-themes ${g.map((e) => e.name).join(" ")}`, c = u ? void 0 : [a, i].join(";");
|
|
4051
|
+
} else if ("theme" in r) {
|
|
4052
|
+
let t = resolveColorReplacements(r.theme, r);
|
|
4053
|
+
o = codeToTokensBase(e, n, r);
|
|
4054
|
+
let c = e.getTheme(r.theme);
|
|
4055
|
+
i = applyColorReplacements(c.bg, t), a = applyColorReplacements(c.fg, t), s = c.name, l = getLastGrammarStateFromMap(o);
|
|
4056
|
+
} else throw new ShikiError("Invalid options, either `theme` or `themes` must be provided");
|
|
4057
|
+
return {
|
|
4058
|
+
tokens: o,
|
|
4059
|
+
fg: a,
|
|
4060
|
+
bg: i,
|
|
4061
|
+
themeName: s,
|
|
4062
|
+
rootStyle: c,
|
|
4063
|
+
grammarState: l
|
|
4064
|
+
};
|
|
4065
|
+
}
|
|
4066
|
+
function mapThemeColors(e, n, r, i, a, o, s) {
|
|
4067
|
+
return e.map((c, l) => {
|
|
4068
|
+
let u = applyColorReplacements(n[l][o], r[l]) || "inherit", d = `${i + c.color}${o === "bg" ? "-bg" : ""}:${u}`;
|
|
4069
|
+
if (l === 0 && a) {
|
|
4070
|
+
if (a === DEFAULT_COLOR_LIGHT_DARK && e.length > 1) {
|
|
4071
|
+
let i = e.findIndex((e) => e.color === "light"), a = e.findIndex((e) => e.color === "dark");
|
|
4072
|
+
if (i === -1 || a === -1) throw new ShikiError("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
4073
|
+
return `light-dark(${applyColorReplacements(n[i][o], r[i]) || "inherit"}, ${applyColorReplacements(n[a][o], r[a]) || "inherit"});${d}`;
|
|
4074
|
+
}
|
|
4075
|
+
return u;
|
|
4076
|
+
}
|
|
4077
|
+
return s === "css-vars" ? d : null;
|
|
4078
|
+
}).filter((e) => !!e).join(";");
|
|
4079
|
+
}
|
|
4080
|
+
function codeToHast(e, t, n, r = {
|
|
4081
|
+
meta: {},
|
|
4082
|
+
options: n,
|
|
4083
|
+
codeToHast: (t, n) => codeToHast(e, t, n),
|
|
4084
|
+
codeToTokens: (t, n) => codeToTokens(e, t, n)
|
|
4085
|
+
}) {
|
|
4086
|
+
let i = t;
|
|
4087
|
+
for (let e of getTransformers(n)) i = e.preprocess?.call(r, i, n) || i;
|
|
4088
|
+
let { tokens: a, fg: o, bg: s, themeName: c, rootStyle: l, grammarState: u } = codeToTokens(e, i, n), { mergeWhitespaces: d = !0, mergeSameStyleTokens: f = !1 } = n;
|
|
4089
|
+
d === !0 ? a = mergeWhitespaceTokens(a) : d === "never" && (a = splitWhitespaceTokens(a)), f && (a = mergeAdjacentStyledTokens(a));
|
|
4090
|
+
let m = {
|
|
4091
|
+
...r,
|
|
4092
|
+
get source() {
|
|
4093
|
+
return i;
|
|
4094
|
+
}
|
|
4095
|
+
};
|
|
4096
|
+
for (let e of getTransformers(n)) a = e.tokens?.call(m, a) || a;
|
|
4097
|
+
return tokensToHast(a, {
|
|
4098
|
+
...n,
|
|
4099
|
+
fg: o,
|
|
4100
|
+
bg: s,
|
|
4101
|
+
themeName: c,
|
|
4102
|
+
rootStyle: n.rootStyle === !1 ? !1 : n.rootStyle ?? l
|
|
4103
|
+
}, m, u);
|
|
4104
|
+
}
|
|
4105
|
+
function tokensToHast(e, t, n, r = getLastGrammarStateFromMap(e)) {
|
|
4106
|
+
let i = getTransformers(t), a = [], o = {
|
|
4107
|
+
type: "root",
|
|
4108
|
+
children: []
|
|
4109
|
+
}, { structure: s = "classic", tabindex: c = "0" } = t, l = { class: `shiki ${t.themeName || ""}` };
|
|
4110
|
+
t.rootStyle !== !1 && (t.rootStyle == null ? l.style = `background-color:${t.bg};color:${t.fg}` : l.style = t.rootStyle), c !== !1 && c != null && (l.tabindex = c.toString());
|
|
4111
|
+
for (let [e, n] of Object.entries(t.meta || {})) e.startsWith("_") || (l[e] = n);
|
|
4112
|
+
let u = {
|
|
4113
|
+
type: "element",
|
|
4114
|
+
tagName: "pre",
|
|
4115
|
+
properties: l,
|
|
4116
|
+
children: [],
|
|
4117
|
+
data: t.data
|
|
4118
|
+
}, d = {
|
|
4119
|
+
type: "element",
|
|
4120
|
+
tagName: "code",
|
|
4121
|
+
properties: {},
|
|
4122
|
+
children: a
|
|
4123
|
+
}, f = [], m = {
|
|
4124
|
+
...n,
|
|
4125
|
+
structure: s,
|
|
4126
|
+
addClassToHast,
|
|
4127
|
+
get source() {
|
|
4128
|
+
return n.source;
|
|
4129
|
+
},
|
|
4130
|
+
get tokens() {
|
|
4131
|
+
return e;
|
|
4132
|
+
},
|
|
4133
|
+
get options() {
|
|
4134
|
+
return t;
|
|
4135
|
+
},
|
|
4136
|
+
get root() {
|
|
4137
|
+
return o;
|
|
4138
|
+
},
|
|
4139
|
+
get pre() {
|
|
4140
|
+
return u;
|
|
4141
|
+
},
|
|
4142
|
+
get code() {
|
|
4143
|
+
return d;
|
|
4144
|
+
},
|
|
4145
|
+
get lines() {
|
|
4146
|
+
return f;
|
|
4147
|
+
}
|
|
4148
|
+
};
|
|
4149
|
+
if (e.forEach((e, t) => {
|
|
4150
|
+
t && (s === "inline" ? o.children.push({
|
|
4151
|
+
type: "element",
|
|
4152
|
+
tagName: "br",
|
|
4153
|
+
properties: {},
|
|
4154
|
+
children: []
|
|
4155
|
+
}) : s === "classic" && a.push({
|
|
4156
|
+
type: "text",
|
|
4157
|
+
value: "\n"
|
|
4158
|
+
}));
|
|
4159
|
+
let n = {
|
|
4160
|
+
type: "element",
|
|
4161
|
+
tagName: "span",
|
|
4162
|
+
properties: { class: "line" },
|
|
4163
|
+
children: []
|
|
4164
|
+
}, r = 0;
|
|
4165
|
+
for (let a of e) {
|
|
4166
|
+
let e = {
|
|
4167
|
+
type: "element",
|
|
4168
|
+
tagName: "span",
|
|
4169
|
+
properties: { ...a.htmlAttrs },
|
|
4170
|
+
children: [{
|
|
4171
|
+
type: "text",
|
|
4172
|
+
value: a.content
|
|
4173
|
+
}]
|
|
4174
|
+
}, c = stringifyTokenStyle(a.htmlStyle || getTokenStyleObject(a));
|
|
4175
|
+
c && (e.properties.style = c);
|
|
4176
|
+
for (let o of i) e = o?.span?.call(m, e, t + 1, r, n, a) || e;
|
|
4177
|
+
s === "inline" ? o.children.push(e) : s === "classic" && n.children.push(e), r += a.content.length;
|
|
4178
|
+
}
|
|
4179
|
+
if (s === "classic") {
|
|
4180
|
+
for (let e of i) n = e?.line?.call(m, n, t + 1) || n;
|
|
4181
|
+
f.push(n), a.push(n);
|
|
4182
|
+
} else s === "inline" && f.push(n);
|
|
4183
|
+
}), s === "classic") {
|
|
4184
|
+
for (let e of i) d = e?.code?.call(m, d) || d;
|
|
4185
|
+
u.children.push(d);
|
|
4186
|
+
for (let e of i) u = e?.pre?.call(m, u) || u;
|
|
4187
|
+
o.children.push(u);
|
|
4188
|
+
} else if (s === "inline") {
|
|
4189
|
+
let e = [], t = {
|
|
4190
|
+
type: "element",
|
|
4191
|
+
tagName: "span",
|
|
4192
|
+
properties: { class: "line" },
|
|
4193
|
+
children: []
|
|
4194
|
+
};
|
|
4195
|
+
for (let n of o.children) n.type === "element" && n.tagName === "br" ? (e.push(t), t = {
|
|
4196
|
+
type: "element",
|
|
4197
|
+
tagName: "span",
|
|
4198
|
+
properties: { class: "line" },
|
|
4199
|
+
children: []
|
|
4200
|
+
}) : (n.type === "element" || n.type === "text") && t.children.push(n);
|
|
4201
|
+
e.push(t);
|
|
4202
|
+
let n = {
|
|
4203
|
+
type: "element",
|
|
4204
|
+
tagName: "code",
|
|
4205
|
+
properties: {},
|
|
4206
|
+
children: e
|
|
4207
|
+
};
|
|
4208
|
+
for (let e of i) n = e?.code?.call(m, n) || n;
|
|
4209
|
+
o.children = [];
|
|
4210
|
+
for (let e = 0; e < n.children.length; e++) {
|
|
4211
|
+
e > 0 && o.children.push({
|
|
4212
|
+
type: "element",
|
|
4213
|
+
tagName: "br",
|
|
4214
|
+
properties: {},
|
|
4215
|
+
children: []
|
|
4216
|
+
});
|
|
4217
|
+
let t = n.children[e];
|
|
4218
|
+
t.type === "element" && o.children.push(...t.children);
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
4221
|
+
let h = o;
|
|
4222
|
+
for (let e of i) h = e?.root?.call(m, h) || h;
|
|
4223
|
+
return r && setLastGrammarStateToMap(h, r), h;
|
|
4224
|
+
}
|
|
4225
|
+
function mergeWhitespaceTokens(e) {
|
|
4226
|
+
return e.map((e) => {
|
|
4227
|
+
let t = [], n = "", r;
|
|
4228
|
+
return e.forEach((i, a) => {
|
|
4229
|
+
let o = !(i.fontStyle && (i.fontStyle & FontStyle.Underline || i.fontStyle & FontStyle.Strikethrough));
|
|
4230
|
+
o && i.content.match(/^\s+$/) && e[a + 1] ? (r === void 0 && (r = i.offset), n += i.content) : n ? (o ? t.push({
|
|
4231
|
+
...i,
|
|
4232
|
+
offset: r,
|
|
4233
|
+
content: n + i.content
|
|
4234
|
+
}) : t.push({
|
|
4235
|
+
content: n,
|
|
4236
|
+
offset: r
|
|
4237
|
+
}, i), r = void 0, n = "") : t.push(i);
|
|
4238
|
+
}), t;
|
|
4239
|
+
});
|
|
4240
|
+
}
|
|
4241
|
+
function splitWhitespaceTokens(e) {
|
|
4242
|
+
return e.map((e) => e.flatMap((e) => {
|
|
4243
|
+
if (e.content.match(/^\s+$/)) return e;
|
|
4244
|
+
let t = e.content.match(/^(\s*)(.*?)(\s*)$/);
|
|
4245
|
+
if (!t) return e;
|
|
4246
|
+
let [, n, r, i] = t;
|
|
4247
|
+
if (!n && !i) return e;
|
|
4248
|
+
let a = [{
|
|
4249
|
+
...e,
|
|
4250
|
+
offset: e.offset + n.length,
|
|
4251
|
+
content: r
|
|
4252
|
+
}];
|
|
4253
|
+
return n && a.unshift({
|
|
4254
|
+
content: n,
|
|
4255
|
+
offset: e.offset
|
|
4256
|
+
}), i && a.push({
|
|
4257
|
+
content: i,
|
|
4258
|
+
offset: e.offset + n.length + r.length
|
|
4259
|
+
}), a;
|
|
4260
|
+
}));
|
|
4261
|
+
}
|
|
4262
|
+
function mergeAdjacentStyledTokens(e) {
|
|
4263
|
+
return e.map((e) => {
|
|
4264
|
+
let t = [];
|
|
4265
|
+
for (let n of e) {
|
|
4266
|
+
if (t.length === 0) {
|
|
4267
|
+
t.push({ ...n });
|
|
4268
|
+
continue;
|
|
4269
|
+
}
|
|
4270
|
+
let e = t[t.length - 1], r = stringifyTokenStyle(e.htmlStyle || getTokenStyleObject(e)), i = stringifyTokenStyle(n.htmlStyle || getTokenStyleObject(n)), a = e.fontStyle && (e.fontStyle & FontStyle.Underline || e.fontStyle & FontStyle.Strikethrough), o = n.fontStyle && (n.fontStyle & FontStyle.Underline || n.fontStyle & FontStyle.Strikethrough);
|
|
4271
|
+
!a && !o && r === i ? e.content += n.content : t.push({ ...n });
|
|
4272
|
+
}
|
|
4273
|
+
return t;
|
|
4274
|
+
});
|
|
4275
|
+
}
|
|
4276
|
+
var hastToHtml = toHtml;
|
|
4277
|
+
function codeToHtml(e, t, n) {
|
|
4278
|
+
let r = {
|
|
4279
|
+
meta: {},
|
|
4280
|
+
options: n,
|
|
4281
|
+
codeToHast: (t, n) => codeToHast(e, t, n),
|
|
4282
|
+
codeToTokens: (t, n) => codeToTokens(e, t, n)
|
|
4283
|
+
}, i = hastToHtml(codeToHast(e, t, n, r));
|
|
4284
|
+
for (let e of getTransformers(n)) i = e.postprocess?.call(r, i, n) || i;
|
|
4285
|
+
return i;
|
|
4286
|
+
}
|
|
4287
|
+
var VSCODE_FALLBACK_EDITOR_FG = {
|
|
4288
|
+
light: "#333333",
|
|
4289
|
+
dark: "#bbbbbb"
|
|
4290
|
+
}, VSCODE_FALLBACK_EDITOR_BG = {
|
|
4291
|
+
light: "#fffffe",
|
|
4292
|
+
dark: "#1e1e1e"
|
|
4293
|
+
}, RESOLVED_KEY = "__shiki_resolved";
|
|
4294
|
+
function normalizeTheme(e) {
|
|
4295
|
+
if (e?.[RESOLVED_KEY]) return e;
|
|
4296
|
+
let t = { ...e };
|
|
4297
|
+
t.tokenColors && !t.settings && (t.settings = t.tokenColors, delete t.tokenColors), t.type ||= "dark", t.colorReplacements = { ...t.colorReplacements }, t.settings ||= [];
|
|
4298
|
+
let { bg: n, fg: r } = t;
|
|
4299
|
+
if (!n || !r) {
|
|
4300
|
+
let e = t.settings ? t.settings.find((e) => !e.name && !e.scope) : void 0;
|
|
4301
|
+
e?.settings?.foreground && (r = e.settings.foreground), e?.settings?.background && (n = e.settings.background), !r && t?.colors?.["editor.foreground"] && (r = t.colors["editor.foreground"]), !n && t?.colors?.["editor.background"] && (n = t.colors["editor.background"]), r ||= t.type === "light" ? VSCODE_FALLBACK_EDITOR_FG.light : VSCODE_FALLBACK_EDITOR_FG.dark, n ||= t.type === "light" ? VSCODE_FALLBACK_EDITOR_BG.light : VSCODE_FALLBACK_EDITOR_BG.dark, t.fg = r, t.bg = n;
|
|
4302
|
+
}
|
|
4303
|
+
t.settings[0] && t.settings[0].settings && !t.settings[0].scope || t.settings.unshift({ settings: {
|
|
4304
|
+
foreground: t.fg,
|
|
4305
|
+
background: t.bg
|
|
4306
|
+
} });
|
|
4307
|
+
let i = 0, a = /* @__PURE__ */ new Map();
|
|
4308
|
+
function o(e) {
|
|
4309
|
+
if (a.has(e)) return a.get(e);
|
|
4310
|
+
i += 1;
|
|
4311
|
+
let n = `#${i.toString(16).padStart(8, "0").toLowerCase()}`;
|
|
4312
|
+
return t.colorReplacements?.[`#${n}`] ? o(e) : (a.set(e, n), n);
|
|
4313
|
+
}
|
|
4314
|
+
t.settings = t.settings.map((e) => {
|
|
4315
|
+
let n = e.settings?.foreground && !e.settings.foreground.startsWith("#"), r = e.settings?.background && !e.settings.background.startsWith("#");
|
|
4316
|
+
if (!n && !r) return e;
|
|
4317
|
+
let i = {
|
|
4318
|
+
...e,
|
|
4319
|
+
settings: { ...e.settings }
|
|
4320
|
+
};
|
|
4321
|
+
if (n) {
|
|
4322
|
+
let n = o(e.settings.foreground);
|
|
4323
|
+
t.colorReplacements[n] = e.settings.foreground, i.settings.foreground = n;
|
|
4324
|
+
}
|
|
4325
|
+
if (r) {
|
|
4326
|
+
let n = o(e.settings.background);
|
|
4327
|
+
t.colorReplacements[n] = e.settings.background, i.settings.background = n;
|
|
4328
|
+
}
|
|
4329
|
+
return i;
|
|
4330
|
+
});
|
|
4331
|
+
for (let e of Object.keys(t.colors || {})) if ((e === "editor.foreground" || e === "editor.background" || e.startsWith("terminal.ansi")) && !t.colors[e]?.startsWith("#")) {
|
|
4332
|
+
let n = o(t.colors[e]);
|
|
4333
|
+
t.colorReplacements[n] = t.colors[e], t.colors[e] = n;
|
|
4334
|
+
}
|
|
4335
|
+
return Object.defineProperty(t, RESOLVED_KEY, {
|
|
4336
|
+
enumerable: !1,
|
|
4337
|
+
writable: !1,
|
|
4338
|
+
value: !0
|
|
4339
|
+
}), t;
|
|
4340
|
+
}
|
|
4341
|
+
async function resolveLangs(e) {
|
|
4342
|
+
return Array.from(new Set((await Promise.all(e.filter((e) => !isSpecialLang(e)).map(async (e) => await normalizeGetter(e).then((e) => Array.isArray(e) ? e : [e])))).flat()));
|
|
4343
|
+
}
|
|
4344
|
+
async function resolveThemes(e) {
|
|
4345
|
+
return (await Promise.all(e.map(async (e) => isSpecialTheme(e) ? null : normalizeTheme(await normalizeGetter(e))))).filter((e) => !!e);
|
|
4346
|
+
}
|
|
4347
|
+
var _emitDeprecation = 3, _emitError = !1;
|
|
4348
|
+
function enableDeprecationWarnings(e = !0, t = !1) {
|
|
4349
|
+
_emitDeprecation = e, _emitError = t;
|
|
4350
|
+
}
|
|
4351
|
+
function warnDeprecated(e, t = 3) {
|
|
4352
|
+
if (_emitDeprecation && !(typeof _emitDeprecation == "number" && t > _emitDeprecation)) {
|
|
4353
|
+
if (_emitError) throw Error(`[SHIKI DEPRECATE]: ${e}`);
|
|
4354
|
+
console.trace(`[SHIKI DEPRECATE]: ${e}`);
|
|
4355
|
+
}
|
|
4356
|
+
}
|
|
4357
|
+
var ShikiError$1 = class extends Error {
|
|
4358
|
+
constructor(e) {
|
|
4359
|
+
super(e), this.name = "ShikiError";
|
|
4360
|
+
}
|
|
4361
|
+
};
|
|
4362
|
+
function resolveLangAlias(e, t) {
|
|
4363
|
+
if (!t) return e;
|
|
4364
|
+
if (t[e]) {
|
|
4365
|
+
let n = /* @__PURE__ */ new Set([e]);
|
|
4366
|
+
for (; t[e];) {
|
|
4367
|
+
if (e = t[e], n.has(e)) throw new ShikiError$1(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);
|
|
4368
|
+
n.add(e);
|
|
4369
|
+
}
|
|
4370
|
+
}
|
|
4371
|
+
return e;
|
|
4372
|
+
}
|
|
4373
|
+
var Registry = class extends Registry$1 {
|
|
4374
|
+
constructor(e, t, n, r = {}) {
|
|
4375
|
+
super(e), this._resolver = e, this._themes = t, this._langs = n, this._alias = r, this._themes.map((e) => this.loadTheme(e)), this.loadLanguages(this._langs);
|
|
4376
|
+
}
|
|
4377
|
+
_resolvedThemes = /* @__PURE__ */ new Map();
|
|
4378
|
+
_resolvedGrammars = /* @__PURE__ */ new Map();
|
|
4379
|
+
_langMap = /* @__PURE__ */ new Map();
|
|
4380
|
+
_langGraph = /* @__PURE__ */ new Map();
|
|
4381
|
+
_textmateThemeCache = /* @__PURE__ */ new WeakMap();
|
|
4382
|
+
_loadedThemesCache = null;
|
|
4383
|
+
_loadedLanguagesCache = null;
|
|
4384
|
+
getTheme(e) {
|
|
4385
|
+
return typeof e == "string" ? this._resolvedThemes.get(e) : this.loadTheme(e);
|
|
4386
|
+
}
|
|
4387
|
+
loadTheme(e) {
|
|
4388
|
+
let t = normalizeTheme(e);
|
|
4389
|
+
return t.name && (this._resolvedThemes.set(t.name, t), this._loadedThemesCache = null), t;
|
|
4390
|
+
}
|
|
4391
|
+
getLoadedThemes() {
|
|
4392
|
+
return this._loadedThemesCache ||= [...this._resolvedThemes.keys()], this._loadedThemesCache;
|
|
4393
|
+
}
|
|
4394
|
+
setTheme(e) {
|
|
4395
|
+
let t = this._textmateThemeCache.get(e);
|
|
4396
|
+
t || (t = Theme.createFromRawTheme(e), this._textmateThemeCache.set(e, t)), this._syncRegistry.setTheme(t);
|
|
4397
|
+
}
|
|
4398
|
+
getGrammar(e) {
|
|
4399
|
+
return e = resolveLangAlias(e, this._alias), this._resolvedGrammars.get(e);
|
|
4400
|
+
}
|
|
4401
|
+
loadLanguage(e) {
|
|
4402
|
+
if (this.getGrammar(e.name)) return;
|
|
4403
|
+
let t = new Set([...this._langMap.values()].filter((t) => t.embeddedLangsLazy?.includes(e.name)));
|
|
4404
|
+
this._resolver.addLanguage(e);
|
|
4405
|
+
let n = {
|
|
4406
|
+
balancedBracketSelectors: e.balancedBracketSelectors || ["*"],
|
|
4407
|
+
unbalancedBracketSelectors: e.unbalancedBracketSelectors || []
|
|
4408
|
+
};
|
|
4409
|
+
this._syncRegistry._rawGrammars.set(e.scopeName, e);
|
|
4410
|
+
let r = this.loadGrammarWithConfiguration(e.scopeName, 1, n);
|
|
4411
|
+
if (r.name = e.name, this._resolvedGrammars.set(e.name, r), e.aliases && e.aliases.forEach((t) => {
|
|
4412
|
+
this._alias[t] = e.name;
|
|
4413
|
+
}), this._loadedLanguagesCache = null, t.size) for (let e of t) this._resolvedGrammars.delete(e.name), this._loadedLanguagesCache = null, this._syncRegistry?._injectionGrammars?.delete(e.scopeName), this._syncRegistry?._grammars?.delete(e.scopeName), this.loadLanguage(this._langMap.get(e.name));
|
|
4414
|
+
}
|
|
4415
|
+
dispose() {
|
|
4416
|
+
super.dispose(), this._resolvedThemes.clear(), this._resolvedGrammars.clear(), this._langMap.clear(), this._langGraph.clear(), this._loadedThemesCache = null;
|
|
4417
|
+
}
|
|
4418
|
+
loadLanguages(e) {
|
|
4419
|
+
for (let t of e) this.resolveEmbeddedLanguages(t);
|
|
4420
|
+
let t = Array.from(this._langGraph.entries()), n = t.filter(([e, t]) => !t);
|
|
4421
|
+
if (n.length) {
|
|
4422
|
+
let e = t.filter(([e, t]) => t ? (t.embeddedLanguages || t.embeddedLangs)?.some((e) => n.map(([e]) => e).includes(e)) : !1).filter((e) => !n.includes(e));
|
|
4423
|
+
throw new ShikiError$1(`Missing languages ${n.map(([e]) => `\`${e}\``).join(", ")}, required by ${e.map(([e]) => `\`${e}\``).join(", ")}`);
|
|
4424
|
+
}
|
|
4425
|
+
for (let [e, n] of t) this._resolver.addLanguage(n);
|
|
4426
|
+
for (let [e, n] of t) this.loadLanguage(n);
|
|
4427
|
+
}
|
|
4428
|
+
getLoadedLanguages() {
|
|
4429
|
+
return this._loadedLanguagesCache ||= [.../* @__PURE__ */ new Set([...this._resolvedGrammars.keys(), ...Object.keys(this._alias)])], this._loadedLanguagesCache;
|
|
4430
|
+
}
|
|
4431
|
+
resolveEmbeddedLanguages(e) {
|
|
4432
|
+
this._langMap.set(e.name, e), this._langGraph.set(e.name, e);
|
|
4433
|
+
let t = e.embeddedLanguages ?? e.embeddedLangs;
|
|
4434
|
+
if (t) for (let e of t) this._langGraph.set(e, this._langMap.get(e));
|
|
4435
|
+
}
|
|
4436
|
+
}, Resolver = class {
|
|
4437
|
+
_langs = /* @__PURE__ */ new Map();
|
|
4438
|
+
_scopeToLang = /* @__PURE__ */ new Map();
|
|
4439
|
+
_injections = /* @__PURE__ */ new Map();
|
|
4440
|
+
_onigLib;
|
|
4441
|
+
constructor(e, t) {
|
|
4442
|
+
this._onigLib = {
|
|
4443
|
+
createOnigScanner: (t) => e.createScanner(t),
|
|
4444
|
+
createOnigString: (t) => e.createString(t)
|
|
4445
|
+
}, t.forEach((e) => this.addLanguage(e));
|
|
4446
|
+
}
|
|
4447
|
+
get onigLib() {
|
|
4448
|
+
return this._onigLib;
|
|
4449
|
+
}
|
|
4450
|
+
getLangRegistration(e) {
|
|
4451
|
+
return this._langs.get(e);
|
|
4452
|
+
}
|
|
4453
|
+
loadGrammar(e) {
|
|
4454
|
+
return this._scopeToLang.get(e);
|
|
4455
|
+
}
|
|
4456
|
+
addLanguage(e) {
|
|
4457
|
+
this._langs.set(e.name, e), e.aliases && e.aliases.forEach((t) => {
|
|
4458
|
+
this._langs.set(t, e);
|
|
4459
|
+
}), this._scopeToLang.set(e.scopeName, e), e.injectTo && e.injectTo.forEach((t) => {
|
|
4460
|
+
this._injections.get(t) || this._injections.set(t, []), this._injections.get(t).push(e.scopeName);
|
|
4461
|
+
});
|
|
4462
|
+
}
|
|
4463
|
+
getInjections(e) {
|
|
4464
|
+
let t = e.split("."), n = [];
|
|
4465
|
+
for (let e = 1; e <= t.length; e++) {
|
|
4466
|
+
let r = t.slice(0, e).join(".");
|
|
4467
|
+
n = [...n, ...this._injections.get(r) || []];
|
|
4468
|
+
}
|
|
4469
|
+
return n;
|
|
4470
|
+
}
|
|
4471
|
+
}, instancesCount = 0;
|
|
4472
|
+
function createShikiInternalSync(e) {
|
|
4473
|
+
instancesCount += 1, e.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.`);
|
|
4474
|
+
let t = !1;
|
|
4475
|
+
if (!e.engine) throw new ShikiError$1("`engine` option is required for synchronous mode");
|
|
4476
|
+
let n = (e.langs || []).flat(1), r = (e.themes || []).flat(1).map(normalizeTheme), i = new Registry(new Resolver(e.engine, n), r, n, e.langAlias), a;
|
|
4477
|
+
function o(t) {
|
|
4478
|
+
return resolveLangAlias(t, e.langAlias);
|
|
4479
|
+
}
|
|
4480
|
+
function s(e) {
|
|
4481
|
+
_();
|
|
4482
|
+
let t = i.getGrammar(typeof e == "string" ? e : e.name);
|
|
4483
|
+
if (!t) throw new ShikiError$1(`Language \`${e}\` not found, you may need to load it first`);
|
|
4484
|
+
return t;
|
|
4485
|
+
}
|
|
4486
|
+
function c(e) {
|
|
4487
|
+
if (e === "none") return {
|
|
4488
|
+
bg: "",
|
|
4489
|
+
fg: "",
|
|
4490
|
+
name: "none",
|
|
4491
|
+
settings: [],
|
|
4492
|
+
type: "dark"
|
|
4493
|
+
};
|
|
4494
|
+
_();
|
|
4495
|
+
let t = i.getTheme(e);
|
|
4496
|
+
if (!t) throw new ShikiError$1(`Theme \`${e}\` not found, you may need to load it first`);
|
|
4497
|
+
return t;
|
|
4498
|
+
}
|
|
4499
|
+
function l(e) {
|
|
4500
|
+
_();
|
|
4501
|
+
let t = c(e);
|
|
4502
|
+
return a !== e && (i.setTheme(t), a = e), {
|
|
4503
|
+
theme: t,
|
|
4504
|
+
colorMap: i.getColorMap()
|
|
4505
|
+
};
|
|
4506
|
+
}
|
|
4507
|
+
function u() {
|
|
4508
|
+
return _(), i.getLoadedThemes();
|
|
4509
|
+
}
|
|
4510
|
+
function d() {
|
|
4511
|
+
return _(), i.getLoadedLanguages();
|
|
4512
|
+
}
|
|
4513
|
+
function f(...e) {
|
|
4514
|
+
_(), i.loadLanguages(e.flat(1));
|
|
4515
|
+
}
|
|
4516
|
+
async function m(...e) {
|
|
4517
|
+
return f(await resolveLangs(e));
|
|
4518
|
+
}
|
|
4519
|
+
function h(...e) {
|
|
4520
|
+
_();
|
|
4521
|
+
for (let t of e.flat(1)) i.loadTheme(t);
|
|
4522
|
+
}
|
|
4523
|
+
async function g(...e) {
|
|
4524
|
+
return _(), h(await resolveThemes(e));
|
|
4525
|
+
}
|
|
4526
|
+
function _() {
|
|
4527
|
+
if (t) throw new ShikiError$1("Shiki instance has been disposed");
|
|
4528
|
+
}
|
|
4529
|
+
function v() {
|
|
4530
|
+
t || (t = !0, i.dispose(), --instancesCount);
|
|
4531
|
+
}
|
|
4532
|
+
return {
|
|
4533
|
+
setTheme: l,
|
|
4534
|
+
getTheme: c,
|
|
4535
|
+
getLanguage: s,
|
|
4536
|
+
getLoadedThemes: u,
|
|
4537
|
+
getLoadedLanguages: d,
|
|
4538
|
+
resolveLangAlias: o,
|
|
4539
|
+
loadLanguage: m,
|
|
4540
|
+
loadLanguageSync: f,
|
|
4541
|
+
loadTheme: g,
|
|
4542
|
+
loadThemeSync: h,
|
|
4543
|
+
dispose: v,
|
|
4544
|
+
[Symbol.dispose]: v
|
|
4545
|
+
};
|
|
4546
|
+
}
|
|
4547
|
+
async function createShikiInternal(e) {
|
|
4548
|
+
e.engine || warnDeprecated("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");
|
|
4549
|
+
let [t, n, r] = await Promise.all([
|
|
4550
|
+
resolveThemes(e.themes || []),
|
|
4551
|
+
resolveLangs(e.langs || []),
|
|
4552
|
+
e.engine
|
|
4553
|
+
]);
|
|
4554
|
+
return createShikiInternalSync({
|
|
4555
|
+
...e,
|
|
4556
|
+
themes: t,
|
|
4557
|
+
langs: n,
|
|
4558
|
+
engine: r
|
|
4559
|
+
});
|
|
4560
|
+
}
|
|
4561
|
+
async function createHighlighterCore(e) {
|
|
4562
|
+
let t = await createShikiInternal(e);
|
|
4563
|
+
return {
|
|
4564
|
+
getLastGrammarState: (...e) => getLastGrammarState(t, ...e),
|
|
4565
|
+
codeToTokensBase: (e, n) => codeToTokensBase(t, e, n),
|
|
4566
|
+
codeToTokensWithThemes: (e, n) => codeToTokensWithThemes(t, e, n),
|
|
4567
|
+
codeToTokens: (e, n) => codeToTokens(t, e, n),
|
|
4568
|
+
codeToHast: (e, n) => codeToHast(t, e, n),
|
|
4569
|
+
codeToHtml: (e, n) => codeToHtml(t, e, n),
|
|
4570
|
+
getBundledLanguages: () => ({}),
|
|
4571
|
+
getBundledThemes: () => ({}),
|
|
4572
|
+
...t,
|
|
4573
|
+
getInternalContext: () => t
|
|
4574
|
+
};
|
|
4575
|
+
}
|
|
4576
|
+
function createHighlighterCoreSync(e) {
|
|
4577
|
+
let t = createShikiInternalSync(e);
|
|
4578
|
+
return {
|
|
4579
|
+
getLastGrammarState: (...e) => getLastGrammarState(t, ...e),
|
|
4580
|
+
codeToTokensBase: (e, n) => codeToTokensBase(t, e, n),
|
|
4581
|
+
codeToTokensWithThemes: (e, n) => codeToTokensWithThemes(t, e, n),
|
|
4582
|
+
codeToTokens: (e, n) => codeToTokens(t, e, n),
|
|
4583
|
+
codeToHast: (e, n) => codeToHast(t, e, n),
|
|
4584
|
+
codeToHtml: (e, n) => codeToHtml(t, e, n),
|
|
4585
|
+
getBundledLanguages: () => ({}),
|
|
4586
|
+
getBundledThemes: () => ({}),
|
|
4587
|
+
...t,
|
|
4588
|
+
getInternalContext: () => t
|
|
4589
|
+
};
|
|
4590
|
+
}
|
|
4591
|
+
function makeSingletonHighlighterCore(e) {
|
|
4592
|
+
let t;
|
|
4593
|
+
async function n(n) {
|
|
4594
|
+
if (t) {
|
|
4595
|
+
let e = await t;
|
|
4596
|
+
return await Promise.all([e.loadTheme(...n.themes || []), e.loadLanguage(...n.langs || [])]), e;
|
|
4597
|
+
} else return t = e({
|
|
4598
|
+
...n,
|
|
4599
|
+
themes: n.themes || [],
|
|
4600
|
+
langs: n.langs || []
|
|
4601
|
+
}), t;
|
|
4602
|
+
}
|
|
4603
|
+
return n;
|
|
4604
|
+
}
|
|
4605
|
+
var getSingletonHighlighterCore = /* @__PURE__ */ makeSingletonHighlighterCore(createHighlighterCore);
|
|
4606
|
+
function createBundledHighlighter(e) {
|
|
4607
|
+
let n = e.langs, r = e.themes, i = e.engine;
|
|
4608
|
+
async function a(e) {
|
|
4609
|
+
function a(r) {
|
|
4610
|
+
if (typeof r == "string") {
|
|
4611
|
+
if (r = e.langAlias?.[r] || r, isSpecialLang(r)) return [];
|
|
4612
|
+
let i = n[r];
|
|
4613
|
+
if (!i) throw new ShikiError(`Language \`${r}\` is not included in this bundle. You may want to load it from external source.`);
|
|
4614
|
+
return i;
|
|
4615
|
+
}
|
|
4616
|
+
return r;
|
|
4617
|
+
}
|
|
4618
|
+
function o(e) {
|
|
4619
|
+
if (isSpecialTheme(e)) return "none";
|
|
4620
|
+
if (typeof e == "string") {
|
|
4621
|
+
let n = r[e];
|
|
4622
|
+
if (!n) throw new ShikiError(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);
|
|
4623
|
+
return n;
|
|
4624
|
+
}
|
|
4625
|
+
return e;
|
|
4626
|
+
}
|
|
4627
|
+
let s = (e.themes ?? []).map((e) => o(e)), c = (e.langs ?? []).map((e) => a(e)), l = await createHighlighterCore({
|
|
4628
|
+
engine: e.engine ?? i(),
|
|
4629
|
+
...e,
|
|
4630
|
+
themes: s,
|
|
4631
|
+
langs: c
|
|
4632
|
+
});
|
|
4633
|
+
return {
|
|
4634
|
+
...l,
|
|
4635
|
+
loadLanguage(...e) {
|
|
4636
|
+
return l.loadLanguage(...e.map(a));
|
|
4637
|
+
},
|
|
4638
|
+
loadTheme(...e) {
|
|
4639
|
+
return l.loadTheme(...e.map(o));
|
|
4640
|
+
},
|
|
4641
|
+
getBundledLanguages() {
|
|
4642
|
+
return n;
|
|
4643
|
+
},
|
|
4644
|
+
getBundledThemes() {
|
|
4645
|
+
return r;
|
|
4646
|
+
}
|
|
4647
|
+
};
|
|
4648
|
+
}
|
|
4649
|
+
return a;
|
|
4650
|
+
}
|
|
4651
|
+
function makeSingletonHighlighter(e) {
|
|
4652
|
+
let t;
|
|
4653
|
+
async function n(n = {}) {
|
|
4654
|
+
if (t) {
|
|
4655
|
+
let e = await t;
|
|
4656
|
+
return await Promise.all([e.loadTheme(...n.themes || []), e.loadLanguage(...n.langs || [])]), e;
|
|
4657
|
+
} else {
|
|
4658
|
+
t = e({
|
|
4659
|
+
...n,
|
|
4660
|
+
themes: [],
|
|
4661
|
+
langs: []
|
|
4662
|
+
});
|
|
4663
|
+
let r = await t;
|
|
4664
|
+
return await Promise.all([r.loadTheme(...n.themes || []), r.loadLanguage(...n.langs || [])]), r;
|
|
4665
|
+
}
|
|
4666
|
+
}
|
|
4667
|
+
return n;
|
|
4668
|
+
}
|
|
4669
|
+
function createSingletonShorthands(e, t) {
|
|
4670
|
+
let n = makeSingletonHighlighter(e);
|
|
4671
|
+
async function r(e, r) {
|
|
4672
|
+
let i = await n({
|
|
4673
|
+
langs: [r.lang],
|
|
4674
|
+
themes: "theme" in r ? [r.theme] : Object.values(r.themes)
|
|
4675
|
+
}), a = await t?.guessEmbeddedLanguages?.(e, r.lang, i);
|
|
4676
|
+
return a && await i.loadLanguage(...a), i;
|
|
4677
|
+
}
|
|
4678
|
+
return {
|
|
4679
|
+
getSingletonHighlighter(e) {
|
|
4680
|
+
return n(e);
|
|
4681
|
+
},
|
|
4682
|
+
async codeToHtml(e, t) {
|
|
4683
|
+
return (await r(e, t)).codeToHtml(e, t);
|
|
4684
|
+
},
|
|
4685
|
+
async codeToHast(e, t) {
|
|
4686
|
+
return (await r(e, t)).codeToHast(e, t);
|
|
4687
|
+
},
|
|
4688
|
+
async codeToTokens(e, t) {
|
|
4689
|
+
return (await r(e, t)).codeToTokens(e, t);
|
|
4690
|
+
},
|
|
4691
|
+
async codeToTokensBase(e, t) {
|
|
4692
|
+
return (await r(e, t)).codeToTokensBase(e, t);
|
|
4693
|
+
},
|
|
4694
|
+
async codeToTokensWithThemes(e, t) {
|
|
4695
|
+
return (await r(e, t)).codeToTokensWithThemes(e, t);
|
|
4696
|
+
},
|
|
4697
|
+
async getLastGrammarState(e, t) {
|
|
4698
|
+
return (await n({
|
|
4699
|
+
langs: [t.lang],
|
|
4700
|
+
themes: [t.theme]
|
|
4701
|
+
})).getLastGrammarState(e, t);
|
|
4702
|
+
}
|
|
4703
|
+
};
|
|
4704
|
+
}
|
|
4705
|
+
var createdBundledHighlighter = createBundledHighlighter;
|
|
4706
|
+
function createCssVariablesTheme(e = {}) {
|
|
4707
|
+
let { name: t = "css-variables", variablePrefix: n = "--shiki-", fontStyle: r = !0 } = e, i = (t) => e.variableDefaults?.[t] ? `var(${n}${t}, ${e.variableDefaults[t]})` : `var(${n}${t})`, a = {
|
|
4708
|
+
name: t,
|
|
4709
|
+
type: "dark",
|
|
4710
|
+
colors: {
|
|
4711
|
+
"editor.foreground": i("foreground"),
|
|
4712
|
+
"editor.background": i("background"),
|
|
4713
|
+
"terminal.ansiBlack": i("ansi-black"),
|
|
4714
|
+
"terminal.ansiRed": i("ansi-red"),
|
|
4715
|
+
"terminal.ansiGreen": i("ansi-green"),
|
|
4716
|
+
"terminal.ansiYellow": i("ansi-yellow"),
|
|
4717
|
+
"terminal.ansiBlue": i("ansi-blue"),
|
|
4718
|
+
"terminal.ansiMagenta": i("ansi-magenta"),
|
|
4719
|
+
"terminal.ansiCyan": i("ansi-cyan"),
|
|
4720
|
+
"terminal.ansiWhite": i("ansi-white"),
|
|
4721
|
+
"terminal.ansiBrightBlack": i("ansi-bright-black"),
|
|
4722
|
+
"terminal.ansiBrightRed": i("ansi-bright-red"),
|
|
4723
|
+
"terminal.ansiBrightGreen": i("ansi-bright-green"),
|
|
4724
|
+
"terminal.ansiBrightYellow": i("ansi-bright-yellow"),
|
|
4725
|
+
"terminal.ansiBrightBlue": i("ansi-bright-blue"),
|
|
4726
|
+
"terminal.ansiBrightMagenta": i("ansi-bright-magenta"),
|
|
4727
|
+
"terminal.ansiBrightCyan": i("ansi-bright-cyan"),
|
|
4728
|
+
"terminal.ansiBrightWhite": i("ansi-bright-white")
|
|
4729
|
+
},
|
|
4730
|
+
tokenColors: [
|
|
4731
|
+
{
|
|
4732
|
+
scope: [
|
|
4733
|
+
"keyword.operator.accessor",
|
|
4734
|
+
"meta.group.braces.round.function.arguments",
|
|
4735
|
+
"meta.template.expression",
|
|
4736
|
+
"markup.fenced_code meta.embedded.block"
|
|
4737
|
+
],
|
|
4738
|
+
settings: { foreground: i("foreground") }
|
|
4739
|
+
},
|
|
4740
|
+
{
|
|
4741
|
+
scope: "emphasis",
|
|
4742
|
+
settings: { fontStyle: "italic" }
|
|
4743
|
+
},
|
|
4744
|
+
{
|
|
4745
|
+
scope: [
|
|
4746
|
+
"strong",
|
|
4747
|
+
"markup.heading.markdown",
|
|
4748
|
+
"markup.bold.markdown"
|
|
4749
|
+
],
|
|
4750
|
+
settings: { fontStyle: "bold" }
|
|
4751
|
+
},
|
|
4752
|
+
{
|
|
4753
|
+
scope: ["markup.italic.markdown"],
|
|
4754
|
+
settings: { fontStyle: "italic" }
|
|
4755
|
+
},
|
|
4756
|
+
{
|
|
4757
|
+
scope: "meta.link.inline.markdown",
|
|
4758
|
+
settings: {
|
|
4759
|
+
fontStyle: "underline",
|
|
4760
|
+
foreground: i("token-link")
|
|
4761
|
+
}
|
|
4762
|
+
},
|
|
4763
|
+
{
|
|
4764
|
+
scope: [
|
|
4765
|
+
"string",
|
|
4766
|
+
"markup.fenced_code",
|
|
4767
|
+
"markup.inline"
|
|
4768
|
+
],
|
|
4769
|
+
settings: { foreground: i("token-string") }
|
|
4770
|
+
},
|
|
4771
|
+
{
|
|
4772
|
+
scope: ["comment", "string.quoted.docstring.multi"],
|
|
4773
|
+
settings: { foreground: i("token-comment") }
|
|
4774
|
+
},
|
|
4775
|
+
{
|
|
4776
|
+
scope: [
|
|
4777
|
+
"constant.numeric",
|
|
4778
|
+
"constant.language",
|
|
4779
|
+
"constant.other.placeholder",
|
|
4780
|
+
"constant.character.format.placeholder",
|
|
4781
|
+
"variable.language.this",
|
|
4782
|
+
"variable.other.object",
|
|
4783
|
+
"variable.other.class",
|
|
4784
|
+
"variable.other.constant",
|
|
4785
|
+
"meta.property-name",
|
|
4786
|
+
"meta.property-value",
|
|
4787
|
+
"support"
|
|
4788
|
+
],
|
|
4789
|
+
settings: { foreground: i("token-constant") }
|
|
4790
|
+
},
|
|
4791
|
+
{
|
|
4792
|
+
scope: [
|
|
4793
|
+
"keyword",
|
|
4794
|
+
"storage.modifier",
|
|
4795
|
+
"storage.type",
|
|
4796
|
+
"storage.control.clojure",
|
|
4797
|
+
"entity.name.function.clojure",
|
|
4798
|
+
"entity.name.tag.yaml",
|
|
4799
|
+
"support.function.node",
|
|
4800
|
+
"support.type.property-name.json",
|
|
4801
|
+
"punctuation.separator.key-value",
|
|
4802
|
+
"punctuation.definition.template-expression"
|
|
4803
|
+
],
|
|
4804
|
+
settings: { foreground: i("token-keyword") }
|
|
4805
|
+
},
|
|
4806
|
+
{
|
|
4807
|
+
scope: "variable.parameter.function",
|
|
4808
|
+
settings: { foreground: i("token-parameter") }
|
|
4809
|
+
},
|
|
4810
|
+
{
|
|
4811
|
+
scope: [
|
|
4812
|
+
"support.function",
|
|
4813
|
+
"entity.name.type",
|
|
4814
|
+
"entity.other.inherited-class",
|
|
4815
|
+
"meta.function-call",
|
|
4816
|
+
"meta.instance.constructor",
|
|
4817
|
+
"entity.other.attribute-name",
|
|
4818
|
+
"entity.name.function",
|
|
4819
|
+
"constant.keyword.clojure"
|
|
4820
|
+
],
|
|
4821
|
+
settings: { foreground: i("token-function") }
|
|
4822
|
+
},
|
|
4823
|
+
{
|
|
4824
|
+
scope: [
|
|
4825
|
+
"entity.name.tag",
|
|
4826
|
+
"string.quoted",
|
|
4827
|
+
"string.regexp",
|
|
4828
|
+
"string.interpolated",
|
|
4829
|
+
"string.template",
|
|
4830
|
+
"string.unquoted.plain.out.yaml",
|
|
4831
|
+
"keyword.other.template"
|
|
4832
|
+
],
|
|
4833
|
+
settings: { foreground: i("token-string-expression") }
|
|
4834
|
+
},
|
|
4835
|
+
{
|
|
4836
|
+
scope: [
|
|
4837
|
+
"punctuation.definition.arguments",
|
|
4838
|
+
"punctuation.definition.dict",
|
|
4839
|
+
"punctuation.separator",
|
|
4840
|
+
"meta.function-call.arguments"
|
|
4841
|
+
],
|
|
4842
|
+
settings: { foreground: i("token-punctuation") }
|
|
4843
|
+
},
|
|
4844
|
+
{
|
|
4845
|
+
scope: ["markup.underline.link", "punctuation.definition.metadata.markdown"],
|
|
4846
|
+
settings: { foreground: i("token-link") }
|
|
4847
|
+
},
|
|
4848
|
+
{
|
|
4849
|
+
scope: ["beginning.punctuation.definition.list.markdown"],
|
|
4850
|
+
settings: { foreground: i("token-string") }
|
|
4851
|
+
},
|
|
4852
|
+
{
|
|
4853
|
+
scope: [
|
|
4854
|
+
"punctuation.definition.string.begin.markdown",
|
|
4855
|
+
"punctuation.definition.string.end.markdown",
|
|
4856
|
+
"string.other.link.title.markdown",
|
|
4857
|
+
"string.other.link.description.markdown"
|
|
4858
|
+
],
|
|
4859
|
+
settings: { foreground: i("token-keyword") }
|
|
4860
|
+
},
|
|
4861
|
+
{
|
|
4862
|
+
scope: [
|
|
4863
|
+
"markup.inserted",
|
|
4864
|
+
"meta.diff.header.to-file",
|
|
4865
|
+
"punctuation.definition.inserted"
|
|
4866
|
+
],
|
|
4867
|
+
settings: { foreground: i("token-inserted") }
|
|
4868
|
+
},
|
|
4869
|
+
{
|
|
4870
|
+
scope: [
|
|
4871
|
+
"markup.deleted",
|
|
4872
|
+
"meta.diff.header.from-file",
|
|
4873
|
+
"punctuation.definition.deleted"
|
|
4874
|
+
],
|
|
4875
|
+
settings: { foreground: i("token-deleted") }
|
|
4876
|
+
},
|
|
4877
|
+
{
|
|
4878
|
+
scope: ["markup.changed", "punctuation.definition.changed"],
|
|
4879
|
+
settings: { foreground: i("token-changed") }
|
|
4880
|
+
}
|
|
4881
|
+
]
|
|
4882
|
+
};
|
|
4883
|
+
return r || (a.tokenColors = a.tokenColors?.map((e) => (e.settings?.fontStyle && delete e.settings.fontStyle, e))), a;
|
|
4884
|
+
}
|
|
4885
|
+
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 };
|