@hep-code-runner/vue3 2.1.4 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +1 -238
  2. package/dist/index.mjs +1690 -1191
  3. package/package.json +3 -2
package/dist/index.mjs CHANGED
@@ -1,85 +1,89 @@
1
- import { defineComponent as le, useCssVars as ve, ref as N, computed as H, onMounted as he, watch as ue, onUnmounted as Ee, openBlock as x, createElementBlock as I, normalizeClass as j, createElementVNode as A, normalizeStyle as Q, withDirectives as ye, createCommentVNode as B, Fragment as Ae, renderList as Se, toDisplayString as z, vModelSelect as ke, createTextVNode as we, createStaticVNode as Te, createVNode as ie, createBlock as _e, Teleport as xe, Transition as Ie, withCtx as Fe, mergeProps as Re, toHandlers as Ne, renderSlot as Oe } from "vue";
2
- var Le = Object.defineProperty, Ce = (i, p, n) => p in i ? Le(i, p, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[p] = n, de = (i, p, n) => Ce(i, typeof p != "symbol" ? p + "" : p, n);
3
- let oe = null;
4
- class De {
5
- constructor(p = {}) {
6
- de(this, "baseUrl"), de(this, "timeout"), this.baseUrl = p.pistonUrl || "/api/piston", this.timeout = p.timeout || 3e3;
1
+ import { defineComponent, useCssVars, ref, computed, onMounted, watch, onUnmounted, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, withDirectives, createCommentVNode, Fragment, renderList, toDisplayString, vModelSelect, createTextVNode, createStaticVNode, createVNode, createBlock, Teleport, Transition, withCtx, mergeProps, toHandlers, renderSlot } from "vue";
2
+ var w = Object.defineProperty;
3
+ var y = (o, e, t) => e in o ? w(o, e, { enumerable: true, configurable: true, writable: true, value: t }) : o[e] = t;
4
+ var c = (o, e, t) => y(o, typeof e != "symbol" ? e + "" : e, t);
5
+ let u = null;
6
+ class W {
7
+ constructor(e = {}) {
8
+ c(this, "baseUrl");
9
+ c(this, "timeout");
10
+ this.baseUrl = e.pistonUrl || "/api/piston", this.timeout = e.timeout || 3e3;
7
11
  }
8
- async getRuntimes(p = !1) {
9
- if (oe && !p)
10
- return oe;
12
+ async getRuntimes(e = false) {
13
+ if (u && !e)
14
+ return u;
11
15
  try {
12
- const n = await fetch(`${this.baseUrl}/runtimes`, {
16
+ const t = await fetch(`${this.baseUrl}/runtimes`, {
13
17
  method: "GET",
14
18
  headers: {
15
19
  "Content-Type": "application/json"
16
20
  }
17
21
  });
18
- if (!n.ok)
19
- throw new Error(`Failed to fetch runtimes: ${n.statusText}`);
20
- const l = await n.json();
21
- return oe = l, l;
22
- } catch (n) {
23
- throw console.error("Failed to fetch runtimes:", n), n;
22
+ if (!t.ok)
23
+ throw new Error(`Failed to fetch runtimes: ${t.statusText}`);
24
+ const n = await t.json();
25
+ return u = n, n;
26
+ } catch (t) {
27
+ throw console.error("Failed to fetch runtimes:", t), t;
24
28
  }
25
29
  }
26
- async execute(p, n, l = {}) {
27
- const v = (await this.getRuntimes()).find(
28
- (f) => {
29
- var b;
30
- return f.language.toLowerCase() === p.toLowerCase() || ((b = f.aliases) == null ? void 0 : b.some((k) => k.toLowerCase() === p.toLowerCase()));
30
+ async execute(e, t, n = {}) {
31
+ const l = (await this.getRuntimes()).find(
32
+ (a) => {
33
+ var r;
34
+ return a.language.toLowerCase() === e.toLowerCase() || ((r = a.aliases) == null ? void 0 : r.some((i) => i.toLowerCase() === e.toLowerCase()));
31
35
  }
32
36
  );
33
- if (!v)
34
- throw new Error(`Language '${p}' is not supported`);
35
- const _ = this.getFileName(p), S = {
36
- language: v.language,
37
- version: l.version || v.version,
37
+ if (!l)
38
+ throw new Error(`Language '${e}' is not supported`);
39
+ const p = this.getFileName(e), h = {
40
+ language: l.language,
41
+ version: n.version || l.version,
38
42
  files: [
39
43
  {
40
- name: _,
41
- content: n
44
+ name: p,
45
+ content: t
42
46
  }
43
47
  ],
44
- stdin: l.stdin || "",
45
- args: l.args || [],
46
- run_timeout: l.runTimeout || this.timeout,
48
+ stdin: n.stdin || "",
49
+ args: n.args || [],
50
+ run_timeout: n.runTimeout || this.timeout,
47
51
  compile_timeout: this.timeout
48
- }, o = Date.now();
52
+ }, d = Date.now();
49
53
  try {
50
- const f = await fetch(`${this.baseUrl}/execute`, {
54
+ const a = await fetch(`${this.baseUrl}/execute`, {
51
55
  method: "POST",
52
56
  headers: {
53
57
  "Content-Type": "application/json"
54
58
  },
55
- body: JSON.stringify(S)
59
+ body: JSON.stringify(h)
56
60
  });
57
- if (!f.ok)
58
- throw new Error(`Execute failed: ${f.statusText}`);
59
- const b = await f.json(), k = Date.now() - o, C = b.run.stdout || "", O = b.run.stderr || "";
61
+ if (!a.ok)
62
+ throw new Error(`Execute failed: ${a.statusText}`);
63
+ const r = await a.json(), i = Date.now() - d, g = r.run.stdout || "", f = r.run.stderr || "";
60
64
  return {
61
- success: b.run.code === 0,
62
- output: C,
63
- stderr: O,
64
- code: b.run.code,
65
- executionTime: k,
66
- compile: b.compile ? {
67
- stdout: b.compile.stdout || "",
68
- stderr: b.compile.stderr || "",
69
- code: b.compile.code
65
+ success: r.run.code === 0,
66
+ output: g,
67
+ stderr: f,
68
+ code: r.run.code,
69
+ executionTime: i,
70
+ compile: r.compile ? {
71
+ stdout: r.compile.stdout || "",
72
+ stderr: r.compile.stderr || "",
73
+ code: r.compile.code
70
74
  } : void 0
71
75
  };
72
- } catch (f) {
76
+ } catch (a) {
73
77
  return {
74
- success: !1,
78
+ success: false,
75
79
  output: "",
76
- stderr: f instanceof Error ? f.message : "Unknown error",
80
+ stderr: a instanceof Error ? a.message : "Unknown error",
77
81
  code: -1,
78
- executionTime: Date.now() - o
82
+ executionTime: Date.now() - d
79
83
  };
80
84
  }
81
85
  }
82
- getFileName(p) {
86
+ getFileName(e) {
83
87
  return {
84
88
  javascript: "main.js",
85
89
  typescript: "main.ts",
@@ -106,10 +110,10 @@ class De {
106
110
  css: "style.css",
107
111
  sql: "query.sql",
108
112
  markdown: "readme.md"
109
- }[p.toLowerCase()] || `main.${p}`;
113
+ }[e.toLowerCase()] || `main.${e}`;
110
114
  }
111
115
  }
112
- const Pe = {
116
+ const m = {
113
117
  javascript: 'console.log("Hello, World!");',
114
118
  typescript: 'console.log("Hello, World!");',
115
119
  python: 'print("Hello, World!")',
@@ -207,18 +211,18 @@ h1 {
207
211
 
208
212
  This is a sample markdown document.`
209
213
  };
210
- function J(i) {
211
- const p = i.toLowerCase();
212
- return Pe[p] || `// ${i}
214
+ function j(o) {
215
+ const e = o.toLowerCase();
216
+ return m[e] || `// ${o}
213
217
  // Write your code here`;
214
218
  }
215
- var pe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
216
- function $e(i) {
217
- return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
219
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
220
+ function getDefaultExportFromCjs(x) {
221
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
218
222
  }
219
- var fe = { exports: {} };
220
- (function(i) {
221
- var p = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
223
+ var prism = { exports: {} };
224
+ (function(module) {
225
+ var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
222
226
  /**
223
227
  * Prism: Lightweight, robust, elegant syntax highlighting
224
228
  *
@@ -227,8 +231,11 @@ var fe = { exports: {} };
227
231
  * @namespace
228
232
  * @public
229
233
  */
230
- var n = function(l) {
231
- var v = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, _ = 0, S = {}, o = {
234
+ var Prism2 = function(_self2) {
235
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
236
+ var uniqueId = 0;
237
+ var plainTextGrammar = {};
238
+ var _ = {
232
239
  /**
233
240
  * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
234
241
  * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
@@ -250,7 +257,7 @@ var fe = { exports: {} };
250
257
  * @memberof Prism
251
258
  * @public
252
259
  */
253
- manual: l.Prism && l.Prism.manual,
260
+ manual: _self2.Prism && _self2.Prism.manual,
254
261
  /**
255
262
  * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
256
263
  * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
@@ -272,7 +279,7 @@ var fe = { exports: {} };
272
279
  * @memberof Prism
273
280
  * @public
274
281
  */
275
- disableWorkerMessageHandler: l.Prism && l.Prism.disableWorkerMessageHandler,
282
+ disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
276
283
  /**
277
284
  * A namespace for utility methods.
278
285
  *
@@ -283,8 +290,14 @@ var fe = { exports: {} };
283
290
  * @memberof Prism
284
291
  */
285
292
  util: {
286
- encode: function e(t) {
287
- return t instanceof f ? new f(t.type, e(t.content), t.alias) : Array.isArray(t) ? t.map(e) : t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
293
+ encode: function encode(tokens) {
294
+ if (tokens instanceof Token) {
295
+ return new Token(tokens.type, encode(tokens.content), tokens.alias);
296
+ } else if (Array.isArray(tokens)) {
297
+ return tokens.map(encode);
298
+ } else {
299
+ return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
300
+ }
288
301
  },
289
302
  /**
290
303
  * Returns the name of the type of the given value.
@@ -302,8 +315,8 @@ var fe = { exports: {} };
302
315
  * type(String) === 'Function'
303
316
  * type(/abc+/) === 'RegExp'
304
317
  */
305
- type: function(e) {
306
- return Object.prototype.toString.call(e).slice(8, -1);
318
+ type: function(o) {
319
+ return Object.prototype.toString.call(o).slice(8, -1);
307
320
  },
308
321
  /**
309
322
  * Returns a unique number for the given object. Later calls will still return the same number.
@@ -311,8 +324,11 @@ var fe = { exports: {} };
311
324
  * @param {Object} obj
312
325
  * @returns {number}
313
326
  */
314
- objId: function(e) {
315
- return e.__id || Object.defineProperty(e, "__id", { value: ++_ }), e.__id;
327
+ objId: function(obj) {
328
+ if (!obj["__id"]) {
329
+ Object.defineProperty(obj, "__id", { value: ++uniqueId });
330
+ }
331
+ return obj["__id"];
316
332
  },
317
333
  /**
318
334
  * Creates a deep clone of the given object.
@@ -324,30 +340,46 @@ var fe = { exports: {} };
324
340
  * @returns {T}
325
341
  * @template T
326
342
  */
327
- clone: function e(t, r) {
328
- r = r || {};
329
- var a, s;
330
- switch (o.util.type(t)) {
343
+ clone: function deepClone(o, visited) {
344
+ visited = visited || {};
345
+ var clone;
346
+ var id;
347
+ switch (_.util.type(o)) {
331
348
  case "Object":
332
- if (s = o.util.objId(t), r[s])
333
- return r[s];
334
- a = /** @type {Record<string, any>} */
335
- {}, r[s] = a;
336
- for (var u in t)
337
- t.hasOwnProperty(u) && (a[u] = e(t[u], r));
349
+ id = _.util.objId(o);
350
+ if (visited[id]) {
351
+ return visited[id];
352
+ }
353
+ clone = /** @type {Record<string, any>} */
354
+ {};
355
+ visited[id] = clone;
356
+ for (var key in o) {
357
+ if (o.hasOwnProperty(key)) {
358
+ clone[key] = deepClone(o[key], visited);
359
+ }
360
+ }
338
361
  return (
339
362
  /** @type {any} */
340
- a
363
+ clone
341
364
  );
342
365
  case "Array":
343
- return s = o.util.objId(t), r[s] ? r[s] : (a = [], r[s] = a, /** @type {Array} */
366
+ id = _.util.objId(o);
367
+ if (visited[id]) {
368
+ return visited[id];
369
+ }
370
+ clone = [];
371
+ visited[id] = clone;
372
+ /** @type {Array} */
344
373
  /** @type {any} */
345
- t.forEach(function(y, c) {
346
- a[c] = e(y, r);
347
- }), /** @type {any} */
348
- a);
374
+ o.forEach(function(v, i) {
375
+ clone[i] = deepClone(v, visited);
376
+ });
377
+ return (
378
+ /** @type {any} */
379
+ clone
380
+ );
349
381
  default:
350
- return t;
382
+ return o;
351
383
  }
352
384
  },
353
385
  /**
@@ -358,12 +390,13 @@ var fe = { exports: {} };
358
390
  * @param {Element} element
359
391
  * @returns {string}
360
392
  */
361
- getLanguage: function(e) {
362
- for (; e; ) {
363
- var t = v.exec(e.className);
364
- if (t)
365
- return t[1].toLowerCase();
366
- e = e.parentElement;
393
+ getLanguage: function(element) {
394
+ while (element) {
395
+ var m2 = lang.exec(element.className);
396
+ if (m2) {
397
+ return m2[1].toLowerCase();
398
+ }
399
+ element = element.parentElement;
367
400
  }
368
401
  return "none";
369
402
  },
@@ -374,8 +407,9 @@ var fe = { exports: {} };
374
407
  * @param {string} language
375
408
  * @returns {void}
376
409
  */
377
- setLanguage: function(e, t) {
378
- e.className = e.className.replace(RegExp(v, "gi"), ""), e.classList.add("language-" + t);
410
+ setLanguage: function(element, language) {
411
+ element.className = element.className.replace(RegExp(lang, "gi"), "");
412
+ element.classList.add("language-" + language);
379
413
  },
380
414
  /**
381
415
  * Returns the script element that is currently executing.
@@ -385,22 +419,26 @@ var fe = { exports: {} };
385
419
  * @returns {HTMLScriptElement | null}
386
420
  */
387
421
  currentScript: function() {
388
- if (typeof document > "u")
422
+ if (typeof document === "undefined") {
389
423
  return null;
390
- if (document.currentScript && document.currentScript.tagName === "SCRIPT")
424
+ }
425
+ if (document.currentScript && document.currentScript.tagName === "SCRIPT" && 1 < 2) {
391
426
  return (
392
427
  /** @type {any} */
393
428
  document.currentScript
394
429
  );
430
+ }
395
431
  try {
396
432
  throw new Error();
397
- } catch (a) {
398
- var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(a.stack) || [])[1];
399
- if (e) {
400
- var t = document.getElementsByTagName("script");
401
- for (var r in t)
402
- if (t[r].src == e)
403
- return t[r];
433
+ } catch (err) {
434
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
435
+ if (src) {
436
+ var scripts = document.getElementsByTagName("script");
437
+ for (var i in scripts) {
438
+ if (scripts[i].src == src) {
439
+ return scripts[i];
440
+ }
441
+ }
404
442
  }
405
443
  return null;
406
444
  }
@@ -424,16 +462,19 @@ var fe = { exports: {} };
424
462
  * @param {boolean} [defaultActivation=false]
425
463
  * @returns {boolean}
426
464
  */
427
- isActive: function(e, t, r) {
428
- for (var a = "no-" + t; e; ) {
429
- var s = e.classList;
430
- if (s.contains(t))
431
- return !0;
432
- if (s.contains(a))
433
- return !1;
434
- e = e.parentElement;
465
+ isActive: function(element, className, defaultActivation) {
466
+ var no = "no-" + className;
467
+ while (element) {
468
+ var classList = element.classList;
469
+ if (classList.contains(className)) {
470
+ return true;
471
+ }
472
+ if (classList.contains(no)) {
473
+ return false;
474
+ }
475
+ element = element.parentElement;
435
476
  }
436
- return !!r;
477
+ return !!defaultActivation;
437
478
  }
438
479
  },
439
480
  /**
@@ -447,10 +488,10 @@ var fe = { exports: {} };
447
488
  /**
448
489
  * The grammar for plain, unformatted text.
449
490
  */
450
- plain: S,
451
- plaintext: S,
452
- text: S,
453
- txt: S,
491
+ plain: plainTextGrammar,
492
+ plaintext: plainTextGrammar,
493
+ text: plainTextGrammar,
494
+ txt: plainTextGrammar,
454
495
  /**
455
496
  * Creates a deep copy of the language with the given id and appends the given tokens.
456
497
  *
@@ -479,11 +520,12 @@ var fe = { exports: {} };
479
520
  * 'color': /\b(?:red|green|blue)\b/
480
521
  * });
481
522
  */
482
- extend: function(e, t) {
483
- var r = o.util.clone(o.languages[e]);
484
- for (var a in t)
485
- r[a] = t[a];
486
- return r;
523
+ extend: function(id, redef) {
524
+ var lang2 = _.util.clone(_.languages[id]);
525
+ for (var key in redef) {
526
+ lang2[key] = redef[key];
527
+ }
528
+ return lang2;
487
529
  },
488
530
  /**
489
531
  * Inserts tokens _before_ another token in a language definition or any other grammar.
@@ -560,32 +602,52 @@ var fe = { exports: {} };
560
602
  * @returns {Grammar} The new grammar object.
561
603
  * @public
562
604
  */
563
- insertBefore: function(e, t, r, a) {
564
- a = a || /** @type {any} */
565
- o.languages;
566
- var s = a[e], u = {};
567
- for (var y in s)
568
- if (s.hasOwnProperty(y)) {
569
- if (y == t)
570
- for (var c in r)
571
- r.hasOwnProperty(c) && (u[c] = r[c]);
572
- r.hasOwnProperty(y) || (u[y] = s[y]);
605
+ insertBefore: function(inside, before, insert, root) {
606
+ root = root || /** @type {any} */
607
+ _.languages;
608
+ var grammar = root[inside];
609
+ var ret = {};
610
+ for (var token in grammar) {
611
+ if (grammar.hasOwnProperty(token)) {
612
+ if (token == before) {
613
+ for (var newToken in insert) {
614
+ if (insert.hasOwnProperty(newToken)) {
615
+ ret[newToken] = insert[newToken];
616
+ }
617
+ }
618
+ }
619
+ if (!insert.hasOwnProperty(token)) {
620
+ ret[token] = grammar[token];
621
+ }
622
+ }
623
+ }
624
+ var old = root[inside];
625
+ root[inside] = ret;
626
+ _.languages.DFS(_.languages, function(key, value) {
627
+ if (value === old && key != inside) {
628
+ this[key] = ret;
573
629
  }
574
- var T = a[e];
575
- return a[e] = u, o.languages.DFS(o.languages, function(F, U) {
576
- U === T && F != e && (this[F] = u);
577
- }), u;
630
+ });
631
+ return ret;
578
632
  },
579
633
  // Traverse a language definition with Depth First Search
580
- DFS: function e(t, r, a, s) {
581
- s = s || {};
582
- var u = o.util.objId;
583
- for (var y in t)
584
- if (t.hasOwnProperty(y)) {
585
- r.call(t, y, t[y], a || y);
586
- var c = t[y], T = o.util.type(c);
587
- T === "Object" && !s[u(c)] ? (s[u(c)] = !0, e(c, r, null, s)) : T === "Array" && !s[u(c)] && (s[u(c)] = !0, e(c, r, y, s));
634
+ DFS: function DFS(o, callback, type, visited) {
635
+ visited = visited || {};
636
+ var objId = _.util.objId;
637
+ for (var i in o) {
638
+ if (o.hasOwnProperty(i)) {
639
+ callback.call(o, i, o[i], type || i);
640
+ var property = o[i];
641
+ var propertyType = _.util.type(property);
642
+ if (propertyType === "Object" && !visited[objId(property)]) {
643
+ visited[objId(property)] = true;
644
+ DFS(property, callback, null, visited);
645
+ } else if (propertyType === "Array" && !visited[objId(property)]) {
646
+ visited[objId(property)] = true;
647
+ DFS(property, callback, i, visited);
648
+ }
588
649
  }
650
+ }
589
651
  }
590
652
  },
591
653
  plugins: {},
@@ -601,8 +663,8 @@ var fe = { exports: {} };
601
663
  * @memberof Prism
602
664
  * @public
603
665
  */
604
- highlightAll: function(e, t) {
605
- o.highlightAllUnder(document, e, t);
666
+ highlightAll: function(async, callback) {
667
+ _.highlightAllUnder(document, async, callback);
606
668
  },
607
669
  /**
608
670
  * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
@@ -619,15 +681,18 @@ var fe = { exports: {} };
619
681
  * @memberof Prism
620
682
  * @public
621
683
  */
622
- highlightAllUnder: function(e, t, r) {
623
- var a = {
624
- callback: r,
625
- container: e,
684
+ highlightAllUnder: function(container, async, callback) {
685
+ var env = {
686
+ callback,
687
+ container,
626
688
  selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
627
689
  };
628
- o.hooks.run("before-highlightall", a), a.elements = Array.prototype.slice.apply(a.container.querySelectorAll(a.selector)), o.hooks.run("before-all-elements-highlight", a);
629
- for (var s = 0, u; u = a.elements[s++]; )
630
- o.highlightElement(u, t === !0, a.callback);
690
+ _.hooks.run("before-highlightall", env);
691
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
692
+ _.hooks.run("before-all-elements-highlight", env);
693
+ for (var i = 0, element; element = env.elements[i++]; ) {
694
+ _.highlightElement(element, async === true, env.callback);
695
+ }
631
696
  },
632
697
  /**
633
698
  * Highlights the code inside a single element.
@@ -657,39 +722,57 @@ var fe = { exports: {} };
657
722
  * @memberof Prism
658
723
  * @public
659
724
  */
660
- highlightElement: function(e, t, r) {
661
- var a = o.util.getLanguage(e), s = o.languages[a];
662
- o.util.setLanguage(e, a);
663
- var u = e.parentElement;
664
- u && u.nodeName.toLowerCase() === "pre" && o.util.setLanguage(u, a);
665
- var y = e.textContent, c = {
666
- element: e,
667
- language: a,
668
- grammar: s,
669
- code: y
725
+ highlightElement: function(element, async, callback) {
726
+ var language = _.util.getLanguage(element);
727
+ var grammar = _.languages[language];
728
+ _.util.setLanguage(element, language);
729
+ var parent = element.parentElement;
730
+ if (parent && parent.nodeName.toLowerCase() === "pre") {
731
+ _.util.setLanguage(parent, language);
732
+ }
733
+ var code = element.textContent;
734
+ var env = {
735
+ element,
736
+ language,
737
+ grammar,
738
+ code
670
739
  };
671
- function T(U) {
672
- c.highlightedCode = U, o.hooks.run("before-insert", c), c.element.innerHTML = c.highlightedCode, o.hooks.run("after-highlight", c), o.hooks.run("complete", c), r && r.call(c.element);
740
+ function insertHighlightedCode(highlightedCode) {
741
+ env.highlightedCode = highlightedCode;
742
+ _.hooks.run("before-insert", env);
743
+ env.element.innerHTML = env.highlightedCode;
744
+ _.hooks.run("after-highlight", env);
745
+ _.hooks.run("complete", env);
746
+ callback && callback.call(env.element);
747
+ }
748
+ _.hooks.run("before-sanity-check", env);
749
+ parent = env.element.parentElement;
750
+ if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
751
+ parent.setAttribute("tabindex", "0");
673
752
  }
674
- if (o.hooks.run("before-sanity-check", c), u = c.element.parentElement, u && u.nodeName.toLowerCase() === "pre" && !u.hasAttribute("tabindex") && u.setAttribute("tabindex", "0"), !c.code) {
675
- o.hooks.run("complete", c), r && r.call(c.element);
753
+ if (!env.code) {
754
+ _.hooks.run("complete", env);
755
+ callback && callback.call(env.element);
676
756
  return;
677
757
  }
678
- if (o.hooks.run("before-highlight", c), !c.grammar) {
679
- T(o.util.encode(c.code));
758
+ _.hooks.run("before-highlight", env);
759
+ if (!env.grammar) {
760
+ insertHighlightedCode(_.util.encode(env.code));
680
761
  return;
681
762
  }
682
- if (t && l.Worker) {
683
- var F = new Worker(o.filename);
684
- F.onmessage = function(U) {
685
- T(U.data);
686
- }, F.postMessage(JSON.stringify({
687
- language: c.language,
688
- code: c.code,
689
- immediateClose: !0
763
+ if (async && _self2.Worker) {
764
+ var worker = new Worker(_.filename);
765
+ worker.onmessage = function(evt) {
766
+ insertHighlightedCode(evt.data);
767
+ };
768
+ worker.postMessage(JSON.stringify({
769
+ language: env.language,
770
+ code: env.code,
771
+ immediateClose: true
690
772
  }));
691
- } else
692
- T(o.highlight(c.code, c.grammar, c.language));
773
+ } else {
774
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
775
+ }
693
776
  },
694
777
  /**
695
778
  * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
@@ -711,15 +794,19 @@ var fe = { exports: {} };
711
794
  * @example
712
795
  * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
713
796
  */
714
- highlight: function(e, t, r) {
715
- var a = {
716
- code: e,
717
- grammar: t,
718
- language: r
797
+ highlight: function(text, grammar, language) {
798
+ var env = {
799
+ code: text,
800
+ grammar,
801
+ language
719
802
  };
720
- if (o.hooks.run("before-tokenize", a), !a.grammar)
721
- throw new Error('The language "' + a.language + '" has no grammar.');
722
- return a.tokens = o.tokenize(a.code, a.grammar), o.hooks.run("after-tokenize", a), f.stringify(o.util.encode(a.tokens), a.language);
803
+ _.hooks.run("before-tokenize", env);
804
+ if (!env.grammar) {
805
+ throw new Error('The language "' + env.language + '" has no grammar.');
806
+ }
807
+ env.tokens = _.tokenize(env.code, env.grammar);
808
+ _.hooks.run("after-tokenize", env);
809
+ return Token.stringify(_.util.encode(env.tokens), env.language);
723
810
  },
724
811
  /**
725
812
  * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
@@ -745,15 +832,18 @@ var fe = { exports: {} };
745
832
  * }
746
833
  * });
747
834
  */
748
- tokenize: function(e, t) {
749
- var r = t.rest;
750
- if (r) {
751
- for (var a in r)
752
- t[a] = r[a];
753
- delete t.rest;
835
+ tokenize: function(text, grammar) {
836
+ var rest = grammar.rest;
837
+ if (rest) {
838
+ for (var token in rest) {
839
+ grammar[token] = rest[token];
840
+ }
841
+ delete grammar.rest;
754
842
  }
755
- var s = new C();
756
- return O(s, s.head, e), k(e, s, t, s.head, 0), $(s);
843
+ var tokenList = new LinkedList();
844
+ addAfter(tokenList, tokenList.head, text);
845
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
846
+ return toArray(tokenList);
757
847
  },
758
848
  /**
759
849
  * @namespace
@@ -774,9 +864,10 @@ var fe = { exports: {} };
774
864
  * @param {HookCallback} callback The callback function which is given environment variables.
775
865
  * @public
776
866
  */
777
- add: function(e, t) {
778
- var r = o.hooks.all;
779
- r[e] = r[e] || [], r[e].push(t);
867
+ add: function(name, callback) {
868
+ var hooks = _.hooks.all;
869
+ hooks[name] = hooks[name] || [];
870
+ hooks[name].push(callback);
780
871
  },
781
872
  /**
782
873
  * Runs a hook invoking all registered callbacks with the given environment variables.
@@ -787,214 +878,337 @@ var fe = { exports: {} };
787
878
  * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
788
879
  * @public
789
880
  */
790
- run: function(e, t) {
791
- var r = o.hooks.all[e];
792
- if (!(!r || !r.length))
793
- for (var a = 0, s; s = r[a++]; )
794
- s(t);
881
+ run: function(name, env) {
882
+ var callbacks = _.hooks.all[name];
883
+ if (!callbacks || !callbacks.length) {
884
+ return;
885
+ }
886
+ for (var i = 0, callback; callback = callbacks[i++]; ) {
887
+ callback(env);
888
+ }
795
889
  }
796
890
  },
797
- Token: f
891
+ Token
798
892
  };
799
- l.Prism = o;
800
- function f(e, t, r, a) {
801
- this.type = e, this.content = t, this.alias = r, this.length = (a || "").length | 0;
893
+ _self2.Prism = _;
894
+ function Token(type, content, alias, matchedStr) {
895
+ this.type = type;
896
+ this.content = content;
897
+ this.alias = alias;
898
+ this.length = (matchedStr || "").length | 0;
802
899
  }
803
- f.stringify = function e(t, r) {
804
- if (typeof t == "string")
805
- return t;
806
- if (Array.isArray(t)) {
807
- var a = "";
808
- return t.forEach(function(T) {
809
- a += e(T, r);
810
- }), a;
900
+ Token.stringify = function stringify(o, language) {
901
+ if (typeof o == "string") {
902
+ return o;
903
+ }
904
+ if (Array.isArray(o)) {
905
+ var s = "";
906
+ o.forEach(function(e) {
907
+ s += stringify(e, language);
908
+ });
909
+ return s;
811
910
  }
812
- var s = {
813
- type: t.type,
814
- content: e(t.content, r),
911
+ var env = {
912
+ type: o.type,
913
+ content: stringify(o.content, language),
815
914
  tag: "span",
816
- classes: ["token", t.type],
915
+ classes: ["token", o.type],
817
916
  attributes: {},
818
- language: r
819
- }, u = t.alias;
820
- u && (Array.isArray(u) ? Array.prototype.push.apply(s.classes, u) : s.classes.push(u)), o.hooks.run("wrap", s);
821
- var y = "";
822
- for (var c in s.attributes)
823
- y += " " + c + '="' + (s.attributes[c] || "").replace(/"/g, "&quot;") + '"';
824
- return "<" + s.tag + ' class="' + s.classes.join(" ") + '"' + y + ">" + s.content + "</" + s.tag + ">";
917
+ language
918
+ };
919
+ var aliases = o.alias;
920
+ if (aliases) {
921
+ if (Array.isArray(aliases)) {
922
+ Array.prototype.push.apply(env.classes, aliases);
923
+ } else {
924
+ env.classes.push(aliases);
925
+ }
926
+ }
927
+ _.hooks.run("wrap", env);
928
+ var attributes = "";
929
+ for (var name in env.attributes) {
930
+ attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
931
+ }
932
+ return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
825
933
  };
826
- function b(e, t, r, a) {
827
- e.lastIndex = t;
828
- var s = e.exec(r);
829
- if (s && a && s[1]) {
830
- var u = s[1].length;
831
- s.index += u, s[0] = s[0].slice(u);
934
+ function matchPattern(pattern, pos, text, lookbehind) {
935
+ pattern.lastIndex = pos;
936
+ var match = pattern.exec(text);
937
+ if (match && lookbehind && match[1]) {
938
+ var lookbehindLength = match[1].length;
939
+ match.index += lookbehindLength;
940
+ match[0] = match[0].slice(lookbehindLength);
832
941
  }
833
- return s;
942
+ return match;
834
943
  }
835
- function k(e, t, r, a, s, u) {
836
- for (var y in r)
837
- if (!(!r.hasOwnProperty(y) || !r[y])) {
838
- var c = r[y];
839
- c = Array.isArray(c) ? c : [c];
840
- for (var T = 0; T < c.length; ++T) {
841
- if (u && u.cause == y + "," + T)
944
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
945
+ for (var token in grammar) {
946
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
947
+ continue;
948
+ }
949
+ var patterns = grammar[token];
950
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
951
+ for (var j2 = 0; j2 < patterns.length; ++j2) {
952
+ if (rematch && rematch.cause == token + "," + j2) {
953
+ return;
954
+ }
955
+ var patternObj = patterns[j2];
956
+ var inside = patternObj.inside;
957
+ var lookbehind = !!patternObj.lookbehind;
958
+ var greedy = !!patternObj.greedy;
959
+ var alias = patternObj.alias;
960
+ if (greedy && !patternObj.pattern.global) {
961
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
962
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
963
+ }
964
+ var pattern = patternObj.pattern || patternObj;
965
+ for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
966
+ if (rematch && pos >= rematch.reach) {
967
+ break;
968
+ }
969
+ var str = currentNode.value;
970
+ if (tokenList.length > text.length) {
842
971
  return;
843
- var F = c[T], U = F.inside, X = !!F.lookbehind, Z = !!F.greedy, V = F.alias;
844
- if (Z && !F.pattern.global) {
845
- var te = F.pattern.toString().match(/[imsuy]*$/)[0];
846
- F.pattern = RegExp(F.pattern.source, te + "g");
847
972
  }
848
- for (var Y = F.pattern || F, R = a.next, D = s; R !== t.tail && !(u && D >= u.reach); D += R.value.length, R = R.next) {
849
- var d = R.value;
850
- if (t.length > e.length)
851
- return;
852
- if (!(d instanceof f)) {
853
- var g = 1, m;
854
- if (Z) {
855
- if (m = b(Y, D, e, X), !m || m.index >= e.length)
856
- break;
857
- var W = m.index, M = m.index + m[0].length, P = D;
858
- for (P += R.value.length; W >= P; )
859
- R = R.next, P += R.value.length;
860
- if (P -= R.value.length, D = P, R.value instanceof f)
861
- continue;
862
- for (var G = R; G !== t.tail && (P < M || typeof G.value == "string"); G = G.next)
863
- g++, P += G.value.length;
864
- g--, d = e.slice(D, P), m.index -= D;
865
- } else if (m = b(Y, 0, d, X), !m)
866
- continue;
867
- var W = m.index, K = m[0], ne = d.slice(0, W), ce = d.slice(W + K.length), ae = D + d.length;
868
- u && ae > u.reach && (u.reach = ae);
869
- var q = R.prev;
870
- ne && (q = O(t, q, ne), D += ne.length), L(t, q, g);
871
- var be = new f(y, U ? o.tokenize(K, U) : K, V, K);
872
- if (R = O(t, q, be), ce && O(t, R, ce), g > 1) {
873
- var re = {
874
- cause: y + "," + T,
875
- reach: ae
876
- };
877
- k(e, t, r, R.prev, D, re), u && re.reach > u.reach && (u.reach = re.reach);
878
- }
973
+ if (str instanceof Token) {
974
+ continue;
975
+ }
976
+ var removeCount = 1;
977
+ var match;
978
+ if (greedy) {
979
+ match = matchPattern(pattern, pos, text, lookbehind);
980
+ if (!match || match.index >= text.length) {
981
+ break;
982
+ }
983
+ var from = match.index;
984
+ var to = match.index + match[0].length;
985
+ var p = pos;
986
+ p += currentNode.value.length;
987
+ while (from >= p) {
988
+ currentNode = currentNode.next;
989
+ p += currentNode.value.length;
990
+ }
991
+ p -= currentNode.value.length;
992
+ pos = p;
993
+ if (currentNode.value instanceof Token) {
994
+ continue;
995
+ }
996
+ for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === "string"); k = k.next) {
997
+ removeCount++;
998
+ p += k.value.length;
999
+ }
1000
+ removeCount--;
1001
+ str = text.slice(pos, p);
1002
+ match.index -= pos;
1003
+ } else {
1004
+ match = matchPattern(pattern, 0, str, lookbehind);
1005
+ if (!match) {
1006
+ continue;
1007
+ }
1008
+ }
1009
+ var from = match.index;
1010
+ var matchStr = match[0];
1011
+ var before = str.slice(0, from);
1012
+ var after = str.slice(from + matchStr.length);
1013
+ var reach = pos + str.length;
1014
+ if (rematch && reach > rematch.reach) {
1015
+ rematch.reach = reach;
1016
+ }
1017
+ var removeFrom = currentNode.prev;
1018
+ if (before) {
1019
+ removeFrom = addAfter(tokenList, removeFrom, before);
1020
+ pos += before.length;
1021
+ }
1022
+ removeRange(tokenList, removeFrom, removeCount);
1023
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
1024
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
1025
+ if (after) {
1026
+ addAfter(tokenList, currentNode, after);
1027
+ }
1028
+ if (removeCount > 1) {
1029
+ var nestedRematch = {
1030
+ cause: token + "," + j2,
1031
+ reach
1032
+ };
1033
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
1034
+ if (rematch && nestedRematch.reach > rematch.reach) {
1035
+ rematch.reach = nestedRematch.reach;
879
1036
  }
880
1037
  }
881
1038
  }
882
1039
  }
1040
+ }
883
1041
  }
884
- function C() {
885
- var e = { value: null, prev: null, next: null }, t = { value: null, prev: e, next: null };
886
- e.next = t, this.head = e, this.tail = t, this.length = 0;
1042
+ function LinkedList() {
1043
+ var head = { value: null, prev: null, next: null };
1044
+ var tail = { value: null, prev: head, next: null };
1045
+ head.next = tail;
1046
+ this.head = head;
1047
+ this.tail = tail;
1048
+ this.length = 0;
887
1049
  }
888
- function O(e, t, r) {
889
- var a = t.next, s = { value: r, prev: t, next: a };
890
- return t.next = s, a.prev = s, e.length++, s;
1050
+ function addAfter(list, node, value) {
1051
+ var next = node.next;
1052
+ var newNode = { value, prev: node, next };
1053
+ node.next = newNode;
1054
+ next.prev = newNode;
1055
+ list.length++;
1056
+ return newNode;
891
1057
  }
892
- function L(e, t, r) {
893
- for (var a = t.next, s = 0; s < r && a !== e.tail; s++)
894
- a = a.next;
895
- t.next = a, a.prev = t, e.length -= s;
1058
+ function removeRange(list, node, count) {
1059
+ var next = node.next;
1060
+ for (var i = 0; i < count && next !== list.tail; i++) {
1061
+ next = next.next;
1062
+ }
1063
+ node.next = next;
1064
+ next.prev = node;
1065
+ list.length -= i;
896
1066
  }
897
- function $(e) {
898
- for (var t = [], r = e.head.next; r !== e.tail; )
899
- t.push(r.value), r = r.next;
900
- return t;
1067
+ function toArray(list) {
1068
+ var array = [];
1069
+ var node = list.head.next;
1070
+ while (node !== list.tail) {
1071
+ array.push(node.value);
1072
+ node = node.next;
1073
+ }
1074
+ return array;
901
1075
  }
902
- if (!l.document)
903
- return l.addEventListener && (o.disableWorkerMessageHandler || l.addEventListener("message", function(e) {
904
- var t = JSON.parse(e.data), r = t.language, a = t.code, s = t.immediateClose;
905
- l.postMessage(o.highlight(a, o.languages[r], r)), s && l.close();
906
- }, !1)), o;
907
- var w = o.util.currentScript();
908
- w && (o.filename = w.src, w.hasAttribute("data-manual") && (o.manual = !0));
909
- function E() {
910
- o.manual || o.highlightAll();
1076
+ if (!_self2.document) {
1077
+ if (!_self2.addEventListener) {
1078
+ return _;
1079
+ }
1080
+ if (!_.disableWorkerMessageHandler) {
1081
+ _self2.addEventListener("message", function(evt) {
1082
+ var message = JSON.parse(evt.data);
1083
+ var lang2 = message.language;
1084
+ var code = message.code;
1085
+ var immediateClose = message.immediateClose;
1086
+ _self2.postMessage(_.highlight(code, _.languages[lang2], lang2));
1087
+ if (immediateClose) {
1088
+ _self2.close();
1089
+ }
1090
+ }, false);
1091
+ }
1092
+ return _;
911
1093
  }
912
- if (!o.manual) {
913
- var h = document.readyState;
914
- h === "loading" || h === "interactive" && w && w.defer ? document.addEventListener("DOMContentLoaded", E) : window.requestAnimationFrame ? window.requestAnimationFrame(E) : window.setTimeout(E, 16);
1094
+ var script = _.util.currentScript();
1095
+ if (script) {
1096
+ _.filename = script.src;
1097
+ if (script.hasAttribute("data-manual")) {
1098
+ _.manual = true;
1099
+ }
1100
+ }
1101
+ function highlightAutomaticallyCallback() {
1102
+ if (!_.manual) {
1103
+ _.highlightAll();
1104
+ }
915
1105
  }
916
- return o;
917
- }(p);
918
- i.exports && (i.exports = n), typeof pe < "u" && (pe.Prism = n), n.languages.markup = {
919
- comment: {
1106
+ if (!_.manual) {
1107
+ var readyState = document.readyState;
1108
+ if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
1109
+ document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
1110
+ } else {
1111
+ if (window.requestAnimationFrame) {
1112
+ window.requestAnimationFrame(highlightAutomaticallyCallback);
1113
+ } else {
1114
+ window.setTimeout(highlightAutomaticallyCallback, 16);
1115
+ }
1116
+ }
1117
+ }
1118
+ return _;
1119
+ }(_self);
1120
+ if (module.exports) {
1121
+ module.exports = Prism2;
1122
+ }
1123
+ if (typeof commonjsGlobal !== "undefined") {
1124
+ commonjsGlobal.Prism = Prism2;
1125
+ }
1126
+ Prism2.languages.markup = {
1127
+ "comment": {
920
1128
  pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
921
- greedy: !0
1129
+ greedy: true
922
1130
  },
923
- prolog: {
1131
+ "prolog": {
924
1132
  pattern: /<\?[\s\S]+?\?>/,
925
- greedy: !0
1133
+ greedy: true
926
1134
  },
927
- doctype: {
1135
+ "doctype": {
928
1136
  // https://www.w3.org/TR/xml/#NT-doctypedecl
929
1137
  pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
930
- greedy: !0,
1138
+ greedy: true,
931
1139
  inside: {
932
1140
  "internal-subset": {
933
1141
  pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
934
- lookbehind: !0,
935
- greedy: !0,
1142
+ lookbehind: true,
1143
+ greedy: true,
936
1144
  inside: null
937
1145
  // see below
938
1146
  },
939
- string: {
1147
+ "string": {
940
1148
  pattern: /"[^"]*"|'[^']*'/,
941
- greedy: !0
1149
+ greedy: true
942
1150
  },
943
- punctuation: /^<!|>$|[[\]]/,
1151
+ "punctuation": /^<!|>$|[[\]]/,
944
1152
  "doctype-tag": /^DOCTYPE/i,
945
- name: /[^\s<>'"]+/
1153
+ "name": /[^\s<>'"]+/
946
1154
  }
947
1155
  },
948
- cdata: {
1156
+ "cdata": {
949
1157
  pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
950
- greedy: !0
1158
+ greedy: true
951
1159
  },
952
- tag: {
1160
+ "tag": {
953
1161
  pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
954
- greedy: !0,
1162
+ greedy: true,
955
1163
  inside: {
956
- tag: {
1164
+ "tag": {
957
1165
  pattern: /^<\/?[^\s>\/]+/,
958
1166
  inside: {
959
- punctuation: /^<\/?/,
960
- namespace: /^[^\s>\/:]+:/
1167
+ "punctuation": /^<\/?/,
1168
+ "namespace": /^[^\s>\/:]+:/
961
1169
  }
962
1170
  },
963
1171
  "special-attr": [],
964
1172
  "attr-value": {
965
1173
  pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
966
1174
  inside: {
967
- punctuation: [
1175
+ "punctuation": [
968
1176
  {
969
1177
  pattern: /^=/,
970
1178
  alias: "attr-equals"
971
1179
  },
972
1180
  {
973
1181
  pattern: /^(\s*)["']|["']$/,
974
- lookbehind: !0
1182
+ lookbehind: true
975
1183
  }
976
1184
  ]
977
1185
  }
978
1186
  },
979
- punctuation: /\/?>/,
1187
+ "punctuation": /\/?>/,
980
1188
  "attr-name": {
981
1189
  pattern: /[^\s>\/]+/,
982
1190
  inside: {
983
- namespace: /^[^\s>\/:]+:/
1191
+ "namespace": /^[^\s>\/:]+:/
984
1192
  }
985
1193
  }
986
1194
  }
987
1195
  },
988
- entity: [
1196
+ "entity": [
989
1197
  {
990
1198
  pattern: /&[\da-z]{1,8};/i,
991
1199
  alias: "named-entity"
992
1200
  },
993
1201
  /&#x?[\da-f]{1,8};/i
994
1202
  ]
995
- }, n.languages.markup.tag.inside["attr-value"].inside.entity = n.languages.markup.entity, n.languages.markup.doctype.inside["internal-subset"].inside = n.languages.markup, n.hooks.add("wrap", function(l) {
996
- l.type === "entity" && (l.attributes.title = l.content.replace(/&amp;/, "&"));
997
- }), Object.defineProperty(n.languages.markup.tag, "addInlined", {
1203
+ };
1204
+ Prism2.languages.markup["tag"].inside["attr-value"].inside["entity"] = Prism2.languages.markup["entity"];
1205
+ Prism2.languages.markup["doctype"].inside["internal-subset"].inside = Prism2.languages.markup;
1206
+ Prism2.hooks.add("wrap", function(env) {
1207
+ if (env.type === "entity") {
1208
+ env.attributes["title"] = env.content.replace(/&amp;/, "&");
1209
+ }
1210
+ });
1211
+ Object.defineProperty(Prism2.languages.markup.tag, "addInlined", {
998
1212
  /**
999
1213
  * Adds an inlined language to markup.
1000
1214
  *
@@ -1006,34 +1220,37 @@ var fe = { exports: {} };
1006
1220
  * @example
1007
1221
  * addInlined('style', 'css');
1008
1222
  */
1009
- value: function(v, _) {
1010
- var S = {};
1011
- S["language-" + _] = {
1223
+ value: function addInlined(tagName, lang) {
1224
+ var includedCdataInside = {};
1225
+ includedCdataInside["language-" + lang] = {
1012
1226
  pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1013
- lookbehind: !0,
1014
- inside: n.languages[_]
1015
- }, S.cdata = /^<!\[CDATA\[|\]\]>$/i;
1016
- var o = {
1227
+ lookbehind: true,
1228
+ inside: Prism2.languages[lang]
1229
+ };
1230
+ includedCdataInside["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
1231
+ var inside = {
1017
1232
  "included-cdata": {
1018
1233
  pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1019
- inside: S
1234
+ inside: includedCdataInside
1020
1235
  }
1021
1236
  };
1022
- o["language-" + _] = {
1237
+ inside["language-" + lang] = {
1023
1238
  pattern: /[\s\S]+/,
1024
- inside: n.languages[_]
1239
+ inside: Prism2.languages[lang]
1025
1240
  };
1026
- var f = {};
1027
- f[v] = {
1241
+ var def = {};
1242
+ def[tagName] = {
1028
1243
  pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
1029
- return v;
1244
+ return tagName;
1030
1245
  }), "i"),
1031
- lookbehind: !0,
1032
- greedy: !0,
1033
- inside: o
1034
- }, n.languages.insertBefore("markup", "cdata", f);
1246
+ lookbehind: true,
1247
+ greedy: true,
1248
+ inside
1249
+ };
1250
+ Prism2.languages.insertBefore("markup", "cdata", def);
1035
1251
  }
1036
- }), Object.defineProperty(n.languages.markup.tag, "addAttribute", {
1252
+ });
1253
+ Object.defineProperty(Prism2.languages.markup.tag, "addAttribute", {
1037
1254
  /**
1038
1255
  * Adds an pattern to highlight languages embedded in HTML attributes.
1039
1256
  *
@@ -1045,25 +1262,25 @@ var fe = { exports: {} };
1045
1262
  * @example
1046
1263
  * addAttribute('style', 'css');
1047
1264
  */
1048
- value: function(l, v) {
1049
- n.languages.markup.tag.inside["special-attr"].push({
1265
+ value: function(attrName, lang) {
1266
+ Prism2.languages.markup.tag.inside["special-attr"].push({
1050
1267
  pattern: RegExp(
1051
- /(^|["'\s])/.source + "(?:" + l + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1268
+ /(^|["'\s])/.source + "(?:" + attrName + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1052
1269
  "i"
1053
1270
  ),
1054
- lookbehind: !0,
1271
+ lookbehind: true,
1055
1272
  inside: {
1056
1273
  "attr-name": /^[^\s=]+/,
1057
1274
  "attr-value": {
1058
1275
  pattern: /=[\s\S]+/,
1059
1276
  inside: {
1060
- value: {
1277
+ "value": {
1061
1278
  pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1062
- lookbehind: !0,
1063
- alias: [v, "language-" + v],
1064
- inside: n.languages[v]
1279
+ lookbehind: true,
1280
+ alias: [lang, "language-" + lang],
1281
+ inside: Prism2.languages[lang]
1065
1282
  },
1066
- punctuation: [
1283
+ "punctuation": [
1067
1284
  {
1068
1285
  pattern: /^=/,
1069
1286
  alias: "attr-equals"
@@ -1075,111 +1292,125 @@ var fe = { exports: {} };
1075
1292
  }
1076
1293
  });
1077
1294
  }
1078
- }), n.languages.html = n.languages.markup, n.languages.mathml = n.languages.markup, n.languages.svg = n.languages.markup, n.languages.xml = n.languages.extend("markup", {}), n.languages.ssml = n.languages.xml, n.languages.atom = n.languages.xml, n.languages.rss = n.languages.xml, function(l) {
1079
- var v = /(?:"(?:\\(?:\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 + "|" + v.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1295
+ });
1296
+ Prism2.languages.html = Prism2.languages.markup;
1297
+ Prism2.languages.mathml = Prism2.languages.markup;
1298
+ Prism2.languages.svg = Prism2.languages.markup;
1299
+ Prism2.languages.xml = Prism2.languages.extend("markup", {});
1300
+ Prism2.languages.ssml = Prism2.languages.xml;
1301
+ Prism2.languages.atom = Prism2.languages.xml;
1302
+ Prism2.languages.rss = Prism2.languages.xml;
1303
+ (function(Prism3) {
1304
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1305
+ Prism3.languages.css = {
1306
+ "comment": /\/\*[\s\S]*?\*\//,
1307
+ "atrule": {
1308
+ pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + string.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1084
1309
  inside: {
1085
- rule: /^@[\w-]+/,
1310
+ "rule": /^@[\w-]+/,
1086
1311
  "selector-function-argument": {
1087
1312
  pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1088
- lookbehind: !0,
1313
+ lookbehind: true,
1089
1314
  alias: "selector"
1090
1315
  },
1091
- keyword: {
1316
+ "keyword": {
1092
1317
  pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1093
- lookbehind: !0
1318
+ lookbehind: true
1094
1319
  }
1095
1320
  // See rest below
1096
1321
  }
1097
1322
  },
1098
- url: {
1323
+ "url": {
1099
1324
  // https://drafts.csswg.org/css-values-3/#urls
1100
- pattern: RegExp("\\burl\\((?:" + v.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1101
- greedy: !0,
1325
+ pattern: RegExp("\\burl\\((?:" + string.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1326
+ greedy: true,
1102
1327
  inside: {
1103
- function: /^url/i,
1104
- punctuation: /^\(|\)$/,
1105
- string: {
1106
- pattern: RegExp("^" + v.source + "$"),
1328
+ "function": /^url/i,
1329
+ "punctuation": /^\(|\)$/,
1330
+ "string": {
1331
+ pattern: RegExp("^" + string.source + "$"),
1107
1332
  alias: "url"
1108
1333
  }
1109
1334
  }
1110
1335
  },
1111
- selector: {
1112
- pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + v.source + ")*(?=\\s*\\{)"),
1113
- lookbehind: !0
1336
+ "selector": {
1337
+ pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + string.source + ")*(?=\\s*\\{)"),
1338
+ lookbehind: true
1114
1339
  },
1115
- string: {
1116
- pattern: v,
1117
- greedy: !0
1340
+ "string": {
1341
+ pattern: string,
1342
+ greedy: true
1118
1343
  },
1119
- property: {
1344
+ "property": {
1120
1345
  pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1121
- lookbehind: !0
1346
+ lookbehind: true
1122
1347
  },
1123
- important: /!important\b/i,
1124
- function: {
1348
+ "important": /!important\b/i,
1349
+ "function": {
1125
1350
  pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1126
- lookbehind: !0
1351
+ lookbehind: true
1127
1352
  },
1128
- punctuation: /[(){};:,]/
1129
- }, l.languages.css.atrule.inside.rest = l.languages.css;
1130
- var _ = l.languages.markup;
1131
- _ && (_.tag.addInlined("style", "css"), _.tag.addAttribute("style", "css"));
1132
- }(n), n.languages.clike = {
1133
- comment: [
1353
+ "punctuation": /[(){};:,]/
1354
+ };
1355
+ Prism3.languages.css["atrule"].inside.rest = Prism3.languages.css;
1356
+ var markup = Prism3.languages.markup;
1357
+ if (markup) {
1358
+ markup.tag.addInlined("style", "css");
1359
+ markup.tag.addAttribute("style", "css");
1360
+ }
1361
+ })(Prism2);
1362
+ Prism2.languages.clike = {
1363
+ "comment": [
1134
1364
  {
1135
1365
  pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1136
- lookbehind: !0,
1137
- greedy: !0
1366
+ lookbehind: true,
1367
+ greedy: true
1138
1368
  },
1139
1369
  {
1140
1370
  pattern: /(^|[^\\:])\/\/.*/,
1141
- lookbehind: !0,
1142
- greedy: !0
1371
+ lookbehind: true,
1372
+ greedy: true
1143
1373
  }
1144
1374
  ],
1145
- string: {
1375
+ "string": {
1146
1376
  pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1147
- greedy: !0
1377
+ greedy: true
1148
1378
  },
1149
1379
  "class-name": {
1150
1380
  pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1151
- lookbehind: !0,
1381
+ lookbehind: true,
1152
1382
  inside: {
1153
- punctuation: /[.\\]/
1383
+ "punctuation": /[.\\]/
1154
1384
  }
1155
1385
  },
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
- }, n.languages.javascript = n.languages.extend("clike", {
1386
+ "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1387
+ "boolean": /\b(?:false|true)\b/,
1388
+ "function": /\b\w+(?=\()/,
1389
+ "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1390
+ "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1391
+ "punctuation": /[{}[\];(),.:]/
1392
+ };
1393
+ Prism2.languages.javascript = Prism2.languages.extend("clike", {
1163
1394
  "class-name": [
1164
- n.languages.clike["class-name"],
1395
+ Prism2.languages.clike["class-name"],
1165
1396
  {
1166
1397
  pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1167
- lookbehind: !0
1398
+ lookbehind: true
1168
1399
  }
1169
1400
  ],
1170
- keyword: [
1401
+ "keyword": [
1171
1402
  {
1172
1403
  pattern: /((?:^|\})\s*)catch\b/,
1173
- lookbehind: !0
1404
+ lookbehind: true
1174
1405
  },
1175
1406
  {
1176
1407
  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
1408
+ lookbehind: true
1178
1409
  }
1179
1410
  ],
1180
1411
  // 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: {
1412
+ "function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1413
+ "number": {
1183
1414
  pattern: RegExp(
1184
1415
  /(^|[^\w$])/.source + "(?:" + // constant
1185
1416
  (/NaN|Infinity/.source + "|" + // binary integer
@@ -1189,11 +1420,13 @@ var fe = { exports: {} };
1189
1420
  /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1190
1421
  /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1191
1422
  ),
1192
- lookbehind: !0
1423
+ lookbehind: true
1193
1424
  },
1194
- operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1195
- }), n.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, n.languages.insertBefore("javascript", "keyword", {
1196
- regex: {
1425
+ "operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1426
+ });
1427
+ Prism2.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1428
+ Prism2.languages.insertBefore("javascript", "keyword", {
1429
+ "regex": {
1197
1430
  pattern: RegExp(
1198
1431
  // lookbehind
1199
1432
  // eslint-disable-next-line regexp/no-dupe-characters-character-class
@@ -1205,14 +1438,14 @@ var fe = { exports: {} };
1205
1438
  /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1206
1439
  /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1207
1440
  ),
1208
- lookbehind: !0,
1209
- greedy: !0,
1441
+ lookbehind: true,
1442
+ greedy: true,
1210
1443
  inside: {
1211
1444
  "regex-source": {
1212
1445
  pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1213
- lookbehind: !0,
1446
+ lookbehind: true,
1214
1447
  alias: "language-regex",
1215
- inside: n.languages.regex
1448
+ inside: Prism2.languages.regex
1216
1449
  },
1217
1450
  "regex-delimiter": /^\/|\/$/,
1218
1451
  "regex-flags": /^[a-z]+$/
@@ -1223,138 +1456,200 @@ var fe = { exports: {} };
1223
1456
  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
1457
  alias: "function"
1225
1458
  },
1226
- parameter: [
1459
+ "parameter": [
1227
1460
  {
1228
1461
  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: n.languages.javascript
1462
+ lookbehind: true,
1463
+ inside: Prism2.languages.javascript
1231
1464
  },
1232
1465
  {
1233
1466
  pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1234
- lookbehind: !0,
1235
- inside: n.languages.javascript
1467
+ lookbehind: true,
1468
+ inside: Prism2.languages.javascript
1236
1469
  },
1237
1470
  {
1238
1471
  pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1239
- lookbehind: !0,
1240
- inside: n.languages.javascript
1472
+ lookbehind: true,
1473
+ inside: Prism2.languages.javascript
1241
1474
  },
1242
1475
  {
1243
1476
  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: n.languages.javascript
1477
+ lookbehind: true,
1478
+ inside: Prism2.languages.javascript
1246
1479
  }
1247
1480
  ],
1248
- constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1249
- }), n.languages.insertBefore("javascript", "string", {
1250
- hashbang: {
1481
+ "constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1482
+ });
1483
+ Prism2.languages.insertBefore("javascript", "string", {
1484
+ "hashbang": {
1251
1485
  pattern: /^#!.*/,
1252
- greedy: !0,
1486
+ greedy: true,
1253
1487
  alias: "comment"
1254
1488
  },
1255
1489
  "template-string": {
1256
1490
  pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1257
- greedy: !0,
1491
+ greedy: true,
1258
1492
  inside: {
1259
1493
  "template-punctuation": {
1260
1494
  pattern: /^`|`$/,
1261
1495
  alias: "string"
1262
1496
  },
1263
- interpolation: {
1497
+ "interpolation": {
1264
1498
  pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1265
- lookbehind: !0,
1499
+ lookbehind: true,
1266
1500
  inside: {
1267
1501
  "interpolation-punctuation": {
1268
1502
  pattern: /^\$\{|\}$/,
1269
1503
  alias: "punctuation"
1270
1504
  },
1271
- rest: n.languages.javascript
1505
+ rest: Prism2.languages.javascript
1272
1506
  }
1273
1507
  },
1274
- string: /[\s\S]+/
1508
+ "string": /[\s\S]+/
1275
1509
  }
1276
1510
  },
1277
1511
  "string-property": {
1278
1512
  pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1279
- lookbehind: !0,
1280
- greedy: !0,
1513
+ lookbehind: true,
1514
+ greedy: true,
1281
1515
  alias: "property"
1282
1516
  }
1283
- }), n.languages.insertBefore("javascript", "operator", {
1517
+ });
1518
+ Prism2.languages.insertBefore("javascript", "operator", {
1284
1519
  "literal-property": {
1285
1520
  pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1286
- lookbehind: !0,
1521
+ lookbehind: true,
1287
1522
  alias: "property"
1288
1523
  }
1289
- }), n.languages.markup && (n.languages.markup.tag.addInlined("script", "javascript"), n.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
- )), n.languages.js = n.languages.javascript, function() {
1293
- if (typeof n > "u" || typeof document > "u")
1524
+ });
1525
+ if (Prism2.languages.markup) {
1526
+ Prism2.languages.markup.tag.addInlined("script", "javascript");
1527
+ Prism2.languages.markup.tag.addAttribute(
1528
+ /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,
1529
+ "javascript"
1530
+ );
1531
+ }
1532
+ Prism2.languages.js = Prism2.languages.javascript;
1533
+ (function() {
1534
+ if (typeof Prism2 === "undefined" || typeof document === "undefined") {
1294
1535
  return;
1295
- Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
1296
- var l = "Loading…", v = function(w, E) {
1297
- return "✖ Error " + w + " while fetching file: " + E;
1298
- }, _ = "✖ Error: File does not exist or is empty", S = {
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
- }, o = "data-src-status", f = "loading", b = "loaded", k = "failed", C = "pre[data-src]:not([" + o + '="' + b + '"]):not([' + o + '="' + f + '"])';
1309
- function O(w, E, h) {
1310
- var e = new XMLHttpRequest();
1311
- e.open("GET", w, !0), e.onreadystatechange = function() {
1312
- e.readyState == 4 && (e.status < 400 && e.responseText ? E(e.responseText) : e.status >= 400 ? h(v(e.status, e.statusText)) : h(_));
1313
- }, e.send(null);
1314
1536
  }
1315
- function L(w) {
1316
- var E = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(w || "");
1317
- if (E) {
1318
- var h = Number(E[1]), e = E[2], t = E[3];
1319
- return e ? t ? [h, Number(t)] : [h, void 0] : [h, h];
1537
+ if (!Element.prototype.matches) {
1538
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1539
+ }
1540
+ var LOADING_MESSAGE = "Loading…";
1541
+ var FAILURE_MESSAGE = function(status, message) {
1542
+ return "✖ Error " + status + " while fetching file: " + message;
1543
+ };
1544
+ var FAILURE_EMPTY_MESSAGE = "✖ Error: File does not exist or is empty";
1545
+ var EXTENSIONS = {
1546
+ "js": "javascript",
1547
+ "py": "python",
1548
+ "rb": "ruby",
1549
+ "ps1": "powershell",
1550
+ "psm1": "powershell",
1551
+ "sh": "bash",
1552
+ "bat": "batch",
1553
+ "h": "c",
1554
+ "tex": "latex"
1555
+ };
1556
+ var STATUS_ATTR = "data-src-status";
1557
+ var STATUS_LOADING = "loading";
1558
+ var STATUS_LOADED = "loaded";
1559
+ var STATUS_FAILED = "failed";
1560
+ var SELECTOR = "pre[data-src]:not([" + STATUS_ATTR + '="' + STATUS_LOADED + '"]):not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
1561
+ function loadFile(src, success, error) {
1562
+ var xhr = new XMLHttpRequest();
1563
+ xhr.open("GET", src, true);
1564
+ xhr.onreadystatechange = function() {
1565
+ if (xhr.readyState == 4) {
1566
+ if (xhr.status < 400 && xhr.responseText) {
1567
+ success(xhr.responseText);
1568
+ } else {
1569
+ if (xhr.status >= 400) {
1570
+ error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
1571
+ } else {
1572
+ error(FAILURE_EMPTY_MESSAGE);
1573
+ }
1574
+ }
1575
+ }
1576
+ };
1577
+ xhr.send(null);
1578
+ }
1579
+ function parseRange(range) {
1580
+ var m2 = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || "");
1581
+ if (m2) {
1582
+ var start = Number(m2[1]);
1583
+ var comma = m2[2];
1584
+ var end = m2[3];
1585
+ if (!comma) {
1586
+ return [start, start];
1587
+ }
1588
+ if (!end) {
1589
+ return [start, void 0];
1590
+ }
1591
+ return [start, Number(end)];
1320
1592
  }
1593
+ return void 0;
1321
1594
  }
1322
- n.hooks.add("before-highlightall", function(w) {
1323
- w.selector += ", " + C;
1324
- }), n.hooks.add("before-sanity-check", function(w) {
1325
- var E = (
1595
+ Prism2.hooks.add("before-highlightall", function(env) {
1596
+ env.selector += ", " + SELECTOR;
1597
+ });
1598
+ Prism2.hooks.add("before-sanity-check", function(env) {
1599
+ var pre = (
1326
1600
  /** @type {HTMLPreElement} */
1327
- w.element
1601
+ env.element
1328
1602
  );
1329
- if (E.matches(C)) {
1330
- w.code = "", E.setAttribute(o, f);
1331
- var h = E.appendChild(document.createElement("CODE"));
1332
- h.textContent = l;
1333
- var e = E.getAttribute("data-src"), t = w.language;
1334
- if (t === "none") {
1335
- var r = (/\.(\w+)$/.exec(e) || [, "none"])[1];
1336
- t = S[r] || r;
1603
+ if (pre.matches(SELECTOR)) {
1604
+ env.code = "";
1605
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADING);
1606
+ var code = pre.appendChild(document.createElement("CODE"));
1607
+ code.textContent = LOADING_MESSAGE;
1608
+ var src = pre.getAttribute("data-src");
1609
+ var language = env.language;
1610
+ if (language === "none") {
1611
+ var extension = (/\.(\w+)$/.exec(src) || [, "none"])[1];
1612
+ language = EXTENSIONS[extension] || extension;
1337
1613
  }
1338
- n.util.setLanguage(h, t), n.util.setLanguage(E, t);
1339
- var a = n.plugins.autoloader;
1340
- a && a.loadLanguages(t), O(
1341
- e,
1342
- function(s) {
1343
- E.setAttribute(o, b);
1344
- var u = L(E.getAttribute("data-range"));
1345
- if (u) {
1346
- var y = s.split(/\r\n?|\n/g), c = u[0], T = u[1] == null ? y.length : u[1];
1347
- c < 0 && (c += y.length), c = Math.max(0, Math.min(c - 1, y.length)), T < 0 && (T += y.length), T = Math.max(0, Math.min(T, y.length)), s = y.slice(c, T).join(`
1348
- `), E.hasAttribute("data-start") || E.setAttribute("data-start", String(c + 1));
1614
+ Prism2.util.setLanguage(code, language);
1615
+ Prism2.util.setLanguage(pre, language);
1616
+ var autoloader = Prism2.plugins.autoloader;
1617
+ if (autoloader) {
1618
+ autoloader.loadLanguages(language);
1619
+ }
1620
+ loadFile(
1621
+ src,
1622
+ function(text) {
1623
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
1624
+ var range = parseRange(pre.getAttribute("data-range"));
1625
+ if (range) {
1626
+ var lines = text.split(/\r\n?|\n/g);
1627
+ var start = range[0];
1628
+ var end = range[1] == null ? lines.length : range[1];
1629
+ if (start < 0) {
1630
+ start += lines.length;
1631
+ }
1632
+ start = Math.max(0, Math.min(start - 1, lines.length));
1633
+ if (end < 0) {
1634
+ end += lines.length;
1635
+ }
1636
+ end = Math.max(0, Math.min(end, lines.length));
1637
+ text = lines.slice(start, end).join("\n");
1638
+ if (!pre.hasAttribute("data-start")) {
1639
+ pre.setAttribute("data-start", String(start + 1));
1640
+ }
1349
1641
  }
1350
- h.textContent = s, n.highlightElement(h);
1642
+ code.textContent = text;
1643
+ Prism2.highlightElement(code);
1351
1644
  },
1352
- function(s) {
1353
- E.setAttribute(o, k), h.textContent = s;
1645
+ function(error) {
1646
+ pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
1647
+ code.textContent = error;
1354
1648
  }
1355
1649
  );
1356
1650
  }
1357
- }), n.plugins.fileHighlight = {
1651
+ });
1652
+ Prism2.plugins.fileHighlight = {
1358
1653
  /**
1359
1654
  * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1360
1655
  *
@@ -1362,71 +1657,77 @@ var fe = { exports: {} };
1362
1657
  *
1363
1658
  * @param {ParentNode} [container=document]
1364
1659
  */
1365
- highlight: function(E) {
1366
- for (var h = (E || document).querySelectorAll(C), e = 0, t; t = h[e++]; )
1367
- n.highlightElement(t);
1660
+ highlight: function highlight(container) {
1661
+ var elements = (container || document).querySelectorAll(SELECTOR);
1662
+ for (var i = 0, element; element = elements[i++]; ) {
1663
+ Prism2.highlightElement(element);
1664
+ }
1368
1665
  }
1369
1666
  };
1370
- var $ = !1;
1371
- n.fileHighlight = function() {
1372
- $ || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), $ = !0), n.plugins.fileHighlight.highlight.apply(this, arguments);
1667
+ var logged = false;
1668
+ Prism2.fileHighlight = function() {
1669
+ if (!logged) {
1670
+ console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.");
1671
+ logged = true;
1672
+ }
1673
+ Prism2.plugins.fileHighlight.highlight.apply(this, arguments);
1373
1674
  };
1374
- }();
1375
- })(fe);
1376
- var Me = fe.exports;
1377
- const se = /* @__PURE__ */ $e(Me);
1675
+ })();
1676
+ })(prism);
1677
+ var prismExports = prism.exports;
1678
+ const Prism$1 = /* @__PURE__ */ getDefaultExportFromCjs(prismExports);
1378
1679
  Prism.languages.clike = {
1379
- comment: [
1680
+ "comment": [
1380
1681
  {
1381
1682
  pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1382
- lookbehind: !0,
1383
- greedy: !0
1683
+ lookbehind: true,
1684
+ greedy: true
1384
1685
  },
1385
1686
  {
1386
1687
  pattern: /(^|[^\\:])\/\/.*/,
1387
- lookbehind: !0,
1388
- greedy: !0
1688
+ lookbehind: true,
1689
+ greedy: true
1389
1690
  }
1390
1691
  ],
1391
- string: {
1692
+ "string": {
1392
1693
  pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1393
- greedy: !0
1694
+ greedy: true
1394
1695
  },
1395
1696
  "class-name": {
1396
1697
  pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1397
- lookbehind: !0,
1698
+ lookbehind: true,
1398
1699
  inside: {
1399
- punctuation: /[.\\]/
1700
+ "punctuation": /[.\\]/
1400
1701
  }
1401
1702
  },
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: /[{}[\];(),.:]/
1703
+ "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1704
+ "boolean": /\b(?:false|true)\b/,
1705
+ "function": /\b\w+(?=\()/,
1706
+ "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1707
+ "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1708
+ "punctuation": /[{}[\];(),.:]/
1408
1709
  };
1409
1710
  Prism.languages.javascript = Prism.languages.extend("clike", {
1410
1711
  "class-name": [
1411
1712
  Prism.languages.clike["class-name"],
1412
1713
  {
1413
1714
  pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1414
- lookbehind: !0
1715
+ lookbehind: true
1415
1716
  }
1416
1717
  ],
1417
- keyword: [
1718
+ "keyword": [
1418
1719
  {
1419
1720
  pattern: /((?:^|\})\s*)catch\b/,
1420
- lookbehind: !0
1721
+ lookbehind: true
1421
1722
  },
1422
1723
  {
1423
1724
  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
1725
+ lookbehind: true
1425
1726
  }
1426
1727
  ],
1427
1728
  // 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: {
1729
+ "function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1730
+ "number": {
1430
1731
  pattern: RegExp(
1431
1732
  /(^|[^\w$])/.source + "(?:" + // constant
1432
1733
  (/NaN|Infinity/.source + "|" + // binary integer
@@ -1436,13 +1737,13 @@ Prism.languages.javascript = Prism.languages.extend("clike", {
1436
1737
  /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1437
1738
  /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1438
1739
  ),
1439
- lookbehind: !0
1740
+ lookbehind: true
1440
1741
  },
1441
- operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1742
+ "operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1442
1743
  });
1443
1744
  Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1444
1745
  Prism.languages.insertBefore("javascript", "keyword", {
1445
- regex: {
1746
+ "regex": {
1446
1747
  pattern: RegExp(
1447
1748
  // lookbehind
1448
1749
  // eslint-disable-next-line regexp/no-dupe-characters-character-class
@@ -1454,12 +1755,12 @@ Prism.languages.insertBefore("javascript", "keyword", {
1454
1755
  /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1455
1756
  /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1456
1757
  ),
1457
- lookbehind: !0,
1458
- greedy: !0,
1758
+ lookbehind: true,
1759
+ greedy: true,
1459
1760
  inside: {
1460
1761
  "regex-source": {
1461
1762
  pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1462
- lookbehind: !0,
1763
+ lookbehind: true,
1463
1764
  alias: "language-regex",
1464
1765
  inside: Prism.languages.regex
1465
1766
  },
@@ -1472,47 +1773,47 @@ Prism.languages.insertBefore("javascript", "keyword", {
1472
1773
  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
1774
  alias: "function"
1474
1775
  },
1475
- parameter: [
1776
+ "parameter": [
1476
1777
  {
1477
1778
  pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1478
- lookbehind: !0,
1779
+ lookbehind: true,
1479
1780
  inside: Prism.languages.javascript
1480
1781
  },
1481
1782
  {
1482
1783
  pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1483
- lookbehind: !0,
1784
+ lookbehind: true,
1484
1785
  inside: Prism.languages.javascript
1485
1786
  },
1486
1787
  {
1487
1788
  pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1488
- lookbehind: !0,
1789
+ lookbehind: true,
1489
1790
  inside: Prism.languages.javascript
1490
1791
  },
1491
1792
  {
1492
1793
  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,
1794
+ lookbehind: true,
1494
1795
  inside: Prism.languages.javascript
1495
1796
  }
1496
1797
  ],
1497
- constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1798
+ "constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1498
1799
  });
1499
1800
  Prism.languages.insertBefore("javascript", "string", {
1500
- hashbang: {
1801
+ "hashbang": {
1501
1802
  pattern: /^#!.*/,
1502
- greedy: !0,
1803
+ greedy: true,
1503
1804
  alias: "comment"
1504
1805
  },
1505
1806
  "template-string": {
1506
1807
  pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1507
- greedy: !0,
1808
+ greedy: true,
1508
1809
  inside: {
1509
1810
  "template-punctuation": {
1510
1811
  pattern: /^`|`$/,
1511
1812
  alias: "string"
1512
1813
  },
1513
- interpolation: {
1814
+ "interpolation": {
1514
1815
  pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1515
- lookbehind: !0,
1816
+ lookbehind: true,
1516
1817
  inside: {
1517
1818
  "interpolation-punctuation": {
1518
1819
  pattern: /^\$\{|\}$/,
@@ -1521,46 +1822,49 @@ Prism.languages.insertBefore("javascript", "string", {
1521
1822
  rest: Prism.languages.javascript
1522
1823
  }
1523
1824
  },
1524
- string: /[\s\S]+/
1825
+ "string": /[\s\S]+/
1525
1826
  }
1526
1827
  },
1527
1828
  "string-property": {
1528
1829
  pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1529
- lookbehind: !0,
1530
- greedy: !0,
1830
+ lookbehind: true,
1831
+ greedy: true,
1531
1832
  alias: "property"
1532
1833
  }
1533
1834
  });
1534
1835
  Prism.languages.insertBefore("javascript", "operator", {
1535
1836
  "literal-property": {
1536
1837
  pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1537
- lookbehind: !0,
1838
+ lookbehind: true,
1538
1839
  alias: "property"
1539
1840
  }
1540
1841
  });
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
- ));
1842
+ if (Prism.languages.markup) {
1843
+ Prism.languages.markup.tag.addInlined("script", "javascript");
1844
+ Prism.languages.markup.tag.addAttribute(
1845
+ /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,
1846
+ "javascript"
1847
+ );
1848
+ }
1545
1849
  Prism.languages.js = Prism.languages.javascript;
1546
1850
  Prism.languages.python = {
1547
- comment: {
1851
+ "comment": {
1548
1852
  pattern: /(^|[^\\])#.*/,
1549
- lookbehind: !0,
1550
- greedy: !0
1853
+ lookbehind: true,
1854
+ greedy: true
1551
1855
  },
1552
1856
  "string-interpolation": {
1553
1857
  pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1554
- greedy: !0,
1858
+ greedy: true,
1555
1859
  inside: {
1556
- interpolation: {
1860
+ "interpolation": {
1557
1861
  // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
1558
1862
  pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
1559
- lookbehind: !0,
1863
+ lookbehind: true,
1560
1864
  inside: {
1561
1865
  "format-spec": {
1562
1866
  pattern: /(:)[^:(){}]+(?=\}$)/,
1563
- lookbehind: !0
1867
+ lookbehind: true
1564
1868
  },
1565
1869
  "conversion-option": {
1566
1870
  pattern: /![sra](?=[:}]$)/,
@@ -1569,52 +1873,52 @@ Prism.languages.python = {
1569
1873
  rest: null
1570
1874
  }
1571
1875
  },
1572
- string: /[\s\S]+/
1876
+ "string": /[\s\S]+/
1573
1877
  }
1574
1878
  },
1575
1879
  "triple-quoted-string": {
1576
1880
  pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
1577
- greedy: !0,
1881
+ greedy: true,
1578
1882
  alias: "string"
1579
1883
  },
1580
- string: {
1884
+ "string": {
1581
1885
  pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1582
- greedy: !0
1886
+ greedy: true
1583
1887
  },
1584
- function: {
1888
+ "function": {
1585
1889
  pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
1586
- lookbehind: !0
1890
+ lookbehind: true
1587
1891
  },
1588
1892
  "class-name": {
1589
1893
  pattern: /(\bclass\s+)\w+/i,
1590
- lookbehind: !0
1894
+ lookbehind: true
1591
1895
  },
1592
- decorator: {
1896
+ "decorator": {
1593
1897
  pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
1594
- lookbehind: !0,
1898
+ lookbehind: true,
1595
1899
  alias: ["annotation", "punctuation"],
1596
1900
  inside: {
1597
- punctuation: /\./
1901
+ "punctuation": /\./
1598
1902
  }
1599
1903
  },
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: /[{}[\];(),.:]/
1904
+ "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/,
1905
+ "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/,
1906
+ "boolean": /\b(?:False|None|True)\b/,
1907
+ "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,
1908
+ "operator": /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
1909
+ "punctuation": /[{}[\];(),.:]/
1606
1910
  };
1607
- Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python;
1911
+ Prism.languages.python["string-interpolation"].inside["interpolation"].inside.rest = Prism.languages.python;
1608
1912
  Prism.languages.py = Prism.languages.python;
1609
1913
  Prism.languages.go = Prism.languages.extend("clike", {
1610
- string: {
1914
+ "string": {
1611
1915
  pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
1612
- lookbehind: !0,
1613
- greedy: !0
1916
+ lookbehind: true,
1917
+ greedy: true
1614
1918
  },
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: [
1919
+ "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/,
1920
+ "boolean": /\b(?:_|false|iota|nil|true)\b/,
1921
+ "number": [
1618
1922
  // binary and octal integers
1619
1923
  /\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
1620
1924
  // hexadecimal integers and floats
@@ -1622,195 +1926,199 @@ Prism.languages.go = Prism.languages.extend("clike", {
1622
1926
  // decimal integers and floats
1623
1927
  /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
1624
1928
  ],
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/
1929
+ "operator": /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
1930
+ "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
1931
  });
1628
1932
  Prism.languages.insertBefore("go", "string", {
1629
- char: {
1933
+ "char": {
1630
1934
  pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
1631
- greedy: !0
1935
+ greedy: true
1632
1936
  }
1633
1937
  });
1634
1938
  delete Prism.languages.go["class-name"];
1635
- (function(i) {
1636
- var p = /\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/, n = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source, l = {
1637
- pattern: RegExp(/(^|[^\w.])/.source + n + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
1638
- lookbehind: !0,
1939
+ (function(Prism2) {
1940
+ var keywords = /\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/;
1941
+ var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
1942
+ var className = {
1943
+ pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
1944
+ lookbehind: true,
1639
1945
  inside: {
1640
- namespace: {
1946
+ "namespace": {
1641
1947
  pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
1642
1948
  inside: {
1643
- punctuation: /\./
1949
+ "punctuation": /\./
1644
1950
  }
1645
1951
  },
1646
- punctuation: /\./
1952
+ "punctuation": /\./
1647
1953
  }
1648
1954
  };
1649
- i.languages.java = i.languages.extend("clike", {
1650
- string: {
1955
+ Prism2.languages.java = Prism2.languages.extend("clike", {
1956
+ "string": {
1651
1957
  pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
1652
- lookbehind: !0,
1653
- greedy: !0
1958
+ lookbehind: true,
1959
+ greedy: true
1654
1960
  },
1655
1961
  "class-name": [
1656
- l,
1962
+ className,
1657
1963
  {
1658
1964
  // variables, parameters, and constructor references
1659
1965
  // 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 + n + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
1661
- lookbehind: !0,
1662
- inside: l.inside
1966
+ pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
1967
+ lookbehind: true,
1968
+ inside: className.inside
1663
1969
  },
1664
1970
  {
1665
1971
  // class names based on keyword
1666
1972
  // 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 + n + /[A-Z]\w*\b/.source),
1668
- lookbehind: !0,
1669
- inside: l.inside
1973
+ pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
1974
+ lookbehind: true,
1975
+ inside: className.inside
1670
1976
  }
1671
1977
  ],
1672
- keyword: p,
1673
- function: [
1674
- i.languages.clike.function,
1978
+ "keyword": keywords,
1979
+ "function": [
1980
+ Prism2.languages.clike.function,
1675
1981
  {
1676
1982
  pattern: /(::\s*)[a-z_]\w*/,
1677
- lookbehind: !0
1983
+ lookbehind: true
1678
1984
  }
1679
1985
  ],
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: {
1986
+ "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,
1987
+ "operator": {
1682
1988
  pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
1683
- lookbehind: !0
1989
+ lookbehind: true
1684
1990
  },
1685
- constant: /\b[A-Z][A-Z_\d]+\b/
1686
- }), i.languages.insertBefore("java", "string", {
1991
+ "constant": /\b[A-Z][A-Z_\d]+\b/
1992
+ });
1993
+ Prism2.languages.insertBefore("java", "string", {
1687
1994
  "triple-quoted-string": {
1688
1995
  // http://openjdk.java.net/jeps/355#Description
1689
1996
  pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
1690
- greedy: !0,
1997
+ greedy: true,
1691
1998
  alias: "string"
1692
1999
  },
1693
- char: {
2000
+ "char": {
1694
2001
  pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
1695
- greedy: !0
2002
+ greedy: true
1696
2003
  }
1697
- }), i.languages.insertBefore("java", "class-name", {
1698
- annotation: {
2004
+ });
2005
+ Prism2.languages.insertBefore("java", "class-name", {
2006
+ "annotation": {
1699
2007
  pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
1700
- lookbehind: !0,
2008
+ lookbehind: true,
1701
2009
  alias: "punctuation"
1702
2010
  },
1703
- generics: {
2011
+ "generics": {
1704
2012
  pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
1705
2013
  inside: {
1706
- "class-name": l,
1707
- keyword: p,
1708
- punctuation: /[<>(),.:]/,
1709
- operator: /[?&|]/
2014
+ "class-name": className,
2015
+ "keyword": keywords,
2016
+ "punctuation": /[<>(),.:]/,
2017
+ "operator": /[?&|]/
1710
2018
  }
1711
2019
  },
1712
- import: [
2020
+ "import": [
1713
2021
  {
1714
- pattern: RegExp(/(\bimport\s+)/.source + n + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
1715
- lookbehind: !0,
2022
+ pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
2023
+ lookbehind: true,
1716
2024
  inside: {
1717
- namespace: l.inside.namespace,
1718
- punctuation: /\./,
1719
- operator: /\*/,
2025
+ "namespace": className.inside.namespace,
2026
+ "punctuation": /\./,
2027
+ "operator": /\*/,
1720
2028
  "class-name": /\w+/
1721
2029
  }
1722
2030
  },
1723
2031
  {
1724
- pattern: RegExp(/(\bimport\s+static\s+)/.source + n + /(?:\w+|\*)(?=\s*;)/.source),
1725
- lookbehind: !0,
2032
+ pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
2033
+ lookbehind: true,
1726
2034
  alias: "static",
1727
2035
  inside: {
1728
- namespace: l.inside.namespace,
1729
- static: /\b\w+$/,
1730
- punctuation: /\./,
1731
- operator: /\*/,
2036
+ "namespace": className.inside.namespace,
2037
+ "static": /\b\w+$/,
2038
+ "punctuation": /\./,
2039
+ "operator": /\*/,
1732
2040
  "class-name": /\w+/
1733
2041
  }
1734
2042
  }
1735
2043
  ],
1736
- namespace: {
2044
+ "namespace": {
1737
2045
  pattern: RegExp(
1738
2046
  /(\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 p.source;
2047
+ return keywords.source;
1740
2048
  })
1741
2049
  ),
1742
- lookbehind: !0,
2050
+ lookbehind: true,
1743
2051
  inside: {
1744
- punctuation: /\./
2052
+ "punctuation": /\./
1745
2053
  }
1746
2054
  }
1747
2055
  });
1748
2056
  })(Prism);
1749
2057
  Prism.languages.c = Prism.languages.extend("clike", {
1750
- comment: {
2058
+ "comment": {
1751
2059
  pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
1752
- greedy: !0
2060
+ greedy: true
1753
2061
  },
1754
- string: {
2062
+ "string": {
1755
2063
  // https://en.cppreference.com/w/c/language/string_literal
1756
2064
  pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
1757
- greedy: !0
2065
+ greedy: true
1758
2066
  },
1759
2067
  "class-name": {
1760
2068
  pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
1761
- lookbehind: !0
2069
+ lookbehind: true
1762
2070
  },
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|[?:~]|[-+*/%&|^!=<>]=?/
2071
+ "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/,
2072
+ "function": /\b[a-z_]\w*(?=\s*\()/i,
2073
+ "number": /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
2074
+ "operator": />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
1767
2075
  });
1768
2076
  Prism.languages.insertBefore("c", "string", {
1769
- char: {
2077
+ "char": {
1770
2078
  // https://en.cppreference.com/w/c/language/character_constant
1771
2079
  pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
1772
- greedy: !0
2080
+ greedy: true
1773
2081
  }
1774
2082
  });
1775
2083
  Prism.languages.insertBefore("c", "string", {
1776
- macro: {
2084
+ "macro": {
1777
2085
  // allow for multiline macro definitions
1778
2086
  // spaces after the # character compile fine with gcc
1779
2087
  pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
1780
- lookbehind: !0,
1781
- greedy: !0,
2088
+ lookbehind: true,
2089
+ greedy: true,
1782
2090
  alias: "property",
1783
2091
  inside: {
1784
- string: [
2092
+ "string": [
1785
2093
  {
1786
2094
  // highlight the path of the include statement as a string
1787
2095
  pattern: /^(#\s*include\s*)<[^>]+>/,
1788
- lookbehind: !0
2096
+ lookbehind: true
1789
2097
  },
1790
- Prism.languages.c.string
2098
+ Prism.languages.c["string"]
1791
2099
  ],
1792
- char: Prism.languages.c.char,
1793
- comment: Prism.languages.c.comment,
2100
+ "char": Prism.languages.c["char"],
2101
+ "comment": Prism.languages.c["comment"],
1794
2102
  "macro-name": [
1795
2103
  {
1796
2104
  pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
1797
- lookbehind: !0
2105
+ lookbehind: true
1798
2106
  },
1799
2107
  {
1800
2108
  pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
1801
- lookbehind: !0,
2109
+ lookbehind: true,
1802
2110
  alias: "function"
1803
2111
  }
1804
2112
  ],
1805
2113
  // highlight macro directives as keywords
1806
- directive: {
2114
+ "directive": {
1807
2115
  pattern: /^(#\s*)[a-z]+/,
1808
- lookbehind: !0,
2116
+ lookbehind: true,
1809
2117
  alias: "keyword"
1810
2118
  },
1811
2119
  "directive-hash": /^#/,
1812
- punctuation: /##|\\(?=[\r\n])/,
1813
- expression: {
2120
+ "punctuation": /##|\\(?=[\r\n])/,
2121
+ "expression": {
1814
2122
  pattern: /\S[\s\S]*/,
1815
2123
  inside: Prism.languages.c
1816
2124
  }
@@ -1819,51 +2127,54 @@ Prism.languages.insertBefore("c", "string", {
1819
2127
  });
1820
2128
  Prism.languages.insertBefore("c", "function", {
1821
2129
  // 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/
2130
+ "constant": /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
1823
2131
  });
1824
- delete Prism.languages.c.boolean;
1825
- (function(i) {
1826
- for (var p = /\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source, n = 0; n < 2; n++)
1827
- p = p.replace(/<self>/g, function() {
1828
- return p;
2132
+ delete Prism.languages.c["boolean"];
2133
+ (function(Prism2) {
2134
+ var multilineComment = /\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source;
2135
+ for (var i = 0; i < 2; i++) {
2136
+ multilineComment = multilineComment.replace(/<self>/g, function() {
2137
+ return multilineComment;
1829
2138
  });
1830
- p = p.replace(/<self>/g, function() {
2139
+ }
2140
+ multilineComment = multilineComment.replace(/<self>/g, function() {
1831
2141
  return /[^\s\S]/.source;
1832
- }), i.languages.rust = {
1833
- comment: [
2142
+ });
2143
+ Prism2.languages.rust = {
2144
+ "comment": [
1834
2145
  {
1835
- pattern: RegExp(/(^|[^\\])/.source + p),
1836
- lookbehind: !0,
1837
- greedy: !0
2146
+ pattern: RegExp(/(^|[^\\])/.source + multilineComment),
2147
+ lookbehind: true,
2148
+ greedy: true
1838
2149
  },
1839
2150
  {
1840
2151
  pattern: /(^|[^\\:])\/\/.*/,
1841
- lookbehind: !0,
1842
- greedy: !0
2152
+ lookbehind: true,
2153
+ greedy: true
1843
2154
  }
1844
2155
  ],
1845
- string: {
2156
+ "string": {
1846
2157
  pattern: /b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,
1847
- greedy: !0
2158
+ greedy: true
1848
2159
  },
1849
- char: {
2160
+ "char": {
1850
2161
  pattern: /b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,
1851
- greedy: !0
2162
+ greedy: true
1852
2163
  },
1853
- attribute: {
2164
+ "attribute": {
1854
2165
  pattern: /#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,
1855
- greedy: !0,
2166
+ greedy: true,
1856
2167
  alias: "attr-name",
1857
2168
  inside: {
1858
- string: null
2169
+ "string": null
1859
2170
  // see below
1860
2171
  }
1861
2172
  },
1862
2173
  // Closure params should not be confused with bitwise OR |
1863
2174
  "closure-params": {
1864
2175
  pattern: /([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,
1865
- lookbehind: !0,
1866
- greedy: !0,
2176
+ lookbehind: true,
2177
+ greedy: true,
1867
2178
  inside: {
1868
2179
  "closure-punctuation": {
1869
2180
  pattern: /^\||\|$/,
@@ -1879,36 +2190,36 @@ delete Prism.languages.c.boolean;
1879
2190
  },
1880
2191
  "fragment-specifier": {
1881
2192
  pattern: /(\$\w+:)[a-z]+/,
1882
- lookbehind: !0,
2193
+ lookbehind: true,
1883
2194
  alias: "punctuation"
1884
2195
  },
1885
- variable: /\$\w+/,
2196
+ "variable": /\$\w+/,
1886
2197
  "function-definition": {
1887
2198
  pattern: /(\bfn\s+)\w+/,
1888
- lookbehind: !0,
2199
+ lookbehind: true,
1889
2200
  alias: "function"
1890
2201
  },
1891
2202
  "type-definition": {
1892
2203
  pattern: /(\b(?:enum|struct|trait|type|union)\s+)\w+/,
1893
- lookbehind: !0,
2204
+ lookbehind: true,
1894
2205
  alias: "class-name"
1895
2206
  },
1896
2207
  "module-declaration": [
1897
2208
  {
1898
2209
  pattern: /(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,
1899
- lookbehind: !0,
2210
+ lookbehind: true,
1900
2211
  alias: "namespace"
1901
2212
  },
1902
2213
  {
1903
2214
  pattern: /(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,
1904
- lookbehind: !0,
2215
+ lookbehind: true,
1905
2216
  alias: "namespace",
1906
2217
  inside: {
1907
- punctuation: /::/
2218
+ "punctuation": /::/
1908
2219
  }
1909
2220
  }
1910
2221
  ],
1911
- keyword: [
2222
+ "keyword": [
1912
2223
  // https://github.com/rust-lang/reference/blob/master/src/keywords.md
1913
2224
  /\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
2225
  // primitives and str
@@ -1918,112 +2229,116 @@ delete Prism.languages.c.boolean;
1918
2229
  // functions can technically start with an upper-case letter, but this will introduce a lot of false positives
1919
2230
  // and Rust's naming conventions recommend snake_case anyway.
1920
2231
  // https://doc.rust-lang.org/1.0.0/style/style/naming/README.html
1921
- function: /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,
1922
- macro: {
2232
+ "function": /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,
2233
+ "macro": {
1923
2234
  pattern: /\b\w+!/,
1924
2235
  alias: "property"
1925
2236
  },
1926
- constant: /\b[A-Z_][A-Z_\d]+\b/,
2237
+ "constant": /\b[A-Z_][A-Z_\d]+\b/,
1927
2238
  "class-name": /\b[A-Z]\w*\b/,
1928
- namespace: {
2239
+ "namespace": {
1929
2240
  pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,
1930
2241
  inside: {
1931
- punctuation: /::/
2242
+ "punctuation": /::/
1932
2243
  }
1933
2244
  },
1934
2245
  // 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
- }, i.languages.rust["closure-params"].inside.rest = i.languages.rust, i.languages.rust.attribute.inside.string = i.languages.rust.string;
2246
+ "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/,
2247
+ "boolean": /\b(?:false|true)\b/,
2248
+ "punctuation": /->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,
2249
+ "operator": /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/
2250
+ };
2251
+ Prism2.languages.rust["closure-params"].inside.rest = Prism2.languages.rust;
2252
+ Prism2.languages.rust["attribute"].inside["string"] = Prism2.languages.rust["string"];
1940
2253
  })(Prism);
1941
2254
  Prism.languages.sql = {
1942
- comment: {
2255
+ "comment": {
1943
2256
  pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
1944
- lookbehind: !0
2257
+ lookbehind: true
1945
2258
  },
1946
- variable: [
2259
+ "variable": [
1947
2260
  {
1948
2261
  pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
1949
- greedy: !0
2262
+ greedy: true
1950
2263
  },
1951
2264
  /@[\w.$]+/
1952
2265
  ],
1953
- string: {
2266
+ "string": {
1954
2267
  pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
1955
- greedy: !0,
1956
- lookbehind: !0
2268
+ greedy: true,
2269
+ lookbehind: true
1957
2270
  },
1958
- identifier: {
2271
+ "identifier": {
1959
2272
  pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,
1960
- greedy: !0,
1961
- lookbehind: !0,
2273
+ greedy: true,
2274
+ lookbehind: true,
1962
2275
  inside: {
1963
- punctuation: /^`|`$/
2276
+ "punctuation": /^`|`$/
1964
2277
  }
1965
2278
  },
1966
- function: /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
2279
+ "function": /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
1967
2280
  // 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: /[;[\]()`,.]/
2281
+ "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,
2282
+ "boolean": /\b(?:FALSE|NULL|TRUE)\b/i,
2283
+ "number": /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
2284
+ "operator": /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
2285
+ "punctuation": /[;[\]()`,.]/
1973
2286
  };
1974
- (function(i) {
1975
- var p = "\\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", n = {
2287
+ (function(Prism2) {
2288
+ var envVars = "\\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";
2289
+ var commandAfterHeredoc = {
1976
2290
  pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
1977
- lookbehind: !0,
2291
+ lookbehind: true,
1978
2292
  alias: "punctuation",
1979
2293
  // this looks reasonably well in all themes
1980
2294
  inside: null
1981
2295
  // see below
1982
- }, l = {
1983
- bash: n,
1984
- environment: {
1985
- pattern: RegExp("\\$" + p),
2296
+ };
2297
+ var insideString = {
2298
+ "bash": commandAfterHeredoc,
2299
+ "environment": {
2300
+ pattern: RegExp("\\$" + envVars),
1986
2301
  alias: "constant"
1987
2302
  },
1988
- variable: [
2303
+ "variable": [
1989
2304
  // [0]: Arithmetic Environment
1990
2305
  {
1991
2306
  pattern: /\$?\(\([\s\S]+?\)\)/,
1992
- greedy: !0,
2307
+ greedy: true,
1993
2308
  inside: {
1994
2309
  // If there is a $ sign at the beginning highlight $(( and )) as variable
1995
- variable: [
2310
+ "variable": [
1996
2311
  {
1997
2312
  pattern: /(^\$\(\([\s\S]+)\)\)/,
1998
- lookbehind: !0
2313
+ lookbehind: true
1999
2314
  },
2000
2315
  /^\$\(\(/
2001
2316
  ],
2002
- number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
2317
+ "number": /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
2003
2318
  // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
2004
- operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
2319
+ "operator": /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
2005
2320
  // If there is no $ sign at the beginning highlight (( and )) as punctuation
2006
- punctuation: /\(\(?|\)\)?|,|;/
2321
+ "punctuation": /\(\(?|\)\)?|,|;/
2007
2322
  }
2008
2323
  },
2009
2324
  // [1]: Command Substitution
2010
2325
  {
2011
2326
  pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
2012
- greedy: !0,
2327
+ greedy: true,
2013
2328
  inside: {
2014
- variable: /^\$\(|^`|\)$|`$/
2329
+ "variable": /^\$\(|^`|\)$|`$/
2015
2330
  }
2016
2331
  },
2017
2332
  // [2]: Brace expansion
2018
2333
  {
2019
2334
  pattern: /\$\{[^}]+\}/,
2020
- greedy: !0,
2335
+ greedy: true,
2021
2336
  inside: {
2022
- operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
2023
- punctuation: /[\[\]]/,
2024
- environment: {
2025
- pattern: RegExp("(\\{)" + p),
2026
- lookbehind: !0,
2337
+ "operator": /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
2338
+ "punctuation": /[\[\]]/,
2339
+ "environment": {
2340
+ pattern: RegExp("(\\{)" + envVars),
2341
+ lookbehind: true,
2027
2342
  alias: "constant"
2028
2343
  }
2029
2344
  }
@@ -2031,16 +2346,16 @@ Prism.languages.sql = {
2031
2346
  /\$(?:\w+|[#?*!@$])/
2032
2347
  ],
2033
2348
  // 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})/
2349
+ "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
2350
  };
2036
- i.languages.bash = {
2037
- shebang: {
2351
+ Prism2.languages.bash = {
2352
+ "shebang": {
2038
2353
  pattern: /^#!\s*\/.*/,
2039
2354
  alias: "important"
2040
2355
  },
2041
- comment: {
2356
+ "comment": {
2042
2357
  pattern: /(^|[^"{\\$])#.*/,
2043
- lookbehind: !0
2358
+ lookbehind: true
2044
2359
  },
2045
2360
  "function-name": [
2046
2361
  // a) function foo {
@@ -2050,7 +2365,7 @@ Prism.languages.sql = {
2050
2365
  {
2051
2366
  // a) and c)
2052
2367
  pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
2053
- lookbehind: !0,
2368
+ lookbehind: true,
2054
2369
  alias: "function"
2055
2370
  },
2056
2371
  {
@@ -2063,98 +2378,98 @@ Prism.languages.sql = {
2063
2378
  "for-or-select": {
2064
2379
  pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
2065
2380
  alias: "variable",
2066
- lookbehind: !0
2381
+ lookbehind: true
2067
2382
  },
2068
2383
  // Highlight variable names as variables in the left-hand part
2069
2384
  // of assignments (“=” and “+=”).
2070
2385
  "assign-left": {
2071
2386
  pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
2072
2387
  inside: {
2073
- environment: {
2074
- pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + p),
2075
- lookbehind: !0,
2388
+ "environment": {
2389
+ pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars),
2390
+ lookbehind: true,
2076
2391
  alias: "constant"
2077
2392
  }
2078
2393
  },
2079
2394
  alias: "variable",
2080
- lookbehind: !0
2395
+ lookbehind: true
2081
2396
  },
2082
2397
  // Highlight parameter names as variables
2083
- parameter: {
2398
+ "parameter": {
2084
2399
  pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
2085
2400
  alias: "variable",
2086
- lookbehind: !0
2401
+ lookbehind: true
2087
2402
  },
2088
- string: [
2403
+ "string": [
2089
2404
  // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
2090
2405
  {
2091
2406
  pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
2092
- lookbehind: !0,
2093
- greedy: !0,
2094
- inside: l
2407
+ lookbehind: true,
2408
+ greedy: true,
2409
+ inside: insideString
2095
2410
  },
2096
2411
  // Here-document with quotes around the tag
2097
2412
  // → No expansion (so no “inside”).
2098
2413
  {
2099
2414
  pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
2100
- lookbehind: !0,
2101
- greedy: !0,
2415
+ lookbehind: true,
2416
+ greedy: true,
2102
2417
  inside: {
2103
- bash: n
2418
+ "bash": commandAfterHeredoc
2104
2419
  }
2105
2420
  },
2106
2421
  // “Normal” string
2107
2422
  {
2108
2423
  // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
2109
2424
  pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
2110
- lookbehind: !0,
2111
- greedy: !0,
2112
- inside: l
2425
+ lookbehind: true,
2426
+ greedy: true,
2427
+ inside: insideString
2113
2428
  },
2114
2429
  {
2115
2430
  // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
2116
2431
  pattern: /(^|[^$\\])'[^']*'/,
2117
- lookbehind: !0,
2118
- greedy: !0
2432
+ lookbehind: true,
2433
+ greedy: true
2119
2434
  },
2120
2435
  {
2121
2436
  // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
2122
2437
  pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
2123
- greedy: !0,
2438
+ greedy: true,
2124
2439
  inside: {
2125
- entity: l.entity
2440
+ "entity": insideString.entity
2126
2441
  }
2127
2442
  }
2128
2443
  ],
2129
- environment: {
2130
- pattern: RegExp("\\$?" + p),
2444
+ "environment": {
2445
+ pattern: RegExp("\\$?" + envVars),
2131
2446
  alias: "constant"
2132
2447
  },
2133
- variable: l.variable,
2134
- function: {
2448
+ "variable": insideString.variable,
2449
+ "function": {
2135
2450
  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
2451
+ lookbehind: true
2137
2452
  },
2138
- keyword: {
2453
+ "keyword": {
2139
2454
  pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
2140
- lookbehind: !0
2455
+ lookbehind: true
2141
2456
  },
2142
2457
  // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
2143
- builtin: {
2458
+ "builtin": {
2144
2459
  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,
2460
+ lookbehind: true,
2146
2461
  // Alias added to make those easier to distinguish from strings.
2147
2462
  alias: "class-name"
2148
2463
  },
2149
- boolean: {
2464
+ "boolean": {
2150
2465
  pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
2151
- lookbehind: !0
2466
+ lookbehind: true
2152
2467
  },
2153
2468
  "file-descriptor": {
2154
2469
  pattern: /\B&\d\b/,
2155
2470
  alias: "important"
2156
2471
  },
2157
- operator: {
2472
+ "operator": {
2158
2473
  // Lots of redirections here, but not just that.
2159
2474
  pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
2160
2475
  inside: {
@@ -2164,13 +2479,14 @@ Prism.languages.sql = {
2164
2479
  }
2165
2480
  }
2166
2481
  },
2167
- punctuation: /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
2168
- number: {
2482
+ "punctuation": /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
2483
+ "number": {
2169
2484
  pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
2170
- lookbehind: !0
2485
+ lookbehind: true
2171
2486
  }
2172
- }, n.inside = i.languages.bash;
2173
- for (var v = [
2487
+ };
2488
+ commandAfterHeredoc.inside = Prism2.languages.bash;
2489
+ var toBeCopied = [
2174
2490
  "comment",
2175
2491
  "function-name",
2176
2492
  "for-or-select",
@@ -2186,36 +2502,40 @@ Prism.languages.sql = {
2186
2502
  "operator",
2187
2503
  "punctuation",
2188
2504
  "number"
2189
- ], _ = l.variable[1].inside, S = 0; S < v.length; S++)
2190
- _[v[S]] = i.languages.bash[v[S]];
2191
- i.languages.sh = i.languages.bash, i.languages.shell = i.languages.bash;
2505
+ ];
2506
+ var inside = insideString.variable[1].inside;
2507
+ for (var i = 0; i < toBeCopied.length; i++) {
2508
+ inside[toBeCopied[i]] = Prism2.languages.bash[toBeCopied[i]];
2509
+ }
2510
+ Prism2.languages.sh = Prism2.languages.bash;
2511
+ Prism2.languages.shell = Prism2.languages.bash;
2192
2512
  })(Prism);
2193
2513
  Prism.languages.json = {
2194
- property: {
2514
+ "property": {
2195
2515
  pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
2196
- lookbehind: !0,
2197
- greedy: !0
2516
+ lookbehind: true,
2517
+ greedy: true
2198
2518
  },
2199
- string: {
2519
+ "string": {
2200
2520
  pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
2201
- lookbehind: !0,
2202
- greedy: !0
2521
+ lookbehind: true,
2522
+ greedy: true
2203
2523
  },
2204
- comment: {
2524
+ "comment": {
2205
2525
  pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
2206
- greedy: !0
2526
+ greedy: true
2207
2527
  },
2208
- number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
2209
- punctuation: /[{}[\],]/,
2210
- operator: /:/,
2211
- boolean: /\b(?:false|true)\b/,
2212
- null: {
2528
+ "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
2529
+ "punctuation": /[{}[\],]/,
2530
+ "operator": /:/,
2531
+ "boolean": /\b(?:false|true)\b/,
2532
+ "null": {
2213
2533
  pattern: /\bnull\b/,
2214
2534
  alias: "keyword"
2215
2535
  }
2216
2536
  };
2217
2537
  Prism.languages.webmanifest = Prism.languages.json;
2218
- const Ue = `
2538
+ const prismDarkTheme = `
2219
2539
  /* 默认代码颜色 */
2220
2540
  .hep-cr-editor .hep-cr-highlight code,
2221
2541
  .hep-cr-editor .hep-cr-highlight pre {
@@ -2301,7 +2621,8 @@ const Ue = `
2301
2621
  .hep-cr-editor .token.console {
2302
2622
  color: #f8f8f2 !important;
2303
2623
  }
2304
- `, Be = `
2624
+ `;
2625
+ const prismLightTheme = `
2305
2626
  /* 默认代码颜色 */
2306
2627
  .hep-cr-editor .hep-cr-highlight code,
2307
2628
  .hep-cr-editor .hep-cr-highlight pre {
@@ -2378,34 +2699,53 @@ const Ue = `
2378
2699
  .hep-cr-editor .token.console {
2379
2700
  color: #333 !important;
2380
2701
  }
2381
- `, He = ["innerHTML"], Ge = ["value", "disabled"], ze = 500, je = /* @__PURE__ */ le({
2702
+ `;
2703
+ const _hoisted_1$2 = ["innerHTML"];
2704
+ const _hoisted_2$2 = ["value", "disabled"];
2705
+ const CHANGE_DEBOUNCE_MS = 500;
2706
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2382
2707
  __name: "CodeEditor",
2383
2708
  props: {
2384
2709
  modelValue: {},
2385
2710
  language: {},
2386
2711
  theme: { default: "dark" },
2387
- disabled: { type: Boolean, default: !1 }
2712
+ disabled: { type: Boolean, default: false }
2388
2713
  },
2389
2714
  emits: ["update:modelValue", "change"],
2390
- setup(i, { emit: p }) {
2391
- ve((h) => ({
2392
- v2b19bab6: C.value
2393
- })), typeof window < "u" && (window.Prism = se);
2394
- function n(h) {
2395
- if (typeof document > "u") return;
2396
- const e = "hep-cr-prism-styles", t = document.getElementById(e), r = h === "dark" ? Ue : Be;
2397
- t && t.remove();
2398
- const a = document.createElement("style");
2399
- a.id = e, a.textContent = r, document.head.appendChild(a);
2715
+ setup(__props, { emit: __emit }) {
2716
+ useCssVars((_ctx) => ({
2717
+ "v2b19bab6": editorBackground.value
2718
+ }));
2719
+ if (typeof window !== "undefined") {
2720
+ window.Prism = Prism$1;
2721
+ }
2722
+ function loadPrismTheme(theme) {
2723
+ if (typeof document === "undefined") return;
2724
+ const styleId = "hep-cr-prism-styles";
2725
+ const oldStyleEl = document.getElementById(styleId);
2726
+ const themeContent = theme === "dark" ? prismDarkTheme : prismLightTheme;
2727
+ if (oldStyleEl) {
2728
+ oldStyleEl.remove();
2729
+ }
2730
+ const styleEl = document.createElement("style");
2731
+ styleEl.id = styleId;
2732
+ styleEl.textContent = themeContent;
2733
+ document.head.appendChild(styleEl);
2400
2734
  }
2401
- const l = i, v = p, _ = N(null), S = N(null);
2402
- let o = null;
2403
- function f(h) {
2404
- o && clearTimeout(o), o = setTimeout(() => {
2405
- v("change", h);
2406
- }, ze);
2735
+ const props = __props;
2736
+ const emit = __emit;
2737
+ const codeRef = ref(null);
2738
+ const highlightRef = ref(null);
2739
+ let changeTimer = null;
2740
+ function emitChange(value) {
2741
+ if (changeTimer) {
2742
+ clearTimeout(changeTimer);
2743
+ }
2744
+ changeTimer = setTimeout(() => {
2745
+ emit("change", value);
2746
+ }, CHANGE_DEBOUNCE_MS);
2407
2747
  }
2408
- const b = {
2748
+ const languageMap = {
2409
2749
  javascript: "javascript",
2410
2750
  js: "javascript",
2411
2751
  typescript: "typescript",
@@ -2436,79 +2776,119 @@ const Ue = `
2436
2776
  yml: "yaml",
2437
2777
  markdown: "markdown",
2438
2778
  md: "markdown"
2439
- }, k = H(() => b[l.language.toLowerCase()] || "javascript"), C = H(() => l.theme === "dark" ? "#1e1e1e" : "#fafafa"), O = H(() => {
2779
+ };
2780
+ const prismLanguage = computed(() => {
2781
+ return languageMap[props.language.toLowerCase()] || "javascript";
2782
+ });
2783
+ const editorBackground = computed(() => {
2784
+ return props.theme === "dark" ? "#1e1e1e" : "#fafafa";
2785
+ });
2786
+ const highlightedCode = computed(() => {
2440
2787
  try {
2441
- const h = se.languages[k.value];
2442
- if (h)
2443
- return se.highlight(l.modelValue || "", h, k.value);
2444
- } catch {
2788
+ const grammar = Prism$1.languages[prismLanguage.value];
2789
+ if (grammar) {
2790
+ return Prism$1.highlight(props.modelValue || "", grammar, prismLanguage.value);
2791
+ }
2792
+ } catch (e) {
2445
2793
  }
2446
- return L(l.modelValue || "");
2794
+ return escapeHtml(props.modelValue || "");
2447
2795
  });
2448
- function L(h) {
2449
- const e = document.createElement("div");
2450
- return e.textContent = h, e.innerHTML;
2796
+ function escapeHtml(text) {
2797
+ const div = document.createElement("div");
2798
+ div.textContent = text;
2799
+ return div.innerHTML;
2451
2800
  }
2452
- function $(h) {
2453
- const e = h.target;
2454
- v("update:modelValue", e.value), f(e.value);
2801
+ function handleInput(e) {
2802
+ const target = e.target;
2803
+ emit("update:modelValue", target.value);
2804
+ emitChange(target.value);
2455
2805
  }
2456
- function w() {
2457
- _.value && S.value && (S.value.scrollTop = _.value.scrollTop, S.value.scrollLeft = _.value.scrollLeft);
2806
+ function handleScroll() {
2807
+ if (codeRef.value && highlightRef.value) {
2808
+ highlightRef.value.scrollTop = codeRef.value.scrollTop;
2809
+ highlightRef.value.scrollLeft = codeRef.value.scrollLeft;
2810
+ }
2458
2811
  }
2459
- function E(h) {
2460
- if (h.key === "Tab") {
2461
- h.preventDefault();
2462
- const e = h.target, t = e.selectionStart, r = e.selectionEnd, a = e.value;
2463
- e.value = a.substring(0, t) + " " + a.substring(r), e.selectionStart = e.selectionEnd = t + 2, v("update:modelValue", e.value), f(e.value);
2812
+ function handleKeydown(e) {
2813
+ if (e.key === "Tab") {
2814
+ e.preventDefault();
2815
+ const target = e.target;
2816
+ const start = target.selectionStart;
2817
+ const end = target.selectionEnd;
2818
+ const value = target.value;
2819
+ target.value = value.substring(0, start) + " " + value.substring(end);
2820
+ target.selectionStart = target.selectionEnd = start + 2;
2821
+ emit("update:modelValue", target.value);
2822
+ emitChange(target.value);
2464
2823
  }
2465
2824
  }
2466
- return he(() => {
2467
- n(l.theme);
2468
- }), ue(() => l.theme, (h) => {
2469
- n(h);
2470
- }), Ee(() => {
2471
- o && clearTimeout(o);
2472
- }), (h, e) => (x(), I("div", {
2473
- class: j(["hep-cr-editor", `hep-cr-theme-${i.theme}`])
2474
- }, [
2475
- A("pre", {
2476
- ref_key: "highlightRef",
2477
- ref: S,
2478
- class: j(["hep-cr-highlight", [`language-${k.value}`, `hep-cr-prism-${i.theme}`]]),
2479
- "aria-hidden": "true"
2825
+ onMounted(() => {
2826
+ loadPrismTheme(props.theme);
2827
+ });
2828
+ watch(() => props.theme, (newTheme) => {
2829
+ loadPrismTheme(newTheme);
2830
+ });
2831
+ onUnmounted(() => {
2832
+ if (changeTimer) {
2833
+ clearTimeout(changeTimer);
2834
+ }
2835
+ });
2836
+ return (_ctx, _cache) => {
2837
+ return openBlock(), createElementBlock("div", {
2838
+ class: normalizeClass(["hep-cr-editor", `hep-cr-theme-${__props.theme}`])
2480
2839
  }, [
2481
- A("code", { innerHTML: O.value }, null, 8, He)
2482
- ], 2),
2483
- A("textarea", {
2484
- ref_key: "codeRef",
2485
- ref: _,
2486
- class: "hep-cr-input",
2487
- value: i.modelValue,
2488
- disabled: i.disabled,
2489
- onInput: $,
2490
- onScroll: w,
2491
- onKeydown: E,
2492
- spellcheck: "false",
2493
- placeholder: "Write your code here..."
2494
- }, null, 40, Ge)
2495
- ], 2));
2840
+ createElementVNode("pre", {
2841
+ ref_key: "highlightRef",
2842
+ ref: highlightRef,
2843
+ class: normalizeClass(["hep-cr-highlight", [`language-${prismLanguage.value}`, `hep-cr-prism-${__props.theme}`]]),
2844
+ "aria-hidden": "true"
2845
+ }, [
2846
+ createElementVNode("code", { innerHTML: highlightedCode.value }, null, 8, _hoisted_1$2)
2847
+ ], 2),
2848
+ createElementVNode("textarea", {
2849
+ ref_key: "codeRef",
2850
+ ref: codeRef,
2851
+ class: "hep-cr-input",
2852
+ value: __props.modelValue,
2853
+ disabled: __props.disabled,
2854
+ onInput: handleInput,
2855
+ onScroll: handleScroll,
2856
+ onKeydown: handleKeydown,
2857
+ spellcheck: "false",
2858
+ placeholder: "Write your code here..."
2859
+ }, null, 40, _hoisted_2$2)
2860
+ ], 2);
2861
+ };
2496
2862
  }
2497
- }), me = (i, p) => {
2498
- const n = i.__vccOpts || i;
2499
- for (const [l, v] of p)
2500
- n[l] = v;
2501
- return n;
2502
- }, We = /* @__PURE__ */ me(je, [["__scopeId", "data-v-a988ca2a"]]), Ve = { class: "hep-cr-header" }, Ye = { class: "hep-cr-controls" }, Xe = ["disabled"], Ze = {
2863
+ });
2864
+ const _export_sfc = (sfc, props) => {
2865
+ const target = sfc.__vccOpts || sfc;
2866
+ for (const [key, val] of props) {
2867
+ target[key] = val;
2868
+ }
2869
+ return target;
2870
+ };
2871
+ const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-a988ca2a"]]);
2872
+ const _hoisted_1$1 = { class: "hep-cr-header" };
2873
+ const _hoisted_2$1 = { class: "hep-cr-controls" };
2874
+ const _hoisted_3$1 = ["disabled"];
2875
+ const _hoisted_4$1 = {
2503
2876
  key: 0,
2504
2877
  value: ""
2505
- }, Ke = ["value"], qe = { class: "hep-cr-actions" }, Je = ["disabled"], Qe = {
2878
+ };
2879
+ const _hoisted_5 = ["value"];
2880
+ const _hoisted_6 = { class: "hep-cr-actions" };
2881
+ const _hoisted_7 = ["disabled"];
2882
+ const _hoisted_8 = {
2506
2883
  key: 0,
2507
2884
  class: "hep-cr-spinner"
2508
- }, et = {
2885
+ };
2886
+ const _hoisted_9 = {
2509
2887
  key: 1,
2510
2888
  class: "hep-cr-run-icon"
2511
- }, tt = ["title"], nt = {
2889
+ };
2890
+ const _hoisted_10 = ["title"];
2891
+ const _hoisted_11 = {
2512
2892
  key: 0,
2513
2893
  width: "16",
2514
2894
  height: "16",
@@ -2516,7 +2896,8 @@ const Ue = `
2516
2896
  fill: "none",
2517
2897
  stroke: "currentColor",
2518
2898
  "stroke-width": "2"
2519
- }, at = {
2899
+ };
2900
+ const _hoisted_12 = {
2520
2901
  key: 1,
2521
2902
  width: "16",
2522
2903
  height: "16",
@@ -2524,10 +2905,17 @@ const Ue = `
2524
2905
  fill: "none",
2525
2906
  stroke: "currentColor",
2526
2907
  "stroke-width": "2"
2527
- }, rt = {
2908
+ };
2909
+ const _hoisted_13 = {
2528
2910
  key: 0,
2529
2911
  class: "hep-cr-error"
2530
- }, ot = { class: "hep-cr-main" }, st = { class: "hep-cr-panel-header" }, it = { class: "hep-cr-output-actions" }, lt = { class: "hep-cr-language-badge" }, ut = ["disabled", "title"], ct = {
2912
+ };
2913
+ const _hoisted_14 = { class: "hep-cr-main" };
2914
+ const _hoisted_15 = { class: "hep-cr-panel-header" };
2915
+ const _hoisted_16 = { class: "hep-cr-output-actions" };
2916
+ const _hoisted_17 = { class: "hep-cr-language-badge" };
2917
+ const _hoisted_18 = ["disabled", "title"];
2918
+ const _hoisted_19 = {
2531
2919
  key: 0,
2532
2920
  width: "14",
2533
2921
  height: "14",
@@ -2535,13 +2923,20 @@ const Ue = `
2535
2923
  fill: "none",
2536
2924
  stroke: "currentColor",
2537
2925
  "stroke-width": "2"
2538
- }, dt = {
2926
+ };
2927
+ const _hoisted_20 = {
2539
2928
  key: 1,
2540
2929
  class: "hep-cr-copied-text"
2541
- }, pt = { class: "hep-cr-panel-header" }, gt = { class: "hep-cr-output-tabs" }, ht = { class: "hep-cr-output-actions" }, ft = {
2930
+ };
2931
+ const _hoisted_21 = { class: "hep-cr-panel-header" };
2932
+ const _hoisted_22 = { class: "hep-cr-output-tabs" };
2933
+ const _hoisted_23 = { class: "hep-cr-output-actions" };
2934
+ const _hoisted_24 = {
2542
2935
  key: 0,
2543
2936
  class: "hep-cr-execution-time"
2544
- }, mt = ["disabled", "title"], bt = {
2937
+ };
2938
+ const _hoisted_25 = ["disabled", "title"];
2939
+ const _hoisted_26 = {
2545
2940
  key: 0,
2546
2941
  width: "14",
2547
2942
  height: "14",
@@ -2549,370 +2944,474 @@ const Ue = `
2549
2944
  fill: "none",
2550
2945
  stroke: "currentColor",
2551
2946
  "stroke-width": "2"
2552
- }, vt = {
2947
+ };
2948
+ const _hoisted_27 = {
2553
2949
  key: 1,
2554
2950
  class: "hep-cr-copied-text"
2555
- }, Et = { class: "hep-cr-output-content" }, yt = { key: 0 }, At = {
2951
+ };
2952
+ const _hoisted_28 = { class: "hep-cr-output-content" };
2953
+ const _hoisted_29 = { key: 0 };
2954
+ const _hoisted_30 = {
2556
2955
  key: 1,
2557
2956
  class: "hep-cr-stderr"
2558
- }, ge = "hep-cr-default-language", St = /* @__PURE__ */ le({
2957
+ };
2958
+ const STORAGE_KEY = "hep-cr-default-language";
2959
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2559
2960
  __name: "CodeRunner",
2560
2961
  props: {
2561
2962
  pistonUrl: { default: "/api/piston" },
2562
2963
  language: { default: "javascript" },
2563
2964
  theme: { default: "light" },
2564
2965
  themeColor: { default: "" },
2565
- showLanguageSelector: { type: Boolean, default: !0 },
2566
- showEditor: { type: Boolean, default: !0 },
2567
- editable: { type: Boolean, default: !0 },
2966
+ showLanguageSelector: { type: Boolean, default: true },
2967
+ showEditor: { type: Boolean, default: true },
2968
+ editable: { type: Boolean, default: true },
2568
2969
  defaultCode: {},
2569
2970
  executorLabel: { default: "运行" }
2570
2971
  },
2571
2972
  emits: ["execute-start", "execute-end", "language-change", "change"],
2572
- setup(i, { emit: p }) {
2573
- const n = i, l = H(() => {
2574
- if (!n.themeColor) return {};
2575
- const d = n.theme === "dark", g = n.themeColor, M = v(g) ? "#000" : "#fff";
2973
+ setup(__props, { emit: __emit }) {
2974
+ const props = __props;
2975
+ const themeStyle = computed(() => {
2976
+ if (!props.themeColor) return {};
2977
+ const isDark = props.theme === "dark";
2978
+ const color = props.themeColor;
2979
+ const isLightColor = isColorLight(color);
2980
+ const textColor = isLightColor ? "#000" : "#fff";
2576
2981
  return {
2577
- "--hep-cr-theme-color": g,
2578
- "--hep-cr-theme-color-hover": d ? _(g, 20) : _(g, -20),
2579
- "--hep-cr-tab-active-color": M
2982
+ "--hep-cr-theme-color": color,
2983
+ "--hep-cr-theme-color-hover": isDark ? adjustColorBrightness(color, 20) : adjustColorBrightness(color, -20),
2984
+ "--hep-cr-tab-active-color": textColor
2580
2985
  };
2581
2986
  });
2582
- function v(d) {
2583
- const g = parseInt(d.replace("#", ""), 16), m = g >> 16 & 255, M = g >> 8 & 255, P = g & 255;
2584
- return (0.299 * m + 0.587 * M + 0.114 * P) / 255 > 0.5;
2987
+ function isColorLight(hex) {
2988
+ const num = parseInt(hex.replace("#", ""), 16);
2989
+ const r = num >> 16 & 255;
2990
+ const g = num >> 8 & 255;
2991
+ const b = num & 255;
2992
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
2993
+ return luminance > 0.5;
2585
2994
  }
2586
- function _(d, g) {
2587
- const m = parseInt(d.replace("#", ""), 16), M = Math.round(2.55 * g), P = Math.min(255, Math.max(0, (m >> 16) + M)), G = Math.min(255, Math.max(0, (m >> 8 & 255) + M)), W = Math.min(255, Math.max(0, (m & 255) + M));
2588
- return "#" + (16777216 + P * 65536 + G * 256 + W).toString(16).slice(1);
2995
+ function adjustColorBrightness(hex, percent) {
2996
+ const num = parseInt(hex.replace("#", ""), 16);
2997
+ const amt = Math.round(2.55 * percent);
2998
+ const R = Math.min(255, Math.max(0, (num >> 16) + amt));
2999
+ const G = Math.min(255, Math.max(0, (num >> 8 & 255) + amt));
3000
+ const B = Math.min(255, Math.max(0, (num & 255) + amt));
3001
+ return "#" + (16777216 + R * 65536 + G * 256 + B).toString(16).slice(1);
2589
3002
  }
2590
- const S = p, o = N([]), f = N(t()), b = N(n.theme), k = N(""), C = N(""), O = N(""), L = N(!1), $ = N(null), w = N("stdout"), E = N(null), h = N(!1), e = N(60);
2591
- function t() {
2592
- return typeof window > "u" ? n.language : localStorage.getItem(ge) || n.language;
3003
+ const emit = __emit;
3004
+ const runtimes = ref([]);
3005
+ const currentLanguage = ref(getStoredLanguage());
3006
+ const currentTheme = ref(props.theme);
3007
+ const code = ref("");
3008
+ const output = ref("");
3009
+ const stderr = ref("");
3010
+ const isRunning = ref(false);
3011
+ const executionTime = ref(null);
3012
+ const activeTab = ref("stdout");
3013
+ const error = ref(null);
3014
+ const runtimesLoading = ref(false);
3015
+ const editorWidth = ref(60);
3016
+ function getStoredLanguage() {
3017
+ if (typeof window === "undefined") return props.language;
3018
+ return localStorage.getItem(STORAGE_KEY) || props.language;
2593
3019
  }
2594
- function r() {
2595
- b.value = b.value === "light" ? "dark" : "light";
3020
+ function toggleTheme() {
3021
+ currentTheme.value = currentTheme.value === "light" ? "dark" : "light";
2596
3022
  }
2597
- const a = H(
2598
- () => new De({ pistonUrl: n.pistonUrl })
2599
- ), s = H(() => o.value.map((d) => ({
2600
- value: `${d.language}:${d.version}`,
2601
- label: `${d.language.charAt(0).toUpperCase() + d.language.slice(1)} ${d.version}`
2602
- }))), u = H(() => {
2603
- const d = f.value;
2604
- return d.includes(":") ? d.split(":")[0] : d;
3023
+ const client = computed(
3024
+ () => new W({ pistonUrl: props.pistonUrl })
3025
+ );
3026
+ const languageOptions = computed(() => {
3027
+ return runtimes.value.map((r) => ({
3028
+ value: `${r.language}:${r.version}`,
3029
+ label: `${r.language.charAt(0).toUpperCase() + r.language.slice(1)} ${r.version}`
3030
+ }));
3031
+ });
3032
+ const languageName = computed(() => {
3033
+ const lang = currentLanguage.value;
3034
+ return lang.includes(":") ? lang.split(":")[0] : lang;
2605
3035
  });
2606
- async function y() {
2607
- h.value = !0, E.value = null;
3036
+ async function loadRuntimes() {
3037
+ runtimesLoading.value = true;
3038
+ error.value = null;
2608
3039
  try {
2609
- o.value = await a.value.getRuntimes();
2610
- const d = f.value.split(":")[0], g = o.value.find((m) => m.language === d);
2611
- g && !f.value.includes(":") && (f.value = `${d}:${g.version}`), k.value || (k.value = n.defaultCode || J(d), S("change", k.value)), S("language-change", d, k.value);
2612
- } catch (d) {
2613
- E.value = d instanceof Error ? d.message : "Failed to load runtimes";
3040
+ runtimes.value = await client.value.getRuntimes();
3041
+ const langName = currentLanguage.value.split(":")[0];
3042
+ const defaultRuntime = runtimes.value.find((r) => r.language === langName);
3043
+ if (defaultRuntime && !currentLanguage.value.includes(":")) {
3044
+ currentLanguage.value = `${langName}:${defaultRuntime.version}`;
3045
+ }
3046
+ if (!code.value) {
3047
+ code.value = props.defaultCode || j(langName);
3048
+ emit("change", code.value);
3049
+ }
3050
+ emit("language-change", langName, code.value);
3051
+ } catch (e) {
3052
+ error.value = e instanceof Error ? e.message : "Failed to load runtimes";
2614
3053
  } finally {
2615
- h.value = !1;
3054
+ runtimesLoading.value = false;
2616
3055
  }
2617
3056
  }
2618
- ue(f, (d) => {
2619
- const g = d.includes(":") ? d.split(":")[0] : d, m = J(g);
2620
- k.value = m, S("language-change", g, m), typeof window < "u" && localStorage.setItem(ge, d);
3057
+ watch(currentLanguage, (newLang) => {
3058
+ const langName = newLang.includes(":") ? newLang.split(":")[0] : newLang;
3059
+ const newCode = j(langName);
3060
+ code.value = newCode;
3061
+ emit("language-change", langName, newCode);
3062
+ if (typeof window !== "undefined") {
3063
+ localStorage.setItem(STORAGE_KEY, newLang);
3064
+ }
2621
3065
  });
2622
- async function c() {
2623
- if (!L.value) {
2624
- L.value = !0, C.value = "", O.value = "", $.value = null, E.value = null, w.value = "stdout", S("execute-start");
2625
- try {
2626
- const d = await a.value.execute(u.value, k.value);
2627
- C.value = d.output, O.value = d.stderr, $.value = d.executionTime || null, w.value = d.stderr ? "stderr" : "stdout", S("execute-end", d);
2628
- } catch (d) {
2629
- E.value = d instanceof Error ? d.message : "Execution failed", S("execute-end", {
2630
- success: !1,
2631
- output: "",
2632
- stderr: E.value,
2633
- code: -1
2634
- });
2635
- } finally {
2636
- L.value = !1;
2637
- }
3066
+ async function execute() {
3067
+ if (isRunning.value) return;
3068
+ isRunning.value = true;
3069
+ output.value = "";
3070
+ stderr.value = "";
3071
+ executionTime.value = null;
3072
+ error.value = null;
3073
+ activeTab.value = "stdout";
3074
+ emit("execute-start");
3075
+ try {
3076
+ const result = await client.value.execute(languageName.value, code.value);
3077
+ output.value = result.output;
3078
+ stderr.value = result.stderr;
3079
+ executionTime.value = result.executionTime || null;
3080
+ activeTab.value = result.stderr ? "stderr" : "stdout";
3081
+ emit("execute-end", result);
3082
+ } catch (e) {
3083
+ error.value = e instanceof Error ? e.message : "Execution failed";
3084
+ emit("execute-end", {
3085
+ success: false,
3086
+ output: "",
3087
+ stderr: error.value,
3088
+ code: -1
3089
+ });
3090
+ } finally {
3091
+ isRunning.value = false;
2638
3092
  }
2639
3093
  }
2640
- const T = N(!1), F = N(!1);
2641
- async function U() {
2642
- await navigator.clipboard.writeText(k.value), T.value = !0, setTimeout(() => {
2643
- T.value = !1;
3094
+ const copiedEditor = ref(false);
3095
+ const copiedOutput = ref(false);
3096
+ async function copyCode() {
3097
+ await navigator.clipboard.writeText(code.value);
3098
+ copiedEditor.value = true;
3099
+ setTimeout(() => {
3100
+ copiedEditor.value = false;
2644
3101
  }, 2e3);
2645
3102
  }
2646
- async function X() {
2647
- const d = w.value === "stdout" ? C.value : O.value;
2648
- await navigator.clipboard.writeText(d), F.value = !0, setTimeout(() => {
2649
- F.value = !1;
3103
+ async function copyOutput() {
3104
+ const text = activeTab.value === "stdout" ? output.value : stderr.value;
3105
+ await navigator.clipboard.writeText(text);
3106
+ copiedOutput.value = true;
3107
+ setTimeout(() => {
3108
+ copiedOutput.value = false;
2650
3109
  }, 2e3);
2651
3110
  }
2652
- function Z() {
2653
- k.value = J(u.value);
3111
+ function resetCode() {
3112
+ code.value = j(languageName.value);
2654
3113
  }
2655
- let V = !1;
2656
- function te(d) {
2657
- V = !0, document.addEventListener("mousemove", Y), document.addEventListener("mouseup", R), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
3114
+ let isDragging = false;
3115
+ function startDrag(e) {
3116
+ isDragging = true;
3117
+ document.addEventListener("mousemove", onDrag);
3118
+ document.addEventListener("mouseup", stopDrag);
3119
+ document.body.style.cursor = "col-resize";
3120
+ document.body.style.userSelect = "none";
2658
3121
  }
2659
- function Y(d) {
2660
- if (!V) return;
2661
- const g = document.querySelector(
3122
+ function onDrag(e) {
3123
+ if (!isDragging) return;
3124
+ const container = document.querySelector(
2662
3125
  ".hep-cr-main"
2663
3126
  );
2664
- if (!g) return;
2665
- const m = g.getBoundingClientRect(), M = (d.clientX - m.left) / m.width * 100;
2666
- e.value = Math.max(20, Math.min(80, M));
3127
+ if (!container) return;
3128
+ const rect = container.getBoundingClientRect();
3129
+ const newWidth = (e.clientX - rect.left) / rect.width * 100;
3130
+ editorWidth.value = Math.max(20, Math.min(80, newWidth));
2667
3131
  }
2668
- function R() {
2669
- V = !1, document.removeEventListener("mousemove", Y), document.removeEventListener("mouseup", R), document.body.style.cursor = "", document.body.style.userSelect = "";
3132
+ function stopDrag() {
3133
+ isDragging = false;
3134
+ document.removeEventListener("mousemove", onDrag);
3135
+ document.removeEventListener("mouseup", stopDrag);
3136
+ document.body.style.cursor = "";
3137
+ document.body.style.userSelect = "";
2670
3138
  }
2671
- he(async () => {
2672
- await y(), k.value || (k.value = n.defaultCode || J(f.value), S("change", k.value));
3139
+ onMounted(async () => {
3140
+ await loadRuntimes();
3141
+ if (!code.value) {
3142
+ code.value = props.defaultCode || j(currentLanguage.value);
3143
+ emit("change", code.value);
3144
+ }
2673
3145
  });
2674
- const D = H(() => `hep-cr-runner-${b.value}`);
2675
- return (d, g) => (x(), I("div", {
2676
- class: j(["hep-cr-runner", D.value]),
2677
- style: Q(l.value)
2678
- }, [
2679
- A("div", Ve, [
2680
- A("div", Ye, [
2681
- i.showLanguageSelector ? ye((x(), I("select", {
2682
- key: 0,
2683
- "onUpdate:modelValue": g[0] || (g[0] = (m) => f.value = m),
2684
- class: "hep-cr-language-select",
2685
- disabled: L.value
2686
- }, [
2687
- h.value ? (x(), I("option", Ze, "加载中...")) : B("", !0),
2688
- (x(!0), I(Ae, null, Se(s.value, (m) => (x(), I("option", {
2689
- key: m.value,
2690
- value: m.value
2691
- }, z(m.label), 9, Ke))), 128))
2692
- ], 8, Xe)), [
2693
- [ke, f.value]
2694
- ]) : B("", !0)
3146
+ const themeClass = computed(() => `hep-cr-runner-${currentTheme.value}`);
3147
+ return (_ctx, _cache) => {
3148
+ return openBlock(), createElementBlock("div", {
3149
+ class: normalizeClass(["hep-cr-runner", themeClass.value]),
3150
+ style: normalizeStyle(themeStyle.value)
3151
+ }, [
3152
+ createElementVNode("div", _hoisted_1$1, [
3153
+ createElementVNode("div", _hoisted_2$1, [
3154
+ __props.showLanguageSelector ? withDirectives((openBlock(), createElementBlock("select", {
3155
+ key: 0,
3156
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentLanguage.value = $event),
3157
+ class: "hep-cr-language-select",
3158
+ disabled: isRunning.value
3159
+ }, [
3160
+ runtimesLoading.value ? (openBlock(), createElementBlock("option", _hoisted_4$1, "加载中...")) : createCommentVNode("", true),
3161
+ (openBlock(true), createElementBlock(Fragment, null, renderList(languageOptions.value, (option) => {
3162
+ return openBlock(), createElementBlock("option", {
3163
+ key: option.value,
3164
+ value: option.value
3165
+ }, toDisplayString(option.label), 9, _hoisted_5);
3166
+ }), 128))
3167
+ ], 8, _hoisted_3$1)), [
3168
+ [vModelSelect, currentLanguage.value]
3169
+ ]) : createCommentVNode("", true)
3170
+ ]),
3171
+ createElementVNode("div", _hoisted_6, [
3172
+ createElementVNode("button", {
3173
+ class: "hep-cr-btn hep-cr-btn-run",
3174
+ disabled: isRunning.value || runtimesLoading.value,
3175
+ onClick: execute
3176
+ }, [
3177
+ isRunning.value ? (openBlock(), createElementBlock("span", _hoisted_8)) : (openBlock(), createElementBlock("span", _hoisted_9, "▶")),
3178
+ createTextVNode(" " + toDisplayString(isRunning.value ? "运行中..." : __props.executorLabel), 1)
3179
+ ], 8, _hoisted_7),
3180
+ __props.showEditor && __props.editable ? (openBlock(), createElementBlock("button", {
3181
+ key: 0,
3182
+ class: "hep-cr-btn hep-cr-btn-reset",
3183
+ onClick: resetCode
3184
+ }, " 重置 ")) : createCommentVNode("", true),
3185
+ createElementVNode("button", {
3186
+ class: "hep-cr-btn hep-cr-btn-theme",
3187
+ onClick: toggleTheme,
3188
+ title: currentTheme.value === "light" ? "Switch to dark mode" : "Switch to light mode"
3189
+ }, [
3190
+ currentTheme.value === "light" ? (openBlock(), createElementBlock("svg", _hoisted_11, [..._cache[5] || (_cache[5] = [
3191
+ createElementVNode("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }, null, -1)
3192
+ ])])) : (openBlock(), createElementBlock("svg", _hoisted_12, [..._cache[6] || (_cache[6] = [
3193
+ createStaticVNode('<circle cx="12" cy="12" r="5" data-v-41977f3b></circle><line x1="12" y1="1" x2="12" y2="3" data-v-41977f3b></line><line x1="12" y1="21" x2="12" y2="23" data-v-41977f3b></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" data-v-41977f3b></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" data-v-41977f3b></line><line x1="1" y1="12" x2="3" y2="12" data-v-41977f3b></line><line x1="21" y1="12" x2="23" y2="12" data-v-41977f3b></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" data-v-41977f3b></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" data-v-41977f3b></line>', 9)
3194
+ ])]))
3195
+ ], 8, _hoisted_10)
3196
+ ])
2695
3197
  ]),
2696
- A("div", qe, [
2697
- A("button", {
2698
- class: "hep-cr-btn hep-cr-btn-run",
2699
- disabled: L.value || h.value,
2700
- onClick: c
2701
- }, [
2702
- L.value ? (x(), I("span", Qe)) : (x(), I("span", et, "▶")),
2703
- we(" " + z(L.value ? "运行中..." : i.executorLabel), 1)
2704
- ], 8, Je),
2705
- i.showEditor && i.editable ? (x(), I("button", {
3198
+ error.value ? (openBlock(), createElementBlock("div", _hoisted_13, toDisplayString(error.value), 1)) : createCommentVNode("", true),
3199
+ createElementVNode("div", _hoisted_14, [
3200
+ __props.showEditor ? (openBlock(), createElementBlock("div", {
2706
3201
  key: 0,
2707
- class: "hep-cr-btn hep-cr-btn-reset",
2708
- onClick: Z
2709
- }, " 重置 ")) : B("", !0),
2710
- A("button", {
2711
- class: "hep-cr-btn hep-cr-btn-theme",
2712
- onClick: r,
2713
- title: b.value === "light" ? "Switch to dark mode" : "Switch to light mode"
3202
+ class: "hep-cr-editor-panel",
3203
+ style: normalizeStyle({ width: editorWidth.value + "%" })
2714
3204
  }, [
2715
- b.value === "light" ? (x(), I("svg", nt, [...g[5] || (g[5] = [
2716
- A("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }, null, -1)
2717
- ])])) : (x(), I("svg", at, [...g[6] || (g[6] = [
2718
- Te('<circle cx="12" cy="12" r="5" data-v-41977f3b></circle><line x1="12" y1="1" x2="12" y2="3" data-v-41977f3b></line><line x1="12" y1="21" x2="12" y2="23" data-v-41977f3b></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" data-v-41977f3b></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" data-v-41977f3b></line><line x1="1" y1="12" x2="3" y2="12" data-v-41977f3b></line><line x1="21" y1="12" x2="23" y2="12" data-v-41977f3b></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" data-v-41977f3b></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" data-v-41977f3b></line>', 9)
2719
- ])]))
2720
- ], 8, tt)
2721
- ])
2722
- ]),
2723
- E.value ? (x(), I("div", rt, z(E.value), 1)) : B("", !0),
2724
- A("div", ot, [
2725
- i.showEditor ? (x(), I("div", {
2726
- key: 0,
2727
- class: "hep-cr-editor-panel",
2728
- style: Q({ width: e.value + "%" })
2729
- }, [
2730
- A("div", st, [
2731
- g[8] || (g[8] = A("span", { class: "hep-cr-panel-title" }, "编辑器", -1)),
2732
- A("div", it, [
2733
- A("span", lt, z(u.value), 1),
2734
- A("button", {
2735
- class: j(["hep-cr-btn-icon", { "hep-cr-btn-copied": T.value }]),
2736
- disabled: T.value,
2737
- onClick: U,
2738
- title: T.value ? "已复制" : "复制"
2739
- }, [
2740
- T.value ? (x(), I("span", dt, "已复制")) : (x(), I("svg", ct, [...g[7] || (g[7] = [
2741
- A("rect", {
2742
- x: "9",
2743
- y: "9",
2744
- width: "13",
2745
- height: "13",
2746
- rx: "2",
2747
- ry: "2"
2748
- }, null, -1),
2749
- A("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
2750
- ])]))
2751
- ], 10, ut)
2752
- ])
2753
- ]),
2754
- ie(We, {
2755
- modelValue: k.value,
2756
- "onUpdate:modelValue": g[1] || (g[1] = (m) => k.value = m),
2757
- language: u.value,
2758
- theme: b.value,
2759
- disabled: !i.editable || L.value,
2760
- onChange: g[2] || (g[2] = (m) => S("change", m))
2761
- }, null, 8, ["modelValue", "language", "theme", "disabled"])
2762
- ], 4)) : B("", !0),
2763
- i.showEditor ? (x(), I("div", {
2764
- key: 1,
2765
- class: "hep-cr-resize-handle",
2766
- onMousedown: te
2767
- }, [...g[9] || (g[9] = [
2768
- A("div", { class: "hep-cr-resize-line" }, null, -1)
2769
- ])], 32)) : B("", !0),
2770
- A("div", {
2771
- class: "hep-cr-output-panel",
2772
- style: Q({ width: i.showEditor ? 100 - e.value + "%" : "100%" })
2773
- }, [
2774
- A("div", pt, [
2775
- A("div", gt, [
2776
- A("button", {
2777
- class: j(["hep-cr-tab", { active: w.value === "stdout" }]),
2778
- onClick: g[3] || (g[3] = (m) => w.value = "stdout")
2779
- }, " 输出 ", 2),
2780
- O.value ? (x(), I("button", {
2781
- key: 0,
2782
- class: j(["hep-cr-tab", "hep-cr-tab-error", { active: w.value === "stderr" }]),
2783
- onClick: g[4] || (g[4] = (m) => w.value = "stderr")
2784
- }, " 错误 ", 2)) : B("", !0)
3205
+ createElementVNode("div", _hoisted_15, [
3206
+ _cache[8] || (_cache[8] = createElementVNode("span", { class: "hep-cr-panel-title" }, "编辑器", -1)),
3207
+ createElementVNode("div", _hoisted_16, [
3208
+ createElementVNode("span", _hoisted_17, toDisplayString(languageName.value), 1),
3209
+ createElementVNode("button", {
3210
+ class: normalizeClass(["hep-cr-btn-icon", { "hep-cr-btn-copied": copiedEditor.value }]),
3211
+ disabled: copiedEditor.value,
3212
+ onClick: copyCode,
3213
+ title: copiedEditor.value ? "已复制" : "复制"
3214
+ }, [
3215
+ !copiedEditor.value ? (openBlock(), createElementBlock("svg", _hoisted_19, [..._cache[7] || (_cache[7] = [
3216
+ createElementVNode("rect", {
3217
+ x: "9",
3218
+ y: "9",
3219
+ width: "13",
3220
+ height: "13",
3221
+ rx: "2",
3222
+ ry: "2"
3223
+ }, null, -1),
3224
+ createElementVNode("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
3225
+ ])])) : (openBlock(), createElementBlock("span", _hoisted_20, "已复制"))
3226
+ ], 10, _hoisted_18)
3227
+ ])
2785
3228
  ]),
2786
- A("div", ht, [
2787
- $.value !== null ? (x(), I("span", ft, z($.value) + "ms ", 1)) : B("", !0),
2788
- A("button", {
2789
- class: j(["hep-cr-btn-icon", { "hep-cr-btn-copied": F.value }]),
2790
- disabled: F.value,
2791
- onClick: X,
2792
- title: F.value ? "已复制" : "复制"
2793
- }, [
2794
- F.value ? (x(), I("span", vt, "已复制")) : (x(), I("svg", bt, [...g[10] || (g[10] = [
2795
- A("rect", {
2796
- x: "9",
2797
- y: "9",
2798
- width: "13",
2799
- height: "13",
2800
- rx: "2",
2801
- ry: "2"
2802
- }, null, -1),
2803
- A("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
2804
- ])]))
2805
- ], 10, mt)
3229
+ createVNode(CodeEditor, {
3230
+ modelValue: code.value,
3231
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => code.value = $event),
3232
+ language: languageName.value,
3233
+ theme: currentTheme.value,
3234
+ disabled: !__props.editable || isRunning.value,
3235
+ onChange: _cache[2] || (_cache[2] = (val) => emit("change", val))
3236
+ }, null, 8, ["modelValue", "language", "theme", "disabled"])
3237
+ ], 4)) : createCommentVNode("", true),
3238
+ __props.showEditor ? (openBlock(), createElementBlock("div", {
3239
+ key: 1,
3240
+ class: "hep-cr-resize-handle",
3241
+ onMousedown: startDrag
3242
+ }, [..._cache[9] || (_cache[9] = [
3243
+ createElementVNode("div", { class: "hep-cr-resize-line" }, null, -1)
3244
+ ])], 32)) : createCommentVNode("", true),
3245
+ createElementVNode("div", {
3246
+ class: "hep-cr-output-panel",
3247
+ style: normalizeStyle({ width: __props.showEditor ? 100 - editorWidth.value + "%" : "100%" })
3248
+ }, [
3249
+ createElementVNode("div", _hoisted_21, [
3250
+ createElementVNode("div", _hoisted_22, [
3251
+ createElementVNode("button", {
3252
+ class: normalizeClass(["hep-cr-tab", { active: activeTab.value === "stdout" }]),
3253
+ onClick: _cache[3] || (_cache[3] = ($event) => activeTab.value = "stdout")
3254
+ }, " 输出 ", 2),
3255
+ stderr.value ? (openBlock(), createElementBlock("button", {
3256
+ key: 0,
3257
+ class: normalizeClass(["hep-cr-tab", "hep-cr-tab-error", { active: activeTab.value === "stderr" }]),
3258
+ onClick: _cache[4] || (_cache[4] = ($event) => activeTab.value = "stderr")
3259
+ }, " 错误 ", 2)) : createCommentVNode("", true)
3260
+ ]),
3261
+ createElementVNode("div", _hoisted_23, [
3262
+ executionTime.value !== null ? (openBlock(), createElementBlock("span", _hoisted_24, toDisplayString(executionTime.value) + "ms ", 1)) : createCommentVNode("", true),
3263
+ createElementVNode("button", {
3264
+ class: normalizeClass(["hep-cr-btn-icon", { "hep-cr-btn-copied": copiedOutput.value }]),
3265
+ disabled: copiedOutput.value,
3266
+ onClick: copyOutput,
3267
+ title: copiedOutput.value ? "已复制" : "复制"
3268
+ }, [
3269
+ !copiedOutput.value ? (openBlock(), createElementBlock("svg", _hoisted_26, [..._cache[10] || (_cache[10] = [
3270
+ createElementVNode("rect", {
3271
+ x: "9",
3272
+ y: "9",
3273
+ width: "13",
3274
+ height: "13",
3275
+ rx: "2",
3276
+ ry: "2"
3277
+ }, null, -1),
3278
+ createElementVNode("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
3279
+ ])])) : (openBlock(), createElementBlock("span", _hoisted_27, "已复制"))
3280
+ ], 10, _hoisted_25)
3281
+ ])
3282
+ ]),
3283
+ createElementVNode("div", _hoisted_28, [
3284
+ activeTab.value === "stdout" ? (openBlock(), createElementBlock("pre", _hoisted_29, toDisplayString(isRunning.value ? "代码执行中..." : output.value || '点击"运行"执行代码'), 1)) : (openBlock(), createElementBlock("pre", _hoisted_30, toDisplayString(stderr.value), 1))
2806
3285
  ])
2807
- ]),
2808
- A("div", Et, [
2809
- w.value === "stdout" ? (x(), I("pre", yt, z(L.value ? "代码执行中..." : C.value || '点击"运行"执行代码'), 1)) : (x(), I("pre", At, z(O.value), 1))
2810
- ])
2811
- ], 4)
2812
- ])
2813
- ], 6));
3286
+ ], 4)
3287
+ ])
3288
+ ], 6);
3289
+ };
2814
3290
  }
2815
- }), ee = /* @__PURE__ */ me(St, [["__scopeId", "data-v-41977f3b"]]), kt = { class: "hep-cr-dialog-header" }, wt = { class: "hep-cr-dialog-title" }, Tt = { class: "hep-cr-dialog-body" }, _t = {
3291
+ });
3292
+ const CodeRunner = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-41977f3b"]]);
3293
+ const _hoisted_1 = { class: "hep-cr-dialog-header" };
3294
+ const _hoisted_2 = { class: "hep-cr-dialog-title" };
3295
+ const _hoisted_3 = { class: "hep-cr-dialog-body" };
3296
+ const _hoisted_4 = {
2816
3297
  key: 0,
2817
3298
  class: "hep-cr-dialog-footer"
2818
- }, It = /* @__PURE__ */ le({
3299
+ };
3300
+ const _sfc_main = /* @__PURE__ */ defineComponent({
2819
3301
  __name: "CodeRunnerDialog",
2820
3302
  props: {
2821
- modelValue: { type: Boolean, default: !1 },
3303
+ modelValue: { type: Boolean, default: false },
2822
3304
  title: { default: "代码执行器" },
2823
3305
  width: { default: 800 },
2824
3306
  pistonUrl: { default: "/api/piston" },
2825
3307
  language: { default: "javascript" },
2826
3308
  theme: { default: "light" },
2827
3309
  themeColor: { default: "" },
2828
- showLanguageSelector: { type: Boolean, default: !0 },
2829
- showEditor: { type: Boolean, default: !0 },
2830
- editable: { type: Boolean, default: !0 },
3310
+ showLanguageSelector: { type: Boolean, default: true },
3311
+ showEditor: { type: Boolean, default: true },
3312
+ editable: { type: Boolean, default: true },
2831
3313
  defaultCode: {},
2832
3314
  executorLabel: { default: "运行" }
2833
3315
  },
2834
3316
  emits: ["update:modelValue", "close", "change"],
2835
- setup(i, { expose: p, emit: n }) {
2836
- const l = i, v = n, _ = N(l.modelValue), S = H(() => l.modelValue !== void 0 ? l.modelValue : _.value);
2837
- ue(
2838
- () => l.modelValue,
2839
- (b) => {
2840
- b !== void 0 && (_.value = b);
3317
+ setup(__props, { expose: __expose, emit: __emit }) {
3318
+ const props = __props;
3319
+ const emit = __emit;
3320
+ const localVisible = ref(props.modelValue);
3321
+ const isVisible = computed(() => {
3322
+ if (props.modelValue !== void 0) {
3323
+ return props.modelValue;
3324
+ }
3325
+ return localVisible.value;
3326
+ });
3327
+ watch(
3328
+ () => props.modelValue,
3329
+ (val) => {
3330
+ if (val !== void 0) {
3331
+ localVisible.value = val;
3332
+ }
2841
3333
  }
2842
3334
  );
2843
- function o() {
2844
- _.value = !1, v("update:modelValue", !1), v("close");
3335
+ function close() {
3336
+ localVisible.value = false;
3337
+ emit("update:modelValue", false);
3338
+ emit("close");
2845
3339
  }
2846
- function f(b) {
2847
- b.target === b.currentTarget && o();
3340
+ function handleOverlayClick(e) {
3341
+ if (e.target === e.currentTarget) {
3342
+ close();
3343
+ }
2848
3344
  }
2849
- return p({
2850
- close: o
2851
- }), (b, k) => (x(), _e(xe, { to: "body" }, [
2852
- ie(Ie, { name: "hep-cr-dialog-fade" }, {
2853
- default: Fe(() => [
2854
- S.value ? (x(), I("div", {
2855
- key: 0,
2856
- class: "hep-cr-dialog-overlay",
2857
- onClick: f
2858
- }, [
2859
- A("div", {
2860
- class: "hep-cr-dialog-container",
2861
- style: Q({ width: typeof i.width == "number" ? i.width + "px" : i.width })
3345
+ __expose({
3346
+ close
3347
+ });
3348
+ return (_ctx, _cache) => {
3349
+ return openBlock(), createBlock(Teleport, { to: "body" }, [
3350
+ createVNode(Transition, { name: "hep-cr-dialog-fade" }, {
3351
+ default: withCtx(() => [
3352
+ isVisible.value ? (openBlock(), createElementBlock("div", {
3353
+ key: 0,
3354
+ class: "hep-cr-dialog-overlay",
3355
+ onClick: handleOverlayClick
2862
3356
  }, [
2863
- A("div", kt, [
2864
- A("h3", wt, z(i.title), 1),
2865
- A("button", {
2866
- class: "hep-cr-dialog-close",
2867
- onClick: o
2868
- }, [...k[0] || (k[0] = [
2869
- A("svg", {
2870
- width: "16",
2871
- height: "16",
2872
- viewBox: "0 0 24 24",
2873
- fill: "none",
2874
- stroke: "currentColor",
2875
- "stroke-width": "2"
2876
- }, [
2877
- A("line", {
2878
- x1: "18",
2879
- y1: "6",
2880
- x2: "6",
2881
- y2: "18"
2882
- }),
2883
- A("line", {
2884
- x1: "6",
2885
- y1: "6",
2886
- x2: "18",
2887
- y2: "18"
2888
- })
2889
- ], -1)
2890
- ])])
2891
- ]),
2892
- A("div", Tt, [
2893
- ie(ee, Re(b.$attrs, Ne(b.$attrs)), null, 16)
2894
- ]),
2895
- b.$slots.footer ? (x(), I("div", _t, [
2896
- Oe(b.$slots, "footer", { close: o })
2897
- ])) : B("", !0)
2898
- ], 4)
2899
- ])) : B("", !0)
2900
- ]),
2901
- _: 3
2902
- })
2903
- ]));
3357
+ createElementVNode("div", {
3358
+ class: "hep-cr-dialog-container",
3359
+ style: normalizeStyle({ width: typeof __props.width === "number" ? __props.width + "px" : __props.width })
3360
+ }, [
3361
+ createElementVNode("div", _hoisted_1, [
3362
+ createElementVNode("h3", _hoisted_2, toDisplayString(__props.title), 1),
3363
+ createElementVNode("button", {
3364
+ class: "hep-cr-dialog-close",
3365
+ onClick: close
3366
+ }, [..._cache[0] || (_cache[0] = [
3367
+ createElementVNode("svg", {
3368
+ width: "16",
3369
+ height: "16",
3370
+ viewBox: "0 0 24 24",
3371
+ fill: "none",
3372
+ stroke: "currentColor",
3373
+ "stroke-width": "2"
3374
+ }, [
3375
+ createElementVNode("line", {
3376
+ x1: "18",
3377
+ y1: "6",
3378
+ x2: "6",
3379
+ y2: "18"
3380
+ }),
3381
+ createElementVNode("line", {
3382
+ x1: "6",
3383
+ y1: "6",
3384
+ x2: "18",
3385
+ y2: "18"
3386
+ })
3387
+ ], -1)
3388
+ ])])
3389
+ ]),
3390
+ createElementVNode("div", _hoisted_3, [
3391
+ createVNode(CodeRunner, mergeProps(_ctx.$attrs, toHandlers(_ctx.$attrs)), null, 16)
3392
+ ]),
3393
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_4, [
3394
+ renderSlot(_ctx.$slots, "footer", { close })
3395
+ ])) : createCommentVNode("", true)
3396
+ ], 4)
3397
+ ])) : createCommentVNode("", true)
3398
+ ]),
3399
+ _: 3
3400
+ })
3401
+ ]);
3402
+ };
2904
3403
  }
2905
3404
  });
2906
- ee.install = (i) => {
2907
- i.component("CodeRunner", ee);
3405
+ CodeRunner.install = (app) => {
3406
+ app.component("CodeRunner", CodeRunner);
2908
3407
  };
2909
- const Ft = {
2910
- install(i) {
2911
- i.component("CodeRunner", ee);
3408
+ const index = {
3409
+ install(app) {
3410
+ app.component("CodeRunner", CodeRunner);
2912
3411
  }
2913
3412
  };
2914
3413
  export {
2915
- ee as CodeRunner,
2916
- It as CodeRunnerDialog,
2917
- Ft as default
3414
+ CodeRunner,
3415
+ _sfc_main as CodeRunnerDialog,
3416
+ index as default
2918
3417
  };