@hep-code-runner/vue3 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2588 @@
1
+ import { defineComponent as ue, useCssVars as he, ref as C, computed as G, onMounted as ce, watch as de, openBlock as x, createElementBlock as N, normalizeClass as W, createElementVNode as A, withDirectives as be, createCommentVNode as H, Fragment as Ee, renderList as ve, toDisplayString as B, vModelSelect as ye, createTextVNode as Ae, normalizeStyle as ie, createVNode as Se } from "vue";
2
+ var we = Object.defineProperty, Te = (o, d, a) => d in o ? we(o, d, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[d] = a, oe = (o, d, a) => Te(o, typeof d != "symbol" ? d + "" : d, a);
3
+ let te = null;
4
+ class ke {
5
+ constructor(d = {}) {
6
+ oe(this, "baseUrl"), oe(this, "timeout"), this.baseUrl = d.pistonUrl || "/api/piston", this.timeout = d.timeout || 3e3;
7
+ }
8
+ async getRuntimes(d = !1) {
9
+ if (te && !d)
10
+ return te;
11
+ try {
12
+ const a = await fetch(`${this.baseUrl}/runtimes`, {
13
+ method: "GET",
14
+ headers: {
15
+ "Content-Type": "application/json"
16
+ }
17
+ });
18
+ if (!a.ok)
19
+ throw new Error(`Failed to fetch runtimes: ${a.statusText}`);
20
+ const l = await a.json();
21
+ return te = l, l;
22
+ } catch (a) {
23
+ throw console.error("Failed to fetch runtimes:", a), a;
24
+ }
25
+ }
26
+ async execute(d, a, l = {}) {
27
+ const b = (await this.getRuntimes()).find(
28
+ (f) => {
29
+ var S;
30
+ return f.language.toLowerCase() === d.toLowerCase() || ((S = f.aliases) == null ? void 0 : S.some((k) => k.toLowerCase() === d.toLowerCase()));
31
+ }
32
+ );
33
+ if (!b)
34
+ throw new Error(`Language '${d}' is not supported`);
35
+ const v = this.getFileName(d), E = {
36
+ language: b.language,
37
+ version: l.version || b.version,
38
+ files: [
39
+ {
40
+ name: v,
41
+ content: a
42
+ }
43
+ ],
44
+ stdin: l.stdin || "",
45
+ args: l.args || [],
46
+ run_timeout: l.runTimeout || this.timeout,
47
+ compile_timeout: this.timeout
48
+ }, i = Date.now();
49
+ try {
50
+ const f = await fetch(`${this.baseUrl}/execute`, {
51
+ method: "POST",
52
+ headers: {
53
+ "Content-Type": "application/json"
54
+ },
55
+ body: JSON.stringify(E)
56
+ });
57
+ if (!f.ok)
58
+ throw new Error(`Execute failed: ${f.statusText}`);
59
+ const S = await f.json(), k = Date.now() - i, O = S.run.stdout || "", I = S.run.stderr || "";
60
+ return {
61
+ success: S.run.code === 0,
62
+ output: O,
63
+ stderr: I,
64
+ code: S.run.code,
65
+ executionTime: k,
66
+ compile: S.compile ? {
67
+ stdout: S.compile.stdout || "",
68
+ stderr: S.compile.stderr || "",
69
+ code: S.compile.code
70
+ } : void 0
71
+ };
72
+ } catch (f) {
73
+ return {
74
+ success: !1,
75
+ output: "",
76
+ stderr: f instanceof Error ? f.message : "Unknown error",
77
+ code: -1,
78
+ executionTime: Date.now() - i
79
+ };
80
+ }
81
+ }
82
+ getFileName(d) {
83
+ return {
84
+ javascript: "main.js",
85
+ typescript: "main.ts",
86
+ python: "main.py",
87
+ python3: "main.py",
88
+ go: "main.go",
89
+ rust: "main.rs",
90
+ java: "Main.java",
91
+ c: "main.c",
92
+ cpp: "main.cpp",
93
+ csharp: "Main.cs",
94
+ ruby: "main.rb",
95
+ php: "main.php",
96
+ bash: "main.sh",
97
+ shell: "main.sh",
98
+ perl: "main.pl",
99
+ lua: "main.lua",
100
+ swift: "main.swift",
101
+ kotlin: "Main.kt",
102
+ scala: "Main.scala",
103
+ haskell: "main.hs",
104
+ dart: "main.dart",
105
+ html: "index.html",
106
+ css: "style.css",
107
+ sql: "query.sql",
108
+ markdown: "readme.md"
109
+ }[d.toLowerCase()] || `main.${d}`;
110
+ }
111
+ }
112
+ const Ie = {
113
+ javascript: 'console.log("Hello, World!");',
114
+ typescript: 'console.log("Hello, World!");',
115
+ python: 'print("Hello, World!")',
116
+ python3: 'print("Hello, World!")',
117
+ go: `package main
118
+
119
+ import "fmt"
120
+
121
+ func main() {
122
+ fmt.Println("Hello, World!")
123
+ }`,
124
+ rust: `fn main() {
125
+ println!("Hello, World!");
126
+ }`,
127
+ java: `public class Main {
128
+ public static void main(String[] args) {
129
+ System.out.println("Hello, World!");
130
+ }
131
+ }`,
132
+ c: `#include <stdio.h>
133
+
134
+ int main() {
135
+ printf("Hello, World!\\n");
136
+ return 0;
137
+ }`,
138
+ cpp: `#include <iostream>
139
+
140
+ int main() {
141
+ std::cout << "Hello, World!" << std::endl;
142
+ return 0;
143
+ }`,
144
+ csharp: `using System;
145
+
146
+ class Main {
147
+ static void Main() {
148
+ Console.WriteLine("Hello, World!");
149
+ }
150
+ }`,
151
+ ruby: 'puts "Hello, World!"',
152
+ php: `<?php
153
+ echo "Hello, World!";
154
+ ?>`,
155
+ bash: 'echo "Hello, World!"',
156
+ shell: 'echo "Hello, World!"',
157
+ perl: 'print "Hello, World!\\n";',
158
+ lua: 'print("Hello, World!")',
159
+ r: 'print("Hello, World!")',
160
+ swift: 'print("Hello, World!")',
161
+ kotlin: `fun main() {
162
+ println("Hello, World!")
163
+ }`,
164
+ scala: `object Main extends App {
165
+ println("Hello, World!")
166
+ }`,
167
+ haskell: 'main = putStrLn "Hello, World!"',
168
+ elixir: 'IO.puts "Hello, World!"',
169
+ erlang: 'main() -> io:fwrite("Hello, World!~n").',
170
+ clojure: '(println "Hello, World!")',
171
+ fsharp: 'printfn "Hello, World!"',
172
+ dart: `void main() {
173
+ print("Hello, World!");
174
+ }`,
175
+ assembly: `section .data
176
+ msg db 'Hello, World!', 0
177
+ section .text
178
+ global _start
179
+ _start:
180
+ mov rax, 1
181
+ mov rdi, 1
182
+ mov rsi, msg
183
+ mov rdx, 13
184
+ syscall
185
+ mov rax, 60
186
+ xor rdi, rdi
187
+ syscall`,
188
+ html: `<!DOCTYPE html>
189
+ <html>
190
+ <head>
191
+ <title>Hello</title>
192
+ </head>
193
+ <body>
194
+ <h1>Hello, World!</h1>
195
+ </body>
196
+ </html>`,
197
+ css: `body {
198
+ background-color: #f0f0f0;
199
+ font-family: Arial, sans-serif;
200
+ }
201
+
202
+ h1 {
203
+ color: #333;
204
+ }`,
205
+ sql: "SELECT 'Hello, World!' AS message;",
206
+ markdown: `# Hello, World!
207
+
208
+ This is a sample markdown document.`
209
+ };
210
+ function ae(o) {
211
+ const d = o.toLowerCase();
212
+ return Ie[d] || `// ${o}
213
+ // Write your code here`;
214
+ }
215
+ var le = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
216
+ function Fe(o) {
217
+ return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
218
+ }
219
+ var pe = { exports: {} };
220
+ (function(o) {
221
+ var d = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
222
+ /**
223
+ * Prism: Lightweight, robust, elegant syntax highlighting
224
+ *
225
+ * @license MIT <https://opensource.org/licenses/MIT>
226
+ * @author Lea Verou <https://lea.verou.me>
227
+ * @namespace
228
+ * @public
229
+ */
230
+ var a = function(l) {
231
+ var b = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, v = 0, E = {}, i = {
232
+ /**
233
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
234
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
235
+ * additional languages or plugins yourself.
236
+ *
237
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
238
+ *
239
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
240
+ * empty Prism object into the global scope before loading the Prism script like this:
241
+ *
242
+ * ```js
243
+ * window.Prism = window.Prism || {};
244
+ * Prism.manual = true;
245
+ * // add a new <script> to load Prism's script
246
+ * ```
247
+ *
248
+ * @default false
249
+ * @type {boolean}
250
+ * @memberof Prism
251
+ * @public
252
+ */
253
+ manual: l.Prism && l.Prism.manual,
254
+ /**
255
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
256
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
257
+ * own worker, you don't want it to do this.
258
+ *
259
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
260
+ *
261
+ * You obviously have to change this value before Prism executes. To do this, you can add an
262
+ * empty Prism object into the global scope before loading the Prism script like this:
263
+ *
264
+ * ```js
265
+ * window.Prism = window.Prism || {};
266
+ * Prism.disableWorkerMessageHandler = true;
267
+ * // Load Prism's script
268
+ * ```
269
+ *
270
+ * @default false
271
+ * @type {boolean}
272
+ * @memberof Prism
273
+ * @public
274
+ */
275
+ disableWorkerMessageHandler: l.Prism && l.Prism.disableWorkerMessageHandler,
276
+ /**
277
+ * A namespace for utility methods.
278
+ *
279
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
280
+ * change or disappear at any time.
281
+ *
282
+ * @namespace
283
+ * @memberof Prism
284
+ */
285
+ util: {
286
+ encode: function t(e) {
287
+ return e instanceof f ? new f(e.type, t(e.content), e.alias) : Array.isArray(e) ? e.map(t) : e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
288
+ },
289
+ /**
290
+ * Returns the name of the type of the given value.
291
+ *
292
+ * @param {any} o
293
+ * @returns {string}
294
+ * @example
295
+ * type(null) === 'Null'
296
+ * type(undefined) === 'Undefined'
297
+ * type(123) === 'Number'
298
+ * type('foo') === 'String'
299
+ * type(true) === 'Boolean'
300
+ * type([1, 2]) === 'Array'
301
+ * type({}) === 'Object'
302
+ * type(String) === 'Function'
303
+ * type(/abc+/) === 'RegExp'
304
+ */
305
+ type: function(t) {
306
+ return Object.prototype.toString.call(t).slice(8, -1);
307
+ },
308
+ /**
309
+ * Returns a unique number for the given object. Later calls will still return the same number.
310
+ *
311
+ * @param {Object} obj
312
+ * @returns {number}
313
+ */
314
+ objId: function(t) {
315
+ return t.__id || Object.defineProperty(t, "__id", { value: ++v }), t.__id;
316
+ },
317
+ /**
318
+ * Creates a deep clone of the given object.
319
+ *
320
+ * The main intended use of this function is to clone language definitions.
321
+ *
322
+ * @param {T} o
323
+ * @param {Record<number, any>} [visited]
324
+ * @returns {T}
325
+ * @template T
326
+ */
327
+ clone: function t(e, n) {
328
+ n = n || {};
329
+ var r, s;
330
+ switch (i.util.type(e)) {
331
+ case "Object":
332
+ if (s = i.util.objId(e), n[s])
333
+ return n[s];
334
+ r = /** @type {Record<string, any>} */
335
+ {}, n[s] = r;
336
+ for (var c in e)
337
+ e.hasOwnProperty(c) && (r[c] = t(e[c], n));
338
+ return (
339
+ /** @type {any} */
340
+ r
341
+ );
342
+ case "Array":
343
+ return s = i.util.objId(e), n[s] ? n[s] : (r = [], n[s] = r, /** @type {Array} */
344
+ /** @type {any} */
345
+ e.forEach(function(m, u) {
346
+ r[u] = t(m, n);
347
+ }), /** @type {any} */
348
+ r);
349
+ default:
350
+ return e;
351
+ }
352
+ },
353
+ /**
354
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
355
+ *
356
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
357
+ *
358
+ * @param {Element} element
359
+ * @returns {string}
360
+ */
361
+ getLanguage: function(t) {
362
+ for (; t; ) {
363
+ var e = b.exec(t.className);
364
+ if (e)
365
+ return e[1].toLowerCase();
366
+ t = t.parentElement;
367
+ }
368
+ return "none";
369
+ },
370
+ /**
371
+ * Sets the Prism `language-xxxx` class of the given element.
372
+ *
373
+ * @param {Element} element
374
+ * @param {string} language
375
+ * @returns {void}
376
+ */
377
+ setLanguage: function(t, e) {
378
+ t.className = t.className.replace(RegExp(b, "gi"), ""), t.classList.add("language-" + e);
379
+ },
380
+ /**
381
+ * Returns the script element that is currently executing.
382
+ *
383
+ * This does __not__ work for line script element.
384
+ *
385
+ * @returns {HTMLScriptElement | null}
386
+ */
387
+ currentScript: function() {
388
+ if (typeof document > "u")
389
+ return null;
390
+ if (document.currentScript && document.currentScript.tagName === "SCRIPT")
391
+ return (
392
+ /** @type {any} */
393
+ document.currentScript
394
+ );
395
+ try {
396
+ throw new Error();
397
+ } catch (r) {
398
+ var t = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack) || [])[1];
399
+ if (t) {
400
+ var e = document.getElementsByTagName("script");
401
+ for (var n in e)
402
+ if (e[n].src == t)
403
+ return e[n];
404
+ }
405
+ return null;
406
+ }
407
+ },
408
+ /**
409
+ * Returns whether a given class is active for `element`.
410
+ *
411
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
412
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
413
+ * given class is just the given class with a `no-` prefix.
414
+ *
415
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
416
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
417
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
418
+ *
419
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
420
+ * version of it, the class is considered active.
421
+ *
422
+ * @param {Element} element
423
+ * @param {string} className
424
+ * @param {boolean} [defaultActivation=false]
425
+ * @returns {boolean}
426
+ */
427
+ isActive: function(t, e, n) {
428
+ for (var r = "no-" + e; t; ) {
429
+ var s = t.classList;
430
+ if (s.contains(e))
431
+ return !0;
432
+ if (s.contains(r))
433
+ return !1;
434
+ t = t.parentElement;
435
+ }
436
+ return !!n;
437
+ }
438
+ },
439
+ /**
440
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
441
+ *
442
+ * @namespace
443
+ * @memberof Prism
444
+ * @public
445
+ */
446
+ languages: {
447
+ /**
448
+ * The grammar for plain, unformatted text.
449
+ */
450
+ plain: E,
451
+ plaintext: E,
452
+ text: E,
453
+ txt: E,
454
+ /**
455
+ * Creates a deep copy of the language with the given id and appends the given tokens.
456
+ *
457
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
458
+ * will be overwritten at its original position.
459
+ *
460
+ * ## Best practices
461
+ *
462
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
463
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
464
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
465
+ *
466
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
467
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
468
+ *
469
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
470
+ * @param {Grammar} redef The new tokens to append.
471
+ * @returns {Grammar} The new language created.
472
+ * @public
473
+ * @example
474
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
475
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
476
+ * // at its original position
477
+ * 'comment': { ... },
478
+ * // CSS doesn't have a 'color' token, so this token will be appended
479
+ * 'color': /\b(?:red|green|blue)\b/
480
+ * });
481
+ */
482
+ extend: function(t, e) {
483
+ var n = i.util.clone(i.languages[t]);
484
+ for (var r in e)
485
+ n[r] = e[r];
486
+ return n;
487
+ },
488
+ /**
489
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
490
+ *
491
+ * ## Usage
492
+ *
493
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
494
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
495
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
496
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
497
+ * this:
498
+ *
499
+ * ```js
500
+ * Prism.languages.markup.style = {
501
+ * // token
502
+ * };
503
+ * ```
504
+ *
505
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
506
+ * before existing tokens. For the CSS example above, you would use it like this:
507
+ *
508
+ * ```js
509
+ * Prism.languages.insertBefore('markup', 'cdata', {
510
+ * 'style': {
511
+ * // token
512
+ * }
513
+ * });
514
+ * ```
515
+ *
516
+ * ## Special cases
517
+ *
518
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
519
+ * will be ignored.
520
+ *
521
+ * This behavior can be used to insert tokens after `before`:
522
+ *
523
+ * ```js
524
+ * Prism.languages.insertBefore('markup', 'comment', {
525
+ * 'comment': Prism.languages.markup.comment,
526
+ * // tokens after 'comment'
527
+ * });
528
+ * ```
529
+ *
530
+ * ## Limitations
531
+ *
532
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
533
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
534
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
535
+ * deleting properties which is necessary to insert at arbitrary positions.
536
+ *
537
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
538
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
539
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
540
+ *
541
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
542
+ * you hold the target object in a variable, then the value of the variable will not change.
543
+ *
544
+ * ```js
545
+ * var oldMarkup = Prism.languages.markup;
546
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
547
+ *
548
+ * assert(oldMarkup !== Prism.languages.markup);
549
+ * assert(newMarkup === Prism.languages.markup);
550
+ * ```
551
+ *
552
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
553
+ * object to be modified.
554
+ * @param {string} before The key to insert before.
555
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
556
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
557
+ * object to be modified.
558
+ *
559
+ * Defaults to `Prism.languages`.
560
+ * @returns {Grammar} The new grammar object.
561
+ * @public
562
+ */
563
+ insertBefore: function(t, e, n, r) {
564
+ r = r || /** @type {any} */
565
+ i.languages;
566
+ var s = r[t], c = {};
567
+ for (var m in s)
568
+ if (s.hasOwnProperty(m)) {
569
+ if (m == e)
570
+ for (var u in n)
571
+ n.hasOwnProperty(u) && (c[u] = n[u]);
572
+ n.hasOwnProperty(m) || (c[m] = s[m]);
573
+ }
574
+ var w = r[t];
575
+ return r[t] = c, i.languages.DFS(i.languages, function(F, P) {
576
+ P === w && F != t && (this[F] = c);
577
+ }), c;
578
+ },
579
+ // Traverse a language definition with Depth First Search
580
+ DFS: function t(e, n, r, s) {
581
+ s = s || {};
582
+ var c = i.util.objId;
583
+ for (var m in e)
584
+ if (e.hasOwnProperty(m)) {
585
+ n.call(e, m, e[m], r || m);
586
+ var u = e[m], w = i.util.type(u);
587
+ w === "Object" && !s[c(u)] ? (s[c(u)] = !0, t(u, n, null, s)) : w === "Array" && !s[c(u)] && (s[c(u)] = !0, t(u, n, m, s));
588
+ }
589
+ }
590
+ },
591
+ plugins: {},
592
+ /**
593
+ * This is the most high-level function in Prism’s API.
594
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
595
+ * each one of them.
596
+ *
597
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
598
+ *
599
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
600
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
601
+ * @memberof Prism
602
+ * @public
603
+ */
604
+ highlightAll: function(t, e) {
605
+ i.highlightAllUnder(document, t, e);
606
+ },
607
+ /**
608
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
609
+ * {@link Prism.highlightElement} on each one of them.
610
+ *
611
+ * The following hooks will be run:
612
+ * 1. `before-highlightall`
613
+ * 2. `before-all-elements-highlight`
614
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
615
+ *
616
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
617
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
618
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
619
+ * @memberof Prism
620
+ * @public
621
+ */
622
+ highlightAllUnder: function(t, e, n) {
623
+ var r = {
624
+ callback: n,
625
+ container: t,
626
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
627
+ };
628
+ i.hooks.run("before-highlightall", r), r.elements = Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)), i.hooks.run("before-all-elements-highlight", r);
629
+ for (var s = 0, c; c = r.elements[s++]; )
630
+ i.highlightElement(c, e === !0, r.callback);
631
+ },
632
+ /**
633
+ * Highlights the code inside a single element.
634
+ *
635
+ * The following hooks will be run:
636
+ * 1. `before-sanity-check`
637
+ * 2. `before-highlight`
638
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
639
+ * 4. `before-insert`
640
+ * 5. `after-highlight`
641
+ * 6. `complete`
642
+ *
643
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
644
+ * the element's language.
645
+ *
646
+ * @param {Element} element The element containing the code.
647
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
648
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
649
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
650
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
651
+ *
652
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
653
+ * asynchronous highlighting to work. You can build your own bundle on the
654
+ * [Download page](https://prismjs.com/download.html).
655
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
656
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
657
+ * @memberof Prism
658
+ * @public
659
+ */
660
+ highlightElement: function(t, e, n) {
661
+ var r = i.util.getLanguage(t), s = i.languages[r];
662
+ i.util.setLanguage(t, r);
663
+ var c = t.parentElement;
664
+ c && c.nodeName.toLowerCase() === "pre" && i.util.setLanguage(c, r);
665
+ var m = t.textContent, u = {
666
+ element: t,
667
+ language: r,
668
+ grammar: s,
669
+ code: m
670
+ };
671
+ function w(P) {
672
+ u.highlightedCode = P, i.hooks.run("before-insert", u), u.element.innerHTML = u.highlightedCode, i.hooks.run("after-highlight", u), i.hooks.run("complete", u), n && n.call(u.element);
673
+ }
674
+ if (i.hooks.run("before-sanity-check", u), c = u.element.parentElement, c && c.nodeName.toLowerCase() === "pre" && !c.hasAttribute("tabindex") && c.setAttribute("tabindex", "0"), !u.code) {
675
+ i.hooks.run("complete", u), n && n.call(u.element);
676
+ return;
677
+ }
678
+ if (i.hooks.run("before-highlight", u), !u.grammar) {
679
+ w(i.util.encode(u.code));
680
+ return;
681
+ }
682
+ if (e && l.Worker) {
683
+ var F = new Worker(i.filename);
684
+ F.onmessage = function(P) {
685
+ w(P.data);
686
+ }, F.postMessage(JSON.stringify({
687
+ language: u.language,
688
+ code: u.code,
689
+ immediateClose: !0
690
+ }));
691
+ } else
692
+ w(i.highlight(u.code, u.grammar, u.language));
693
+ },
694
+ /**
695
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
696
+ * and the language definitions to use, and returns a string with the HTML produced.
697
+ *
698
+ * The following hooks will be run:
699
+ * 1. `before-tokenize`
700
+ * 2. `after-tokenize`
701
+ * 3. `wrap`: On each {@link Token}.
702
+ *
703
+ * @param {string} text A string with the code to be highlighted.
704
+ * @param {Grammar} grammar An object containing the tokens to use.
705
+ *
706
+ * Usually a language definition like `Prism.languages.markup`.
707
+ * @param {string} language The name of the language definition passed to `grammar`.
708
+ * @returns {string} The highlighted HTML.
709
+ * @memberof Prism
710
+ * @public
711
+ * @example
712
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
713
+ */
714
+ highlight: function(t, e, n) {
715
+ var r = {
716
+ code: t,
717
+ grammar: e,
718
+ language: n
719
+ };
720
+ if (i.hooks.run("before-tokenize", r), !r.grammar)
721
+ throw new Error('The language "' + r.language + '" has no grammar.');
722
+ return r.tokens = i.tokenize(r.code, r.grammar), i.hooks.run("after-tokenize", r), f.stringify(i.util.encode(r.tokens), r.language);
723
+ },
724
+ /**
725
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
726
+ * and the language definitions to use, and returns an array with the tokenized code.
727
+ *
728
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
729
+ *
730
+ * This method could be useful in other contexts as well, as a very crude parser.
731
+ *
732
+ * @param {string} text A string with the code to be highlighted.
733
+ * @param {Grammar} grammar An object containing the tokens to use.
734
+ *
735
+ * Usually a language definition like `Prism.languages.markup`.
736
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
737
+ * @memberof Prism
738
+ * @public
739
+ * @example
740
+ * let code = `var foo = 0;`;
741
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
742
+ * tokens.forEach(token => {
743
+ * if (token instanceof Prism.Token && token.type === 'number') {
744
+ * console.log(`Found numeric literal: ${token.content}`);
745
+ * }
746
+ * });
747
+ */
748
+ tokenize: function(t, e) {
749
+ var n = e.rest;
750
+ if (n) {
751
+ for (var r in n)
752
+ e[r] = n[r];
753
+ delete e.rest;
754
+ }
755
+ var s = new O();
756
+ return I(s, s.head, t), k(t, s, e, s.head, 0), D(s);
757
+ },
758
+ /**
759
+ * @namespace
760
+ * @memberof Prism
761
+ * @public
762
+ */
763
+ hooks: {
764
+ all: {},
765
+ /**
766
+ * Adds the given callback to the list of callbacks for the given hook.
767
+ *
768
+ * The callback will be invoked when the hook it is registered for is run.
769
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
770
+ *
771
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
772
+ *
773
+ * @param {string} name The name of the hook.
774
+ * @param {HookCallback} callback The callback function which is given environment variables.
775
+ * @public
776
+ */
777
+ add: function(t, e) {
778
+ var n = i.hooks.all;
779
+ n[t] = n[t] || [], n[t].push(e);
780
+ },
781
+ /**
782
+ * Runs a hook invoking all registered callbacks with the given environment variables.
783
+ *
784
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
785
+ *
786
+ * @param {string} name The name of the hook.
787
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
788
+ * @public
789
+ */
790
+ run: function(t, e) {
791
+ var n = i.hooks.all[t];
792
+ if (!(!n || !n.length))
793
+ for (var r = 0, s; s = n[r++]; )
794
+ s(e);
795
+ }
796
+ },
797
+ Token: f
798
+ };
799
+ l.Prism = i;
800
+ function f(t, e, n, r) {
801
+ this.type = t, this.content = e, this.alias = n, this.length = (r || "").length | 0;
802
+ }
803
+ f.stringify = function t(e, n) {
804
+ if (typeof e == "string")
805
+ return e;
806
+ if (Array.isArray(e)) {
807
+ var r = "";
808
+ return e.forEach(function(w) {
809
+ r += t(w, n);
810
+ }), r;
811
+ }
812
+ var s = {
813
+ type: e.type,
814
+ content: t(e.content, n),
815
+ tag: "span",
816
+ classes: ["token", e.type],
817
+ attributes: {},
818
+ language: n
819
+ }, c = e.alias;
820
+ c && (Array.isArray(c) ? Array.prototype.push.apply(s.classes, c) : s.classes.push(c)), i.hooks.run("wrap", s);
821
+ var m = "";
822
+ for (var u in s.attributes)
823
+ m += " " + u + '="' + (s.attributes[u] || "").replace(/"/g, "&quot;") + '"';
824
+ return "<" + s.tag + ' class="' + s.classes.join(" ") + '"' + m + ">" + s.content + "</" + s.tag + ">";
825
+ };
826
+ function S(t, e, n, r) {
827
+ t.lastIndex = e;
828
+ var s = t.exec(n);
829
+ if (s && r && s[1]) {
830
+ var c = s[1].length;
831
+ s.index += c, s[0] = s[0].slice(c);
832
+ }
833
+ return s;
834
+ }
835
+ function k(t, e, n, r, s, c) {
836
+ for (var m in n)
837
+ if (!(!n.hasOwnProperty(m) || !n[m])) {
838
+ var u = n[m];
839
+ u = Array.isArray(u) ? u : [u];
840
+ for (var w = 0; w < u.length; ++w) {
841
+ if (c && c.cause == m + "," + w)
842
+ return;
843
+ var F = u[w], P = F.inside, V = !!F.lookbehind, h = !!F.greedy, T = F.alias;
844
+ if (h && !F.pattern.global) {
845
+ var _ = F.pattern.toString().match(/[imsuy]*$/)[0];
846
+ F.pattern = RegExp(F.pattern.source, _ + "g");
847
+ }
848
+ for (var Y = F.pattern || F, R = r.next, M = s; R !== e.tail && !(c && M >= c.reach); M += R.value.length, R = R.next) {
849
+ var z = R.value;
850
+ if (e.length > t.length)
851
+ return;
852
+ if (!(z instanceof f)) {
853
+ var X = 1, $;
854
+ if (h) {
855
+ if ($ = S(Y, M, t, V), !$ || $.index >= t.length)
856
+ break;
857
+ var Z = $.index, me = $.index + $[0].length, U = M;
858
+ for (U += R.value.length; Z >= U; )
859
+ R = R.next, U += R.value.length;
860
+ if (U -= R.value.length, M = U, R.value instanceof f)
861
+ continue;
862
+ for (var j = R; j !== e.tail && (U < me || typeof j.value == "string"); j = j.next)
863
+ X++, U += j.value.length;
864
+ X--, z = t.slice(M, U), $.index -= M;
865
+ } else if ($ = S(Y, 0, z, V), !$)
866
+ continue;
867
+ var Z = $.index, K = $[0], J = z.slice(0, Z), se = z.slice(Z + K.length), Q = M + z.length;
868
+ c && Q > c.reach && (c.reach = Q);
869
+ var q = R.prev;
870
+ J && (q = I(e, q, J), M += J.length), L(e, q, X);
871
+ var fe = new f(m, P ? i.tokenize(K, P) : K, T, K);
872
+ if (R = I(e, q, fe), se && I(e, R, se), X > 1) {
873
+ var ee = {
874
+ cause: m + "," + w,
875
+ reach: Q
876
+ };
877
+ k(t, e, n, R.prev, M, ee), c && ee.reach > c.reach && (c.reach = ee.reach);
878
+ }
879
+ }
880
+ }
881
+ }
882
+ }
883
+ }
884
+ function O() {
885
+ var t = { value: null, prev: null, next: null }, e = { value: null, prev: t, next: null };
886
+ t.next = e, this.head = t, this.tail = e, this.length = 0;
887
+ }
888
+ function I(t, e, n) {
889
+ var r = e.next, s = { value: n, prev: e, next: r };
890
+ return e.next = s, r.prev = s, t.length++, s;
891
+ }
892
+ function L(t, e, n) {
893
+ for (var r = e.next, s = 0; s < n && r !== t.tail; s++)
894
+ r = r.next;
895
+ e.next = r, r.prev = e, t.length -= s;
896
+ }
897
+ function D(t) {
898
+ for (var e = [], n = t.head.next; n !== t.tail; )
899
+ e.push(n.value), n = n.next;
900
+ return e;
901
+ }
902
+ if (!l.document)
903
+ return l.addEventListener && (i.disableWorkerMessageHandler || l.addEventListener("message", function(t) {
904
+ var e = JSON.parse(t.data), n = e.language, r = e.code, s = e.immediateClose;
905
+ l.postMessage(i.highlight(r, i.languages[n], n)), s && l.close();
906
+ }, !1)), i;
907
+ var g = i.util.currentScript();
908
+ g && (i.filename = g.src, g.hasAttribute("data-manual") && (i.manual = !0));
909
+ function p() {
910
+ i.manual || i.highlightAll();
911
+ }
912
+ if (!i.manual) {
913
+ var y = document.readyState;
914
+ y === "loading" || y === "interactive" && g && g.defer ? document.addEventListener("DOMContentLoaded", p) : window.requestAnimationFrame ? window.requestAnimationFrame(p) : window.setTimeout(p, 16);
915
+ }
916
+ return i;
917
+ }(d);
918
+ o.exports && (o.exports = a), typeof le < "u" && (le.Prism = a), a.languages.markup = {
919
+ comment: {
920
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
921
+ greedy: !0
922
+ },
923
+ prolog: {
924
+ pattern: /<\?[\s\S]+?\?>/,
925
+ greedy: !0
926
+ },
927
+ doctype: {
928
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
929
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
930
+ greedy: !0,
931
+ inside: {
932
+ "internal-subset": {
933
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
934
+ lookbehind: !0,
935
+ greedy: !0,
936
+ inside: null
937
+ // see below
938
+ },
939
+ string: {
940
+ pattern: /"[^"]*"|'[^']*'/,
941
+ greedy: !0
942
+ },
943
+ punctuation: /^<!|>$|[[\]]/,
944
+ "doctype-tag": /^DOCTYPE/i,
945
+ name: /[^\s<>'"]+/
946
+ }
947
+ },
948
+ cdata: {
949
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
950
+ greedy: !0
951
+ },
952
+ tag: {
953
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
954
+ greedy: !0,
955
+ inside: {
956
+ tag: {
957
+ pattern: /^<\/?[^\s>\/]+/,
958
+ inside: {
959
+ punctuation: /^<\/?/,
960
+ namespace: /^[^\s>\/:]+:/
961
+ }
962
+ },
963
+ "special-attr": [],
964
+ "attr-value": {
965
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
966
+ inside: {
967
+ punctuation: [
968
+ {
969
+ pattern: /^=/,
970
+ alias: "attr-equals"
971
+ },
972
+ {
973
+ pattern: /^(\s*)["']|["']$/,
974
+ lookbehind: !0
975
+ }
976
+ ]
977
+ }
978
+ },
979
+ punctuation: /\/?>/,
980
+ "attr-name": {
981
+ pattern: /[^\s>\/]+/,
982
+ inside: {
983
+ namespace: /^[^\s>\/:]+:/
984
+ }
985
+ }
986
+ }
987
+ },
988
+ entity: [
989
+ {
990
+ pattern: /&[\da-z]{1,8};/i,
991
+ alias: "named-entity"
992
+ },
993
+ /&#x?[\da-f]{1,8};/i
994
+ ]
995
+ }, a.languages.markup.tag.inside["attr-value"].inside.entity = a.languages.markup.entity, a.languages.markup.doctype.inside["internal-subset"].inside = a.languages.markup, a.hooks.add("wrap", function(l) {
996
+ l.type === "entity" && (l.attributes.title = l.content.replace(/&amp;/, "&"));
997
+ }), Object.defineProperty(a.languages.markup.tag, "addInlined", {
998
+ /**
999
+ * Adds an inlined language to markup.
1000
+ *
1001
+ * An example of an inlined language is CSS with `<style>` tags.
1002
+ *
1003
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1004
+ * case insensitive.
1005
+ * @param {string} lang The language key.
1006
+ * @example
1007
+ * addInlined('style', 'css');
1008
+ */
1009
+ value: function(b, v) {
1010
+ var E = {};
1011
+ E["language-" + v] = {
1012
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1013
+ lookbehind: !0,
1014
+ inside: a.languages[v]
1015
+ }, E.cdata = /^<!\[CDATA\[|\]\]>$/i;
1016
+ var i = {
1017
+ "included-cdata": {
1018
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1019
+ inside: E
1020
+ }
1021
+ };
1022
+ i["language-" + v] = {
1023
+ pattern: /[\s\S]+/,
1024
+ inside: a.languages[v]
1025
+ };
1026
+ var f = {};
1027
+ f[b] = {
1028
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
1029
+ return b;
1030
+ }), "i"),
1031
+ lookbehind: !0,
1032
+ greedy: !0,
1033
+ inside: i
1034
+ }, a.languages.insertBefore("markup", "cdata", f);
1035
+ }
1036
+ }), Object.defineProperty(a.languages.markup.tag, "addAttribute", {
1037
+ /**
1038
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1039
+ *
1040
+ * An example of an inlined language is CSS with `style` attributes.
1041
+ *
1042
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1043
+ * case insensitive.
1044
+ * @param {string} lang The language key.
1045
+ * @example
1046
+ * addAttribute('style', 'css');
1047
+ */
1048
+ value: function(l, b) {
1049
+ a.languages.markup.tag.inside["special-attr"].push({
1050
+ pattern: RegExp(
1051
+ /(^|["'\s])/.source + "(?:" + l + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1052
+ "i"
1053
+ ),
1054
+ lookbehind: !0,
1055
+ inside: {
1056
+ "attr-name": /^[^\s=]+/,
1057
+ "attr-value": {
1058
+ pattern: /=[\s\S]+/,
1059
+ inside: {
1060
+ value: {
1061
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1062
+ lookbehind: !0,
1063
+ alias: [b, "language-" + b],
1064
+ inside: a.languages[b]
1065
+ },
1066
+ punctuation: [
1067
+ {
1068
+ pattern: /^=/,
1069
+ alias: "attr-equals"
1070
+ },
1071
+ /"|'/
1072
+ ]
1073
+ }
1074
+ }
1075
+ }
1076
+ });
1077
+ }
1078
+ }), a.languages.html = a.languages.markup, a.languages.mathml = a.languages.markup, a.languages.svg = a.languages.markup, a.languages.xml = a.languages.extend("markup", {}), a.languages.ssml = a.languages.xml, a.languages.atom = a.languages.xml, a.languages.rss = a.languages.xml, function(l) {
1079
+ var b = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1080
+ l.languages.css = {
1081
+ comment: /\/\*[\s\S]*?\*\//,
1082
+ atrule: {
1083
+ pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + b.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1084
+ inside: {
1085
+ rule: /^@[\w-]+/,
1086
+ "selector-function-argument": {
1087
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1088
+ lookbehind: !0,
1089
+ alias: "selector"
1090
+ },
1091
+ keyword: {
1092
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1093
+ lookbehind: !0
1094
+ }
1095
+ // See rest below
1096
+ }
1097
+ },
1098
+ url: {
1099
+ // https://drafts.csswg.org/css-values-3/#urls
1100
+ pattern: RegExp("\\burl\\((?:" + b.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1101
+ greedy: !0,
1102
+ inside: {
1103
+ function: /^url/i,
1104
+ punctuation: /^\(|\)$/,
1105
+ string: {
1106
+ pattern: RegExp("^" + b.source + "$"),
1107
+ alias: "url"
1108
+ }
1109
+ }
1110
+ },
1111
+ selector: {
1112
+ pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + b.source + ")*(?=\\s*\\{)"),
1113
+ lookbehind: !0
1114
+ },
1115
+ string: {
1116
+ pattern: b,
1117
+ greedy: !0
1118
+ },
1119
+ property: {
1120
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1121
+ lookbehind: !0
1122
+ },
1123
+ important: /!important\b/i,
1124
+ function: {
1125
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1126
+ lookbehind: !0
1127
+ },
1128
+ punctuation: /[(){};:,]/
1129
+ }, l.languages.css.atrule.inside.rest = l.languages.css;
1130
+ var v = l.languages.markup;
1131
+ v && (v.tag.addInlined("style", "css"), v.tag.addAttribute("style", "css"));
1132
+ }(a), a.languages.clike = {
1133
+ comment: [
1134
+ {
1135
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1136
+ lookbehind: !0,
1137
+ greedy: !0
1138
+ },
1139
+ {
1140
+ pattern: /(^|[^\\:])\/\/.*/,
1141
+ lookbehind: !0,
1142
+ greedy: !0
1143
+ }
1144
+ ],
1145
+ string: {
1146
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1147
+ greedy: !0
1148
+ },
1149
+ "class-name": {
1150
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1151
+ lookbehind: !0,
1152
+ inside: {
1153
+ punctuation: /[.\\]/
1154
+ }
1155
+ },
1156
+ keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1157
+ boolean: /\b(?:false|true)\b/,
1158
+ function: /\b\w+(?=\()/,
1159
+ number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1160
+ operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1161
+ punctuation: /[{}[\];(),.:]/
1162
+ }, a.languages.javascript = a.languages.extend("clike", {
1163
+ "class-name": [
1164
+ a.languages.clike["class-name"],
1165
+ {
1166
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1167
+ lookbehind: !0
1168
+ }
1169
+ ],
1170
+ keyword: [
1171
+ {
1172
+ pattern: /((?:^|\})\s*)catch\b/,
1173
+ lookbehind: !0
1174
+ },
1175
+ {
1176
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1177
+ lookbehind: !0
1178
+ }
1179
+ ],
1180
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1181
+ function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1182
+ number: {
1183
+ pattern: RegExp(
1184
+ /(^|[^\w$])/.source + "(?:" + // constant
1185
+ (/NaN|Infinity/.source + "|" + // binary integer
1186
+ /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
1187
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
1188
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
1189
+ /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1190
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1191
+ ),
1192
+ lookbehind: !0
1193
+ },
1194
+ operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1195
+ }), a.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, a.languages.insertBefore("javascript", "keyword", {
1196
+ regex: {
1197
+ pattern: RegExp(
1198
+ // lookbehind
1199
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1200
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
1201
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1202
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1203
+ // with the only syntax, so we have to define 2 different regex patterns.
1204
+ /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
1205
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1206
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1207
+ ),
1208
+ lookbehind: !0,
1209
+ greedy: !0,
1210
+ inside: {
1211
+ "regex-source": {
1212
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1213
+ lookbehind: !0,
1214
+ alias: "language-regex",
1215
+ inside: a.languages.regex
1216
+ },
1217
+ "regex-delimiter": /^\/|\/$/,
1218
+ "regex-flags": /^[a-z]+$/
1219
+ }
1220
+ },
1221
+ // This must be declared before keyword because we use "function" inside the look-forward
1222
+ "function-variable": {
1223
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1224
+ alias: "function"
1225
+ },
1226
+ parameter: [
1227
+ {
1228
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1229
+ lookbehind: !0,
1230
+ inside: a.languages.javascript
1231
+ },
1232
+ {
1233
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1234
+ lookbehind: !0,
1235
+ inside: a.languages.javascript
1236
+ },
1237
+ {
1238
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1239
+ lookbehind: !0,
1240
+ inside: a.languages.javascript
1241
+ },
1242
+ {
1243
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1244
+ lookbehind: !0,
1245
+ inside: a.languages.javascript
1246
+ }
1247
+ ],
1248
+ constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1249
+ }), a.languages.insertBefore("javascript", "string", {
1250
+ hashbang: {
1251
+ pattern: /^#!.*/,
1252
+ greedy: !0,
1253
+ alias: "comment"
1254
+ },
1255
+ "template-string": {
1256
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1257
+ greedy: !0,
1258
+ inside: {
1259
+ "template-punctuation": {
1260
+ pattern: /^`|`$/,
1261
+ alias: "string"
1262
+ },
1263
+ interpolation: {
1264
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1265
+ lookbehind: !0,
1266
+ inside: {
1267
+ "interpolation-punctuation": {
1268
+ pattern: /^\$\{|\}$/,
1269
+ alias: "punctuation"
1270
+ },
1271
+ rest: a.languages.javascript
1272
+ }
1273
+ },
1274
+ string: /[\s\S]+/
1275
+ }
1276
+ },
1277
+ "string-property": {
1278
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1279
+ lookbehind: !0,
1280
+ greedy: !0,
1281
+ alias: "property"
1282
+ }
1283
+ }), a.languages.insertBefore("javascript", "operator", {
1284
+ "literal-property": {
1285
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1286
+ lookbehind: !0,
1287
+ alias: "property"
1288
+ }
1289
+ }), a.languages.markup && (a.languages.markup.tag.addInlined("script", "javascript"), a.languages.markup.tag.addAttribute(
1290
+ /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
1291
+ "javascript"
1292
+ )), a.languages.js = a.languages.javascript, function() {
1293
+ if (typeof a > "u" || typeof document > "u")
1294
+ return;
1295
+ Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
1296
+ var l = "Loading…", b = function(g, p) {
1297
+ return "✖ Error " + g + " while fetching file: " + p;
1298
+ }, v = "✖ Error: File does not exist or is empty", E = {
1299
+ js: "javascript",
1300
+ py: "python",
1301
+ rb: "ruby",
1302
+ ps1: "powershell",
1303
+ psm1: "powershell",
1304
+ sh: "bash",
1305
+ bat: "batch",
1306
+ h: "c",
1307
+ tex: "latex"
1308
+ }, i = "data-src-status", f = "loading", S = "loaded", k = "failed", O = "pre[data-src]:not([" + i + '="' + S + '"]):not([' + i + '="' + f + '"])';
1309
+ function I(g, p, y) {
1310
+ var t = new XMLHttpRequest();
1311
+ t.open("GET", g, !0), t.onreadystatechange = function() {
1312
+ t.readyState == 4 && (t.status < 400 && t.responseText ? p(t.responseText) : t.status >= 400 ? y(b(t.status, t.statusText)) : y(v));
1313
+ }, t.send(null);
1314
+ }
1315
+ function L(g) {
1316
+ var p = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(g || "");
1317
+ if (p) {
1318
+ var y = Number(p[1]), t = p[2], e = p[3];
1319
+ return t ? e ? [y, Number(e)] : [y, void 0] : [y, y];
1320
+ }
1321
+ }
1322
+ a.hooks.add("before-highlightall", function(g) {
1323
+ g.selector += ", " + O;
1324
+ }), a.hooks.add("before-sanity-check", function(g) {
1325
+ var p = (
1326
+ /** @type {HTMLPreElement} */
1327
+ g.element
1328
+ );
1329
+ if (p.matches(O)) {
1330
+ g.code = "", p.setAttribute(i, f);
1331
+ var y = p.appendChild(document.createElement("CODE"));
1332
+ y.textContent = l;
1333
+ var t = p.getAttribute("data-src"), e = g.language;
1334
+ if (e === "none") {
1335
+ var n = (/\.(\w+)$/.exec(t) || [, "none"])[1];
1336
+ e = E[n] || n;
1337
+ }
1338
+ a.util.setLanguage(y, e), a.util.setLanguage(p, e);
1339
+ var r = a.plugins.autoloader;
1340
+ r && r.loadLanguages(e), I(
1341
+ t,
1342
+ function(s) {
1343
+ p.setAttribute(i, S);
1344
+ var c = L(p.getAttribute("data-range"));
1345
+ if (c) {
1346
+ var m = s.split(/\r\n?|\n/g), u = c[0], w = c[1] == null ? m.length : c[1];
1347
+ u < 0 && (u += m.length), u = Math.max(0, Math.min(u - 1, m.length)), w < 0 && (w += m.length), w = Math.max(0, Math.min(w, m.length)), s = m.slice(u, w).join(`
1348
+ `), p.hasAttribute("data-start") || p.setAttribute("data-start", String(u + 1));
1349
+ }
1350
+ y.textContent = s, a.highlightElement(y);
1351
+ },
1352
+ function(s) {
1353
+ p.setAttribute(i, k), y.textContent = s;
1354
+ }
1355
+ );
1356
+ }
1357
+ }), a.plugins.fileHighlight = {
1358
+ /**
1359
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1360
+ *
1361
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
1362
+ *
1363
+ * @param {ParentNode} [container=document]
1364
+ */
1365
+ highlight: function(p) {
1366
+ for (var y = (p || document).querySelectorAll(O), t = 0, e; e = y[t++]; )
1367
+ a.highlightElement(e);
1368
+ }
1369
+ };
1370
+ var D = !1;
1371
+ a.fileHighlight = function() {
1372
+ D || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), D = !0), a.plugins.fileHighlight.highlight.apply(this, arguments);
1373
+ };
1374
+ }();
1375
+ })(pe);
1376
+ var _e = pe.exports;
1377
+ const ne = /* @__PURE__ */ Fe(_e);
1378
+ Prism.languages.clike = {
1379
+ comment: [
1380
+ {
1381
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1382
+ lookbehind: !0,
1383
+ greedy: !0
1384
+ },
1385
+ {
1386
+ pattern: /(^|[^\\:])\/\/.*/,
1387
+ lookbehind: !0,
1388
+ greedy: !0
1389
+ }
1390
+ ],
1391
+ string: {
1392
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1393
+ greedy: !0
1394
+ },
1395
+ "class-name": {
1396
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1397
+ lookbehind: !0,
1398
+ inside: {
1399
+ punctuation: /[.\\]/
1400
+ }
1401
+ },
1402
+ keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1403
+ boolean: /\b(?:false|true)\b/,
1404
+ function: /\b\w+(?=\()/,
1405
+ number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1406
+ operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1407
+ punctuation: /[{}[\];(),.:]/
1408
+ };
1409
+ Prism.languages.javascript = Prism.languages.extend("clike", {
1410
+ "class-name": [
1411
+ Prism.languages.clike["class-name"],
1412
+ {
1413
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1414
+ lookbehind: !0
1415
+ }
1416
+ ],
1417
+ keyword: [
1418
+ {
1419
+ pattern: /((?:^|\})\s*)catch\b/,
1420
+ lookbehind: !0
1421
+ },
1422
+ {
1423
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1424
+ lookbehind: !0
1425
+ }
1426
+ ],
1427
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1428
+ function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1429
+ number: {
1430
+ pattern: RegExp(
1431
+ /(^|[^\w$])/.source + "(?:" + // constant
1432
+ (/NaN|Infinity/.source + "|" + // binary integer
1433
+ /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
1434
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
1435
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
1436
+ /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1437
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1438
+ ),
1439
+ lookbehind: !0
1440
+ },
1441
+ operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1442
+ });
1443
+ Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1444
+ Prism.languages.insertBefore("javascript", "keyword", {
1445
+ regex: {
1446
+ pattern: RegExp(
1447
+ // lookbehind
1448
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1449
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
1450
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1451
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1452
+ // with the only syntax, so we have to define 2 different regex patterns.
1453
+ /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
1454
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1455
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1456
+ ),
1457
+ lookbehind: !0,
1458
+ greedy: !0,
1459
+ inside: {
1460
+ "regex-source": {
1461
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1462
+ lookbehind: !0,
1463
+ alias: "language-regex",
1464
+ inside: Prism.languages.regex
1465
+ },
1466
+ "regex-delimiter": /^\/|\/$/,
1467
+ "regex-flags": /^[a-z]+$/
1468
+ }
1469
+ },
1470
+ // This must be declared before keyword because we use "function" inside the look-forward
1471
+ "function-variable": {
1472
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1473
+ alias: "function"
1474
+ },
1475
+ parameter: [
1476
+ {
1477
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1478
+ lookbehind: !0,
1479
+ inside: Prism.languages.javascript
1480
+ },
1481
+ {
1482
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1483
+ lookbehind: !0,
1484
+ inside: Prism.languages.javascript
1485
+ },
1486
+ {
1487
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1488
+ lookbehind: !0,
1489
+ inside: Prism.languages.javascript
1490
+ },
1491
+ {
1492
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1493
+ lookbehind: !0,
1494
+ inside: Prism.languages.javascript
1495
+ }
1496
+ ],
1497
+ constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1498
+ });
1499
+ Prism.languages.insertBefore("javascript", "string", {
1500
+ hashbang: {
1501
+ pattern: /^#!.*/,
1502
+ greedy: !0,
1503
+ alias: "comment"
1504
+ },
1505
+ "template-string": {
1506
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1507
+ greedy: !0,
1508
+ inside: {
1509
+ "template-punctuation": {
1510
+ pattern: /^`|`$/,
1511
+ alias: "string"
1512
+ },
1513
+ interpolation: {
1514
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1515
+ lookbehind: !0,
1516
+ inside: {
1517
+ "interpolation-punctuation": {
1518
+ pattern: /^\$\{|\}$/,
1519
+ alias: "punctuation"
1520
+ },
1521
+ rest: Prism.languages.javascript
1522
+ }
1523
+ },
1524
+ string: /[\s\S]+/
1525
+ }
1526
+ },
1527
+ "string-property": {
1528
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1529
+ lookbehind: !0,
1530
+ greedy: !0,
1531
+ alias: "property"
1532
+ }
1533
+ });
1534
+ Prism.languages.insertBefore("javascript", "operator", {
1535
+ "literal-property": {
1536
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1537
+ lookbehind: !0,
1538
+ alias: "property"
1539
+ }
1540
+ });
1541
+ Prism.languages.markup && (Prism.languages.markup.tag.addInlined("script", "javascript"), Prism.languages.markup.tag.addAttribute(
1542
+ /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
1543
+ "javascript"
1544
+ ));
1545
+ Prism.languages.js = Prism.languages.javascript;
1546
+ Prism.languages.python = {
1547
+ comment: {
1548
+ pattern: /(^|[^\\])#.*/,
1549
+ lookbehind: !0,
1550
+ greedy: !0
1551
+ },
1552
+ "string-interpolation": {
1553
+ pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1554
+ greedy: !0,
1555
+ inside: {
1556
+ interpolation: {
1557
+ // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
1558
+ pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
1559
+ lookbehind: !0,
1560
+ inside: {
1561
+ "format-spec": {
1562
+ pattern: /(:)[^:(){}]+(?=\}$)/,
1563
+ lookbehind: !0
1564
+ },
1565
+ "conversion-option": {
1566
+ pattern: /![sra](?=[:}]$)/,
1567
+ alias: "punctuation"
1568
+ },
1569
+ rest: null
1570
+ }
1571
+ },
1572
+ string: /[\s\S]+/
1573
+ }
1574
+ },
1575
+ "triple-quoted-string": {
1576
+ pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
1577
+ greedy: !0,
1578
+ alias: "string"
1579
+ },
1580
+ string: {
1581
+ pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1582
+ greedy: !0
1583
+ },
1584
+ function: {
1585
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
1586
+ lookbehind: !0
1587
+ },
1588
+ "class-name": {
1589
+ pattern: /(\bclass\s+)\w+/i,
1590
+ lookbehind: !0
1591
+ },
1592
+ decorator: {
1593
+ pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
1594
+ lookbehind: !0,
1595
+ alias: ["annotation", "punctuation"],
1596
+ inside: {
1597
+ punctuation: /\./
1598
+ }
1599
+ },
1600
+ keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
1601
+ builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
1602
+ boolean: /\b(?:False|None|True)\b/,
1603
+ number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
1604
+ operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
1605
+ punctuation: /[{}[\];(),.:]/
1606
+ };
1607
+ Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python;
1608
+ Prism.languages.py = Prism.languages.python;
1609
+ Prism.languages.go = Prism.languages.extend("clike", {
1610
+ string: {
1611
+ pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
1612
+ lookbehind: !0,
1613
+ greedy: !0
1614
+ },
1615
+ keyword: /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
1616
+ boolean: /\b(?:_|false|iota|nil|true)\b/,
1617
+ number: [
1618
+ // binary and octal integers
1619
+ /\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
1620
+ // hexadecimal integers and floats
1621
+ /\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
1622
+ // decimal integers and floats
1623
+ /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
1624
+ ],
1625
+ operator: /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
1626
+ builtin: /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/
1627
+ });
1628
+ Prism.languages.insertBefore("go", "string", {
1629
+ char: {
1630
+ pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
1631
+ greedy: !0
1632
+ }
1633
+ });
1634
+ delete Prism.languages.go["class-name"];
1635
+ (function(o) {
1636
+ var d = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/, a = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source, l = {
1637
+ pattern: RegExp(/(^|[^\w.])/.source + a + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
1638
+ lookbehind: !0,
1639
+ inside: {
1640
+ namespace: {
1641
+ pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
1642
+ inside: {
1643
+ punctuation: /\./
1644
+ }
1645
+ },
1646
+ punctuation: /\./
1647
+ }
1648
+ };
1649
+ o.languages.java = o.languages.extend("clike", {
1650
+ string: {
1651
+ pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
1652
+ lookbehind: !0,
1653
+ greedy: !0
1654
+ },
1655
+ "class-name": [
1656
+ l,
1657
+ {
1658
+ // variables, parameters, and constructor references
1659
+ // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
1660
+ pattern: RegExp(/(^|[^\w.])/.source + a + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
1661
+ lookbehind: !0,
1662
+ inside: l.inside
1663
+ },
1664
+ {
1665
+ // class names based on keyword
1666
+ // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
1667
+ pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + a + /[A-Z]\w*\b/.source),
1668
+ lookbehind: !0,
1669
+ inside: l.inside
1670
+ }
1671
+ ],
1672
+ keyword: d,
1673
+ function: [
1674
+ o.languages.clike.function,
1675
+ {
1676
+ pattern: /(::\s*)[a-z_]\w*/,
1677
+ lookbehind: !0
1678
+ }
1679
+ ],
1680
+ number: /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
1681
+ operator: {
1682
+ pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
1683
+ lookbehind: !0
1684
+ },
1685
+ constant: /\b[A-Z][A-Z_\d]+\b/
1686
+ }), o.languages.insertBefore("java", "string", {
1687
+ "triple-quoted-string": {
1688
+ // http://openjdk.java.net/jeps/355#Description
1689
+ pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
1690
+ greedy: !0,
1691
+ alias: "string"
1692
+ },
1693
+ char: {
1694
+ pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
1695
+ greedy: !0
1696
+ }
1697
+ }), o.languages.insertBefore("java", "class-name", {
1698
+ annotation: {
1699
+ pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
1700
+ lookbehind: !0,
1701
+ alias: "punctuation"
1702
+ },
1703
+ generics: {
1704
+ pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
1705
+ inside: {
1706
+ "class-name": l,
1707
+ keyword: d,
1708
+ punctuation: /[<>(),.:]/,
1709
+ operator: /[?&|]/
1710
+ }
1711
+ },
1712
+ import: [
1713
+ {
1714
+ pattern: RegExp(/(\bimport\s+)/.source + a + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
1715
+ lookbehind: !0,
1716
+ inside: {
1717
+ namespace: l.inside.namespace,
1718
+ punctuation: /\./,
1719
+ operator: /\*/,
1720
+ "class-name": /\w+/
1721
+ }
1722
+ },
1723
+ {
1724
+ pattern: RegExp(/(\bimport\s+static\s+)/.source + a + /(?:\w+|\*)(?=\s*;)/.source),
1725
+ lookbehind: !0,
1726
+ alias: "static",
1727
+ inside: {
1728
+ namespace: l.inside.namespace,
1729
+ static: /\b\w+$/,
1730
+ punctuation: /\./,
1731
+ operator: /\*/,
1732
+ "class-name": /\w+/
1733
+ }
1734
+ }
1735
+ ],
1736
+ namespace: {
1737
+ pattern: RegExp(
1738
+ /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function() {
1739
+ return d.source;
1740
+ })
1741
+ ),
1742
+ lookbehind: !0,
1743
+ inside: {
1744
+ punctuation: /\./
1745
+ }
1746
+ }
1747
+ });
1748
+ })(Prism);
1749
+ Prism.languages.c = Prism.languages.extend("clike", {
1750
+ comment: {
1751
+ pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
1752
+ greedy: !0
1753
+ },
1754
+ string: {
1755
+ // https://en.cppreference.com/w/c/language/string_literal
1756
+ pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
1757
+ greedy: !0
1758
+ },
1759
+ "class-name": {
1760
+ pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
1761
+ lookbehind: !0
1762
+ },
1763
+ keyword: /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
1764
+ function: /\b[a-z_]\w*(?=\s*\()/i,
1765
+ number: /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
1766
+ operator: />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
1767
+ });
1768
+ Prism.languages.insertBefore("c", "string", {
1769
+ char: {
1770
+ // https://en.cppreference.com/w/c/language/character_constant
1771
+ pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
1772
+ greedy: !0
1773
+ }
1774
+ });
1775
+ Prism.languages.insertBefore("c", "string", {
1776
+ macro: {
1777
+ // allow for multiline macro definitions
1778
+ // spaces after the # character compile fine with gcc
1779
+ pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
1780
+ lookbehind: !0,
1781
+ greedy: !0,
1782
+ alias: "property",
1783
+ inside: {
1784
+ string: [
1785
+ {
1786
+ // highlight the path of the include statement as a string
1787
+ pattern: /^(#\s*include\s*)<[^>]+>/,
1788
+ lookbehind: !0
1789
+ },
1790
+ Prism.languages.c.string
1791
+ ],
1792
+ char: Prism.languages.c.char,
1793
+ comment: Prism.languages.c.comment,
1794
+ "macro-name": [
1795
+ {
1796
+ pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
1797
+ lookbehind: !0
1798
+ },
1799
+ {
1800
+ pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
1801
+ lookbehind: !0,
1802
+ alias: "function"
1803
+ }
1804
+ ],
1805
+ // highlight macro directives as keywords
1806
+ directive: {
1807
+ pattern: /^(#\s*)[a-z]+/,
1808
+ lookbehind: !0,
1809
+ alias: "keyword"
1810
+ },
1811
+ "directive-hash": /^#/,
1812
+ punctuation: /##|\\(?=[\r\n])/,
1813
+ expression: {
1814
+ pattern: /\S[\s\S]*/,
1815
+ inside: Prism.languages.c
1816
+ }
1817
+ }
1818
+ }
1819
+ });
1820
+ Prism.languages.insertBefore("c", "function", {
1821
+ // highlight predefined macros as constants
1822
+ constant: /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
1823
+ });
1824
+ delete Prism.languages.c.boolean;
1825
+ (function(o) {
1826
+ for (var d = /\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source, a = 0; a < 2; a++)
1827
+ d = d.replace(/<self>/g, function() {
1828
+ return d;
1829
+ });
1830
+ d = d.replace(/<self>/g, function() {
1831
+ return /[^\s\S]/.source;
1832
+ }), o.languages.rust = {
1833
+ comment: [
1834
+ {
1835
+ pattern: RegExp(/(^|[^\\])/.source + d),
1836
+ lookbehind: !0,
1837
+ greedy: !0
1838
+ },
1839
+ {
1840
+ pattern: /(^|[^\\:])\/\/.*/,
1841
+ lookbehind: !0,
1842
+ greedy: !0
1843
+ }
1844
+ ],
1845
+ string: {
1846
+ pattern: /b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,
1847
+ greedy: !0
1848
+ },
1849
+ char: {
1850
+ pattern: /b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,
1851
+ greedy: !0
1852
+ },
1853
+ attribute: {
1854
+ pattern: /#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,
1855
+ greedy: !0,
1856
+ alias: "attr-name",
1857
+ inside: {
1858
+ string: null
1859
+ // see below
1860
+ }
1861
+ },
1862
+ // Closure params should not be confused with bitwise OR |
1863
+ "closure-params": {
1864
+ pattern: /([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,
1865
+ lookbehind: !0,
1866
+ greedy: !0,
1867
+ inside: {
1868
+ "closure-punctuation": {
1869
+ pattern: /^\||\|$/,
1870
+ alias: "punctuation"
1871
+ },
1872
+ rest: null
1873
+ // see below
1874
+ }
1875
+ },
1876
+ "lifetime-annotation": {
1877
+ pattern: /'\w+/,
1878
+ alias: "symbol"
1879
+ },
1880
+ "fragment-specifier": {
1881
+ pattern: /(\$\w+:)[a-z]+/,
1882
+ lookbehind: !0,
1883
+ alias: "punctuation"
1884
+ },
1885
+ variable: /\$\w+/,
1886
+ "function-definition": {
1887
+ pattern: /(\bfn\s+)\w+/,
1888
+ lookbehind: !0,
1889
+ alias: "function"
1890
+ },
1891
+ "type-definition": {
1892
+ pattern: /(\b(?:enum|struct|trait|type|union)\s+)\w+/,
1893
+ lookbehind: !0,
1894
+ alias: "class-name"
1895
+ },
1896
+ "module-declaration": [
1897
+ {
1898
+ pattern: /(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,
1899
+ lookbehind: !0,
1900
+ alias: "namespace"
1901
+ },
1902
+ {
1903
+ pattern: /(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,
1904
+ lookbehind: !0,
1905
+ alias: "namespace",
1906
+ inside: {
1907
+ punctuation: /::/
1908
+ }
1909
+ }
1910
+ ],
1911
+ keyword: [
1912
+ // https://github.com/rust-lang/reference/blob/master/src/keywords.md
1913
+ /\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,
1914
+ // primitives and str
1915
+ // https://doc.rust-lang.org/stable/rust-by-example/primitives.html
1916
+ /\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/
1917
+ ],
1918
+ // functions can technically start with an upper-case letter, but this will introduce a lot of false positives
1919
+ // and Rust's naming conventions recommend snake_case anyway.
1920
+ // https://doc.rust-lang.org/1.0.0/style/style/naming/README.html
1921
+ function: /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,
1922
+ macro: {
1923
+ pattern: /\b\w+!/,
1924
+ alias: "property"
1925
+ },
1926
+ constant: /\b[A-Z_][A-Z_\d]+\b/,
1927
+ "class-name": /\b[A-Z]\w*\b/,
1928
+ namespace: {
1929
+ pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,
1930
+ inside: {
1931
+ punctuation: /::/
1932
+ }
1933
+ },
1934
+ // Hex, oct, bin, dec numbers with visual separators and type suffix
1935
+ number: /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,
1936
+ boolean: /\b(?:false|true)\b/,
1937
+ punctuation: /->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,
1938
+ operator: /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/
1939
+ }, o.languages.rust["closure-params"].inside.rest = o.languages.rust, o.languages.rust.attribute.inside.string = o.languages.rust.string;
1940
+ })(Prism);
1941
+ Prism.languages.sql = {
1942
+ comment: {
1943
+ pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
1944
+ lookbehind: !0
1945
+ },
1946
+ variable: [
1947
+ {
1948
+ pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
1949
+ greedy: !0
1950
+ },
1951
+ /@[\w.$]+/
1952
+ ],
1953
+ string: {
1954
+ pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
1955
+ greedy: !0,
1956
+ lookbehind: !0
1957
+ },
1958
+ identifier: {
1959
+ pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,
1960
+ greedy: !0,
1961
+ lookbehind: !0,
1962
+ inside: {
1963
+ punctuation: /^`|`$/
1964
+ }
1965
+ },
1966
+ function: /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
1967
+ // Should we highlight user defined functions too?
1968
+ keyword: /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
1969
+ boolean: /\b(?:FALSE|NULL|TRUE)\b/i,
1970
+ number: /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
1971
+ operator: /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
1972
+ punctuation: /[;[\]()`,.]/
1973
+ };
1974
+ (function(o) {
1975
+ var d = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", a = {
1976
+ pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
1977
+ lookbehind: !0,
1978
+ alias: "punctuation",
1979
+ // this looks reasonably well in all themes
1980
+ inside: null
1981
+ // see below
1982
+ }, l = {
1983
+ bash: a,
1984
+ environment: {
1985
+ pattern: RegExp("\\$" + d),
1986
+ alias: "constant"
1987
+ },
1988
+ variable: [
1989
+ // [0]: Arithmetic Environment
1990
+ {
1991
+ pattern: /\$?\(\([\s\S]+?\)\)/,
1992
+ greedy: !0,
1993
+ inside: {
1994
+ // If there is a $ sign at the beginning highlight $(( and )) as variable
1995
+ variable: [
1996
+ {
1997
+ pattern: /(^\$\(\([\s\S]+)\)\)/,
1998
+ lookbehind: !0
1999
+ },
2000
+ /^\$\(\(/
2001
+ ],
2002
+ number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
2003
+ // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
2004
+ operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
2005
+ // If there is no $ sign at the beginning highlight (( and )) as punctuation
2006
+ punctuation: /\(\(?|\)\)?|,|;/
2007
+ }
2008
+ },
2009
+ // [1]: Command Substitution
2010
+ {
2011
+ pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
2012
+ greedy: !0,
2013
+ inside: {
2014
+ variable: /^\$\(|^`|\)$|`$/
2015
+ }
2016
+ },
2017
+ // [2]: Brace expansion
2018
+ {
2019
+ pattern: /\$\{[^}]+\}/,
2020
+ greedy: !0,
2021
+ inside: {
2022
+ operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
2023
+ punctuation: /[\[\]]/,
2024
+ environment: {
2025
+ pattern: RegExp("(\\{)" + d),
2026
+ lookbehind: !0,
2027
+ alias: "constant"
2028
+ }
2029
+ }
2030
+ },
2031
+ /\$(?:\w+|[#?*!@$])/
2032
+ ],
2033
+ // Escape sequences from echo and printf's manuals, and escaped quotes.
2034
+ entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
2035
+ };
2036
+ o.languages.bash = {
2037
+ shebang: {
2038
+ pattern: /^#!\s*\/.*/,
2039
+ alias: "important"
2040
+ },
2041
+ comment: {
2042
+ pattern: /(^|[^"{\\$])#.*/,
2043
+ lookbehind: !0
2044
+ },
2045
+ "function-name": [
2046
+ // a) function foo {
2047
+ // b) foo() {
2048
+ // c) function foo() {
2049
+ // but not “foo {”
2050
+ {
2051
+ // a) and c)
2052
+ pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
2053
+ lookbehind: !0,
2054
+ alias: "function"
2055
+ },
2056
+ {
2057
+ // b)
2058
+ pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
2059
+ alias: "function"
2060
+ }
2061
+ ],
2062
+ // Highlight variable names as variables in for and select beginnings.
2063
+ "for-or-select": {
2064
+ pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
2065
+ alias: "variable",
2066
+ lookbehind: !0
2067
+ },
2068
+ // Highlight variable names as variables in the left-hand part
2069
+ // of assignments (“=” and “+=”).
2070
+ "assign-left": {
2071
+ pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
2072
+ inside: {
2073
+ environment: {
2074
+ pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + d),
2075
+ lookbehind: !0,
2076
+ alias: "constant"
2077
+ }
2078
+ },
2079
+ alias: "variable",
2080
+ lookbehind: !0
2081
+ },
2082
+ // Highlight parameter names as variables
2083
+ parameter: {
2084
+ pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
2085
+ alias: "variable",
2086
+ lookbehind: !0
2087
+ },
2088
+ string: [
2089
+ // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
2090
+ {
2091
+ pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
2092
+ lookbehind: !0,
2093
+ greedy: !0,
2094
+ inside: l
2095
+ },
2096
+ // Here-document with quotes around the tag
2097
+ // → No expansion (so no “inside”).
2098
+ {
2099
+ pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
2100
+ lookbehind: !0,
2101
+ greedy: !0,
2102
+ inside: {
2103
+ bash: a
2104
+ }
2105
+ },
2106
+ // “Normal” string
2107
+ {
2108
+ // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
2109
+ pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
2110
+ lookbehind: !0,
2111
+ greedy: !0,
2112
+ inside: l
2113
+ },
2114
+ {
2115
+ // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
2116
+ pattern: /(^|[^$\\])'[^']*'/,
2117
+ lookbehind: !0,
2118
+ greedy: !0
2119
+ },
2120
+ {
2121
+ // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
2122
+ pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
2123
+ greedy: !0,
2124
+ inside: {
2125
+ entity: l.entity
2126
+ }
2127
+ }
2128
+ ],
2129
+ environment: {
2130
+ pattern: RegExp("\\$?" + d),
2131
+ alias: "constant"
2132
+ },
2133
+ variable: l.variable,
2134
+ function: {
2135
+ pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
2136
+ lookbehind: !0
2137
+ },
2138
+ keyword: {
2139
+ pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
2140
+ lookbehind: !0
2141
+ },
2142
+ // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
2143
+ builtin: {
2144
+ pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
2145
+ lookbehind: !0,
2146
+ // Alias added to make those easier to distinguish from strings.
2147
+ alias: "class-name"
2148
+ },
2149
+ boolean: {
2150
+ pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
2151
+ lookbehind: !0
2152
+ },
2153
+ "file-descriptor": {
2154
+ pattern: /\B&\d\b/,
2155
+ alias: "important"
2156
+ },
2157
+ operator: {
2158
+ // Lots of redirections here, but not just that.
2159
+ pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
2160
+ inside: {
2161
+ "file-descriptor": {
2162
+ pattern: /^\d/,
2163
+ alias: "important"
2164
+ }
2165
+ }
2166
+ },
2167
+ punctuation: /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
2168
+ number: {
2169
+ pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
2170
+ lookbehind: !0
2171
+ }
2172
+ }, a.inside = o.languages.bash;
2173
+ for (var b = [
2174
+ "comment",
2175
+ "function-name",
2176
+ "for-or-select",
2177
+ "assign-left",
2178
+ "parameter",
2179
+ "string",
2180
+ "environment",
2181
+ "function",
2182
+ "keyword",
2183
+ "builtin",
2184
+ "boolean",
2185
+ "file-descriptor",
2186
+ "operator",
2187
+ "punctuation",
2188
+ "number"
2189
+ ], v = l.variable[1].inside, E = 0; E < b.length; E++)
2190
+ v[b[E]] = o.languages.bash[b[E]];
2191
+ o.languages.sh = o.languages.bash, o.languages.shell = o.languages.bash;
2192
+ })(Prism);
2193
+ Prism.languages.json = {
2194
+ property: {
2195
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
2196
+ lookbehind: !0,
2197
+ greedy: !0
2198
+ },
2199
+ string: {
2200
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
2201
+ lookbehind: !0,
2202
+ greedy: !0
2203
+ },
2204
+ comment: {
2205
+ pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
2206
+ greedy: !0
2207
+ },
2208
+ number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
2209
+ punctuation: /[{}[\],]/,
2210
+ operator: /:/,
2211
+ boolean: /\b(?:false|true)\b/,
2212
+ null: {
2213
+ pattern: /\bnull\b/,
2214
+ alias: "keyword"
2215
+ }
2216
+ };
2217
+ Prism.languages.webmanifest = Prism.languages.json;
2218
+ const Re = ["innerHTML"], xe = ["value", "disabled"], Ne = /* @__PURE__ */ ue({
2219
+ __name: "CodeEditor",
2220
+ props: {
2221
+ modelValue: {},
2222
+ language: {},
2223
+ theme: { default: "dark" },
2224
+ disabled: { type: Boolean, default: !1 }
2225
+ },
2226
+ emits: ["update:modelValue"],
2227
+ setup(o, { emit: d }) {
2228
+ he((g) => ({
2229
+ v4a58b198: S.value
2230
+ }));
2231
+ function a(g) {
2232
+ if (typeof document > "u") return;
2233
+ const p = g === "dark" ? "prism-okaidia" : "prism", y = document.getElementById("prism-theme-style"), t = `https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/${p}.min.css`;
2234
+ if (y)
2235
+ y.setAttribute("href", t);
2236
+ else {
2237
+ const e = document.createElement("link");
2238
+ e.id = "prism-theme-style", e.rel = "stylesheet", e.href = t, document.head.appendChild(e);
2239
+ }
2240
+ }
2241
+ typeof window < "u" && (window.Prism = ne);
2242
+ const l = o, b = d, v = C(null), E = C(null), i = {
2243
+ javascript: "javascript",
2244
+ js: "javascript",
2245
+ typescript: "typescript",
2246
+ ts: "typescript",
2247
+ python: "python",
2248
+ py: "python",
2249
+ java: "java",
2250
+ c: "c",
2251
+ cpp: "cpp",
2252
+ "c++": "cpp",
2253
+ csharp: "csharp",
2254
+ "c#": "csharp",
2255
+ go: "go",
2256
+ golang: "go",
2257
+ rust: "rust",
2258
+ ruby: "ruby",
2259
+ rb: "ruby",
2260
+ php: "php",
2261
+ swift: "swift",
2262
+ kotlin: "kotlin",
2263
+ kt: "kotlin",
2264
+ sql: "sql",
2265
+ bash: "bash",
2266
+ sh: "bash",
2267
+ shell: "bash",
2268
+ json: "json",
2269
+ yaml: "yaml",
2270
+ yml: "yaml",
2271
+ markdown: "markdown",
2272
+ md: "markdown"
2273
+ }, f = G(() => i[l.language.toLowerCase()] || "javascript"), S = G(() => l.theme === "dark" ? "#1e1e1e" : "#fafafa"), k = G(() => {
2274
+ try {
2275
+ const g = ne.languages[f.value];
2276
+ if (g)
2277
+ return ne.highlight(l.modelValue || "", g, f.value);
2278
+ } catch {
2279
+ }
2280
+ return O(l.modelValue || "");
2281
+ });
2282
+ function O(g) {
2283
+ const p = document.createElement("div");
2284
+ return p.textContent = g, p.innerHTML;
2285
+ }
2286
+ function I(g) {
2287
+ const p = g.target;
2288
+ b("update:modelValue", p.value);
2289
+ }
2290
+ function L() {
2291
+ v.value && E.value && (E.value.scrollTop = v.value.scrollTop, E.value.scrollLeft = v.value.scrollLeft);
2292
+ }
2293
+ function D(g) {
2294
+ if (g.key === "Tab") {
2295
+ g.preventDefault();
2296
+ const p = g.target, y = p.selectionStart, t = p.selectionEnd, e = p.value;
2297
+ p.value = e.substring(0, y) + " " + e.substring(t), p.selectionStart = p.selectionEnd = y + 2, b("update:modelValue", p.value);
2298
+ }
2299
+ }
2300
+ return ce(() => {
2301
+ a(l.theme);
2302
+ }), de(() => l.theme, (g) => {
2303
+ a(g);
2304
+ }), (g, p) => (x(), N("div", {
2305
+ class: W(["code-editor", `theme-${o.theme}`])
2306
+ }, [
2307
+ A("pre", {
2308
+ ref_key: "highlightRef",
2309
+ ref: E,
2310
+ class: W(["code-highlight", [`language-${f.value}`, `prism-theme-${o.theme}`]]),
2311
+ "aria-hidden": "true"
2312
+ }, [
2313
+ A("code", { innerHTML: k.value }, null, 8, Re)
2314
+ ], 2),
2315
+ A("textarea", {
2316
+ ref_key: "codeRef",
2317
+ ref: v,
2318
+ class: "code-input",
2319
+ value: o.modelValue,
2320
+ disabled: o.disabled,
2321
+ onInput: I,
2322
+ onScroll: L,
2323
+ onKeydown: D,
2324
+ spellcheck: "false",
2325
+ placeholder: "Write your code here..."
2326
+ }, null, 40, xe)
2327
+ ], 2));
2328
+ }
2329
+ }), ge = (o, d) => {
2330
+ const a = o.__vccOpts || o;
2331
+ for (const [l, b] of d)
2332
+ a[l] = b;
2333
+ return a;
2334
+ }, Oe = /* @__PURE__ */ ge(Ne, [["__scopeId", "data-v-0ec35612"]]), Le = { class: "code-runner-header" }, Ce = { class: "code-runner-controls" }, De = ["disabled"], Pe = {
2335
+ key: 0,
2336
+ value: ""
2337
+ }, $e = ["value"], Me = { class: "code-runner-actions" }, Ue = ["disabled"], He = {
2338
+ key: 0,
2339
+ class: "spinner"
2340
+ }, Be = {
2341
+ key: 1,
2342
+ class: "run-icon"
2343
+ }, Ge = ["title"], ze = {
2344
+ key: 0,
2345
+ class: "error-message"
2346
+ }, je = { class: "code-runner-main" }, We = { class: "panel-header" }, Ve = { class: "language-badge" }, Ye = { class: "panel-header" }, Xe = { class: "output-tabs" }, Ze = { class: "output-actions" }, Ke = {
2347
+ key: 0,
2348
+ class: "execution-time"
2349
+ }, qe = { class: "output-content" }, Je = { key: 0 }, Qe = {
2350
+ key: 1,
2351
+ class: "stderr"
2352
+ }, et = /* @__PURE__ */ ue({
2353
+ __name: "CodeRunner",
2354
+ props: {
2355
+ pistonUrl: { default: "/api/piston" },
2356
+ language: { default: "javascript" },
2357
+ theme: { default: "light" },
2358
+ showLanguageSelector: { type: Boolean, default: !0 },
2359
+ showEditor: { type: Boolean, default: !0 },
2360
+ editable: { type: Boolean, default: !0 },
2361
+ defaultCode: {},
2362
+ executorLabel: { default: "运行" }
2363
+ },
2364
+ emits: ["execute-start", "execute-end", "language-change"],
2365
+ setup(o, { emit: d }) {
2366
+ const a = o, l = d, b = C([]), v = C(a.language), E = C(a.theme), i = C(""), f = C(""), S = C(""), k = C(!1), O = C(null), I = C("stdout"), L = C(null), D = C(!1), g = C(60);
2367
+ function p() {
2368
+ E.value = E.value === "light" ? "dark" : "light";
2369
+ }
2370
+ const y = G(
2371
+ () => new ke({ pistonUrl: a.pistonUrl })
2372
+ ), t = G(() => b.value.map((h) => ({
2373
+ value: `${h.language}:${h.version}`,
2374
+ label: `${h.language.charAt(0).toUpperCase() + h.language.slice(1)} ${h.version}`
2375
+ }))), e = G(() => {
2376
+ const h = v.value;
2377
+ return h.includes(":") ? h.split(":")[0] : h;
2378
+ });
2379
+ async function n() {
2380
+ D.value = !0, L.value = null;
2381
+ try {
2382
+ b.value = await y.value.getRuntimes();
2383
+ } catch (h) {
2384
+ L.value = h instanceof Error ? h.message : "Failed to load runtimes";
2385
+ } finally {
2386
+ D.value = !1;
2387
+ }
2388
+ }
2389
+ de(v, (h) => {
2390
+ const T = h.includes(":") ? h.split(":")[0] : h, _ = ae(T);
2391
+ i.value = _, l("language-change", T, _);
2392
+ });
2393
+ async function r() {
2394
+ if (!k.value) {
2395
+ k.value = !0, f.value = "", S.value = "", O.value = null, L.value = null, I.value = "stdout", l("execute-start");
2396
+ try {
2397
+ const h = await y.value.execute(e.value, i.value);
2398
+ f.value = h.output, S.value = h.stderr, O.value = h.executionTime || null, I.value = h.stderr ? "stderr" : "stdout", l("execute-end", h);
2399
+ } catch (h) {
2400
+ L.value = h instanceof Error ? h.message : "Execution failed", l("execute-end", {
2401
+ success: !1,
2402
+ output: "",
2403
+ stderr: L.value,
2404
+ code: -1
2405
+ });
2406
+ } finally {
2407
+ k.value = !1;
2408
+ }
2409
+ }
2410
+ }
2411
+ function s() {
2412
+ f.value = "", S.value = "", O.value = null, L.value = null;
2413
+ }
2414
+ async function c() {
2415
+ const h = I.value === "stdout" ? f.value : S.value;
2416
+ await navigator.clipboard.writeText(h);
2417
+ }
2418
+ function m() {
2419
+ i.value = ae(e.value);
2420
+ }
2421
+ let u = !1;
2422
+ function w(h) {
2423
+ u = !0, document.addEventListener("mousemove", F), document.addEventListener("mouseup", P), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
2424
+ }
2425
+ function F(h) {
2426
+ if (!u) return;
2427
+ const T = document.querySelector(
2428
+ ".code-runner-main"
2429
+ );
2430
+ if (!T) return;
2431
+ const _ = T.getBoundingClientRect(), Y = (h.clientX - _.left) / _.width * 100;
2432
+ g.value = Math.max(20, Math.min(80, Y));
2433
+ }
2434
+ function P() {
2435
+ u = !1, document.removeEventListener("mousemove", F), document.removeEventListener("mouseup", P), document.body.style.cursor = "", document.body.style.userSelect = "";
2436
+ }
2437
+ ce(async () => {
2438
+ await n(), i.value || (i.value = a.defaultCode || ae(v.value));
2439
+ });
2440
+ const V = G(() => `code-runner-${E.value}`);
2441
+ return (h, T) => (x(), N("div", {
2442
+ class: W(["code-runner", V.value])
2443
+ }, [
2444
+ A("div", Le, [
2445
+ A("div", Ce, [
2446
+ o.showLanguageSelector ? be((x(), N("select", {
2447
+ key: 0,
2448
+ "onUpdate:modelValue": T[0] || (T[0] = (_) => v.value = _),
2449
+ class: "language-select",
2450
+ disabled: k.value
2451
+ }, [
2452
+ D.value ? (x(), N("option", Pe, "加载中...")) : H("", !0),
2453
+ (x(!0), N(Ee, null, ve(t.value, (_) => (x(), N("option", {
2454
+ key: _.value,
2455
+ value: _.value
2456
+ }, B(_.label), 9, $e))), 128))
2457
+ ], 8, De)), [
2458
+ [ye, v.value]
2459
+ ]) : H("", !0)
2460
+ ]),
2461
+ A("div", Me, [
2462
+ A("button", {
2463
+ class: "btn btn-run",
2464
+ disabled: k.value || D.value,
2465
+ onClick: r
2466
+ }, [
2467
+ k.value ? (x(), N("span", He)) : (x(), N("span", Be, "▶")),
2468
+ Ae(" " + B(k.value ? "运行中..." : o.executorLabel), 1)
2469
+ ], 8, Ue),
2470
+ o.showEditor && o.editable ? (x(), N("button", {
2471
+ key: 0,
2472
+ class: "btn btn-reset",
2473
+ onClick: m
2474
+ }, " 重置 ")) : H("", !0),
2475
+ A("button", {
2476
+ class: "btn btn-theme",
2477
+ onClick: p,
2478
+ title: E.value === "light" ? "Switch to dark mode" : "Switch to light mode"
2479
+ }, B(E.value === "light" ? "🌙" : "☀️"), 9, Ge)
2480
+ ])
2481
+ ]),
2482
+ L.value ? (x(), N("div", ze, B(L.value), 1)) : H("", !0),
2483
+ A("div", je, [
2484
+ o.showEditor ? (x(), N("div", {
2485
+ key: 0,
2486
+ class: "editor-panel",
2487
+ style: ie({ width: g.value + "%" })
2488
+ }, [
2489
+ A("div", We, [
2490
+ T[4] || (T[4] = A("span", { class: "panel-title" }, "编辑器", -1)),
2491
+ A("span", Ve, B(e.value), 1)
2492
+ ]),
2493
+ Se(Oe, {
2494
+ modelValue: i.value,
2495
+ "onUpdate:modelValue": T[1] || (T[1] = (_) => i.value = _),
2496
+ language: e.value,
2497
+ theme: E.value,
2498
+ disabled: !o.editable || k.value
2499
+ }, null, 8, ["modelValue", "language", "theme", "disabled"])
2500
+ ], 4)) : H("", !0),
2501
+ o.showEditor ? (x(), N("div", {
2502
+ key: 1,
2503
+ class: "resize-handle",
2504
+ onMousedown: w
2505
+ }, [...T[5] || (T[5] = [
2506
+ A("div", { class: "resize-line" }, null, -1)
2507
+ ])], 32)) : H("", !0),
2508
+ A("div", {
2509
+ class: "output-panel",
2510
+ style: ie({ width: o.showEditor ? 100 - g.value + "%" : "100%" })
2511
+ }, [
2512
+ A("div", Ye, [
2513
+ A("div", Xe, [
2514
+ A("button", {
2515
+ class: W(["tab", { active: I.value === "stdout" }]),
2516
+ onClick: T[2] || (T[2] = (_) => I.value = "stdout")
2517
+ }, " 输出 ", 2),
2518
+ S.value ? (x(), N("button", {
2519
+ key: 0,
2520
+ class: W(["tab", { active: I.value === "stderr" }]),
2521
+ onClick: T[3] || (T[3] = (_) => I.value = "stderr")
2522
+ }, " 错误 ", 2)) : H("", !0)
2523
+ ]),
2524
+ A("div", Ze, [
2525
+ O.value !== null ? (x(), N("span", Ke, B(O.value) + "ms ", 1)) : H("", !0),
2526
+ A("button", {
2527
+ class: "btn-icon",
2528
+ onClick: c,
2529
+ title: "复制"
2530
+ }, [...T[6] || (T[6] = [
2531
+ A("svg", {
2532
+ width: "14",
2533
+ height: "14",
2534
+ viewBox: "0 0 24 24",
2535
+ fill: "none",
2536
+ stroke: "currentColor",
2537
+ "stroke-width": "2"
2538
+ }, [
2539
+ A("rect", {
2540
+ x: "9",
2541
+ y: "9",
2542
+ width: "13",
2543
+ height: "13",
2544
+ rx: "2",
2545
+ ry: "2"
2546
+ }),
2547
+ A("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
2548
+ ], -1)
2549
+ ])]),
2550
+ A("button", {
2551
+ class: "btn-icon",
2552
+ onClick: s,
2553
+ title: "清除"
2554
+ }, [...T[7] || (T[7] = [
2555
+ A("svg", {
2556
+ width: "14",
2557
+ height: "14",
2558
+ viewBox: "0 0 24 24",
2559
+ fill: "none",
2560
+ stroke: "currentColor",
2561
+ "stroke-width": "2"
2562
+ }, [
2563
+ A("polyline", { points: "3 6 5 6 21 6" }),
2564
+ A("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
2565
+ ], -1)
2566
+ ])])
2567
+ ])
2568
+ ]),
2569
+ A("div", qe, [
2570
+ I.value === "stdout" ? (x(), N("pre", Je, B(f.value || '点击"运行"执行代码'), 1)) : (x(), N("pre", Qe, B(S.value), 1))
2571
+ ])
2572
+ ], 4)
2573
+ ])
2574
+ ], 2));
2575
+ }
2576
+ }), re = /* @__PURE__ */ ge(et, [["__scopeId", "data-v-6e14ca02"]]);
2577
+ re.install = (o) => {
2578
+ o.component("CodeRunner", re);
2579
+ };
2580
+ const at = {
2581
+ install(o) {
2582
+ o.component("CodeRunner", re);
2583
+ }
2584
+ };
2585
+ export {
2586
+ re as CodeRunner,
2587
+ at as default
2588
+ };