@cas-smartdesign/element-preview 0.2.1 → 0.3.0

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.
@@ -1,1079 +1,1071 @@
1
- import dt from "postcss";
2
- import ut from "postcss-prefix-selector";
3
- const gt = "code{white-space:pre}.example{display:flex;flex-wrap:wrap;flex-direction:row;align-items:center;gap:16px}.example>*{flex:1 1 500px}.example .tab-control{overflow:hidden}.example div[role=tab]{cursor:pointer;padding:8px 16px;display:inline-block;font-size:16px;border-bottom:2px solid transparent;background-clip:padding-box;-webkit-user-select:none;user-select:none}.example div[role=tab]:hover{background-color:#1467ba14}.example div[role=tab][selected]{background-color:#1467ba21;border-bottom:2px solid #1467ba}.tab-content{margin:16px 0}.tab-content>pre{padding-top:0}.tab-content.code{max-height:500px;overflow:auto}.tab-content.code pre{margin:0}", ft = "pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#005cc5}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-comment,.hljs-code,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}";
4
- function pt(e) {
5
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1
+ import nn from "postcss";
2
+ import rn from "postcss-prefix-selector";
3
+ const on = "code{white-space:pre}.example{display:flex;flex-wrap:wrap;flex-direction:row;align-items:center;gap:16px}.example>*{flex:1 1 500px}.example .tab-control{overflow:hidden}.example div[role=tab]{cursor:pointer;padding:8px 16px;display:inline-block;font-size:16px;border-bottom:2px solid transparent;background-clip:padding-box;-webkit-user-select:none;user-select:none}.example div[role=tab]:hover{background-color:#1467ba14}.example div[role=tab][selected]{background-color:#1467ba21;border-bottom:2px solid #1467ba}.tab-content{margin:16px 0}.tab-content>pre{padding-top:0}.tab-content.code{max-height:500px;overflow:auto}.tab-content.code pre{margin:0}", sn = "pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#005cc5}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-comment,.hljs-code,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}";
4
+ function an(i) {
5
+ return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
6
6
  }
7
- function Pe(e) {
8
- return e instanceof Map ? e.clear = e.delete = e.set = function() {
9
- throw new Error("map is read-only");
10
- } : e instanceof Set && (e.add = e.clear = e.delete = function() {
11
- throw new Error("set is read-only");
12
- }), Object.freeze(e), Object.getOwnPropertyNames(e).forEach((t) => {
13
- const n = e[t], i = typeof n;
14
- (i === "object" || i === "function") && !Object.isFrozen(n) && Pe(n);
15
- }), e;
16
- }
17
- class ke {
18
- /**
19
- * @param {CompiledMode} mode
20
- */
21
- constructor(t) {
22
- t.data === void 0 && (t.data = {}), this.data = t.data, this.isMatchIgnored = !1;
7
+ var He, rt;
8
+ function cn() {
9
+ if (rt) return He;
10
+ rt = 1;
11
+ function i(e) {
12
+ return e instanceof Map ? e.clear = e.delete = e.set = function() {
13
+ throw new Error("map is read-only");
14
+ } : e instanceof Set && (e.add = e.clear = e.delete = function() {
15
+ throw new Error("set is read-only");
16
+ }), Object.freeze(e), Object.getOwnPropertyNames(e).forEach((t) => {
17
+ const r = e[t], p = typeof r;
18
+ (p === "object" || p === "function") && !Object.isFrozen(r) && i(r);
19
+ }), e;
23
20
  }
24
- ignoreMatch() {
25
- this.isMatchIgnored = !0;
21
+ class s {
22
+ /**
23
+ * @param {CompiledMode} mode
24
+ */
25
+ constructor(t) {
26
+ t.data === void 0 && (t.data = {}), this.data = t.data, this.isMatchIgnored = !1;
27
+ }
28
+ ignoreMatch() {
29
+ this.isMatchIgnored = !0;
30
+ }
26
31
  }
27
- }
28
- function je(e) {
29
- return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
30
- }
31
- function D(e, ...t) {
32
- const n = /* @__PURE__ */ Object.create(null);
33
- for (const i in e)
34
- n[i] = e[i];
35
- return t.forEach(function(i) {
36
- for (const u in i)
37
- n[u] = i[u];
38
- }), /** @type {T} */
39
- n;
40
- }
41
- const ht = "</span>", ve = (e) => !!e.scope, bt = (e, { prefix: t }) => {
42
- if (e.startsWith("language:"))
43
- return e.replace("language:", "language-");
44
- if (e.includes(".")) {
45
- const n = e.split(".");
46
- return [
47
- `${t}${n.shift()}`,
48
- ...n.map((i, u) => `${i}${"_".repeat(u + 1)}`)
49
- ].join(" ");
32
+ function c(e) {
33
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
50
34
  }
51
- return `${t}${e}`;
52
- };
53
- class Et {
54
- /**
55
- * Creates a new HTMLRenderer
56
- *
57
- * @param {Tree} parseTree - the parse tree (must support `walk` API)
58
- * @param {{classPrefix: string}} options
59
- */
60
- constructor(t, n) {
61
- this.buffer = "", this.classPrefix = n.classPrefix, t.walk(this);
35
+ function g(e, ...t) {
36
+ const r = /* @__PURE__ */ Object.create(null);
37
+ for (const p in e)
38
+ r[p] = e[p];
39
+ return t.forEach(function(p) {
40
+ for (const N in p)
41
+ r[N] = p[N];
42
+ }), /** @type {T} */
43
+ r;
62
44
  }
63
- /**
64
- * Adds texts to the output stream
65
- *
66
- * @param {string} text */
67
- addText(t) {
68
- this.buffer += je(t);
45
+ const E = "</span>", w = (e) => !!e.scope, S = (e, { prefix: t }) => {
46
+ if (e.startsWith("language:"))
47
+ return e.replace("language:", "language-");
48
+ if (e.includes(".")) {
49
+ const r = e.split(".");
50
+ return [
51
+ `${t}${r.shift()}`,
52
+ ...r.map((p, N) => `${p}${"_".repeat(N + 1)}`)
53
+ ].join(" ");
54
+ }
55
+ return `${t}${e}`;
56
+ };
57
+ class M {
58
+ /**
59
+ * Creates a new HTMLRenderer
60
+ *
61
+ * @param {Tree} parseTree - the parse tree (must support `walk` API)
62
+ * @param {{classPrefix: string}} options
63
+ */
64
+ constructor(t, r) {
65
+ this.buffer = "", this.classPrefix = r.classPrefix, t.walk(this);
66
+ }
67
+ /**
68
+ * Adds texts to the output stream
69
+ *
70
+ * @param {string} text */
71
+ addText(t) {
72
+ this.buffer += c(t);
73
+ }
74
+ /**
75
+ * Adds a node open to the output stream (if needed)
76
+ *
77
+ * @param {Node} node */
78
+ openNode(t) {
79
+ if (!w(t)) return;
80
+ const r = S(
81
+ t.scope,
82
+ { prefix: this.classPrefix }
83
+ );
84
+ this.span(r);
85
+ }
86
+ /**
87
+ * Adds a node close to the output stream (if needed)
88
+ *
89
+ * @param {Node} node */
90
+ closeNode(t) {
91
+ w(t) && (this.buffer += E);
92
+ }
93
+ /**
94
+ * returns the accumulated buffer
95
+ */
96
+ value() {
97
+ return this.buffer;
98
+ }
99
+ // helpers
100
+ /**
101
+ * Builds a span element
102
+ *
103
+ * @param {string} className */
104
+ span(t) {
105
+ this.buffer += `<span class="${t}">`;
106
+ }
69
107
  }
70
- /**
71
- * Adds a node open to the output stream (if needed)
72
- *
73
- * @param {Node} node */
74
- openNode(t) {
75
- if (!ve(t))
76
- return;
77
- const n = bt(
78
- t.scope,
79
- { prefix: this.classPrefix }
80
- );
81
- this.span(n);
108
+ const D = (e = {}) => {
109
+ const t = { children: [] };
110
+ return Object.assign(t, e), t;
111
+ };
112
+ class T {
113
+ constructor() {
114
+ this.rootNode = D(), this.stack = [this.rootNode];
115
+ }
116
+ get top() {
117
+ return this.stack[this.stack.length - 1];
118
+ }
119
+ get root() {
120
+ return this.rootNode;
121
+ }
122
+ /** @param {Node} node */
123
+ add(t) {
124
+ this.top.children.push(t);
125
+ }
126
+ /** @param {string} scope */
127
+ openNode(t) {
128
+ const r = D({ scope: t });
129
+ this.add(r), this.stack.push(r);
130
+ }
131
+ closeNode() {
132
+ if (this.stack.length > 1)
133
+ return this.stack.pop();
134
+ }
135
+ closeAllNodes() {
136
+ for (; this.closeNode(); ) ;
137
+ }
138
+ toJSON() {
139
+ return JSON.stringify(this.rootNode, null, 4);
140
+ }
141
+ /**
142
+ * @typedef { import("./html_renderer").Renderer } Renderer
143
+ * @param {Renderer} builder
144
+ */
145
+ walk(t) {
146
+ return this.constructor._walk(t, this.rootNode);
147
+ }
148
+ /**
149
+ * @param {Renderer} builder
150
+ * @param {Node} node
151
+ */
152
+ static _walk(t, r) {
153
+ return typeof r == "string" ? t.addText(r) : r.children && (t.openNode(r), r.children.forEach((p) => this._walk(t, p)), t.closeNode(r)), t;
154
+ }
155
+ /**
156
+ * @param {Node} node
157
+ */
158
+ static _collapse(t) {
159
+ typeof t != "string" && t.children && (t.children.every((r) => typeof r == "string") ? t.children = [t.children.join("")] : t.children.forEach((r) => {
160
+ T._collapse(r);
161
+ }));
162
+ }
82
163
  }
83
- /**
84
- * Adds a node close to the output stream (if needed)
85
- *
86
- * @param {Node} node */
87
- closeNode(t) {
88
- ve(t) && (this.buffer += ht);
164
+ class Z extends T {
165
+ /**
166
+ * @param {*} options
167
+ */
168
+ constructor(t) {
169
+ super(), this.options = t;
170
+ }
171
+ /**
172
+ * @param {string} text
173
+ */
174
+ addText(t) {
175
+ t !== "" && this.add(t);
176
+ }
177
+ /** @param {string} scope */
178
+ startScope(t) {
179
+ this.openNode(t);
180
+ }
181
+ endScope() {
182
+ this.closeNode();
183
+ }
184
+ /**
185
+ * @param {Emitter & {root: DataNode}} emitter
186
+ * @param {string} name
187
+ */
188
+ __addSublanguage(t, r) {
189
+ const p = t.root;
190
+ r && (p.scope = `language:${r}`), this.add(p);
191
+ }
192
+ toHTML() {
193
+ return new M(this, this.options).value();
194
+ }
195
+ finalize() {
196
+ return this.closeAllNodes(), !0;
197
+ }
89
198
  }
90
- /**
91
- * returns the accumulated buffer
92
- */
93
- value() {
94
- return this.buffer;
199
+ function j(e) {
200
+ return e ? typeof e == "string" ? e : e.source : null;
95
201
  }
96
- // helpers
97
- /**
98
- * Builds a span element
99
- *
100
- * @param {string} className */
101
- span(t) {
102
- this.buffer += `<span class="${t}">`;
202
+ function P(e) {
203
+ return R("(?=", e, ")");
103
204
  }
104
- }
105
- const Ce = (e = {}) => {
106
- const t = { children: [] };
107
- return Object.assign(t, e), t;
108
- };
109
- class ye {
110
- constructor() {
111
- this.rootNode = Ce(), this.stack = [this.rootNode];
205
+ function X(e) {
206
+ return R("(?:", e, ")*");
112
207
  }
113
- get top() {
114
- return this.stack[this.stack.length - 1];
208
+ function te(e) {
209
+ return R("(?:", e, ")?");
115
210
  }
116
- get root() {
117
- return this.rootNode;
211
+ function R(...e) {
212
+ return e.map((r) => j(r)).join("");
118
213
  }
119
- /** @param {Node} node */
120
- add(t) {
121
- this.top.children.push(t);
214
+ function ne(e) {
215
+ const t = e[e.length - 1];
216
+ return typeof t == "object" && t.constructor === Object ? (e.splice(e.length - 1, 1), t) : {};
122
217
  }
123
- /** @param {string} scope */
124
- openNode(t) {
125
- const n = Ce({ scope: t });
126
- this.add(n), this.stack.push(n);
218
+ function ie(...e) {
219
+ return "(" + (ne(e).capture ? "" : "?:") + e.map((p) => j(p)).join("|") + ")";
127
220
  }
128
- closeNode() {
129
- if (this.stack.length > 1)
130
- return this.stack.pop();
221
+ function G(e) {
222
+ return new RegExp(e.toString() + "|").exec("").length - 1;
131
223
  }
132
- closeAllNodes() {
133
- for (; this.closeNode(); )
134
- ;
224
+ function re(e, t) {
225
+ const r = e && e.exec(t);
226
+ return r && r.index === 0;
135
227
  }
136
- toJSON() {
137
- return JSON.stringify(this.rootNode, null, 4);
228
+ const fe = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
229
+ function Y(e, { joinWith: t }) {
230
+ let r = 0;
231
+ return e.map((p) => {
232
+ r += 1;
233
+ const N = r;
234
+ let k = j(p), l = "";
235
+ for (; k.length > 0; ) {
236
+ const a = fe.exec(k);
237
+ if (!a) {
238
+ l += k;
239
+ break;
240
+ }
241
+ l += k.substring(0, a.index), k = k.substring(a.index + a[0].length), a[0][0] === "\\" && a[1] ? l += "\\" + String(Number(a[1]) + N) : (l += a[0], a[0] === "(" && r++);
242
+ }
243
+ return l;
244
+ }).map((p) => `(${p})`).join(t);
138
245
  }
139
- /**
140
- * @typedef { import("./html_renderer").Renderer } Renderer
141
- * @param {Renderer} builder
142
- */
143
- walk(t) {
144
- return this.constructor._walk(t, this.rootNode);
246
+ const q = /\b\B/, pe = "[a-zA-Z]\\w*", oe = "[a-zA-Z_]\\w*", he = "\\b\\d+(\\.\\d+)?", be = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", me = "\\b(0b[01]+)", Oe = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", Re = (e = {}) => {
247
+ const t = /^#![ ]*\//;
248
+ return e.binary && (e.begin = R(
249
+ t,
250
+ /.*\b/,
251
+ e.binary,
252
+ /\b.*/
253
+ )), g({
254
+ scope: "meta",
255
+ begin: t,
256
+ end: /$/,
257
+ relevance: 0,
258
+ /** @type {ModeCallback} */
259
+ "on:begin": (r, p) => {
260
+ r.index !== 0 && p.ignoreMatch();
261
+ }
262
+ }, e);
263
+ }, V = {
264
+ begin: "\\\\[\\s\\S]",
265
+ relevance: 0
266
+ }, Ce = {
267
+ scope: "string",
268
+ begin: "'",
269
+ end: "'",
270
+ illegal: "\\n",
271
+ contains: [V]
272
+ }, Ee = {
273
+ scope: "string",
274
+ begin: '"',
275
+ end: '"',
276
+ illegal: "\\n",
277
+ contains: [V]
278
+ }, Ie = {
279
+ begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
280
+ }, C = function(e, t, r = {}) {
281
+ const p = g(
282
+ {
283
+ scope: "comment",
284
+ begin: e,
285
+ end: t,
286
+ contains: []
287
+ },
288
+ r
289
+ );
290
+ p.contains.push({
291
+ scope: "doctag",
292
+ // hack to avoid the space from being included. the space is necessary to
293
+ // match here to prevent the plain text rule below from gobbling up doctags
294
+ begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
295
+ end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
296
+ excludeBegin: !0,
297
+ relevance: 0
298
+ });
299
+ const N = ie(
300
+ // list of common 1 and 2 letter words in English
301
+ "I",
302
+ "a",
303
+ "is",
304
+ "so",
305
+ "us",
306
+ "to",
307
+ "at",
308
+ "if",
309
+ "in",
310
+ "it",
311
+ "on",
312
+ // note: this is not an exhaustive list of contractions, just popular ones
313
+ /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,
314
+ // contractions - can't we'd they're let's, etc
315
+ /[A-Za-z]+[-][a-z]+/,
316
+ // `no-way`, etc.
317
+ /[A-Za-z][a-z]{2,}/
318
+ // allow capitalized words at beginning of sentences
319
+ );
320
+ return p.contains.push(
321
+ {
322
+ // TODO: how to include ", (, ) without breaking grammars that use these for
323
+ // comment delimiters?
324
+ // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
325
+ // ---
326
+ // this tries to find sequences of 3 english words in a row (without any
327
+ // "programming" type syntax) this gives us a strong signal that we've
328
+ // TRULY found a comment - vs perhaps scanning with the wrong language.
329
+ // It's possible to find something that LOOKS like the start of the
330
+ // comment - but then if there is no readable text - good chance it is a
331
+ // false match and not a comment.
332
+ //
333
+ // for a visual example please see:
334
+ // https://github.com/highlightjs/highlight.js/issues/2827
335
+ begin: R(
336
+ /[ ]+/,
337
+ // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
338
+ "(",
339
+ N,
340
+ /[.]?[:]?([.][ ]|[ ])/,
341
+ "){3}"
342
+ )
343
+ // look for 3 words in a row
344
+ }
345
+ ), p;
346
+ }, F = C("//", "$"), J = C("/\\*", "\\*/"), se = C("#", "$"), le = {
347
+ scope: "number",
348
+ begin: he,
349
+ relevance: 0
350
+ }, _e = {
351
+ scope: "number",
352
+ begin: be,
353
+ relevance: 0
354
+ }, ft = {
355
+ scope: "number",
356
+ begin: me,
357
+ relevance: 0
358
+ }, pt = {
359
+ scope: "regexp",
360
+ begin: /\/(?=[^/\n]*\/)/,
361
+ end: /\/[gimuy]*/,
362
+ contains: [
363
+ V,
364
+ {
365
+ begin: /\[/,
366
+ end: /\]/,
367
+ relevance: 0,
368
+ contains: [V]
369
+ }
370
+ ]
371
+ }, ht = {
372
+ scope: "title",
373
+ begin: pe,
374
+ relevance: 0
375
+ }, bt = {
376
+ scope: "title",
377
+ begin: oe,
378
+ relevance: 0
379
+ }, mt = {
380
+ // excludes method names from keyword processing
381
+ begin: "\\.\\s*" + oe,
382
+ relevance: 0
383
+ };
384
+ var ye = /* @__PURE__ */ Object.freeze({
385
+ __proto__: null,
386
+ APOS_STRING_MODE: Ce,
387
+ BACKSLASH_ESCAPE: V,
388
+ BINARY_NUMBER_MODE: ft,
389
+ BINARY_NUMBER_RE: me,
390
+ COMMENT: C,
391
+ C_BLOCK_COMMENT_MODE: J,
392
+ C_LINE_COMMENT_MODE: F,
393
+ C_NUMBER_MODE: _e,
394
+ C_NUMBER_RE: be,
395
+ END_SAME_AS_BEGIN: function(e) {
396
+ return Object.assign(
397
+ e,
398
+ {
399
+ /** @type {ModeCallback} */
400
+ "on:begin": (t, r) => {
401
+ r.data._beginMatch = t[1];
402
+ },
403
+ /** @type {ModeCallback} */
404
+ "on:end": (t, r) => {
405
+ r.data._beginMatch !== t[1] && r.ignoreMatch();
406
+ }
407
+ }
408
+ );
409
+ },
410
+ HASH_COMMENT_MODE: se,
411
+ IDENT_RE: pe,
412
+ MATCH_NOTHING_RE: q,
413
+ METHOD_GUARD: mt,
414
+ NUMBER_MODE: le,
415
+ NUMBER_RE: he,
416
+ PHRASAL_WORDS_MODE: Ie,
417
+ QUOTE_STRING_MODE: Ee,
418
+ REGEXP_MODE: pt,
419
+ RE_STARTERS_RE: Oe,
420
+ SHEBANG: Re,
421
+ TITLE_MODE: ht,
422
+ UNDERSCORE_IDENT_RE: oe,
423
+ UNDERSCORE_TITLE_MODE: bt
424
+ });
425
+ function Et(e, t) {
426
+ e.input[e.index - 1] === "." && t.ignoreMatch();
145
427
  }
146
- /**
147
- * @param {Renderer} builder
148
- * @param {Node} node
149
- */
150
- static _walk(t, n) {
151
- return typeof n == "string" ? t.addText(n) : n.children && (t.openNode(n), n.children.forEach((i) => this._walk(t, i)), t.closeNode(n)), t;
428
+ function _t(e, t) {
429
+ e.className !== void 0 && (e.scope = e.className, delete e.className);
152
430
  }
153
- /**
154
- * @param {Node} node
155
- */
156
- static _collapse(t) {
157
- typeof t != "string" && t.children && (t.children.every((n) => typeof n == "string") ? t.children = [t.children.join("")] : t.children.forEach((n) => {
158
- ye._collapse(n);
159
- }));
431
+ function yt(e, t) {
432
+ t && e.beginKeywords && (e.begin = "\\b(" + e.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", e.__beforeBegin = Et, e.keywords = e.keywords || e.beginKeywords, delete e.beginKeywords, e.relevance === void 0 && (e.relevance = 0));
160
433
  }
161
- }
162
- class mt extends ye {
163
- /**
164
- * @param {*} options
165
- */
166
- constructor(t) {
167
- super(), this.options = t;
434
+ function xt(e, t) {
435
+ Array.isArray(e.illegal) && (e.illegal = ie(...e.illegal));
168
436
  }
169
- /**
170
- * @param {string} text
171
- */
172
- addText(t) {
173
- t !== "" && this.add(t);
437
+ function wt(e, t) {
438
+ if (e.match) {
439
+ if (e.begin || e.end) throw new Error("begin & end are not supported with match");
440
+ e.begin = e.match, delete e.match;
441
+ }
174
442
  }
175
- /** @param {string} scope */
176
- startScope(t) {
177
- this.openNode(t);
443
+ function St(e, t) {
444
+ e.relevance === void 0 && (e.relevance = 1);
178
445
  }
179
- endScope() {
180
- this.closeNode();
446
+ const Nt = (e, t) => {
447
+ if (!e.beforeMatch) return;
448
+ if (e.starts) throw new Error("beforeMatch cannot be used with starts");
449
+ const r = Object.assign({}, e);
450
+ Object.keys(e).forEach((p) => {
451
+ delete e[p];
452
+ }), e.keywords = r.keywords, e.begin = R(r.beforeMatch, P(r.begin)), e.starts = {
453
+ relevance: 0,
454
+ contains: [
455
+ Object.assign(r, { endsParent: !0 })
456
+ ]
457
+ }, e.relevance = 0, delete r.beforeMatch;
458
+ }, kt = [
459
+ "of",
460
+ "and",
461
+ "for",
462
+ "in",
463
+ "not",
464
+ "or",
465
+ "if",
466
+ "then",
467
+ "parent",
468
+ // common variable name
469
+ "list",
470
+ // common variable name
471
+ "value"
472
+ // common variable name
473
+ ], vt = "keyword";
474
+ function Ge(e, t, r = vt) {
475
+ const p = /* @__PURE__ */ Object.create(null);
476
+ return typeof e == "string" ? N(r, e.split(" ")) : Array.isArray(e) ? N(r, e) : Object.keys(e).forEach(function(k) {
477
+ Object.assign(
478
+ p,
479
+ Ge(e[k], t, k)
480
+ );
481
+ }), p;
482
+ function N(k, l) {
483
+ t && (l = l.map((a) => a.toLowerCase())), l.forEach(function(a) {
484
+ const f = a.split("|");
485
+ p[f[0]] = [k, Mt(f[0], f[1])];
486
+ });
487
+ }
181
488
  }
182
- /**
183
- * @param {Emitter & {root: DataNode}} emitter
184
- * @param {string} name
185
- */
186
- __addSublanguage(t, n) {
187
- const i = t.root;
188
- n && (i.scope = `language:${n}`), this.add(i);
489
+ function Mt(e, t) {
490
+ return t ? Number(t) : At(e) ? 0 : 1;
189
491
  }
190
- toHTML() {
191
- return new Et(this, this.options).value();
492
+ function At(e) {
493
+ return kt.includes(e.toLowerCase());
192
494
  }
193
- finalize() {
194
- return this.closeAllNodes(), !0;
495
+ const $e = {}, Q = (e) => {
496
+ console.error(e);
497
+ }, Fe = (e, ...t) => {
498
+ console.log(`WARN: ${e}`, ...t);
499
+ }, ae = (e, t) => {
500
+ $e[`${e}/${t}`] || (console.log(`Deprecated as of ${e}. ${t}`), $e[`${e}/${t}`] = !0);
501
+ }, xe = new Error();
502
+ function Ke(e, t, { key: r }) {
503
+ let p = 0;
504
+ const N = e[r], k = {}, l = {};
505
+ for (let a = 1; a <= t.length; a++)
506
+ l[a + p] = N[a], k[a + p] = !0, p += G(t[a - 1]);
507
+ e[r] = l, e[r]._emit = k, e[r]._multi = !0;
195
508
  }
196
- }
197
- function J(e) {
198
- return e ? typeof e == "string" ? e : e.source : null;
199
- }
200
- function Ue(e) {
201
- return z("(?=", e, ")");
202
- }
203
- function _t(e) {
204
- return z("(?:", e, ")*");
205
- }
206
- function yt(e) {
207
- return z("(?:", e, ")?");
208
- }
209
- function z(...e) {
210
- return e.map((n) => J(n)).join("");
211
- }
212
- function xt(e) {
213
- const t = e[e.length - 1];
214
- return typeof t == "object" && t.constructor === Object ? (e.splice(e.length - 1, 1), t) : {};
215
- }
216
- function xe(...e) {
217
- return "(" + (xt(e).capture ? "" : "?:") + e.map((i) => J(i)).join("|") + ")";
218
- }
219
- function ze(e) {
220
- return new RegExp(e.toString() + "|").exec("").length - 1;
221
- }
222
- function wt(e, t) {
223
- const n = e && e.exec(t);
224
- return n && n.index === 0;
225
- }
226
- const Nt = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
227
- function we(e, { joinWith: t }) {
228
- let n = 0;
229
- return e.map((i) => {
230
- n += 1;
231
- const u = n;
232
- let f = J(i), o = "";
233
- for (; f.length > 0; ) {
234
- const s = Nt.exec(f);
235
- if (!s) {
236
- o += f;
237
- break;
238
- }
239
- o += f.substring(0, s.index), f = f.substring(s.index + s[0].length), s[0][0] === "\\" && s[1] ? o += "\\" + String(Number(s[1]) + u) : (o += s[0], s[0] === "(" && n++);
240
- }
241
- return o;
242
- }).map((i) => `(${i})`).join(t);
243
- }
244
- const St = /\b\B/, He = "[a-zA-Z]\\w*", Ne = "[a-zA-Z_]\\w*", $e = "\\b\\d+(\\.\\d+)?", Ge = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", Fe = "\\b(0b[01]+)", Mt = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", At = (e = {}) => {
245
- const t = /^#![ ]*\//;
246
- return e.binary && (e.begin = z(
247
- t,
248
- /.*\b/,
249
- e.binary,
250
- /\b.*/
251
- )), D({
252
- scope: "meta",
253
- begin: t,
254
- end: /$/,
255
- relevance: 0,
256
- /** @type {ModeCallback} */
257
- "on:begin": (n, i) => {
258
- n.index !== 0 && i.ignoreMatch();
259
- }
260
- }, e);
261
- }, V = {
262
- begin: "\\\\[\\s\\S]",
263
- relevance: 0
264
- }, Ot = {
265
- scope: "string",
266
- begin: "'",
267
- end: "'",
268
- illegal: "\\n",
269
- contains: [V]
270
- }, Tt = {
271
- scope: "string",
272
- begin: '"',
273
- end: '"',
274
- illegal: "\\n",
275
- contains: [V]
276
- }, Rt = {
277
- begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
278
- }, de = function(e, t, n = {}) {
279
- const i = D(
280
- {
281
- scope: "comment",
282
- begin: e,
283
- end: t,
284
- contains: []
285
- },
286
- n
287
- );
288
- i.contains.push({
289
- scope: "doctag",
290
- // hack to avoid the space from being included. the space is necessary to
291
- // match here to prevent the plain text rule below from gobbling up doctags
292
- begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
293
- end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
294
- excludeBegin: !0,
295
- relevance: 0
296
- });
297
- const u = xe(
298
- // list of common 1 and 2 letter words in English
299
- "I",
300
- "a",
301
- "is",
302
- "so",
303
- "us",
304
- "to",
305
- "at",
306
- "if",
307
- "in",
308
- "it",
309
- "on",
310
- // note: this is not an exhaustive list of contractions, just popular ones
311
- /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,
312
- // contractions - can't we'd they're let's, etc
313
- /[A-Za-z]+[-][a-z]+/,
314
- // `no-way`, etc.
315
- /[A-Za-z][a-z]{2,}/
316
- // allow capitalized words at beginning of sentences
317
- );
318
- return i.contains.push(
319
- {
320
- // TODO: how to include ", (, ) without breaking grammars that use these for
321
- // comment delimiters?
322
- // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
323
- // ---
324
- // this tries to find sequences of 3 english words in a row (without any
325
- // "programming" type syntax) this gives us a strong signal that we've
326
- // TRULY found a comment - vs perhaps scanning with the wrong language.
327
- // It's possible to find something that LOOKS like the start of the
328
- // comment - but then if there is no readable text - good chance it is a
329
- // false match and not a comment.
330
- //
331
- // for a visual example please see:
332
- // https://github.com/highlightjs/highlight.js/issues/2827
333
- begin: z(
334
- /[ ]+/,
335
- // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
336
- "(",
337
- u,
338
- /[.]?[:]?([.][ ]|[ ])/,
339
- "){3}"
340
- )
341
- // look for 3 words in a row
342
- }
343
- ), i;
344
- }, kt = de("//", "$"), vt = de("/\\*", "\\*/"), Ct = de("#", "$"), It = {
345
- scope: "number",
346
- begin: $e,
347
- relevance: 0
348
- }, Lt = {
349
- scope: "number",
350
- begin: Ge,
351
- relevance: 0
352
- }, Dt = {
353
- scope: "number",
354
- begin: Fe,
355
- relevance: 0
356
- }, Bt = {
357
- scope: "regexp",
358
- begin: /\/(?=[^/\n]*\/)/,
359
- end: /\/[gimuy]*/,
360
- contains: [
361
- V,
362
- {
363
- begin: /\[/,
364
- end: /\]/,
365
- relevance: 0,
366
- contains: [V]
367
- }
368
- ]
369
- }, Pt = {
370
- scope: "title",
371
- begin: He,
372
- relevance: 0
373
- }, jt = {
374
- scope: "title",
375
- begin: Ne,
376
- relevance: 0
377
- }, Ut = {
378
- // excludes method names from keyword processing
379
- begin: "\\.\\s*" + Ne,
380
- relevance: 0
381
- }, zt = function(e) {
382
- return Object.assign(
383
- e,
384
- {
385
- /** @type {ModeCallback} */
386
- "on:begin": (t, n) => {
387
- n.data._beginMatch = t[1];
388
- },
389
- /** @type {ModeCallback} */
390
- "on:end": (t, n) => {
391
- n.data._beginMatch !== t[1] && n.ignoreMatch();
392
- }
509
+ function Tt(e) {
510
+ if (Array.isArray(e.begin)) {
511
+ if (e.skip || e.excludeBegin || e.returnBegin)
512
+ throw Q("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), xe;
513
+ if (typeof e.beginScope != "object" || e.beginScope === null)
514
+ throw Q("beginScope must be object"), xe;
515
+ Ke(e, e.begin, { key: "beginScope" }), e.begin = Y(e.begin, { joinWith: "" });
393
516
  }
394
- );
395
- };
396
- var oe = /* @__PURE__ */ Object.freeze({
397
- __proto__: null,
398
- APOS_STRING_MODE: Ot,
399
- BACKSLASH_ESCAPE: V,
400
- BINARY_NUMBER_MODE: Dt,
401
- BINARY_NUMBER_RE: Fe,
402
- COMMENT: de,
403
- C_BLOCK_COMMENT_MODE: vt,
404
- C_LINE_COMMENT_MODE: kt,
405
- C_NUMBER_MODE: Lt,
406
- C_NUMBER_RE: Ge,
407
- END_SAME_AS_BEGIN: zt,
408
- HASH_COMMENT_MODE: Ct,
409
- IDENT_RE: He,
410
- MATCH_NOTHING_RE: St,
411
- METHOD_GUARD: Ut,
412
- NUMBER_MODE: It,
413
- NUMBER_RE: $e,
414
- PHRASAL_WORDS_MODE: Rt,
415
- QUOTE_STRING_MODE: Tt,
416
- REGEXP_MODE: Bt,
417
- RE_STARTERS_RE: Mt,
418
- SHEBANG: At,
419
- TITLE_MODE: Pt,
420
- UNDERSCORE_IDENT_RE: Ne,
421
- UNDERSCORE_TITLE_MODE: jt
422
- });
423
- function Ht(e, t) {
424
- e.input[e.index - 1] === "." && t.ignoreMatch();
425
- }
426
- function $t(e, t) {
427
- e.className !== void 0 && (e.scope = e.className, delete e.className);
428
- }
429
- function Gt(e, t) {
430
- t && e.beginKeywords && (e.begin = "\\b(" + e.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", e.__beforeBegin = Ht, e.keywords = e.keywords || e.beginKeywords, delete e.beginKeywords, e.relevance === void 0 && (e.relevance = 0));
431
- }
432
- function Ft(e, t) {
433
- Array.isArray(e.illegal) && (e.illegal = xe(...e.illegal));
434
- }
435
- function Kt(e, t) {
436
- if (e.match) {
437
- if (e.begin || e.end)
438
- throw new Error("begin & end are not supported with match");
439
- e.begin = e.match, delete e.match;
440
- }
441
- }
442
- function Wt(e, t) {
443
- e.relevance === void 0 && (e.relevance = 1);
444
- }
445
- const Zt = (e, t) => {
446
- if (!e.beforeMatch)
447
- return;
448
- if (e.starts)
449
- throw new Error("beforeMatch cannot be used with starts");
450
- const n = Object.assign({}, e);
451
- Object.keys(e).forEach((i) => {
452
- delete e[i];
453
- }), e.keywords = n.keywords, e.begin = z(n.beforeMatch, Ue(n.begin)), e.starts = {
454
- relevance: 0,
455
- contains: [
456
- Object.assign(n, { endsParent: !0 })
457
- ]
458
- }, e.relevance = 0, delete n.beforeMatch;
459
- }, Xt = [
460
- "of",
461
- "and",
462
- "for",
463
- "in",
464
- "not",
465
- "or",
466
- "if",
467
- "then",
468
- "parent",
469
- // common variable name
470
- "list",
471
- // common variable name
472
- "value"
473
- // common variable name
474
- ], Yt = "keyword";
475
- function Ke(e, t, n = Yt) {
476
- const i = /* @__PURE__ */ Object.create(null);
477
- return typeof e == "string" ? u(n, e.split(" ")) : Array.isArray(e) ? u(n, e) : Object.keys(e).forEach(function(f) {
478
- Object.assign(
479
- i,
480
- Ke(e[f], t, f)
481
- );
482
- }), i;
483
- function u(f, o) {
484
- t && (o = o.map((s) => s.toLowerCase())), o.forEach(function(s) {
485
- const l = s.split("|");
486
- i[l[0]] = [f, qt(l[0], l[1])];
487
- });
488
517
  }
489
- }
490
- function qt(e, t) {
491
- return t ? Number(t) : Jt(e) ? 0 : 1;
492
- }
493
- function Jt(e) {
494
- return Xt.includes(e.toLowerCase());
495
- }
496
- const Ie = {}, U = (e) => {
497
- console.error(e);
498
- }, Le = (e, ...t) => {
499
- console.log(`WARN: ${e}`, ...t);
500
- }, F = (e, t) => {
501
- Ie[`${e}/${t}`] || (console.log(`Deprecated as of ${e}. ${t}`), Ie[`${e}/${t}`] = !0);
502
- }, ce = new Error();
503
- function We(e, t, { key: n }) {
504
- let i = 0;
505
- const u = e[n], f = {}, o = {};
506
- for (let s = 1; s <= t.length; s++)
507
- o[s + i] = u[s], f[s + i] = !0, i += ze(t[s - 1]);
508
- e[n] = o, e[n]._emit = f, e[n]._multi = !0;
509
- }
510
- function Vt(e) {
511
- if (Array.isArray(e.begin)) {
512
- if (e.skip || e.excludeBegin || e.returnBegin)
513
- throw U("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), ce;
514
- if (typeof e.beginScope != "object" || e.beginScope === null)
515
- throw U("beginScope must be object"), ce;
516
- We(e, e.begin, { key: "beginScope" }), e.begin = we(e.begin, { joinWith: "" });
518
+ function Ot(e) {
519
+ if (Array.isArray(e.end)) {
520
+ if (e.skip || e.excludeEnd || e.returnEnd)
521
+ throw Q("skip, excludeEnd, returnEnd not compatible with endScope: {}"), xe;
522
+ if (typeof e.endScope != "object" || e.endScope === null)
523
+ throw Q("endScope must be object"), xe;
524
+ Ke(e, e.end, { key: "endScope" }), e.end = Y(e.end, { joinWith: "" });
525
+ }
517
526
  }
518
- }
519
- function Qt(e) {
520
- if (Array.isArray(e.end)) {
521
- if (e.skip || e.excludeEnd || e.returnEnd)
522
- throw U("skip, excludeEnd, returnEnd not compatible with endScope: {}"), ce;
523
- if (typeof e.endScope != "object" || e.endScope === null)
524
- throw U("endScope must be object"), ce;
525
- We(e, e.end, { key: "endScope" }), e.end = we(e.end, { joinWith: "" });
527
+ function Rt(e) {
528
+ e.scope && typeof e.scope == "object" && e.scope !== null && (e.beginScope = e.scope, delete e.scope);
526
529
  }
527
- }
528
- function en(e) {
529
- e.scope && typeof e.scope == "object" && e.scope !== null && (e.beginScope = e.scope, delete e.scope);
530
- }
531
- function tn(e) {
532
- en(e), typeof e.beginScope == "string" && (e.beginScope = { _wrap: e.beginScope }), typeof e.endScope == "string" && (e.endScope = { _wrap: e.endScope }), Vt(e), Qt(e);
533
- }
534
- function nn(e) {
535
- function t(o, s) {
536
- return new RegExp(
537
- J(o),
538
- "m" + (e.case_insensitive ? "i" : "") + (e.unicodeRegex ? "u" : "") + (s ? "g" : "")
539
- );
530
+ function Ct(e) {
531
+ Rt(e), typeof e.beginScope == "string" && (e.beginScope = { _wrap: e.beginScope }), typeof e.endScope == "string" && (e.endScope = { _wrap: e.endScope }), Tt(e), Ot(e);
540
532
  }
541
- class n {
542
- constructor() {
543
- this.matchIndexes = {}, this.regexes = [], this.matchAt = 1, this.position = 0;
544
- }
545
- // @ts-ignore
546
- addRule(s, l) {
547
- l.position = this.position++, this.matchIndexes[this.matchAt] = l, this.regexes.push([l, s]), this.matchAt += ze(s) + 1;
548
- }
549
- compile() {
550
- this.regexes.length === 0 && (this.exec = () => null);
551
- const s = this.regexes.map((l) => l[1]);
552
- this.matcherRe = t(we(s, { joinWith: "|" }), !0), this.lastIndex = 0;
553
- }
554
- /** @param {string} s */
555
- exec(s) {
556
- this.matcherRe.lastIndex = this.lastIndex;
557
- const l = this.matcherRe.exec(s);
558
- if (!l)
559
- return null;
560
- const b = l.findIndex((A, w) => w > 0 && A !== void 0), m = this.matchIndexes[b];
561
- return l.splice(0, b), Object.assign(l, m);
533
+ function It(e) {
534
+ function t(l, a) {
535
+ return new RegExp(
536
+ j(l),
537
+ "m" + (e.case_insensitive ? "i" : "") + (e.unicodeRegex ? "u" : "") + (a ? "g" : "")
538
+ );
562
539
  }
563
- }
564
- class i {
565
- constructor() {
566
- this.rules = [], this.multiRegexes = [], this.count = 0, this.lastIndex = 0, this.regexIndex = 0;
567
- }
568
- // @ts-ignore
569
- getMatcher(s) {
570
- if (this.multiRegexes[s])
571
- return this.multiRegexes[s];
572
- const l = new n();
573
- return this.rules.slice(s).forEach(([b, m]) => l.addRule(b, m)), l.compile(), this.multiRegexes[s] = l, l;
574
- }
575
- resumingScanAtSamePosition() {
576
- return this.regexIndex !== 0;
577
- }
578
- considerAll() {
579
- this.regexIndex = 0;
580
- }
581
- // @ts-ignore
582
- addRule(s, l) {
583
- this.rules.push([s, l]), l.type === "begin" && this.count++;
584
- }
585
- /** @param {string} s */
586
- exec(s) {
587
- const l = this.getMatcher(this.regexIndex);
588
- l.lastIndex = this.lastIndex;
589
- let b = l.exec(s);
590
- if (this.resumingScanAtSamePosition() && !(b && b.index === this.lastIndex)) {
591
- const m = this.getMatcher(0);
592
- m.lastIndex = this.lastIndex + 1, b = m.exec(s);
540
+ class r {
541
+ constructor() {
542
+ this.matchIndexes = {}, this.regexes = [], this.matchAt = 1, this.position = 0;
543
+ }
544
+ // @ts-ignore
545
+ addRule(a, f) {
546
+ f.position = this.position++, this.matchIndexes[this.matchAt] = f, this.regexes.push([f, a]), this.matchAt += G(a) + 1;
547
+ }
548
+ compile() {
549
+ this.regexes.length === 0 && (this.exec = () => null);
550
+ const a = this.regexes.map((f) => f[1]);
551
+ this.matcherRe = t(Y(a, { joinWith: "|" }), !0), this.lastIndex = 0;
552
+ }
553
+ /** @param {string} s */
554
+ exec(a) {
555
+ this.matcherRe.lastIndex = this.lastIndex;
556
+ const f = this.matcherRe.exec(a);
557
+ if (!f)
558
+ return null;
559
+ const O = f.findIndex((de, De) => De > 0 && de !== void 0), v = this.matchIndexes[O];
560
+ return f.splice(0, O), Object.assign(f, v);
593
561
  }
594
- return b && (this.regexIndex += b.position + 1, this.regexIndex === this.count && this.considerAll()), b;
595
562
  }
596
- }
597
- function u(o) {
598
- const s = new i();
599
- return o.contains.forEach((l) => s.addRule(l.begin, { rule: l, type: "begin" })), o.terminatorEnd && s.addRule(o.terminatorEnd, { type: "end" }), o.illegal && s.addRule(o.illegal, { type: "illegal" }), s;
600
- }
601
- function f(o, s) {
602
- const l = (
603
- /** @type CompiledMode */
604
- o
605
- );
606
- if (o.isCompiled)
607
- return l;
608
- [
609
- $t,
610
- // do this early so compiler extensions generally don't have to worry about
611
- // the distinction between match/begin
612
- Kt,
613
- tn,
614
- Zt
615
- ].forEach((m) => m(o, s)), e.compilerExtensions.forEach((m) => m(o, s)), o.__beforeBegin = null, [
616
- Gt,
617
- // do this later so compiler extensions that come earlier have access to the
618
- // raw array if they wanted to perhaps manipulate it, etc.
619
- Ft,
620
- // default to 1 relevance if not specified
621
- Wt
622
- ].forEach((m) => m(o, s)), o.isCompiled = !0;
623
- let b = null;
624
- return typeof o.keywords == "object" && o.keywords.$pattern && (o.keywords = Object.assign({}, o.keywords), b = o.keywords.$pattern, delete o.keywords.$pattern), b = b || /\w+/, o.keywords && (o.keywords = Ke(o.keywords, e.case_insensitive)), l.keywordPatternRe = t(b, !0), s && (o.begin || (o.begin = /\B|\b/), l.beginRe = t(l.begin), !o.end && !o.endsWithParent && (o.end = /\B|\b/), o.end && (l.endRe = t(l.end)), l.terminatorEnd = J(l.end) || "", o.endsWithParent && s.terminatorEnd && (l.terminatorEnd += (o.end ? "|" : "") + s.terminatorEnd)), o.illegal && (l.illegalRe = t(
625
- /** @type {RegExp | string} */
626
- o.illegal
627
- )), o.contains || (o.contains = []), o.contains = [].concat(...o.contains.map(function(m) {
628
- return rn(m === "self" ? o : m);
629
- })), o.contains.forEach(function(m) {
630
- f(
631
- /** @type Mode */
632
- m,
563
+ class p {
564
+ constructor() {
565
+ this.rules = [], this.multiRegexes = [], this.count = 0, this.lastIndex = 0, this.regexIndex = 0;
566
+ }
567
+ // @ts-ignore
568
+ getMatcher(a) {
569
+ if (this.multiRegexes[a]) return this.multiRegexes[a];
570
+ const f = new r();
571
+ return this.rules.slice(a).forEach(([O, v]) => f.addRule(O, v)), f.compile(), this.multiRegexes[a] = f, f;
572
+ }
573
+ resumingScanAtSamePosition() {
574
+ return this.regexIndex !== 0;
575
+ }
576
+ considerAll() {
577
+ this.regexIndex = 0;
578
+ }
579
+ // @ts-ignore
580
+ addRule(a, f) {
581
+ this.rules.push([a, f]), f.type === "begin" && this.count++;
582
+ }
583
+ /** @param {string} s */
584
+ exec(a) {
585
+ const f = this.getMatcher(this.regexIndex);
586
+ f.lastIndex = this.lastIndex;
587
+ let O = f.exec(a);
588
+ if (this.resumingScanAtSamePosition() && !(O && O.index === this.lastIndex)) {
589
+ const v = this.getMatcher(0);
590
+ v.lastIndex = this.lastIndex + 1, O = v.exec(a);
591
+ }
592
+ return O && (this.regexIndex += O.position + 1, this.regexIndex === this.count && this.considerAll()), O;
593
+ }
594
+ }
595
+ function N(l) {
596
+ const a = new p();
597
+ return l.contains.forEach((f) => a.addRule(f.begin, { rule: f, type: "begin" })), l.terminatorEnd && a.addRule(l.terminatorEnd, { type: "end" }), l.illegal && a.addRule(l.illegal, { type: "illegal" }), a;
598
+ }
599
+ function k(l, a) {
600
+ const f = (
601
+ /** @type CompiledMode */
633
602
  l
634
603
  );
635
- }), o.starts && f(o.starts, s), l.matcher = u(l), l;
604
+ if (l.isCompiled) return f;
605
+ [
606
+ _t,
607
+ // do this early so compiler extensions generally don't have to worry about
608
+ // the distinction between match/begin
609
+ wt,
610
+ Ct,
611
+ Nt
612
+ ].forEach((v) => v(l, a)), e.compilerExtensions.forEach((v) => v(l, a)), l.__beforeBegin = null, [
613
+ yt,
614
+ // do this later so compiler extensions that come earlier have access to the
615
+ // raw array if they wanted to perhaps manipulate it, etc.
616
+ xt,
617
+ // default to 1 relevance if not specified
618
+ St
619
+ ].forEach((v) => v(l, a)), l.isCompiled = !0;
620
+ let O = null;
621
+ return typeof l.keywords == "object" && l.keywords.$pattern && (l.keywords = Object.assign({}, l.keywords), O = l.keywords.$pattern, delete l.keywords.$pattern), O = O || /\w+/, l.keywords && (l.keywords = Ge(l.keywords, e.case_insensitive)), f.keywordPatternRe = t(O, !0), a && (l.begin || (l.begin = /\B|\b/), f.beginRe = t(f.begin), !l.end && !l.endsWithParent && (l.end = /\B|\b/), l.end && (f.endRe = t(f.end)), f.terminatorEnd = j(f.end) || "", l.endsWithParent && a.terminatorEnd && (f.terminatorEnd += (l.end ? "|" : "") + a.terminatorEnd)), l.illegal && (f.illegalRe = t(
622
+ /** @type {RegExp | string} */
623
+ l.illegal
624
+ )), l.contains || (l.contains = []), l.contains = [].concat(...l.contains.map(function(v) {
625
+ return Lt(v === "self" ? l : v);
626
+ })), l.contains.forEach(function(v) {
627
+ k(
628
+ /** @type Mode */
629
+ v,
630
+ f
631
+ );
632
+ }), l.starts && k(l.starts, a), f.matcher = N(f), f;
633
+ }
634
+ if (e.compilerExtensions || (e.compilerExtensions = []), e.contains && e.contains.includes("self"))
635
+ throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
636
+ return e.classNameAliases = g(e.classNameAliases || {}), k(
637
+ /** @type Mode */
638
+ e
639
+ );
636
640
  }
637
- if (e.compilerExtensions || (e.compilerExtensions = []), e.contains && e.contains.includes("self"))
638
- throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
639
- return e.classNameAliases = D(e.classNameAliases || {}), f(
640
- /** @type Mode */
641
- e
642
- );
643
- }
644
- function Ze(e) {
645
- return e ? e.endsWithParent || Ze(e.starts) : !1;
646
- }
647
- function rn(e) {
648
- return e.variants && !e.cachedVariants && (e.cachedVariants = e.variants.map(function(t) {
649
- return D(e, { variants: null }, t);
650
- })), e.cachedVariants ? e.cachedVariants : Ze(e) ? D(e, { starts: e.starts ? D(e.starts) : null }) : Object.isFrozen(e) ? D(e) : e;
651
- }
652
- var sn = "11.9.0";
653
- class on extends Error {
654
- constructor(t, n) {
655
- super(t), this.name = "HTMLInjectionError", this.html = n;
641
+ function We(e) {
642
+ return e ? e.endsWithParent || We(e.starts) : !1;
656
643
  }
657
- }
658
- const _e = je, De = D, Be = Symbol("nomatch"), an = 7, Xe = function(e) {
659
- const t = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ Object.create(null), i = [];
660
- let u = !0;
661
- const f = "Could not find the language '{}', did you forget to load/include a language module?", o = { disableAutodetect: !0, name: "Plain text", contains: [] };
662
- let s = {
663
- ignoreUnescapedHTML: !1,
664
- throwUnescapedHTML: !1,
665
- noHighlightRe: /^(no-?highlight)$/i,
666
- languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
667
- classPrefix: "hljs-",
668
- cssSelector: "pre code",
669
- languages: null,
670
- // beta configuration options, subject to change, welcome to discuss
671
- // https://github.com/highlightjs/highlight.js/issues/1086
672
- __emitter: mt
673
- };
674
- function l(r) {
675
- return s.noHighlightRe.test(r);
644
+ function Lt(e) {
645
+ return e.variants && !e.cachedVariants && (e.cachedVariants = e.variants.map(function(t) {
646
+ return g(e, { variants: null }, t);
647
+ })), e.cachedVariants ? e.cachedVariants : We(e) ? g(e, { starts: e.starts ? g(e.starts) : null }) : Object.isFrozen(e) ? g(e) : e;
676
648
  }
677
- function b(r) {
678
- let c = r.className + " ";
679
- c += r.parentNode ? r.parentNode.className : "";
680
- const p = s.languageDetectRe.exec(c);
681
- if (p) {
682
- const E = R(p[1]);
683
- return E || (Le(f.replace("{}", p[1])), Le("Falling back to no-highlight mode for this block.", r)), E ? p[1] : "no-highlight";
684
- }
685
- return c.split(/\s+/).find((E) => l(E) || R(E));
649
+ var Dt = "11.11.1";
650
+ class Bt extends Error {
651
+ constructor(t, r) {
652
+ super(t), this.name = "HTMLInjectionError", this.html = r;
653
+ }
686
654
  }
687
- function m(r, c, p) {
688
- let E = "", x = "";
689
- typeof c == "object" ? (E = r, p = c.ignoreIllegals, x = c.language) : (F("10.7.0", "highlight(lang, code, ...args) has been deprecated."), F("10.7.0", `Please use highlight(code, options) instead.
690
- https://github.com/highlightjs/highlight.js/issues/2277`), x = r, E = c), p === void 0 && (p = !0);
691
- const M = {
692
- code: E,
693
- language: x
655
+ const Le = c, Ze = g, Xe = Symbol("nomatch"), Pt = 7, Ye = function(e) {
656
+ const t = /* @__PURE__ */ Object.create(null), r = /* @__PURE__ */ Object.create(null), p = [];
657
+ let N = !0;
658
+ const k = "Could not find the language '{}', did you forget to load/include a language module?", l = { disableAutodetect: !0, name: "Plain text", contains: [] };
659
+ let a = {
660
+ ignoreUnescapedHTML: !1,
661
+ throwUnescapedHTML: !1,
662
+ noHighlightRe: /^(no-?highlight)$/i,
663
+ languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
664
+ classPrefix: "hljs-",
665
+ cssSelector: "pre code",
666
+ languages: null,
667
+ // beta configuration options, subject to change, welcome to discuss
668
+ // https://github.com/highlightjs/highlight.js/issues/1086
669
+ __emitter: Z
694
670
  };
695
- G("before:highlight", M);
696
- const T = M.result ? M.result : A(M.language, M.code, p);
697
- return T.code = M.code, G("after:highlight", T), T;
698
- }
699
- function A(r, c, p, E) {
700
- const x = /* @__PURE__ */ Object.create(null);
701
- function M(a, d) {
702
- return a.keywords[d];
703
- }
704
- function T() {
705
- if (!g.keywords) {
706
- N.addText(y);
707
- return;
708
- }
709
- let a = 0;
710
- g.keywordPatternRe.lastIndex = 0;
711
- let d = g.keywordPatternRe.exec(y), h = "";
712
- for (; d; ) {
713
- h += y.substring(a, d.index);
714
- const _ = v.case_insensitive ? d[0].toLowerCase() : d[0], S = M(g, _);
715
- if (S) {
716
- const [I, ct] = S;
717
- if (N.addText(h), h = "", x[_] = (x[_] || 0) + 1, x[_] <= an && (se += ct), I.startsWith("_"))
718
- h += d[0];
719
- else {
720
- const lt = v.classNameAliases[I] || I;
721
- k(d[0], lt);
722
- }
723
- } else
724
- h += d[0];
725
- a = g.keywordPatternRe.lastIndex, d = g.keywordPatternRe.exec(y);
671
+ function f(n) {
672
+ return a.noHighlightRe.test(n);
673
+ }
674
+ function O(n) {
675
+ let u = n.className + " ";
676
+ u += n.parentNode ? n.parentNode.className : "";
677
+ const m = a.languageDetectRe.exec(u);
678
+ if (m) {
679
+ const y = K(m[1]);
680
+ return y || (Fe(k.replace("{}", m[1])), Fe("Falling back to no-highlight mode for this block.", n)), y ? m[1] : "no-highlight";
726
681
  }
727
- h += y.substring(a), N.addText(h);
682
+ return u.split(/\s+/).find((y) => f(y) || K(y));
728
683
  }
729
- function ie() {
730
- if (y === "")
731
- return;
732
- let a = null;
733
- if (typeof g.subLanguage == "string") {
734
- if (!t[g.subLanguage]) {
735
- N.addText(y);
684
+ function v(n, u, m) {
685
+ let y = "", A = "";
686
+ typeof u == "object" ? (y = n, m = u.ignoreIllegals, A = u.language) : (ae("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ae("10.7.0", `Please use highlight(code, options) instead.
687
+ https://github.com/highlightjs/highlight.js/issues/2277`), A = n, y = u), m === void 0 && (m = !0);
688
+ const z = {
689
+ code: y,
690
+ language: A
691
+ };
692
+ Se("before:highlight", z);
693
+ const W = z.result ? z.result : de(z.language, z.code, m);
694
+ return W.code = z.code, Se("after:highlight", W), W;
695
+ }
696
+ function de(n, u, m, y) {
697
+ const A = /* @__PURE__ */ Object.create(null);
698
+ function z(o, d) {
699
+ return o.keywords[d];
700
+ }
701
+ function W() {
702
+ if (!h.keywords) {
703
+ I.addText(x);
736
704
  return;
737
705
  }
738
- a = A(g.subLanguage, y, !0, Re[g.subLanguage]), Re[g.subLanguage] = /** @type {CompiledMode} */
739
- a._top;
740
- } else
741
- a = L(y, g.subLanguage.length ? g.subLanguage : null);
742
- g.relevance > 0 && (se += a.relevance), N.__addSublanguage(a._emitter, a.language);
743
- }
744
- function O() {
745
- g.subLanguage != null ? ie() : T(), y = "";
746
- }
747
- function k(a, d) {
748
- a !== "" && (N.startScope(d), N.addText(a), N.endScope());
749
- }
750
- function Me(a, d) {
751
- let h = 1;
752
- const _ = d.length - 1;
753
- for (; h <= _; ) {
754
- if (!a._emit[h]) {
755
- h++;
756
- continue;
706
+ let o = 0;
707
+ h.keywordPatternRe.lastIndex = 0;
708
+ let d = h.keywordPatternRe.exec(x), b = "";
709
+ for (; d; ) {
710
+ b += x.substring(o, d.index);
711
+ const _ = H.case_insensitive ? d[0].toLowerCase() : d[0], L = z(h, _);
712
+ if (L) {
713
+ const [$, en] = L;
714
+ if (I.addText(b), b = "", A[_] = (A[_] || 0) + 1, A[_] <= Pt && (ve += en), $.startsWith("_"))
715
+ b += d[0];
716
+ else {
717
+ const tn = H.classNameAliases[$] || $;
718
+ U(d[0], tn);
719
+ }
720
+ } else
721
+ b += d[0];
722
+ o = h.keywordPatternRe.lastIndex, d = h.keywordPatternRe.exec(x);
757
723
  }
758
- const S = v.classNameAliases[a[h]] || a[h], I = d[h];
759
- S ? k(I, S) : (y = I, T(), y = ""), h++;
724
+ b += x.substring(o), I.addText(b);
760
725
  }
761
- }
762
- function Ae(a, d) {
763
- return a.scope && typeof a.scope == "string" && N.openNode(v.classNameAliases[a.scope] || a.scope), a.beginScope && (a.beginScope._wrap ? (k(y, v.classNameAliases[a.beginScope._wrap] || a.beginScope._wrap), y = "") : a.beginScope._multi && (Me(a.beginScope, d), y = "")), g = Object.create(a, { parent: { value: g } }), g;
764
- }
765
- function Oe(a, d, h) {
766
- let _ = wt(a.endRe, h);
767
- if (_) {
768
- if (a["on:end"]) {
769
- const S = new ke(a);
770
- a["on:end"](d, S), S.isMatchIgnored && (_ = !1);
726
+ function Ne() {
727
+ if (x === "") return;
728
+ let o = null;
729
+ if (typeof h.subLanguage == "string") {
730
+ if (!t[h.subLanguage]) {
731
+ I.addText(x);
732
+ return;
733
+ }
734
+ o = de(h.subLanguage, x, !0, it[h.subLanguage]), it[h.subLanguage] = /** @type {CompiledMode} */
735
+ o._top;
736
+ } else
737
+ o = Be(x, h.subLanguage.length ? h.subLanguage : null);
738
+ h.relevance > 0 && (ve += o.relevance), I.__addSublanguage(o._emitter, o.language);
739
+ }
740
+ function B() {
741
+ h.subLanguage != null ? Ne() : W(), x = "";
742
+ }
743
+ function U(o, d) {
744
+ o !== "" && (I.startScope(d), I.addText(o), I.endScope());
745
+ }
746
+ function Qe(o, d) {
747
+ let b = 1;
748
+ const _ = d.length - 1;
749
+ for (; b <= _; ) {
750
+ if (!o._emit[b]) {
751
+ b++;
752
+ continue;
753
+ }
754
+ const L = H.classNameAliases[o[b]] || o[b], $ = d[b];
755
+ L ? U($, L) : (x = $, W(), x = ""), b++;
771
756
  }
757
+ }
758
+ function et(o, d) {
759
+ return o.scope && typeof o.scope == "string" && I.openNode(H.classNameAliases[o.scope] || o.scope), o.beginScope && (o.beginScope._wrap ? (U(x, H.classNameAliases[o.beginScope._wrap] || o.beginScope._wrap), x = "") : o.beginScope._multi && (Qe(o.beginScope, d), x = "")), h = Object.create(o, { parent: { value: h } }), h;
760
+ }
761
+ function tt(o, d, b) {
762
+ let _ = re(o.endRe, b);
772
763
  if (_) {
773
- for (; a.endsParent && a.parent; )
774
- a = a.parent;
775
- return a;
764
+ if (o["on:end"]) {
765
+ const L = new s(o);
766
+ o["on:end"](d, L), L.isMatchIgnored && (_ = !1);
767
+ }
768
+ if (_) {
769
+ for (; o.endsParent && o.parent; )
770
+ o = o.parent;
771
+ return o;
772
+ }
776
773
  }
774
+ if (o.endsWithParent)
775
+ return tt(o.parent, d, b);
777
776
  }
778
- if (a.endsWithParent)
779
- return Oe(a.parent, d, h);
780
- }
781
- function it(a) {
782
- return g.matcher.regexIndex === 0 ? (y += a[0], 1) : (me = !0, 0);
783
- }
784
- function rt(a) {
785
- const d = a[0], h = a.rule, _ = new ke(h), S = [h.__beforeBegin, h["on:begin"]];
786
- for (const I of S)
787
- if (I && (I(a, _), _.isMatchIgnored))
788
- return it(d);
789
- return h.skip ? y += d : (h.excludeBegin && (y += d), O(), !h.returnBegin && !h.excludeBegin && (y = d)), Ae(h, a), h.returnBegin ? 0 : d.length;
790
- }
791
- function st(a) {
792
- const d = a[0], h = c.substring(a.index), _ = Oe(g, a, h);
793
- if (!_)
794
- return Be;
795
- const S = g;
796
- g.endScope && g.endScope._wrap ? (O(), k(d, g.endScope._wrap)) : g.endScope && g.endScope._multi ? (O(), Me(g.endScope, a)) : S.skip ? y += d : (S.returnEnd || S.excludeEnd || (y += d), O(), S.excludeEnd && (y = d));
797
- do
798
- g.scope && N.closeNode(), !g.skip && !g.subLanguage && (se += g.relevance), g = g.parent;
799
- while (g !== _.parent);
800
- return _.starts && Ae(_.starts, a), S.returnEnd ? 0 : d.length;
801
- }
802
- function ot() {
803
- const a = [];
804
- for (let d = g; d !== v; d = d.parent)
805
- d.scope && a.unshift(d.scope);
806
- a.forEach((d) => N.openNode(d));
807
- }
808
- let re = {};
809
- function Te(a, d) {
810
- const h = d && d[0];
811
- if (y += a, h == null)
812
- return O(), 0;
813
- if (re.type === "begin" && d.type === "end" && re.index === d.index && h === "") {
814
- if (y += c.slice(d.index, d.index + 1), !u) {
815
- const _ = new Error(`0 width match regex (${r})`);
816
- throw _.languageName = r, _.badRule = re.rule, _;
817
- }
818
- return 1;
777
+ function Yt(o) {
778
+ return h.matcher.regexIndex === 0 ? (x += o[0], 1) : (Ue = !0, 0);
779
+ }
780
+ function qt(o) {
781
+ const d = o[0], b = o.rule, _ = new s(b), L = [b.__beforeBegin, b["on:begin"]];
782
+ for (const $ of L)
783
+ if ($ && ($(o, _), _.isMatchIgnored))
784
+ return Yt(d);
785
+ return b.skip ? x += d : (b.excludeBegin && (x += d), B(), !b.returnBegin && !b.excludeBegin && (x = d)), et(b, o), b.returnBegin ? 0 : d.length;
786
+ }
787
+ function Vt(o) {
788
+ const d = o[0], b = u.substring(o.index), _ = tt(h, o, b);
789
+ if (!_)
790
+ return Xe;
791
+ const L = h;
792
+ h.endScope && h.endScope._wrap ? (B(), U(d, h.endScope._wrap)) : h.endScope && h.endScope._multi ? (B(), Qe(h.endScope, o)) : L.skip ? x += d : (L.returnEnd || L.excludeEnd || (x += d), B(), L.excludeEnd && (x = d));
793
+ do
794
+ h.scope && I.closeNode(), !h.skip && !h.subLanguage && (ve += h.relevance), h = h.parent;
795
+ while (h !== _.parent);
796
+ return _.starts && et(_.starts, o), L.returnEnd ? 0 : d.length;
819
797
  }
820
- if (re = d, d.type === "begin")
821
- return rt(d);
822
- if (d.type === "illegal" && !p) {
823
- const _ = new Error('Illegal lexeme "' + h + '" for mode "' + (g.scope || "<unnamed>") + '"');
824
- throw _.mode = g, _;
825
- } else if (d.type === "end") {
826
- const _ = st(d);
827
- if (_ !== Be)
828
- return _;
798
+ function Jt() {
799
+ const o = [];
800
+ for (let d = h; d !== H; d = d.parent)
801
+ d.scope && o.unshift(d.scope);
802
+ o.forEach((d) => I.openNode(d));
829
803
  }
830
- if (d.type === "illegal" && h === "")
831
- return 1;
832
- if (Ee > 1e5 && Ee > d.index * 3)
833
- throw new Error("potential infinite loop, way more iterations than matches");
834
- return y += h, h.length;
835
- }
836
- const v = R(r);
837
- if (!v)
838
- throw U(f.replace("{}", r)), new Error('Unknown language: "' + r + '"');
839
- const at = nn(v);
840
- let be = "", g = E || at;
841
- const Re = {}, N = new s.__emitter(s);
842
- ot();
843
- let y = "", se = 0, j = 0, Ee = 0, me = !1;
844
- try {
845
- if (v.__emitTokens)
846
- v.__emitTokens(c, N);
847
- else {
848
- for (g.matcher.considerAll(); ; ) {
849
- Ee++, me ? me = !1 : g.matcher.considerAll(), g.matcher.lastIndex = j;
850
- const a = g.matcher.exec(c);
851
- if (!a)
852
- break;
853
- const d = c.substring(j, a.index), h = Te(d, a);
854
- j = a.index + h;
804
+ let ke = {};
805
+ function nt(o, d) {
806
+ const b = d && d[0];
807
+ if (x += o, b == null)
808
+ return B(), 0;
809
+ if (ke.type === "begin" && d.type === "end" && ke.index === d.index && b === "") {
810
+ if (x += u.slice(d.index, d.index + 1), !N) {
811
+ const _ = new Error(`0 width match regex (${n})`);
812
+ throw _.languageName = n, _.badRule = ke.rule, _;
813
+ }
814
+ return 1;
815
+ }
816
+ if (ke = d, d.type === "begin")
817
+ return qt(d);
818
+ if (d.type === "illegal" && !m) {
819
+ const _ = new Error('Illegal lexeme "' + b + '" for mode "' + (h.scope || "<unnamed>") + '"');
820
+ throw _.mode = h, _;
821
+ } else if (d.type === "end") {
822
+ const _ = Vt(d);
823
+ if (_ !== Xe)
824
+ return _;
855
825
  }
856
- Te(c.substring(j));
826
+ if (d.type === "illegal" && b === "")
827
+ return x += `
828
+ `, 1;
829
+ if (ze > 1e5 && ze > d.index * 3)
830
+ throw new Error("potential infinite loop, way more iterations than matches");
831
+ return x += b, b.length;
857
832
  }
858
- return N.finalize(), be = N.toHTML(), {
859
- language: r,
860
- value: be,
861
- relevance: se,
862
- illegal: !1,
863
- _emitter: N,
864
- _top: g
865
- };
866
- } catch (a) {
867
- if (a.message && a.message.includes("Illegal"))
868
- return {
869
- language: r,
870
- value: _e(c),
871
- illegal: !0,
872
- relevance: 0,
873
- _illegalBy: {
874
- message: a.message,
875
- index: j,
876
- context: c.slice(j - 100, j + 100),
877
- mode: a.mode,
878
- resultSoFar: be
879
- },
880
- _emitter: N
881
- };
882
- if (u)
883
- return {
884
- language: r,
885
- value: _e(c),
833
+ const H = K(n);
834
+ if (!H)
835
+ throw Q(k.replace("{}", n)), new Error('Unknown language: "' + n + '"');
836
+ const Qt = It(H);
837
+ let je = "", h = y || Qt;
838
+ const it = {}, I = new a.__emitter(a);
839
+ Jt();
840
+ let x = "", ve = 0, ee = 0, ze = 0, Ue = !1;
841
+ try {
842
+ if (H.__emitTokens)
843
+ H.__emitTokens(u, I);
844
+ else {
845
+ for (h.matcher.considerAll(); ; ) {
846
+ ze++, Ue ? Ue = !1 : h.matcher.considerAll(), h.matcher.lastIndex = ee;
847
+ const o = h.matcher.exec(u);
848
+ if (!o) break;
849
+ const d = u.substring(ee, o.index), b = nt(d, o);
850
+ ee = o.index + b;
851
+ }
852
+ nt(u.substring(ee));
853
+ }
854
+ return I.finalize(), je = I.toHTML(), {
855
+ language: n,
856
+ value: je,
857
+ relevance: ve,
886
858
  illegal: !1,
887
- relevance: 0,
888
- errorRaised: a,
889
- _emitter: N,
890
- _top: g
859
+ _emitter: I,
860
+ _top: h
891
861
  };
892
- throw a;
862
+ } catch (o) {
863
+ if (o.message && o.message.includes("Illegal"))
864
+ return {
865
+ language: n,
866
+ value: Le(u),
867
+ illegal: !0,
868
+ relevance: 0,
869
+ _illegalBy: {
870
+ message: o.message,
871
+ index: ee,
872
+ context: u.slice(ee - 100, ee + 100),
873
+ mode: o.mode,
874
+ resultSoFar: je
875
+ },
876
+ _emitter: I
877
+ };
878
+ if (N)
879
+ return {
880
+ language: n,
881
+ value: Le(u),
882
+ illegal: !1,
883
+ relevance: 0,
884
+ errorRaised: o,
885
+ _emitter: I,
886
+ _top: h
887
+ };
888
+ throw o;
889
+ }
893
890
  }
894
- }
895
- function w(r) {
896
- const c = {
897
- value: _e(r),
898
- illegal: !1,
899
- relevance: 0,
900
- _top: o,
901
- _emitter: new s.__emitter(s)
891
+ function De(n) {
892
+ const u = {
893
+ value: Le(n),
894
+ illegal: !1,
895
+ relevance: 0,
896
+ _top: l,
897
+ _emitter: new a.__emitter(a)
898
+ };
899
+ return u._emitter.addText(n), u;
900
+ }
901
+ function Be(n, u) {
902
+ u = u || a.languages || Object.keys(t);
903
+ const m = De(n), y = u.filter(K).filter(Je).map(
904
+ (B) => de(B, n, !1)
905
+ );
906
+ y.unshift(m);
907
+ const A = y.sort((B, U) => {
908
+ if (B.relevance !== U.relevance) return U.relevance - B.relevance;
909
+ if (B.language && U.language) {
910
+ if (K(B.language).supersetOf === U.language)
911
+ return 1;
912
+ if (K(U.language).supersetOf === B.language)
913
+ return -1;
914
+ }
915
+ return 0;
916
+ }), [z, W] = A, Ne = z;
917
+ return Ne.secondBest = W, Ne;
918
+ }
919
+ function jt(n, u, m) {
920
+ const y = u && r[u] || m;
921
+ n.classList.add("hljs"), n.classList.add(`language-${y}`);
922
+ }
923
+ function Pe(n) {
924
+ let u = null;
925
+ const m = O(n);
926
+ if (f(m)) return;
927
+ if (Se(
928
+ "before:highlightElement",
929
+ { el: n, language: m }
930
+ ), n.dataset.highlighted) {
931
+ console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", n);
932
+ return;
933
+ }
934
+ if (n.children.length > 0 && (a.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(n)), a.throwUnescapedHTML))
935
+ throw new Bt(
936
+ "One of your code blocks includes unescaped HTML.",
937
+ n.innerHTML
938
+ );
939
+ u = n;
940
+ const y = u.textContent, A = m ? v(y, { language: m, ignoreIllegals: !0 }) : Be(y);
941
+ n.innerHTML = A.value, n.dataset.highlighted = "yes", jt(n, m, A.language), n.result = {
942
+ language: A.language,
943
+ // TODO: remove with version 11.0
944
+ re: A.relevance,
945
+ relevance: A.relevance
946
+ }, A.secondBest && (n.secondBest = {
947
+ language: A.secondBest.language,
948
+ relevance: A.secondBest.relevance
949
+ }), Se("after:highlightElement", { el: n, result: A, text: y });
950
+ }
951
+ function zt(n) {
952
+ a = Ze(a, n);
953
+ }
954
+ const Ut = () => {
955
+ we(), ae("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
902
956
  };
903
- return c._emitter.addText(r), c;
904
- }
905
- function L(r, c) {
906
- c = c || s.languages || Object.keys(t);
907
- const p = w(r), E = c.filter(R).filter(te).map(
908
- (O) => A(O, r, !1)
909
- );
910
- E.unshift(p);
911
- const x = E.sort((O, k) => {
912
- if (O.relevance !== k.relevance)
913
- return k.relevance - O.relevance;
914
- if (O.language && k.language) {
915
- if (R(O.language).supersetOf === k.language)
916
- return 1;
917
- if (R(k.language).supersetOf === O.language)
918
- return -1;
957
+ function Ht() {
958
+ we(), ae("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
959
+ }
960
+ let qe = !1;
961
+ function we() {
962
+ function n() {
963
+ we();
919
964
  }
920
- return 0;
921
- }), [M, T] = x, ie = M;
922
- return ie.secondBest = T, ie;
923
- }
924
- function H(r, c, p) {
925
- const E = c && n[c] || p;
926
- r.classList.add("hljs"), r.classList.add(`language-${E}`);
927
- }
928
- function C(r) {
929
- let c = null;
930
- const p = b(r);
931
- if (l(p))
932
- return;
933
- if (G(
934
- "before:highlightElement",
935
- { el: r, language: p }
936
- ), r.dataset.highlighted) {
937
- console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", r);
938
- return;
939
- }
940
- if (r.children.length > 0 && (s.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(r)), s.throwUnescapedHTML))
941
- throw new on(
942
- "One of your code blocks includes unescaped HTML.",
943
- r.innerHTML
944
- );
945
- c = r;
946
- const E = c.textContent, x = p ? m(E, { language: p, ignoreIllegals: !0 }) : L(E);
947
- r.innerHTML = x.value, r.dataset.highlighted = "yes", H(r, p, x.language), r.result = {
948
- language: x.language,
949
- // TODO: remove with version 11.0
950
- re: x.relevance,
951
- relevance: x.relevance
952
- }, x.secondBest && (r.secondBest = {
953
- language: x.secondBest.language,
954
- relevance: x.secondBest.relevance
955
- }), G("after:highlightElement", { el: r, result: x, text: E });
956
- }
957
- function $(r) {
958
- s = De(s, r);
959
- }
960
- const Se = () => {
961
- B(), F("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
962
- };
963
- function W() {
964
- B(), F("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
965
- }
966
- let Z = !1;
967
- function B() {
968
- if (document.readyState === "loading") {
969
- Z = !0;
970
- return;
965
+ if (document.readyState === "loading") {
966
+ qe || window.addEventListener("DOMContentLoaded", n, !1), qe = !0;
967
+ return;
968
+ }
969
+ document.querySelectorAll(a.cssSelector).forEach(Pe);
971
970
  }
972
- document.querySelectorAll(s.cssSelector).forEach(C);
973
- }
974
- function X() {
975
- Z && B();
976
- }
977
- typeof window < "u" && window.addEventListener && window.addEventListener("DOMContentLoaded", X, !1);
978
- function P(r, c) {
979
- let p = null;
980
- try {
981
- p = c(e);
982
- } catch (E) {
983
- if (U("Language definition for '{}' could not be registered.".replace("{}", r)), u)
984
- U(E);
985
- else
986
- throw E;
987
- p = o;
988
- }
989
- p.name || (p.name = r), t[r] = p, p.rawDefinition = c.bind(null, e), p.aliases && ee(p.aliases, { languageName: r });
990
- }
991
- function ge(r) {
992
- delete t[r];
993
- for (const c of Object.keys(n))
994
- n[c] === r && delete n[c];
995
- }
996
- function Q() {
997
- return Object.keys(t);
998
- }
999
- function R(r) {
1000
- return r = (r || "").toLowerCase(), t[r] || t[n[r]];
1001
- }
1002
- function ee(r, { languageName: c }) {
1003
- typeof r == "string" && (r = [r]), r.forEach((p) => {
1004
- n[p.toLowerCase()] = c;
1005
- });
1006
- }
1007
- function te(r) {
1008
- const c = R(r);
1009
- return c && !c.disableAutodetect;
1010
- }
1011
- function fe(r) {
1012
- r["before:highlightBlock"] && !r["before:highlightElement"] && (r["before:highlightElement"] = (c) => {
1013
- r["before:highlightBlock"](
1014
- Object.assign({ block: c.el }, c)
1015
- );
1016
- }), r["after:highlightBlock"] && !r["after:highlightElement"] && (r["after:highlightElement"] = (c) => {
1017
- r["after:highlightBlock"](
1018
- Object.assign({ block: c.el }, c)
1019
- );
1020
- });
1021
- }
1022
- function pe(r) {
1023
- fe(r), i.push(r);
1024
- }
1025
- function he(r) {
1026
- const c = i.indexOf(r);
1027
- c !== -1 && i.splice(c, 1);
1028
- }
1029
- function G(r, c) {
1030
- const p = r;
1031
- i.forEach(function(E) {
1032
- E[p] && E[p](c);
1033
- });
1034
- }
1035
- function ne(r) {
1036
- return F("10.7.0", "highlightBlock will be removed entirely in v12.0"), F("10.7.0", "Please use highlightElement now."), C(r);
1037
- }
1038
- Object.assign(e, {
1039
- highlight: m,
1040
- highlightAuto: L,
1041
- highlightAll: B,
1042
- highlightElement: C,
1043
- // TODO: Remove with v12 API
1044
- highlightBlock: ne,
1045
- configure: $,
1046
- initHighlighting: Se,
1047
- initHighlightingOnLoad: W,
1048
- registerLanguage: P,
1049
- unregisterLanguage: ge,
1050
- listLanguages: Q,
1051
- getLanguage: R,
1052
- registerAliases: ee,
1053
- autoDetection: te,
1054
- inherit: De,
1055
- addPlugin: pe,
1056
- removePlugin: he
1057
- }), e.debugMode = function() {
1058
- u = !1;
1059
- }, e.safeMode = function() {
1060
- u = !0;
1061
- }, e.versionString = sn, e.regex = {
1062
- concat: z,
1063
- lookahead: Ue,
1064
- either: xe,
1065
- optional: yt,
1066
- anyNumberOfTimes: _t
1067
- };
1068
- for (const r in oe)
1069
- typeof oe[r] == "object" && Pe(oe[r]);
1070
- return Object.assign(e, oe), e;
1071
- }, K = Xe({});
1072
- K.newInstance = () => Xe({});
1073
- var cn = K;
1074
- K.HighlightJS = K;
1075
- K.default = K;
1076
- const ue = /* @__PURE__ */ pt(cn), le = "[A-Za-z$_][0-9A-Za-z$_]*", Ye = [
971
+ function Gt(n, u) {
972
+ let m = null;
973
+ try {
974
+ m = u(e);
975
+ } catch (y) {
976
+ if (Q("Language definition for '{}' could not be registered.".replace("{}", n)), N)
977
+ Q(y);
978
+ else
979
+ throw y;
980
+ m = l;
981
+ }
982
+ m.name || (m.name = n), t[n] = m, m.rawDefinition = u.bind(null, e), m.aliases && Ve(m.aliases, { languageName: n });
983
+ }
984
+ function $t(n) {
985
+ delete t[n];
986
+ for (const u of Object.keys(r))
987
+ r[u] === n && delete r[u];
988
+ }
989
+ function Ft() {
990
+ return Object.keys(t);
991
+ }
992
+ function K(n) {
993
+ return n = (n || "").toLowerCase(), t[n] || t[r[n]];
994
+ }
995
+ function Ve(n, { languageName: u }) {
996
+ typeof n == "string" && (n = [n]), n.forEach((m) => {
997
+ r[m.toLowerCase()] = u;
998
+ });
999
+ }
1000
+ function Je(n) {
1001
+ const u = K(n);
1002
+ return u && !u.disableAutodetect;
1003
+ }
1004
+ function Kt(n) {
1005
+ n["before:highlightBlock"] && !n["before:highlightElement"] && (n["before:highlightElement"] = (u) => {
1006
+ n["before:highlightBlock"](
1007
+ Object.assign({ block: u.el }, u)
1008
+ );
1009
+ }), n["after:highlightBlock"] && !n["after:highlightElement"] && (n["after:highlightElement"] = (u) => {
1010
+ n["after:highlightBlock"](
1011
+ Object.assign({ block: u.el }, u)
1012
+ );
1013
+ });
1014
+ }
1015
+ function Wt(n) {
1016
+ Kt(n), p.push(n);
1017
+ }
1018
+ function Zt(n) {
1019
+ const u = p.indexOf(n);
1020
+ u !== -1 && p.splice(u, 1);
1021
+ }
1022
+ function Se(n, u) {
1023
+ const m = n;
1024
+ p.forEach(function(y) {
1025
+ y[m] && y[m](u);
1026
+ });
1027
+ }
1028
+ function Xt(n) {
1029
+ return ae("10.7.0", "highlightBlock will be removed entirely in v12.0"), ae("10.7.0", "Please use highlightElement now."), Pe(n);
1030
+ }
1031
+ Object.assign(e, {
1032
+ highlight: v,
1033
+ highlightAuto: Be,
1034
+ highlightAll: we,
1035
+ highlightElement: Pe,
1036
+ // TODO: Remove with v12 API
1037
+ highlightBlock: Xt,
1038
+ configure: zt,
1039
+ initHighlighting: Ut,
1040
+ initHighlightingOnLoad: Ht,
1041
+ registerLanguage: Gt,
1042
+ unregisterLanguage: $t,
1043
+ listLanguages: Ft,
1044
+ getLanguage: K,
1045
+ registerAliases: Ve,
1046
+ autoDetection: Je,
1047
+ inherit: Ze,
1048
+ addPlugin: Wt,
1049
+ removePlugin: Zt
1050
+ }), e.debugMode = function() {
1051
+ N = !1;
1052
+ }, e.safeMode = function() {
1053
+ N = !0;
1054
+ }, e.versionString = Dt, e.regex = {
1055
+ concat: R,
1056
+ lookahead: P,
1057
+ either: ie,
1058
+ optional: te,
1059
+ anyNumberOfTimes: X
1060
+ };
1061
+ for (const n in ye)
1062
+ typeof ye[n] == "object" && i(ye[n]);
1063
+ return Object.assign(e, ye), e;
1064
+ }, ce = Ye({});
1065
+ return ce.newInstance = () => Ye({}), He = ce, ce.HighlightJS = ce, ce.default = ce, He;
1066
+ }
1067
+ var ln = /* @__PURE__ */ cn();
1068
+ const Te = /* @__PURE__ */ an(ln), Ae = "[A-Za-z$_][0-9A-Za-z$_]*", ot = [
1077
1069
  "as",
1078
1070
  // for exports
1079
1071
  "in",
@@ -1115,15 +1107,17 @@ const ue = /* @__PURE__ */ pt(cn), le = "[A-Za-z$_][0-9A-Za-z$_]*", Ye = [
1115
1107
  "import",
1116
1108
  "from",
1117
1109
  "export",
1118
- "extends"
1119
- ], qe = [
1110
+ "extends",
1111
+ // It's reached stage 3, which is "recommended for implementation":
1112
+ "using"
1113
+ ], st = [
1120
1114
  "true",
1121
1115
  "false",
1122
1116
  "null",
1123
1117
  "undefined",
1124
1118
  "NaN",
1125
1119
  "Infinity"
1126
- ], Je = [
1120
+ ], at = [
1127
1121
  // Fundamental objects
1128
1122
  "Object",
1129
1123
  "Function",
@@ -1173,7 +1167,7 @@ const ue = /* @__PURE__ */ pt(cn), le = "[A-Za-z$_][0-9A-Za-z$_]*", Ye = [
1173
1167
  "Intl",
1174
1168
  // WebAssembly
1175
1169
  "WebAssembly"
1176
- ], Ve = [
1170
+ ], ct = [
1177
1171
  "Error",
1178
1172
  "EvalError",
1179
1173
  "InternalError",
@@ -1182,7 +1176,7 @@ const ue = /* @__PURE__ */ pt(cn), le = "[A-Za-z$_][0-9A-Za-z$_]*", Ye = [
1182
1176
  "SyntaxError",
1183
1177
  "TypeError",
1184
1178
  "URIError"
1185
- ], Qe = [
1179
+ ], lt = [
1186
1180
  "setInterval",
1187
1181
  "setTimeout",
1188
1182
  "clearInterval",
@@ -1200,7 +1194,7 @@ const ue = /* @__PURE__ */ pt(cn), le = "[A-Za-z$_][0-9A-Za-z$_]*", Ye = [
1200
1194
  "encodeURIComponent",
1201
1195
  "escape",
1202
1196
  "unescape"
1203
- ], et = [
1197
+ ], dt = [
1204
1198
  "arguments",
1205
1199
  "this",
1206
1200
  "super",
@@ -1212,62 +1206,62 @@ const ue = /* @__PURE__ */ pt(cn), le = "[A-Za-z$_][0-9A-Za-z$_]*", Ye = [
1212
1206
  "module",
1213
1207
  "global"
1214
1208
  // Node.js
1215
- ], tt = [].concat(
1216
- Qe,
1217
- Je,
1218
- Ve
1209
+ ], ut = [].concat(
1210
+ lt,
1211
+ at,
1212
+ ct
1219
1213
  );
1220
- function ln(e) {
1221
- const t = e.regex, n = (c, { after: p }) => {
1222
- const E = "</" + c[0].slice(1);
1223
- return c.input.indexOf(E, p) !== -1;
1224
- }, i = le, u = {
1214
+ function dn(i) {
1215
+ const s = i.regex, c = (C, { after: F }) => {
1216
+ const J = "</" + C[0].slice(1);
1217
+ return C.input.indexOf(J, F) !== -1;
1218
+ }, g = Ae, E = {
1225
1219
  begin: "<>",
1226
1220
  end: "</>"
1227
- }, f = /<[A-Za-z0-9\\._:-]+\s*\/>/, o = {
1221
+ }, w = /<[A-Za-z0-9\\._:-]+\s*\/>/, S = {
1228
1222
  begin: /<[A-Za-z0-9\\._:-]+/,
1229
1223
  end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
1230
1224
  /**
1231
1225
  * @param {RegExpMatchArray} match
1232
1226
  * @param {CallbackResponse} response
1233
1227
  */
1234
- isTrulyOpeningTag: (c, p) => {
1235
- const E = c[0].length + c.index, x = c.input[E];
1228
+ isTrulyOpeningTag: (C, F) => {
1229
+ const J = C[0].length + C.index, se = C.input[J];
1236
1230
  if (
1237
1231
  // HTML should not include another raw `<` inside a tag
1238
1232
  // nested type?
1239
1233
  // `<Array<Array<number>>`, etc.
1240
- x === "<" || // the , gives away that this is not HTML
1234
+ se === "<" || // the , gives away that this is not HTML
1241
1235
  // `<T, A extends keyof T, V>`
1242
- x === ","
1236
+ se === ","
1243
1237
  ) {
1244
- p.ignoreMatch();
1238
+ F.ignoreMatch();
1245
1239
  return;
1246
1240
  }
1247
- x === ">" && (n(c, { after: E }) || p.ignoreMatch());
1248
- let M;
1249
- const T = c.input.substring(E);
1250
- if (M = T.match(/^\s*=/)) {
1251
- p.ignoreMatch();
1241
+ se === ">" && (c(C, { after: J }) || F.ignoreMatch());
1242
+ let le;
1243
+ const _e = C.input.substring(J);
1244
+ if (le = _e.match(/^\s*=/)) {
1245
+ F.ignoreMatch();
1252
1246
  return;
1253
1247
  }
1254
- if ((M = T.match(/^\s+extends\s+/)) && M.index === 0) {
1255
- p.ignoreMatch();
1248
+ if ((le = _e.match(/^\s+extends\s+/)) && le.index === 0) {
1249
+ F.ignoreMatch();
1256
1250
  return;
1257
1251
  }
1258
1252
  }
1259
- }, s = {
1260
- $pattern: le,
1261
- keyword: Ye,
1262
- literal: qe,
1263
- built_in: tt,
1264
- "variable.language": et
1265
- }, l = "[0-9](_?[0-9])*", b = `\\.(${l})`, m = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", A = {
1253
+ }, M = {
1254
+ $pattern: Ae,
1255
+ keyword: ot,
1256
+ literal: st,
1257
+ built_in: ut,
1258
+ "variable.language": dt
1259
+ }, D = "[0-9](_?[0-9])*", T = `\\.(${D})`, Z = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", j = {
1266
1260
  className: "number",
1267
1261
  variants: [
1268
1262
  // DecimalLiteral
1269
- { begin: `(\\b(${m})((${b})|\\.)?|(${b}))[eE][+-]?(${l})\\b` },
1270
- { begin: `\\b(${m})\\b((${b})\\b|\\.)?|(${b})\\b` },
1263
+ { begin: `(\\b(${Z})((${T})|\\.)?|(${T}))[eE][+-]?(${D})\\b` },
1264
+ { begin: `\\b(${Z})\\b((${T})\\b|\\.)?|(${T})\\b` },
1271
1265
  // DecimalBigIntegerLiteral
1272
1266
  { begin: "\\b(0|[1-9](_?[0-9])*)n\\b" },
1273
1267
  // NonDecimalIntegerLiteral
@@ -1279,61 +1273,61 @@ function ln(e) {
1279
1273
  { begin: "\\b0[0-7]+n?\\b" }
1280
1274
  ],
1281
1275
  relevance: 0
1282
- }, w = {
1276
+ }, P = {
1283
1277
  className: "subst",
1284
1278
  begin: "\\$\\{",
1285
1279
  end: "\\}",
1286
- keywords: s,
1280
+ keywords: M,
1287
1281
  contains: []
1288
1282
  // defined later
1289
- }, L = {
1290
- begin: "html`",
1283
+ }, X = {
1284
+ begin: ".?html`",
1291
1285
  end: "",
1292
1286
  starts: {
1293
1287
  end: "`",
1294
1288
  returnEnd: !1,
1295
1289
  contains: [
1296
- e.BACKSLASH_ESCAPE,
1297
- w
1290
+ i.BACKSLASH_ESCAPE,
1291
+ P
1298
1292
  ],
1299
1293
  subLanguage: "xml"
1300
1294
  }
1301
- }, H = {
1302
- begin: "css`",
1295
+ }, te = {
1296
+ begin: ".?css`",
1303
1297
  end: "",
1304
1298
  starts: {
1305
1299
  end: "`",
1306
1300
  returnEnd: !1,
1307
1301
  contains: [
1308
- e.BACKSLASH_ESCAPE,
1309
- w
1302
+ i.BACKSLASH_ESCAPE,
1303
+ P
1310
1304
  ],
1311
1305
  subLanguage: "css"
1312
1306
  }
1313
- }, C = {
1314
- begin: "gql`",
1307
+ }, R = {
1308
+ begin: ".?gql`",
1315
1309
  end: "",
1316
1310
  starts: {
1317
1311
  end: "`",
1318
1312
  returnEnd: !1,
1319
1313
  contains: [
1320
- e.BACKSLASH_ESCAPE,
1321
- w
1314
+ i.BACKSLASH_ESCAPE,
1315
+ P
1322
1316
  ],
1323
1317
  subLanguage: "graphql"
1324
1318
  }
1325
- }, $ = {
1319
+ }, ne = {
1326
1320
  className: "string",
1327
1321
  begin: "`",
1328
1322
  end: "`",
1329
1323
  contains: [
1330
- e.BACKSLASH_ESCAPE,
1331
- w
1324
+ i.BACKSLASH_ESCAPE,
1325
+ P
1332
1326
  ]
1333
- }, W = {
1327
+ }, G = {
1334
1328
  className: "comment",
1335
1329
  variants: [
1336
- e.COMMENT(
1330
+ i.COMMENT(
1337
1331
  /\/\*\*(?!\/)/,
1338
1332
  "\\*/",
1339
1333
  {
@@ -1357,7 +1351,7 @@ function ln(e) {
1357
1351
  },
1358
1352
  {
1359
1353
  className: "variable",
1360
- begin: i + "(?=\\s*(-)|$)",
1354
+ begin: g + "(?=\\s*(-)|$)",
1361
1355
  endsParent: !0,
1362
1356
  relevance: 0
1363
1357
  },
@@ -1372,61 +1366,63 @@ function ln(e) {
1372
1366
  ]
1373
1367
  }
1374
1368
  ),
1375
- e.C_BLOCK_COMMENT_MODE,
1376
- e.C_LINE_COMMENT_MODE
1369
+ i.C_BLOCK_COMMENT_MODE,
1370
+ i.C_LINE_COMMENT_MODE
1377
1371
  ]
1378
- }, Z = [
1379
- e.APOS_STRING_MODE,
1380
- e.QUOTE_STRING_MODE,
1381
- L,
1382
- H,
1383
- C,
1384
- $,
1372
+ }, re = [
1373
+ i.APOS_STRING_MODE,
1374
+ i.QUOTE_STRING_MODE,
1375
+ X,
1376
+ te,
1377
+ R,
1378
+ ne,
1385
1379
  // Skip numbers when they are part of a variable name
1386
1380
  { match: /\$\d+/ },
1387
- A
1381
+ j
1388
1382
  // This is intentional:
1389
1383
  // See https://github.com/highlightjs/highlight.js/issues/3288
1390
1384
  // hljs.REGEXP_MODE
1391
1385
  ];
1392
- w.contains = Z.concat({
1386
+ P.contains = re.concat({
1393
1387
  // we need to pair up {} inside our subst to prevent
1394
1388
  // it from ending too early by matching another }
1395
1389
  begin: /\{/,
1396
1390
  end: /\}/,
1397
- keywords: s,
1391
+ keywords: M,
1398
1392
  contains: [
1399
1393
  "self"
1400
- ].concat(Z)
1394
+ ].concat(re)
1401
1395
  });
1402
- const B = [].concat(W, w.contains), X = B.concat([
1396
+ const fe = [].concat(G, P.contains), Y = fe.concat([
1403
1397
  // eat recursive parens in sub expressions
1404
1398
  {
1405
- begin: /\(/,
1399
+ begin: /(\s*)\(/,
1406
1400
  end: /\)/,
1407
- keywords: s,
1408
- contains: ["self"].concat(B)
1401
+ keywords: M,
1402
+ contains: ["self"].concat(fe)
1409
1403
  }
1410
- ]), P = {
1404
+ ]), q = {
1411
1405
  className: "params",
1412
- begin: /\(/,
1406
+ // convert this to negative lookbehind in v12
1407
+ begin: /(\s*)\(/,
1408
+ // to match the parms with
1413
1409
  end: /\)/,
1414
1410
  excludeBegin: !0,
1415
1411
  excludeEnd: !0,
1416
- keywords: s,
1417
- contains: X
1418
- }, ge = {
1412
+ keywords: M,
1413
+ contains: Y
1414
+ }, pe = {
1419
1415
  variants: [
1420
1416
  // class Car extends vehicle
1421
1417
  {
1422
1418
  match: [
1423
1419
  /class/,
1424
1420
  /\s+/,
1425
- i,
1421
+ g,
1426
1422
  /\s+/,
1427
1423
  /extends/,
1428
1424
  /\s+/,
1429
- t.concat(i, "(", t.concat(/\./, i), ")*")
1425
+ s.concat(g, "(", s.concat(/\./, g), ")*")
1430
1426
  ],
1431
1427
  scope: {
1432
1428
  1: "keyword",
@@ -1440,7 +1436,7 @@ function ln(e) {
1440
1436
  match: [
1441
1437
  /class/,
1442
1438
  /\s+/,
1443
- i
1439
+ g
1444
1440
  ],
1445
1441
  scope: {
1446
1442
  1: "keyword",
@@ -1448,9 +1444,9 @@ function ln(e) {
1448
1444
  }
1449
1445
  }
1450
1446
  ]
1451
- }, Q = {
1447
+ }, oe = {
1452
1448
  relevance: 0,
1453
- match: t.either(
1449
+ match: s.either(
1454
1450
  // Hard coded exceptions
1455
1451
  /\bJSON/,
1456
1452
  // Float32Array, OutT
@@ -1468,22 +1464,22 @@ function ln(e) {
1468
1464
  keywords: {
1469
1465
  _: [
1470
1466
  // se we still get relevance credit for JS library classes
1471
- ...Je,
1472
- ...Ve
1467
+ ...at,
1468
+ ...ct
1473
1469
  ]
1474
1470
  }
1475
- }, R = {
1471
+ }, he = {
1476
1472
  label: "use_strict",
1477
1473
  className: "meta",
1478
1474
  relevance: 10,
1479
1475
  begin: /^\s*['"]use (strict|asm)['"]/
1480
- }, ee = {
1476
+ }, be = {
1481
1477
  variants: [
1482
1478
  {
1483
1479
  match: [
1484
1480
  /function/,
1485
1481
  /\s+/,
1486
- i,
1482
+ g,
1487
1483
  /(?=\s*\()/
1488
1484
  ]
1489
1485
  },
@@ -1500,43 +1496,43 @@ function ln(e) {
1500
1496
  3: "title.function"
1501
1497
  },
1502
1498
  label: "func.def",
1503
- contains: [P],
1499
+ contains: [q],
1504
1500
  illegal: /%/
1505
- }, te = {
1501
+ }, me = {
1506
1502
  relevance: 0,
1507
1503
  match: /\b[A-Z][A-Z_0-9]+\b/,
1508
1504
  className: "variable.constant"
1509
1505
  };
1510
- function fe(c) {
1511
- return t.concat("(?!", c.join("|"), ")");
1506
+ function Oe(C) {
1507
+ return s.concat("(?!", C.join("|"), ")");
1512
1508
  }
1513
- const pe = {
1514
- match: t.concat(
1509
+ const Re = {
1510
+ match: s.concat(
1515
1511
  /\b/,
1516
- fe([
1517
- ...Qe,
1512
+ Oe([
1513
+ ...lt,
1518
1514
  "super",
1519
1515
  "import"
1520
- ]),
1521
- i,
1522
- t.lookahead(/\(/)
1516
+ ].map((C) => `${C}\\s*\\(`)),
1517
+ g,
1518
+ s.lookahead(/\s*\(/)
1523
1519
  ),
1524
1520
  className: "title.function",
1525
1521
  relevance: 0
1526
- }, he = {
1527
- begin: t.concat(/\./, t.lookahead(
1528
- t.concat(i, /(?![0-9A-Za-z$_(])/)
1522
+ }, V = {
1523
+ begin: s.concat(/\./, s.lookahead(
1524
+ s.concat(g, /(?![0-9A-Za-z$_(])/)
1529
1525
  )),
1530
- end: i,
1526
+ end: g,
1531
1527
  excludeBegin: !0,
1532
1528
  keywords: "prototype",
1533
1529
  className: "property",
1534
1530
  relevance: 0
1535
- }, G = {
1531
+ }, Ce = {
1536
1532
  match: [
1537
1533
  /get|set/,
1538
1534
  /\s+/,
1539
- i,
1535
+ g,
1540
1536
  /(?=\()/
1541
1537
  ],
1542
1538
  className: {
@@ -1548,18 +1544,18 @@ function ln(e) {
1548
1544
  // eat to avoid empty params
1549
1545
  begin: /\(\)/
1550
1546
  },
1551
- P
1547
+ q
1552
1548
  ]
1553
- }, ne = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + e.UNDERSCORE_IDENT_RE + ")\\s*=>", r = {
1549
+ }, Ee = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + i.UNDERSCORE_IDENT_RE + ")\\s*=>", Ie = {
1554
1550
  match: [
1555
1551
  /const|var|let/,
1556
1552
  /\s+/,
1557
- i,
1553
+ g,
1558
1554
  /\s*/,
1559
1555
  /=\s*/,
1560
1556
  /(async\s*)?/,
1561
1557
  // async is optional
1562
- t.lookahead(ne)
1558
+ s.lookahead(Ee)
1563
1559
  ],
1564
1560
  keywords: "async",
1565
1561
  className: {
@@ -1567,54 +1563,54 @@ function ln(e) {
1567
1563
  3: "title.function"
1568
1564
  },
1569
1565
  contains: [
1570
- P
1566
+ q
1571
1567
  ]
1572
1568
  };
1573
1569
  return {
1574
1570
  name: "JavaScript",
1575
1571
  aliases: ["js", "jsx", "mjs", "cjs"],
1576
- keywords: s,
1572
+ keywords: M,
1577
1573
  // this will be extended by TypeScript
1578
- exports: { PARAMS_CONTAINS: X, CLASS_REFERENCE: Q },
1574
+ exports: { PARAMS_CONTAINS: Y, CLASS_REFERENCE: oe },
1579
1575
  illegal: /#(?![$_A-z])/,
1580
1576
  contains: [
1581
- e.SHEBANG({
1577
+ i.SHEBANG({
1582
1578
  label: "shebang",
1583
1579
  binary: "node",
1584
1580
  relevance: 5
1585
1581
  }),
1582
+ he,
1583
+ i.APOS_STRING_MODE,
1584
+ i.QUOTE_STRING_MODE,
1585
+ X,
1586
+ te,
1586
1587
  R,
1587
- e.APOS_STRING_MODE,
1588
- e.QUOTE_STRING_MODE,
1589
- L,
1590
- H,
1591
- C,
1592
- $,
1593
- W,
1588
+ ne,
1589
+ G,
1594
1590
  // Skip numbers when they are part of a variable name
1595
1591
  { match: /\$\d+/ },
1596
- A,
1597
- Q,
1592
+ j,
1593
+ oe,
1598
1594
  {
1599
- className: "attr",
1600
- begin: i + t.lookahead(":"),
1595
+ scope: "attr",
1596
+ match: g + s.lookahead(":"),
1601
1597
  relevance: 0
1602
1598
  },
1603
- r,
1599
+ Ie,
1604
1600
  {
1605
1601
  // "value" container
1606
- begin: "(" + e.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
1602
+ begin: "(" + i.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
1607
1603
  keywords: "return throw case",
1608
1604
  relevance: 0,
1609
1605
  contains: [
1610
- W,
1611
- e.REGEXP_MODE,
1606
+ G,
1607
+ i.REGEXP_MODE,
1612
1608
  {
1613
1609
  className: "function",
1614
1610
  // we have to count the parens to make sure we actually have the
1615
1611
  // correct bounding ( ) before the =>. There could be any number of
1616
1612
  // sub-expressions inside also surrounded by parens.
1617
- begin: ne,
1613
+ begin: Ee,
1618
1614
  returnBegin: !0,
1619
1615
  end: "\\s*=>",
1620
1616
  contains: [
@@ -1622,7 +1618,7 @@ function ln(e) {
1622
1618
  className: "params",
1623
1619
  variants: [
1624
1620
  {
1625
- begin: e.UNDERSCORE_IDENT_RE,
1621
+ begin: i.UNDERSCORE_IDENT_RE,
1626
1622
  relevance: 0
1627
1623
  },
1628
1624
  {
@@ -1631,12 +1627,12 @@ function ln(e) {
1631
1627
  skip: !0
1632
1628
  },
1633
1629
  {
1634
- begin: /\(/,
1630
+ begin: /(\s*)\(/,
1635
1631
  end: /\)/,
1636
1632
  excludeBegin: !0,
1637
1633
  excludeEnd: !0,
1638
- keywords: s,
1639
- contains: X
1634
+ keywords: M,
1635
+ contains: Y
1640
1636
  }
1641
1637
  ]
1642
1638
  }
@@ -1654,21 +1650,21 @@ function ln(e) {
1654
1650
  {
1655
1651
  // JSX
1656
1652
  variants: [
1657
- { begin: u.begin, end: u.end },
1658
- { match: f },
1653
+ { begin: E.begin, end: E.end },
1654
+ { match: w },
1659
1655
  {
1660
- begin: o.begin,
1656
+ begin: S.begin,
1661
1657
  // we carefully check the opening tag to see if it truly
1662
1658
  // is a tag and not a false positive
1663
- "on:begin": o.isTrulyOpeningTag,
1664
- end: o.end
1659
+ "on:begin": S.isTrulyOpeningTag,
1660
+ end: S.end
1665
1661
  }
1666
1662
  ],
1667
1663
  subLanguage: "xml",
1668
1664
  contains: [
1669
1665
  {
1670
- begin: o.begin,
1671
- end: o.end,
1666
+ begin: S.begin,
1667
+ end: S.end,
1672
1668
  skip: !0,
1673
1669
  contains: ["self"]
1674
1670
  }
@@ -1676,7 +1672,7 @@ function ln(e) {
1676
1672
  }
1677
1673
  ]
1678
1674
  },
1679
- ee,
1675
+ be,
1680
1676
  {
1681
1677
  // prevent this from getting swallowed up by function
1682
1678
  // since they appear "function like"
@@ -1686,13 +1682,13 @@ function ln(e) {
1686
1682
  // we have to count the parens to make sure we actually have the correct
1687
1683
  // bounding ( ). There could be any number of sub-expressions inside
1688
1684
  // also surrounded by parens.
1689
- begin: "\\b(?!function)" + e.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
1685
+ begin: "\\b(?!function)" + i.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
1690
1686
  // end parens
1691
1687
  returnBegin: !0,
1692
1688
  label: "func.def",
1693
1689
  contains: [
1694
- P,
1695
- e.inherit(e.TITLE_MODE, { begin: i, className: "title.function" })
1690
+ q,
1691
+ i.inherit(i.TITLE_MODE, { begin: g, className: "title.function" })
1696
1692
  ]
1697
1693
  },
1698
1694
  // catch ... so it won't trigger the property rule below
@@ -1700,23 +1696,23 @@ function ln(e) {
1700
1696
  match: /\.\.\./,
1701
1697
  relevance: 0
1702
1698
  },
1703
- he,
1699
+ V,
1704
1700
  // hack: prevents detection of keywords in some circumstances
1705
1701
  // .keyword()
1706
1702
  // $keyword = x
1707
1703
  {
1708
- match: "\\$" + i,
1704
+ match: "\\$" + g,
1709
1705
  relevance: 0
1710
1706
  },
1711
1707
  {
1712
1708
  match: [/\bconstructor(?=\s*\()/],
1713
1709
  className: { 1: "title.function" },
1714
- contains: [P]
1710
+ contains: [q]
1715
1711
  },
1712
+ Re,
1713
+ me,
1716
1714
  pe,
1717
- te,
1718
- ge,
1719
- G,
1715
+ Ce,
1720
1716
  {
1721
1717
  match: /\$[(.]/
1722
1718
  // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
@@ -1724,8 +1720,8 @@ function ln(e) {
1724
1720
  ]
1725
1721
  };
1726
1722
  }
1727
- function dn(e) {
1728
- const t = ln(e), n = le, i = [
1723
+ function un(i) {
1724
+ const s = i.regex, c = dn(i), g = Ae, E = [
1729
1725
  "any",
1730
1726
  "void",
1731
1727
  "number",
@@ -1736,27 +1732,32 @@ function dn(e) {
1736
1732
  "symbol",
1737
1733
  "bigint",
1738
1734
  "unknown"
1739
- ], u = {
1740
- beginKeywords: "namespace",
1741
- end: /\{/,
1742
- excludeEnd: !0,
1743
- contains: [t.exports.CLASS_REFERENCE]
1744
- }, f = {
1735
+ ], w = {
1736
+ begin: [
1737
+ /namespace/,
1738
+ /\s+/,
1739
+ i.IDENT_RE
1740
+ ],
1741
+ beginScope: {
1742
+ 1: "keyword",
1743
+ 3: "title.class"
1744
+ }
1745
+ }, S = {
1745
1746
  beginKeywords: "interface",
1746
1747
  end: /\{/,
1747
1748
  excludeEnd: !0,
1748
1749
  keywords: {
1749
1750
  keyword: "interface extends",
1750
- built_in: i
1751
+ built_in: E
1751
1752
  },
1752
- contains: [t.exports.CLASS_REFERENCE]
1753
- }, o = {
1753
+ contains: [c.exports.CLASS_REFERENCE]
1754
+ }, M = {
1754
1755
  className: "meta",
1755
1756
  relevance: 10,
1756
1757
  begin: /^\s*['"]use strict['"]/
1757
- }, s = [
1758
+ }, D = [
1758
1759
  "type",
1759
- "namespace",
1760
+ // "namespace",
1760
1761
  "interface",
1761
1762
  "public",
1762
1763
  "private",
@@ -1766,29 +1767,45 @@ function dn(e) {
1766
1767
  "abstract",
1767
1768
  "readonly",
1768
1769
  "enum",
1769
- "override"
1770
- ], l = {
1771
- $pattern: le,
1772
- keyword: Ye.concat(s),
1773
- literal: qe,
1774
- built_in: tt.concat(i),
1775
- "variable.language": et
1776
- }, b = {
1770
+ "override",
1771
+ "satisfies"
1772
+ ], T = {
1773
+ $pattern: Ae,
1774
+ keyword: ot.concat(D),
1775
+ literal: st,
1776
+ built_in: ut.concat(E),
1777
+ "variable.language": dt
1778
+ }, Z = {
1777
1779
  className: "meta",
1778
- begin: "@" + n
1779
- }, m = (w, L, H) => {
1780
- const C = w.contains.findIndex(($) => $.label === L);
1781
- if (C === -1)
1780
+ begin: "@" + g
1781
+ }, j = (R, ne, ie) => {
1782
+ const G = R.contains.findIndex((re) => re.label === ne);
1783
+ if (G === -1)
1782
1784
  throw new Error("can not find mode to replace");
1783
- w.contains.splice(C, 1, H);
1785
+ R.contains.splice(G, 1, ie);
1784
1786
  };
1785
- Object.assign(t.keywords, l), t.exports.PARAMS_CONTAINS.push(b), t.contains = t.contains.concat([
1786
- b,
1787
- u,
1788
- f
1789
- ]), m(t, "shebang", e.SHEBANG()), m(t, "use_strict", o);
1790
- const A = t.contains.find((w) => w.label === "func.def");
1791
- return A.relevance = 0, Object.assign(t, {
1787
+ Object.assign(c.keywords, T), c.exports.PARAMS_CONTAINS.push(Z);
1788
+ const P = c.contains.find((R) => R.scope === "attr"), X = Object.assign(
1789
+ {},
1790
+ P,
1791
+ { match: s.concat(g, s.lookahead(/\s*\?:/)) }
1792
+ );
1793
+ c.exports.PARAMS_CONTAINS.push([
1794
+ c.exports.CLASS_REFERENCE,
1795
+ // class reference for highlighting the params types
1796
+ P,
1797
+ // highlight the params key
1798
+ X
1799
+ // Added for optional property assignment highlighting
1800
+ ]), c.contains = c.contains.concat([
1801
+ Z,
1802
+ w,
1803
+ S,
1804
+ X
1805
+ // Added for optional property assignment highlighting
1806
+ ]), j(c, "shebang", i.SHEBANG()), j(c, "use_strict", M);
1807
+ const te = c.contains.find((R) => R.label === "func.def");
1808
+ return te.relevance = 0, Object.assign(c, {
1792
1809
  name: "TypeScript",
1793
1810
  aliases: [
1794
1811
  "ts",
@@ -1796,13 +1813,13 @@ function dn(e) {
1796
1813
  "mts",
1797
1814
  "cts"
1798
1815
  ]
1799
- }), t;
1816
+ }), c;
1800
1817
  }
1801
- function un(e) {
1802
- const t = e.regex, n = t.concat(/[\p{L}_]/u, t.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), i = /[\p{L}0-9._:-]+/u, u = {
1818
+ function gn(i) {
1819
+ const s = i.regex, c = s.concat(/[\p{L}_]/u, s.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), g = /[\p{L}0-9._:-]+/u, E = {
1803
1820
  className: "symbol",
1804
1821
  begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
1805
- }, f = {
1822
+ }, w = {
1806
1823
  begin: /\s/,
1807
1824
  contains: [
1808
1825
  {
@@ -1811,17 +1828,17 @@ function un(e) {
1811
1828
  illegal: /\n/
1812
1829
  }
1813
1830
  ]
1814
- }, o = e.inherit(f, {
1831
+ }, S = i.inherit(w, {
1815
1832
  begin: /\(/,
1816
1833
  end: /\)/
1817
- }), s = e.inherit(e.APOS_STRING_MODE, { className: "string" }), l = e.inherit(e.QUOTE_STRING_MODE, { className: "string" }), b = {
1834
+ }), M = i.inherit(i.APOS_STRING_MODE, { className: "string" }), D = i.inherit(i.QUOTE_STRING_MODE, { className: "string" }), T = {
1818
1835
  endsWithParent: !0,
1819
1836
  illegal: /</,
1820
1837
  relevance: 0,
1821
1838
  contains: [
1822
1839
  {
1823
1840
  className: "attr",
1824
- begin: i,
1841
+ begin: g,
1825
1842
  relevance: 0
1826
1843
  },
1827
1844
  {
@@ -1835,12 +1852,12 @@ function un(e) {
1835
1852
  {
1836
1853
  begin: /"/,
1837
1854
  end: /"/,
1838
- contains: [u]
1855
+ contains: [E]
1839
1856
  },
1840
1857
  {
1841
1858
  begin: /'/,
1842
1859
  end: /'/,
1843
- contains: [u]
1860
+ contains: [E]
1844
1861
  },
1845
1862
  { begin: /[^\s"'=<>`]+/ }
1846
1863
  ]
@@ -1872,10 +1889,10 @@ function un(e) {
1872
1889
  end: />/,
1873
1890
  relevance: 10,
1874
1891
  contains: [
1875
- f,
1876
- l,
1877
- s,
1878
- o,
1892
+ w,
1893
+ D,
1894
+ M,
1895
+ S,
1879
1896
  {
1880
1897
  begin: /\[/,
1881
1898
  end: /\]/,
@@ -1885,17 +1902,17 @@ function un(e) {
1885
1902
  begin: /<![a-z]/,
1886
1903
  end: />/,
1887
1904
  contains: [
1888
- f,
1889
- o,
1890
- l,
1891
- s
1905
+ w,
1906
+ S,
1907
+ D,
1908
+ M
1892
1909
  ]
1893
1910
  }
1894
1911
  ]
1895
1912
  }
1896
1913
  ]
1897
1914
  },
1898
- e.COMMENT(
1915
+ i.COMMENT(
1899
1916
  /<!--/,
1900
1917
  /-->/,
1901
1918
  { relevance: 10 }
@@ -1905,7 +1922,7 @@ function un(e) {
1905
1922
  end: /\]\]>/,
1906
1923
  relevance: 10
1907
1924
  },
1908
- u,
1925
+ E,
1909
1926
  // xml processing instructions
1910
1927
  {
1911
1928
  className: "meta",
@@ -1915,7 +1932,7 @@ function un(e) {
1915
1932
  begin: /<\?xml/,
1916
1933
  relevance: 10,
1917
1934
  contains: [
1918
- l
1935
+ D
1919
1936
  ]
1920
1937
  },
1921
1938
  {
@@ -1933,7 +1950,7 @@ function un(e) {
1933
1950
  begin: /<style(?=\s|>)/,
1934
1951
  end: />/,
1935
1952
  keywords: { name: "style" },
1936
- contains: [b],
1953
+ contains: [T],
1937
1954
  starts: {
1938
1955
  end: /<\/style>/,
1939
1956
  returnEnd: !0,
@@ -1949,7 +1966,7 @@ function un(e) {
1949
1966
  begin: /<script(?=\s|>)/,
1950
1967
  end: />/,
1951
1968
  keywords: { name: "script" },
1952
- contains: [b],
1969
+ contains: [T],
1953
1970
  starts: {
1954
1971
  end: /<\/script>/,
1955
1972
  returnEnd: !0,
@@ -1968,40 +1985,40 @@ function un(e) {
1968
1985
  // open tag
1969
1986
  {
1970
1987
  className: "tag",
1971
- begin: t.concat(
1988
+ begin: s.concat(
1972
1989
  /</,
1973
- t.lookahead(t.concat(
1974
- n,
1990
+ s.lookahead(s.concat(
1991
+ c,
1975
1992
  // <tag/>
1976
1993
  // <tag>
1977
1994
  // <tag ...
1978
- t.either(/\/>/, />/, /\s/)
1995
+ s.either(/\/>/, />/, /\s/)
1979
1996
  ))
1980
1997
  ),
1981
1998
  end: /\/?>/,
1982
1999
  contains: [
1983
2000
  {
1984
2001
  className: "name",
1985
- begin: n,
2002
+ begin: c,
1986
2003
  relevance: 0,
1987
- starts: b
2004
+ starts: T
1988
2005
  }
1989
2006
  ]
1990
2007
  },
1991
2008
  // close tag
1992
2009
  {
1993
2010
  className: "tag",
1994
- begin: t.concat(
2011
+ begin: s.concat(
1995
2012
  /<\//,
1996
- t.lookahead(t.concat(
1997
- n,
2013
+ s.lookahead(s.concat(
2014
+ c,
1998
2015
  />/
1999
2016
  ))
2000
2017
  ),
2001
2018
  contains: [
2002
2019
  {
2003
2020
  className: "name",
2004
- begin: n,
2021
+ begin: c,
2005
2022
  relevance: 0
2006
2023
  },
2007
2024
  {
@@ -2014,12 +2031,12 @@ function un(e) {
2014
2031
  ]
2015
2032
  };
2016
2033
  }
2017
- const gn = (e) => ({
2034
+ const fn = (i) => ({
2018
2035
  IMPORTANT: {
2019
2036
  scope: "meta",
2020
2037
  begin: "!important"
2021
2038
  },
2022
- BLOCK_COMMENT: e.C_BLOCK_COMMENT_MODE,
2039
+ BLOCK_COMMENT: i.C_BLOCK_COMMENT_MODE,
2023
2040
  HEXCOLOR: {
2024
2041
  scope: "number",
2025
2042
  begin: /#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/
@@ -2034,20 +2051,20 @@ const gn = (e) => ({
2034
2051
  end: /\]/,
2035
2052
  illegal: "$",
2036
2053
  contains: [
2037
- e.APOS_STRING_MODE,
2038
- e.QUOTE_STRING_MODE
2054
+ i.APOS_STRING_MODE,
2055
+ i.QUOTE_STRING_MODE
2039
2056
  ]
2040
2057
  },
2041
2058
  CSS_NUMBER_MODE: {
2042
2059
  scope: "number",
2043
- begin: e.NUMBER_RE + "(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",
2060
+ begin: i.NUMBER_RE + "(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",
2044
2061
  relevance: 0
2045
2062
  },
2046
2063
  CSS_VARIABLE: {
2047
2064
  className: "attr",
2048
2065
  begin: /--[A-Za-z_][A-Za-z0-9_-]*/
2049
2066
  }
2050
- }), fn = [
2067
+ }), pn = [
2051
2068
  "a",
2052
2069
  "abbr",
2053
2070
  "address",
@@ -2099,11 +2116,16 @@ const gn = (e) => ({
2099
2116
  "nav",
2100
2117
  "object",
2101
2118
  "ol",
2119
+ "optgroup",
2120
+ "option",
2102
2121
  "p",
2122
+ "picture",
2103
2123
  "q",
2104
2124
  "quote",
2105
2125
  "samp",
2106
2126
  "section",
2127
+ "select",
2128
+ "source",
2107
2129
  "span",
2108
2130
  "strong",
2109
2131
  "summary",
@@ -2120,7 +2142,52 @@ const gn = (e) => ({
2120
2142
  "ul",
2121
2143
  "var",
2122
2144
  "video"
2123
- ], pn = [
2145
+ ], hn = [
2146
+ "defs",
2147
+ "g",
2148
+ "marker",
2149
+ "mask",
2150
+ "pattern",
2151
+ "svg",
2152
+ "switch",
2153
+ "symbol",
2154
+ "feBlend",
2155
+ "feColorMatrix",
2156
+ "feComponentTransfer",
2157
+ "feComposite",
2158
+ "feConvolveMatrix",
2159
+ "feDiffuseLighting",
2160
+ "feDisplacementMap",
2161
+ "feFlood",
2162
+ "feGaussianBlur",
2163
+ "feImage",
2164
+ "feMerge",
2165
+ "feMorphology",
2166
+ "feOffset",
2167
+ "feSpecularLighting",
2168
+ "feTile",
2169
+ "feTurbulence",
2170
+ "linearGradient",
2171
+ "radialGradient",
2172
+ "stop",
2173
+ "circle",
2174
+ "ellipse",
2175
+ "image",
2176
+ "line",
2177
+ "path",
2178
+ "polygon",
2179
+ "polyline",
2180
+ "rect",
2181
+ "text",
2182
+ "use",
2183
+ "textPath",
2184
+ "tspan",
2185
+ "foreignObject",
2186
+ "clipPath"
2187
+ ], bn = [
2188
+ ...pn,
2189
+ ...hn
2190
+ ], mn = [
2124
2191
  "any-hover",
2125
2192
  "any-pointer",
2126
2193
  "aspect-ratio",
@@ -2155,7 +2222,7 @@ const gn = (e) => ({
2155
2222
  "max-width",
2156
2223
  "min-height",
2157
2224
  "max-height"
2158
- ], hn = [
2225
+ ].sort().reverse(), En = [
2159
2226
  "active",
2160
2227
  "any-link",
2161
2228
  "blank",
@@ -2229,7 +2296,7 @@ const gn = (e) => ({
2229
2296
  "visited",
2230
2297
  "where"
2231
2298
  // where()
2232
- ], bn = [
2299
+ ].sort().reverse(), _n = [
2233
2300
  "after",
2234
2301
  "backdrop",
2235
2302
  "before",
@@ -2244,12 +2311,16 @@ const gn = (e) => ({
2244
2311
  "selection",
2245
2312
  "slotted",
2246
2313
  "spelling-error"
2247
- ], En = [
2314
+ ].sort().reverse(), yn = [
2315
+ "accent-color",
2248
2316
  "align-content",
2249
2317
  "align-items",
2250
2318
  "align-self",
2319
+ "alignment-baseline",
2251
2320
  "all",
2321
+ "anchor-name",
2252
2322
  "animation",
2323
+ "animation-composition",
2253
2324
  "animation-delay",
2254
2325
  "animation-direction",
2255
2326
  "animation-duration",
@@ -2257,7 +2328,14 @@ const gn = (e) => ({
2257
2328
  "animation-iteration-count",
2258
2329
  "animation-name",
2259
2330
  "animation-play-state",
2331
+ "animation-range",
2332
+ "animation-range-end",
2333
+ "animation-range-start",
2334
+ "animation-timeline",
2260
2335
  "animation-timing-function",
2336
+ "appearance",
2337
+ "aspect-ratio",
2338
+ "backdrop-filter",
2261
2339
  "backface-visibility",
2262
2340
  "background",
2263
2341
  "background-attachment",
@@ -2267,8 +2345,11 @@ const gn = (e) => ({
2267
2345
  "background-image",
2268
2346
  "background-origin",
2269
2347
  "background-position",
2348
+ "background-position-x",
2349
+ "background-position-y",
2270
2350
  "background-repeat",
2271
2351
  "background-size",
2352
+ "baseline-shift",
2272
2353
  "block-size",
2273
2354
  "border",
2274
2355
  "border-block",
@@ -2291,6 +2372,8 @@ const gn = (e) => ({
2291
2372
  "border-bottom-width",
2292
2373
  "border-collapse",
2293
2374
  "border-color",
2375
+ "border-end-end-radius",
2376
+ "border-end-start-radius",
2294
2377
  "border-image",
2295
2378
  "border-image-outset",
2296
2379
  "border-image-repeat",
@@ -2319,6 +2402,8 @@ const gn = (e) => ({
2319
2402
  "border-right-style",
2320
2403
  "border-right-width",
2321
2404
  "border-spacing",
2405
+ "border-start-end-radius",
2406
+ "border-start-start-radius",
2322
2407
  "border-style",
2323
2408
  "border-top",
2324
2409
  "border-top-color",
@@ -2328,7 +2413,15 @@ const gn = (e) => ({
2328
2413
  "border-top-width",
2329
2414
  "border-width",
2330
2415
  "bottom",
2416
+ "box-align",
2331
2417
  "box-decoration-break",
2418
+ "box-direction",
2419
+ "box-flex",
2420
+ "box-flex-group",
2421
+ "box-lines",
2422
+ "box-ordinal-group",
2423
+ "box-orient",
2424
+ "box-pack",
2332
2425
  "box-shadow",
2333
2426
  "box-sizing",
2334
2427
  "break-after",
@@ -2341,6 +2434,11 @@ const gn = (e) => ({
2341
2434
  "clip-path",
2342
2435
  "clip-rule",
2343
2436
  "color",
2437
+ "color-interpolation",
2438
+ "color-interpolation-filters",
2439
+ "color-profile",
2440
+ "color-rendering",
2441
+ "color-scheme",
2344
2442
  "column-count",
2345
2443
  "column-fill",
2346
2444
  "column-gap",
@@ -2352,17 +2450,34 @@ const gn = (e) => ({
2352
2450
  "column-width",
2353
2451
  "columns",
2354
2452
  "contain",
2453
+ "contain-intrinsic-block-size",
2454
+ "contain-intrinsic-height",
2455
+ "contain-intrinsic-inline-size",
2456
+ "contain-intrinsic-size",
2457
+ "contain-intrinsic-width",
2458
+ "container",
2459
+ "container-name",
2460
+ "container-type",
2355
2461
  "content",
2356
2462
  "content-visibility",
2357
2463
  "counter-increment",
2358
2464
  "counter-reset",
2465
+ "counter-set",
2359
2466
  "cue",
2360
2467
  "cue-after",
2361
2468
  "cue-before",
2362
2469
  "cursor",
2470
+ "cx",
2471
+ "cy",
2363
2472
  "direction",
2364
2473
  "display",
2474
+ "dominant-baseline",
2365
2475
  "empty-cells",
2476
+ "enable-background",
2477
+ "field-sizing",
2478
+ "fill",
2479
+ "fill-opacity",
2480
+ "fill-rule",
2366
2481
  "filter",
2367
2482
  "flex",
2368
2483
  "flex-basis",
@@ -2372,6 +2487,8 @@ const gn = (e) => ({
2372
2487
  "flex-shrink",
2373
2488
  "flex-wrap",
2374
2489
  "float",
2490
+ "flood-color",
2491
+ "flood-opacity",
2375
2492
  "flow",
2376
2493
  "font",
2377
2494
  "font-display",
@@ -2379,21 +2496,32 @@ const gn = (e) => ({
2379
2496
  "font-feature-settings",
2380
2497
  "font-kerning",
2381
2498
  "font-language-override",
2499
+ "font-optical-sizing",
2500
+ "font-palette",
2382
2501
  "font-size",
2383
2502
  "font-size-adjust",
2503
+ "font-smooth",
2384
2504
  "font-smoothing",
2385
2505
  "font-stretch",
2386
2506
  "font-style",
2387
2507
  "font-synthesis",
2508
+ "font-synthesis-position",
2509
+ "font-synthesis-small-caps",
2510
+ "font-synthesis-style",
2511
+ "font-synthesis-weight",
2388
2512
  "font-variant",
2513
+ "font-variant-alternates",
2389
2514
  "font-variant-caps",
2390
2515
  "font-variant-east-asian",
2516
+ "font-variant-emoji",
2391
2517
  "font-variant-ligatures",
2392
2518
  "font-variant-numeric",
2393
2519
  "font-variant-position",
2394
2520
  "font-variation-settings",
2395
2521
  "font-weight",
2522
+ "forced-color-adjust",
2396
2523
  "gap",
2524
+ "glyph-orientation-horizontal",
2397
2525
  "glyph-orientation-vertical",
2398
2526
  "grid",
2399
2527
  "grid-area",
@@ -2413,19 +2541,36 @@ const gn = (e) => ({
2413
2541
  "grid-template-rows",
2414
2542
  "hanging-punctuation",
2415
2543
  "height",
2544
+ "hyphenate-character",
2545
+ "hyphenate-limit-chars",
2416
2546
  "hyphens",
2417
2547
  "icon",
2418
2548
  "image-orientation",
2419
2549
  "image-rendering",
2420
2550
  "image-resolution",
2421
2551
  "ime-mode",
2552
+ "initial-letter",
2553
+ "initial-letter-align",
2422
2554
  "inline-size",
2555
+ "inset",
2556
+ "inset-area",
2557
+ "inset-block",
2558
+ "inset-block-end",
2559
+ "inset-block-start",
2560
+ "inset-inline",
2561
+ "inset-inline-end",
2562
+ "inset-inline-start",
2423
2563
  "isolation",
2424
2564
  "justify-content",
2565
+ "justify-items",
2566
+ "justify-self",
2567
+ "kerning",
2425
2568
  "left",
2426
2569
  "letter-spacing",
2570
+ "lighting-color",
2427
2571
  "line-break",
2428
2572
  "line-height",
2573
+ "line-height-step",
2429
2574
  "list-style",
2430
2575
  "list-style-image",
2431
2576
  "list-style-position",
@@ -2441,6 +2586,11 @@ const gn = (e) => ({
2441
2586
  "margin-left",
2442
2587
  "margin-right",
2443
2588
  "margin-top",
2589
+ "margin-trim",
2590
+ "marker",
2591
+ "marker-end",
2592
+ "marker-mid",
2593
+ "marker-start",
2444
2594
  "marks",
2445
2595
  "mask",
2446
2596
  "mask-border",
@@ -2459,6 +2609,10 @@ const gn = (e) => ({
2459
2609
  "mask-repeat",
2460
2610
  "mask-size",
2461
2611
  "mask-type",
2612
+ "masonry-auto-flow",
2613
+ "math-depth",
2614
+ "math-shift",
2615
+ "math-style",
2462
2616
  "max-block-size",
2463
2617
  "max-height",
2464
2618
  "max-inline-size",
@@ -2477,6 +2631,12 @@ const gn = (e) => ({
2477
2631
  "normal",
2478
2632
  "object-fit",
2479
2633
  "object-position",
2634
+ "offset",
2635
+ "offset-anchor",
2636
+ "offset-distance",
2637
+ "offset-path",
2638
+ "offset-position",
2639
+ "offset-rotate",
2480
2640
  "opacity",
2481
2641
  "order",
2482
2642
  "orphans",
@@ -2486,9 +2646,19 @@ const gn = (e) => ({
2486
2646
  "outline-style",
2487
2647
  "outline-width",
2488
2648
  "overflow",
2649
+ "overflow-anchor",
2650
+ "overflow-block",
2651
+ "overflow-clip-margin",
2652
+ "overflow-inline",
2489
2653
  "overflow-wrap",
2490
2654
  "overflow-x",
2491
2655
  "overflow-y",
2656
+ "overlay",
2657
+ "overscroll-behavior",
2658
+ "overscroll-behavior-block",
2659
+ "overscroll-behavior-inline",
2660
+ "overscroll-behavior-x",
2661
+ "overscroll-behavior-y",
2492
2662
  "padding",
2493
2663
  "padding-block",
2494
2664
  "padding-block-end",
@@ -2500,23 +2670,37 @@ const gn = (e) => ({
2500
2670
  "padding-left",
2501
2671
  "padding-right",
2502
2672
  "padding-top",
2673
+ "page",
2503
2674
  "page-break-after",
2504
2675
  "page-break-before",
2505
2676
  "page-break-inside",
2677
+ "paint-order",
2506
2678
  "pause",
2507
2679
  "pause-after",
2508
2680
  "pause-before",
2509
2681
  "perspective",
2510
2682
  "perspective-origin",
2683
+ "place-content",
2684
+ "place-items",
2685
+ "place-self",
2511
2686
  "pointer-events",
2512
2687
  "position",
2688
+ "position-anchor",
2689
+ "position-visibility",
2690
+ "print-color-adjust",
2513
2691
  "quotes",
2692
+ "r",
2514
2693
  "resize",
2515
2694
  "rest",
2516
2695
  "rest-after",
2517
2696
  "rest-before",
2518
2697
  "right",
2698
+ "rotate",
2519
2699
  "row-gap",
2700
+ "ruby-align",
2701
+ "ruby-position",
2702
+ "scale",
2703
+ "scroll-behavior",
2520
2704
  "scroll-margin",
2521
2705
  "scroll-margin-block",
2522
2706
  "scroll-margin-block-end",
@@ -2542,26 +2726,44 @@ const gn = (e) => ({
2542
2726
  "scroll-snap-align",
2543
2727
  "scroll-snap-stop",
2544
2728
  "scroll-snap-type",
2729
+ "scroll-timeline",
2730
+ "scroll-timeline-axis",
2731
+ "scroll-timeline-name",
2545
2732
  "scrollbar-color",
2546
2733
  "scrollbar-gutter",
2547
2734
  "scrollbar-width",
2548
2735
  "shape-image-threshold",
2549
2736
  "shape-margin",
2550
2737
  "shape-outside",
2738
+ "shape-rendering",
2551
2739
  "speak",
2552
2740
  "speak-as",
2553
2741
  "src",
2554
2742
  // @font-face
2743
+ "stop-color",
2744
+ "stop-opacity",
2745
+ "stroke",
2746
+ "stroke-dasharray",
2747
+ "stroke-dashoffset",
2748
+ "stroke-linecap",
2749
+ "stroke-linejoin",
2750
+ "stroke-miterlimit",
2751
+ "stroke-opacity",
2752
+ "stroke-width",
2555
2753
  "tab-size",
2556
2754
  "table-layout",
2557
2755
  "text-align",
2558
2756
  "text-align-all",
2559
2757
  "text-align-last",
2758
+ "text-anchor",
2560
2759
  "text-combine-upright",
2561
2760
  "text-decoration",
2562
2761
  "text-decoration-color",
2563
2762
  "text-decoration-line",
2763
+ "text-decoration-skip",
2764
+ "text-decoration-skip-ink",
2564
2765
  "text-decoration-style",
2766
+ "text-decoration-thickness",
2565
2767
  "text-emphasis",
2566
2768
  "text-emphasis-color",
2567
2769
  "text-emphasis-position",
@@ -2572,20 +2774,37 @@ const gn = (e) => ({
2572
2774
  "text-overflow",
2573
2775
  "text-rendering",
2574
2776
  "text-shadow",
2777
+ "text-size-adjust",
2575
2778
  "text-transform",
2779
+ "text-underline-offset",
2576
2780
  "text-underline-position",
2781
+ "text-wrap",
2782
+ "text-wrap-mode",
2783
+ "text-wrap-style",
2784
+ "timeline-scope",
2577
2785
  "top",
2786
+ "touch-action",
2578
2787
  "transform",
2579
2788
  "transform-box",
2580
2789
  "transform-origin",
2581
2790
  "transform-style",
2582
2791
  "transition",
2792
+ "transition-behavior",
2583
2793
  "transition-delay",
2584
2794
  "transition-duration",
2585
2795
  "transition-property",
2586
2796
  "transition-timing-function",
2797
+ "translate",
2587
2798
  "unicode-bidi",
2799
+ "user-modify",
2800
+ "user-select",
2801
+ "vector-effect",
2588
2802
  "vertical-align",
2803
+ "view-timeline",
2804
+ "view-timeline-axis",
2805
+ "view-timeline-inset",
2806
+ "view-timeline-name",
2807
+ "view-transition-name",
2589
2808
  "visibility",
2590
2809
  "voice-balance",
2591
2810
  "voice-duration",
@@ -2596,6 +2815,7 @@ const gn = (e) => ({
2596
2815
  "voice-stress",
2597
2816
  "voice-volume",
2598
2817
  "white-space",
2818
+ "white-space-collapse",
2599
2819
  "widows",
2600
2820
  "width",
2601
2821
  "will-change",
@@ -2603,14 +2823,15 @@ const gn = (e) => ({
2603
2823
  "word-spacing",
2604
2824
  "word-wrap",
2605
2825
  "writing-mode",
2606
- "z-index"
2607
- // reverse makes sure longer attributes `font-weight` are matched fully
2608
- // instead of getting false positives on say `font`
2609
- ].reverse();
2610
- function mn(e) {
2611
- const t = e.regex, n = gn(e), i = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, u = "and or not only", f = /@-?\w[\w]*(-\w+)*/, o = "[a-zA-Z-][a-zA-Z0-9_-]*", s = [
2612
- e.APOS_STRING_MODE,
2613
- e.QUOTE_STRING_MODE
2826
+ "x",
2827
+ "y",
2828
+ "z-index",
2829
+ "zoom"
2830
+ ].sort().reverse();
2831
+ function xn(i) {
2832
+ const s = i.regex, c = fn(i), g = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, E = "and or not only", w = /@-?\w[\w]*(-\w+)*/, S = "[a-zA-Z-][a-zA-Z0-9_-]*", M = [
2833
+ i.APOS_STRING_MODE,
2834
+ i.QUOTE_STRING_MODE
2614
2835
  ];
2615
2836
  return {
2616
2837
  name: "CSS",
@@ -2623,11 +2844,11 @@ function mn(e) {
2623
2844
  keyframePosition: "selector-tag"
2624
2845
  },
2625
2846
  contains: [
2626
- n.BLOCK_COMMENT,
2627
- i,
2847
+ c.BLOCK_COMMENT,
2848
+ g,
2628
2849
  // to recognize keyframe 40% etc which are outside the scope of our
2629
2850
  // attribute value mode
2630
- n.CSS_NUMBER_MODE,
2851
+ c.CSS_NUMBER_MODE,
2631
2852
  {
2632
2853
  className: "selector-id",
2633
2854
  begin: /#[A-Za-z0-9_-]+/,
@@ -2635,15 +2856,15 @@ function mn(e) {
2635
2856
  },
2636
2857
  {
2637
2858
  className: "selector-class",
2638
- begin: "\\." + o,
2859
+ begin: "\\." + S,
2639
2860
  relevance: 0
2640
2861
  },
2641
- n.ATTRIBUTE_SELECTOR_MODE,
2862
+ c.ATTRIBUTE_SELECTOR_MODE,
2642
2863
  {
2643
2864
  className: "selector-pseudo",
2644
2865
  variants: [
2645
- { begin: ":(" + hn.join("|") + ")" },
2646
- { begin: ":(:)?(" + bn.join("|") + ")" }
2866
+ { begin: ":(" + En.join("|") + ")" },
2867
+ { begin: ":(:)?(" + _n.join("|") + ")" }
2647
2868
  ]
2648
2869
  },
2649
2870
  // we may actually need this (12/2020)
@@ -2652,21 +2873,21 @@ function mn(e) {
2652
2873
  // end: /\)/,
2653
2874
  // contains: [ hljs.CSS_NUMBER_MODE ]
2654
2875
  // },
2655
- n.CSS_VARIABLE,
2876
+ c.CSS_VARIABLE,
2656
2877
  {
2657
2878
  className: "attribute",
2658
- begin: "\\b(" + En.join("|") + ")\\b"
2879
+ begin: "\\b(" + yn.join("|") + ")\\b"
2659
2880
  },
2660
2881
  // attribute values
2661
2882
  {
2662
2883
  begin: /:/,
2663
2884
  end: /[;}{]/,
2664
2885
  contains: [
2665
- n.BLOCK_COMMENT,
2666
- n.HEXCOLOR,
2667
- n.IMPORTANT,
2668
- n.CSS_NUMBER_MODE,
2669
- ...s,
2886
+ c.BLOCK_COMMENT,
2887
+ c.HEXCOLOR,
2888
+ c.IMPORTANT,
2889
+ c.CSS_NUMBER_MODE,
2890
+ ...M,
2670
2891
  // needed to highlight these as strings and to avoid issues with
2671
2892
  // illegal characters that might be inside urls that would tigger the
2672
2893
  // languages illegal stack
@@ -2677,7 +2898,7 @@ function mn(e) {
2677
2898
  // from keywords
2678
2899
  keywords: { built_in: "url data-uri" },
2679
2900
  contains: [
2680
- ...s,
2901
+ ...M,
2681
2902
  {
2682
2903
  className: "string",
2683
2904
  // any character other than `)` as in `url()` will be the start
@@ -2688,11 +2909,11 @@ function mn(e) {
2688
2909
  }
2689
2910
  ]
2690
2911
  },
2691
- n.FUNCTION_DISPATCH
2912
+ c.FUNCTION_DISPATCH
2692
2913
  ]
2693
2914
  },
2694
2915
  {
2695
- begin: t.lookahead(/@/),
2916
+ begin: s.lookahead(/@/),
2696
2917
  end: "[{;]",
2697
2918
  relevance: 0,
2698
2919
  illegal: /:/,
@@ -2700,7 +2921,7 @@ function mn(e) {
2700
2921
  contains: [
2701
2922
  {
2702
2923
  className: "keyword",
2703
- begin: f
2924
+ begin: w
2704
2925
  },
2705
2926
  {
2706
2927
  begin: /\s/,
@@ -2709,112 +2930,111 @@ function mn(e) {
2709
2930
  relevance: 0,
2710
2931
  keywords: {
2711
2932
  $pattern: /[a-z-]+/,
2712
- keyword: u,
2713
- attribute: pn.join(" ")
2933
+ keyword: E,
2934
+ attribute: mn.join(" ")
2714
2935
  },
2715
2936
  contains: [
2716
2937
  {
2717
2938
  begin: /[a-z-]+(?=:)/,
2718
2939
  className: "attribute"
2719
2940
  },
2720
- ...s,
2721
- n.CSS_NUMBER_MODE
2941
+ ...M,
2942
+ c.CSS_NUMBER_MODE
2722
2943
  ]
2723
2944
  }
2724
2945
  ]
2725
2946
  },
2726
2947
  {
2727
2948
  className: "selector-tag",
2728
- begin: "\\b(" + fn.join("|") + ")\\b"
2949
+ begin: "\\b(" + bn.join("|") + ")\\b"
2729
2950
  }
2730
2951
  ]
2731
2952
  };
2732
2953
  }
2733
- const nt = document.createElement("style");
2734
- nt.innerText = [gt, ft].join(`
2954
+ const gt = document.createElement("style");
2955
+ gt.innerText = [on, sn].join(`
2735
2956
  `);
2736
- document.head.appendChild(nt);
2737
- ue.registerLanguage("typescript", dn);
2738
- ue.registerLanguage("html", un);
2739
- ue.registerLanguage("css", mn);
2740
- function _n(...e) {
2741
- const t = document.createElement("div"), n = document.createElement("div");
2742
- n.classList.add("tab-control");
2743
- const i = document.createElement("div");
2744
- return e.forEach((u) => {
2745
- t.appendChild(u), u.addEventListener("click", () => {
2746
- e.forEach((f) => f.removeAttribute("selected")), u.setAttribute("selected", ""), i.innerHTML = "", i.appendChild(u.content), i.className = u.className, i.classList.add("tab-content");
2957
+ document.head.appendChild(gt);
2958
+ Te.registerLanguage("typescript", un);
2959
+ Te.registerLanguage("html", gn);
2960
+ Te.registerLanguage("css", xn);
2961
+ function wn(...i) {
2962
+ const s = document.createElement("div"), c = document.createElement("div");
2963
+ c.classList.add("tab-control");
2964
+ const g = document.createElement("div");
2965
+ return i.forEach((E) => {
2966
+ s.appendChild(E), E.addEventListener("click", () => {
2967
+ i.forEach((w) => w.removeAttribute("selected")), E.setAttribute("selected", ""), g.innerHTML = "", g.appendChild(E.content), g.className = E.className, g.classList.add("tab-content");
2747
2968
  });
2748
- }), n.appendChild(t), n.appendChild(i), i.classList.add("tab-content"), e[0].setAttribute("selected", ""), i.appendChild(e[0].content), n;
2969
+ }), c.appendChild(s), c.appendChild(g), g.classList.add("tab-content"), i[0].setAttribute("selected", ""), g.appendChild(i[0].content), c;
2749
2970
  }
2750
- function Y(e, t) {
2751
- const n = document.createElement("div");
2752
- return n.role = "tab", n.tabIndex = 0, n.innerText = e, n.content = t, t.tagName == "PRE" && n.classList.add("code"), n;
2971
+ function ue(i, s) {
2972
+ const c = document.createElement("div");
2973
+ return c.role = "tab", c.tabIndex = 0, c.innerText = i, c.content = s, s.tagName == "PRE" && c.classList.add("code"), c;
2753
2974
  }
2754
- function q(e, t) {
2755
- const n = document.createElement(e);
2756
- return typeof t == "string" ? n.innerHTML = t : t.forEach((i) => {
2757
- n.appendChild(i);
2758
- }), n;
2975
+ function ge(i, s) {
2976
+ const c = document.createElement(i);
2977
+ return typeof s == "string" ? c.innerHTML = s : s.forEach((g) => {
2978
+ c.appendChild(g);
2979
+ }), c;
2759
2980
  }
2760
- async function yn(e, t, n) {
2761
- var b, m, A;
2762
- const i = t.mainContent, u = q("div", i);
2763
- u.id = `example-preview-${n}`;
2764
- const f = typeof t.css == "string" || (b = t.css) == null ? void 0 : b.label, o = typeof t.css == "string" ? t.css : (m = t.css) == null ? void 0 : m.content, s = _n(
2765
- Y("Preview", u),
2766
- Y("HTML", ae("html", i)),
2767
- ...o ? [Y(f ?? "CSS", ae("css", o))] : [],
2768
- ...t.initializer && t.initializer.content ? [
2769
- Y(
2770
- t.initializer.label ?? "TS",
2771
- ae("typescript", t.initializer.content)
2981
+ async function Sn(i, s, c) {
2982
+ const g = s.mainContent, E = ge("div", g);
2983
+ E.id = `example-preview-${c}`;
2984
+ const w = typeof s.css == "string" ? void 0 : s.css?.label, S = typeof s.css == "string" ? s.css : s.css?.content, M = wn(
2985
+ ue("Preview", E),
2986
+ ue("HTML", Me("html", g)),
2987
+ ...S ? [ue(w ?? "CSS", Me("css", S))] : [],
2988
+ ...s.initializer && s.initializer.content ? [
2989
+ ue(
2990
+ s.initializer.label ?? "TS",
2991
+ Me("typescript", s.initializer.content)
2772
2992
  )
2773
2993
  ] : [],
2774
- ...(t.additionalSources || []).map((w) => Y(w.label, ae(w.language, w.content)))
2994
+ ...(s.additionalSources || []).map((T) => ue(T.label, Me(T.language, T.content)))
2775
2995
  );
2776
- t.description && e.appendChild(q("div", t.description));
2777
- const l = q("div", [s]);
2778
- l.classList.add("example"), e.appendChild(l), o && xn(`#${u.id}`, o), (A = t.initializer) != null && A.initialize && await t.initializer.initialize(u);
2996
+ s.description && i.appendChild(ge("div", s.description));
2997
+ const D = ge("div", [M]);
2998
+ D.classList.add("example"), i.appendChild(D), S && Nn(`#${E.id}`, S), s.initializer?.initialize && await s.initializer.initialize(E);
2779
2999
  }
2780
- function ae(e, t) {
2781
- let n = t.split(/\r?\n/).map((i) => {
2782
- const u = i.indexOf("///");
2783
- if (u > -1) {
2784
- const f = i.substring(u + 3).trimStart();
2785
- return f ? i.replace(/^(\s*)([^\s].*)$/, `$1${f}`) : void 0;
2786
- }
2787
- return i;
2788
- }).filter((i) => typeof i < "u").join(`
3000
+ function Me(i, s) {
3001
+ let c = s.split(/\r?\n/).map((g) => {
3002
+ const E = g.indexOf("///");
3003
+ if (E > -1) {
3004
+ const w = g.substring(E + 3).trimStart();
3005
+ return w ? g.replace(/^(\s*)([^\s].*)$/, `$1${w}`) : void 0;
3006
+ }
3007
+ return g;
3008
+ }).filter((g) => typeof g < "u").join(`
2789
3009
  `).trim();
2790
- return e && e != "raw" && (n = ue.highlight(n, { language: e }).value), q("pre", [q("code", n)]);
3010
+ return i && i != "raw" && (c = Te.highlight(c, { language: i }).value), ge("pre", [ge("code", c)]);
2791
3011
  }
2792
- function xn(e, t) {
2793
- const n = document.createElement("style");
2794
- n.innerHTML = dt().use(ut({ prefix: e })).process(t).css, document.head.appendChild(n);
3012
+ function Nn(i, s) {
3013
+ const c = document.createElement("style");
3014
+ c.innerHTML = nn().use(rn({ prefix: i })).process(s).css, document.head.appendChild(c);
2795
3015
  }
2796
- async function An(e, t = document.body) {
2797
- const n = Nn(t);
2798
- let i = 0;
2799
- Object.keys(e).forEach(async (u) => {
2800
- const f = document.createElement("div");
2801
- f.className = "example-container", n.appendChild(f);
2802
- const o = e[u].default;
2803
- yn(f, o, i++);
3016
+ async function On(i, s = document.body) {
3017
+ const c = vn(s);
3018
+ let g = 0;
3019
+ Object.keys(i).sort().forEach(async (E) => {
3020
+ const w = document.createElement("div");
3021
+ w.className = "example-container", c.appendChild(w);
3022
+ const S = i[E].default;
3023
+ Sn(w, S, g++);
2804
3024
  });
2805
3025
  }
2806
- function wn(e) {
2807
- const t = document.createElement("div");
2808
- t.id = "examples-container";
2809
- const n = e.querySelector("#examples");
2810
- return n ? n.after(t) : e.appendChild(t), t;
3026
+ function kn(i) {
3027
+ const s = document.createElement("div");
3028
+ s.id = "examples-container";
3029
+ const c = i.querySelector("#examples");
3030
+ return c ? c.after(s) : i.appendChild(s), s;
2811
3031
  }
2812
- function Nn(e) {
2813
- return e.children ? wn(e) : e;
3032
+ function vn(i) {
3033
+ return i.children ? kn(i) : i;
2814
3034
  }
2815
3035
  export {
2816
- yn as initialize,
2817
- An as initializeExamplesForModules,
2818
- xn as loadPrefixedStylesheet
3036
+ Sn as initialize,
3037
+ On as initializeExamplesForModules,
3038
+ Nn as loadPrefixedStylesheet
2819
3039
  };
2820
3040
  //# sourceMappingURL=element-preview.mjs.map