@plebeiantech/lat.md 0.12.3-fork.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.
Files changed (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +97 -0
  3. package/dist/src/cli/check-frontmatter.d.ts +12 -0
  4. package/dist/src/cli/check-frontmatter.js +44 -0
  5. package/dist/src/cli/check-mode.d.ts +6 -0
  6. package/dist/src/cli/check-mode.js +303 -0
  7. package/dist/src/cli/check-status.d.ts +74 -0
  8. package/dist/src/cli/check-status.js +217 -0
  9. package/dist/src/cli/check.d.ts +45 -0
  10. package/dist/src/cli/check.js +777 -0
  11. package/dist/src/cli/checklist-menu.d.ts +12 -0
  12. package/dist/src/cli/checklist-menu.js +111 -0
  13. package/dist/src/cli/comment-guard.d.ts +16 -0
  14. package/dist/src/cli/comment-guard.js +111 -0
  15. package/dist/src/cli/comment-reminder.d.ts +62 -0
  16. package/dist/src/cli/comment-reminder.js +210 -0
  17. package/dist/src/cli/context.d.ts +11 -0
  18. package/dist/src/cli/context.js +58 -0
  19. package/dist/src/cli/expand.d.ts +8 -0
  20. package/dist/src/cli/expand.js +94 -0
  21. package/dist/src/cli/gen-index.d.ts +45 -0
  22. package/dist/src/cli/gen-index.js +235 -0
  23. package/dist/src/cli/gen.d.ts +6 -0
  24. package/dist/src/cli/gen.js +42 -0
  25. package/dist/src/cli/graph.d.ts +7 -0
  26. package/dist/src/cli/graph.js +47 -0
  27. package/dist/src/cli/hook.d.ts +1 -0
  28. package/dist/src/cli/hook.js +432 -0
  29. package/dist/src/cli/index.d.ts +2 -0
  30. package/dist/src/cli/index.js +307 -0
  31. package/dist/src/cli/init.d.ts +9 -0
  32. package/dist/src/cli/init.js +1031 -0
  33. package/dist/src/cli/link-scheme.d.ts +54 -0
  34. package/dist/src/cli/link-scheme.js +101 -0
  35. package/dist/src/cli/locate.d.ts +2 -0
  36. package/dist/src/cli/locate.js +17 -0
  37. package/dist/src/cli/refs.d.ts +22 -0
  38. package/dist/src/cli/refs.js +229 -0
  39. package/dist/src/cli/reindex.d.ts +13 -0
  40. package/dist/src/cli/reindex.js +136 -0
  41. package/dist/src/cli/search.d.ts +36 -0
  42. package/dist/src/cli/search.js +217 -0
  43. package/dist/src/cli/section.d.ts +43 -0
  44. package/dist/src/cli/section.js +252 -0
  45. package/dist/src/cli/select-menu.d.ts +13 -0
  46. package/dist/src/cli/select-menu.js +100 -0
  47. package/dist/src/cli/templates.d.ts +1 -0
  48. package/dist/src/cli/templates.js +15 -0
  49. package/dist/src/cli/ui.d.ts +11 -0
  50. package/dist/src/cli/ui.js +34 -0
  51. package/dist/src/code-refs.d.ts +17 -0
  52. package/dist/src/code-refs.js +277 -0
  53. package/dist/src/config.d.ts +29 -0
  54. package/dist/src/config.js +83 -0
  55. package/dist/src/context.d.ts +23 -0
  56. package/dist/src/context.js +11 -0
  57. package/dist/src/extensions/wiki-link/from-markdown.d.ts +5 -0
  58. package/dist/src/extensions/wiki-link/from-markdown.js +34 -0
  59. package/dist/src/extensions/wiki-link/index.d.ts +4 -0
  60. package/dist/src/extensions/wiki-link/index.js +3 -0
  61. package/dist/src/extensions/wiki-link/syntax.d.ts +14 -0
  62. package/dist/src/extensions/wiki-link/syntax.js +121 -0
  63. package/dist/src/extensions/wiki-link/to-markdown.d.ts +5 -0
  64. package/dist/src/extensions/wiki-link/to-markdown.js +28 -0
  65. package/dist/src/extensions/wiki-link/types.d.ts +34 -0
  66. package/dist/src/extensions/wiki-link/types.js +1 -0
  67. package/dist/src/format.d.ts +8 -0
  68. package/dist/src/format.js +43 -0
  69. package/dist/src/graph-export.d.ts +60 -0
  70. package/dist/src/graph-export.js +309 -0
  71. package/dist/src/init-version.d.ts +10 -0
  72. package/dist/src/init-version.js +49 -0
  73. package/dist/src/knowledge/bd.d.ts +2 -0
  74. package/dist/src/knowledge/bd.js +107 -0
  75. package/dist/src/knowledge/claude-memory.d.ts +13 -0
  76. package/dist/src/knowledge/claude-memory.js +204 -0
  77. package/dist/src/knowledge/cq.d.ts +2 -0
  78. package/dist/src/knowledge/cq.js +74 -0
  79. package/dist/src/knowledge/index.d.ts +49 -0
  80. package/dist/src/knowledge/index.js +271 -0
  81. package/dist/src/knowledge/ranking.d.ts +17 -0
  82. package/dist/src/knowledge/ranking.js +62 -0
  83. package/dist/src/knowledge/session.d.ts +46 -0
  84. package/dist/src/knowledge/session.js +203 -0
  85. package/dist/src/knowledge/types.d.ts +47 -0
  86. package/dist/src/knowledge/types.js +10 -0
  87. package/dist/src/lattice.d.ts +108 -0
  88. package/dist/src/lattice.js +816 -0
  89. package/dist/src/mcp/server.d.ts +1 -0
  90. package/dist/src/mcp/server.js +58 -0
  91. package/dist/src/parser.d.ts +3 -0
  92. package/dist/src/parser.js +18 -0
  93. package/dist/src/search/db.d.ts +16 -0
  94. package/dist/src/search/db.js +54 -0
  95. package/dist/src/search/embedder.d.ts +25 -0
  96. package/dist/src/search/embedder.js +58 -0
  97. package/dist/src/search/index.d.ts +9 -0
  98. package/dist/src/search/index.js +66 -0
  99. package/dist/src/search/search.d.ts +9 -0
  100. package/dist/src/search/search.js +16 -0
  101. package/dist/src/source-parser.d.ts +27 -0
  102. package/dist/src/source-parser.js +916 -0
  103. package/dist/src/untrusted.d.ts +24 -0
  104. package/dist/src/untrusted.js +97 -0
  105. package/dist/src/version.d.ts +7 -0
  106. package/dist/src/version.js +39 -0
  107. package/dist/src/view/client/assets/index-B0n0u03y.css +1 -0
  108. package/dist/src/view/client/assets/index-xm2_px4q.js +23 -0
  109. package/dist/src/view/client/index.html +14 -0
  110. package/dist/src/view/diagnostics.d.ts +5 -0
  111. package/dist/src/view/diagnostics.js +171 -0
  112. package/dist/src/view/git-diff.d.ts +3 -0
  113. package/dist/src/view/git-diff.js +255 -0
  114. package/dist/src/view/git.d.ts +22 -0
  115. package/dist/src/view/git.js +193 -0
  116. package/dist/src/view/highlight.d.ts +2 -0
  117. package/dist/src/view/highlight.js +3767 -0
  118. package/dist/src/view/markdown.d.ts +22 -0
  119. package/dist/src/view/markdown.js +322 -0
  120. package/dist/src/view/protocol.d.ts +89 -0
  121. package/dist/src/view/protocol.js +1 -0
  122. package/dist/src/view/references.d.ts +62 -0
  123. package/dist/src/view/references.js +345 -0
  124. package/dist/src/view/repository.d.ts +12 -0
  125. package/dist/src/view/repository.js +167 -0
  126. package/dist/src/view/search.d.ts +14 -0
  127. package/dist/src/view/search.js +64 -0
  128. package/dist/src/view/server.d.ts +20 -0
  129. package/dist/src/view/server.js +233 -0
  130. package/dist/src/view/store.d.ts +57 -0
  131. package/dist/src/view/store.js +404 -0
  132. package/dist/src/walk.d.ts +18 -0
  133. package/dist/src/walk.js +27 -0
  134. package/package.json +85 -0
  135. package/templates/AGENTS.md +118 -0
  136. package/templates/README +1 -0
  137. package/templates/cursor-rules.md +77 -0
  138. package/templates/init/lat.md +1 -0
  139. package/templates/logo-dark.svg +182 -0
  140. package/templates/logo-light.svg +182 -0
  141. package/templates/logo.txt +7 -0
  142. package/templates/opencode-plugin.ts +180 -0
  143. package/templates/pi-extension.ts +364 -0
  144. package/templates/skill/SKILL.md +189 -0
@@ -0,0 +1,3767 @@
1
+ /*!
2
+ BSD 3-Clause License
3
+
4
+ Copyright (c) 2006, Ivan Sagalaev.
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice, this
11
+ list of conditions and the following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above copyright notice,
14
+ this list of conditions and the following disclaimer in the documentation
15
+ and/or other materials provided with the distribution.
16
+
17
+ * Neither the name of the copyright holder nor the names of its
18
+ contributors may be used to endorse or promote products derived from
19
+ this software without specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ import { extname as st } from "node:path";
33
+ function it(t) {
34
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
35
+ }
36
+ var Ue, nn;
37
+ function rt() {
38
+ if (nn) return Ue;
39
+ nn = 1;
40
+ function t(e) {
41
+ return e instanceof Map ? e.clear = e.delete = e.set = function() {
42
+ throw new Error("map is read-only");
43
+ } : e instanceof Set && (e.add = e.clear = e.delete = function() {
44
+ throw new Error("set is read-only");
45
+ }), Object.freeze(e), Object.getOwnPropertyNames(e).forEach((n) => {
46
+ const i = e[n], E = typeof i;
47
+ (E === "object" || E === "function") && !Object.isFrozen(i) && t(i);
48
+ }), e;
49
+ }
50
+ class g {
51
+ /**
52
+ * @param {CompiledMode} mode
53
+ */
54
+ constructor(n) {
55
+ n.data === void 0 && (n.data = {}), this.data = n.data, this.isMatchIgnored = !1;
56
+ }
57
+ ignoreMatch() {
58
+ this.isMatchIgnored = !0;
59
+ }
60
+ }
61
+ function d(e) {
62
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
63
+ }
64
+ function o(e, ...n) {
65
+ const i = /* @__PURE__ */ Object.create(null);
66
+ for (const E in e)
67
+ i[E] = e[E];
68
+ return n.forEach(function(E) {
69
+ for (const x in E)
70
+ i[x] = E[x];
71
+ }), /** @type {T} */
72
+ i;
73
+ }
74
+ const A = "</span>", D = (e) => !!e.scope, y = (e, { prefix: n }) => {
75
+ if (e.startsWith("language:"))
76
+ return e.replace("language:", "language-");
77
+ if (e.includes(".")) {
78
+ const i = e.split(".");
79
+ return [
80
+ `${n}${i.shift()}`,
81
+ ...i.map((E, x) => `${E}${"_".repeat(x + 1)}`)
82
+ ].join(" ");
83
+ }
84
+ return `${n}${e}`;
85
+ };
86
+ class h {
87
+ /**
88
+ * Creates a new HTMLRenderer
89
+ *
90
+ * @param {Tree} parseTree - the parse tree (must support `walk` API)
91
+ * @param {{classPrefix: string}} options
92
+ */
93
+ constructor(n, i) {
94
+ this.buffer = "", this.classPrefix = i.classPrefix, n.walk(this);
95
+ }
96
+ /**
97
+ * Adds texts to the output stream
98
+ *
99
+ * @param {string} text */
100
+ addText(n) {
101
+ this.buffer += d(n);
102
+ }
103
+ /**
104
+ * Adds a node open to the output stream (if needed)
105
+ *
106
+ * @param {Node} node */
107
+ openNode(n) {
108
+ if (!D(n)) return;
109
+ const i = y(
110
+ n.scope,
111
+ { prefix: this.classPrefix }
112
+ );
113
+ this.span(i);
114
+ }
115
+ /**
116
+ * Adds a node close to the output stream (if needed)
117
+ *
118
+ * @param {Node} node */
119
+ closeNode(n) {
120
+ D(n) && (this.buffer += A);
121
+ }
122
+ /**
123
+ * returns the accumulated buffer
124
+ */
125
+ value() {
126
+ return this.buffer;
127
+ }
128
+ // helpers
129
+ /**
130
+ * Builds a span element
131
+ *
132
+ * @param {string} className */
133
+ span(n) {
134
+ this.buffer += `<span class="${n}">`;
135
+ }
136
+ }
137
+ const M = (e = {}) => {
138
+ const n = { children: [] };
139
+ return Object.assign(n, e), n;
140
+ };
141
+ class w {
142
+ constructor() {
143
+ this.rootNode = M(), this.stack = [this.rootNode];
144
+ }
145
+ get top() {
146
+ return this.stack[this.stack.length - 1];
147
+ }
148
+ get root() {
149
+ return this.rootNode;
150
+ }
151
+ /** @param {Node} node */
152
+ add(n) {
153
+ this.top.children.push(n);
154
+ }
155
+ /** @param {string} scope */
156
+ openNode(n) {
157
+ const i = M({ scope: n });
158
+ this.add(i), this.stack.push(i);
159
+ }
160
+ closeNode() {
161
+ if (this.stack.length > 1)
162
+ return this.stack.pop();
163
+ }
164
+ closeAllNodes() {
165
+ for (; this.closeNode(); ) ;
166
+ }
167
+ toJSON() {
168
+ return JSON.stringify(this.rootNode, null, 4);
169
+ }
170
+ /**
171
+ * @typedef { import("./html_renderer").Renderer } Renderer
172
+ * @param {Renderer} builder
173
+ */
174
+ walk(n) {
175
+ return this.constructor._walk(n, this.rootNode);
176
+ }
177
+ /**
178
+ * @param {Renderer} builder
179
+ * @param {Node} node
180
+ */
181
+ static _walk(n, i) {
182
+ return typeof i == "string" ? n.addText(i) : i.children && (n.openNode(i), i.children.forEach((E) => this._walk(n, E)), n.closeNode(i)), n;
183
+ }
184
+ /**
185
+ * @param {Node} node
186
+ */
187
+ static _collapse(n) {
188
+ typeof n != "string" && n.children && (n.children.every((i) => typeof i == "string") ? n.children = [n.children.join("")] : n.children.forEach((i) => {
189
+ w._collapse(i);
190
+ }));
191
+ }
192
+ }
193
+ class I extends w {
194
+ /**
195
+ * @param {*} options
196
+ */
197
+ constructor(n) {
198
+ super(), this.options = n;
199
+ }
200
+ /**
201
+ * @param {string} text
202
+ */
203
+ addText(n) {
204
+ n !== "" && this.add(n);
205
+ }
206
+ /** @param {string} scope */
207
+ startScope(n) {
208
+ this.openNode(n);
209
+ }
210
+ endScope() {
211
+ this.closeNode();
212
+ }
213
+ /**
214
+ * @param {Emitter & {root: DataNode}} emitter
215
+ * @param {string} name
216
+ */
217
+ __addSublanguage(n, i) {
218
+ const E = n.root;
219
+ i && (E.scope = `language:${i}`), this.add(E);
220
+ }
221
+ toHTML() {
222
+ return new h(this, this.options).value();
223
+ }
224
+ finalize() {
225
+ return this.closeAllNodes(), !0;
226
+ }
227
+ }
228
+ function C(e) {
229
+ return e ? typeof e == "string" ? e : e.source : null;
230
+ }
231
+ function T(e) {
232
+ return R("(?=", e, ")");
233
+ }
234
+ function F(e) {
235
+ return R("(?:", e, ")*");
236
+ }
237
+ function L(e) {
238
+ return R("(?:", e, ")?");
239
+ }
240
+ function R(...e) {
241
+ return e.map((i) => C(i)).join("");
242
+ }
243
+ function Z(e) {
244
+ const n = e[e.length - 1];
245
+ return typeof n == "object" && n.constructor === Object ? (e.splice(e.length - 1, 1), n) : {};
246
+ }
247
+ function Y(...e) {
248
+ return "(" + (Z(e).capture ? "" : "?:") + e.map((E) => C(E)).join("|") + ")";
249
+ }
250
+ function W(e) {
251
+ return new RegExp(e.toString() + "|").exec("").length - 1;
252
+ }
253
+ function Q(e, n) {
254
+ const i = e && e.exec(n);
255
+ return i && i.index === 0;
256
+ }
257
+ const U = new RegExp(Y(
258
+ /\[(?:[^\\\]]|\\.)*\]/,
259
+ // a character class, inside which ( and \ lose their meaning
260
+ /\(\?<(?![=!])[^>]+>/,
261
+ // a named capture group `(?<name>` (not a lookbehind `(?<=` / `(?<!`)
262
+ /\(\?'[^']+'/,
263
+ // a named capture group `(?'name'`
264
+ /\(\??/,
265
+ // an opening parenthesis, capturing or non-capturing / lookahead
266
+ /\\([1-9][0-9]*)/,
267
+ // a backreference like `\1`
268
+ /\\./
269
+ // any other escape sequence
270
+ ));
271
+ function G(e, { joinWith: n }) {
272
+ let i = 0;
273
+ return e.map((E) => {
274
+ i += 1;
275
+ const x = i;
276
+ let v = C(E), c = "";
277
+ for (; v.length > 0; ) {
278
+ const a = U.exec(v);
279
+ if (!a) {
280
+ c += v;
281
+ break;
282
+ }
283
+ c += v.substring(0, a.index), v = v.substring(a.index + a[0].length), a[0][0] === "\\" && a[1] ? c += "\\" + String(Number(a[1]) + x) : (c += a[0], (a[0] === "(" || /^\(\?[<']/.test(a[0])) && i++);
284
+ }
285
+ return c;
286
+ }).map((E) => `(${E})`).join(n);
287
+ }
288
+ const K = /\b\B/, re = "[a-zA-Z]\\w*", ne = "[a-zA-Z_]\\w*", de = "\\b\\d+(\\.\\d+)?", Ee = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", _e = "\\b(0b[01]+)", he = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", Se = (e = {}) => {
289
+ const n = /^#![ ]*\//;
290
+ return e.binary && (e.begin = R(
291
+ n,
292
+ /.*\b/,
293
+ e.binary,
294
+ /\b.*/
295
+ )), o({
296
+ scope: "meta",
297
+ begin: n,
298
+ end: /$/,
299
+ relevance: 0,
300
+ /** @type {ModeCallback} */
301
+ "on:begin": (i, E) => {
302
+ i.index !== 0 && E.ignoreMatch();
303
+ }
304
+ }, e);
305
+ }, te = {
306
+ begin: "\\\\[\\s\\S]",
307
+ relevance: 0
308
+ }, Ae = {
309
+ scope: "string",
310
+ begin: "'",
311
+ end: "'",
312
+ illegal: "\\n",
313
+ contains: [te]
314
+ }, oe = {
315
+ scope: "string",
316
+ begin: '"',
317
+ end: '"',
318
+ illegal: "\\n",
319
+ contains: [te]
320
+ }, Ne = {
321
+ 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/
322
+ }, S = function(e, n, i = {}) {
323
+ const E = o(
324
+ {
325
+ scope: "comment",
326
+ begin: e,
327
+ end: n,
328
+ contains: []
329
+ },
330
+ i
331
+ );
332
+ E.contains.push({
333
+ scope: "doctag",
334
+ // hack to avoid the space from being included. the space is necessary to
335
+ // match here to prevent the plain text rule below from gobbling up doctags
336
+ begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
337
+ end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
338
+ excludeBegin: !0,
339
+ relevance: 0
340
+ });
341
+ const x = Y(
342
+ // list of common 1 and 2 letter words in English
343
+ "I",
344
+ "a",
345
+ "is",
346
+ "so",
347
+ "us",
348
+ "to",
349
+ "at",
350
+ "if",
351
+ "in",
352
+ "it",
353
+ "on",
354
+ // note: this is not an exhaustive list of contractions, just popular ones
355
+ /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,
356
+ // contractions - can't we'd they're let's, etc
357
+ /[A-Za-z]+[-][a-z]+/,
358
+ // `no-way`, etc.
359
+ /[A-Za-z][a-z]{2,}/
360
+ // allow capitalized words at beginning of sentences
361
+ );
362
+ return E.contains.push(
363
+ {
364
+ // TODO: how to include ", (, ) without breaking grammars that use these for
365
+ // comment delimiters?
366
+ // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
367
+ // ---
368
+ // this tries to find sequences of 3 english words in a row (without any
369
+ // "programming" type syntax) this gives us a strong signal that we've
370
+ // TRULY found a comment - vs perhaps scanning with the wrong language.
371
+ // It's possible to find something that LOOKS like the start of the
372
+ // comment - but then if there is no readable text - good chance it is a
373
+ // false match and not a comment.
374
+ //
375
+ // for a visual example please see:
376
+ // https://github.com/highlightjs/highlight.js/issues/2827
377
+ begin: R(
378
+ /[ ]+/,
379
+ // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
380
+ "(",
381
+ x,
382
+ /[.]?[:]?([.][ ]|[ ])/,
383
+ "){3}"
384
+ )
385
+ // look for 3 words in a row
386
+ }
387
+ ), E;
388
+ }, z = S("//", "$"), X = S("/\\*", "\\*/"), J = S("#", "$"), se = {
389
+ scope: "number",
390
+ begin: de,
391
+ relevance: 0
392
+ }, le = {
393
+ scope: "number",
394
+ begin: Ee,
395
+ relevance: 0
396
+ }, En = {
397
+ scope: "number",
398
+ begin: _e,
399
+ relevance: 0
400
+ }, _n = {
401
+ scope: "regexp",
402
+ begin: /\/(?=[^/\n]*\/)/,
403
+ end: /\/[gimuy]*/,
404
+ contains: [
405
+ te,
406
+ {
407
+ begin: /\[/,
408
+ end: /\]/,
409
+ relevance: 0,
410
+ contains: [te]
411
+ }
412
+ ]
413
+ }, bn = {
414
+ scope: "title",
415
+ begin: re,
416
+ relevance: 0
417
+ }, pn = {
418
+ scope: "title",
419
+ begin: ne,
420
+ relevance: 0
421
+ }, hn = {
422
+ // excludes method names from keyword processing
423
+ begin: "\\.\\s*" + ne,
424
+ relevance: 0
425
+ };
426
+ var ye = /* @__PURE__ */ Object.freeze({
427
+ __proto__: null,
428
+ APOS_STRING_MODE: Ae,
429
+ BACKSLASH_ESCAPE: te,
430
+ BINARY_NUMBER_MODE: En,
431
+ BINARY_NUMBER_RE: _e,
432
+ COMMENT: S,
433
+ C_BLOCK_COMMENT_MODE: X,
434
+ C_LINE_COMMENT_MODE: z,
435
+ C_NUMBER_MODE: le,
436
+ C_NUMBER_RE: Ee,
437
+ END_SAME_AS_BEGIN: function(e) {
438
+ return Object.assign(
439
+ e,
440
+ {
441
+ /** @type {ModeCallback} */
442
+ "on:begin": (n, i) => {
443
+ i.data._beginMatch = n[1];
444
+ },
445
+ /** @type {ModeCallback} */
446
+ "on:end": (n, i) => {
447
+ i.data._beginMatch !== n[1] && i.ignoreMatch();
448
+ }
449
+ }
450
+ );
451
+ },
452
+ HASH_COMMENT_MODE: J,
453
+ IDENT_RE: re,
454
+ MATCH_NOTHING_RE: K,
455
+ METHOD_GUARD: hn,
456
+ NUMBER_MODE: se,
457
+ NUMBER_RE: de,
458
+ PHRASAL_WORDS_MODE: Ne,
459
+ QUOTE_STRING_MODE: oe,
460
+ REGEXP_MODE: _n,
461
+ RE_STARTERS_RE: he,
462
+ SHEBANG: Se,
463
+ TITLE_MODE: bn,
464
+ UNDERSCORE_IDENT_RE: ne,
465
+ UNDERSCORE_TITLE_MODE: pn
466
+ });
467
+ function Sn(e, n) {
468
+ e.input[e.index - 1] === "." && n.ignoreMatch();
469
+ }
470
+ function An(e, n) {
471
+ e.className !== void 0 && (e.scope = e.className, delete e.className);
472
+ }
473
+ function Nn(e, n) {
474
+ n && e.beginKeywords && (e.begin = "\\b(" + e.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", e.__beforeBegin = Sn, e.keywords = e.keywords || e.beginKeywords, delete e.beginKeywords, e.relevance === void 0 && (e.relevance = 0));
475
+ }
476
+ function Tn(e, n) {
477
+ Array.isArray(e.illegal) && (e.illegal = Y(...e.illegal));
478
+ }
479
+ function yn(e, n) {
480
+ if (e.match) {
481
+ if (e.begin || e.end) throw new Error("begin & end are not supported with match");
482
+ e.begin = e.match, delete e.match;
483
+ }
484
+ }
485
+ function Rn(e, n) {
486
+ e.relevance === void 0 && (e.relevance = 1);
487
+ }
488
+ const On = (e, n) => {
489
+ if (!e.beforeMatch) return;
490
+ if (e.starts) throw new Error("beforeMatch cannot be used with starts");
491
+ const i = Object.assign({}, e);
492
+ Object.keys(e).forEach((E) => {
493
+ delete e[E];
494
+ }), e.keywords = i.keywords, e.begin = R(i.beforeMatch, T(i.begin)), e.starts = {
495
+ relevance: 0,
496
+ contains: [
497
+ Object.assign(i, { endsParent: !0 })
498
+ ]
499
+ }, e.relevance = 0, delete i.beforeMatch;
500
+ }, mn = [
501
+ "of",
502
+ "and",
503
+ "for",
504
+ "in",
505
+ "not",
506
+ "or",
507
+ "if",
508
+ "then",
509
+ "parent",
510
+ // common variable name
511
+ "list",
512
+ // common variable name
513
+ "value"
514
+ // common variable name
515
+ ], Mn = "keyword";
516
+ function $e(e, n, i = Mn) {
517
+ const E = /* @__PURE__ */ Object.create(null);
518
+ return typeof e == "string" ? x(i, e.split(" ")) : Array.isArray(e) ? x(i, e) : Object.keys(e).forEach(function(v) {
519
+ Object.assign(
520
+ E,
521
+ $e(e[v], n, v)
522
+ );
523
+ }), E;
524
+ function x(v, c) {
525
+ n && (c = c.map((a) => a.toLowerCase())), c.forEach(function(a) {
526
+ const f = a.split("|");
527
+ E[f[0]] = [v, wn(f[0], f[1])];
528
+ });
529
+ }
530
+ }
531
+ function wn(e, n) {
532
+ return n ? Number(n) : In(e) ? 0 : 1;
533
+ }
534
+ function In(e) {
535
+ return mn.includes(e.toLowerCase());
536
+ }
537
+ const Fe = {}, ue = (e) => {
538
+ console.error(e);
539
+ }, He = (e, ...n) => {
540
+ console.log(`WARN: ${e}`, ...n);
541
+ }, be = (e, n) => {
542
+ Fe[`${e}/${n}`] || (console.log(`Deprecated as of ${e}. ${n}`), Fe[`${e}/${n}`] = !0);
543
+ }, Re = new Error();
544
+ function Ge(e, n, { key: i }) {
545
+ let E = 0;
546
+ const x = e[i], v = {}, c = {};
547
+ for (let a = 1; a <= n.length; a++)
548
+ c[a + E] = x[a], v[a + E] = !0, E += W(n[a - 1]);
549
+ e[i] = c, e[i]._emit = v, e[i]._multi = !0;
550
+ }
551
+ function Cn(e) {
552
+ if (Array.isArray(e.begin)) {
553
+ if (e.skip || e.excludeBegin || e.returnBegin)
554
+ throw ue("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), Re;
555
+ if (typeof e.beginScope != "object" || e.beginScope === null)
556
+ throw ue("beginScope must be object"), Re;
557
+ Ge(e, e.begin, { key: "beginScope" }), e.begin = G(e.begin, { joinWith: "" });
558
+ }
559
+ }
560
+ function xn(e) {
561
+ if (Array.isArray(e.end)) {
562
+ if (e.skip || e.excludeEnd || e.returnEnd)
563
+ throw ue("skip, excludeEnd, returnEnd not compatible with endScope: {}"), Re;
564
+ if (typeof e.endScope != "object" || e.endScope === null)
565
+ throw ue("endScope must be object"), Re;
566
+ Ge(e, e.end, { key: "endScope" }), e.end = G(e.end, { joinWith: "" });
567
+ }
568
+ }
569
+ function vn(e) {
570
+ e.scope && typeof e.scope == "object" && e.scope !== null && (e.beginScope = e.scope, delete e.scope);
571
+ }
572
+ function Ln(e) {
573
+ vn(e), typeof e.beginScope == "string" && (e.beginScope = { _wrap: e.beginScope }), typeof e.endScope == "string" && (e.endScope = { _wrap: e.endScope }), Cn(e), xn(e);
574
+ }
575
+ function kn(e) {
576
+ function n(c, a) {
577
+ return new RegExp(
578
+ C(c),
579
+ "m" + (e.case_insensitive ? "i" : "") + (e.unicodeRegex ? "u" : "") + (a ? "g" : "")
580
+ );
581
+ }
582
+ class i {
583
+ constructor() {
584
+ this.matchIndexes = {}, this.regexes = [], this.matchAt = 1, this.position = 0;
585
+ }
586
+ // @ts-ignore
587
+ addRule(a, f) {
588
+ f.position = this.position++, this.matchIndexes[this.matchAt] = f, this.regexes.push([f, a]), this.matchAt += W(a) + 1;
589
+ }
590
+ compile() {
591
+ this.regexes.length === 0 && (this.exec = () => null);
592
+ const a = this.regexes.map((f) => f[1]);
593
+ this.matcherRe = n(G(a, { joinWith: "|" }), !0), this.lastIndex = 0;
594
+ }
595
+ /** @param {string} s */
596
+ exec(a) {
597
+ this.matcherRe.lastIndex = this.lastIndex;
598
+ const f = this.matcherRe.exec(a);
599
+ if (!f)
600
+ return null;
601
+ const P = f.findIndex((Te, ve) => ve > 0 && Te !== void 0), k = this.matchIndexes[P];
602
+ return f.splice(0, P), Object.assign(f, k);
603
+ }
604
+ }
605
+ class E {
606
+ constructor() {
607
+ this.rules = [], this.multiRegexes = [], this.count = 0, this.lastIndex = 0, this.regexIndex = 0;
608
+ }
609
+ // @ts-ignore
610
+ getMatcher(a) {
611
+ if (this.multiRegexes[a]) return this.multiRegexes[a];
612
+ const f = new i();
613
+ return this.rules.slice(a).forEach(([P, k]) => f.addRule(P, k)), f.compile(), this.multiRegexes[a] = f, f;
614
+ }
615
+ resumingScanAtSamePosition() {
616
+ return this.regexIndex !== 0;
617
+ }
618
+ considerAll() {
619
+ this.regexIndex = 0;
620
+ }
621
+ // @ts-ignore
622
+ addRule(a, f) {
623
+ this.rules.push([a, f]), f.type === "begin" && this.count++;
624
+ }
625
+ /** @param {string} s */
626
+ exec(a) {
627
+ const f = this.getMatcher(this.regexIndex);
628
+ f.lastIndex = this.lastIndex;
629
+ let P = f.exec(a);
630
+ if (this.resumingScanAtSamePosition() && !(P && P.index === this.lastIndex)) {
631
+ const k = this.getMatcher(0);
632
+ k.lastIndex = this.lastIndex + 1, P = k.exec(a);
633
+ }
634
+ return P && (this.regexIndex += P.position + 1, this.regexIndex === this.count && this.considerAll()), P;
635
+ }
636
+ }
637
+ function x(c) {
638
+ const a = new E();
639
+ return c.contains.forEach((f) => a.addRule(f.begin, { rule: f, type: "begin" })), c.terminatorEnd && a.addRule(c.terminatorEnd, { type: "end" }), c.illegal && a.addRule(c.illegal, { type: "illegal" }), a;
640
+ }
641
+ function v(c, a) {
642
+ const f = (
643
+ /** @type CompiledMode */
644
+ c
645
+ );
646
+ if (c.isCompiled) return f;
647
+ [
648
+ An,
649
+ // do this early so compiler extensions generally don't have to worry about
650
+ // the distinction between match/begin
651
+ yn,
652
+ Ln,
653
+ On
654
+ ].forEach((k) => k(c, a)), e.compilerExtensions.forEach((k) => k(c, a)), c.__beforeBegin = null, [
655
+ Nn,
656
+ // do this later so compiler extensions that come earlier have access to the
657
+ // raw array if they wanted to perhaps manipulate it, etc.
658
+ Tn,
659
+ // default to 1 relevance if not specified
660
+ Rn
661
+ ].forEach((k) => k(c, a)), c.isCompiled = !0;
662
+ let P = null;
663
+ return typeof c.keywords == "object" && c.keywords.$pattern && (c.keywords = Object.assign({}, c.keywords), P = c.keywords.$pattern, delete c.keywords.$pattern), P = P || /\w+/, c.keywords && (c.keywords = $e(c.keywords, e.case_insensitive)), f.keywordPatternRe = n(P, !0), a && (c.begin || (c.begin = /\B|\b/), f.beginRe = n(f.begin), !c.end && !c.endsWithParent && (c.end = /\B|\b/), c.end && (f.endRe = n(f.end)), f.terminatorEnd = C(f.end) || "", c.endsWithParent && a.terminatorEnd && (f.terminatorEnd += (c.end ? "|" : "") + a.terminatorEnd)), c.illegal && (f.illegalRe = n(
664
+ /** @type {RegExp | string} */
665
+ c.illegal
666
+ )), c.contains || (c.contains = []), c.contains = [].concat(...c.contains.map(function(k) {
667
+ return Dn(k === "self" ? c : k);
668
+ })), c.contains.forEach(function(k) {
669
+ v(
670
+ /** @type Mode */
671
+ k,
672
+ f
673
+ );
674
+ }), c.starts && v(c.starts, a), f.matcher = x(f), f;
675
+ }
676
+ if (e.compilerExtensions || (e.compilerExtensions = []), e.contains && e.contains.includes("self"))
677
+ throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
678
+ return e.classNameAliases = o(e.classNameAliases || {}), v(
679
+ /** @type Mode */
680
+ e
681
+ );
682
+ }
683
+ function Ke(e) {
684
+ return e ? e.endsWithParent || Ke(e.starts) : !1;
685
+ }
686
+ function Dn(e) {
687
+ return e.variants && !e.cachedVariants && (e.cachedVariants = e.variants.map(function(n) {
688
+ return o(e, { variants: null }, n);
689
+ })), e.cachedVariants ? e.cachedVariants : Ke(e) ? o(e, { starts: e.starts ? o(e.starts) : null }) : Object.isFrozen(e) ? o(e) : e;
690
+ }
691
+ var Bn = "11.12.0";
692
+ class Pn extends Error {
693
+ constructor(n, i) {
694
+ super(n), this.name = "HTMLInjectionError", this.html = i;
695
+ }
696
+ }
697
+ const xe = d, ze = o, Ze = /* @__PURE__ */ Symbol("nomatch"), Un = 7, We = function(e) {
698
+ const n = /* @__PURE__ */ Object.create(null), i = /* @__PURE__ */ Object.create(null), E = [];
699
+ let x = !0;
700
+ const v = "Could not find the language '{}', did you forget to load/include a language module?", c = { disableAutodetect: !0, name: "Plain text", contains: [] };
701
+ let a = {
702
+ ignoreUnescapedHTML: !1,
703
+ throwUnescapedHTML: !1,
704
+ noHighlightRe: /^(no-?highlight)$/i,
705
+ languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
706
+ classPrefix: "hljs-",
707
+ cssSelector: "pre code",
708
+ languages: null,
709
+ // beta configuration options, subject to change, welcome to discuss
710
+ // https://github.com/highlightjs/highlight.js/issues/1086
711
+ __emitter: I
712
+ };
713
+ function f(s) {
714
+ return a.noHighlightRe.test(s);
715
+ }
716
+ function P(s) {
717
+ let u = s.className + " ";
718
+ u += s.parentNode ? s.parentNode.className : "";
719
+ const p = a.languageDetectRe.exec(u);
720
+ if (p) {
721
+ const O = ae(p[1]);
722
+ return O || (He(v.replace("{}", p[1])), He("Falling back to no-highlight mode for this block.", s)), O ? p[1] : "no-highlight";
723
+ }
724
+ return u.split(/\s+/).find((O) => f(O) || ae(O));
725
+ }
726
+ function k(s, u, p) {
727
+ let O = "", B = "";
728
+ typeof u == "object" ? (O = s, p = u.ignoreIllegals, B = u.language) : (be("10.7.0", "highlight(lang, code, ...args) has been deprecated."), be("10.7.0", `Please use highlight(code, options) instead.
729
+ https://github.com/highlightjs/highlight.js/issues/2277`), B = s, O = u), p === void 0 && (p = !0);
730
+ const V = {
731
+ code: O,
732
+ language: B
733
+ };
734
+ me("before:highlight", V);
735
+ const ce = V.result ? V.result : Te(V.language, V.code, p);
736
+ return ce.code = V.code, me("after:highlight", ce), ce;
737
+ }
738
+ function Te(s, u, p, O) {
739
+ const B = /* @__PURE__ */ Object.create(null);
740
+ function V(r, l) {
741
+ return r.keywords[l];
742
+ }
743
+ function ce() {
744
+ if (!_.keywords) {
745
+ $.addText(m);
746
+ return;
747
+ }
748
+ let r = 0;
749
+ _.keywordPatternRe.lastIndex = 0;
750
+ let l = _.keywordPatternRe.exec(m), b = "";
751
+ for (; l; ) {
752
+ b += m.substring(r, l.index);
753
+ const N = ee.case_insensitive ? l[0].toLowerCase() : l[0], H = V(_, N);
754
+ if (H) {
755
+ const [ie, nt] = H;
756
+ if ($.addText(b), b = "", B[N] = (B[N] || 0) + 1, B[N] <= Un && (Ie += nt), ie.startsWith("_"))
757
+ b += l[0];
758
+ else {
759
+ const tt = ee.classNameAliases[ie] || ie;
760
+ j(l[0], tt);
761
+ }
762
+ } else
763
+ b += l[0];
764
+ r = _.keywordPatternRe.lastIndex, l = _.keywordPatternRe.exec(m);
765
+ }
766
+ b += m.substring(r), $.addText(b);
767
+ }
768
+ function Me() {
769
+ if (m === "") return;
770
+ let r = null;
771
+ if (typeof _.subLanguage == "string") {
772
+ if (!n[_.subLanguage]) {
773
+ $.addText(m);
774
+ return;
775
+ }
776
+ r = Te(_.subLanguage, m, !0, en[_.subLanguage]), en[_.subLanguage] = /** @type {CompiledMode} */
777
+ r._top;
778
+ } else
779
+ r = Le(m, _.subLanguage.length ? _.subLanguage : null);
780
+ _.relevance > 0 && (Ie += r.relevance), $.__addSublanguage(r._emitter, r.language);
781
+ }
782
+ function q() {
783
+ _.subLanguage != null ? Me() : ce(), m = "";
784
+ }
785
+ function j(r, l) {
786
+ r !== "" && ($.startScope(l), $.addText(r), $.endScope());
787
+ }
788
+ function Je(r, l) {
789
+ let b = 1;
790
+ const N = l.length - 1;
791
+ for (; b <= N; ) {
792
+ if (!r._emit[b]) {
793
+ b++;
794
+ continue;
795
+ }
796
+ const H = ee.classNameAliases[r[b]] || r[b], ie = l[b];
797
+ H ? j(ie, H) : (m = ie, ce(), m = ""), b++;
798
+ }
799
+ }
800
+ function Ve(r, l) {
801
+ return r.scope && typeof r.scope == "string" && $.openNode(ee.classNameAliases[r.scope] || r.scope), r.beginScope && (r.beginScope._wrap ? (j(m, ee.classNameAliases[r.beginScope._wrap] || r.beginScope._wrap), m = "") : r.beginScope._multi && (Je(r.beginScope, l), m = "")), _ = Object.create(r, { parent: { value: _ } }), _;
802
+ }
803
+ function Qe(r, l, b) {
804
+ let N = Q(r.endRe, b);
805
+ if (N) {
806
+ if (r["on:end"]) {
807
+ const H = new g(r);
808
+ r["on:end"](l, H), H.isMatchIgnored && (N = !1);
809
+ }
810
+ if (N) {
811
+ for (; r.endsParent && r.parent; )
812
+ r = r.parent;
813
+ return r;
814
+ }
815
+ }
816
+ if (r.endsWithParent)
817
+ return Qe(r.parent, l, b);
818
+ }
819
+ function Jn(r) {
820
+ return _.matcher.regexIndex === 0 ? (m += r[0], 1) : (Pe = !0, 0);
821
+ }
822
+ function Vn(r) {
823
+ const l = r[0], b = r.rule, N = new g(b), H = [b.__beforeBegin, b["on:begin"]];
824
+ for (const ie of H)
825
+ if (ie && (ie(r, N), N.isMatchIgnored))
826
+ return Jn(l);
827
+ return b.skip ? m += l : (b.excludeBegin && (m += l), q(), !b.returnBegin && !b.excludeBegin && (m = l)), Ve(b, r), b.returnBegin ? 0 : l.length;
828
+ }
829
+ function Qn(r) {
830
+ const l = r[0], b = u.substring(r.index), N = Qe(_, r, b);
831
+ if (!N)
832
+ return Ze;
833
+ const H = _;
834
+ _.endScope && _.endScope._wrap ? (q(), j(l, _.endScope._wrap)) : _.endScope && _.endScope._multi ? (q(), Je(_.endScope, r)) : H.skip ? m += l : (H.returnEnd || H.excludeEnd || (m += l), q(), H.excludeEnd && (m = l));
835
+ do
836
+ _.scope && $.closeNode(), !_.skip && !_.subLanguage && (Ie += _.relevance), _ = _.parent;
837
+ while (_ !== N.parent);
838
+ return N.starts && Ve(N.starts, r), H.returnEnd ? 0 : l.length;
839
+ }
840
+ function jn() {
841
+ const r = [];
842
+ for (let l = _; l !== ee; l = l.parent)
843
+ l.scope && r.unshift(l.scope);
844
+ r.forEach((l) => $.openNode(l));
845
+ }
846
+ let we = {};
847
+ function je(r, l) {
848
+ const b = l && l[0];
849
+ if (m += r, b == null)
850
+ return q(), 0;
851
+ if (we.type === "begin" && l.type === "end" && we.index === l.index && b === "") {
852
+ if (m += u.slice(l.index, l.index + 1), !x) {
853
+ const N = new Error(`0 width match regex (${s})`);
854
+ throw N.languageName = s, N.badRule = we.rule, N;
855
+ }
856
+ return 1;
857
+ }
858
+ if (we = l, l.type === "begin")
859
+ return Vn(l);
860
+ if (l.type === "illegal" && !p) {
861
+ const N = new Error('Illegal lexeme "' + b + '" for mode "' + (_.scope || "<unnamed>") + '"');
862
+ throw N.mode = _, N;
863
+ } else if (l.type === "end") {
864
+ const N = Qn(l);
865
+ if (N !== Ze)
866
+ return N;
867
+ }
868
+ if (l.type === "illegal" && b === "")
869
+ return l.index === u.length || (m += `
870
+ `), 1;
871
+ if (Be > 1e5 && Be > l.index * 3)
872
+ throw new Error("potential infinite loop, way more iterations than matches");
873
+ return m += b, b.length;
874
+ }
875
+ const ee = ae(s);
876
+ if (!ee)
877
+ throw ue(v.replace("{}", s)), new Error('Unknown language: "' + s + '"');
878
+ const et = kn(ee);
879
+ let De = "", _ = O || et;
880
+ const en = {}, $ = new a.__emitter(a);
881
+ jn();
882
+ let m = "", Ie = 0, ge = 0, Be = 0, Pe = !1;
883
+ try {
884
+ if (ee.__emitTokens)
885
+ ee.__emitTokens(u, $);
886
+ else {
887
+ for (_.matcher.considerAll(); ; ) {
888
+ Be++, Pe ? Pe = !1 : _.matcher.considerAll(), _.matcher.lastIndex = ge;
889
+ const r = _.matcher.exec(u);
890
+ if (!r) break;
891
+ const l = u.substring(ge, r.index), b = je(l, r);
892
+ ge = r.index + b;
893
+ }
894
+ je(u.substring(ge));
895
+ }
896
+ return $.finalize(), De = $.toHTML(), {
897
+ language: s,
898
+ value: De,
899
+ relevance: Ie,
900
+ illegal: !1,
901
+ _emitter: $,
902
+ _top: _
903
+ };
904
+ } catch (r) {
905
+ if (r.message && r.message.includes("Illegal"))
906
+ return {
907
+ language: s,
908
+ value: xe(u),
909
+ illegal: !0,
910
+ relevance: 0,
911
+ _illegalBy: {
912
+ message: r.message,
913
+ index: ge,
914
+ context: u.slice(ge - 100, ge + 100),
915
+ mode: r.mode,
916
+ resultSoFar: De
917
+ },
918
+ _emitter: $
919
+ };
920
+ if (x)
921
+ return {
922
+ language: s,
923
+ value: xe(u),
924
+ illegal: !1,
925
+ relevance: 0,
926
+ errorRaised: r,
927
+ _emitter: $,
928
+ _top: _
929
+ };
930
+ throw r;
931
+ }
932
+ }
933
+ function ve(s) {
934
+ const u = {
935
+ value: xe(s),
936
+ illegal: !1,
937
+ relevance: 0,
938
+ _top: c,
939
+ _emitter: new a.__emitter(a)
940
+ };
941
+ return u._emitter.addText(s), u;
942
+ }
943
+ function Le(s, u) {
944
+ u = u || a.languages || Object.keys(n);
945
+ const p = ve(s), O = u.filter(ae).filter(qe).map(
946
+ (q) => Te(q, s, !1)
947
+ );
948
+ O.unshift(p);
949
+ const B = O.sort((q, j) => {
950
+ if (q.relevance !== j.relevance) return j.relevance - q.relevance;
951
+ if (q.language && j.language) {
952
+ if (ae(q.language).supersetOf === j.language)
953
+ return 1;
954
+ if (ae(j.language).supersetOf === q.language)
955
+ return -1;
956
+ }
957
+ return 0;
958
+ }), [V, ce] = B, Me = V;
959
+ return Me.secondBest = ce, Me;
960
+ }
961
+ function $n(s, u, p) {
962
+ const O = u && i[u] || p;
963
+ s.classList.add("hljs"), s.classList.add(`language-${O}`);
964
+ }
965
+ function ke(s) {
966
+ let u = null;
967
+ const p = P(s);
968
+ if (f(p)) return;
969
+ if (me(
970
+ "before:highlightElement",
971
+ { el: s, language: p }
972
+ ), s.dataset.highlighted) {
973
+ console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", s);
974
+ return;
975
+ }
976
+ if (s.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(s)), a.throwUnescapedHTML))
977
+ throw new Pn(
978
+ "One of your code blocks includes unescaped HTML.",
979
+ s.innerHTML
980
+ );
981
+ u = s;
982
+ const O = u.textContent, B = p ? k(O, { language: p, ignoreIllegals: !0 }) : Le(O);
983
+ s.innerHTML = B.value, s.dataset.highlighted = "yes", $n(s, p, B.language), s.result = {
984
+ language: B.language,
985
+ // TODO: remove with version 11.0
986
+ re: B.relevance,
987
+ relevance: B.relevance
988
+ }, B.secondBest && (s.secondBest = {
989
+ language: B.secondBest.language,
990
+ relevance: B.secondBest.relevance
991
+ }), me("after:highlightElement", { el: s, result: B, text: O });
992
+ }
993
+ function Fn(s) {
994
+ a = ze(a, s);
995
+ }
996
+ const Hn = () => {
997
+ Oe(), be("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
998
+ };
999
+ function Gn() {
1000
+ Oe(), be("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
1001
+ }
1002
+ let Ye = !1;
1003
+ function Oe() {
1004
+ function s() {
1005
+ Oe();
1006
+ }
1007
+ if (document.readyState === "loading") {
1008
+ Ye || window.addEventListener("DOMContentLoaded", s, !1), Ye = !0;
1009
+ return;
1010
+ }
1011
+ document.querySelectorAll(a.cssSelector).forEach(ke);
1012
+ }
1013
+ function Kn(s, u) {
1014
+ let p = null;
1015
+ try {
1016
+ p = u(e);
1017
+ } catch (O) {
1018
+ if (ue("Language definition for '{}' could not be registered.".replace("{}", s)), x)
1019
+ ue(O);
1020
+ else
1021
+ throw O;
1022
+ p = c;
1023
+ }
1024
+ p.name || (p.name = s), n[s] = p, p.rawDefinition = u.bind(null, e), p.aliases && Xe(p.aliases, { languageName: s });
1025
+ }
1026
+ function zn(s) {
1027
+ delete n[s];
1028
+ for (const u of Object.keys(i))
1029
+ i[u] === s && delete i[u];
1030
+ }
1031
+ function Zn() {
1032
+ return Object.keys(n);
1033
+ }
1034
+ function ae(s) {
1035
+ return s = (s || "").toLowerCase(), n[s] || n[i[s]];
1036
+ }
1037
+ function Xe(s, { languageName: u }) {
1038
+ typeof s == "string" && (s = [s]), s.forEach((p) => {
1039
+ i[p.toLowerCase()] = u;
1040
+ });
1041
+ }
1042
+ function qe(s) {
1043
+ const u = ae(s);
1044
+ return u && !u.disableAutodetect;
1045
+ }
1046
+ function Wn(s) {
1047
+ s["before:highlightBlock"] && !s["before:highlightElement"] && (s["before:highlightElement"] = (u) => {
1048
+ s["before:highlightBlock"](
1049
+ Object.assign({ block: u.el }, u)
1050
+ );
1051
+ }), s["after:highlightBlock"] && !s["after:highlightElement"] && (s["after:highlightElement"] = (u) => {
1052
+ s["after:highlightBlock"](
1053
+ Object.assign({ block: u.el }, u)
1054
+ );
1055
+ });
1056
+ }
1057
+ function Yn(s) {
1058
+ Wn(s), E.push(s);
1059
+ }
1060
+ function Xn(s) {
1061
+ const u = E.indexOf(s);
1062
+ u !== -1 && E.splice(u, 1);
1063
+ }
1064
+ function me(s, u) {
1065
+ const p = s;
1066
+ E.forEach(function(O) {
1067
+ O[p] && O[p](u);
1068
+ });
1069
+ }
1070
+ function qn(s) {
1071
+ return be("10.7.0", "highlightBlock will be removed entirely in v12.0"), be("10.7.0", "Please use highlightElement now."), ke(s);
1072
+ }
1073
+ Object.assign(e, {
1074
+ highlight: k,
1075
+ highlightAuto: Le,
1076
+ highlightAll: Oe,
1077
+ highlightElement: ke,
1078
+ // TODO: Remove with v12 API
1079
+ highlightBlock: qn,
1080
+ configure: Fn,
1081
+ initHighlighting: Hn,
1082
+ initHighlightingOnLoad: Gn,
1083
+ registerLanguage: Kn,
1084
+ unregisterLanguage: zn,
1085
+ listLanguages: Zn,
1086
+ getLanguage: ae,
1087
+ registerAliases: Xe,
1088
+ autoDetection: qe,
1089
+ inherit: ze,
1090
+ addPlugin: Yn,
1091
+ removePlugin: Xn
1092
+ }), e.debugMode = function() {
1093
+ x = !1;
1094
+ }, e.safeMode = function() {
1095
+ x = !0;
1096
+ }, e.versionString = Bn, e.regex = {
1097
+ concat: R,
1098
+ lookahead: T,
1099
+ either: Y,
1100
+ optional: L,
1101
+ anyNumberOfTimes: F
1102
+ };
1103
+ for (const s in ye)
1104
+ typeof ye[s] == "object" && t(ye[s]);
1105
+ return Object.assign(e, ye), e;
1106
+ }, pe = We({});
1107
+ return pe.newInstance = () => We({}), Ue = pe, pe.HighlightJS = pe, pe.default = pe, Ue;
1108
+ }
1109
+ var at = /* @__PURE__ */ rt();
1110
+ const fe = /* @__PURE__ */ it(at);
1111
+ function ct(t) {
1112
+ const g = t.regex, d = t.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), o = "decltype\\(auto\\)", A = "[a-zA-Z_]\\w*::", y = "(" + o + "|" + g.optional(A) + "[a-zA-Z_]\\w*" + g.optional("<[^<>]+>") + ")", h = g.concat(/\batomic_/, g.either(
1113
+ "bool",
1114
+ "char",
1115
+ "schar",
1116
+ "uchar",
1117
+ "short",
1118
+ "ushort",
1119
+ "int",
1120
+ "uint",
1121
+ "long",
1122
+ "ulong",
1123
+ "llong",
1124
+ "ullong",
1125
+ "char16_t",
1126
+ "char32_t",
1127
+ "wchar_t",
1128
+ "int_least8_t",
1129
+ "uint_least8_t",
1130
+ "int_least16_t",
1131
+ "uint_least16_t",
1132
+ "int_least32_t",
1133
+ "uint_least32_t",
1134
+ "int_least64_t",
1135
+ "uint_least64_t",
1136
+ "int_fast8_t",
1137
+ "uint_fast8_t",
1138
+ "int_fast16_t",
1139
+ "uint_fast16_t",
1140
+ "int_fast32_t",
1141
+ "uint_fast32_t",
1142
+ "int_fast64_t",
1143
+ "uint_fast64_t",
1144
+ "intptr_t",
1145
+ "uintptr_t",
1146
+ "size_t",
1147
+ "ptrdiff_t",
1148
+ "intmax_t",
1149
+ "uintmax_t"
1150
+ ), /\b/), M = {
1151
+ className: "type",
1152
+ variants: [
1153
+ { begin: "\\b[a-z\\d_]*_t\\b" },
1154
+ { match: h }
1155
+ ]
1156
+ }, I = {
1157
+ className: "string",
1158
+ variants: [
1159
+ {
1160
+ begin: '(u8?|U|L)?"',
1161
+ end: '"',
1162
+ illegal: "\\n",
1163
+ contains: [t.BACKSLASH_ESCAPE]
1164
+ },
1165
+ {
1166
+ begin: "(u8?|U|L)?'(" + "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)" + "|.)",
1167
+ end: "'",
1168
+ illegal: "."
1169
+ },
1170
+ // https://en.cppreference.com/w/cpp/language/string_literal
1171
+ // a d-char-sequence never contains parentheses, backslashes or whitespace;
1172
+ // quotes are excluded as well so the closing delimiter cannot swallow the
1173
+ // quote that actually terminates the literal
1174
+ t.END_SAME_AS_BEGIN({
1175
+ begin: /(?:u8?|U|L)?R"([^()\\\s"]{0,16})\(/,
1176
+ end: /\)([^()\\\s"]{0,16})"/
1177
+ })
1178
+ ]
1179
+ }, C = {
1180
+ className: "number",
1181
+ variants: [
1182
+ { match: /\b(0b[01']+)/ },
1183
+ { match: /(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/ },
1184
+ { match: /(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/ },
1185
+ { match: /(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/ }
1186
+ ],
1187
+ relevance: 0
1188
+ }, T = {
1189
+ scope: "meta",
1190
+ begin: /#\s*include\b/,
1191
+ end: /$/,
1192
+ keywords: { keyword: "include" },
1193
+ contains: [
1194
+ {
1195
+ // the `\` at the end of a line signaling continuation
1196
+ begin: /\\\n/
1197
+ },
1198
+ I,
1199
+ {
1200
+ scope: "string",
1201
+ begin: /<.*?>/
1202
+ },
1203
+ d,
1204
+ t.C_BLOCK_COMMENT_MODE
1205
+ ]
1206
+ }, F = {
1207
+ className: "meta",
1208
+ begin: /#\s*[a-z]+\b/,
1209
+ end: /$/,
1210
+ keywords: { keyword: "if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include" },
1211
+ contains: [
1212
+ {
1213
+ begin: /\\\n/,
1214
+ relevance: 0
1215
+ },
1216
+ t.inherit(I, { className: "string" }),
1217
+ d,
1218
+ t.C_BLOCK_COMMENT_MODE
1219
+ ]
1220
+ }, L = [
1221
+ T,
1222
+ F
1223
+ ], R = {
1224
+ className: "title",
1225
+ begin: g.optional(A) + t.IDENT_RE,
1226
+ relevance: 0
1227
+ }, Z = g.optional(A) + t.IDENT_RE + "\\s*\\(", Y = 12, U = {
1228
+ keyword: [
1229
+ "asm",
1230
+ "auto",
1231
+ "break",
1232
+ "case",
1233
+ "continue",
1234
+ "default",
1235
+ "do",
1236
+ "else",
1237
+ "enum",
1238
+ "extern",
1239
+ "for",
1240
+ "fortran",
1241
+ "goto",
1242
+ "if",
1243
+ "inline",
1244
+ "register",
1245
+ "restrict",
1246
+ "return",
1247
+ "sizeof",
1248
+ "typeof",
1249
+ "typeof_unqual",
1250
+ "struct",
1251
+ "switch",
1252
+ "typedef",
1253
+ "union",
1254
+ "volatile",
1255
+ "while",
1256
+ "_Alignas",
1257
+ "_Alignof",
1258
+ "_Atomic",
1259
+ "_Generic",
1260
+ "_Noreturn",
1261
+ "_Static_assert",
1262
+ "_Thread_local",
1263
+ // aliases
1264
+ "alignas",
1265
+ "alignof",
1266
+ "noreturn",
1267
+ "static_assert",
1268
+ "thread_local",
1269
+ // not a C keyword but is, for all intents and purposes, treated exactly like one.
1270
+ "_Pragma"
1271
+ ],
1272
+ type: [
1273
+ "float",
1274
+ "double",
1275
+ "signed",
1276
+ "unsigned",
1277
+ "int",
1278
+ "short",
1279
+ "long",
1280
+ "char",
1281
+ "void",
1282
+ "_Bool",
1283
+ "_BitInt",
1284
+ "_Complex",
1285
+ "_Imaginary",
1286
+ "_Decimal32",
1287
+ "_Decimal64",
1288
+ "_Decimal96",
1289
+ "_Decimal128",
1290
+ "_Decimal64x",
1291
+ "_Decimal128x",
1292
+ "_Float16",
1293
+ "_Float32",
1294
+ "_Float64",
1295
+ "_Float128",
1296
+ "_Float32x",
1297
+ "_Float64x",
1298
+ "_Float128x",
1299
+ // modifiers
1300
+ "const",
1301
+ "static",
1302
+ "constexpr",
1303
+ // aliases
1304
+ "complex",
1305
+ "bool",
1306
+ "imaginary"
1307
+ ],
1308
+ literal: "true false NULL",
1309
+ // TODO: apply hinting work similar to what was done in cpp.js
1310
+ built_in: "std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"
1311
+ }, G = [
1312
+ ...L,
1313
+ M,
1314
+ d,
1315
+ t.C_BLOCK_COMMENT_MODE,
1316
+ C,
1317
+ I
1318
+ ], K = {
1319
+ // This mode covers expression context where we can't expect a function
1320
+ // definition and shouldn't highlight anything that looks like one:
1321
+ // `return some()`, `else if()`, `(x*sum(1, 2))`
1322
+ variants: [
1323
+ {
1324
+ begin: /=/,
1325
+ end: /;/
1326
+ },
1327
+ {
1328
+ begin: /\(/,
1329
+ end: /\)/
1330
+ },
1331
+ {
1332
+ beginKeywords: "new throw return else",
1333
+ end: /;/
1334
+ }
1335
+ ],
1336
+ keywords: U,
1337
+ contains: G.concat([
1338
+ {
1339
+ begin: /\(/,
1340
+ end: /\)/,
1341
+ keywords: U,
1342
+ contains: G.concat(["self"]),
1343
+ relevance: 0
1344
+ }
1345
+ ]),
1346
+ relevance: 0
1347
+ }, re = {
1348
+ begin: "(" + y + "[\\*&\\s]+){1," + Y + "}" + Z,
1349
+ returnBegin: !0,
1350
+ end: /[{;=]/,
1351
+ excludeEnd: !0,
1352
+ keywords: U,
1353
+ illegal: /[^\w\s\*&:<>.]/,
1354
+ contains: [
1355
+ {
1356
+ // to prevent it from being confused as the function title
1357
+ begin: o,
1358
+ keywords: U,
1359
+ relevance: 0
1360
+ },
1361
+ {
1362
+ begin: Z,
1363
+ returnBegin: !0,
1364
+ contains: [t.inherit(R, { className: "title.function" })],
1365
+ relevance: 0
1366
+ },
1367
+ // allow for multiple declarations, e.g.:
1368
+ // extern void f(int), g(char);
1369
+ {
1370
+ relevance: 0,
1371
+ match: /,/
1372
+ },
1373
+ {
1374
+ className: "params",
1375
+ begin: /\(/,
1376
+ end: /\)/,
1377
+ keywords: U,
1378
+ relevance: 0,
1379
+ contains: [
1380
+ d,
1381
+ t.C_BLOCK_COMMENT_MODE,
1382
+ I,
1383
+ C,
1384
+ M,
1385
+ // Count matching parentheses.
1386
+ {
1387
+ begin: /\(/,
1388
+ end: /\)/,
1389
+ keywords: U,
1390
+ relevance: 0,
1391
+ contains: [
1392
+ "self",
1393
+ d,
1394
+ t.C_BLOCK_COMMENT_MODE,
1395
+ I,
1396
+ C,
1397
+ M
1398
+ ]
1399
+ }
1400
+ ]
1401
+ },
1402
+ M,
1403
+ d,
1404
+ t.C_BLOCK_COMMENT_MODE,
1405
+ ...L
1406
+ ]
1407
+ };
1408
+ return {
1409
+ name: "C",
1410
+ aliases: ["h"],
1411
+ keywords: U,
1412
+ // Until differentiations are added between `c` and `cpp`, `c` will
1413
+ // not be auto-detected to avoid auto-detect conflicts between C and C++
1414
+ disableAutodetect: !0,
1415
+ illegal: "</",
1416
+ contains: [].concat(
1417
+ K,
1418
+ re,
1419
+ G,
1420
+ [
1421
+ ...L,
1422
+ {
1423
+ begin: t.IDENT_RE + "::",
1424
+ keywords: U
1425
+ },
1426
+ {
1427
+ className: "class",
1428
+ beginKeywords: "enum class struct union",
1429
+ end: /[{;:<>=]/,
1430
+ contains: [
1431
+ { beginKeywords: "final class struct" },
1432
+ t.TITLE_MODE
1433
+ ]
1434
+ }
1435
+ ]
1436
+ ),
1437
+ exports: {
1438
+ preprocessor: F,
1439
+ strings: I,
1440
+ keywords: U
1441
+ }
1442
+ };
1443
+ }
1444
+ function ot(t) {
1445
+ const D = {
1446
+ keyword: [
1447
+ "break",
1448
+ "case",
1449
+ "chan",
1450
+ "const",
1451
+ "continue",
1452
+ "default",
1453
+ "defer",
1454
+ "else",
1455
+ "fallthrough",
1456
+ "for",
1457
+ "func",
1458
+ "go",
1459
+ "goto",
1460
+ "if",
1461
+ "import",
1462
+ "interface",
1463
+ "map",
1464
+ "package",
1465
+ "range",
1466
+ "return",
1467
+ "select",
1468
+ "struct",
1469
+ "switch",
1470
+ "type",
1471
+ "var"
1472
+ ],
1473
+ type: [
1474
+ "bool",
1475
+ "byte",
1476
+ "complex64",
1477
+ "complex128",
1478
+ "error",
1479
+ "float32",
1480
+ "float64",
1481
+ "int8",
1482
+ "int16",
1483
+ "int32",
1484
+ "int64",
1485
+ "string",
1486
+ "uint8",
1487
+ "uint16",
1488
+ "uint32",
1489
+ "uint64",
1490
+ "int",
1491
+ "uint",
1492
+ "uintptr",
1493
+ "rune"
1494
+ ],
1495
+ literal: [
1496
+ "true",
1497
+ "false",
1498
+ "iota",
1499
+ "nil"
1500
+ ],
1501
+ built_in: [
1502
+ "append",
1503
+ "cap",
1504
+ "close",
1505
+ "complex",
1506
+ "copy",
1507
+ "imag",
1508
+ "len",
1509
+ "make",
1510
+ "new",
1511
+ "panic",
1512
+ "print",
1513
+ "println",
1514
+ "real",
1515
+ "recover",
1516
+ "delete"
1517
+ ]
1518
+ };
1519
+ return {
1520
+ name: "Go",
1521
+ aliases: ["golang"],
1522
+ keywords: D,
1523
+ illegal: "</",
1524
+ contains: [
1525
+ t.C_LINE_COMMENT_MODE,
1526
+ t.C_BLOCK_COMMENT_MODE,
1527
+ {
1528
+ className: "string",
1529
+ variants: [
1530
+ t.QUOTE_STRING_MODE,
1531
+ t.APOS_STRING_MODE,
1532
+ {
1533
+ begin: "`",
1534
+ end: "`"
1535
+ }
1536
+ ]
1537
+ },
1538
+ {
1539
+ className: "number",
1540
+ variants: [
1541
+ {
1542
+ match: /-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,
1543
+ // hex without a present digit before . (making a digit afterwards required)
1544
+ relevance: 0
1545
+ },
1546
+ {
1547
+ match: /-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,
1548
+ // hex with a present digit before . (making a digit afterwards optional)
1549
+ relevance: 0
1550
+ },
1551
+ {
1552
+ match: /-?\b0[oO](_?[0-7])*i?/,
1553
+ // leading 0o octal
1554
+ relevance: 0
1555
+ },
1556
+ {
1557
+ match: /-?\b0[bB](_?[01])*i?/,
1558
+ // leading 0b binary
1559
+ relevance: 0
1560
+ },
1561
+ {
1562
+ match: /-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,
1563
+ // decimal without a present digit before . (making a digit afterwards required)
1564
+ relevance: 0
1565
+ },
1566
+ {
1567
+ match: /-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,
1568
+ // decimal with a present digit before . (making a digit afterwards optional)
1569
+ relevance: 0
1570
+ }
1571
+ ]
1572
+ },
1573
+ {
1574
+ begin: /:=/
1575
+ // relevance booster
1576
+ },
1577
+ {
1578
+ className: "function",
1579
+ beginKeywords: "func",
1580
+ end: "\\s*(\\{|$)",
1581
+ excludeEnd: !0,
1582
+ contains: [
1583
+ t.TITLE_MODE,
1584
+ {
1585
+ className: "params",
1586
+ begin: /\(/,
1587
+ end: /\)/,
1588
+ endsParent: !0,
1589
+ keywords: D,
1590
+ illegal: /["']/
1591
+ }
1592
+ ]
1593
+ }
1594
+ ]
1595
+ };
1596
+ }
1597
+ const tn = "[A-Za-z$_][0-9A-Za-z$_]*", lt = [
1598
+ "as",
1599
+ // for exports
1600
+ "in",
1601
+ "of",
1602
+ "if",
1603
+ "for",
1604
+ "while",
1605
+ "finally",
1606
+ "var",
1607
+ "new",
1608
+ "function",
1609
+ "do",
1610
+ "return",
1611
+ "void",
1612
+ "else",
1613
+ "break",
1614
+ "catch",
1615
+ "instanceof",
1616
+ "with",
1617
+ "throw",
1618
+ "case",
1619
+ "default",
1620
+ "try",
1621
+ "switch",
1622
+ "continue",
1623
+ "typeof",
1624
+ "delete",
1625
+ "let",
1626
+ "yield",
1627
+ "const",
1628
+ "class",
1629
+ // JS handles these with a special rule
1630
+ // "get",
1631
+ // "set",
1632
+ "debugger",
1633
+ "async",
1634
+ "await",
1635
+ "static",
1636
+ "import",
1637
+ "from",
1638
+ "export",
1639
+ "extends",
1640
+ // It's reached stage 3, which is "recommended for implementation":
1641
+ "using"
1642
+ ], ut = [
1643
+ "true",
1644
+ "false",
1645
+ "null",
1646
+ "undefined",
1647
+ "NaN",
1648
+ "Infinity"
1649
+ ], sn = [
1650
+ // Fundamental objects
1651
+ "Object",
1652
+ "Function",
1653
+ "Boolean",
1654
+ "Symbol",
1655
+ // numbers and dates
1656
+ "Math",
1657
+ "Date",
1658
+ "Number",
1659
+ "BigInt",
1660
+ // text
1661
+ "String",
1662
+ "RegExp",
1663
+ // Indexed collections
1664
+ "Array",
1665
+ "Float32Array",
1666
+ "Float64Array",
1667
+ "Int8Array",
1668
+ "Uint8Array",
1669
+ "Uint8ClampedArray",
1670
+ "Int16Array",
1671
+ "Int32Array",
1672
+ "Uint16Array",
1673
+ "Uint32Array",
1674
+ "BigInt64Array",
1675
+ "BigUint64Array",
1676
+ // Keyed collections
1677
+ "Set",
1678
+ "Map",
1679
+ "WeakSet",
1680
+ "WeakMap",
1681
+ // Structured data
1682
+ "ArrayBuffer",
1683
+ "SharedArrayBuffer",
1684
+ "Atomics",
1685
+ "DataView",
1686
+ "JSON",
1687
+ // Control abstraction objects
1688
+ "Promise",
1689
+ "Generator",
1690
+ "GeneratorFunction",
1691
+ "AsyncFunction",
1692
+ // Reflection
1693
+ "Reflect",
1694
+ "Proxy",
1695
+ // Internationalization
1696
+ "Intl",
1697
+ // WebAssembly
1698
+ "WebAssembly"
1699
+ ], rn = [
1700
+ "Error",
1701
+ "EvalError",
1702
+ "InternalError",
1703
+ "RangeError",
1704
+ "ReferenceError",
1705
+ "SyntaxError",
1706
+ "TypeError",
1707
+ "URIError"
1708
+ ], an = [
1709
+ "setInterval",
1710
+ "setTimeout",
1711
+ "clearInterval",
1712
+ "clearTimeout",
1713
+ "require",
1714
+ "exports",
1715
+ "eval",
1716
+ "isFinite",
1717
+ "isNaN",
1718
+ "parseFloat",
1719
+ "parseInt",
1720
+ "decodeURI",
1721
+ "decodeURIComponent",
1722
+ "encodeURI",
1723
+ "encodeURIComponent",
1724
+ "escape",
1725
+ "unescape"
1726
+ ], gt = [
1727
+ "arguments",
1728
+ "this",
1729
+ "super",
1730
+ "console",
1731
+ "window",
1732
+ "document",
1733
+ "localStorage",
1734
+ "sessionStorage",
1735
+ "module",
1736
+ "self",
1737
+ "global"
1738
+ // Node.js
1739
+ ], ft = [].concat(
1740
+ an,
1741
+ sn,
1742
+ rn
1743
+ );
1744
+ function dt(t) {
1745
+ const g = t.regex, d = (S, { after: z }) => {
1746
+ const X = "</" + S[0].slice(1);
1747
+ return S.input.indexOf(X, z) !== -1;
1748
+ }, o = tn, A = {
1749
+ begin: "<>",
1750
+ end: "</>"
1751
+ }, D = /<[A-Za-z0-9\\._:-]+\s*\/>/, y = {
1752
+ begin: /<[A-Za-z0-9\\._:-]+/,
1753
+ end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
1754
+ /**
1755
+ * @param {RegExpMatchArray} match
1756
+ * @param {CallbackResponse} response
1757
+ */
1758
+ isTrulyOpeningTag: (S, z) => {
1759
+ const X = S[0].length + S.index, J = S.input[X];
1760
+ if (
1761
+ // HTML should not include another raw `<` inside a tag
1762
+ // nested type?
1763
+ // `<Array<Array<number>>`, etc.
1764
+ J === "<" || // the , gives away that this is not HTML
1765
+ // `<T, A extends keyof T, V>`
1766
+ J === ","
1767
+ ) {
1768
+ z.ignoreMatch();
1769
+ return;
1770
+ }
1771
+ J === ">" && (d(S, { after: X }) || z.ignoreMatch());
1772
+ let se;
1773
+ const le = S.input.substring(X);
1774
+ if (se = le.match(/^\s*=/)) {
1775
+ z.ignoreMatch();
1776
+ return;
1777
+ }
1778
+ if ((se = le.match(/^\s+extends\s+/)) && se.index === 0) {
1779
+ z.ignoreMatch();
1780
+ return;
1781
+ }
1782
+ }
1783
+ }, h = {
1784
+ $pattern: tn,
1785
+ keyword: lt,
1786
+ literal: ut,
1787
+ built_in: ft,
1788
+ "variable.language": gt
1789
+ }, M = "[0-9](_?[0-9])*", w = `\\.(${M})`, I = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", C = {
1790
+ className: "number",
1791
+ variants: [
1792
+ // DecimalLiteral
1793
+ { begin: `(\\b(${I})((${w})|\\.)?|(${w}))[eE][+-]?(${M})\\b` },
1794
+ { begin: `\\b(${I})\\b((${w})\\b|\\.)?|(${w})\\b` },
1795
+ // DecimalBigIntegerLiteral
1796
+ { begin: "\\b(0|[1-9](_?[0-9])*)n\\b" },
1797
+ // NonDecimalIntegerLiteral
1798
+ { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
1799
+ { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
1800
+ { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
1801
+ // LegacyOctalIntegerLiteral (does not include underscore separators)
1802
+ // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
1803
+ { begin: "\\b0[0-7]+n?\\b" }
1804
+ ],
1805
+ relevance: 0
1806
+ }, T = {
1807
+ className: "subst",
1808
+ begin: "\\$\\{",
1809
+ end: "\\}",
1810
+ keywords: h,
1811
+ contains: []
1812
+ // defined later
1813
+ }, F = {
1814
+ begin: ".?html`",
1815
+ end: "",
1816
+ starts: {
1817
+ end: "`",
1818
+ returnEnd: !1,
1819
+ contains: [
1820
+ t.BACKSLASH_ESCAPE,
1821
+ T
1822
+ ],
1823
+ subLanguage: "xml"
1824
+ }
1825
+ }, L = {
1826
+ begin: ".?css`",
1827
+ end: "",
1828
+ starts: {
1829
+ end: "`",
1830
+ returnEnd: !1,
1831
+ contains: [
1832
+ t.BACKSLASH_ESCAPE,
1833
+ T
1834
+ ],
1835
+ subLanguage: "css"
1836
+ }
1837
+ }, R = {
1838
+ begin: ".?gql`",
1839
+ end: "",
1840
+ starts: {
1841
+ end: "`",
1842
+ returnEnd: !1,
1843
+ contains: [
1844
+ t.BACKSLASH_ESCAPE,
1845
+ T
1846
+ ],
1847
+ subLanguage: "graphql"
1848
+ }
1849
+ }, Z = {
1850
+ className: "string",
1851
+ begin: "`",
1852
+ end: "`",
1853
+ contains: [
1854
+ t.BACKSLASH_ESCAPE,
1855
+ T
1856
+ ]
1857
+ }, W = {
1858
+ className: "comment",
1859
+ variants: [
1860
+ t.COMMENT(
1861
+ /\/\*\*(?!\/)/,
1862
+ "\\*/",
1863
+ {
1864
+ relevance: 0,
1865
+ contains: [
1866
+ {
1867
+ begin: "(?=@[A-Za-z]+)",
1868
+ relevance: 0,
1869
+ contains: [
1870
+ {
1871
+ className: "doctag",
1872
+ begin: "@[A-Za-z]+"
1873
+ },
1874
+ {
1875
+ className: "type",
1876
+ begin: "\\{",
1877
+ end: "\\}",
1878
+ excludeEnd: !0,
1879
+ excludeBegin: !0,
1880
+ relevance: 0
1881
+ },
1882
+ {
1883
+ className: "variable",
1884
+ begin: o + "(?=\\s*(-)|$)",
1885
+ endsParent: !0,
1886
+ relevance: 0
1887
+ },
1888
+ // eat spaces (not newlines) so we can find
1889
+ // types or variables
1890
+ {
1891
+ begin: /(?=[^\n])\s/,
1892
+ relevance: 0
1893
+ }
1894
+ ]
1895
+ }
1896
+ ]
1897
+ }
1898
+ ),
1899
+ t.C_BLOCK_COMMENT_MODE,
1900
+ t.C_LINE_COMMENT_MODE
1901
+ ]
1902
+ }, Q = [
1903
+ t.APOS_STRING_MODE,
1904
+ t.QUOTE_STRING_MODE,
1905
+ F,
1906
+ L,
1907
+ R,
1908
+ Z,
1909
+ // Skip numbers when they are part of a variable name
1910
+ { match: /\$\d+/ },
1911
+ C
1912
+ // This is intentional:
1913
+ // See https://github.com/highlightjs/highlight.js/issues/3288
1914
+ // hljs.REGEXP_MODE
1915
+ ];
1916
+ T.contains = Q.concat({
1917
+ // we need to pair up {} inside our subst to prevent
1918
+ // it from ending too early by matching another }
1919
+ begin: /\{/,
1920
+ end: /\}/,
1921
+ keywords: h,
1922
+ contains: [
1923
+ "self"
1924
+ ].concat(Q)
1925
+ });
1926
+ const U = [].concat(W, T.contains), G = U.concat([
1927
+ // eat recursive parens in sub expressions
1928
+ {
1929
+ begin: /(\s*)\(/,
1930
+ end: /\)/,
1931
+ keywords: h,
1932
+ contains: ["self"].concat(U)
1933
+ }
1934
+ ]), K = {
1935
+ className: "params",
1936
+ // convert this to negative lookbehind in v12
1937
+ begin: /(\s*)\(/,
1938
+ // to match the parms with
1939
+ end: /\)/,
1940
+ excludeBegin: !0,
1941
+ excludeEnd: !0,
1942
+ keywords: h,
1943
+ contains: G
1944
+ }, re = {
1945
+ variants: [
1946
+ // class Car extends vehicle
1947
+ {
1948
+ match: [
1949
+ /class/,
1950
+ /\s+/,
1951
+ o,
1952
+ /\s+/,
1953
+ /extends/,
1954
+ /\s+/,
1955
+ g.concat(o, "(", g.concat(/\./, o), ")*")
1956
+ ],
1957
+ scope: {
1958
+ 1: "keyword",
1959
+ 3: "title.class",
1960
+ 5: "keyword",
1961
+ 7: "title.class.inherited"
1962
+ }
1963
+ },
1964
+ // class Car
1965
+ {
1966
+ match: [
1967
+ /class/,
1968
+ /\s+/,
1969
+ o
1970
+ ],
1971
+ scope: {
1972
+ 1: "keyword",
1973
+ 3: "title.class"
1974
+ }
1975
+ }
1976
+ ]
1977
+ }, ne = {
1978
+ relevance: 0,
1979
+ match: g.either(
1980
+ // Hard coded exceptions
1981
+ /\bJSON/,
1982
+ // Float32Array, OutT
1983
+ /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
1984
+ // CSSFactory, CSSFactoryT
1985
+ /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,
1986
+ // FPs, FPsT
1987
+ /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/
1988
+ // P
1989
+ // single letters are not highlighted
1990
+ // BLAH
1991
+ // this will be flagged as a UPPER_CASE_CONSTANT instead
1992
+ ),
1993
+ className: "title.class",
1994
+ keywords: {
1995
+ _: [
1996
+ // se we still get relevance credit for JS library classes
1997
+ ...sn,
1998
+ ...rn
1999
+ ]
2000
+ }
2001
+ }, de = {
2002
+ label: "use_strict",
2003
+ className: "meta",
2004
+ relevance: 10,
2005
+ begin: /^\s*['"]use (strict|asm)['"]/
2006
+ }, Ee = {
2007
+ variants: [
2008
+ {
2009
+ match: [
2010
+ /function/,
2011
+ /\s+/,
2012
+ o,
2013
+ /(?=\s*\()/
2014
+ ]
2015
+ },
2016
+ // anonymous function
2017
+ {
2018
+ match: [
2019
+ /function/,
2020
+ /\s*(?=\()/
2021
+ ]
2022
+ }
2023
+ ],
2024
+ className: {
2025
+ 1: "keyword",
2026
+ 3: "title.function"
2027
+ },
2028
+ label: "func.def",
2029
+ contains: [K],
2030
+ illegal: /%/
2031
+ }, _e = {
2032
+ relevance: 0,
2033
+ match: /\b[A-Z][A-Z_0-9]+\b/,
2034
+ className: "variable.constant"
2035
+ };
2036
+ function he(S) {
2037
+ return g.concat("(?!", S.join("|"), ")");
2038
+ }
2039
+ const Se = {
2040
+ match: g.concat(
2041
+ /\b/,
2042
+ he([
2043
+ ...an,
2044
+ "super",
2045
+ "import",
2046
+ "await"
2047
+ ].map((S) => `${S}\\s*\\(`)),
2048
+ o,
2049
+ g.lookahead(/\s*\(/)
2050
+ ),
2051
+ className: "title.function",
2052
+ relevance: 0
2053
+ }, te = {
2054
+ begin: g.concat(/\./, g.lookahead(
2055
+ g.concat(o, /(?![0-9A-Za-z$_(])/)
2056
+ )),
2057
+ end: o,
2058
+ excludeBegin: !0,
2059
+ keywords: "prototype",
2060
+ className: "property",
2061
+ relevance: 0
2062
+ }, Ae = {
2063
+ match: [
2064
+ /get|set/,
2065
+ /\s+/,
2066
+ o,
2067
+ /(?=\()/
2068
+ ],
2069
+ className: {
2070
+ 1: "keyword",
2071
+ 3: "title.function"
2072
+ },
2073
+ contains: [
2074
+ {
2075
+ // eat to avoid empty params
2076
+ begin: /\(\)/
2077
+ },
2078
+ K
2079
+ ]
2080
+ }, oe = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + t.UNDERSCORE_IDENT_RE + ")\\s*=>", Ne = {
2081
+ match: [
2082
+ /const|var|let/,
2083
+ /\s+/,
2084
+ o,
2085
+ /\s*/,
2086
+ /=\s*/,
2087
+ /(async\s*)?/,
2088
+ // async is optional
2089
+ g.lookahead(oe)
2090
+ ],
2091
+ keywords: "async",
2092
+ className: {
2093
+ 1: "keyword",
2094
+ 3: "title.function"
2095
+ },
2096
+ contains: [
2097
+ K
2098
+ ]
2099
+ };
2100
+ return {
2101
+ name: "JavaScript",
2102
+ aliases: ["js", "jsx", "mjs", "cjs"],
2103
+ keywords: h,
2104
+ // this will be extended by TypeScript
2105
+ exports: { PARAMS_CONTAINS: G, CLASS_REFERENCE: ne },
2106
+ illegal: /#(?![$_A-Za-z])/,
2107
+ contains: [
2108
+ t.SHEBANG({
2109
+ label: "shebang",
2110
+ binary: "node",
2111
+ relevance: 5
2112
+ }),
2113
+ de,
2114
+ t.APOS_STRING_MODE,
2115
+ t.QUOTE_STRING_MODE,
2116
+ F,
2117
+ L,
2118
+ R,
2119
+ Z,
2120
+ W,
2121
+ // Skip numbers when they are part of a variable name
2122
+ { match: /\$\d+/ },
2123
+ C,
2124
+ ne,
2125
+ {
2126
+ scope: "attr",
2127
+ match: o + g.lookahead(":"),
2128
+ relevance: 0
2129
+ },
2130
+ Ne,
2131
+ {
2132
+ // "value" container
2133
+ begin: "(" + t.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
2134
+ keywords: "return throw case",
2135
+ relevance: 0,
2136
+ contains: [
2137
+ W,
2138
+ t.REGEXP_MODE,
2139
+ {
2140
+ className: "function",
2141
+ // we have to count the parens to make sure we actually have the
2142
+ // correct bounding ( ) before the =>. There could be any number of
2143
+ // sub-expressions inside also surrounded by parens.
2144
+ begin: oe,
2145
+ returnBegin: !0,
2146
+ end: "\\s*=>",
2147
+ contains: [
2148
+ {
2149
+ className: "params",
2150
+ variants: [
2151
+ {
2152
+ begin: t.UNDERSCORE_IDENT_RE,
2153
+ relevance: 0
2154
+ },
2155
+ {
2156
+ className: null,
2157
+ begin: /\(\s*\)/,
2158
+ skip: !0
2159
+ },
2160
+ {
2161
+ begin: /(\s*)\(/,
2162
+ end: /\)/,
2163
+ excludeBegin: !0,
2164
+ excludeEnd: !0,
2165
+ keywords: h,
2166
+ contains: G
2167
+ }
2168
+ ]
2169
+ }
2170
+ ]
2171
+ },
2172
+ {
2173
+ // could be a comma delimited list of params to a function call
2174
+ begin: /,/,
2175
+ relevance: 0
2176
+ },
2177
+ {
2178
+ match: /\s+/,
2179
+ relevance: 0
2180
+ },
2181
+ {
2182
+ // JSX
2183
+ variants: [
2184
+ { begin: A.begin, end: A.end },
2185
+ { match: D },
2186
+ {
2187
+ begin: y.begin,
2188
+ // we carefully check the opening tag to see if it truly
2189
+ // is a tag and not a false positive
2190
+ "on:begin": y.isTrulyOpeningTag,
2191
+ end: y.end
2192
+ }
2193
+ ],
2194
+ subLanguage: "xml",
2195
+ contains: [
2196
+ {
2197
+ begin: y.begin,
2198
+ end: y.end,
2199
+ skip: !0,
2200
+ contains: ["self"]
2201
+ }
2202
+ ]
2203
+ }
2204
+ ]
2205
+ },
2206
+ Ee,
2207
+ {
2208
+ // prevent this from getting swallowed up by function
2209
+ // since they appear "function like"
2210
+ beginKeywords: "while if switch catch for"
2211
+ },
2212
+ {
2213
+ // we have to count the parens to make sure we actually have the correct
2214
+ // bounding ( ). There could be any number of sub-expressions inside
2215
+ // also surrounded by parens.
2216
+ begin: "\\b(?!function)" + t.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
2217
+ // end parens
2218
+ returnBegin: !0,
2219
+ label: "func.def",
2220
+ contains: [
2221
+ K,
2222
+ t.inherit(t.TITLE_MODE, { begin: o, className: "title.function" })
2223
+ ]
2224
+ },
2225
+ // catch ... so it won't trigger the property rule below
2226
+ {
2227
+ match: /\.\.\./,
2228
+ relevance: 0
2229
+ },
2230
+ te,
2231
+ // hack: prevents detection of keywords in some circumstances
2232
+ // .keyword()
2233
+ // $keyword = x
2234
+ {
2235
+ match: "\\$" + o,
2236
+ relevance: 0
2237
+ },
2238
+ {
2239
+ match: [/\bconstructor(?=\s*\()/],
2240
+ className: { 1: "title.function" },
2241
+ contains: [K]
2242
+ },
2243
+ Se,
2244
+ _e,
2245
+ re,
2246
+ Ae,
2247
+ {
2248
+ match: /\$[(.]/
2249
+ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
2250
+ }
2251
+ ]
2252
+ };
2253
+ }
2254
+ function Et(t) {
2255
+ const g = t.regex, d = /[\p{XID_Start}_]\p{XID_Continue}*/u, o = [
2256
+ "and",
2257
+ "as",
2258
+ "assert",
2259
+ "async",
2260
+ "await",
2261
+ "break",
2262
+ "case",
2263
+ "class",
2264
+ "continue",
2265
+ "def",
2266
+ "del",
2267
+ "elif",
2268
+ "else",
2269
+ "except",
2270
+ "finally",
2271
+ "for",
2272
+ "from",
2273
+ "global",
2274
+ "if",
2275
+ "import",
2276
+ "in",
2277
+ "is",
2278
+ "lambda",
2279
+ "lazy",
2280
+ "match",
2281
+ "nonlocal|10",
2282
+ "not",
2283
+ "or",
2284
+ "pass",
2285
+ "raise",
2286
+ "return",
2287
+ "try",
2288
+ "while",
2289
+ "with",
2290
+ "yield"
2291
+ ], h = {
2292
+ $pattern: /[A-Za-z]\w+|__\w+__/,
2293
+ keyword: o,
2294
+ built_in: [
2295
+ "__import__",
2296
+ "abs",
2297
+ "aiter",
2298
+ "all",
2299
+ "anext",
2300
+ "any",
2301
+ "ascii",
2302
+ "bin",
2303
+ "bool",
2304
+ "breakpoint",
2305
+ "bytearray",
2306
+ "bytes",
2307
+ "callable",
2308
+ "chr",
2309
+ "classmethod",
2310
+ "compile",
2311
+ "complex",
2312
+ "delattr",
2313
+ "dict",
2314
+ "dir",
2315
+ "divmod",
2316
+ "enumerate",
2317
+ "eval",
2318
+ "exec",
2319
+ "filter",
2320
+ "float",
2321
+ "format",
2322
+ "frozendict",
2323
+ "frozenset",
2324
+ "getattr",
2325
+ "globals",
2326
+ "hasattr",
2327
+ "hash",
2328
+ "help",
2329
+ "hex",
2330
+ "id",
2331
+ "input",
2332
+ "int",
2333
+ "isinstance",
2334
+ "issubclass",
2335
+ "iter",
2336
+ "len",
2337
+ "list",
2338
+ "locals",
2339
+ "map",
2340
+ "max",
2341
+ "memoryview",
2342
+ "min",
2343
+ "next",
2344
+ "object",
2345
+ "oct",
2346
+ "open",
2347
+ "ord",
2348
+ "pow",
2349
+ "print",
2350
+ "property",
2351
+ "range",
2352
+ "repr",
2353
+ "reversed",
2354
+ "round",
2355
+ "sentinel",
2356
+ "set",
2357
+ "setattr",
2358
+ "slice",
2359
+ "sorted",
2360
+ "staticmethod",
2361
+ "str",
2362
+ "sum",
2363
+ "super",
2364
+ "tuple",
2365
+ "type",
2366
+ "vars",
2367
+ "zip"
2368
+ ],
2369
+ literal: [
2370
+ "__debug__",
2371
+ "Ellipsis",
2372
+ "False",
2373
+ "None",
2374
+ "NotImplemented",
2375
+ "True"
2376
+ ],
2377
+ type: [
2378
+ "Any",
2379
+ "Callable",
2380
+ "Coroutine",
2381
+ "Dict",
2382
+ "List",
2383
+ "Literal",
2384
+ "Generic",
2385
+ "Optional",
2386
+ "Sequence",
2387
+ "Set",
2388
+ "Tuple",
2389
+ "Type",
2390
+ "Union"
2391
+ ]
2392
+ }, M = {
2393
+ className: "meta",
2394
+ begin: /^(>>>|\.\.\.) /
2395
+ }, w = {
2396
+ className: "subst",
2397
+ begin: /\{/,
2398
+ end: /\}/,
2399
+ keywords: h,
2400
+ illegal: /#/
2401
+ }, I = {
2402
+ begin: /\{\{/,
2403
+ relevance: 0
2404
+ }, C = {
2405
+ className: "string",
2406
+ contains: [t.BACKSLASH_ESCAPE],
2407
+ variants: [
2408
+ {
2409
+ begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,
2410
+ end: /'''/,
2411
+ contains: [
2412
+ t.BACKSLASH_ESCAPE,
2413
+ M
2414
+ ],
2415
+ relevance: 10
2416
+ },
2417
+ {
2418
+ begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,
2419
+ end: /"""/,
2420
+ contains: [
2421
+ t.BACKSLASH_ESCAPE,
2422
+ M
2423
+ ],
2424
+ relevance: 10
2425
+ },
2426
+ {
2427
+ begin: /([fFtT][rR]|[rR][fFtT]|[fFtT])'''/,
2428
+ end: /'''/,
2429
+ contains: [
2430
+ t.BACKSLASH_ESCAPE,
2431
+ M,
2432
+ I,
2433
+ w
2434
+ ]
2435
+ },
2436
+ {
2437
+ begin: /([fFtT][rR]|[rR][fFtT]|[fFtT])"""/,
2438
+ end: /"""/,
2439
+ contains: [
2440
+ t.BACKSLASH_ESCAPE,
2441
+ M,
2442
+ I,
2443
+ w
2444
+ ]
2445
+ },
2446
+ {
2447
+ begin: /([uU]|[rR])'/,
2448
+ end: /'/,
2449
+ relevance: 10
2450
+ },
2451
+ {
2452
+ begin: /([uU]|[rR])"/,
2453
+ end: /"/,
2454
+ relevance: 10
2455
+ },
2456
+ {
2457
+ begin: /([bB]|[bB][rR]|[rR][bB])'/,
2458
+ end: /'/
2459
+ },
2460
+ {
2461
+ begin: /([bB]|[bB][rR]|[rR][bB])"/,
2462
+ end: /"/
2463
+ },
2464
+ {
2465
+ begin: /([fFtT][rR]|[rR][fFtT]|[fFtT])'/,
2466
+ end: /'/,
2467
+ contains: [
2468
+ t.BACKSLASH_ESCAPE,
2469
+ I,
2470
+ w
2471
+ ]
2472
+ },
2473
+ {
2474
+ begin: /([fFtT][rR]|[rR][fFtT]|[fFtT])"/,
2475
+ end: /"/,
2476
+ contains: [
2477
+ t.BACKSLASH_ESCAPE,
2478
+ I,
2479
+ w
2480
+ ]
2481
+ },
2482
+ t.APOS_STRING_MODE,
2483
+ t.QUOTE_STRING_MODE
2484
+ ]
2485
+ }, T = "[0-9](_?[0-9])*", F = `(\\b(${T}))?\\.(${T})|\\b(${T})\\.`, L = `\\b|${o.join("|")}`, R = {
2486
+ className: "number",
2487
+ relevance: 0,
2488
+ variants: [
2489
+ // exponentfloat, pointfloat
2490
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#floating-point-literals
2491
+ // optionally imaginary
2492
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
2493
+ // Note: no leading \b because floats can start with a decimal point
2494
+ // and we don't want to mishandle e.g. `fn(.5)`,
2495
+ // no trailing \b for pointfloat because it can end with a decimal point
2496
+ // and we don't want to mishandle e.g. `0..hex()`; this should be safe
2497
+ // because both MUST contain a decimal point and so cannot be confused with
2498
+ // the interior part of an identifier
2499
+ {
2500
+ begin: `(\\b(${T})|(${F}))[eE][+-]?(${T})[jJ]?(?=${L})`
2501
+ },
2502
+ {
2503
+ begin: `(${F})[jJ]?`
2504
+ },
2505
+ // decinteger, bininteger, octinteger, hexinteger
2506
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#integer-literals
2507
+ // optionally "long" in Python 2
2508
+ // https://docs.python.org/2.7/reference/lexical_analysis.html#integer-and-long-integer-literals
2509
+ // decinteger is optionally imaginary
2510
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
2511
+ {
2512
+ begin: `\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${L})`
2513
+ },
2514
+ {
2515
+ begin: `\\b0[bB](_?[01])+[lL]?(?=${L})`
2516
+ },
2517
+ {
2518
+ begin: `\\b0[oO](_?[0-7])+[lL]?(?=${L})`
2519
+ },
2520
+ {
2521
+ begin: `\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${L})`
2522
+ },
2523
+ // imagnumber (digitpart-based)
2524
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
2525
+ {
2526
+ begin: `\\b(${T})[jJ](?=${L})`
2527
+ }
2528
+ ]
2529
+ }, Z = {
2530
+ className: "comment",
2531
+ begin: g.lookahead(/# type:/),
2532
+ end: /$/,
2533
+ keywords: h,
2534
+ contains: [
2535
+ {
2536
+ // prevent keywords from coloring `type`
2537
+ begin: /# type:/
2538
+ },
2539
+ // comment within a datatype comment includes no keywords
2540
+ {
2541
+ begin: /#/,
2542
+ end: /\b\B/,
2543
+ endsWithParent: !0
2544
+ }
2545
+ ]
2546
+ }, Y = {
2547
+ className: "params",
2548
+ variants: [
2549
+ // Exclude params in functions without params
2550
+ {
2551
+ className: "",
2552
+ begin: /\(\s*\)/,
2553
+ skip: !0
2554
+ },
2555
+ {
2556
+ begin: /\(/,
2557
+ end: /\)/,
2558
+ excludeBegin: !0,
2559
+ excludeEnd: !0,
2560
+ keywords: h,
2561
+ contains: [
2562
+ "self",
2563
+ M,
2564
+ R,
2565
+ C,
2566
+ t.HASH_COMMENT_MODE
2567
+ ]
2568
+ }
2569
+ ]
2570
+ };
2571
+ return w.contains = [
2572
+ C,
2573
+ R,
2574
+ M
2575
+ ], {
2576
+ name: "Python",
2577
+ aliases: [
2578
+ "py",
2579
+ "gyp",
2580
+ "ipython"
2581
+ ],
2582
+ unicodeRegex: !0,
2583
+ keywords: h,
2584
+ illegal: /(<\/|\?)|=>/,
2585
+ contains: [
2586
+ M,
2587
+ R,
2588
+ {
2589
+ // very common convention
2590
+ scope: "variable.language",
2591
+ match: /\bself\b/
2592
+ },
2593
+ {
2594
+ // eat "if" prior to string so that it won't accidentally be
2595
+ // labeled as an f-string
2596
+ beginKeywords: "if",
2597
+ relevance: 0
2598
+ },
2599
+ { match: /\bor\b/, scope: "keyword" },
2600
+ C,
2601
+ Z,
2602
+ t.HASH_COMMENT_MODE,
2603
+ {
2604
+ match: [
2605
+ /\bdef/,
2606
+ /\s+/,
2607
+ d
2608
+ ],
2609
+ scope: {
2610
+ 1: "keyword",
2611
+ 3: "title.function"
2612
+ },
2613
+ contains: [Y]
2614
+ },
2615
+ {
2616
+ variants: [
2617
+ {
2618
+ match: [
2619
+ /\bclass/,
2620
+ /\s+/,
2621
+ d,
2622
+ /\s*/,
2623
+ /\(\s*/,
2624
+ d,
2625
+ /\s*\)/
2626
+ ]
2627
+ },
2628
+ {
2629
+ match: [
2630
+ /\bclass/,
2631
+ /\s+/,
2632
+ d
2633
+ ]
2634
+ }
2635
+ ],
2636
+ scope: {
2637
+ 1: "keyword",
2638
+ 3: "title.class",
2639
+ 6: "title.class.inherited"
2640
+ }
2641
+ },
2642
+ {
2643
+ className: "meta",
2644
+ begin: /^[\t ]*@/,
2645
+ end: /(?=#)|$/,
2646
+ contains: [
2647
+ R,
2648
+ Y,
2649
+ C
2650
+ ]
2651
+ }
2652
+ ]
2653
+ };
2654
+ }
2655
+ function _t(t) {
2656
+ const g = t.regex, d = /(r#)?/, o = g.concat(d, t.UNDERSCORE_IDENT_RE), A = g.concat(d, t.IDENT_RE), D = {
2657
+ scope: "title.function.invoke",
2658
+ relevance: 0,
2659
+ begin: g.concat(
2660
+ /\b/,
2661
+ /(?!(?:let|for|while|if|else|match)\b)/,
2662
+ A,
2663
+ g.lookahead(/\s*\(/)
2664
+ )
2665
+ }, y = "([ui](8|16|32|64|128|size)|f(16|32|64|128))?", h = [
2666
+ "abstract",
2667
+ "as",
2668
+ "async",
2669
+ "await",
2670
+ "become",
2671
+ "box",
2672
+ "break",
2673
+ "const",
2674
+ "continue",
2675
+ "crate",
2676
+ "do",
2677
+ "dyn",
2678
+ "else",
2679
+ "enum",
2680
+ "extern",
2681
+ "false",
2682
+ "final",
2683
+ "fn",
2684
+ "for",
2685
+ "if",
2686
+ "impl",
2687
+ "in",
2688
+ "let",
2689
+ "loop",
2690
+ "macro",
2691
+ "match",
2692
+ "mod",
2693
+ "move",
2694
+ "mut",
2695
+ "override",
2696
+ "priv",
2697
+ "pub",
2698
+ "raw",
2699
+ "ref",
2700
+ "return",
2701
+ "self",
2702
+ "Self",
2703
+ "static",
2704
+ "struct",
2705
+ "super",
2706
+ "trait",
2707
+ "true",
2708
+ "try",
2709
+ "type",
2710
+ "typeof",
2711
+ "union",
2712
+ "unsafe",
2713
+ "unsized",
2714
+ "use",
2715
+ "virtual",
2716
+ "where",
2717
+ "while",
2718
+ "yield"
2719
+ ], M = [
2720
+ "true",
2721
+ "false",
2722
+ "Some",
2723
+ "None",
2724
+ "Ok",
2725
+ "Err"
2726
+ ], w = [
2727
+ // functions
2728
+ "drop ",
2729
+ // traits
2730
+ "Copy",
2731
+ "Send",
2732
+ "Sized",
2733
+ "Sync",
2734
+ "Drop",
2735
+ "Fn",
2736
+ "FnMut",
2737
+ "FnOnce",
2738
+ "ToOwned",
2739
+ "Clone",
2740
+ "Debug",
2741
+ "PartialEq",
2742
+ "PartialOrd",
2743
+ "Eq",
2744
+ "Ord",
2745
+ "AsRef",
2746
+ "AsMut",
2747
+ "Into",
2748
+ "From",
2749
+ "Default",
2750
+ "Iterator",
2751
+ "Extend",
2752
+ "IntoIterator",
2753
+ "DoubleEndedIterator",
2754
+ "ExactSizeIterator",
2755
+ "SliceConcatExt",
2756
+ "ToString",
2757
+ // macros
2758
+ "assert!",
2759
+ "assert_eq!",
2760
+ "bitflags!",
2761
+ "bytes!",
2762
+ "cfg!",
2763
+ "col!",
2764
+ "concat!",
2765
+ "concat_idents!",
2766
+ "debug_assert!",
2767
+ "debug_assert_eq!",
2768
+ "env!",
2769
+ "eprintln!",
2770
+ "panic!",
2771
+ "file!",
2772
+ "format!",
2773
+ "format_args!",
2774
+ "include_bytes!",
2775
+ "include_str!",
2776
+ "line!",
2777
+ "local_data_key!",
2778
+ "module_path!",
2779
+ "option_env!",
2780
+ "print!",
2781
+ "println!",
2782
+ "select!",
2783
+ "stringify!",
2784
+ "try!",
2785
+ "unimplemented!",
2786
+ "unreachable!",
2787
+ "vec!",
2788
+ "write!",
2789
+ "writeln!",
2790
+ "macro_rules!",
2791
+ "assert_ne!",
2792
+ "debug_assert_ne!"
2793
+ ], I = [
2794
+ "i8",
2795
+ "i16",
2796
+ "i32",
2797
+ "i64",
2798
+ "i128",
2799
+ "isize",
2800
+ "u8",
2801
+ "u16",
2802
+ "u32",
2803
+ "u64",
2804
+ "u128",
2805
+ "usize",
2806
+ "f16",
2807
+ "f32",
2808
+ "f64",
2809
+ "f128",
2810
+ "str",
2811
+ "char",
2812
+ "bool",
2813
+ "Box",
2814
+ "Option",
2815
+ "Result",
2816
+ "String",
2817
+ "Vec"
2818
+ ];
2819
+ return {
2820
+ name: "Rust",
2821
+ aliases: ["rs"],
2822
+ keywords: {
2823
+ $pattern: t.IDENT_RE + "!?",
2824
+ type: I,
2825
+ keyword: h,
2826
+ literal: M,
2827
+ built_in: w
2828
+ },
2829
+ illegal: "</",
2830
+ contains: [
2831
+ t.C_LINE_COMMENT_MODE,
2832
+ t.COMMENT("/\\*", "\\*/", { contains: ["self"] }),
2833
+ t.inherit(t.QUOTE_STRING_MODE, {
2834
+ begin: /b?"/,
2835
+ illegal: null
2836
+ }),
2837
+ {
2838
+ scope: "symbol",
2839
+ // negative lookahead to avoid matching `'`
2840
+ begin: /'[a-zA-Z_][a-zA-Z0-9_]*(?!')/
2841
+ },
2842
+ {
2843
+ scope: "string",
2844
+ variants: [
2845
+ { begin: /b?r(#*)"(.|\n)*?"\1(?!#)/ },
2846
+ {
2847
+ begin: /b?'/,
2848
+ end: /'/,
2849
+ contains: [
2850
+ {
2851
+ scope: "char.escape",
2852
+ match: /\\('|"|\\|\w|x\w{2}|u\w{4}|U\w{8})/
2853
+ }
2854
+ ]
2855
+ }
2856
+ ]
2857
+ },
2858
+ {
2859
+ scope: "number",
2860
+ variants: [
2861
+ { begin: "\\b0b([01_]+)" + y },
2862
+ { begin: "\\b0o([0-7_]+)" + y },
2863
+ { begin: "\\b0x([A-Fa-f0-9_]+)" + y },
2864
+ { begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" + y }
2865
+ ],
2866
+ relevance: 0
2867
+ },
2868
+ {
2869
+ begin: [
2870
+ /\bsafe/,
2871
+ /\s+/,
2872
+ /extern/
2873
+ ],
2874
+ scope: {
2875
+ 1: "keyword",
2876
+ 3: "keyword"
2877
+ }
2878
+ },
2879
+ {
2880
+ begin: [
2881
+ /fn/,
2882
+ /\s+/,
2883
+ o
2884
+ ],
2885
+ scope: {
2886
+ 1: "keyword",
2887
+ 3: "title.function"
2888
+ }
2889
+ },
2890
+ {
2891
+ scope: "meta",
2892
+ begin: "#!?\\[",
2893
+ end: "\\]",
2894
+ contains: [
2895
+ {
2896
+ scope: "string",
2897
+ begin: /"/,
2898
+ end: /"/,
2899
+ contains: [
2900
+ t.BACKSLASH_ESCAPE
2901
+ ]
2902
+ }
2903
+ ]
2904
+ },
2905
+ {
2906
+ begin: [
2907
+ /let/,
2908
+ /\s+/,
2909
+ /(?:mut\s+)?/,
2910
+ o
2911
+ ],
2912
+ scope: {
2913
+ 1: "keyword",
2914
+ 3: "keyword",
2915
+ 4: "variable"
2916
+ }
2917
+ },
2918
+ // must come before impl/for rule later
2919
+ {
2920
+ begin: [
2921
+ /for/,
2922
+ /\s+/,
2923
+ o,
2924
+ /\s+/,
2925
+ /in/
2926
+ ],
2927
+ scope: {
2928
+ 1: "keyword",
2929
+ 3: "variable",
2930
+ 5: "keyword"
2931
+ }
2932
+ },
2933
+ {
2934
+ begin: [
2935
+ /type/,
2936
+ /\s+/,
2937
+ o
2938
+ ],
2939
+ scope: {
2940
+ 1: "keyword",
2941
+ 3: "title.class"
2942
+ }
2943
+ },
2944
+ {
2945
+ begin: [
2946
+ /(?:trait|enum|struct|union|impl|for)/,
2947
+ /\s+/,
2948
+ o
2949
+ ],
2950
+ scope: {
2951
+ 1: "keyword",
2952
+ 3: "title.class"
2953
+ }
2954
+ },
2955
+ {
2956
+ begin: t.IDENT_RE + "::",
2957
+ keywords: {
2958
+ keyword: "Self",
2959
+ built_in: w,
2960
+ type: I
2961
+ }
2962
+ },
2963
+ {
2964
+ scope: "punctuation",
2965
+ begin: "->"
2966
+ },
2967
+ D
2968
+ ]
2969
+ };
2970
+ }
2971
+ const Ce = "[A-Za-z$_][0-9A-Za-z$_]*", cn = [
2972
+ "as",
2973
+ // for exports
2974
+ "in",
2975
+ "of",
2976
+ "if",
2977
+ "for",
2978
+ "while",
2979
+ "finally",
2980
+ "var",
2981
+ "new",
2982
+ "function",
2983
+ "do",
2984
+ "return",
2985
+ "void",
2986
+ "else",
2987
+ "break",
2988
+ "catch",
2989
+ "instanceof",
2990
+ "with",
2991
+ "throw",
2992
+ "case",
2993
+ "default",
2994
+ "try",
2995
+ "switch",
2996
+ "continue",
2997
+ "typeof",
2998
+ "delete",
2999
+ "let",
3000
+ "yield",
3001
+ "const",
3002
+ "class",
3003
+ // JS handles these with a special rule
3004
+ // "get",
3005
+ // "set",
3006
+ "debugger",
3007
+ "async",
3008
+ "await",
3009
+ "static",
3010
+ "import",
3011
+ "from",
3012
+ "export",
3013
+ "extends",
3014
+ // It's reached stage 3, which is "recommended for implementation":
3015
+ "using"
3016
+ ], on = [
3017
+ "true",
3018
+ "false",
3019
+ "null",
3020
+ "undefined",
3021
+ "NaN",
3022
+ "Infinity"
3023
+ ], ln = [
3024
+ // Fundamental objects
3025
+ "Object",
3026
+ "Function",
3027
+ "Boolean",
3028
+ "Symbol",
3029
+ // numbers and dates
3030
+ "Math",
3031
+ "Date",
3032
+ "Number",
3033
+ "BigInt",
3034
+ // text
3035
+ "String",
3036
+ "RegExp",
3037
+ // Indexed collections
3038
+ "Array",
3039
+ "Float32Array",
3040
+ "Float64Array",
3041
+ "Int8Array",
3042
+ "Uint8Array",
3043
+ "Uint8ClampedArray",
3044
+ "Int16Array",
3045
+ "Int32Array",
3046
+ "Uint16Array",
3047
+ "Uint32Array",
3048
+ "BigInt64Array",
3049
+ "BigUint64Array",
3050
+ // Keyed collections
3051
+ "Set",
3052
+ "Map",
3053
+ "WeakSet",
3054
+ "WeakMap",
3055
+ // Structured data
3056
+ "ArrayBuffer",
3057
+ "SharedArrayBuffer",
3058
+ "Atomics",
3059
+ "DataView",
3060
+ "JSON",
3061
+ // Control abstraction objects
3062
+ "Promise",
3063
+ "Generator",
3064
+ "GeneratorFunction",
3065
+ "AsyncFunction",
3066
+ // Reflection
3067
+ "Reflect",
3068
+ "Proxy",
3069
+ // Internationalization
3070
+ "Intl",
3071
+ // WebAssembly
3072
+ "WebAssembly"
3073
+ ], un = [
3074
+ "Error",
3075
+ "EvalError",
3076
+ "InternalError",
3077
+ "RangeError",
3078
+ "ReferenceError",
3079
+ "SyntaxError",
3080
+ "TypeError",
3081
+ "URIError"
3082
+ ], gn = [
3083
+ "setInterval",
3084
+ "setTimeout",
3085
+ "clearInterval",
3086
+ "clearTimeout",
3087
+ "require",
3088
+ "exports",
3089
+ "eval",
3090
+ "isFinite",
3091
+ "isNaN",
3092
+ "parseFloat",
3093
+ "parseInt",
3094
+ "decodeURI",
3095
+ "decodeURIComponent",
3096
+ "encodeURI",
3097
+ "encodeURIComponent",
3098
+ "escape",
3099
+ "unescape"
3100
+ ], fn = [
3101
+ "arguments",
3102
+ "this",
3103
+ "super",
3104
+ "console",
3105
+ "window",
3106
+ "document",
3107
+ "localStorage",
3108
+ "sessionStorage",
3109
+ "module",
3110
+ "self",
3111
+ "global"
3112
+ // Node.js
3113
+ ], dn = [].concat(
3114
+ gn,
3115
+ ln,
3116
+ un
3117
+ );
3118
+ function bt(t) {
3119
+ const g = t.regex, d = (S, { after: z }) => {
3120
+ const X = "</" + S[0].slice(1);
3121
+ return S.input.indexOf(X, z) !== -1;
3122
+ }, o = Ce, A = {
3123
+ begin: "<>",
3124
+ end: "</>"
3125
+ }, D = /<[A-Za-z0-9\\._:-]+\s*\/>/, y = {
3126
+ begin: /<[A-Za-z0-9\\._:-]+/,
3127
+ end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
3128
+ /**
3129
+ * @param {RegExpMatchArray} match
3130
+ * @param {CallbackResponse} response
3131
+ */
3132
+ isTrulyOpeningTag: (S, z) => {
3133
+ const X = S[0].length + S.index, J = S.input[X];
3134
+ if (
3135
+ // HTML should not include another raw `<` inside a tag
3136
+ // nested type?
3137
+ // `<Array<Array<number>>`, etc.
3138
+ J === "<" || // the , gives away that this is not HTML
3139
+ // `<T, A extends keyof T, V>`
3140
+ J === ","
3141
+ ) {
3142
+ z.ignoreMatch();
3143
+ return;
3144
+ }
3145
+ J === ">" && (d(S, { after: X }) || z.ignoreMatch());
3146
+ let se;
3147
+ const le = S.input.substring(X);
3148
+ if (se = le.match(/^\s*=/)) {
3149
+ z.ignoreMatch();
3150
+ return;
3151
+ }
3152
+ if ((se = le.match(/^\s+extends\s+/)) && se.index === 0) {
3153
+ z.ignoreMatch();
3154
+ return;
3155
+ }
3156
+ }
3157
+ }, h = {
3158
+ $pattern: Ce,
3159
+ keyword: cn,
3160
+ literal: on,
3161
+ built_in: dn,
3162
+ "variable.language": fn
3163
+ }, M = "[0-9](_?[0-9])*", w = `\\.(${M})`, I = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", C = {
3164
+ className: "number",
3165
+ variants: [
3166
+ // DecimalLiteral
3167
+ { begin: `(\\b(${I})((${w})|\\.)?|(${w}))[eE][+-]?(${M})\\b` },
3168
+ { begin: `\\b(${I})\\b((${w})\\b|\\.)?|(${w})\\b` },
3169
+ // DecimalBigIntegerLiteral
3170
+ { begin: "\\b(0|[1-9](_?[0-9])*)n\\b" },
3171
+ // NonDecimalIntegerLiteral
3172
+ { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
3173
+ { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
3174
+ { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
3175
+ // LegacyOctalIntegerLiteral (does not include underscore separators)
3176
+ // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
3177
+ { begin: "\\b0[0-7]+n?\\b" }
3178
+ ],
3179
+ relevance: 0
3180
+ }, T = {
3181
+ className: "subst",
3182
+ begin: "\\$\\{",
3183
+ end: "\\}",
3184
+ keywords: h,
3185
+ contains: []
3186
+ // defined later
3187
+ }, F = {
3188
+ begin: ".?html`",
3189
+ end: "",
3190
+ starts: {
3191
+ end: "`",
3192
+ returnEnd: !1,
3193
+ contains: [
3194
+ t.BACKSLASH_ESCAPE,
3195
+ T
3196
+ ],
3197
+ subLanguage: "xml"
3198
+ }
3199
+ }, L = {
3200
+ begin: ".?css`",
3201
+ end: "",
3202
+ starts: {
3203
+ end: "`",
3204
+ returnEnd: !1,
3205
+ contains: [
3206
+ t.BACKSLASH_ESCAPE,
3207
+ T
3208
+ ],
3209
+ subLanguage: "css"
3210
+ }
3211
+ }, R = {
3212
+ begin: ".?gql`",
3213
+ end: "",
3214
+ starts: {
3215
+ end: "`",
3216
+ returnEnd: !1,
3217
+ contains: [
3218
+ t.BACKSLASH_ESCAPE,
3219
+ T
3220
+ ],
3221
+ subLanguage: "graphql"
3222
+ }
3223
+ }, Z = {
3224
+ className: "string",
3225
+ begin: "`",
3226
+ end: "`",
3227
+ contains: [
3228
+ t.BACKSLASH_ESCAPE,
3229
+ T
3230
+ ]
3231
+ }, W = {
3232
+ className: "comment",
3233
+ variants: [
3234
+ t.COMMENT(
3235
+ /\/\*\*(?!\/)/,
3236
+ "\\*/",
3237
+ {
3238
+ relevance: 0,
3239
+ contains: [
3240
+ {
3241
+ begin: "(?=@[A-Za-z]+)",
3242
+ relevance: 0,
3243
+ contains: [
3244
+ {
3245
+ className: "doctag",
3246
+ begin: "@[A-Za-z]+"
3247
+ },
3248
+ {
3249
+ className: "type",
3250
+ begin: "\\{",
3251
+ end: "\\}",
3252
+ excludeEnd: !0,
3253
+ excludeBegin: !0,
3254
+ relevance: 0
3255
+ },
3256
+ {
3257
+ className: "variable",
3258
+ begin: o + "(?=\\s*(-)|$)",
3259
+ endsParent: !0,
3260
+ relevance: 0
3261
+ },
3262
+ // eat spaces (not newlines) so we can find
3263
+ // types or variables
3264
+ {
3265
+ begin: /(?=[^\n])\s/,
3266
+ relevance: 0
3267
+ }
3268
+ ]
3269
+ }
3270
+ ]
3271
+ }
3272
+ ),
3273
+ t.C_BLOCK_COMMENT_MODE,
3274
+ t.C_LINE_COMMENT_MODE
3275
+ ]
3276
+ }, Q = [
3277
+ t.APOS_STRING_MODE,
3278
+ t.QUOTE_STRING_MODE,
3279
+ F,
3280
+ L,
3281
+ R,
3282
+ Z,
3283
+ // Skip numbers when they are part of a variable name
3284
+ { match: /\$\d+/ },
3285
+ C
3286
+ // This is intentional:
3287
+ // See https://github.com/highlightjs/highlight.js/issues/3288
3288
+ // hljs.REGEXP_MODE
3289
+ ];
3290
+ T.contains = Q.concat({
3291
+ // we need to pair up {} inside our subst to prevent
3292
+ // it from ending too early by matching another }
3293
+ begin: /\{/,
3294
+ end: /\}/,
3295
+ keywords: h,
3296
+ contains: [
3297
+ "self"
3298
+ ].concat(Q)
3299
+ });
3300
+ const U = [].concat(W, T.contains), G = U.concat([
3301
+ // eat recursive parens in sub expressions
3302
+ {
3303
+ begin: /(\s*)\(/,
3304
+ end: /\)/,
3305
+ keywords: h,
3306
+ contains: ["self"].concat(U)
3307
+ }
3308
+ ]), K = {
3309
+ className: "params",
3310
+ // convert this to negative lookbehind in v12
3311
+ begin: /(\s*)\(/,
3312
+ // to match the parms with
3313
+ end: /\)/,
3314
+ excludeBegin: !0,
3315
+ excludeEnd: !0,
3316
+ keywords: h,
3317
+ contains: G
3318
+ }, re = {
3319
+ variants: [
3320
+ // class Car extends vehicle
3321
+ {
3322
+ match: [
3323
+ /class/,
3324
+ /\s+/,
3325
+ o,
3326
+ /\s+/,
3327
+ /extends/,
3328
+ /\s+/,
3329
+ g.concat(o, "(", g.concat(/\./, o), ")*")
3330
+ ],
3331
+ scope: {
3332
+ 1: "keyword",
3333
+ 3: "title.class",
3334
+ 5: "keyword",
3335
+ 7: "title.class.inherited"
3336
+ }
3337
+ },
3338
+ // class Car
3339
+ {
3340
+ match: [
3341
+ /class/,
3342
+ /\s+/,
3343
+ o
3344
+ ],
3345
+ scope: {
3346
+ 1: "keyword",
3347
+ 3: "title.class"
3348
+ }
3349
+ }
3350
+ ]
3351
+ }, ne = {
3352
+ relevance: 0,
3353
+ match: g.either(
3354
+ // Hard coded exceptions
3355
+ /\bJSON/,
3356
+ // Float32Array, OutT
3357
+ /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
3358
+ // CSSFactory, CSSFactoryT
3359
+ /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,
3360
+ // FPs, FPsT
3361
+ /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/
3362
+ // P
3363
+ // single letters are not highlighted
3364
+ // BLAH
3365
+ // this will be flagged as a UPPER_CASE_CONSTANT instead
3366
+ ),
3367
+ className: "title.class",
3368
+ keywords: {
3369
+ _: [
3370
+ // se we still get relevance credit for JS library classes
3371
+ ...ln,
3372
+ ...un
3373
+ ]
3374
+ }
3375
+ }, de = {
3376
+ label: "use_strict",
3377
+ className: "meta",
3378
+ relevance: 10,
3379
+ begin: /^\s*['"]use (strict|asm)['"]/
3380
+ }, Ee = {
3381
+ variants: [
3382
+ {
3383
+ match: [
3384
+ /function/,
3385
+ /\s+/,
3386
+ o,
3387
+ /(?=\s*\()/
3388
+ ]
3389
+ },
3390
+ // anonymous function
3391
+ {
3392
+ match: [
3393
+ /function/,
3394
+ /\s*(?=\()/
3395
+ ]
3396
+ }
3397
+ ],
3398
+ className: {
3399
+ 1: "keyword",
3400
+ 3: "title.function"
3401
+ },
3402
+ label: "func.def",
3403
+ contains: [K],
3404
+ illegal: /%/
3405
+ }, _e = {
3406
+ relevance: 0,
3407
+ match: /\b[A-Z][A-Z_0-9]+\b/,
3408
+ className: "variable.constant"
3409
+ };
3410
+ function he(S) {
3411
+ return g.concat("(?!", S.join("|"), ")");
3412
+ }
3413
+ const Se = {
3414
+ match: g.concat(
3415
+ /\b/,
3416
+ he([
3417
+ ...gn,
3418
+ "super",
3419
+ "import",
3420
+ "await"
3421
+ ].map((S) => `${S}\\s*\\(`)),
3422
+ o,
3423
+ g.lookahead(/\s*\(/)
3424
+ ),
3425
+ className: "title.function",
3426
+ relevance: 0
3427
+ }, te = {
3428
+ begin: g.concat(/\./, g.lookahead(
3429
+ g.concat(o, /(?![0-9A-Za-z$_(])/)
3430
+ )),
3431
+ end: o,
3432
+ excludeBegin: !0,
3433
+ keywords: "prototype",
3434
+ className: "property",
3435
+ relevance: 0
3436
+ }, Ae = {
3437
+ match: [
3438
+ /get|set/,
3439
+ /\s+/,
3440
+ o,
3441
+ /(?=\()/
3442
+ ],
3443
+ className: {
3444
+ 1: "keyword",
3445
+ 3: "title.function"
3446
+ },
3447
+ contains: [
3448
+ {
3449
+ // eat to avoid empty params
3450
+ begin: /\(\)/
3451
+ },
3452
+ K
3453
+ ]
3454
+ }, oe = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + t.UNDERSCORE_IDENT_RE + ")\\s*=>", Ne = {
3455
+ match: [
3456
+ /const|var|let/,
3457
+ /\s+/,
3458
+ o,
3459
+ /\s*/,
3460
+ /=\s*/,
3461
+ /(async\s*)?/,
3462
+ // async is optional
3463
+ g.lookahead(oe)
3464
+ ],
3465
+ keywords: "async",
3466
+ className: {
3467
+ 1: "keyword",
3468
+ 3: "title.function"
3469
+ },
3470
+ contains: [
3471
+ K
3472
+ ]
3473
+ };
3474
+ return {
3475
+ name: "JavaScript",
3476
+ aliases: ["js", "jsx", "mjs", "cjs"],
3477
+ keywords: h,
3478
+ // this will be extended by TypeScript
3479
+ exports: { PARAMS_CONTAINS: G, CLASS_REFERENCE: ne },
3480
+ illegal: /#(?![$_A-Za-z])/,
3481
+ contains: [
3482
+ t.SHEBANG({
3483
+ label: "shebang",
3484
+ binary: "node",
3485
+ relevance: 5
3486
+ }),
3487
+ de,
3488
+ t.APOS_STRING_MODE,
3489
+ t.QUOTE_STRING_MODE,
3490
+ F,
3491
+ L,
3492
+ R,
3493
+ Z,
3494
+ W,
3495
+ // Skip numbers when they are part of a variable name
3496
+ { match: /\$\d+/ },
3497
+ C,
3498
+ ne,
3499
+ {
3500
+ scope: "attr",
3501
+ match: o + g.lookahead(":"),
3502
+ relevance: 0
3503
+ },
3504
+ Ne,
3505
+ {
3506
+ // "value" container
3507
+ begin: "(" + t.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
3508
+ keywords: "return throw case",
3509
+ relevance: 0,
3510
+ contains: [
3511
+ W,
3512
+ t.REGEXP_MODE,
3513
+ {
3514
+ className: "function",
3515
+ // we have to count the parens to make sure we actually have the
3516
+ // correct bounding ( ) before the =>. There could be any number of
3517
+ // sub-expressions inside also surrounded by parens.
3518
+ begin: oe,
3519
+ returnBegin: !0,
3520
+ end: "\\s*=>",
3521
+ contains: [
3522
+ {
3523
+ className: "params",
3524
+ variants: [
3525
+ {
3526
+ begin: t.UNDERSCORE_IDENT_RE,
3527
+ relevance: 0
3528
+ },
3529
+ {
3530
+ className: null,
3531
+ begin: /\(\s*\)/,
3532
+ skip: !0
3533
+ },
3534
+ {
3535
+ begin: /(\s*)\(/,
3536
+ end: /\)/,
3537
+ excludeBegin: !0,
3538
+ excludeEnd: !0,
3539
+ keywords: h,
3540
+ contains: G
3541
+ }
3542
+ ]
3543
+ }
3544
+ ]
3545
+ },
3546
+ {
3547
+ // could be a comma delimited list of params to a function call
3548
+ begin: /,/,
3549
+ relevance: 0
3550
+ },
3551
+ {
3552
+ match: /\s+/,
3553
+ relevance: 0
3554
+ },
3555
+ {
3556
+ // JSX
3557
+ variants: [
3558
+ { begin: A.begin, end: A.end },
3559
+ { match: D },
3560
+ {
3561
+ begin: y.begin,
3562
+ // we carefully check the opening tag to see if it truly
3563
+ // is a tag and not a false positive
3564
+ "on:begin": y.isTrulyOpeningTag,
3565
+ end: y.end
3566
+ }
3567
+ ],
3568
+ subLanguage: "xml",
3569
+ contains: [
3570
+ {
3571
+ begin: y.begin,
3572
+ end: y.end,
3573
+ skip: !0,
3574
+ contains: ["self"]
3575
+ }
3576
+ ]
3577
+ }
3578
+ ]
3579
+ },
3580
+ Ee,
3581
+ {
3582
+ // prevent this from getting swallowed up by function
3583
+ // since they appear "function like"
3584
+ beginKeywords: "while if switch catch for"
3585
+ },
3586
+ {
3587
+ // we have to count the parens to make sure we actually have the correct
3588
+ // bounding ( ). There could be any number of sub-expressions inside
3589
+ // also surrounded by parens.
3590
+ begin: "\\b(?!function)" + t.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
3591
+ // end parens
3592
+ returnBegin: !0,
3593
+ label: "func.def",
3594
+ contains: [
3595
+ K,
3596
+ t.inherit(t.TITLE_MODE, { begin: o, className: "title.function" })
3597
+ ]
3598
+ },
3599
+ // catch ... so it won't trigger the property rule below
3600
+ {
3601
+ match: /\.\.\./,
3602
+ relevance: 0
3603
+ },
3604
+ te,
3605
+ // hack: prevents detection of keywords in some circumstances
3606
+ // .keyword()
3607
+ // $keyword = x
3608
+ {
3609
+ match: "\\$" + o,
3610
+ relevance: 0
3611
+ },
3612
+ {
3613
+ match: [/\bconstructor(?=\s*\()/],
3614
+ className: { 1: "title.function" },
3615
+ contains: [K]
3616
+ },
3617
+ Se,
3618
+ _e,
3619
+ re,
3620
+ Ae,
3621
+ {
3622
+ match: /\$[(.]/
3623
+ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
3624
+ }
3625
+ ]
3626
+ };
3627
+ }
3628
+ function pt(t) {
3629
+ const g = t.regex, d = bt(t), o = Ce, A = [
3630
+ "any",
3631
+ "void",
3632
+ "number",
3633
+ "boolean",
3634
+ "string",
3635
+ "object",
3636
+ "never",
3637
+ "symbol",
3638
+ "bigint",
3639
+ "unknown"
3640
+ ], D = {
3641
+ begin: [
3642
+ /namespace/,
3643
+ /\s+/,
3644
+ t.IDENT_RE
3645
+ ],
3646
+ beginScope: {
3647
+ 1: "keyword",
3648
+ 3: "title.class"
3649
+ }
3650
+ }, y = {
3651
+ beginKeywords: "interface",
3652
+ end: /\{/,
3653
+ excludeEnd: !0,
3654
+ keywords: {
3655
+ keyword: "interface extends",
3656
+ built_in: A
3657
+ },
3658
+ contains: [d.exports.CLASS_REFERENCE]
3659
+ }, h = {
3660
+ className: "meta",
3661
+ relevance: 10,
3662
+ begin: /^\s*['"]use strict['"]/
3663
+ }, M = [
3664
+ "type",
3665
+ // "namespace",
3666
+ "interface",
3667
+ "public",
3668
+ "private",
3669
+ "protected",
3670
+ "implements",
3671
+ "declare",
3672
+ "abstract",
3673
+ "readonly",
3674
+ "enum",
3675
+ "override",
3676
+ "satisfies"
3677
+ ], w = {
3678
+ $pattern: Ce,
3679
+ keyword: cn.concat(M),
3680
+ literal: on,
3681
+ built_in: dn.concat(A),
3682
+ "variable.language": fn
3683
+ }, I = {
3684
+ className: "meta",
3685
+ begin: "@" + o
3686
+ }, C = (R, Z, Y) => {
3687
+ const W = R.contains.findIndex((Q) => Q.label === Z);
3688
+ if (W === -1)
3689
+ throw new Error("can not find mode to replace");
3690
+ R.contains.splice(W, 1, Y);
3691
+ };
3692
+ Object.assign(d.keywords, w), d.exports.PARAMS_CONTAINS.push(I);
3693
+ const T = d.contains.find((R) => R.scope === "attr"), F = Object.assign(
3694
+ {},
3695
+ T,
3696
+ { match: g.concat(o, g.lookahead(/\s*\?:/)) }
3697
+ );
3698
+ d.exports.PARAMS_CONTAINS.push([
3699
+ d.exports.CLASS_REFERENCE,
3700
+ // class reference for highlighting the params types
3701
+ T,
3702
+ // highlight the params key
3703
+ F
3704
+ // Added for optional property assignment highlighting
3705
+ ]), d.contains = d.contains.concat([
3706
+ I,
3707
+ D,
3708
+ y,
3709
+ F
3710
+ // Added for optional property assignment highlighting
3711
+ ]), C(d, "shebang", t.SHEBANG()), C(d, "use_strict", h);
3712
+ const L = d.contains.find((R) => R.label === "func.def");
3713
+ return L.relevance = 0, Object.assign(d, {
3714
+ name: "TypeScript",
3715
+ aliases: [
3716
+ "ts",
3717
+ "tsx",
3718
+ "mts",
3719
+ "cts"
3720
+ ]
3721
+ }), d;
3722
+ }
3723
+ fe.registerLanguage("c", ct);
3724
+ fe.registerLanguage("go", ot);
3725
+ fe.registerLanguage("javascript", dt);
3726
+ fe.registerLanguage("python", Et);
3727
+ fe.registerLanguage("rust", _t);
3728
+ fe.registerLanguage("typescript", pt);
3729
+ const ht = {
3730
+ ".c": "c",
3731
+ ".go": "go",
3732
+ ".h": "c",
3733
+ ".js": "javascript",
3734
+ ".jsx": "javascript",
3735
+ ".py": "python",
3736
+ ".rs": "rust",
3737
+ ".ts": "typescript",
3738
+ ".tsx": "typescript"
3739
+ };
3740
+ function St(t) {
3741
+ return t.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#x27;");
3742
+ }
3743
+ function At(t) {
3744
+ const g = [], d = [], o = /<span class="[^"]+">|<\/span>|\n/g;
3745
+ let A = "", D = 0;
3746
+ for (const y of t.matchAll(o)) {
3747
+ A += t.slice(D, y.index);
3748
+ const h = y[0];
3749
+ h === `
3750
+ ` ? (A += "</span>".repeat(d.length), g.push(A), A = d.join("")) : h === "</span>" ? (d.pop(), A += h) : (d.push(h), A += h), D = y.index + h.length;
3751
+ }
3752
+ return A += t.slice(D), g.push(A), g;
3753
+ }
3754
+ function yt(t, g) {
3755
+ const d = ht[st(t)];
3756
+ if (!d) return g.split(/\r?\n/).map(St);
3757
+ const o = g.replaceAll(`\r
3758
+ `, `
3759
+ `), A = fe.highlight(o, {
3760
+ language: d,
3761
+ ignoreIllegals: !0
3762
+ }).value;
3763
+ return At(A);
3764
+ }
3765
+ export {
3766
+ yt as highlightSource
3767
+ };