@hep-code-runner/vue3 1.5.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +50 -4
- package/dist/index.mjs +514 -422
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as ie, useCssVars as be, ref as
|
|
2
|
-
var
|
|
1
|
+
import { defineComponent as ie, useCssVars as be, ref as O, computed as B, onMounted as pe, watch as le, openBlock as T, createElementBlock as x, normalizeClass as G, createElementVNode as E, withDirectives as Ee, createCommentVNode as M, Fragment as ve, renderList as ye, toDisplayString as H, vModelSelect as Ae, createTextVNode as ke, createStaticVNode as Se, normalizeStyle as oe, createVNode as se, createBlock as we, Teleport as Te, Transition as _e, withCtx as xe, normalizeProps as Ie, guardReactiveProps as Fe, renderSlot as Re } from "vue";
|
|
2
|
+
var Oe = Object.defineProperty, Ne = (i, d, n) => d in i ? Oe(i, d, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[d] = n, ce = (i, d, n) => Ne(i, typeof d != "symbol" ? d + "" : d, n);
|
|
3
3
|
let ne = null;
|
|
4
4
|
class Le {
|
|
5
5
|
constructor(d = {}) {
|
|
@@ -27,17 +27,17 @@ class Le {
|
|
|
27
27
|
const h = (await this.getRuntimes()).find(
|
|
28
28
|
(f) => {
|
|
29
29
|
var m;
|
|
30
|
-
return f.language.toLowerCase() === d.toLowerCase() || ((m = f.aliases) == null ? void 0 : m.some((
|
|
30
|
+
return f.language.toLowerCase() === d.toLowerCase() || ((m = f.aliases) == null ? void 0 : m.some((I) => I.toLowerCase() === d.toLowerCase()));
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
if (!h)
|
|
34
34
|
throw new Error(`Language '${d}' is not supported`);
|
|
35
|
-
const
|
|
35
|
+
const A = this.getFileName(d), k = {
|
|
36
36
|
language: h.language,
|
|
37
37
|
version: l.version || h.version,
|
|
38
38
|
files: [
|
|
39
39
|
{
|
|
40
|
-
name:
|
|
40
|
+
name: A,
|
|
41
41
|
content: n
|
|
42
42
|
}
|
|
43
43
|
],
|
|
@@ -45,24 +45,24 @@ class Le {
|
|
|
45
45
|
args: l.args || [],
|
|
46
46
|
run_timeout: l.runTimeout || this.timeout,
|
|
47
47
|
compile_timeout: this.timeout
|
|
48
|
-
},
|
|
48
|
+
}, o = Date.now();
|
|
49
49
|
try {
|
|
50
50
|
const f = await fetch(`${this.baseUrl}/execute`, {
|
|
51
51
|
method: "POST",
|
|
52
52
|
headers: {
|
|
53
53
|
"Content-Type": "application/json"
|
|
54
54
|
},
|
|
55
|
-
body: JSON.stringify(
|
|
55
|
+
body: JSON.stringify(k)
|
|
56
56
|
});
|
|
57
57
|
if (!f.ok)
|
|
58
58
|
throw new Error(`Execute failed: ${f.statusText}`);
|
|
59
|
-
const m = await f.json(),
|
|
59
|
+
const m = await f.json(), I = Date.now() - o, N = m.run.stdout || "", R = m.run.stderr || "";
|
|
60
60
|
return {
|
|
61
61
|
success: m.run.code === 0,
|
|
62
|
-
output:
|
|
63
|
-
stderr:
|
|
62
|
+
output: N,
|
|
63
|
+
stderr: R,
|
|
64
64
|
code: m.run.code,
|
|
65
|
-
executionTime:
|
|
65
|
+
executionTime: I,
|
|
66
66
|
compile: m.compile ? {
|
|
67
67
|
stdout: m.compile.stdout || "",
|
|
68
68
|
stderr: m.compile.stderr || "",
|
|
@@ -75,7 +75,7 @@ class Le {
|
|
|
75
75
|
output: "",
|
|
76
76
|
stderr: f instanceof Error ? f.message : "Unknown error",
|
|
77
77
|
code: -1,
|
|
78
|
-
executionTime: Date.now() -
|
|
78
|
+
executionTime: Date.now() - o
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -109,7 +109,7 @@ class Le {
|
|
|
109
109
|
}[d.toLowerCase()] || `main.${d}`;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
const
|
|
112
|
+
const Ce = {
|
|
113
113
|
javascript: 'console.log("Hello, World!");',
|
|
114
114
|
typescript: 'console.log("Hello, World!");',
|
|
115
115
|
python: 'print("Hello, World!")',
|
|
@@ -209,11 +209,11 @@ This is a sample markdown document.`
|
|
|
209
209
|
};
|
|
210
210
|
function ae(i) {
|
|
211
211
|
const d = i.toLowerCase();
|
|
212
|
-
return
|
|
212
|
+
return Ce[d] || `// ${i}
|
|
213
213
|
// Write your code here`;
|
|
214
214
|
}
|
|
215
215
|
var de = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
216
|
-
function
|
|
216
|
+
function De(i) {
|
|
217
217
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
218
218
|
}
|
|
219
219
|
var ge = { exports: {} };
|
|
@@ -228,7 +228,7 @@ var ge = { exports: {} };
|
|
|
228
228
|
* @public
|
|
229
229
|
*/
|
|
230
230
|
var n = function(l) {
|
|
231
|
-
var h = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,
|
|
231
|
+
var h = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, A = 0, k = {}, o = {
|
|
232
232
|
/**
|
|
233
233
|
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
234
234
|
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
@@ -312,7 +312,7 @@ var ge = { exports: {} };
|
|
|
312
312
|
* @returns {number}
|
|
313
313
|
*/
|
|
314
314
|
objId: function(t) {
|
|
315
|
-
return t.__id || Object.defineProperty(t, "__id", { value: ++
|
|
315
|
+
return t.__id || Object.defineProperty(t, "__id", { value: ++A }), t.__id;
|
|
316
316
|
},
|
|
317
317
|
/**
|
|
318
318
|
* Creates a deep clone of the given object.
|
|
@@ -324,28 +324,28 @@ var ge = { exports: {} };
|
|
|
324
324
|
* @returns {T}
|
|
325
325
|
* @template T
|
|
326
326
|
*/
|
|
327
|
-
clone: function t(e,
|
|
328
|
-
|
|
329
|
-
var
|
|
330
|
-
switch (
|
|
327
|
+
clone: function t(e, r) {
|
|
328
|
+
r = r || {};
|
|
329
|
+
var s, a;
|
|
330
|
+
switch (o.util.type(e)) {
|
|
331
331
|
case "Object":
|
|
332
|
-
if (
|
|
333
|
-
return a
|
|
334
|
-
|
|
335
|
-
{}, a
|
|
336
|
-
for (var
|
|
337
|
-
e.hasOwnProperty(
|
|
332
|
+
if (a = o.util.objId(e), r[a])
|
|
333
|
+
return r[a];
|
|
334
|
+
s = /** @type {Record<string, any>} */
|
|
335
|
+
{}, r[a] = s;
|
|
336
|
+
for (var u in e)
|
|
337
|
+
e.hasOwnProperty(u) && (s[u] = t(e[u], r));
|
|
338
338
|
return (
|
|
339
339
|
/** @type {any} */
|
|
340
|
-
|
|
340
|
+
s
|
|
341
341
|
);
|
|
342
342
|
case "Array":
|
|
343
|
-
return
|
|
343
|
+
return a = o.util.objId(e), r[a] ? r[a] : (s = [], r[a] = s, /** @type {Array} */
|
|
344
344
|
/** @type {any} */
|
|
345
|
-
e.forEach(function(b,
|
|
346
|
-
|
|
345
|
+
e.forEach(function(b, c) {
|
|
346
|
+
s[c] = t(b, r);
|
|
347
347
|
}), /** @type {any} */
|
|
348
|
-
|
|
348
|
+
s);
|
|
349
349
|
default:
|
|
350
350
|
return e;
|
|
351
351
|
}
|
|
@@ -394,13 +394,13 @@ var ge = { exports: {} };
|
|
|
394
394
|
);
|
|
395
395
|
try {
|
|
396
396
|
throw new Error();
|
|
397
|
-
} catch (
|
|
398
|
-
var t = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(
|
|
397
|
+
} catch (s) {
|
|
398
|
+
var t = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(s.stack) || [])[1];
|
|
399
399
|
if (t) {
|
|
400
400
|
var e = document.getElementsByTagName("script");
|
|
401
|
-
for (var
|
|
402
|
-
if (e[
|
|
403
|
-
return e[
|
|
401
|
+
for (var r in e)
|
|
402
|
+
if (e[r].src == t)
|
|
403
|
+
return e[r];
|
|
404
404
|
}
|
|
405
405
|
return null;
|
|
406
406
|
}
|
|
@@ -424,16 +424,16 @@ var ge = { exports: {} };
|
|
|
424
424
|
* @param {boolean} [defaultActivation=false]
|
|
425
425
|
* @returns {boolean}
|
|
426
426
|
*/
|
|
427
|
-
isActive: function(t, e,
|
|
428
|
-
for (var
|
|
429
|
-
var
|
|
430
|
-
if (
|
|
427
|
+
isActive: function(t, e, r) {
|
|
428
|
+
for (var s = "no-" + e; t; ) {
|
|
429
|
+
var a = t.classList;
|
|
430
|
+
if (a.contains(e))
|
|
431
431
|
return !0;
|
|
432
|
-
if (
|
|
432
|
+
if (a.contains(s))
|
|
433
433
|
return !1;
|
|
434
434
|
t = t.parentElement;
|
|
435
435
|
}
|
|
436
|
-
return !!
|
|
436
|
+
return !!r;
|
|
437
437
|
}
|
|
438
438
|
},
|
|
439
439
|
/**
|
|
@@ -447,10 +447,10 @@ var ge = { exports: {} };
|
|
|
447
447
|
/**
|
|
448
448
|
* The grammar for plain, unformatted text.
|
|
449
449
|
*/
|
|
450
|
-
plain:
|
|
451
|
-
plaintext:
|
|
452
|
-
text:
|
|
453
|
-
txt:
|
|
450
|
+
plain: k,
|
|
451
|
+
plaintext: k,
|
|
452
|
+
text: k,
|
|
453
|
+
txt: k,
|
|
454
454
|
/**
|
|
455
455
|
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
456
456
|
*
|
|
@@ -480,10 +480,10 @@ var ge = { exports: {} };
|
|
|
480
480
|
* });
|
|
481
481
|
*/
|
|
482
482
|
extend: function(t, e) {
|
|
483
|
-
var
|
|
484
|
-
for (var
|
|
485
|
-
|
|
486
|
-
return
|
|
483
|
+
var r = o.util.clone(o.languages[t]);
|
|
484
|
+
for (var s in e)
|
|
485
|
+
r[s] = e[s];
|
|
486
|
+
return r;
|
|
487
487
|
},
|
|
488
488
|
/**
|
|
489
489
|
* Inserts tokens _before_ another token in a language definition or any other grammar.
|
|
@@ -560,31 +560,31 @@ var ge = { exports: {} };
|
|
|
560
560
|
* @returns {Grammar} The new grammar object.
|
|
561
561
|
* @public
|
|
562
562
|
*/
|
|
563
|
-
insertBefore: function(t, e,
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
var
|
|
567
|
-
for (var b in
|
|
568
|
-
if (
|
|
563
|
+
insertBefore: function(t, e, r, s) {
|
|
564
|
+
s = s || /** @type {any} */
|
|
565
|
+
o.languages;
|
|
566
|
+
var a = s[t], u = {};
|
|
567
|
+
for (var b in a)
|
|
568
|
+
if (a.hasOwnProperty(b)) {
|
|
569
569
|
if (b == e)
|
|
570
|
-
for (var
|
|
571
|
-
|
|
572
|
-
|
|
570
|
+
for (var c in r)
|
|
571
|
+
r.hasOwnProperty(c) && (u[c] = r[c]);
|
|
572
|
+
r.hasOwnProperty(b) || (u[b] = a[b]);
|
|
573
573
|
}
|
|
574
|
-
var
|
|
575
|
-
return
|
|
576
|
-
|
|
577
|
-
}),
|
|
574
|
+
var _ = s[t];
|
|
575
|
+
return s[t] = u, o.languages.DFS(o.languages, function(F, $) {
|
|
576
|
+
$ === _ && F != t && (this[F] = u);
|
|
577
|
+
}), u;
|
|
578
578
|
},
|
|
579
579
|
// Traverse a language definition with Depth First Search
|
|
580
|
-
DFS: function t(e,
|
|
581
|
-
|
|
582
|
-
var
|
|
580
|
+
DFS: function t(e, r, s, a) {
|
|
581
|
+
a = a || {};
|
|
582
|
+
var u = o.util.objId;
|
|
583
583
|
for (var b in e)
|
|
584
584
|
if (e.hasOwnProperty(b)) {
|
|
585
|
-
|
|
586
|
-
var
|
|
587
|
-
|
|
585
|
+
r.call(e, b, e[b], s || b);
|
|
586
|
+
var c = e[b], _ = o.util.type(c);
|
|
587
|
+
_ === "Object" && !a[u(c)] ? (a[u(c)] = !0, t(c, r, null, a)) : _ === "Array" && !a[u(c)] && (a[u(c)] = !0, t(c, r, b, a));
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
},
|
|
@@ -602,7 +602,7 @@ var ge = { exports: {} };
|
|
|
602
602
|
* @public
|
|
603
603
|
*/
|
|
604
604
|
highlightAll: function(t, e) {
|
|
605
|
-
|
|
605
|
+
o.highlightAllUnder(document, t, e);
|
|
606
606
|
},
|
|
607
607
|
/**
|
|
608
608
|
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
|
@@ -619,15 +619,15 @@ var ge = { exports: {} };
|
|
|
619
619
|
* @memberof Prism
|
|
620
620
|
* @public
|
|
621
621
|
*/
|
|
622
|
-
highlightAllUnder: function(t, e,
|
|
623
|
-
var
|
|
624
|
-
callback:
|
|
622
|
+
highlightAllUnder: function(t, e, r) {
|
|
623
|
+
var s = {
|
|
624
|
+
callback: r,
|
|
625
625
|
container: t,
|
|
626
626
|
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
627
627
|
};
|
|
628
|
-
|
|
629
|
-
for (var
|
|
630
|
-
|
|
628
|
+
o.hooks.run("before-highlightall", s), s.elements = Array.prototype.slice.apply(s.container.querySelectorAll(s.selector)), o.hooks.run("before-all-elements-highlight", s);
|
|
629
|
+
for (var a = 0, u; u = s.elements[a++]; )
|
|
630
|
+
o.highlightElement(u, e === !0, s.callback);
|
|
631
631
|
},
|
|
632
632
|
/**
|
|
633
633
|
* Highlights the code inside a single element.
|
|
@@ -657,39 +657,39 @@ var ge = { exports: {} };
|
|
|
657
657
|
* @memberof Prism
|
|
658
658
|
* @public
|
|
659
659
|
*/
|
|
660
|
-
highlightElement: function(t, e,
|
|
661
|
-
var
|
|
662
|
-
|
|
663
|
-
var
|
|
664
|
-
|
|
665
|
-
var b = t.textContent,
|
|
660
|
+
highlightElement: function(t, e, r) {
|
|
661
|
+
var s = o.util.getLanguage(t), a = o.languages[s];
|
|
662
|
+
o.util.setLanguage(t, s);
|
|
663
|
+
var u = t.parentElement;
|
|
664
|
+
u && u.nodeName.toLowerCase() === "pre" && o.util.setLanguage(u, s);
|
|
665
|
+
var b = t.textContent, c = {
|
|
666
666
|
element: t,
|
|
667
|
-
language:
|
|
668
|
-
grammar:
|
|
667
|
+
language: s,
|
|
668
|
+
grammar: a,
|
|
669
669
|
code: b
|
|
670
670
|
};
|
|
671
|
-
function
|
|
672
|
-
|
|
671
|
+
function _($) {
|
|
672
|
+
c.highlightedCode = $, 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);
|
|
673
673
|
}
|
|
674
|
-
if (
|
|
675
|
-
|
|
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);
|
|
676
676
|
return;
|
|
677
677
|
}
|
|
678
|
-
if (
|
|
679
|
-
|
|
678
|
+
if (o.hooks.run("before-highlight", c), !c.grammar) {
|
|
679
|
+
_(o.util.encode(c.code));
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
682
682
|
if (e && l.Worker) {
|
|
683
|
-
var F = new Worker(
|
|
684
|
-
F.onmessage = function(
|
|
685
|
-
|
|
683
|
+
var F = new Worker(o.filename);
|
|
684
|
+
F.onmessage = function($) {
|
|
685
|
+
_($.data);
|
|
686
686
|
}, F.postMessage(JSON.stringify({
|
|
687
|
-
language:
|
|
688
|
-
code:
|
|
687
|
+
language: c.language,
|
|
688
|
+
code: c.code,
|
|
689
689
|
immediateClose: !0
|
|
690
690
|
}));
|
|
691
691
|
} else
|
|
692
|
-
|
|
692
|
+
_(o.highlight(c.code, c.grammar, c.language));
|
|
693
693
|
},
|
|
694
694
|
/**
|
|
695
695
|
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
@@ -711,15 +711,15 @@ var ge = { exports: {} };
|
|
|
711
711
|
* @example
|
|
712
712
|
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
|
713
713
|
*/
|
|
714
|
-
highlight: function(t, e,
|
|
715
|
-
var
|
|
714
|
+
highlight: function(t, e, r) {
|
|
715
|
+
var s = {
|
|
716
716
|
code: t,
|
|
717
717
|
grammar: e,
|
|
718
|
-
language:
|
|
718
|
+
language: r
|
|
719
719
|
};
|
|
720
|
-
if (
|
|
721
|
-
throw new Error('The language "' +
|
|
722
|
-
return
|
|
720
|
+
if (o.hooks.run("before-tokenize", s), !s.grammar)
|
|
721
|
+
throw new Error('The language "' + s.language + '" has no grammar.');
|
|
722
|
+
return s.tokens = o.tokenize(s.code, s.grammar), o.hooks.run("after-tokenize", s), f.stringify(o.util.encode(s.tokens), s.language);
|
|
723
723
|
},
|
|
724
724
|
/**
|
|
725
725
|
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
@@ -746,14 +746,14 @@ var ge = { exports: {} };
|
|
|
746
746
|
* });
|
|
747
747
|
*/
|
|
748
748
|
tokenize: function(t, e) {
|
|
749
|
-
var
|
|
750
|
-
if (
|
|
751
|
-
for (var
|
|
752
|
-
e[
|
|
749
|
+
var r = e.rest;
|
|
750
|
+
if (r) {
|
|
751
|
+
for (var s in r)
|
|
752
|
+
e[s] = r[s];
|
|
753
753
|
delete e.rest;
|
|
754
754
|
}
|
|
755
|
-
var
|
|
756
|
-
return
|
|
755
|
+
var a = new N();
|
|
756
|
+
return R(a, a.head, t), I(t, a, e, a.head, 0), D(a);
|
|
757
757
|
},
|
|
758
758
|
/**
|
|
759
759
|
* @namespace
|
|
@@ -775,8 +775,8 @@ var ge = { exports: {} };
|
|
|
775
775
|
* @public
|
|
776
776
|
*/
|
|
777
777
|
add: function(t, e) {
|
|
778
|
-
var
|
|
779
|
-
|
|
778
|
+
var r = o.hooks.all;
|
|
779
|
+
r[t] = r[t] || [], r[t].push(e);
|
|
780
780
|
},
|
|
781
781
|
/**
|
|
782
782
|
* Runs a hook invoking all registered callbacks with the given environment variables.
|
|
@@ -788,132 +788,132 @@ var ge = { exports: {} };
|
|
|
788
788
|
* @public
|
|
789
789
|
*/
|
|
790
790
|
run: function(t, e) {
|
|
791
|
-
var
|
|
792
|
-
if (!(!
|
|
793
|
-
for (var
|
|
794
|
-
|
|
791
|
+
var r = o.hooks.all[t];
|
|
792
|
+
if (!(!r || !r.length))
|
|
793
|
+
for (var s = 0, a; a = r[s++]; )
|
|
794
|
+
a(e);
|
|
795
795
|
}
|
|
796
796
|
},
|
|
797
797
|
Token: f
|
|
798
798
|
};
|
|
799
|
-
l.Prism =
|
|
800
|
-
function f(t, e,
|
|
801
|
-
this.type = t, this.content = e, this.alias =
|
|
799
|
+
l.Prism = o;
|
|
800
|
+
function f(t, e, r, s) {
|
|
801
|
+
this.type = t, this.content = e, this.alias = r, this.length = (s || "").length | 0;
|
|
802
802
|
}
|
|
803
|
-
f.stringify = function t(e,
|
|
803
|
+
f.stringify = function t(e, r) {
|
|
804
804
|
if (typeof e == "string")
|
|
805
805
|
return e;
|
|
806
806
|
if (Array.isArray(e)) {
|
|
807
|
-
var
|
|
808
|
-
return e.forEach(function(
|
|
809
|
-
|
|
810
|
-
}),
|
|
807
|
+
var s = "";
|
|
808
|
+
return e.forEach(function(_) {
|
|
809
|
+
s += t(_, r);
|
|
810
|
+
}), s;
|
|
811
811
|
}
|
|
812
|
-
var
|
|
812
|
+
var a = {
|
|
813
813
|
type: e.type,
|
|
814
|
-
content: t(e.content,
|
|
814
|
+
content: t(e.content, r),
|
|
815
815
|
tag: "span",
|
|
816
816
|
classes: ["token", e.type],
|
|
817
817
|
attributes: {},
|
|
818
|
-
language:
|
|
819
|
-
},
|
|
820
|
-
|
|
818
|
+
language: r
|
|
819
|
+
}, u = e.alias;
|
|
820
|
+
u && (Array.isArray(u) ? Array.prototype.push.apply(a.classes, u) : a.classes.push(u)), o.hooks.run("wrap", a);
|
|
821
821
|
var b = "";
|
|
822
|
-
for (var
|
|
823
|
-
b += " " +
|
|
824
|
-
return "<" +
|
|
822
|
+
for (var c in a.attributes)
|
|
823
|
+
b += " " + c + '="' + (a.attributes[c] || "").replace(/"/g, """) + '"';
|
|
824
|
+
return "<" + a.tag + ' class="' + a.classes.join(" ") + '"' + b + ">" + a.content + "</" + a.tag + ">";
|
|
825
825
|
};
|
|
826
|
-
function m(t, e,
|
|
826
|
+
function m(t, e, r, s) {
|
|
827
827
|
t.lastIndex = e;
|
|
828
|
-
var
|
|
829
|
-
if (
|
|
830
|
-
var
|
|
831
|
-
|
|
828
|
+
var a = t.exec(r);
|
|
829
|
+
if (a && s && a[1]) {
|
|
830
|
+
var u = a[1].length;
|
|
831
|
+
a.index += u, a[0] = a[0].slice(u);
|
|
832
832
|
}
|
|
833
|
-
return
|
|
833
|
+
return a;
|
|
834
834
|
}
|
|
835
|
-
function
|
|
836
|
-
for (var b in
|
|
837
|
-
if (!(!
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
for (var
|
|
841
|
-
if (
|
|
835
|
+
function I(t, e, r, s, a, u) {
|
|
836
|
+
for (var b in r)
|
|
837
|
+
if (!(!r.hasOwnProperty(b) || !r[b])) {
|
|
838
|
+
var c = r[b];
|
|
839
|
+
c = Array.isArray(c) ? c : [c];
|
|
840
|
+
for (var _ = 0; _ < c.length; ++_) {
|
|
841
|
+
if (u && u.cause == b + "," + _)
|
|
842
842
|
return;
|
|
843
|
-
var F =
|
|
844
|
-
if (
|
|
845
|
-
var
|
|
846
|
-
F.pattern = RegExp(F.pattern.source,
|
|
843
|
+
var F = c[_], $ = F.inside, j = !!F.lookbehind, W = !!F.greedy, J = F.alias;
|
|
844
|
+
if (W && !F.pattern.global) {
|
|
845
|
+
var v = F.pattern.toString().match(/[imsuy]*$/)[0];
|
|
846
|
+
F.pattern = RegExp(F.pattern.source, v + "g");
|
|
847
847
|
}
|
|
848
|
-
for (var
|
|
849
|
-
var z =
|
|
848
|
+
for (var S = F.pattern || F, y = s.next, C = a; y !== e.tail && !(u && C >= u.reach); C += y.value.length, y = y.next) {
|
|
849
|
+
var z = y.value;
|
|
850
850
|
if (e.length > t.length)
|
|
851
851
|
return;
|
|
852
852
|
if (!(z instanceof f)) {
|
|
853
|
-
var
|
|
854
|
-
if (
|
|
855
|
-
if (
|
|
853
|
+
var Y = 1, P;
|
|
854
|
+
if (W) {
|
|
855
|
+
if (P = m(S, C, t, j), !P || P.index >= t.length)
|
|
856
856
|
break;
|
|
857
|
-
var
|
|
858
|
-
for (
|
|
859
|
-
|
|
860
|
-
if (
|
|
857
|
+
var X = P.index, fe = P.index + P[0].length, U = C;
|
|
858
|
+
for (U += y.value.length; X >= U; )
|
|
859
|
+
y = y.next, U += y.value.length;
|
|
860
|
+
if (U -= y.value.length, C = U, y.value instanceof f)
|
|
861
861
|
continue;
|
|
862
|
-
for (var
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
} else if (
|
|
862
|
+
for (var V = y; V !== e.tail && (U < fe || typeof V.value == "string"); V = V.next)
|
|
863
|
+
Y++, U += V.value.length;
|
|
864
|
+
Y--, z = t.slice(C, U), P.index -= C;
|
|
865
|
+
} else if (P = m(S, 0, z, j), !P)
|
|
866
866
|
continue;
|
|
867
|
-
var
|
|
868
|
-
|
|
869
|
-
var
|
|
870
|
-
Q && (
|
|
871
|
-
var me = new f(b,
|
|
872
|
-
if (
|
|
867
|
+
var X = P.index, Z = P[0], Q = z.slice(0, X), ue = z.slice(X + Z.length), ee = C + z.length;
|
|
868
|
+
u && ee > u.reach && (u.reach = ee);
|
|
869
|
+
var K = y.prev;
|
|
870
|
+
Q && (K = R(e, K, Q), C += Q.length), L(e, K, Y);
|
|
871
|
+
var me = new f(b, $ ? o.tokenize(Z, $) : Z, J, Z);
|
|
872
|
+
if (y = R(e, K, me), ue && R(e, y, ue), Y > 1) {
|
|
873
873
|
var te = {
|
|
874
|
-
cause: b + "," +
|
|
874
|
+
cause: b + "," + _,
|
|
875
875
|
reach: ee
|
|
876
876
|
};
|
|
877
|
-
|
|
877
|
+
I(t, e, r, y.prev, C, te), u && te.reach > u.reach && (u.reach = te.reach);
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
|
-
function
|
|
884
|
+
function N() {
|
|
885
885
|
var t = { value: null, prev: null, next: null }, e = { value: null, prev: t, next: null };
|
|
886
886
|
t.next = e, this.head = t, this.tail = e, this.length = 0;
|
|
887
887
|
}
|
|
888
|
-
function
|
|
889
|
-
var
|
|
890
|
-
return e.next =
|
|
888
|
+
function R(t, e, r) {
|
|
889
|
+
var s = e.next, a = { value: r, prev: e, next: s };
|
|
890
|
+
return e.next = a, s.prev = a, t.length++, a;
|
|
891
891
|
}
|
|
892
|
-
function
|
|
893
|
-
for (var
|
|
894
|
-
|
|
895
|
-
e.next =
|
|
892
|
+
function L(t, e, r) {
|
|
893
|
+
for (var s = e.next, a = 0; a < r && s !== t.tail; a++)
|
|
894
|
+
s = s.next;
|
|
895
|
+
e.next = s, s.prev = e, t.length -= a;
|
|
896
896
|
}
|
|
897
897
|
function D(t) {
|
|
898
|
-
for (var e = [],
|
|
899
|
-
e.push(
|
|
898
|
+
for (var e = [], r = t.head.next; r !== t.tail; )
|
|
899
|
+
e.push(r.value), r = r.next;
|
|
900
900
|
return e;
|
|
901
901
|
}
|
|
902
902
|
if (!l.document)
|
|
903
|
-
return l.addEventListener && (
|
|
904
|
-
var e = JSON.parse(t.data),
|
|
905
|
-
l.postMessage(
|
|
906
|
-
}, !1)),
|
|
907
|
-
var g =
|
|
908
|
-
g && (
|
|
903
|
+
return l.addEventListener && (o.disableWorkerMessageHandler || l.addEventListener("message", function(t) {
|
|
904
|
+
var e = JSON.parse(t.data), r = e.language, s = e.code, a = e.immediateClose;
|
|
905
|
+
l.postMessage(o.highlight(s, o.languages[r], r)), a && l.close();
|
|
906
|
+
}, !1)), o;
|
|
907
|
+
var g = o.util.currentScript();
|
|
908
|
+
g && (o.filename = g.src, g.hasAttribute("data-manual") && (o.manual = !0));
|
|
909
909
|
function p() {
|
|
910
|
-
|
|
910
|
+
o.manual || o.highlightAll();
|
|
911
911
|
}
|
|
912
|
-
if (!
|
|
913
|
-
var
|
|
914
|
-
|
|
912
|
+
if (!o.manual) {
|
|
913
|
+
var w = document.readyState;
|
|
914
|
+
w === "loading" || w === "interactive" && g && g.defer ? document.addEventListener("DOMContentLoaded", p) : window.requestAnimationFrame ? window.requestAnimationFrame(p) : window.setTimeout(p, 16);
|
|
915
915
|
}
|
|
916
|
-
return
|
|
916
|
+
return o;
|
|
917
917
|
}(d);
|
|
918
918
|
i.exports && (i.exports = n), typeof de < "u" && (de.Prism = n), n.languages.markup = {
|
|
919
919
|
comment: {
|
|
@@ -1006,22 +1006,22 @@ var ge = { exports: {} };
|
|
|
1006
1006
|
* @example
|
|
1007
1007
|
* addInlined('style', 'css');
|
|
1008
1008
|
*/
|
|
1009
|
-
value: function(h,
|
|
1010
|
-
var
|
|
1011
|
-
|
|
1009
|
+
value: function(h, A) {
|
|
1010
|
+
var k = {};
|
|
1011
|
+
k["language-" + A] = {
|
|
1012
1012
|
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1013
1013
|
lookbehind: !0,
|
|
1014
|
-
inside: n.languages[
|
|
1015
|
-
},
|
|
1016
|
-
var
|
|
1014
|
+
inside: n.languages[A]
|
|
1015
|
+
}, k.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
1016
|
+
var o = {
|
|
1017
1017
|
"included-cdata": {
|
|
1018
1018
|
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1019
|
-
inside:
|
|
1019
|
+
inside: k
|
|
1020
1020
|
}
|
|
1021
1021
|
};
|
|
1022
|
-
|
|
1022
|
+
o["language-" + A] = {
|
|
1023
1023
|
pattern: /[\s\S]+/,
|
|
1024
|
-
inside: n.languages[
|
|
1024
|
+
inside: n.languages[A]
|
|
1025
1025
|
};
|
|
1026
1026
|
var f = {};
|
|
1027
1027
|
f[h] = {
|
|
@@ -1030,7 +1030,7 @@ var ge = { exports: {} };
|
|
|
1030
1030
|
}), "i"),
|
|
1031
1031
|
lookbehind: !0,
|
|
1032
1032
|
greedy: !0,
|
|
1033
|
-
inside:
|
|
1033
|
+
inside: o
|
|
1034
1034
|
}, n.languages.insertBefore("markup", "cdata", f);
|
|
1035
1035
|
}
|
|
1036
1036
|
}), Object.defineProperty(n.languages.markup.tag, "addAttribute", {
|
|
@@ -1127,8 +1127,8 @@ var ge = { exports: {} };
|
|
|
1127
1127
|
},
|
|
1128
1128
|
punctuation: /[(){};:,]/
|
|
1129
1129
|
}, l.languages.css.atrule.inside.rest = l.languages.css;
|
|
1130
|
-
var
|
|
1131
|
-
|
|
1130
|
+
var A = l.languages.markup;
|
|
1131
|
+
A && (A.tag.addInlined("style", "css"), A.tag.addAttribute("style", "css"));
|
|
1132
1132
|
}(n), n.languages.clike = {
|
|
1133
1133
|
comment: [
|
|
1134
1134
|
{
|
|
@@ -1295,7 +1295,7 @@ var ge = { exports: {} };
|
|
|
1295
1295
|
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
1296
1296
|
var l = "Loading…", h = function(g, p) {
|
|
1297
1297
|
return "✖ Error " + g + " while fetching file: " + p;
|
|
1298
|
-
},
|
|
1298
|
+
}, A = "✖ Error: File does not exist or is empty", k = {
|
|
1299
1299
|
js: "javascript",
|
|
1300
1300
|
py: "python",
|
|
1301
1301
|
rb: "ruby",
|
|
@@ -1305,52 +1305,52 @@ var ge = { exports: {} };
|
|
|
1305
1305
|
bat: "batch",
|
|
1306
1306
|
h: "c",
|
|
1307
1307
|
tex: "latex"
|
|
1308
|
-
},
|
|
1309
|
-
function
|
|
1308
|
+
}, o = "data-src-status", f = "loading", m = "loaded", I = "failed", N = "pre[data-src]:not([" + o + '="' + m + '"]):not([' + o + '="' + f + '"])';
|
|
1309
|
+
function R(g, p, w) {
|
|
1310
1310
|
var t = new XMLHttpRequest();
|
|
1311
1311
|
t.open("GET", g, !0), t.onreadystatechange = function() {
|
|
1312
|
-
t.readyState == 4 && (t.status < 400 && t.responseText ? p(t.responseText) : t.status >= 400 ?
|
|
1312
|
+
t.readyState == 4 && (t.status < 400 && t.responseText ? p(t.responseText) : t.status >= 400 ? w(h(t.status, t.statusText)) : w(A));
|
|
1313
1313
|
}, t.send(null);
|
|
1314
1314
|
}
|
|
1315
|
-
function
|
|
1315
|
+
function L(g) {
|
|
1316
1316
|
var p = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(g || "");
|
|
1317
1317
|
if (p) {
|
|
1318
|
-
var
|
|
1319
|
-
return t ? e ? [
|
|
1318
|
+
var w = Number(p[1]), t = p[2], e = p[3];
|
|
1319
|
+
return t ? e ? [w, Number(e)] : [w, void 0] : [w, w];
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
1322
|
n.hooks.add("before-highlightall", function(g) {
|
|
1323
|
-
g.selector += ", " +
|
|
1323
|
+
g.selector += ", " + N;
|
|
1324
1324
|
}), n.hooks.add("before-sanity-check", function(g) {
|
|
1325
1325
|
var p = (
|
|
1326
1326
|
/** @type {HTMLPreElement} */
|
|
1327
1327
|
g.element
|
|
1328
1328
|
);
|
|
1329
|
-
if (p.matches(
|
|
1330
|
-
g.code = "", p.setAttribute(
|
|
1331
|
-
var
|
|
1332
|
-
|
|
1329
|
+
if (p.matches(N)) {
|
|
1330
|
+
g.code = "", p.setAttribute(o, f);
|
|
1331
|
+
var w = p.appendChild(document.createElement("CODE"));
|
|
1332
|
+
w.textContent = l;
|
|
1333
1333
|
var t = p.getAttribute("data-src"), e = g.language;
|
|
1334
1334
|
if (e === "none") {
|
|
1335
|
-
var
|
|
1336
|
-
e =
|
|
1335
|
+
var r = (/\.(\w+)$/.exec(t) || [, "none"])[1];
|
|
1336
|
+
e = k[r] || r;
|
|
1337
1337
|
}
|
|
1338
|
-
n.util.setLanguage(
|
|
1339
|
-
var
|
|
1340
|
-
|
|
1338
|
+
n.util.setLanguage(w, e), n.util.setLanguage(p, e);
|
|
1339
|
+
var s = n.plugins.autoloader;
|
|
1340
|
+
s && s.loadLanguages(e), R(
|
|
1341
1341
|
t,
|
|
1342
|
-
function(
|
|
1343
|
-
p.setAttribute(
|
|
1344
|
-
var
|
|
1345
|
-
if (
|
|
1346
|
-
var b =
|
|
1347
|
-
|
|
1348
|
-
`), p.hasAttribute("data-start") || p.setAttribute("data-start", String(
|
|
1342
|
+
function(a) {
|
|
1343
|
+
p.setAttribute(o, m);
|
|
1344
|
+
var u = L(p.getAttribute("data-range"));
|
|
1345
|
+
if (u) {
|
|
1346
|
+
var b = a.split(/\r\n?|\n/g), c = u[0], _ = u[1] == null ? b.length : u[1];
|
|
1347
|
+
c < 0 && (c += b.length), c = Math.max(0, Math.min(c - 1, b.length)), _ < 0 && (_ += b.length), _ = Math.max(0, Math.min(_, b.length)), a = b.slice(c, _).join(`
|
|
1348
|
+
`), p.hasAttribute("data-start") || p.setAttribute("data-start", String(c + 1));
|
|
1349
1349
|
}
|
|
1350
|
-
|
|
1350
|
+
w.textContent = a, n.highlightElement(w);
|
|
1351
1351
|
},
|
|
1352
|
-
function(
|
|
1353
|
-
p.setAttribute(
|
|
1352
|
+
function(a) {
|
|
1353
|
+
p.setAttribute(o, I), w.textContent = a;
|
|
1354
1354
|
}
|
|
1355
1355
|
);
|
|
1356
1356
|
}
|
|
@@ -1363,7 +1363,7 @@ var ge = { exports: {} };
|
|
|
1363
1363
|
* @param {ParentNode} [container=document]
|
|
1364
1364
|
*/
|
|
1365
1365
|
highlight: function(p) {
|
|
1366
|
-
for (var
|
|
1366
|
+
for (var w = (p || document).querySelectorAll(N), t = 0, e; e = w[t++]; )
|
|
1367
1367
|
n.highlightElement(e);
|
|
1368
1368
|
}
|
|
1369
1369
|
};
|
|
@@ -1373,8 +1373,8 @@ var ge = { exports: {} };
|
|
|
1373
1373
|
};
|
|
1374
1374
|
}();
|
|
1375
1375
|
})(ge);
|
|
1376
|
-
var
|
|
1377
|
-
const re = /* @__PURE__ */
|
|
1376
|
+
var Pe = ge.exports;
|
|
1377
|
+
const re = /* @__PURE__ */ De(Pe);
|
|
1378
1378
|
Prism.languages.clike = {
|
|
1379
1379
|
comment: [
|
|
1380
1380
|
{
|
|
@@ -2186,8 +2186,8 @@ Prism.languages.sql = {
|
|
|
2186
2186
|
"operator",
|
|
2187
2187
|
"punctuation",
|
|
2188
2188
|
"number"
|
|
2189
|
-
],
|
|
2190
|
-
|
|
2189
|
+
], A = l.variable[1].inside, k = 0; k < h.length; k++)
|
|
2190
|
+
A[h[k]] = i.languages.bash[h[k]];
|
|
2191
2191
|
i.languages.sh = i.languages.bash, i.languages.shell = i.languages.bash;
|
|
2192
2192
|
})(Prism);
|
|
2193
2193
|
Prism.languages.json = {
|
|
@@ -2215,7 +2215,13 @@ Prism.languages.json = {
|
|
|
2215
2215
|
}
|
|
2216
2216
|
};
|
|
2217
2217
|
Prism.languages.webmanifest = Prism.languages.json;
|
|
2218
|
-
const
|
|
2218
|
+
const $e = `
|
|
2219
|
+
/* 默认代码颜色 */
|
|
2220
|
+
.hep-cr-editor .hep-cr-highlight code,
|
|
2221
|
+
.hep-cr-editor .hep-cr-highlight pre {
|
|
2222
|
+
color: #f8f8f2 !important;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2219
2225
|
.hep-cr-editor .token.comment,
|
|
2220
2226
|
.hep-cr-editor .token.prolog,
|
|
2221
2227
|
.hep-cr-editor .token.doctype,
|
|
@@ -2235,6 +2241,12 @@ const Pe = `
|
|
|
2235
2241
|
color: #f92672 !important;
|
|
2236
2242
|
}
|
|
2237
2243
|
|
|
2244
|
+
/* console 单独处理 - 必须是白色 */
|
|
2245
|
+
.hep-cr-editor .token.property.console,
|
|
2246
|
+
.hep-cr-editor .token.console {
|
|
2247
|
+
color: #f8f8f2 !important;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2238
2250
|
.hep-cr-editor .token.boolean,
|
|
2239
2251
|
.hep-cr-editor .token.number {
|
|
2240
2252
|
color: #ae81ff !important;
|
|
@@ -2274,7 +2286,28 @@ const Pe = `
|
|
|
2274
2286
|
.hep-cr-editor .token.important {
|
|
2275
2287
|
color: #fd971f !important;
|
|
2276
2288
|
}
|
|
2277
|
-
|
|
2289
|
+
|
|
2290
|
+
/* 覆盖用户项目的 text-shadow 样式,避免白边 */
|
|
2291
|
+
.hep-cr-editor code[class*="language-"],
|
|
2292
|
+
.hep-cr-editor pre[class*="language-"],
|
|
2293
|
+
.hep-cr-editor .hep-cr-highlight code,
|
|
2294
|
+
.hep-cr-editor .hep-cr-highlight pre {
|
|
2295
|
+
text-shadow: none !important;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
/* 覆盖 console 等内置对象 - 使用最高特异性 */
|
|
2299
|
+
.hep-cr-editor .hep-cr-highlight .token.console,
|
|
2300
|
+
.hep-cr-editor code.token.console,
|
|
2301
|
+
.hep-cr-editor .token.console {
|
|
2302
|
+
color: #f8f8f2 !important;
|
|
2303
|
+
}
|
|
2304
|
+
`, Me = `
|
|
2305
|
+
/* 默认代码颜色 */
|
|
2306
|
+
.hep-cr-editor .hep-cr-highlight code,
|
|
2307
|
+
.hep-cr-editor .hep-cr-highlight pre {
|
|
2308
|
+
color: #333 !important;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2278
2311
|
.hep-cr-editor .token.comment,
|
|
2279
2312
|
.hep-cr-editor .token.prolog,
|
|
2280
2313
|
.hep-cr-editor .token.doctype,
|
|
@@ -2332,7 +2365,20 @@ const Pe = `
|
|
|
2332
2365
|
.hep-cr-editor .token.important {
|
|
2333
2366
|
color: #e36209;
|
|
2334
2367
|
}
|
|
2335
|
-
|
|
2368
|
+
|
|
2369
|
+
/* 覆盖用户项目的 text-shadow 样式,避免白边 */
|
|
2370
|
+
.hep-cr-editor code[class*="language-"],
|
|
2371
|
+
.hep-cr-editor pre[class*="language-"],
|
|
2372
|
+
.hep-cr-editor .hep-cr-highlight code,
|
|
2373
|
+
.hep-cr-editor .hep-cr-highlight pre {
|
|
2374
|
+
text-shadow: none !important;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
/* 覆盖 console 等内置对象 */
|
|
2378
|
+
.hep-cr-editor .token.console {
|
|
2379
|
+
color: #333 !important;
|
|
2380
|
+
}
|
|
2381
|
+
`, Ue = ["innerHTML"], He = ["value", "disabled"], Be = /* @__PURE__ */ ie({
|
|
2336
2382
|
__name: "CodeEditor",
|
|
2337
2383
|
props: {
|
|
2338
2384
|
modelValue: {},
|
|
@@ -2347,12 +2393,12 @@ const Pe = `
|
|
|
2347
2393
|
})), typeof window < "u" && (window.Prism = re);
|
|
2348
2394
|
function n(g) {
|
|
2349
2395
|
if (typeof document > "u") return;
|
|
2350
|
-
const p = "hep-cr-prism-styles",
|
|
2351
|
-
|
|
2396
|
+
const p = "hep-cr-prism-styles", w = document.getElementById(p), t = g === "dark" ? $e : Me;
|
|
2397
|
+
w && w.remove();
|
|
2352
2398
|
const e = document.createElement("style");
|
|
2353
2399
|
e.id = p, e.textContent = t, document.head.appendChild(e);
|
|
2354
2400
|
}
|
|
2355
|
-
const l = i, h = d,
|
|
2401
|
+
const l = i, h = d, A = O(null), k = O(null), o = {
|
|
2356
2402
|
javascript: "javascript",
|
|
2357
2403
|
js: "javascript",
|
|
2358
2404
|
typescript: "typescript",
|
|
@@ -2383,60 +2429,60 @@ const Pe = `
|
|
|
2383
2429
|
yml: "yaml",
|
|
2384
2430
|
markdown: "markdown",
|
|
2385
2431
|
md: "markdown"
|
|
2386
|
-
}, f =
|
|
2432
|
+
}, f = B(() => o[l.language.toLowerCase()] || "javascript"), m = B(() => l.theme === "dark" ? "#1e1e1e" : "#fafafa"), I = B(() => {
|
|
2387
2433
|
try {
|
|
2388
2434
|
const g = re.languages[f.value];
|
|
2389
2435
|
if (g)
|
|
2390
2436
|
return re.highlight(l.modelValue || "", g, f.value);
|
|
2391
2437
|
} catch {
|
|
2392
2438
|
}
|
|
2393
|
-
return
|
|
2439
|
+
return N(l.modelValue || "");
|
|
2394
2440
|
});
|
|
2395
|
-
function
|
|
2441
|
+
function N(g) {
|
|
2396
2442
|
const p = document.createElement("div");
|
|
2397
2443
|
return p.textContent = g, p.innerHTML;
|
|
2398
2444
|
}
|
|
2399
|
-
function
|
|
2445
|
+
function R(g) {
|
|
2400
2446
|
const p = g.target;
|
|
2401
2447
|
h("update:modelValue", p.value);
|
|
2402
2448
|
}
|
|
2403
|
-
function
|
|
2404
|
-
|
|
2449
|
+
function L() {
|
|
2450
|
+
A.value && k.value && (k.value.scrollTop = A.value.scrollTop, k.value.scrollLeft = A.value.scrollLeft);
|
|
2405
2451
|
}
|
|
2406
2452
|
function D(g) {
|
|
2407
2453
|
if (g.key === "Tab") {
|
|
2408
2454
|
g.preventDefault();
|
|
2409
|
-
const p = g.target,
|
|
2410
|
-
p.value = e.substring(0,
|
|
2455
|
+
const p = g.target, w = p.selectionStart, t = p.selectionEnd, e = p.value;
|
|
2456
|
+
p.value = e.substring(0, w) + " " + e.substring(t), p.selectionStart = p.selectionEnd = w + 2, h("update:modelValue", p.value);
|
|
2411
2457
|
}
|
|
2412
2458
|
}
|
|
2413
2459
|
return pe(() => {
|
|
2414
2460
|
n(l.theme);
|
|
2415
2461
|
}), le(() => l.theme, (g) => {
|
|
2416
2462
|
n(g);
|
|
2417
|
-
}), (g, p) => (
|
|
2418
|
-
class:
|
|
2463
|
+
}), (g, p) => (T(), x("div", {
|
|
2464
|
+
class: G(["hep-cr-editor", `hep-cr-theme-${i.theme}`])
|
|
2419
2465
|
}, [
|
|
2420
2466
|
E("pre", {
|
|
2421
2467
|
ref_key: "highlightRef",
|
|
2422
|
-
ref:
|
|
2423
|
-
class:
|
|
2468
|
+
ref: k,
|
|
2469
|
+
class: G(["hep-cr-highlight", [`language-${f.value}`, `hep-cr-prism-${i.theme}`]]),
|
|
2424
2470
|
"aria-hidden": "true"
|
|
2425
2471
|
}, [
|
|
2426
|
-
E("code", { innerHTML:
|
|
2472
|
+
E("code", { innerHTML: I.value }, null, 8, Ue)
|
|
2427
2473
|
], 2),
|
|
2428
2474
|
E("textarea", {
|
|
2429
2475
|
ref_key: "codeRef",
|
|
2430
|
-
ref:
|
|
2476
|
+
ref: A,
|
|
2431
2477
|
class: "hep-cr-input",
|
|
2432
2478
|
value: i.modelValue,
|
|
2433
2479
|
disabled: i.disabled,
|
|
2434
|
-
onInput:
|
|
2435
|
-
onScroll:
|
|
2480
|
+
onInput: R,
|
|
2481
|
+
onScroll: L,
|
|
2436
2482
|
onKeydown: D,
|
|
2437
2483
|
spellcheck: "false",
|
|
2438
2484
|
placeholder: "Write your code here..."
|
|
2439
|
-
}, null, 40,
|
|
2485
|
+
}, null, 40, He)
|
|
2440
2486
|
], 2));
|
|
2441
2487
|
}
|
|
2442
2488
|
}), he = (i, d) => {
|
|
@@ -2444,25 +2490,63 @@ const Pe = `
|
|
|
2444
2490
|
for (const [l, h] of d)
|
|
2445
2491
|
n[l] = h;
|
|
2446
2492
|
return n;
|
|
2447
|
-
},
|
|
2493
|
+
}, Ge = /* @__PURE__ */ he(Be, [["__scopeId", "data-v-bf752fa5"]]), ze = { class: "hep-cr-header" }, je = { class: "hep-cr-controls" }, We = ["disabled"], Ve = {
|
|
2448
2494
|
key: 0,
|
|
2449
2495
|
value: ""
|
|
2450
|
-
},
|
|
2496
|
+
}, Ye = ["value"], Xe = { class: "hep-cr-actions" }, Ze = ["disabled"], Ke = {
|
|
2451
2497
|
key: 0,
|
|
2452
2498
|
class: "hep-cr-spinner"
|
|
2453
|
-
},
|
|
2499
|
+
}, qe = {
|
|
2454
2500
|
key: 1,
|
|
2455
2501
|
class: "hep-cr-run-icon"
|
|
2456
|
-
},
|
|
2502
|
+
}, Je = ["title"], Qe = {
|
|
2503
|
+
key: 0,
|
|
2504
|
+
width: "16",
|
|
2505
|
+
height: "16",
|
|
2506
|
+
viewBox: "0 0 24 24",
|
|
2507
|
+
fill: "none",
|
|
2508
|
+
stroke: "currentColor",
|
|
2509
|
+
"stroke-width": "2"
|
|
2510
|
+
}, et = {
|
|
2511
|
+
key: 1,
|
|
2512
|
+
width: "16",
|
|
2513
|
+
height: "16",
|
|
2514
|
+
viewBox: "0 0 24 24",
|
|
2515
|
+
fill: "none",
|
|
2516
|
+
stroke: "currentColor",
|
|
2517
|
+
"stroke-width": "2"
|
|
2518
|
+
}, tt = {
|
|
2457
2519
|
key: 0,
|
|
2458
2520
|
class: "hep-cr-error"
|
|
2459
|
-
},
|
|
2521
|
+
}, nt = { class: "hep-cr-main" }, at = { class: "hep-cr-panel-header" }, rt = { class: "hep-cr-output-actions" }, ot = { class: "hep-cr-language-badge" }, st = ["disabled", "title"], it = {
|
|
2522
|
+
key: 0,
|
|
2523
|
+
width: "14",
|
|
2524
|
+
height: "14",
|
|
2525
|
+
viewBox: "0 0 24 24",
|
|
2526
|
+
fill: "none",
|
|
2527
|
+
stroke: "currentColor",
|
|
2528
|
+
"stroke-width": "2"
|
|
2529
|
+
}, lt = {
|
|
2530
|
+
key: 1,
|
|
2531
|
+
class: "hep-cr-copied-text"
|
|
2532
|
+
}, ut = { class: "hep-cr-panel-header" }, ct = { class: "hep-cr-output-tabs" }, dt = { class: "hep-cr-output-actions" }, pt = {
|
|
2460
2533
|
key: 0,
|
|
2461
2534
|
class: "hep-cr-execution-time"
|
|
2462
|
-
},
|
|
2535
|
+
}, gt = ["disabled", "title"], ht = {
|
|
2536
|
+
key: 0,
|
|
2537
|
+
width: "14",
|
|
2538
|
+
height: "14",
|
|
2539
|
+
viewBox: "0 0 24 24",
|
|
2540
|
+
fill: "none",
|
|
2541
|
+
stroke: "currentColor",
|
|
2542
|
+
"stroke-width": "2"
|
|
2543
|
+
}, ft = {
|
|
2544
|
+
key: 1,
|
|
2545
|
+
class: "hep-cr-copied-text"
|
|
2546
|
+
}, mt = { class: "hep-cr-output-content" }, bt = { key: 0 }, Et = {
|
|
2463
2547
|
key: 1,
|
|
2464
2548
|
class: "hep-cr-stderr"
|
|
2465
|
-
},
|
|
2549
|
+
}, vt = /* @__PURE__ */ ie({
|
|
2466
2550
|
__name: "CodeRunner",
|
|
2467
2551
|
props: {
|
|
2468
2552
|
pistonUrl: { default: "/api/piston" },
|
|
@@ -2476,179 +2560,204 @@ const Pe = `
|
|
|
2476
2560
|
},
|
|
2477
2561
|
emits: ["execute-start", "execute-end", "language-change"],
|
|
2478
2562
|
setup(i, { emit: d }) {
|
|
2479
|
-
const n = i, l = d, h =
|
|
2563
|
+
const n = i, l = d, h = O([]), A = O(n.language), k = O(n.theme), o = O(""), f = O(""), m = O(""), I = O(!1), N = O(null), R = O("stdout"), L = O(null), D = O(!1), g = O(60);
|
|
2480
2564
|
function p() {
|
|
2481
|
-
|
|
2565
|
+
k.value = k.value === "light" ? "dark" : "light";
|
|
2482
2566
|
}
|
|
2483
|
-
const
|
|
2567
|
+
const w = B(
|
|
2484
2568
|
() => new Le({ pistonUrl: n.pistonUrl })
|
|
2485
|
-
), t =
|
|
2569
|
+
), t = B(() => h.value.map((v) => ({
|
|
2486
2570
|
value: `${v.language}:${v.version}`,
|
|
2487
2571
|
label: `${v.language.charAt(0).toUpperCase() + v.language.slice(1)} ${v.version}`
|
|
2488
|
-
}))), e =
|
|
2489
|
-
const v =
|
|
2572
|
+
}))), e = B(() => {
|
|
2573
|
+
const v = A.value;
|
|
2490
2574
|
return v.includes(":") ? v.split(":")[0] : v;
|
|
2491
2575
|
});
|
|
2492
|
-
async function
|
|
2493
|
-
D.value = !0,
|
|
2576
|
+
async function r() {
|
|
2577
|
+
D.value = !0, L.value = null;
|
|
2494
2578
|
try {
|
|
2495
|
-
h.value = await
|
|
2579
|
+
h.value = await w.value.getRuntimes();
|
|
2496
2580
|
} catch (v) {
|
|
2497
|
-
|
|
2581
|
+
L.value = v instanceof Error ? v.message : "Failed to load runtimes";
|
|
2498
2582
|
} finally {
|
|
2499
2583
|
D.value = !1;
|
|
2500
2584
|
}
|
|
2501
2585
|
}
|
|
2502
|
-
le(
|
|
2503
|
-
const
|
|
2504
|
-
|
|
2586
|
+
le(A, (v) => {
|
|
2587
|
+
const S = v.includes(":") ? v.split(":")[0] : v, y = ae(S);
|
|
2588
|
+
o.value = y, l("language-change", S, y);
|
|
2505
2589
|
});
|
|
2506
|
-
async function
|
|
2507
|
-
if (!
|
|
2508
|
-
|
|
2590
|
+
async function s() {
|
|
2591
|
+
if (!I.value) {
|
|
2592
|
+
I.value = !0, f.value = "", m.value = "", N.value = null, L.value = null, R.value = "stdout", l("execute-start");
|
|
2509
2593
|
try {
|
|
2510
|
-
const v = await
|
|
2511
|
-
f.value = v.output, m.value = v.stderr,
|
|
2594
|
+
const v = await w.value.execute(e.value, o.value);
|
|
2595
|
+
f.value = v.output, m.value = v.stderr, N.value = v.executionTime || null, R.value = v.stderr ? "stderr" : "stdout", l("execute-end", v);
|
|
2512
2596
|
} catch (v) {
|
|
2513
|
-
|
|
2597
|
+
L.value = v instanceof Error ? v.message : "Execution failed", l("execute-end", {
|
|
2514
2598
|
success: !1,
|
|
2515
2599
|
output: "",
|
|
2516
|
-
stderr:
|
|
2600
|
+
stderr: L.value,
|
|
2517
2601
|
code: -1
|
|
2518
2602
|
});
|
|
2519
2603
|
} finally {
|
|
2520
|
-
|
|
2604
|
+
I.value = !1;
|
|
2521
2605
|
}
|
|
2522
2606
|
}
|
|
2523
2607
|
}
|
|
2524
|
-
|
|
2525
|
-
|
|
2608
|
+
const a = O(!1), u = O(!1);
|
|
2609
|
+
async function b() {
|
|
2610
|
+
await navigator.clipboard.writeText(o.value), a.value = !0, setTimeout(() => {
|
|
2611
|
+
a.value = !1;
|
|
2612
|
+
}, 2e3);
|
|
2526
2613
|
}
|
|
2527
2614
|
async function c() {
|
|
2528
|
-
const v =
|
|
2529
|
-
await navigator.clipboard.writeText(v)
|
|
2615
|
+
const v = R.value === "stdout" ? f.value : m.value;
|
|
2616
|
+
await navigator.clipboard.writeText(v), u.value = !0, setTimeout(() => {
|
|
2617
|
+
u.value = !1;
|
|
2618
|
+
}, 2e3);
|
|
2530
2619
|
}
|
|
2531
|
-
function
|
|
2532
|
-
|
|
2620
|
+
function _() {
|
|
2621
|
+
o.value = ae(e.value);
|
|
2533
2622
|
}
|
|
2534
|
-
let
|
|
2535
|
-
function
|
|
2536
|
-
|
|
2623
|
+
let F = !1;
|
|
2624
|
+
function $(v) {
|
|
2625
|
+
F = !0, document.addEventListener("mousemove", j), document.addEventListener("mouseup", W), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
2537
2626
|
}
|
|
2538
|
-
function
|
|
2539
|
-
if (!
|
|
2540
|
-
const
|
|
2627
|
+
function j(v) {
|
|
2628
|
+
if (!F) return;
|
|
2629
|
+
const S = document.querySelector(
|
|
2541
2630
|
".hep-cr-main"
|
|
2542
2631
|
);
|
|
2543
|
-
if (!
|
|
2544
|
-
const
|
|
2545
|
-
g.value = Math.max(20, Math.min(80,
|
|
2632
|
+
if (!S) return;
|
|
2633
|
+
const y = S.getBoundingClientRect(), C = (v.clientX - y.left) / y.width * 100;
|
|
2634
|
+
g.value = Math.max(20, Math.min(80, C));
|
|
2546
2635
|
}
|
|
2547
|
-
function
|
|
2548
|
-
|
|
2636
|
+
function W() {
|
|
2637
|
+
F = !1, document.removeEventListener("mousemove", j), document.removeEventListener("mouseup", W), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
2549
2638
|
}
|
|
2550
2639
|
pe(async () => {
|
|
2551
|
-
await
|
|
2640
|
+
await r(), o.value || (o.value = n.defaultCode || ae(A.value));
|
|
2552
2641
|
});
|
|
2553
|
-
const
|
|
2554
|
-
return (v,
|
|
2555
|
-
class:
|
|
2642
|
+
const J = B(() => `hep-cr-runner-${k.value}`);
|
|
2643
|
+
return (v, S) => (T(), x("div", {
|
|
2644
|
+
class: G(["hep-cr-runner", J.value])
|
|
2556
2645
|
}, [
|
|
2557
|
-
E("div",
|
|
2558
|
-
E("div",
|
|
2559
|
-
i.showLanguageSelector ? Ee((
|
|
2646
|
+
E("div", ze, [
|
|
2647
|
+
E("div", je, [
|
|
2648
|
+
i.showLanguageSelector ? Ee((T(), x("select", {
|
|
2560
2649
|
key: 0,
|
|
2561
|
-
"onUpdate:modelValue":
|
|
2650
|
+
"onUpdate:modelValue": S[0] || (S[0] = (y) => A.value = y),
|
|
2562
2651
|
class: "hep-cr-language-select",
|
|
2563
|
-
disabled:
|
|
2652
|
+
disabled: I.value
|
|
2564
2653
|
}, [
|
|
2565
|
-
D.value ? (
|
|
2566
|
-
(
|
|
2567
|
-
key:
|
|
2568
|
-
value:
|
|
2569
|
-
}, H(
|
|
2570
|
-
], 8,
|
|
2571
|
-
[Ae,
|
|
2572
|
-
]) :
|
|
2654
|
+
D.value ? (T(), x("option", Ve, "加载中...")) : M("", !0),
|
|
2655
|
+
(T(!0), x(ve, null, ye(t.value, (y) => (T(), x("option", {
|
|
2656
|
+
key: y.value,
|
|
2657
|
+
value: y.value
|
|
2658
|
+
}, H(y.label), 9, Ye))), 128))
|
|
2659
|
+
], 8, We)), [
|
|
2660
|
+
[Ae, A.value]
|
|
2661
|
+
]) : M("", !0)
|
|
2573
2662
|
]),
|
|
2574
|
-
E("div",
|
|
2663
|
+
E("div", Xe, [
|
|
2575
2664
|
E("button", {
|
|
2576
2665
|
class: "hep-cr-btn hep-cr-btn-run",
|
|
2577
|
-
disabled:
|
|
2578
|
-
onClick:
|
|
2666
|
+
disabled: I.value || D.value,
|
|
2667
|
+
onClick: s
|
|
2579
2668
|
}, [
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
], 8,
|
|
2583
|
-
i.showEditor && i.editable ? (
|
|
2669
|
+
I.value ? (T(), x("span", Ke)) : (T(), x("span", qe, "▶")),
|
|
2670
|
+
ke(" " + H(I.value ? "运行中..." : i.executorLabel), 1)
|
|
2671
|
+
], 8, Ze),
|
|
2672
|
+
i.showEditor && i.editable ? (T(), x("button", {
|
|
2584
2673
|
key: 0,
|
|
2585
2674
|
class: "hep-cr-btn hep-cr-btn-reset",
|
|
2586
|
-
onClick:
|
|
2587
|
-
}, " 重置 ")) :
|
|
2675
|
+
onClick: _
|
|
2676
|
+
}, " 重置 ")) : M("", !0),
|
|
2588
2677
|
E("button", {
|
|
2589
2678
|
class: "hep-cr-btn hep-cr-btn-theme",
|
|
2590
2679
|
onClick: p,
|
|
2591
|
-
title:
|
|
2592
|
-
},
|
|
2680
|
+
title: k.value === "light" ? "Switch to dark mode" : "Switch to light mode"
|
|
2681
|
+
}, [
|
|
2682
|
+
k.value === "light" ? (T(), x("svg", Qe, [...S[4] || (S[4] = [
|
|
2683
|
+
E("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }, null, -1)
|
|
2684
|
+
])])) : (T(), x("svg", et, [...S[5] || (S[5] = [
|
|
2685
|
+
Se('<circle cx="12" cy="12" r="5" data-v-00f5b2e7></circle><line x1="12" y1="1" x2="12" y2="3" data-v-00f5b2e7></line><line x1="12" y1="21" x2="12" y2="23" data-v-00f5b2e7></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" data-v-00f5b2e7></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" data-v-00f5b2e7></line><line x1="1" y1="12" x2="3" y2="12" data-v-00f5b2e7></line><line x1="21" y1="12" x2="23" y2="12" data-v-00f5b2e7></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" data-v-00f5b2e7></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" data-v-00f5b2e7></line>', 9)
|
|
2686
|
+
])]))
|
|
2687
|
+
], 8, Je)
|
|
2593
2688
|
])
|
|
2594
2689
|
]),
|
|
2595
|
-
|
|
2596
|
-
E("div",
|
|
2597
|
-
i.showEditor ? (
|
|
2690
|
+
L.value ? (T(), x("div", tt, H(L.value), 1)) : M("", !0),
|
|
2691
|
+
E("div", nt, [
|
|
2692
|
+
i.showEditor ? (T(), x("div", {
|
|
2598
2693
|
key: 0,
|
|
2599
2694
|
class: "hep-cr-editor-panel",
|
|
2600
|
-
style:
|
|
2695
|
+
style: oe({ width: g.value + "%" })
|
|
2601
2696
|
}, [
|
|
2602
|
-
E("div",
|
|
2603
|
-
|
|
2604
|
-
E("
|
|
2697
|
+
E("div", at, [
|
|
2698
|
+
S[7] || (S[7] = E("span", { class: "hep-cr-panel-title" }, "编辑器", -1)),
|
|
2699
|
+
E("div", rt, [
|
|
2700
|
+
E("span", ot, H(e.value), 1),
|
|
2701
|
+
E("button", {
|
|
2702
|
+
class: G(["hep-cr-btn-icon", { "hep-cr-btn-copied": a.value }]),
|
|
2703
|
+
disabled: a.value,
|
|
2704
|
+
onClick: b,
|
|
2705
|
+
title: a.value ? "已复制" : "复制"
|
|
2706
|
+
}, [
|
|
2707
|
+
a.value ? (T(), x("span", lt, "已复制")) : (T(), x("svg", it, [...S[6] || (S[6] = [
|
|
2708
|
+
E("rect", {
|
|
2709
|
+
x: "9",
|
|
2710
|
+
y: "9",
|
|
2711
|
+
width: "13",
|
|
2712
|
+
height: "13",
|
|
2713
|
+
rx: "2",
|
|
2714
|
+
ry: "2"
|
|
2715
|
+
}, null, -1),
|
|
2716
|
+
E("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
|
|
2717
|
+
])]))
|
|
2718
|
+
], 10, st)
|
|
2719
|
+
])
|
|
2605
2720
|
]),
|
|
2606
|
-
|
|
2607
|
-
modelValue:
|
|
2608
|
-
"onUpdate:modelValue":
|
|
2721
|
+
se(Ge, {
|
|
2722
|
+
modelValue: o.value,
|
|
2723
|
+
"onUpdate:modelValue": S[1] || (S[1] = (y) => o.value = y),
|
|
2609
2724
|
language: e.value,
|
|
2610
|
-
theme:
|
|
2611
|
-
disabled: !i.editable ||
|
|
2725
|
+
theme: k.value,
|
|
2726
|
+
disabled: !i.editable || I.value
|
|
2612
2727
|
}, null, 8, ["modelValue", "language", "theme", "disabled"])
|
|
2613
|
-
], 4)) :
|
|
2614
|
-
i.showEditor ? (
|
|
2728
|
+
], 4)) : M("", !0),
|
|
2729
|
+
i.showEditor ? (T(), x("div", {
|
|
2615
2730
|
key: 1,
|
|
2616
2731
|
class: "hep-cr-resize-handle",
|
|
2617
|
-
onMousedown:
|
|
2618
|
-
}, [...
|
|
2732
|
+
onMousedown: $
|
|
2733
|
+
}, [...S[8] || (S[8] = [
|
|
2619
2734
|
E("div", { class: "hep-cr-resize-line" }, null, -1)
|
|
2620
|
-
])], 32)) :
|
|
2735
|
+
])], 32)) : M("", !0),
|
|
2621
2736
|
E("div", {
|
|
2622
2737
|
class: "hep-cr-output-panel",
|
|
2623
|
-
style:
|
|
2738
|
+
style: oe({ width: i.showEditor ? 100 - g.value + "%" : "100%" })
|
|
2624
2739
|
}, [
|
|
2625
|
-
E("div",
|
|
2626
|
-
E("div",
|
|
2740
|
+
E("div", ut, [
|
|
2741
|
+
E("div", ct, [
|
|
2627
2742
|
E("button", {
|
|
2628
|
-
class:
|
|
2629
|
-
onClick:
|
|
2743
|
+
class: G(["hep-cr-tab", { active: R.value === "stdout" }]),
|
|
2744
|
+
onClick: S[2] || (S[2] = (y) => R.value = "stdout")
|
|
2630
2745
|
}, " 输出 ", 2),
|
|
2631
|
-
m.value ? (
|
|
2746
|
+
m.value ? (T(), x("button", {
|
|
2632
2747
|
key: 0,
|
|
2633
|
-
class:
|
|
2634
|
-
onClick:
|
|
2635
|
-
}, " 错误 ", 2)) :
|
|
2748
|
+
class: G(["hep-cr-tab", "hep-cr-tab-error", { active: R.value === "stderr" }]),
|
|
2749
|
+
onClick: S[3] || (S[3] = (y) => R.value = "stderr")
|
|
2750
|
+
}, " 错误 ", 2)) : M("", !0)
|
|
2636
2751
|
]),
|
|
2637
|
-
E("div",
|
|
2638
|
-
|
|
2752
|
+
E("div", dt, [
|
|
2753
|
+
N.value !== null ? (T(), x("span", pt, H(N.value) + "ms ", 1)) : M("", !0),
|
|
2639
2754
|
E("button", {
|
|
2640
|
-
class: "hep-cr-btn-icon",
|
|
2755
|
+
class: G(["hep-cr-btn-icon", { "hep-cr-btn-copied": u.value }]),
|
|
2756
|
+
disabled: u.value,
|
|
2641
2757
|
onClick: c,
|
|
2642
|
-
title: "复制"
|
|
2643
|
-
}, [
|
|
2644
|
-
|
|
2645
|
-
width: "14",
|
|
2646
|
-
height: "14",
|
|
2647
|
-
viewBox: "0 0 24 24",
|
|
2648
|
-
fill: "none",
|
|
2649
|
-
stroke: "currentColor",
|
|
2650
|
-
"stroke-width": "2"
|
|
2651
|
-
}, [
|
|
2758
|
+
title: u.value ? "已复制" : "复制"
|
|
2759
|
+
}, [
|
|
2760
|
+
u.value ? (T(), x("span", ft, "已复制")) : (T(), x("svg", ht, [...S[9] || (S[9] = [
|
|
2652
2761
|
E("rect", {
|
|
2653
2762
|
x: "9",
|
|
2654
2763
|
y: "9",
|
|
@@ -2656,40 +2765,23 @@ const Pe = `
|
|
|
2656
2765
|
height: "13",
|
|
2657
2766
|
rx: "2",
|
|
2658
2767
|
ry: "2"
|
|
2659
|
-
}),
|
|
2660
|
-
E("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2661
|
-
]
|
|
2662
|
-
])
|
|
2663
|
-
E("button", {
|
|
2664
|
-
class: "hep-cr-btn-icon",
|
|
2665
|
-
onClick: o,
|
|
2666
|
-
title: "清除"
|
|
2667
|
-
}, [...w[7] || (w[7] = [
|
|
2668
|
-
E("svg", {
|
|
2669
|
-
width: "14",
|
|
2670
|
-
height: "14",
|
|
2671
|
-
viewBox: "0 0 24 24",
|
|
2672
|
-
fill: "none",
|
|
2673
|
-
stroke: "currentColor",
|
|
2674
|
-
"stroke-width": "2"
|
|
2675
|
-
}, [
|
|
2676
|
-
E("polyline", { points: "3 6 5 6 21 6" }),
|
|
2677
|
-
E("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
2678
|
-
], -1)
|
|
2679
|
-
])])
|
|
2768
|
+
}, null, -1),
|
|
2769
|
+
E("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
|
|
2770
|
+
])]))
|
|
2771
|
+
], 10, gt)
|
|
2680
2772
|
])
|
|
2681
2773
|
]),
|
|
2682
|
-
E("div",
|
|
2683
|
-
|
|
2774
|
+
E("div", mt, [
|
|
2775
|
+
R.value === "stdout" ? (T(), x("pre", bt, H(I.value ? "代码执行中..." : f.value || '点击"运行"执行代码'), 1)) : (T(), x("pre", Et, H(m.value), 1))
|
|
2684
2776
|
])
|
|
2685
2777
|
], 4)
|
|
2686
2778
|
])
|
|
2687
2779
|
], 2));
|
|
2688
2780
|
}
|
|
2689
|
-
}),
|
|
2781
|
+
}), q = /* @__PURE__ */ he(vt, [["__scopeId", "data-v-00f5b2e7"]]), yt = { class: "hep-cr-dialog-header" }, At = { class: "hep-cr-dialog-title" }, kt = { class: "hep-cr-dialog-body" }, St = {
|
|
2690
2782
|
key: 0,
|
|
2691
2783
|
class: "hep-cr-dialog-footer"
|
|
2692
|
-
},
|
|
2784
|
+
}, Tt = /* @__PURE__ */ ie({
|
|
2693
2785
|
__name: "CodeRunnerDialog",
|
|
2694
2786
|
props: {
|
|
2695
2787
|
modelValue: { type: Boolean, default: !1 },
|
|
@@ -2706,39 +2798,39 @@ const Pe = `
|
|
|
2706
2798
|
},
|
|
2707
2799
|
emits: ["update:modelValue", "close"],
|
|
2708
2800
|
setup(i, { expose: d, emit: n }) {
|
|
2709
|
-
const l = i, h = n,
|
|
2801
|
+
const l = i, h = n, A = O(l.modelValue), k = B(() => l.modelValue !== void 0 ? l.modelValue : A.value);
|
|
2710
2802
|
le(
|
|
2711
2803
|
() => l.modelValue,
|
|
2712
2804
|
(m) => {
|
|
2713
|
-
m !== void 0 && (
|
|
2805
|
+
m !== void 0 && (A.value = m);
|
|
2714
2806
|
}
|
|
2715
2807
|
);
|
|
2716
|
-
function
|
|
2717
|
-
|
|
2808
|
+
function o() {
|
|
2809
|
+
A.value = !1, h("update:modelValue", !1), h("close");
|
|
2718
2810
|
}
|
|
2719
2811
|
function f(m) {
|
|
2720
|
-
m.target === m.currentTarget &&
|
|
2812
|
+
m.target === m.currentTarget && o();
|
|
2721
2813
|
}
|
|
2722
2814
|
return d({
|
|
2723
|
-
close:
|
|
2724
|
-
}), (m,
|
|
2725
|
-
|
|
2726
|
-
default:
|
|
2727
|
-
|
|
2815
|
+
close: o
|
|
2816
|
+
}), (m, I) => (T(), we(Te, { to: "body" }, [
|
|
2817
|
+
se(_e, { name: "hep-cr-dialog-fade" }, {
|
|
2818
|
+
default: xe(() => [
|
|
2819
|
+
k.value ? (T(), x("div", {
|
|
2728
2820
|
key: 0,
|
|
2729
2821
|
class: "hep-cr-dialog-overlay",
|
|
2730
2822
|
onClick: f
|
|
2731
2823
|
}, [
|
|
2732
2824
|
E("div", {
|
|
2733
2825
|
class: "hep-cr-dialog-container",
|
|
2734
|
-
style:
|
|
2826
|
+
style: oe({ width: typeof i.width == "number" ? i.width + "px" : i.width })
|
|
2735
2827
|
}, [
|
|
2736
|
-
E("div",
|
|
2737
|
-
E("h3",
|
|
2828
|
+
E("div", yt, [
|
|
2829
|
+
E("h3", At, H(i.title), 1),
|
|
2738
2830
|
E("button", {
|
|
2739
2831
|
class: "hep-cr-dialog-close",
|
|
2740
|
-
onClick:
|
|
2741
|
-
}, [...
|
|
2832
|
+
onClick: o
|
|
2833
|
+
}, [...I[0] || (I[0] = [
|
|
2742
2834
|
E("svg", {
|
|
2743
2835
|
width: "16",
|
|
2744
2836
|
height: "16",
|
|
@@ -2762,30 +2854,30 @@ const Pe = `
|
|
|
2762
2854
|
], -1)
|
|
2763
2855
|
])])
|
|
2764
2856
|
]),
|
|
2765
|
-
E("div",
|
|
2766
|
-
|
|
2857
|
+
E("div", kt, [
|
|
2858
|
+
se(q, Ie(Fe(m.$attrs)), null, 16)
|
|
2767
2859
|
]),
|
|
2768
|
-
m.$slots.footer ? (
|
|
2769
|
-
Re(m.$slots, "footer", { close:
|
|
2770
|
-
])) :
|
|
2860
|
+
m.$slots.footer ? (T(), x("div", St, [
|
|
2861
|
+
Re(m.$slots, "footer", { close: o })
|
|
2862
|
+
])) : M("", !0)
|
|
2771
2863
|
], 4)
|
|
2772
|
-
])) :
|
|
2864
|
+
])) : M("", !0)
|
|
2773
2865
|
]),
|
|
2774
2866
|
_: 3
|
|
2775
2867
|
})
|
|
2776
2868
|
]));
|
|
2777
2869
|
}
|
|
2778
2870
|
});
|
|
2779
|
-
|
|
2780
|
-
i.component("CodeRunner",
|
|
2871
|
+
q.install = (i) => {
|
|
2872
|
+
i.component("CodeRunner", q);
|
|
2781
2873
|
};
|
|
2782
|
-
const
|
|
2874
|
+
const _t = {
|
|
2783
2875
|
install(i) {
|
|
2784
|
-
i.component("CodeRunner",
|
|
2876
|
+
i.component("CodeRunner", q);
|
|
2785
2877
|
}
|
|
2786
2878
|
};
|
|
2787
2879
|
export {
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2880
|
+
q as CodeRunner,
|
|
2881
|
+
Tt as CodeRunnerDialog,
|
|
2882
|
+
_t as default
|
|
2791
2883
|
};
|