@cas-smartdesign/element-preview 0.2.1

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.
@@ -0,0 +1,2820 @@
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;
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;
23
+ }
24
+ ignoreMatch() {
25
+ this.isMatchIgnored = !0;
26
+ }
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(" ");
50
+ }
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);
62
+ }
63
+ /**
64
+ * Adds texts to the output stream
65
+ *
66
+ * @param {string} text */
67
+ addText(t) {
68
+ this.buffer += je(t);
69
+ }
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);
82
+ }
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);
89
+ }
90
+ /**
91
+ * returns the accumulated buffer
92
+ */
93
+ value() {
94
+ return this.buffer;
95
+ }
96
+ // helpers
97
+ /**
98
+ * Builds a span element
99
+ *
100
+ * @param {string} className */
101
+ span(t) {
102
+ this.buffer += `<span class="${t}">`;
103
+ }
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];
112
+ }
113
+ get top() {
114
+ return this.stack[this.stack.length - 1];
115
+ }
116
+ get root() {
117
+ return this.rootNode;
118
+ }
119
+ /** @param {Node} node */
120
+ add(t) {
121
+ this.top.children.push(t);
122
+ }
123
+ /** @param {string} scope */
124
+ openNode(t) {
125
+ const n = Ce({ scope: t });
126
+ this.add(n), this.stack.push(n);
127
+ }
128
+ closeNode() {
129
+ if (this.stack.length > 1)
130
+ return this.stack.pop();
131
+ }
132
+ closeAllNodes() {
133
+ for (; this.closeNode(); )
134
+ ;
135
+ }
136
+ toJSON() {
137
+ return JSON.stringify(this.rootNode, null, 4);
138
+ }
139
+ /**
140
+ * @typedef { import("./html_renderer").Renderer } Renderer
141
+ * @param {Renderer} builder
142
+ */
143
+ walk(t) {
144
+ return this.constructor._walk(t, this.rootNode);
145
+ }
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;
152
+ }
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
+ }));
160
+ }
161
+ }
162
+ class mt extends ye {
163
+ /**
164
+ * @param {*} options
165
+ */
166
+ constructor(t) {
167
+ super(), this.options = t;
168
+ }
169
+ /**
170
+ * @param {string} text
171
+ */
172
+ addText(t) {
173
+ t !== "" && this.add(t);
174
+ }
175
+ /** @param {string} scope */
176
+ startScope(t) {
177
+ this.openNode(t);
178
+ }
179
+ endScope() {
180
+ this.closeNode();
181
+ }
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);
189
+ }
190
+ toHTML() {
191
+ return new Et(this, this.options).value();
192
+ }
193
+ finalize() {
194
+ return this.closeAllNodes(), !0;
195
+ }
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
+ }
393
+ }
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
+ }
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: "" });
517
+ }
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: "" });
526
+ }
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
+ );
540
+ }
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);
562
+ }
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);
593
+ }
594
+ return b && (this.regexIndex += b.position + 1, this.regexIndex === this.count && this.considerAll()), b;
595
+ }
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,
633
+ l
634
+ );
635
+ }), o.starts && f(o.starts, s), l.matcher = u(l), l;
636
+ }
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;
656
+ }
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);
676
+ }
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));
686
+ }
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
694
+ };
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);
726
+ }
727
+ h += y.substring(a), N.addText(h);
728
+ }
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);
736
+ return;
737
+ }
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;
757
+ }
758
+ const S = v.classNameAliases[a[h]] || a[h], I = d[h];
759
+ S ? k(I, S) : (y = I, T(), y = ""), h++;
760
+ }
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);
771
+ }
772
+ if (_) {
773
+ for (; a.endsParent && a.parent; )
774
+ a = a.parent;
775
+ return a;
776
+ }
777
+ }
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;
819
+ }
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 _;
829
+ }
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;
855
+ }
856
+ Te(c.substring(j));
857
+ }
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),
886
+ illegal: !1,
887
+ relevance: 0,
888
+ errorRaised: a,
889
+ _emitter: N,
890
+ _top: g
891
+ };
892
+ throw a;
893
+ }
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)
902
+ };
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;
919
+ }
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;
971
+ }
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 = [
1077
+ "as",
1078
+ // for exports
1079
+ "in",
1080
+ "of",
1081
+ "if",
1082
+ "for",
1083
+ "while",
1084
+ "finally",
1085
+ "var",
1086
+ "new",
1087
+ "function",
1088
+ "do",
1089
+ "return",
1090
+ "void",
1091
+ "else",
1092
+ "break",
1093
+ "catch",
1094
+ "instanceof",
1095
+ "with",
1096
+ "throw",
1097
+ "case",
1098
+ "default",
1099
+ "try",
1100
+ "switch",
1101
+ "continue",
1102
+ "typeof",
1103
+ "delete",
1104
+ "let",
1105
+ "yield",
1106
+ "const",
1107
+ "class",
1108
+ // JS handles these with a special rule
1109
+ // "get",
1110
+ // "set",
1111
+ "debugger",
1112
+ "async",
1113
+ "await",
1114
+ "static",
1115
+ "import",
1116
+ "from",
1117
+ "export",
1118
+ "extends"
1119
+ ], qe = [
1120
+ "true",
1121
+ "false",
1122
+ "null",
1123
+ "undefined",
1124
+ "NaN",
1125
+ "Infinity"
1126
+ ], Je = [
1127
+ // Fundamental objects
1128
+ "Object",
1129
+ "Function",
1130
+ "Boolean",
1131
+ "Symbol",
1132
+ // numbers and dates
1133
+ "Math",
1134
+ "Date",
1135
+ "Number",
1136
+ "BigInt",
1137
+ // text
1138
+ "String",
1139
+ "RegExp",
1140
+ // Indexed collections
1141
+ "Array",
1142
+ "Float32Array",
1143
+ "Float64Array",
1144
+ "Int8Array",
1145
+ "Uint8Array",
1146
+ "Uint8ClampedArray",
1147
+ "Int16Array",
1148
+ "Int32Array",
1149
+ "Uint16Array",
1150
+ "Uint32Array",
1151
+ "BigInt64Array",
1152
+ "BigUint64Array",
1153
+ // Keyed collections
1154
+ "Set",
1155
+ "Map",
1156
+ "WeakSet",
1157
+ "WeakMap",
1158
+ // Structured data
1159
+ "ArrayBuffer",
1160
+ "SharedArrayBuffer",
1161
+ "Atomics",
1162
+ "DataView",
1163
+ "JSON",
1164
+ // Control abstraction objects
1165
+ "Promise",
1166
+ "Generator",
1167
+ "GeneratorFunction",
1168
+ "AsyncFunction",
1169
+ // Reflection
1170
+ "Reflect",
1171
+ "Proxy",
1172
+ // Internationalization
1173
+ "Intl",
1174
+ // WebAssembly
1175
+ "WebAssembly"
1176
+ ], Ve = [
1177
+ "Error",
1178
+ "EvalError",
1179
+ "InternalError",
1180
+ "RangeError",
1181
+ "ReferenceError",
1182
+ "SyntaxError",
1183
+ "TypeError",
1184
+ "URIError"
1185
+ ], Qe = [
1186
+ "setInterval",
1187
+ "setTimeout",
1188
+ "clearInterval",
1189
+ "clearTimeout",
1190
+ "require",
1191
+ "exports",
1192
+ "eval",
1193
+ "isFinite",
1194
+ "isNaN",
1195
+ "parseFloat",
1196
+ "parseInt",
1197
+ "decodeURI",
1198
+ "decodeURIComponent",
1199
+ "encodeURI",
1200
+ "encodeURIComponent",
1201
+ "escape",
1202
+ "unescape"
1203
+ ], et = [
1204
+ "arguments",
1205
+ "this",
1206
+ "super",
1207
+ "console",
1208
+ "window",
1209
+ "document",
1210
+ "localStorage",
1211
+ "sessionStorage",
1212
+ "module",
1213
+ "global"
1214
+ // Node.js
1215
+ ], tt = [].concat(
1216
+ Qe,
1217
+ Je,
1218
+ Ve
1219
+ );
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 = {
1225
+ begin: "<>",
1226
+ end: "</>"
1227
+ }, f = /<[A-Za-z0-9\\._:-]+\s*\/>/, o = {
1228
+ begin: /<[A-Za-z0-9\\._:-]+/,
1229
+ end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
1230
+ /**
1231
+ * @param {RegExpMatchArray} match
1232
+ * @param {CallbackResponse} response
1233
+ */
1234
+ isTrulyOpeningTag: (c, p) => {
1235
+ const E = c[0].length + c.index, x = c.input[E];
1236
+ if (
1237
+ // HTML should not include another raw `<` inside a tag
1238
+ // nested type?
1239
+ // `<Array<Array<number>>`, etc.
1240
+ x === "<" || // the , gives away that this is not HTML
1241
+ // `<T, A extends keyof T, V>`
1242
+ x === ","
1243
+ ) {
1244
+ p.ignoreMatch();
1245
+ return;
1246
+ }
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();
1252
+ return;
1253
+ }
1254
+ if ((M = T.match(/^\s+extends\s+/)) && M.index === 0) {
1255
+ p.ignoreMatch();
1256
+ return;
1257
+ }
1258
+ }
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 = {
1266
+ className: "number",
1267
+ variants: [
1268
+ // DecimalLiteral
1269
+ { begin: `(\\b(${m})((${b})|\\.)?|(${b}))[eE][+-]?(${l})\\b` },
1270
+ { begin: `\\b(${m})\\b((${b})\\b|\\.)?|(${b})\\b` },
1271
+ // DecimalBigIntegerLiteral
1272
+ { begin: "\\b(0|[1-9](_?[0-9])*)n\\b" },
1273
+ // NonDecimalIntegerLiteral
1274
+ { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
1275
+ { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
1276
+ { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
1277
+ // LegacyOctalIntegerLiteral (does not include underscore separators)
1278
+ // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
1279
+ { begin: "\\b0[0-7]+n?\\b" }
1280
+ ],
1281
+ relevance: 0
1282
+ }, w = {
1283
+ className: "subst",
1284
+ begin: "\\$\\{",
1285
+ end: "\\}",
1286
+ keywords: s,
1287
+ contains: []
1288
+ // defined later
1289
+ }, L = {
1290
+ begin: "html`",
1291
+ end: "",
1292
+ starts: {
1293
+ end: "`",
1294
+ returnEnd: !1,
1295
+ contains: [
1296
+ e.BACKSLASH_ESCAPE,
1297
+ w
1298
+ ],
1299
+ subLanguage: "xml"
1300
+ }
1301
+ }, H = {
1302
+ begin: "css`",
1303
+ end: "",
1304
+ starts: {
1305
+ end: "`",
1306
+ returnEnd: !1,
1307
+ contains: [
1308
+ e.BACKSLASH_ESCAPE,
1309
+ w
1310
+ ],
1311
+ subLanguage: "css"
1312
+ }
1313
+ }, C = {
1314
+ begin: "gql`",
1315
+ end: "",
1316
+ starts: {
1317
+ end: "`",
1318
+ returnEnd: !1,
1319
+ contains: [
1320
+ e.BACKSLASH_ESCAPE,
1321
+ w
1322
+ ],
1323
+ subLanguage: "graphql"
1324
+ }
1325
+ }, $ = {
1326
+ className: "string",
1327
+ begin: "`",
1328
+ end: "`",
1329
+ contains: [
1330
+ e.BACKSLASH_ESCAPE,
1331
+ w
1332
+ ]
1333
+ }, W = {
1334
+ className: "comment",
1335
+ variants: [
1336
+ e.COMMENT(
1337
+ /\/\*\*(?!\/)/,
1338
+ "\\*/",
1339
+ {
1340
+ relevance: 0,
1341
+ contains: [
1342
+ {
1343
+ begin: "(?=@[A-Za-z]+)",
1344
+ relevance: 0,
1345
+ contains: [
1346
+ {
1347
+ className: "doctag",
1348
+ begin: "@[A-Za-z]+"
1349
+ },
1350
+ {
1351
+ className: "type",
1352
+ begin: "\\{",
1353
+ end: "\\}",
1354
+ excludeEnd: !0,
1355
+ excludeBegin: !0,
1356
+ relevance: 0
1357
+ },
1358
+ {
1359
+ className: "variable",
1360
+ begin: i + "(?=\\s*(-)|$)",
1361
+ endsParent: !0,
1362
+ relevance: 0
1363
+ },
1364
+ // eat spaces (not newlines) so we can find
1365
+ // types or variables
1366
+ {
1367
+ begin: /(?=[^\n])\s/,
1368
+ relevance: 0
1369
+ }
1370
+ ]
1371
+ }
1372
+ ]
1373
+ }
1374
+ ),
1375
+ e.C_BLOCK_COMMENT_MODE,
1376
+ e.C_LINE_COMMENT_MODE
1377
+ ]
1378
+ }, Z = [
1379
+ e.APOS_STRING_MODE,
1380
+ e.QUOTE_STRING_MODE,
1381
+ L,
1382
+ H,
1383
+ C,
1384
+ $,
1385
+ // Skip numbers when they are part of a variable name
1386
+ { match: /\$\d+/ },
1387
+ A
1388
+ // This is intentional:
1389
+ // See https://github.com/highlightjs/highlight.js/issues/3288
1390
+ // hljs.REGEXP_MODE
1391
+ ];
1392
+ w.contains = Z.concat({
1393
+ // we need to pair up {} inside our subst to prevent
1394
+ // it from ending too early by matching another }
1395
+ begin: /\{/,
1396
+ end: /\}/,
1397
+ keywords: s,
1398
+ contains: [
1399
+ "self"
1400
+ ].concat(Z)
1401
+ });
1402
+ const B = [].concat(W, w.contains), X = B.concat([
1403
+ // eat recursive parens in sub expressions
1404
+ {
1405
+ begin: /\(/,
1406
+ end: /\)/,
1407
+ keywords: s,
1408
+ contains: ["self"].concat(B)
1409
+ }
1410
+ ]), P = {
1411
+ className: "params",
1412
+ begin: /\(/,
1413
+ end: /\)/,
1414
+ excludeBegin: !0,
1415
+ excludeEnd: !0,
1416
+ keywords: s,
1417
+ contains: X
1418
+ }, ge = {
1419
+ variants: [
1420
+ // class Car extends vehicle
1421
+ {
1422
+ match: [
1423
+ /class/,
1424
+ /\s+/,
1425
+ i,
1426
+ /\s+/,
1427
+ /extends/,
1428
+ /\s+/,
1429
+ t.concat(i, "(", t.concat(/\./, i), ")*")
1430
+ ],
1431
+ scope: {
1432
+ 1: "keyword",
1433
+ 3: "title.class",
1434
+ 5: "keyword",
1435
+ 7: "title.class.inherited"
1436
+ }
1437
+ },
1438
+ // class Car
1439
+ {
1440
+ match: [
1441
+ /class/,
1442
+ /\s+/,
1443
+ i
1444
+ ],
1445
+ scope: {
1446
+ 1: "keyword",
1447
+ 3: "title.class"
1448
+ }
1449
+ }
1450
+ ]
1451
+ }, Q = {
1452
+ relevance: 0,
1453
+ match: t.either(
1454
+ // Hard coded exceptions
1455
+ /\bJSON/,
1456
+ // Float32Array, OutT
1457
+ /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
1458
+ // CSSFactory, CSSFactoryT
1459
+ /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,
1460
+ // FPs, FPsT
1461
+ /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/
1462
+ // P
1463
+ // single letters are not highlighted
1464
+ // BLAH
1465
+ // this will be flagged as a UPPER_CASE_CONSTANT instead
1466
+ ),
1467
+ className: "title.class",
1468
+ keywords: {
1469
+ _: [
1470
+ // se we still get relevance credit for JS library classes
1471
+ ...Je,
1472
+ ...Ve
1473
+ ]
1474
+ }
1475
+ }, R = {
1476
+ label: "use_strict",
1477
+ className: "meta",
1478
+ relevance: 10,
1479
+ begin: /^\s*['"]use (strict|asm)['"]/
1480
+ }, ee = {
1481
+ variants: [
1482
+ {
1483
+ match: [
1484
+ /function/,
1485
+ /\s+/,
1486
+ i,
1487
+ /(?=\s*\()/
1488
+ ]
1489
+ },
1490
+ // anonymous function
1491
+ {
1492
+ match: [
1493
+ /function/,
1494
+ /\s*(?=\()/
1495
+ ]
1496
+ }
1497
+ ],
1498
+ className: {
1499
+ 1: "keyword",
1500
+ 3: "title.function"
1501
+ },
1502
+ label: "func.def",
1503
+ contains: [P],
1504
+ illegal: /%/
1505
+ }, te = {
1506
+ relevance: 0,
1507
+ match: /\b[A-Z][A-Z_0-9]+\b/,
1508
+ className: "variable.constant"
1509
+ };
1510
+ function fe(c) {
1511
+ return t.concat("(?!", c.join("|"), ")");
1512
+ }
1513
+ const pe = {
1514
+ match: t.concat(
1515
+ /\b/,
1516
+ fe([
1517
+ ...Qe,
1518
+ "super",
1519
+ "import"
1520
+ ]),
1521
+ i,
1522
+ t.lookahead(/\(/)
1523
+ ),
1524
+ className: "title.function",
1525
+ relevance: 0
1526
+ }, he = {
1527
+ begin: t.concat(/\./, t.lookahead(
1528
+ t.concat(i, /(?![0-9A-Za-z$_(])/)
1529
+ )),
1530
+ end: i,
1531
+ excludeBegin: !0,
1532
+ keywords: "prototype",
1533
+ className: "property",
1534
+ relevance: 0
1535
+ }, G = {
1536
+ match: [
1537
+ /get|set/,
1538
+ /\s+/,
1539
+ i,
1540
+ /(?=\()/
1541
+ ],
1542
+ className: {
1543
+ 1: "keyword",
1544
+ 3: "title.function"
1545
+ },
1546
+ contains: [
1547
+ {
1548
+ // eat to avoid empty params
1549
+ begin: /\(\)/
1550
+ },
1551
+ P
1552
+ ]
1553
+ }, ne = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + e.UNDERSCORE_IDENT_RE + ")\\s*=>", r = {
1554
+ match: [
1555
+ /const|var|let/,
1556
+ /\s+/,
1557
+ i,
1558
+ /\s*/,
1559
+ /=\s*/,
1560
+ /(async\s*)?/,
1561
+ // async is optional
1562
+ t.lookahead(ne)
1563
+ ],
1564
+ keywords: "async",
1565
+ className: {
1566
+ 1: "keyword",
1567
+ 3: "title.function"
1568
+ },
1569
+ contains: [
1570
+ P
1571
+ ]
1572
+ };
1573
+ return {
1574
+ name: "JavaScript",
1575
+ aliases: ["js", "jsx", "mjs", "cjs"],
1576
+ keywords: s,
1577
+ // this will be extended by TypeScript
1578
+ exports: { PARAMS_CONTAINS: X, CLASS_REFERENCE: Q },
1579
+ illegal: /#(?![$_A-z])/,
1580
+ contains: [
1581
+ e.SHEBANG({
1582
+ label: "shebang",
1583
+ binary: "node",
1584
+ relevance: 5
1585
+ }),
1586
+ R,
1587
+ e.APOS_STRING_MODE,
1588
+ e.QUOTE_STRING_MODE,
1589
+ L,
1590
+ H,
1591
+ C,
1592
+ $,
1593
+ W,
1594
+ // Skip numbers when they are part of a variable name
1595
+ { match: /\$\d+/ },
1596
+ A,
1597
+ Q,
1598
+ {
1599
+ className: "attr",
1600
+ begin: i + t.lookahead(":"),
1601
+ relevance: 0
1602
+ },
1603
+ r,
1604
+ {
1605
+ // "value" container
1606
+ begin: "(" + e.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
1607
+ keywords: "return throw case",
1608
+ relevance: 0,
1609
+ contains: [
1610
+ W,
1611
+ e.REGEXP_MODE,
1612
+ {
1613
+ className: "function",
1614
+ // we have to count the parens to make sure we actually have the
1615
+ // correct bounding ( ) before the =>. There could be any number of
1616
+ // sub-expressions inside also surrounded by parens.
1617
+ begin: ne,
1618
+ returnBegin: !0,
1619
+ end: "\\s*=>",
1620
+ contains: [
1621
+ {
1622
+ className: "params",
1623
+ variants: [
1624
+ {
1625
+ begin: e.UNDERSCORE_IDENT_RE,
1626
+ relevance: 0
1627
+ },
1628
+ {
1629
+ className: null,
1630
+ begin: /\(\s*\)/,
1631
+ skip: !0
1632
+ },
1633
+ {
1634
+ begin: /\(/,
1635
+ end: /\)/,
1636
+ excludeBegin: !0,
1637
+ excludeEnd: !0,
1638
+ keywords: s,
1639
+ contains: X
1640
+ }
1641
+ ]
1642
+ }
1643
+ ]
1644
+ },
1645
+ {
1646
+ // could be a comma delimited list of params to a function call
1647
+ begin: /,/,
1648
+ relevance: 0
1649
+ },
1650
+ {
1651
+ match: /\s+/,
1652
+ relevance: 0
1653
+ },
1654
+ {
1655
+ // JSX
1656
+ variants: [
1657
+ { begin: u.begin, end: u.end },
1658
+ { match: f },
1659
+ {
1660
+ begin: o.begin,
1661
+ // we carefully check the opening tag to see if it truly
1662
+ // is a tag and not a false positive
1663
+ "on:begin": o.isTrulyOpeningTag,
1664
+ end: o.end
1665
+ }
1666
+ ],
1667
+ subLanguage: "xml",
1668
+ contains: [
1669
+ {
1670
+ begin: o.begin,
1671
+ end: o.end,
1672
+ skip: !0,
1673
+ contains: ["self"]
1674
+ }
1675
+ ]
1676
+ }
1677
+ ]
1678
+ },
1679
+ ee,
1680
+ {
1681
+ // prevent this from getting swallowed up by function
1682
+ // since they appear "function like"
1683
+ beginKeywords: "while if switch catch for"
1684
+ },
1685
+ {
1686
+ // we have to count the parens to make sure we actually have the correct
1687
+ // bounding ( ). There could be any number of sub-expressions inside
1688
+ // also surrounded by parens.
1689
+ begin: "\\b(?!function)" + e.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
1690
+ // end parens
1691
+ returnBegin: !0,
1692
+ label: "func.def",
1693
+ contains: [
1694
+ P,
1695
+ e.inherit(e.TITLE_MODE, { begin: i, className: "title.function" })
1696
+ ]
1697
+ },
1698
+ // catch ... so it won't trigger the property rule below
1699
+ {
1700
+ match: /\.\.\./,
1701
+ relevance: 0
1702
+ },
1703
+ he,
1704
+ // hack: prevents detection of keywords in some circumstances
1705
+ // .keyword()
1706
+ // $keyword = x
1707
+ {
1708
+ match: "\\$" + i,
1709
+ relevance: 0
1710
+ },
1711
+ {
1712
+ match: [/\bconstructor(?=\s*\()/],
1713
+ className: { 1: "title.function" },
1714
+ contains: [P]
1715
+ },
1716
+ pe,
1717
+ te,
1718
+ ge,
1719
+ G,
1720
+ {
1721
+ match: /\$[(.]/
1722
+ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
1723
+ }
1724
+ ]
1725
+ };
1726
+ }
1727
+ function dn(e) {
1728
+ const t = ln(e), n = le, i = [
1729
+ "any",
1730
+ "void",
1731
+ "number",
1732
+ "boolean",
1733
+ "string",
1734
+ "object",
1735
+ "never",
1736
+ "symbol",
1737
+ "bigint",
1738
+ "unknown"
1739
+ ], u = {
1740
+ beginKeywords: "namespace",
1741
+ end: /\{/,
1742
+ excludeEnd: !0,
1743
+ contains: [t.exports.CLASS_REFERENCE]
1744
+ }, f = {
1745
+ beginKeywords: "interface",
1746
+ end: /\{/,
1747
+ excludeEnd: !0,
1748
+ keywords: {
1749
+ keyword: "interface extends",
1750
+ built_in: i
1751
+ },
1752
+ contains: [t.exports.CLASS_REFERENCE]
1753
+ }, o = {
1754
+ className: "meta",
1755
+ relevance: 10,
1756
+ begin: /^\s*['"]use strict['"]/
1757
+ }, s = [
1758
+ "type",
1759
+ "namespace",
1760
+ "interface",
1761
+ "public",
1762
+ "private",
1763
+ "protected",
1764
+ "implements",
1765
+ "declare",
1766
+ "abstract",
1767
+ "readonly",
1768
+ "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 = {
1777
+ className: "meta",
1778
+ begin: "@" + n
1779
+ }, m = (w, L, H) => {
1780
+ const C = w.contains.findIndex(($) => $.label === L);
1781
+ if (C === -1)
1782
+ throw new Error("can not find mode to replace");
1783
+ w.contains.splice(C, 1, H);
1784
+ };
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, {
1792
+ name: "TypeScript",
1793
+ aliases: [
1794
+ "ts",
1795
+ "tsx",
1796
+ "mts",
1797
+ "cts"
1798
+ ]
1799
+ }), t;
1800
+ }
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 = {
1803
+ className: "symbol",
1804
+ begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
1805
+ }, f = {
1806
+ begin: /\s/,
1807
+ contains: [
1808
+ {
1809
+ className: "keyword",
1810
+ begin: /#?[a-z_][a-z1-9_-]+/,
1811
+ illegal: /\n/
1812
+ }
1813
+ ]
1814
+ }, o = e.inherit(f, {
1815
+ begin: /\(/,
1816
+ end: /\)/
1817
+ }), s = e.inherit(e.APOS_STRING_MODE, { className: "string" }), l = e.inherit(e.QUOTE_STRING_MODE, { className: "string" }), b = {
1818
+ endsWithParent: !0,
1819
+ illegal: /</,
1820
+ relevance: 0,
1821
+ contains: [
1822
+ {
1823
+ className: "attr",
1824
+ begin: i,
1825
+ relevance: 0
1826
+ },
1827
+ {
1828
+ begin: /=\s*/,
1829
+ relevance: 0,
1830
+ contains: [
1831
+ {
1832
+ className: "string",
1833
+ endsParent: !0,
1834
+ variants: [
1835
+ {
1836
+ begin: /"/,
1837
+ end: /"/,
1838
+ contains: [u]
1839
+ },
1840
+ {
1841
+ begin: /'/,
1842
+ end: /'/,
1843
+ contains: [u]
1844
+ },
1845
+ { begin: /[^\s"'=<>`]+/ }
1846
+ ]
1847
+ }
1848
+ ]
1849
+ }
1850
+ ]
1851
+ };
1852
+ return {
1853
+ name: "HTML, XML",
1854
+ aliases: [
1855
+ "html",
1856
+ "xhtml",
1857
+ "rss",
1858
+ "atom",
1859
+ "xjb",
1860
+ "xsd",
1861
+ "xsl",
1862
+ "plist",
1863
+ "wsf",
1864
+ "svg"
1865
+ ],
1866
+ case_insensitive: !0,
1867
+ unicodeRegex: !0,
1868
+ contains: [
1869
+ {
1870
+ className: "meta",
1871
+ begin: /<![a-z]/,
1872
+ end: />/,
1873
+ relevance: 10,
1874
+ contains: [
1875
+ f,
1876
+ l,
1877
+ s,
1878
+ o,
1879
+ {
1880
+ begin: /\[/,
1881
+ end: /\]/,
1882
+ contains: [
1883
+ {
1884
+ className: "meta",
1885
+ begin: /<![a-z]/,
1886
+ end: />/,
1887
+ contains: [
1888
+ f,
1889
+ o,
1890
+ l,
1891
+ s
1892
+ ]
1893
+ }
1894
+ ]
1895
+ }
1896
+ ]
1897
+ },
1898
+ e.COMMENT(
1899
+ /<!--/,
1900
+ /-->/,
1901
+ { relevance: 10 }
1902
+ ),
1903
+ {
1904
+ begin: /<!\[CDATA\[/,
1905
+ end: /\]\]>/,
1906
+ relevance: 10
1907
+ },
1908
+ u,
1909
+ // xml processing instructions
1910
+ {
1911
+ className: "meta",
1912
+ end: /\?>/,
1913
+ variants: [
1914
+ {
1915
+ begin: /<\?xml/,
1916
+ relevance: 10,
1917
+ contains: [
1918
+ l
1919
+ ]
1920
+ },
1921
+ {
1922
+ begin: /<\?[a-z][a-z0-9]+/
1923
+ }
1924
+ ]
1925
+ },
1926
+ {
1927
+ className: "tag",
1928
+ /*
1929
+ The lookahead pattern (?=...) ensures that 'begin' only matches
1930
+ '<style' as a single word, followed by a whitespace or an
1931
+ ending bracket.
1932
+ */
1933
+ begin: /<style(?=\s|>)/,
1934
+ end: />/,
1935
+ keywords: { name: "style" },
1936
+ contains: [b],
1937
+ starts: {
1938
+ end: /<\/style>/,
1939
+ returnEnd: !0,
1940
+ subLanguage: [
1941
+ "css",
1942
+ "xml"
1943
+ ]
1944
+ }
1945
+ },
1946
+ {
1947
+ className: "tag",
1948
+ // See the comment in the <style tag about the lookahead pattern
1949
+ begin: /<script(?=\s|>)/,
1950
+ end: />/,
1951
+ keywords: { name: "script" },
1952
+ contains: [b],
1953
+ starts: {
1954
+ end: /<\/script>/,
1955
+ returnEnd: !0,
1956
+ subLanguage: [
1957
+ "javascript",
1958
+ "handlebars",
1959
+ "xml"
1960
+ ]
1961
+ }
1962
+ },
1963
+ // we need this for now for jSX
1964
+ {
1965
+ className: "tag",
1966
+ begin: /<>|<\/>/
1967
+ },
1968
+ // open tag
1969
+ {
1970
+ className: "tag",
1971
+ begin: t.concat(
1972
+ /</,
1973
+ t.lookahead(t.concat(
1974
+ n,
1975
+ // <tag/>
1976
+ // <tag>
1977
+ // <tag ...
1978
+ t.either(/\/>/, />/, /\s/)
1979
+ ))
1980
+ ),
1981
+ end: /\/?>/,
1982
+ contains: [
1983
+ {
1984
+ className: "name",
1985
+ begin: n,
1986
+ relevance: 0,
1987
+ starts: b
1988
+ }
1989
+ ]
1990
+ },
1991
+ // close tag
1992
+ {
1993
+ className: "tag",
1994
+ begin: t.concat(
1995
+ /<\//,
1996
+ t.lookahead(t.concat(
1997
+ n,
1998
+ />/
1999
+ ))
2000
+ ),
2001
+ contains: [
2002
+ {
2003
+ className: "name",
2004
+ begin: n,
2005
+ relevance: 0
2006
+ },
2007
+ {
2008
+ begin: />/,
2009
+ relevance: 0,
2010
+ endsParent: !0
2011
+ }
2012
+ ]
2013
+ }
2014
+ ]
2015
+ };
2016
+ }
2017
+ const gn = (e) => ({
2018
+ IMPORTANT: {
2019
+ scope: "meta",
2020
+ begin: "!important"
2021
+ },
2022
+ BLOCK_COMMENT: e.C_BLOCK_COMMENT_MODE,
2023
+ HEXCOLOR: {
2024
+ scope: "number",
2025
+ begin: /#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/
2026
+ },
2027
+ FUNCTION_DISPATCH: {
2028
+ className: "built_in",
2029
+ begin: /[\w-]+(?=\()/
2030
+ },
2031
+ ATTRIBUTE_SELECTOR_MODE: {
2032
+ scope: "selector-attr",
2033
+ begin: /\[/,
2034
+ end: /\]/,
2035
+ illegal: "$",
2036
+ contains: [
2037
+ e.APOS_STRING_MODE,
2038
+ e.QUOTE_STRING_MODE
2039
+ ]
2040
+ },
2041
+ CSS_NUMBER_MODE: {
2042
+ 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)?",
2044
+ relevance: 0
2045
+ },
2046
+ CSS_VARIABLE: {
2047
+ className: "attr",
2048
+ begin: /--[A-Za-z_][A-Za-z0-9_-]*/
2049
+ }
2050
+ }), fn = [
2051
+ "a",
2052
+ "abbr",
2053
+ "address",
2054
+ "article",
2055
+ "aside",
2056
+ "audio",
2057
+ "b",
2058
+ "blockquote",
2059
+ "body",
2060
+ "button",
2061
+ "canvas",
2062
+ "caption",
2063
+ "cite",
2064
+ "code",
2065
+ "dd",
2066
+ "del",
2067
+ "details",
2068
+ "dfn",
2069
+ "div",
2070
+ "dl",
2071
+ "dt",
2072
+ "em",
2073
+ "fieldset",
2074
+ "figcaption",
2075
+ "figure",
2076
+ "footer",
2077
+ "form",
2078
+ "h1",
2079
+ "h2",
2080
+ "h3",
2081
+ "h4",
2082
+ "h5",
2083
+ "h6",
2084
+ "header",
2085
+ "hgroup",
2086
+ "html",
2087
+ "i",
2088
+ "iframe",
2089
+ "img",
2090
+ "input",
2091
+ "ins",
2092
+ "kbd",
2093
+ "label",
2094
+ "legend",
2095
+ "li",
2096
+ "main",
2097
+ "mark",
2098
+ "menu",
2099
+ "nav",
2100
+ "object",
2101
+ "ol",
2102
+ "p",
2103
+ "q",
2104
+ "quote",
2105
+ "samp",
2106
+ "section",
2107
+ "span",
2108
+ "strong",
2109
+ "summary",
2110
+ "sup",
2111
+ "table",
2112
+ "tbody",
2113
+ "td",
2114
+ "textarea",
2115
+ "tfoot",
2116
+ "th",
2117
+ "thead",
2118
+ "time",
2119
+ "tr",
2120
+ "ul",
2121
+ "var",
2122
+ "video"
2123
+ ], pn = [
2124
+ "any-hover",
2125
+ "any-pointer",
2126
+ "aspect-ratio",
2127
+ "color",
2128
+ "color-gamut",
2129
+ "color-index",
2130
+ "device-aspect-ratio",
2131
+ "device-height",
2132
+ "device-width",
2133
+ "display-mode",
2134
+ "forced-colors",
2135
+ "grid",
2136
+ "height",
2137
+ "hover",
2138
+ "inverted-colors",
2139
+ "monochrome",
2140
+ "orientation",
2141
+ "overflow-block",
2142
+ "overflow-inline",
2143
+ "pointer",
2144
+ "prefers-color-scheme",
2145
+ "prefers-contrast",
2146
+ "prefers-reduced-motion",
2147
+ "prefers-reduced-transparency",
2148
+ "resolution",
2149
+ "scan",
2150
+ "scripting",
2151
+ "update",
2152
+ "width",
2153
+ // TODO: find a better solution?
2154
+ "min-width",
2155
+ "max-width",
2156
+ "min-height",
2157
+ "max-height"
2158
+ ], hn = [
2159
+ "active",
2160
+ "any-link",
2161
+ "blank",
2162
+ "checked",
2163
+ "current",
2164
+ "default",
2165
+ "defined",
2166
+ "dir",
2167
+ // dir()
2168
+ "disabled",
2169
+ "drop",
2170
+ "empty",
2171
+ "enabled",
2172
+ "first",
2173
+ "first-child",
2174
+ "first-of-type",
2175
+ "fullscreen",
2176
+ "future",
2177
+ "focus",
2178
+ "focus-visible",
2179
+ "focus-within",
2180
+ "has",
2181
+ // has()
2182
+ "host",
2183
+ // host or host()
2184
+ "host-context",
2185
+ // host-context()
2186
+ "hover",
2187
+ "indeterminate",
2188
+ "in-range",
2189
+ "invalid",
2190
+ "is",
2191
+ // is()
2192
+ "lang",
2193
+ // lang()
2194
+ "last-child",
2195
+ "last-of-type",
2196
+ "left",
2197
+ "link",
2198
+ "local-link",
2199
+ "not",
2200
+ // not()
2201
+ "nth-child",
2202
+ // nth-child()
2203
+ "nth-col",
2204
+ // nth-col()
2205
+ "nth-last-child",
2206
+ // nth-last-child()
2207
+ "nth-last-col",
2208
+ // nth-last-col()
2209
+ "nth-last-of-type",
2210
+ //nth-last-of-type()
2211
+ "nth-of-type",
2212
+ //nth-of-type()
2213
+ "only-child",
2214
+ "only-of-type",
2215
+ "optional",
2216
+ "out-of-range",
2217
+ "past",
2218
+ "placeholder-shown",
2219
+ "read-only",
2220
+ "read-write",
2221
+ "required",
2222
+ "right",
2223
+ "root",
2224
+ "scope",
2225
+ "target",
2226
+ "target-within",
2227
+ "user-invalid",
2228
+ "valid",
2229
+ "visited",
2230
+ "where"
2231
+ // where()
2232
+ ], bn = [
2233
+ "after",
2234
+ "backdrop",
2235
+ "before",
2236
+ "cue",
2237
+ "cue-region",
2238
+ "first-letter",
2239
+ "first-line",
2240
+ "grammar-error",
2241
+ "marker",
2242
+ "part",
2243
+ "placeholder",
2244
+ "selection",
2245
+ "slotted",
2246
+ "spelling-error"
2247
+ ], En = [
2248
+ "align-content",
2249
+ "align-items",
2250
+ "align-self",
2251
+ "all",
2252
+ "animation",
2253
+ "animation-delay",
2254
+ "animation-direction",
2255
+ "animation-duration",
2256
+ "animation-fill-mode",
2257
+ "animation-iteration-count",
2258
+ "animation-name",
2259
+ "animation-play-state",
2260
+ "animation-timing-function",
2261
+ "backface-visibility",
2262
+ "background",
2263
+ "background-attachment",
2264
+ "background-blend-mode",
2265
+ "background-clip",
2266
+ "background-color",
2267
+ "background-image",
2268
+ "background-origin",
2269
+ "background-position",
2270
+ "background-repeat",
2271
+ "background-size",
2272
+ "block-size",
2273
+ "border",
2274
+ "border-block",
2275
+ "border-block-color",
2276
+ "border-block-end",
2277
+ "border-block-end-color",
2278
+ "border-block-end-style",
2279
+ "border-block-end-width",
2280
+ "border-block-start",
2281
+ "border-block-start-color",
2282
+ "border-block-start-style",
2283
+ "border-block-start-width",
2284
+ "border-block-style",
2285
+ "border-block-width",
2286
+ "border-bottom",
2287
+ "border-bottom-color",
2288
+ "border-bottom-left-radius",
2289
+ "border-bottom-right-radius",
2290
+ "border-bottom-style",
2291
+ "border-bottom-width",
2292
+ "border-collapse",
2293
+ "border-color",
2294
+ "border-image",
2295
+ "border-image-outset",
2296
+ "border-image-repeat",
2297
+ "border-image-slice",
2298
+ "border-image-source",
2299
+ "border-image-width",
2300
+ "border-inline",
2301
+ "border-inline-color",
2302
+ "border-inline-end",
2303
+ "border-inline-end-color",
2304
+ "border-inline-end-style",
2305
+ "border-inline-end-width",
2306
+ "border-inline-start",
2307
+ "border-inline-start-color",
2308
+ "border-inline-start-style",
2309
+ "border-inline-start-width",
2310
+ "border-inline-style",
2311
+ "border-inline-width",
2312
+ "border-left",
2313
+ "border-left-color",
2314
+ "border-left-style",
2315
+ "border-left-width",
2316
+ "border-radius",
2317
+ "border-right",
2318
+ "border-right-color",
2319
+ "border-right-style",
2320
+ "border-right-width",
2321
+ "border-spacing",
2322
+ "border-style",
2323
+ "border-top",
2324
+ "border-top-color",
2325
+ "border-top-left-radius",
2326
+ "border-top-right-radius",
2327
+ "border-top-style",
2328
+ "border-top-width",
2329
+ "border-width",
2330
+ "bottom",
2331
+ "box-decoration-break",
2332
+ "box-shadow",
2333
+ "box-sizing",
2334
+ "break-after",
2335
+ "break-before",
2336
+ "break-inside",
2337
+ "caption-side",
2338
+ "caret-color",
2339
+ "clear",
2340
+ "clip",
2341
+ "clip-path",
2342
+ "clip-rule",
2343
+ "color",
2344
+ "column-count",
2345
+ "column-fill",
2346
+ "column-gap",
2347
+ "column-rule",
2348
+ "column-rule-color",
2349
+ "column-rule-style",
2350
+ "column-rule-width",
2351
+ "column-span",
2352
+ "column-width",
2353
+ "columns",
2354
+ "contain",
2355
+ "content",
2356
+ "content-visibility",
2357
+ "counter-increment",
2358
+ "counter-reset",
2359
+ "cue",
2360
+ "cue-after",
2361
+ "cue-before",
2362
+ "cursor",
2363
+ "direction",
2364
+ "display",
2365
+ "empty-cells",
2366
+ "filter",
2367
+ "flex",
2368
+ "flex-basis",
2369
+ "flex-direction",
2370
+ "flex-flow",
2371
+ "flex-grow",
2372
+ "flex-shrink",
2373
+ "flex-wrap",
2374
+ "float",
2375
+ "flow",
2376
+ "font",
2377
+ "font-display",
2378
+ "font-family",
2379
+ "font-feature-settings",
2380
+ "font-kerning",
2381
+ "font-language-override",
2382
+ "font-size",
2383
+ "font-size-adjust",
2384
+ "font-smoothing",
2385
+ "font-stretch",
2386
+ "font-style",
2387
+ "font-synthesis",
2388
+ "font-variant",
2389
+ "font-variant-caps",
2390
+ "font-variant-east-asian",
2391
+ "font-variant-ligatures",
2392
+ "font-variant-numeric",
2393
+ "font-variant-position",
2394
+ "font-variation-settings",
2395
+ "font-weight",
2396
+ "gap",
2397
+ "glyph-orientation-vertical",
2398
+ "grid",
2399
+ "grid-area",
2400
+ "grid-auto-columns",
2401
+ "grid-auto-flow",
2402
+ "grid-auto-rows",
2403
+ "grid-column",
2404
+ "grid-column-end",
2405
+ "grid-column-start",
2406
+ "grid-gap",
2407
+ "grid-row",
2408
+ "grid-row-end",
2409
+ "grid-row-start",
2410
+ "grid-template",
2411
+ "grid-template-areas",
2412
+ "grid-template-columns",
2413
+ "grid-template-rows",
2414
+ "hanging-punctuation",
2415
+ "height",
2416
+ "hyphens",
2417
+ "icon",
2418
+ "image-orientation",
2419
+ "image-rendering",
2420
+ "image-resolution",
2421
+ "ime-mode",
2422
+ "inline-size",
2423
+ "isolation",
2424
+ "justify-content",
2425
+ "left",
2426
+ "letter-spacing",
2427
+ "line-break",
2428
+ "line-height",
2429
+ "list-style",
2430
+ "list-style-image",
2431
+ "list-style-position",
2432
+ "list-style-type",
2433
+ "margin",
2434
+ "margin-block",
2435
+ "margin-block-end",
2436
+ "margin-block-start",
2437
+ "margin-bottom",
2438
+ "margin-inline",
2439
+ "margin-inline-end",
2440
+ "margin-inline-start",
2441
+ "margin-left",
2442
+ "margin-right",
2443
+ "margin-top",
2444
+ "marks",
2445
+ "mask",
2446
+ "mask-border",
2447
+ "mask-border-mode",
2448
+ "mask-border-outset",
2449
+ "mask-border-repeat",
2450
+ "mask-border-slice",
2451
+ "mask-border-source",
2452
+ "mask-border-width",
2453
+ "mask-clip",
2454
+ "mask-composite",
2455
+ "mask-image",
2456
+ "mask-mode",
2457
+ "mask-origin",
2458
+ "mask-position",
2459
+ "mask-repeat",
2460
+ "mask-size",
2461
+ "mask-type",
2462
+ "max-block-size",
2463
+ "max-height",
2464
+ "max-inline-size",
2465
+ "max-width",
2466
+ "min-block-size",
2467
+ "min-height",
2468
+ "min-inline-size",
2469
+ "min-width",
2470
+ "mix-blend-mode",
2471
+ "nav-down",
2472
+ "nav-index",
2473
+ "nav-left",
2474
+ "nav-right",
2475
+ "nav-up",
2476
+ "none",
2477
+ "normal",
2478
+ "object-fit",
2479
+ "object-position",
2480
+ "opacity",
2481
+ "order",
2482
+ "orphans",
2483
+ "outline",
2484
+ "outline-color",
2485
+ "outline-offset",
2486
+ "outline-style",
2487
+ "outline-width",
2488
+ "overflow",
2489
+ "overflow-wrap",
2490
+ "overflow-x",
2491
+ "overflow-y",
2492
+ "padding",
2493
+ "padding-block",
2494
+ "padding-block-end",
2495
+ "padding-block-start",
2496
+ "padding-bottom",
2497
+ "padding-inline",
2498
+ "padding-inline-end",
2499
+ "padding-inline-start",
2500
+ "padding-left",
2501
+ "padding-right",
2502
+ "padding-top",
2503
+ "page-break-after",
2504
+ "page-break-before",
2505
+ "page-break-inside",
2506
+ "pause",
2507
+ "pause-after",
2508
+ "pause-before",
2509
+ "perspective",
2510
+ "perspective-origin",
2511
+ "pointer-events",
2512
+ "position",
2513
+ "quotes",
2514
+ "resize",
2515
+ "rest",
2516
+ "rest-after",
2517
+ "rest-before",
2518
+ "right",
2519
+ "row-gap",
2520
+ "scroll-margin",
2521
+ "scroll-margin-block",
2522
+ "scroll-margin-block-end",
2523
+ "scroll-margin-block-start",
2524
+ "scroll-margin-bottom",
2525
+ "scroll-margin-inline",
2526
+ "scroll-margin-inline-end",
2527
+ "scroll-margin-inline-start",
2528
+ "scroll-margin-left",
2529
+ "scroll-margin-right",
2530
+ "scroll-margin-top",
2531
+ "scroll-padding",
2532
+ "scroll-padding-block",
2533
+ "scroll-padding-block-end",
2534
+ "scroll-padding-block-start",
2535
+ "scroll-padding-bottom",
2536
+ "scroll-padding-inline",
2537
+ "scroll-padding-inline-end",
2538
+ "scroll-padding-inline-start",
2539
+ "scroll-padding-left",
2540
+ "scroll-padding-right",
2541
+ "scroll-padding-top",
2542
+ "scroll-snap-align",
2543
+ "scroll-snap-stop",
2544
+ "scroll-snap-type",
2545
+ "scrollbar-color",
2546
+ "scrollbar-gutter",
2547
+ "scrollbar-width",
2548
+ "shape-image-threshold",
2549
+ "shape-margin",
2550
+ "shape-outside",
2551
+ "speak",
2552
+ "speak-as",
2553
+ "src",
2554
+ // @font-face
2555
+ "tab-size",
2556
+ "table-layout",
2557
+ "text-align",
2558
+ "text-align-all",
2559
+ "text-align-last",
2560
+ "text-combine-upright",
2561
+ "text-decoration",
2562
+ "text-decoration-color",
2563
+ "text-decoration-line",
2564
+ "text-decoration-style",
2565
+ "text-emphasis",
2566
+ "text-emphasis-color",
2567
+ "text-emphasis-position",
2568
+ "text-emphasis-style",
2569
+ "text-indent",
2570
+ "text-justify",
2571
+ "text-orientation",
2572
+ "text-overflow",
2573
+ "text-rendering",
2574
+ "text-shadow",
2575
+ "text-transform",
2576
+ "text-underline-position",
2577
+ "top",
2578
+ "transform",
2579
+ "transform-box",
2580
+ "transform-origin",
2581
+ "transform-style",
2582
+ "transition",
2583
+ "transition-delay",
2584
+ "transition-duration",
2585
+ "transition-property",
2586
+ "transition-timing-function",
2587
+ "unicode-bidi",
2588
+ "vertical-align",
2589
+ "visibility",
2590
+ "voice-balance",
2591
+ "voice-duration",
2592
+ "voice-family",
2593
+ "voice-pitch",
2594
+ "voice-range",
2595
+ "voice-rate",
2596
+ "voice-stress",
2597
+ "voice-volume",
2598
+ "white-space",
2599
+ "widows",
2600
+ "width",
2601
+ "will-change",
2602
+ "word-break",
2603
+ "word-spacing",
2604
+ "word-wrap",
2605
+ "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
2614
+ ];
2615
+ return {
2616
+ name: "CSS",
2617
+ case_insensitive: !0,
2618
+ illegal: /[=|'\$]/,
2619
+ keywords: { keyframePosition: "from to" },
2620
+ classNameAliases: {
2621
+ // for visual continuity with `tag {}` and because we
2622
+ // don't have a great class for this?
2623
+ keyframePosition: "selector-tag"
2624
+ },
2625
+ contains: [
2626
+ n.BLOCK_COMMENT,
2627
+ i,
2628
+ // to recognize keyframe 40% etc which are outside the scope of our
2629
+ // attribute value mode
2630
+ n.CSS_NUMBER_MODE,
2631
+ {
2632
+ className: "selector-id",
2633
+ begin: /#[A-Za-z0-9_-]+/,
2634
+ relevance: 0
2635
+ },
2636
+ {
2637
+ className: "selector-class",
2638
+ begin: "\\." + o,
2639
+ relevance: 0
2640
+ },
2641
+ n.ATTRIBUTE_SELECTOR_MODE,
2642
+ {
2643
+ className: "selector-pseudo",
2644
+ variants: [
2645
+ { begin: ":(" + hn.join("|") + ")" },
2646
+ { begin: ":(:)?(" + bn.join("|") + ")" }
2647
+ ]
2648
+ },
2649
+ // we may actually need this (12/2020)
2650
+ // { // pseudo-selector params
2651
+ // begin: /\(/,
2652
+ // end: /\)/,
2653
+ // contains: [ hljs.CSS_NUMBER_MODE ]
2654
+ // },
2655
+ n.CSS_VARIABLE,
2656
+ {
2657
+ className: "attribute",
2658
+ begin: "\\b(" + En.join("|") + ")\\b"
2659
+ },
2660
+ // attribute values
2661
+ {
2662
+ begin: /:/,
2663
+ end: /[;}{]/,
2664
+ contains: [
2665
+ n.BLOCK_COMMENT,
2666
+ n.HEXCOLOR,
2667
+ n.IMPORTANT,
2668
+ n.CSS_NUMBER_MODE,
2669
+ ...s,
2670
+ // needed to highlight these as strings and to avoid issues with
2671
+ // illegal characters that might be inside urls that would tigger the
2672
+ // languages illegal stack
2673
+ {
2674
+ begin: /(url|data-uri)\(/,
2675
+ end: /\)/,
2676
+ relevance: 0,
2677
+ // from keywords
2678
+ keywords: { built_in: "url data-uri" },
2679
+ contains: [
2680
+ ...s,
2681
+ {
2682
+ className: "string",
2683
+ // any character other than `)` as in `url()` will be the start
2684
+ // of a string, which ends with `)` (from the parent mode)
2685
+ begin: /[^)]/,
2686
+ endsWithParent: !0,
2687
+ excludeEnd: !0
2688
+ }
2689
+ ]
2690
+ },
2691
+ n.FUNCTION_DISPATCH
2692
+ ]
2693
+ },
2694
+ {
2695
+ begin: t.lookahead(/@/),
2696
+ end: "[{;]",
2697
+ relevance: 0,
2698
+ illegal: /:/,
2699
+ // break on Less variables @var: ...
2700
+ contains: [
2701
+ {
2702
+ className: "keyword",
2703
+ begin: f
2704
+ },
2705
+ {
2706
+ begin: /\s/,
2707
+ endsWithParent: !0,
2708
+ excludeEnd: !0,
2709
+ relevance: 0,
2710
+ keywords: {
2711
+ $pattern: /[a-z-]+/,
2712
+ keyword: u,
2713
+ attribute: pn.join(" ")
2714
+ },
2715
+ contains: [
2716
+ {
2717
+ begin: /[a-z-]+(?=:)/,
2718
+ className: "attribute"
2719
+ },
2720
+ ...s,
2721
+ n.CSS_NUMBER_MODE
2722
+ ]
2723
+ }
2724
+ ]
2725
+ },
2726
+ {
2727
+ className: "selector-tag",
2728
+ begin: "\\b(" + fn.join("|") + ")\\b"
2729
+ }
2730
+ ]
2731
+ };
2732
+ }
2733
+ const nt = document.createElement("style");
2734
+ nt.innerText = [gt, ft].join(`
2735
+ `);
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");
2747
+ });
2748
+ }), n.appendChild(t), n.appendChild(i), i.classList.add("tab-content"), e[0].setAttribute("selected", ""), i.appendChild(e[0].content), n;
2749
+ }
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;
2753
+ }
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;
2759
+ }
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)
2772
+ )
2773
+ ] : [],
2774
+ ...(t.additionalSources || []).map((w) => Y(w.label, ae(w.language, w.content)))
2775
+ );
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);
2779
+ }
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(`
2789
+ `).trim();
2790
+ return e && e != "raw" && (n = ue.highlight(n, { language: e }).value), q("pre", [q("code", n)]);
2791
+ }
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);
2795
+ }
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++);
2804
+ });
2805
+ }
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;
2811
+ }
2812
+ function Nn(e) {
2813
+ return e.children ? wn(e) : e;
2814
+ }
2815
+ export {
2816
+ yn as initialize,
2817
+ An as initializeExamplesForModules,
2818
+ xn as loadPrefixedStylesheet
2819
+ };
2820
+ //# sourceMappingURL=element-preview.mjs.map