princess-python-editor 0.3.0 → 0.3.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.
package/dist/index.es.js CHANGED
@@ -1,9 +1,9 @@
1
- var Na = Object.defineProperty;
2
- var La = (s, n, a) => n in s ? Na(s, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[n] = a;
3
- var ie = (s, n, a) => La(s, typeof n != "symbol" ? n + "" : n, a);
4
- import { h as Kn, defineComponent as $a, ref as C, reactive as Jn, computed as U, onMounted as Fa, onBeforeUnmount as _a, watch as ee, nextTick as Zn, openBlock as m, createElementBlock as g, normalizeStyle as Gn, normalizeClass as le, createElementVNode as l, createVNode as V, unref as B, createCommentVNode as T, createBlock as Wn, withDirectives as J, vModelText as he, Fragment as A, renderList as te, toDisplayString as R, vModelSelect as Et, withModifiers as Yn, withKeys as Ra, createTextVNode as Wt, onScopeDispose as Ia } from "vue";
1
+ var Ta = Object.defineProperty;
2
+ var Fa = (s, n, a) => n in s ? Ta(s, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[n] = a;
3
+ var ie = (s, n, a) => Fa(s, typeof n != "symbol" ? n + "" : n, a);
4
+ import { h as Kn, defineComponent as La, ref as C, reactive as Jn, computed as U, onMounted as $a, onBeforeUnmount as Ra, watch as ee, nextTick as Zn, openBlock as p, createElementBlock as m, normalizeStyle as Gn, normalizeClass as le, createElementVNode as l, createVNode as V, unref as B, createCommentVNode as O, createBlock as Wn, withDirectives as J, vModelText as ge, Fragment as A, renderList as te, toDisplayString as _, vModelSelect as Et, withModifiers as Yn, withKeys as _a, createTextVNode as Wt, onScopeDispose as Ia } from "vue";
5
5
  import { EditorState as nn, StateEffect as Ha, StateField as Ba, Compartment as qt } from "@codemirror/state";
6
- import { EditorView as $e, keymap as Xn, lineNumbers as Ua, highlightActiveLineGutter as Aa, highlightActiveLine as Da, drawSelection as za, placeholder as ja, Decoration as rn } from "@codemirror/view";
6
+ import { EditorView as Le, keymap as Xn, lineNumbers as Ua, highlightActiveLineGutter as Aa, highlightActiveLine as Da, drawSelection as za, placeholder as ja, Decoration as rn } from "@codemirror/view";
7
7
  import { linter as Va, forceLinting as Qa } from "@codemirror/lint";
8
8
  import { autocompletion as Ka, closeBrackets as Ja, closeBracketsKeymap as Za } from "@codemirror/autocomplete";
9
9
  import { history as Ga, defaultKeymap as Wa, historyKeymap as Ya, indentWithTab as Xa } from "@codemirror/commands";
@@ -65,11 +65,11 @@ class pt {
65
65
  static define(n) {
66
66
  let a = n.props && n.props.length ? /* @__PURE__ */ Object.create(null) : ls, o = (n.top ? 1 : 0) | (n.skipped ? 2 : 0) | (n.error ? 4 : 0) | (n.name == null ? 8 : 0), i = new pt(n.name || "", a, n.id, o);
67
67
  if (n.props) {
68
- for (let p of n.props)
69
- if (Array.isArray(p) || (p = p(i)), p) {
70
- if (p[0].perNode)
68
+ for (let f of n.props)
69
+ if (Array.isArray(f) || (f = f(i)), f) {
70
+ if (f[0].perNode)
71
71
  throw new RangeError("Can't store a per-node prop on a node type");
72
- a[p[0].id] = p[1];
72
+ a[f[0].id] = f[1];
73
73
  }
74
74
  }
75
75
  return i;
@@ -133,8 +133,8 @@ class pt {
133
133
  for (let i of o.split(" "))
134
134
  a[i] = n[o];
135
135
  return (o) => {
136
- for (let i = o.prop(K.group), p = -1; p < (i ? i.length : 0); p++) {
137
- let b = a[p < 0 ? o.name : i[p]];
136
+ for (let i = o.prop(K.group), f = -1; f < (i ? i.length : 0); f++) {
137
+ let b = a[f < 0 ? o.name : i[f]];
138
138
  if (b)
139
139
  return b;
140
140
  }
@@ -173,8 +173,8 @@ class ue {
173
173
  throw new Error("Can not derive from a modified tag");
174
174
  let i = new ue(o, [], null, []);
175
175
  if (i.set.push(i), a)
176
- for (let p of a.set)
177
- i.set.push(p);
176
+ for (let f of a.set)
177
+ i.set.push(f);
178
178
  return i;
179
179
  }
180
180
  /**
@@ -190,12 +190,12 @@ class ue {
190
190
  `m1(m3(t1)`, and so on.
191
191
  */
192
192
  static defineModifier(n) {
193
- let a = new Nt(n);
194
- return (o) => o.modified.indexOf(a) > -1 ? o : Nt.get(o.base || o, o.modified.concat(a).sort((i, p) => i.id - p.id));
193
+ let a = new Tt(n);
194
+ return (o) => o.modified.indexOf(a) > -1 ? o : Tt.get(o.base || o, o.modified.concat(a).sort((i, f) => i.id - f.id));
195
195
  }
196
196
  }
197
197
  let cs = 0;
198
- class Nt {
198
+ class Tt {
199
199
  constructor(n) {
200
200
  this.name = n, this.instances = [], this.id = cs++;
201
201
  }
@@ -205,15 +205,15 @@ class Nt {
205
205
  let o = a[0].instances.find((E) => E.base == n && ds(a, E.modified));
206
206
  if (o)
207
207
  return o;
208
- let i = [], p = new ue(n.name, i, n, a);
208
+ let i = [], f = new ue(n.name, i, n, a);
209
209
  for (let E of a)
210
- E.instances.push(p);
210
+ E.instances.push(f);
211
211
  let b = ps(a);
212
212
  for (let E of n.set)
213
213
  if (!E.modified.length)
214
- for (let _ of b)
215
- i.push(Nt.get(E, _));
216
- return p;
214
+ for (let R of b)
215
+ i.push(Tt.get(E, R));
216
+ return f;
217
217
  }
218
218
  }
219
219
  function ds(s, n) {
@@ -232,8 +232,8 @@ new K({
232
232
  for (; s || n; ) {
233
233
  if (!s || n && s.depth <= n.depth ? (i = n, n = n.next) : (i = s, s = s.next), a && a.mode == i.mode && !i.context && !a.context)
234
234
  continue;
235
- let p = new an(i.tags, i.mode, i.context);
236
- a ? a.next = p : o = p, a = p;
235
+ let f = new an(i.tags, i.mode, i.context);
236
+ a ? a.next = f : o = f, a = f;
237
237
  }
238
238
  return o;
239
239
  }
@@ -258,21 +258,21 @@ class an {
258
258
  an.empty = new an([], 2, null);
259
259
  function fs(s, n) {
260
260
  let a = /* @__PURE__ */ Object.create(null);
261
- for (let p of s)
262
- if (!Array.isArray(p.tag))
263
- a[p.tag.id] = p.class;
261
+ for (let f of s)
262
+ if (!Array.isArray(f.tag))
263
+ a[f.tag.id] = f.class;
264
264
  else
265
- for (let b of p.tag)
266
- a[b.id] = p.class;
265
+ for (let b of f.tag)
266
+ a[b.id] = f.class;
267
267
  let { scope: o, all: i = null } = {};
268
268
  return {
269
- style: (p) => {
269
+ style: (f) => {
270
270
  let b = i;
271
- for (let E of p)
272
- for (let _ of E.set) {
273
- let O = a[_.id];
274
- if (O) {
275
- b = b ? b + " " + O : O;
271
+ for (let E of f)
272
+ for (let R of E.set) {
273
+ let M = a[R.id];
274
+ if (M) {
275
+ b = b ? b + " " + M : M;
276
276
  break;
277
277
  }
278
278
  }
@@ -281,7 +281,7 @@ function fs(s, n) {
281
281
  scope: o
282
282
  };
283
283
  }
284
- const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt = v(Le), Yt = v(Le), we = v(), Be = v(we), be = v(), ke = v(), sn = v(), lt = v(sn), Ot = v(), d = {
284
+ const y = ue.define, Ct = y(), Te = y(), tr = y(Te), nr = y(Te), Fe = y(), Pt = y(Fe), Yt = y(Fe), we = y(), Be = y(we), be = y(), ke = y(), sn = y(), lt = y(sn), Ot = y(), d = {
285
285
  /**
286
286
  A comment.
287
287
  */
@@ -289,23 +289,23 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
289
289
  /**
290
290
  A line [comment](#highlight.tags.comment).
291
291
  */
292
- lineComment: v(Ct),
292
+ lineComment: y(Ct),
293
293
  /**
294
294
  A block [comment](#highlight.tags.comment).
295
295
  */
296
- blockComment: v(Ct),
296
+ blockComment: y(Ct),
297
297
  /**
298
298
  A documentation [comment](#highlight.tags.comment).
299
299
  */
300
- docComment: v(Ct),
300
+ docComment: y(Ct),
301
301
  /**
302
302
  Any kind of identifier.
303
303
  */
304
- name: Ne,
304
+ name: Te,
305
305
  /**
306
306
  The [name](#highlight.tags.name) of a variable.
307
307
  */
308
- variableName: v(Ne),
308
+ variableName: y(Te),
309
309
  /**
310
310
  A type [name](#highlight.tags.name).
311
311
  */
@@ -313,7 +313,7 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
313
313
  /**
314
314
  A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
315
315
  */
316
- tagName: v(tr),
316
+ tagName: y(tr),
317
317
  /**
318
318
  A property or field [name](#highlight.tags.name).
319
319
  */
@@ -321,27 +321,27 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
321
321
  /**
322
322
  An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
323
323
  */
324
- attributeName: v(nr),
324
+ attributeName: y(nr),
325
325
  /**
326
326
  The [name](#highlight.tags.name) of a class.
327
327
  */
328
- className: v(Ne),
328
+ className: y(Te),
329
329
  /**
330
330
  A label [name](#highlight.tags.name).
331
331
  */
332
- labelName: v(Ne),
332
+ labelName: y(Te),
333
333
  /**
334
334
  A namespace [name](#highlight.tags.name).
335
335
  */
336
- namespace: v(Ne),
336
+ namespace: y(Te),
337
337
  /**
338
338
  The [name](#highlight.tags.name) of a macro.
339
339
  */
340
- macroName: v(Ne),
340
+ macroName: y(Te),
341
341
  /**
342
342
  A literal value.
343
343
  */
344
- literal: Le,
344
+ literal: Fe,
345
345
  /**
346
346
  A string [literal](#highlight.tags.literal).
347
347
  */
@@ -349,15 +349,15 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
349
349
  /**
350
350
  A documentation [string](#highlight.tags.string).
351
351
  */
352
- docString: v(Pt),
352
+ docString: y(Pt),
353
353
  /**
354
354
  A character literal (subtag of [string](#highlight.tags.string)).
355
355
  */
356
- character: v(Pt),
356
+ character: y(Pt),
357
357
  /**
358
358
  An attribute value (subtag of [string](#highlight.tags.string)).
359
359
  */
360
- attributeValue: v(Pt),
360
+ attributeValue: y(Pt),
361
361
  /**
362
362
  A number [literal](#highlight.tags.literal).
363
363
  */
@@ -365,32 +365,32 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
365
365
  /**
366
366
  An integer [number](#highlight.tags.number) literal.
367
367
  */
368
- integer: v(Yt),
368
+ integer: y(Yt),
369
369
  /**
370
370
  A floating-point [number](#highlight.tags.number) literal.
371
371
  */
372
- float: v(Yt),
372
+ float: y(Yt),
373
373
  /**
374
374
  A boolean [literal](#highlight.tags.literal).
375
375
  */
376
- bool: v(Le),
376
+ bool: y(Fe),
377
377
  /**
378
378
  Regular expression [literal](#highlight.tags.literal).
379
379
  */
380
- regexp: v(Le),
380
+ regexp: y(Fe),
381
381
  /**
382
382
  An escape [literal](#highlight.tags.literal), for example a
383
383
  backslash escape in a string.
384
384
  */
385
- escape: v(Le),
385
+ escape: y(Fe),
386
386
  /**
387
387
  A color [literal](#highlight.tags.literal).
388
388
  */
389
- color: v(Le),
389
+ color: y(Fe),
390
390
  /**
391
391
  A URL [literal](#highlight.tags.literal).
392
392
  */
393
- url: v(Le),
393
+ url: y(Fe),
394
394
  /**
395
395
  A language keyword.
396
396
  */
@@ -399,40 +399,40 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
399
399
  The [keyword](#highlight.tags.keyword) for the self or this
400
400
  object.
401
401
  */
402
- self: v(be),
402
+ self: y(be),
403
403
  /**
404
404
  The [keyword](#highlight.tags.keyword) for null.
405
405
  */
406
- null: v(be),
406
+ null: y(be),
407
407
  /**
408
408
  A [keyword](#highlight.tags.keyword) denoting some atomic value.
409
409
  */
410
- atom: v(be),
410
+ atom: y(be),
411
411
  /**
412
412
  A [keyword](#highlight.tags.keyword) that represents a unit.
413
413
  */
414
- unit: v(be),
414
+ unit: y(be),
415
415
  /**
416
416
  A modifier [keyword](#highlight.tags.keyword).
417
417
  */
418
- modifier: v(be),
418
+ modifier: y(be),
419
419
  /**
420
420
  A [keyword](#highlight.tags.keyword) that acts as an operator.
421
421
  */
422
- operatorKeyword: v(be),
422
+ operatorKeyword: y(be),
423
423
  /**
424
424
  A control-flow related [keyword](#highlight.tags.keyword).
425
425
  */
426
- controlKeyword: v(be),
426
+ controlKeyword: y(be),
427
427
  /**
428
428
  A [keyword](#highlight.tags.keyword) that defines something.
429
429
  */
430
- definitionKeyword: v(be),
430
+ definitionKeyword: y(be),
431
431
  /**
432
432
  A [keyword](#highlight.tags.keyword) related to defining or
433
433
  interfacing with modules.
434
434
  */
435
- moduleKeyword: v(be),
435
+ moduleKeyword: y(be),
436
436
  /**
437
437
  An operator.
438
438
  */
@@ -440,39 +440,39 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
440
440
  /**
441
441
  An [operator](#highlight.tags.operator) that dereferences something.
442
442
  */
443
- derefOperator: v(ke),
443
+ derefOperator: y(ke),
444
444
  /**
445
445
  Arithmetic-related [operator](#highlight.tags.operator).
446
446
  */
447
- arithmeticOperator: v(ke),
447
+ arithmeticOperator: y(ke),
448
448
  /**
449
449
  Logical [operator](#highlight.tags.operator).
450
450
  */
451
- logicOperator: v(ke),
451
+ logicOperator: y(ke),
452
452
  /**
453
453
  Bit [operator](#highlight.tags.operator).
454
454
  */
455
- bitwiseOperator: v(ke),
455
+ bitwiseOperator: y(ke),
456
456
  /**
457
457
  Comparison [operator](#highlight.tags.operator).
458
458
  */
459
- compareOperator: v(ke),
459
+ compareOperator: y(ke),
460
460
  /**
461
461
  [Operator](#highlight.tags.operator) that updates its operand.
462
462
  */
463
- updateOperator: v(ke),
463
+ updateOperator: y(ke),
464
464
  /**
465
465
  [Operator](#highlight.tags.operator) that defines something.
466
466
  */
467
- definitionOperator: v(ke),
467
+ definitionOperator: y(ke),
468
468
  /**
469
469
  Type-related [operator](#highlight.tags.operator).
470
470
  */
471
- typeOperator: v(ke),
471
+ typeOperator: y(ke),
472
472
  /**
473
473
  Control-flow [operator](#highlight.tags.operator).
474
474
  */
475
- controlOperator: v(ke),
475
+ controlOperator: y(ke),
476
476
  /**
477
477
  Program or markup punctuation.
478
478
  */
@@ -481,7 +481,7 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
481
481
  [Punctuation](#highlight.tags.punctuation) that separates
482
482
  things.
483
483
  */
484
- separator: v(sn),
484
+ separator: y(sn),
485
485
  /**
486
486
  Bracket-style [punctuation](#highlight.tags.punctuation).
487
487
  */
@@ -490,22 +490,22 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
490
490
  Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`
491
491
  tokens).
492
492
  */
493
- angleBracket: v(lt),
493
+ angleBracket: y(lt),
494
494
  /**
495
495
  Square [brackets](#highlight.tags.bracket) (usually `[` and `]`
496
496
  tokens).
497
497
  */
498
- squareBracket: v(lt),
498
+ squareBracket: y(lt),
499
499
  /**
500
500
  Parentheses (usually `(` and `)` tokens). Subtag of
501
501
  [bracket](#highlight.tags.bracket).
502
502
  */
503
- paren: v(lt),
503
+ paren: y(lt),
504
504
  /**
505
505
  Braces (usually `{` and `}` tokens). Subtag of
506
506
  [bracket](#highlight.tags.bracket).
507
507
  */
508
- brace: v(lt),
508
+ brace: y(lt),
509
509
  /**
510
510
  Content, for example plain text in XML or markup documents.
511
511
  */
@@ -517,77 +517,77 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
517
517
  /**
518
518
  A level 1 [heading](#highlight.tags.heading).
519
519
  */
520
- heading1: v(Be),
520
+ heading1: y(Be),
521
521
  /**
522
522
  A level 2 [heading](#highlight.tags.heading).
523
523
  */
524
- heading2: v(Be),
524
+ heading2: y(Be),
525
525
  /**
526
526
  A level 3 [heading](#highlight.tags.heading).
527
527
  */
528
- heading3: v(Be),
528
+ heading3: y(Be),
529
529
  /**
530
530
  A level 4 [heading](#highlight.tags.heading).
531
531
  */
532
- heading4: v(Be),
532
+ heading4: y(Be),
533
533
  /**
534
534
  A level 5 [heading](#highlight.tags.heading).
535
535
  */
536
- heading5: v(Be),
536
+ heading5: y(Be),
537
537
  /**
538
538
  A level 6 [heading](#highlight.tags.heading).
539
539
  */
540
- heading6: v(Be),
540
+ heading6: y(Be),
541
541
  /**
542
542
  A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
543
543
  */
544
- contentSeparator: v(we),
544
+ contentSeparator: y(we),
545
545
  /**
546
546
  [Content](#highlight.tags.content) that represents a list.
547
547
  */
548
- list: v(we),
548
+ list: y(we),
549
549
  /**
550
550
  [Content](#highlight.tags.content) that represents a quote.
551
551
  */
552
- quote: v(we),
552
+ quote: y(we),
553
553
  /**
554
554
  [Content](#highlight.tags.content) that is emphasized.
555
555
  */
556
- emphasis: v(we),
556
+ emphasis: y(we),
557
557
  /**
558
558
  [Content](#highlight.tags.content) that is styled strong.
559
559
  */
560
- strong: v(we),
560
+ strong: y(we),
561
561
  /**
562
562
  [Content](#highlight.tags.content) that is part of a link.
563
563
  */
564
- link: v(we),
564
+ link: y(we),
565
565
  /**
566
566
  [Content](#highlight.tags.content) that is styled as code or
567
567
  monospace.
568
568
  */
569
- monospace: v(we),
569
+ monospace: y(we),
570
570
  /**
571
571
  [Content](#highlight.tags.content) that has a strike-through
572
572
  style.
573
573
  */
574
- strikethrough: v(we),
574
+ strikethrough: y(we),
575
575
  /**
576
576
  Inserted text in a change-tracking format.
577
577
  */
578
- inserted: v(),
578
+ inserted: y(),
579
579
  /**
580
580
  Deleted text.
581
581
  */
582
- deleted: v(),
582
+ deleted: y(),
583
583
  /**
584
584
  Changed text.
585
585
  */
586
- changed: v(),
586
+ changed: y(),
587
587
  /**
588
588
  An invalid or unsyntactic element.
589
589
  */
590
- invalid: v(),
590
+ invalid: y(),
591
591
  /**
592
592
  Metadata or meta-instruction.
593
593
  */
@@ -596,17 +596,17 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
596
596
  [Metadata](#highlight.tags.meta) that applies to the entire
597
597
  document.
598
598
  */
599
- documentMeta: v(Ot),
599
+ documentMeta: y(Ot),
600
600
  /**
601
601
  [Metadata](#highlight.tags.meta) that annotates or adds
602
602
  attributes to a given syntactic element.
603
603
  */
604
- annotation: v(Ot),
604
+ annotation: y(Ot),
605
605
  /**
606
606
  Processing instruction or preprocessor directive. Subtag of
607
607
  [meta](#highlight.tags.meta).
608
608
  */
609
- processingInstruction: v(Ot),
609
+ processingInstruction: y(Ot),
610
610
  /**
611
611
  [Modifier](#highlight.Tag^defineModifier) that indicates that a
612
612
  given element is being defined. Expected to be used with the
@@ -783,28 +783,28 @@ const vs = {
783
783
  { tag: d.strikethrough, textDecoration: "line-through" },
784
784
  { tag: d.invalid, color: "var(--vpe-syn-invalid)" }
785
785
  ]);
786
- function Tt(s) {
787
- return [$e.theme(vs, { dark: s }), es(ms)];
786
+ function Nt(s) {
787
+ return [Le.theme(vs, { dark: s }), es(ms)];
788
788
  }
789
- const gs = "'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace", gr = Ha.define();
790
- function ys(s, n) {
789
+ const ys = "'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace", yr = Ha.define();
790
+ function hs(s, n) {
791
791
  const a = s.filter((o) => Number.isFinite(o) && o >= 1 && o <= n.lines).sort((o, i) => o - i);
792
792
  return rn.set(
793
793
  a.map((o) => rn.line({ class: "vpe-error-line" }).range(n.line(o).from))
794
794
  );
795
795
  }
796
- const hs = Ba.define({
796
+ const gs = Ba.define({
797
797
  create: () => rn.none,
798
798
  update: (s, n) => {
799
799
  let a = s;
800
800
  for (const o of n.effects)
801
- o.is(gr) && (a = ys(o.value, n.state.doc));
801
+ o.is(yr) && (a = hs(o.value, n.state.doc));
802
802
  return n.docChanged && (a = a.map(n.changes)), a;
803
803
  },
804
- provide: (s) => $e.decorations.from(s)
805
- }), bs = $e.theme({
804
+ provide: (s) => Le.decorations.from(s)
805
+ }), bs = Le.theme({
806
806
  "&": { height: "100%", fontSize: "13px" },
807
- ".cm-scroller": { fontFamily: gs, lineHeight: "1.65" },
807
+ ".cm-scroller": { fontFamily: ys, lineHeight: "1.65" },
808
808
  ".cm-content": { padding: "10px 0 14px" },
809
809
  ".cm-gutters": {
810
810
  borderRight: "none",
@@ -815,8 +815,8 @@ const hs = Ba.define({
815
815
  "&.cm-focused": { outline: "none" }
816
816
  });
817
817
  function ks(s, n) {
818
- const a = $e.updateListener.of((p) => {
819
- p.docChanged && n.onDocChange(p.state.doc.toString());
818
+ const a = Le.updateListener.of((f) => {
819
+ f.docChanged && n.onDocChange(f.state.doc.toString());
820
820
  }), o = Xn.of([
821
821
  {
822
822
  key: "Mod-Enter",
@@ -834,20 +834,20 @@ function ks(s, n) {
834
834
  Ga(),
835
835
  ns.of(" "),
836
836
  n.language ?? mr(),
837
- Tt(n.dark),
837
+ Nt(n.dark),
838
838
  Ka(),
839
839
  Ja(),
840
840
  rs(),
841
- $e.lineWrapping,
841
+ Le.lineWrapping,
842
842
  ja(n.placeholderText),
843
- hs,
843
+ gs,
844
844
  o,
845
845
  Xn.of([...Za, ...Wa, ...Ya, Xa]),
846
846
  ...n.extensions,
847
847
  a
848
848
  ]
849
849
  });
850
- return new $e({ state: i, parent: s });
850
+ return new Le({ state: i, parent: s });
851
851
  }
852
852
  function ws(s, n = 600) {
853
853
  return Va(
@@ -861,11 +861,11 @@ function ws(s, n = 600) {
861
861
  return [];
862
862
  }
863
863
  if (!i) return [];
864
- const p = Math.min(Math.max(Math.round(i.line) || 1, 1), a.state.doc.lines), b = a.state.doc.line(p), E = Math.min(Math.max(Math.round(i.column) || 1, 1), b.length + 1), _ = b.from + E - 1, O = Math.min(_ + 1, b.to);
864
+ const f = Math.min(Math.max(Math.round(i.line) || 1, 1), a.state.doc.lines), b = a.state.doc.line(f), E = Math.min(Math.max(Math.round(i.column) || 1, 1), b.length + 1), R = b.from + E - 1, M = Math.min(R + 1, b.to);
865
865
  return [
866
866
  {
867
- from: _,
868
- to: O,
867
+ from: R,
868
+ to: M,
869
869
  severity: "error",
870
870
  message: i.message,
871
871
  source: "python-syntax"
@@ -1224,7 +1224,7 @@ self.onmessage = async function (ev) {
1224
1224
  };
1225
1225
  `;
1226
1226
  }
1227
- const yr = "https://cdn.jsdelivr.net/pyodide/v0.27.2/full/";
1227
+ const hr = "https://cdn.jsdelivr.net/pyodide/v0.27.2/full/";
1228
1228
  class qs {
1229
1229
  constructor(n = {}) {
1230
1230
  ie(this, "status", "idle");
@@ -1239,7 +1239,7 @@ class qs {
1239
1239
  ie(this, "statusHandlers", /* @__PURE__ */ new Set());
1240
1240
  ie(this, "outputHandlers", /* @__PURE__ */ new Set());
1241
1241
  ie(this, "initErrorHandlers", /* @__PURE__ */ new Set());
1242
- this.pyodideUrl = n.pyodideUrl || yr;
1242
+ this.pyodideUrl = n.pyodideUrl || hr;
1243
1243
  }
1244
1244
  on(n, a) {
1245
1245
  if (n === "status") {
@@ -1257,22 +1257,22 @@ class qs {
1257
1257
  waitReady(n = 18e4) {
1258
1258
  const a = this.generation;
1259
1259
  return this.ensureWorker(), this.status === "ready" || this.status === "running" ? Promise.resolve() : new Promise((o, i) => {
1260
- let p = () => {
1260
+ let f = () => {
1261
1261
  }, b = () => {
1262
1262
  };
1263
1263
  const E = () => {
1264
- clearTimeout(_), p(), b();
1265
- }, _ = setTimeout(() => {
1264
+ clearTimeout(R), f(), b();
1265
+ }, R = setTimeout(() => {
1266
1266
  E(), i(new Error("Pyodide 加载超时"));
1267
1267
  }, n);
1268
- p = this.on("status", (O) => {
1268
+ f = this.on("status", (M) => {
1269
1269
  if (this.generation !== a) {
1270
1270
  E(), i(new Error("执行已被中断"));
1271
1271
  return;
1272
1272
  }
1273
- O === "ready" && (E(), o());
1274
- }), b = this.on("initError", (O) => {
1275
- E(), i(new Error(O));
1273
+ M === "ready" && (E(), o());
1274
+ }), b = this.on("initError", (M) => {
1275
+ E(), i(new Error(M));
1276
1276
  });
1277
1277
  });
1278
1278
  }
@@ -1446,8 +1446,8 @@ class qs {
1446
1446
  }
1447
1447
  send(n, a) {
1448
1448
  const o = this.ensureWorker(), i = this.chain.then(
1449
- () => new Promise((p) => {
1450
- this.pending.set(n.id, { resolve: p, onOutput: a }), o.postMessage(n);
1449
+ () => new Promise((f) => {
1450
+ this.pending.set(n.id, { resolve: f, onOutput: a }), o.postMessage(n);
1451
1451
  })
1452
1452
  );
1453
1453
  return this.chain = i.then(
@@ -1463,7 +1463,7 @@ class qs {
1463
1463
  }
1464
1464
  let Xt = null;
1465
1465
  function un(s) {
1466
- return Xt ? s != null && s.pyodideUrl && s.pyodideUrl !== yr && console.warn(
1466
+ return Xt ? s != null && s.pyodideUrl && s.pyodideUrl !== hr && console.warn(
1467
1467
  "[princess-python-editor] Pyodide 运行器已初始化,后续传入的 pyodideUrl 将被忽略。"
1468
1468
  ) : Xt = new qs(s), Xt;
1469
1469
  }
@@ -1474,64 +1474,64 @@ function Ps(s) {
1474
1474
  throw new Error("未配置文件服务端点(filesEndpoint)");
1475
1475
  return n;
1476
1476
  }
1477
- async function Ft(s, n, a, o = {}) {
1478
- var _, O;
1479
- const i = Ps(s), p = new AbortController(), b = setTimeout(() => p.abort(), o.timeoutMs ?? Cs), E = () => p.abort();
1480
- o.signal && (o.signal.aborted ? p.abort() : o.signal.addEventListener("abort", E));
1477
+ async function $t(s, n, a, o = {}) {
1478
+ var R, M;
1479
+ const i = Ps(s), f = new AbortController(), b = setTimeout(() => f.abort(), o.timeoutMs ?? Cs), E = () => f.abort();
1480
+ o.signal && (o.signal.aborted ? f.abort() : o.signal.addEventListener("abort", E));
1481
1481
  try {
1482
- const N = await fetch(i + n, {
1482
+ const T = await fetch(i + n, {
1483
1483
  ...a,
1484
1484
  headers: {
1485
1485
  "Content-Type": "application/json",
1486
1486
  ...o.headers ?? {},
1487
1487
  ...a.headers ?? {}
1488
1488
  },
1489
- signal: p.signal
1490
- }), x = await N.text();
1491
- let F = null;
1489
+ signal: f.signal
1490
+ }), x = await T.text();
1491
+ let $ = null;
1492
1492
  if (x)
1493
1493
  try {
1494
- F = JSON.parse(x);
1494
+ $ = JSON.parse(x);
1495
1495
  } catch {
1496
- throw new Error(`文件服务返回的不是合法 JSON(HTTP ${N.status})`);
1496
+ throw new Error(`文件服务返回的不是合法 JSON(HTTP ${T.status})`);
1497
1497
  }
1498
- if (!N.ok || !F || F.ok === !1)
1499
- throw new Error(((_ = F == null ? void 0 : F.error) == null ? void 0 : _.message) ?? `文件服务返回 HTTP ${N.status}`);
1500
- return F.data;
1498
+ if (!T.ok || !$ || $.ok === !1)
1499
+ throw new Error(((R = $ == null ? void 0 : $.error) == null ? void 0 : R.message) ?? `文件服务返回 HTTP ${T.status}`);
1500
+ return $.data;
1501
1501
  } finally {
1502
- clearTimeout(b), (O = o.signal) == null || O.removeEventListener("abort", E);
1502
+ clearTimeout(b), (M = o.signal) == null || M.removeEventListener("abort", E);
1503
1503
  }
1504
1504
  }
1505
1505
  function Os(s, n = {}) {
1506
- return Ft(s, "", { method: "GET" }, n);
1506
+ return $t(s, "", { method: "GET" }, n);
1507
1507
  }
1508
1508
  function Ms(s, n, a = {}) {
1509
- return Ft(
1509
+ return $t(
1510
1510
  s,
1511
1511
  "",
1512
1512
  { method: "POST", body: JSON.stringify(n) },
1513
1513
  a
1514
1514
  );
1515
1515
  }
1516
- function Ts(s, n, a = {}) {
1517
- return Ft(
1516
+ function Ns(s, n, a = {}) {
1517
+ return $t(
1518
1518
  s,
1519
1519
  `/${encodeURIComponent(n)}`,
1520
1520
  { method: "GET" },
1521
1521
  a
1522
1522
  );
1523
1523
  }
1524
- async function Ns(s, n, a = {}) {
1525
- await Ft(s, `/${encodeURIComponent(n)}`, { method: "DELETE" }, a);
1524
+ async function Ts(s, n, a = {}) {
1525
+ await $t(s, `/${encodeURIComponent(n)}`, { method: "DELETE" }, a);
1526
1526
  }
1527
- const Ls = 6e4;
1527
+ const Fs = 6e4;
1528
1528
  function cn(s) {
1529
1529
  const n = (s ?? "").trim().replace(/\/+$/, "");
1530
1530
  if (!n)
1531
1531
  throw new Error("未配置 Python 服务端点(pythonEndpoint)");
1532
1532
  return n;
1533
1533
  }
1534
- function hr(s, n) {
1534
+ function gr(s, n) {
1535
1535
  if (s && typeof s == "object") {
1536
1536
  const a = s, o = Number(a.line);
1537
1537
  return {
@@ -1544,36 +1544,36 @@ function hr(s, n) {
1544
1544
  return { type: "PythonError", message: n };
1545
1545
  }
1546
1546
  async function el(s, n, a = {}) {
1547
- var _;
1548
- const o = cn(s), i = performance.now(), p = new AbortController(), b = setTimeout(() => p.abort(), a.timeoutMs ?? Ls), E = () => p.abort();
1549
- a.signal && (a.signal.aborted ? p.abort() : a.signal.addEventListener("abort", E));
1547
+ var R;
1548
+ const o = cn(s), i = performance.now(), f = new AbortController(), b = setTimeout(() => f.abort(), a.timeoutMs ?? Fs), E = () => f.abort();
1549
+ a.signal && (a.signal.aborted ? f.abort() : a.signal.addEventListener("abort", E));
1550
1550
  try {
1551
- const O = await fetch(`${o}/run`, {
1551
+ const M = await fetch(`${o}/run`, {
1552
1552
  method: "POST",
1553
1553
  headers: {
1554
1554
  "Content-Type": "application/json",
1555
1555
  ...a.headers ?? {}
1556
1556
  },
1557
1557
  body: JSON.stringify({ code: n, stdin: a.stdin ?? "" }),
1558
- signal: p.signal
1559
- }), N = await O.text();
1558
+ signal: f.signal
1559
+ }), T = await M.text();
1560
1560
  let x = null;
1561
- if (N)
1561
+ if (T)
1562
1562
  try {
1563
- x = JSON.parse(N);
1563
+ x = JSON.parse(T);
1564
1564
  } catch {
1565
- throw new Error(`Python 服务返回的不是合法 JSON(HTTP ${O.status})`);
1565
+ throw new Error(`Python 服务返回的不是合法 JSON(HTTP ${M.status})`);
1566
1566
  }
1567
- const F = performance.now() - i;
1568
- if (!O.ok) {
1569
- const M = x == null ? void 0 : x.error, Q = typeof (M == null ? void 0 : M.message) == "string" && M.message ? M.message : `Python 服务返回 HTTP ${O.status}`;
1567
+ const $ = performance.now() - i;
1568
+ if (!M.ok) {
1569
+ const N = x == null ? void 0 : x.error, Q = typeof (N == null ? void 0 : N.message) == "string" && N.message ? N.message : `Python 服务返回 HTTP ${M.status}`;
1570
1570
  return {
1571
1571
  ok: !1,
1572
1572
  stdout: "",
1573
1573
  stderr: "",
1574
- durationMs: F,
1574
+ durationMs: $,
1575
1575
  error: {
1576
- type: typeof (M == null ? void 0 : M.type) == "string" && M.type ? M.type : `Http${O.status}`,
1576
+ type: typeof (N == null ? void 0 : N.type) == "string" && N.type ? N.type : `Http${M.status}`,
1577
1577
  message: Q
1578
1578
  }
1579
1579
  };
@@ -1583,7 +1583,7 @@ async function el(s, n, a = {}) {
1583
1583
  ok: !1,
1584
1584
  stdout: "",
1585
1585
  stderr: "",
1586
- durationMs: F,
1586
+ durationMs: $,
1587
1587
  error: { type: "BadResponse", message: "Python 服务返回内容为空" }
1588
1588
  };
1589
1589
  const q = x.ok === !0, G = Number(x.durationMs), me = Number(x.exitCode);
@@ -1592,33 +1592,33 @@ async function el(s, n, a = {}) {
1592
1592
  stdout: typeof x.stdout == "string" ? x.stdout : "",
1593
1593
  stderr: typeof x.stderr == "string" ? x.stderr : "",
1594
1594
  exitCode: Number.isFinite(me) ? Math.trunc(me) : void 0,
1595
- durationMs: Number.isFinite(G) && G >= 0 ? G : F,
1596
- error: q ? void 0 : hr(x.error, "服务端 Python 执行失败")
1595
+ durationMs: Number.isFinite(G) && G >= 0 ? G : $,
1596
+ error: q ? void 0 : gr(x.error, "服务端 Python 执行失败")
1597
1597
  };
1598
1598
  } finally {
1599
- clearTimeout(b), (_ = a.signal) == null || _.removeEventListener("abort", E);
1599
+ clearTimeout(b), (R = a.signal) == null || R.removeEventListener("abort", E);
1600
1600
  }
1601
1601
  }
1602
- function $s(s) {
1602
+ function Ls(s) {
1603
1603
  return s === "waiting" || s === "running" || s === "exited" ? s : "exited";
1604
1604
  }
1605
1605
  async function dn(s, n, a, o, i) {
1606
- var N;
1607
- const p = cn(s), b = performance.now(), E = new AbortController(), _ = setTimeout(() => E.abort(), o.timeoutMs ?? i), O = () => E.abort();
1608
- o.signal && (o.signal.aborted ? E.abort() : o.signal.addEventListener("abort", O));
1606
+ var T;
1607
+ const f = cn(s), b = performance.now(), E = new AbortController(), R = setTimeout(() => E.abort(), o.timeoutMs ?? i), M = () => E.abort();
1608
+ o.signal && (o.signal.aborted ? E.abort() : o.signal.addEventListener("abort", M));
1609
1609
  try {
1610
- const x = await fetch(p + n, {
1610
+ const x = await fetch(f + n, {
1611
1611
  ...a,
1612
1612
  headers: {
1613
1613
  "Content-Type": "application/json",
1614
1614
  ...o.headers ?? {}
1615
1615
  },
1616
1616
  signal: E.signal
1617
- }), F = await x.text();
1617
+ }), $ = await x.text();
1618
1618
  let q = null;
1619
- if (F)
1619
+ if ($)
1620
1620
  try {
1621
- q = JSON.parse(F);
1621
+ q = JSON.parse($);
1622
1622
  } catch {
1623
1623
  throw new Error(`Python 服务返回的不是合法 JSON(HTTP ${x.status})`);
1624
1624
  }
@@ -1637,21 +1637,21 @@ async function dn(s, n, a, o, i) {
1637
1637
  }
1638
1638
  };
1639
1639
  }
1640
- const me = Number(q.exitCode), M = Number(q.durationMs);
1640
+ const me = Number(q.exitCode), N = Number(q.durationMs);
1641
1641
  return {
1642
1642
  sessionId: typeof q.sessionId == "string" ? q.sessionId : "",
1643
- state: $s(q.state),
1643
+ state: Ls(q.state),
1644
1644
  stdout: typeof q.stdout == "string" ? q.stdout : "",
1645
1645
  stderr: typeof q.stderr == "string" ? q.stderr : "",
1646
1646
  exitCode: Number.isFinite(me) ? Math.trunc(me) : void 0,
1647
- durationMs: Number.isFinite(M) ? M : G,
1648
- error: q.error ? hr(q.error, "服务端 Python 执行失败") : void 0
1647
+ durationMs: Number.isFinite(N) ? N : G,
1648
+ error: q.error ? gr(q.error, "服务端 Python 执行失败") : void 0
1649
1649
  };
1650
1650
  } finally {
1651
- clearTimeout(_), (N = o.signal) == null || N.removeEventListener("abort", O);
1651
+ clearTimeout(R), (T = o.signal) == null || T.removeEventListener("abort", M);
1652
1652
  }
1653
1653
  }
1654
- function Fs(s, n, a = {}) {
1654
+ function $s(s, n, a = {}) {
1655
1655
  return dn(
1656
1656
  s,
1657
1657
  "/sessions",
@@ -1667,7 +1667,7 @@ function Fs(s, n, a = {}) {
1667
1667
  2e4
1668
1668
  );
1669
1669
  }
1670
- function _s(s, n, a = {}) {
1670
+ function Rs(s, n, a = {}) {
1671
1671
  return dn(
1672
1672
  s,
1673
1673
  `/sessions/${encodeURIComponent(n)}`,
@@ -1676,7 +1676,7 @@ function _s(s, n, a = {}) {
1676
1676
  5e3
1677
1677
  );
1678
1678
  }
1679
- function Rs(s, n, a, o = {}) {
1679
+ function _s(s, n, a, o = {}) {
1680
1680
  return dn(
1681
1681
  s,
1682
1682
  `/sessions/${encodeURIComponent(n)}/input`,
@@ -1709,7 +1709,7 @@ const dt = [
1709
1709
  connection: { dialect: "sqlite", database: ":memory:" },
1710
1710
  maxRows: 200,
1711
1711
  timeoutMs: 3e4
1712
- }, br = 200, Lt = 3e4;
1712
+ }, br = 200, Ft = 3e4;
1713
1713
  function Is(s) {
1714
1714
  return dt.some((n) => n.value === s);
1715
1715
  }
@@ -1724,24 +1724,24 @@ function Hs(s) {
1724
1724
  return Math.min(Math.trunc(n), 65535);
1725
1725
  }
1726
1726
  function D(s = {}) {
1727
- var p, b, E, _, O, N, x;
1728
- const n = s.mode === "http" ? "http" : "sqlite", a = (p = s.connection) == null ? void 0 : p.dialect, o = Is(a) ? a : n === "http" ? "mysql" : "sqlite", i = (b = s.connection) == null ? void 0 : b.database;
1727
+ var f, b, E, R, M, T, x;
1728
+ const n = s.mode === "http" ? "http" : "sqlite", a = (f = s.connection) == null ? void 0 : f.dialect, o = Is(a) ? a : n === "http" ? "mysql" : "sqlite", i = (b = s.connection) == null ? void 0 : b.database;
1729
1729
  return {
1730
1730
  mode: n,
1731
1731
  connectionId: s.connectionId === void 0 || s.connectionId === null ? void 0 : s.connectionId.trim() || void 0,
1732
1732
  connection: {
1733
1733
  dialect: o,
1734
1734
  host: ((E = s.connection) == null ? void 0 : E.host) ?? "",
1735
- port: Hs((_ = s.connection) == null ? void 0 : _.port),
1736
- user: ((O = s.connection) == null ? void 0 : O.user) ?? "",
1737
- password: ((N = s.connection) == null ? void 0 : N.password) ?? "",
1735
+ port: Hs((R = s.connection) == null ? void 0 : R.port),
1736
+ user: ((M = s.connection) == null ? void 0 : M.user) ?? "",
1737
+ password: ((T = s.connection) == null ? void 0 : T.password) ?? "",
1738
1738
  database: i ?? (n === "sqlite" ? ":memory:" : ""),
1739
1739
  options: (x = s.connection) != null && x.options ? { ...s.connection.options } : void 0
1740
1740
  },
1741
1741
  endpoint: s.endpoint ?? "",
1742
1742
  headers: s.headers ? { ...s.headers } : void 0,
1743
1743
  maxRows: ar(s.maxRows, br, 1, 1e5),
1744
- timeoutMs: ar(s.timeoutMs, Lt, 1e3, 6e5)
1744
+ timeoutMs: ar(s.timeoutMs, Ft, 1e3, 6e5)
1745
1745
  };
1746
1746
  }
1747
1747
  function sr(s) {
@@ -1786,19 +1786,19 @@ function or(s, n) {
1786
1786
  error: { type: "BadResponse", message: "SQL 服务返回内容为空或格式不正确" },
1787
1787
  durationMs: n
1788
1788
  };
1789
- const a = s, o = a.ok !== !1, i = Number(a.durationMs), p = Number.isFinite(i) && i >= 0 ? i : n;
1789
+ const a = s, o = a.ok !== !1, i = Number(a.durationMs), f = Number.isFinite(i) && i >= 0 ? i : n;
1790
1790
  if (!o)
1791
1791
  return {
1792
1792
  ok: !1,
1793
1793
  results: [],
1794
1794
  error: pn(a.error, "SQL 服务返回执行失败"),
1795
- durationMs: p
1795
+ durationMs: f
1796
1796
  };
1797
1797
  let b = [];
1798
1798
  return Array.isArray(a.results) ? b = a.results : (Array.isArray(a.columns) || Array.isArray(a.rows)) && (b = [a]), {
1799
1799
  ok: !0,
1800
1800
  results: b.map(on),
1801
- durationMs: p
1801
+ durationMs: f
1802
1802
  };
1803
1803
  }
1804
1804
  async function Us(s, n, a, o) {
@@ -1813,14 +1813,14 @@ async function Us(s, n, a, o) {
1813
1813
  },
1814
1814
  durationMs: 0
1815
1815
  };
1816
- const p = performance.now(), b = new AbortController();
1816
+ const f = performance.now(), b = new AbortController();
1817
1817
  let E = !1;
1818
- const _ = setTimeout(() => {
1818
+ const R = setTimeout(() => {
1819
1819
  E = !0, b.abort();
1820
- }, s.timeoutMs ?? Lt), O = () => b.abort();
1821
- o && (o.aborted ? b.abort() : o.addEventListener("abort", O));
1820
+ }, s.timeoutMs ?? Ft), M = () => b.abort();
1821
+ o && (o.aborted ? b.abort() : o.addEventListener("abort", M));
1822
1822
  try {
1823
- const N = await fetch(i, {
1823
+ const T = await fetch(i, {
1824
1824
  method: "POST",
1825
1825
  headers: { "Content-Type": "application/json", ...s.headers ?? {} },
1826
1826
  body: JSON.stringify({
@@ -1830,49 +1830,49 @@ async function Us(s, n, a, o) {
1830
1830
  maxRows: a
1831
1831
  }),
1832
1832
  signal: b.signal
1833
- }), x = await N.text();
1834
- let F = null;
1833
+ }), x = await T.text();
1834
+ let $ = null;
1835
1835
  if (x)
1836
1836
  try {
1837
- F = JSON.parse(x);
1837
+ $ = JSON.parse(x);
1838
1838
  } catch {
1839
1839
  return {
1840
1840
  ok: !1,
1841
1841
  results: [],
1842
1842
  error: {
1843
1843
  type: "BadResponse",
1844
- message: `SQL 服务返回的不是合法 JSON(HTTP ${N.status})`
1844
+ message: `SQL 服务返回的不是合法 JSON(HTTP ${T.status})`
1845
1845
  },
1846
- durationMs: performance.now() - p
1846
+ durationMs: performance.now() - f
1847
1847
  };
1848
1848
  }
1849
- if (!N.ok) {
1850
- const q = F ? or(F, performance.now() - p) : null;
1849
+ if (!T.ok) {
1850
+ const q = $ ? or($, performance.now() - f) : null;
1851
1851
  return {
1852
1852
  ok: !1,
1853
1853
  results: [],
1854
1854
  error: (q == null ? void 0 : q.error) ?? {
1855
- type: `Http${N.status}`,
1856
- message: `SQL 服务返回 HTTP ${N.status}${N.statusText ? ` ${N.statusText}` : ""}`
1855
+ type: `Http${T.status}`,
1856
+ message: `SQL 服务返回 HTTP ${T.status}${T.statusText ? ` ${T.statusText}` : ""}`
1857
1857
  },
1858
- durationMs: performance.now() - p
1858
+ durationMs: performance.now() - f
1859
1859
  };
1860
1860
  }
1861
- return or(F, performance.now() - p);
1862
- } catch (N) {
1861
+ return or($, performance.now() - f);
1862
+ } catch (T) {
1863
1863
  if (E)
1864
1864
  return {
1865
1865
  ok: !1,
1866
1866
  results: [],
1867
1867
  error: {
1868
1868
  type: "Timeout",
1869
- message: `SQL 请求超时(${s.timeoutMs ?? Lt}ms)`
1869
+ message: `SQL 请求超时(${s.timeoutMs ?? Ft}ms)`
1870
1870
  },
1871
- durationMs: performance.now() - p
1871
+ durationMs: performance.now() - f
1872
1872
  };
1873
- throw N;
1873
+ throw T;
1874
1874
  } finally {
1875
- clearTimeout(_), o == null || o.removeEventListener("abort", O);
1875
+ clearTimeout(R), o == null || o.removeEventListener("abort", M);
1876
1876
  }
1877
1877
  }
1878
1878
  function ir(s, n) {
@@ -1896,7 +1896,7 @@ function ir(s, n) {
1896
1896
  };
1897
1897
  }
1898
1898
  async function kr(s, n, a = {}) {
1899
- const o = D(s), i = o.maxRows ?? br, p = performance.now();
1899
+ const o = D(s), i = o.maxRows ?? br, f = performance.now();
1900
1900
  if (!n.trim())
1901
1901
  return {
1902
1902
  ok: !1,
@@ -1910,7 +1910,7 @@ async function kr(s, n, a = {}) {
1910
1910
  { sql: n, connection: o.connection, maxRows: i },
1911
1911
  { signal: a.signal }
1912
1912
  );
1913
- return ir(E, performance.now() - p);
1913
+ return ir(E, performance.now() - f);
1914
1914
  }
1915
1915
  if (o.mode === "http")
1916
1916
  return await Us(o, n, i, a.signal);
@@ -1919,18 +1919,18 @@ async function kr(s, n, a = {}) {
1919
1919
  database: o.connection.database || ":memory:",
1920
1920
  maxRows: i
1921
1921
  });
1922
- return ir(b, performance.now() - p);
1922
+ return ir(b, performance.now() - f);
1923
1923
  } catch (b) {
1924
1924
  return Bs(b) ? {
1925
1925
  ok: !1,
1926
1926
  results: [],
1927
1927
  error: { type: "AbortError", message: "SQL 执行已中断" },
1928
- durationMs: performance.now() - p
1928
+ durationMs: performance.now() - f
1929
1929
  } : {
1930
1930
  ok: !1,
1931
1931
  results: [],
1932
1932
  error: pn(b, "SQL 执行失败"),
1933
- durationMs: performance.now() - p
1933
+ durationMs: performance.now() - f
1934
1934
  };
1935
1935
  }
1936
1936
  }
@@ -1952,14 +1952,14 @@ async function As(s, n = {}) {
1952
1952
  };
1953
1953
  }
1954
1954
  async function fn(s, n, a, o = {}) {
1955
- var O, N;
1956
- const i = D(s), p = (i.endpoint ?? "").trim().replace(/\/+$/, "");
1957
- if (!p)
1955
+ var M, T;
1956
+ const i = D(s), f = (i.endpoint ?? "").trim().replace(/\/+$/, "");
1957
+ if (!f)
1958
1958
  throw new Error("未配置 SQL 服务端点");
1959
- const b = new AbortController(), E = setTimeout(() => b.abort(), i.timeoutMs ?? Lt), _ = () => b.abort();
1960
- o.signal && (o.signal.aborted ? b.abort() : o.signal.addEventListener("abort", _));
1959
+ const b = new AbortController(), E = setTimeout(() => b.abort(), i.timeoutMs ?? Ft), R = () => b.abort();
1960
+ o.signal && (o.signal.aborted ? b.abort() : o.signal.addEventListener("abort", R));
1961
1961
  try {
1962
- const x = await fetch(p + n, {
1962
+ const x = await fetch(f + n, {
1963
1963
  ...a,
1964
1964
  headers: {
1965
1965
  "Content-Type": "application/json",
@@ -1967,19 +1967,19 @@ async function fn(s, n, a, o = {}) {
1967
1967
  ...a.headers ?? {}
1968
1968
  },
1969
1969
  signal: b.signal
1970
- }), F = await x.text();
1970
+ }), $ = await x.text();
1971
1971
  let q = null;
1972
- if (F)
1972
+ if ($)
1973
1973
  try {
1974
- q = JSON.parse(F);
1974
+ q = JSON.parse($);
1975
1975
  } catch {
1976
1976
  throw new Error(`SQL 服务返回的不是合法 JSON(HTTP ${x.status})`);
1977
1977
  }
1978
1978
  if (!x.ok || !q || q.ok === !1)
1979
- throw new Error(((O = q == null ? void 0 : q.error) == null ? void 0 : O.message) ?? `SQL 服务返回 HTTP ${x.status}`);
1979
+ throw new Error(((M = q == null ? void 0 : q.error) == null ? void 0 : M.message) ?? `SQL 服务返回 HTTP ${x.status}`);
1980
1980
  return q.data;
1981
1981
  } finally {
1982
- clearTimeout(E), (N = o.signal) == null || N.removeEventListener("abort", _);
1982
+ clearTimeout(E), (T = o.signal) == null || T.removeEventListener("abort", R);
1983
1983
  }
1984
1984
  }
1985
1985
  function Ds(s, n = {}) {
@@ -2001,14 +2001,14 @@ async function ur(s, n, a = {}) {
2001
2001
  a
2002
2002
  );
2003
2003
  }
2004
- const $t = [
2004
+ const Lt = [
2005
2005
  { value: "python", label: "Python", extension: "py" },
2006
2006
  { value: "sql", label: "SQL", extension: "sql" },
2007
2007
  { value: "javascript", label: "JavaScript", extension: "js" },
2008
2008
  { value: "json", label: "JSON", extension: "json" }
2009
2009
  ];
2010
2010
  function Mt(s) {
2011
- return $t.find((n) => n.value === s) ?? $t[0];
2011
+ return Lt.find((n) => n.value === s) ?? Lt[0];
2012
2012
  }
2013
2013
  function en(s) {
2014
2014
  switch (s) {
@@ -2098,22 +2098,22 @@ const Vs = Z(
2098
2098
  }, no = { class: "vpe-toolbar-main" }, ro = ["title", "disabled"], ao = ["disabled"], so = ["disabled"], oo = ["title", "disabled"], io = ["title", "aria-label"], lo = { key: 2 }, uo = { key: 3 }, co = ["disabled"], po = {
2099
2099
  class: "vpe-file",
2100
2100
  title: "当前文件名(下载时使用)"
2101
- }, fo = ["value"], vo = ["value"], mo = { class: "vpe-toolbar-end" }, go = ["disabled"], yo = {
2101
+ }, fo = ["value"], vo = ["value"], mo = { class: "vpe-toolbar-end" }, yo = ["disabled"], ho = {
2102
2102
  value: "",
2103
2103
  disabled: ""
2104
- }, ho = ["value"], bo = { class: "vpe-toolbar-chips" }, ko = ["title"], wo = { class: "vpe-status-text" }, So = ["value", "disabled"], xo = ["value"], Eo = ["aria-selected", "data-file-id", "title", "onClick", "onKeydown"], qo = { class: "vpe-tab-name" }, Co = ["title", "aria-label", "disabled", "onClick"], Po = ["disabled"], Oo = { class: "vpe-output-head" }, Mo = { class: "vpe-output-main" }, To = {
2104
+ }, go = ["value"], bo = { class: "vpe-toolbar-chips" }, ko = ["title"], wo = { class: "vpe-status-text" }, So = ["value", "disabled"], xo = ["value"], Eo = ["aria-selected", "data-file-id", "title", "onClick", "onKeydown"], qo = { class: "vpe-tab-name" }, Co = ["title", "aria-label", "disabled", "onClick"], Po = ["disabled"], Oo = { class: "vpe-output-head" }, Mo = { class: "vpe-output-main" }, No = {
2105
2105
  key: 0,
2106
2106
  class: "vpe-sql-results"
2107
- }, No = { class: "vpe-sql-result-head" }, Lo = {
2107
+ }, To = { class: "vpe-sql-result-head" }, Fo = {
2108
2108
  key: 0,
2109
2109
  class: "vpe-sql-table-wrap"
2110
- }, $o = { class: "vpe-sql-table" }, Fo = {
2110
+ }, Lo = { class: "vpe-sql-table" }, $o = {
2111
2111
  key: 0,
2112
2112
  class: "vpe-sql-empty"
2113
- }, _o = {
2113
+ }, Ro = {
2114
2114
  key: 1,
2115
2115
  class: "vpe-sql-affected"
2116
- }, Ro = {
2116
+ }, _o = {
2117
2117
  key: 1,
2118
2118
  class: "vpe-empty"
2119
2119
  }, Io = {
@@ -2149,7 +2149,7 @@ const Vs = Z(
2149
2149
  class: "vpe-sql-panel",
2150
2150
  role: "dialog",
2151
2151
  "aria-label": "SQL 连接配置"
2152
- }, oi = { class: "vpe-fs-head" }, ii = { class: "vpe-fs-title" }, li = { class: "vpe-sql-body" }, ui = { class: "vpe-sql-field" }, ci = { class: "vpe-sql-field" }, di = { class: "vpe-sql-field" }, pi = { class: "vpe-sql-field" }, fi = ["value"], vi = { class: "vpe-sql-row" }, mi = { class: "vpe-sql-field vpe-sql-field--grow" }, gi = { class: "vpe-sql-field vpe-sql-field--grow" }, yi = { class: "vpe-sql-row" }, hi = { class: "vpe-sql-field vpe-sql-field--grow" }, bi = { class: "vpe-sql-field vpe-sql-field--grow" }, ki = ["placeholder"], wi = { class: "vpe-sql-field" }, Si = {
2152
+ }, oi = { class: "vpe-fs-head" }, ii = { class: "vpe-fs-title" }, li = { class: "vpe-sql-body" }, ui = { class: "vpe-sql-field" }, ci = { class: "vpe-sql-field" }, di = { class: "vpe-sql-field" }, pi = { class: "vpe-sql-field" }, fi = ["value"], vi = { class: "vpe-sql-row" }, mi = { class: "vpe-sql-field vpe-sql-field--grow" }, yi = { class: "vpe-sql-field vpe-sql-field--grow" }, hi = { class: "vpe-sql-row" }, gi = { class: "vpe-sql-field vpe-sql-field--grow" }, bi = { class: "vpe-sql-field vpe-sql-field--grow" }, ki = ["placeholder"], wi = { class: "vpe-sql-field" }, Si = {
2153
2153
  key: 0,
2154
2154
  class: "vpe-sql-field"
2155
2155
  }, xi = {
@@ -2163,16 +2163,16 @@ const Vs = Z(
2163
2163
  class: "vpe-sql-manager-panel",
2164
2164
  role: "dialog",
2165
2165
  "aria-label": "连接管理"
2166
- }, Ti = { class: "vpe-fs-head" }, Ni = ["disabled"], Li = { class: "vpe-sql-manager-body" }, $i = {
2166
+ }, Ni = { class: "vpe-fs-head" }, Ti = ["disabled"], Fi = { class: "vpe-sql-manager-body" }, Li = {
2167
2167
  key: 0,
2168
2168
  class: "vpe-fs-empty"
2169
- }, Fi = {
2169
+ }, $i = {
2170
2170
  key: 0,
2171
2171
  class: "vpe-fs-empty"
2172
- }, _i = { class: "vpe-sql-manager-main" }, Ri = ["title"], Ii = { class: "vpe-sql-manager-meta" }, Hi = ["onClick"], Bi = ["disabled", "onClick"], Ui = {
2172
+ }, Ri = { class: "vpe-sql-manager-main" }, _i = ["title"], Ii = { class: "vpe-sql-manager-meta" }, Hi = ["onClick"], Bi = ["disabled", "onClick"], Ui = {
2173
2173
  key: 1,
2174
2174
  class: "vpe-sql-hint vpe-sql-hint--error"
2175
- }, tn = 1, vr = 80, Ai = /* @__PURE__ */ $a({
2175
+ }, tn = 1, vr = 80, Ai = /* @__PURE__ */ La({
2176
2176
  __name: "PythonEditor",
2177
2177
  props: {
2178
2178
  modelValue: { default: "" },
@@ -2183,6 +2183,10 @@ const Vs = Z(
2183
2183
  readOnly: { type: Boolean, default: !1 },
2184
2184
  autofocus: { type: Boolean, default: !1 },
2185
2185
  showToolbar: { type: Boolean, default: !0 },
2186
+ showNewFile: { type: Boolean, default: !0 },
2187
+ showOpenFile: { type: Boolean, default: !0 },
2188
+ showDownload: { type: Boolean, default: !0 },
2189
+ showVirtualFiles: { type: Boolean, default: !0 },
2186
2190
  showTabs: { type: Boolean, default: !0 },
2187
2191
  showOutput: { type: Boolean, default: !0 },
2188
2192
  clearOutputOnRun: { type: Boolean, default: !0 },
@@ -2208,7 +2212,7 @@ const Vs = Z(
2208
2212
  },
2209
2213
  emits: ["update:modelValue", "ready", "statusChange", "runStart", "runOutput", "runError", "runFinish", "loadError", "update:fileName", "update:language", "update:theme", "newFile", "fileClose", "fileSwitch", "copy", "download", "fileOpen", "fsDownload", "update:sqlConfig", "update:runtime", "sqlResult", "sqlError"],
2210
2214
  setup(s, { expose: n, emit: a }) {
2211
- const o = s, i = a, p = C(), b = C(), E = C(), _ = C(), O = C(), N = C(), x = C(null), F = C(!1), q = Jn(/* @__PURE__ */ new Map()), G = U(() => fe().lines), me = U(() => fe().sqlResults), M = Jn(/* @__PURE__ */ new Map()), Q = U(() => M.get(w.value.id) ?? null), Ue = U(() => {
2215
+ const o = s, i = a, f = C(), b = C(), E = C(), R = C(), M = C(), T = C(), x = C(null), $ = C(!1), q = Jn(/* @__PURE__ */ new Map()), G = U(() => fe().lines), me = U(() => fe().sqlResults), N = Jn(/* @__PURE__ */ new Map()), Q = U(() => N.get(w.value.id) ?? null), Ue = U(() => {
2212
2216
  var e;
2213
2217
  return !!((e = Q.value) != null && e.busy);
2214
2218
  }), Ae = U(() => {
@@ -2223,36 +2227,36 @@ const Vs = Z(
2223
2227
  const t = Q.value;
2224
2228
  t && (t.input = e);
2225
2229
  }
2226
- }), k = C(null), I = C("idle"), z = C(o.theme), ce = C(o.runtime), Se = C(!1), De = C(!1), Xe = C(!1), et = C([]), xe = C(!1), ft = C(!1), tt = C([]), ze = C(""), W = C(!1), Fe = C(!1), Ee = C(!1), _e = C(!1), nt = C(""), vt = C(!1), f = C(D(o.sqlConfig)), Ce = C([]), je = C(!1), Pe = C(""), ne = C(""), re = C(!1), ae = C(""), Ve = C(!1), Re = C(!1), Qe = C(""), mt = C(!1);
2227
- let _t = !1, gt, vn = !1, Rt = !1, mn = !1, P = null, wr = 0, Sr = 0, yt = null, ht = null, It, de = null, Y = null, se = null, oe = null, xr = 0, rt = 0;
2230
+ }), k = C(null), I = C("idle"), z = C(o.theme), ce = C(o.runtime), Se = C(!1), De = C(!1), Xe = C(!1), et = C([]), xe = C(!1), ft = C(!1), tt = C([]), ze = C(""), W = C(!1), $e = C(!1), Ee = C(!1), Re = C(!1), nt = C(""), vt = C(!1), v = C(D(o.sqlConfig)), Ce = C([]), je = C(!1), Pe = C(""), ne = C(""), re = C(!1), ae = C(""), Ve = C(!1), _e = C(!1), Qe = C(""), mt = C(!1);
2231
+ let Rt = !1, yt, vn = !1, _t = !1, mn = !1, P = null, wr = 0, Sr = 0, ht = null, gt = null, It, de = null, Y = null, se = null, oe = null, xr = 0, rt = 0;
2228
2232
  function Ke(e, t, r) {
2229
2233
  return { id: ++Sr, name: e, language: t, code: r };
2230
2234
  }
2231
- const L = C([Ke(o.fileName, o.language, o.modelValue)]), qe = C(L.value[0].id), w = U(
2232
- () => L.value.find((e) => e.id === qe.value) ?? L.value[0]
2235
+ const F = C([Ke(o.fileName, o.language, o.modelValue)]), qe = C(F.value[0].id), w = U(
2236
+ () => F.value.find((e) => e.id === qe.value) ?? F.value[0]
2233
2237
  ), Ie = U({
2234
2238
  get: () => w.value.name,
2235
2239
  set: (e) => {
2236
2240
  const t = w.value;
2237
2241
  t.name !== e && (t.name = e, i("update:fileName", e));
2238
2242
  }
2239
- }), gn = new qt(), Ht = new qt(), Bt = new qt(), Ut = new qt(), j = un(o.pyodideUrl ? { pyodideUrl: o.pyodideUrl } : void 0), Er = U(() => ({
2243
+ }), yn = new qt(), Ht = new qt(), Bt = new qt(), Ut = new qt(), j = un(o.pyodideUrl ? { pyodideUrl: o.pyodideUrl } : void 0), Er = U(() => ({
2240
2244
  height: typeof o.height == "number" ? `${o.height}px` : o.height
2241
2245
  })), qr = U(() => [
2242
2246
  `vpe-theme-${z.value}`,
2243
2247
  ut(z.value) ? "vpe-dark" : ""
2244
2248
  ]);
2245
- let yn = 0, At = 0, Je = null;
2249
+ let hn = 0, At = 0, Je = null;
2246
2250
  const Cr = U(
2247
2251
  () => x.value !== null ? `${x.value}px` : typeof o.outputHeight == "number" ? `${o.outputHeight}px` : o.outputHeight
2248
- ), pe = U(() => w.value.language === "sql"), hn = U(() => w.value.language === "python"), bt = U(() => !!(o.pythonEndpoint ?? "").trim()), Ze = U(
2249
- () => hn.value && bt.value && ce.value === "server"
2250
- ), Oe = U(() => !!(o.filesEndpoint ?? "").trim()), Dt = U(() => Ue.value || Ee.value && k.value === w.value.id ? !0 : I.value === "running" && k.value === w.value.id), bn = U(() => pe.value && f.value.mode === "http" ? Ee.value && k.value === w.value.id ? "查询中" : "外部服务" : Ze.value ? Ue.value ? Ae.value ? "等待输入" : "执行中" : "服务端" : I.value === "running" && k.value !== w.value.id ? "就绪" : {
2252
+ ), pe = U(() => w.value.language === "sql"), gn = U(() => w.value.language === "python"), bt = U(() => !!(o.pythonEndpoint ?? "").trim()), Ze = U(
2253
+ () => gn.value && bt.value && ce.value === "server"
2254
+ ), Oe = U(() => !!(o.filesEndpoint ?? "").trim()), Dt = U(() => Ue.value || Ee.value && k.value === w.value.id ? !0 : I.value === "running" && k.value === w.value.id), bn = U(() => pe.value && v.value.mode === "http" ? Ee.value && k.value === w.value.id ? "查询中" : "外部服务" : Ze.value ? Ue.value ? Ae.value ? "等待输入" : "执行中" : "服务端" : I.value === "running" && k.value !== w.value.id ? "就绪" : {
2251
2255
  idle: "未加载",
2252
2256
  loading: "正在加载 Pyodide…",
2253
2257
  ready: "就绪",
2254
2258
  running: "运行中"
2255
- }[I.value]), Pr = U(() => pe.value && f.value.mode === "http" ? Ee.value && k.value === w.value.id ? "running" : "ready" : Ze.value ? Ue.value ? Ae.value ? "loading" : "running" : "ready" : I.value === "running" && k.value !== w.value.id ? "ready" : I.value), Or = U(() => pe.value ? "执行 SQL (Ctrl+Enter)" : Ze.value ? "运行(服务端 Python,Ctrl+Enter)" : w.value.language === "python" ? "运行 (Ctrl+Enter)" : "仅支持执行 Python / SQL 文件"), Mr = U(() => Dt.value ? !0 : Ze.value || pe.value ? !1 : I.value === "loading" || w.value.language !== "python"), Tr = U(() => f.value.mode === "http" ? f.value.connectionId ? "SQL 连接配置" : "新建 SQL 连接" : "SQL 连接");
2259
+ }[I.value]), Pr = U(() => pe.value && v.value.mode === "http" ? Ee.value && k.value === w.value.id ? "running" : "ready" : Ze.value ? Ue.value ? Ae.value ? "loading" : "running" : "ready" : I.value === "running" && k.value !== w.value.id ? "ready" : I.value), Or = U(() => pe.value ? "执行 SQL (Ctrl+Enter)" : Ze.value ? "运行(服务端 Python,Ctrl+Enter)" : w.value.language === "python" ? "运行 (Ctrl+Enter)" : "仅支持执行 Python / SQL 文件"), Mr = U(() => Dt.value ? !0 : Ze.value || pe.value ? !1 : I.value === "loading" || w.value.language !== "python"), Nr = U(() => v.value.mode === "http" ? v.value.connectionId ? "SQL 连接配置" : "新建 SQL 连接" : "SQL 连接");
2256
2260
  function Ge(e) {
2257
2261
  return { ...e };
2258
2262
  }
@@ -2260,16 +2264,16 @@ const Vs = Z(
2260
2264
  let t = q.get(e);
2261
2265
  return t || (t = { lines: [], sqlResults: [] }, q.set(e, t)), t;
2262
2266
  }
2263
- function ge(e, t, r) {
2267
+ function ye(e, t, r) {
2264
2268
  fe(r).lines.push({ id: ++wr, stream: e, text: t });
2265
2269
  }
2266
- function h(e, t) {
2267
- ge("system", e, t);
2270
+ function g(e, t) {
2271
+ ye("system", e, t);
2268
2272
  }
2269
- function Nr(e) {
2270
- return $t.some((t) => t.value === e);
2273
+ function Tr(e) {
2274
+ return Lt.some((t) => t.value === e);
2271
2275
  }
2272
- function Lr() {
2276
+ function Fr() {
2273
2277
  if (!o.storageKey || typeof window > "u") return null;
2274
2278
  try {
2275
2279
  const e = window.localStorage.getItem(o.storageKey);
@@ -2277,10 +2281,10 @@ const Vs = Z(
2277
2281
  const t = JSON.parse(e);
2278
2282
  if (t.version !== tn || !Array.isArray(t.files)) return null;
2279
2283
  const r = [];
2280
- for (const y of t.files) {
2281
- if (!y || typeof y.name != "string" || typeof y.code != "string" || !y.name.trim()) continue;
2282
- const S = Nr(y.language) ? y.language : "python";
2283
- r.push({ name: y.name, language: S, code: y.code });
2284
+ for (const h of t.files) {
2285
+ if (!h || typeof h.name != "string" || typeof h.code != "string" || !h.name.trim()) continue;
2286
+ const S = Tr(h.language) ? h.language : "python";
2287
+ r.push({ name: h.name, language: S, code: h.code });
2284
2288
  }
2285
2289
  if (!r.length) return null;
2286
2290
  const u = typeof t.activeIndex == "number" ? t.activeIndex : 0, c = Math.min(Math.max(Math.trunc(u) || 0, 0), r.length - 1);
@@ -2289,52 +2293,52 @@ const Vs = Z(
2289
2293
  return null;
2290
2294
  }
2291
2295
  }
2292
- function $r() {
2293
- const e = Lr();
2296
+ function Lr() {
2297
+ const e = Fr();
2294
2298
  if (!e) return;
2295
- L.value = e.files.map((r) => Ke(r.name, r.language, r.code));
2296
- const t = L.value[e.activeIndex] ?? L.value[0];
2297
- qe.value = t.id, h(`已恢复上次编辑内容(${L.value.length} 个文件)`), i("update:modelValue", t.code), i("update:fileName", t.name), i("update:language", t.language);
2299
+ F.value = e.files.map((r) => Ke(r.name, r.language, r.code));
2300
+ const t = F.value[e.activeIndex] ?? F.value[0];
2301
+ qe.value = t.id, g(`已恢复上次编辑内容(${F.value.length} 个文件)`), i("update:modelValue", t.code), i("update:fileName", t.name), i("update:language", t.language);
2298
2302
  }
2299
2303
  function kn() {
2300
- if (!(!_t || Rt || !o.storageKey || typeof window > "u"))
2304
+ if (!(!Rt || _t || !o.storageKey || typeof window > "u"))
2301
2305
  try {
2302
2306
  const e = {
2303
2307
  version: tn,
2304
- files: L.value.map((t) => ({
2308
+ files: F.value.map((t) => ({
2305
2309
  name: t.name,
2306
2310
  language: t.language,
2307
2311
  code: t.code
2308
2312
  })),
2309
2313
  activeIndex: Math.max(
2310
- L.value.findIndex((t) => t.id === qe.value),
2314
+ F.value.findIndex((t) => t.id === qe.value),
2311
2315
  0
2312
2316
  )
2313
2317
  };
2314
2318
  window.localStorage.setItem(o.storageKey, JSON.stringify(e));
2315
2319
  } catch (e) {
2316
- vn || (vn = !0, h(`本地草稿保存失败:${e instanceof Error ? e.message : String(e)}`));
2320
+ vn || (vn = !0, g(`本地草稿保存失败:${e instanceof Error ? e.message : String(e)}`));
2317
2321
  }
2318
2322
  }
2319
- function Fr() {
2320
- !_t || !o.storageKey || typeof window > "u" || (Rt = !1, window.clearTimeout(gt), gt = window.setTimeout(kn, 400));
2323
+ function $r() {
2324
+ !Rt || !o.storageKey || typeof window > "u" || (_t = !1, window.clearTimeout(yt), yt = window.setTimeout(kn, 400));
2321
2325
  }
2322
- function _r() {
2326
+ function Rr() {
2323
2327
  if (!(!o.storageKey || typeof window > "u")) {
2324
- window.clearTimeout(gt);
2328
+ window.clearTimeout(yt);
2325
2329
  try {
2326
- window.localStorage.removeItem(o.storageKey), Rt = !0, h("已清除本地草稿");
2330
+ window.localStorage.removeItem(o.storageKey), _t = !0, g("已清除本地草稿");
2327
2331
  } catch (e) {
2328
- h(`清除本地草稿失败:${e instanceof Error ? e.message : String(e)}`);
2332
+ g(`清除本地草稿失败:${e instanceof Error ? e.message : String(e)}`);
2329
2333
  }
2330
2334
  }
2331
2335
  }
2332
2336
  function Me(e) {
2333
2337
  if (!P) return;
2334
2338
  const t = e ? [e] : [];
2335
- P.dispatch({ effects: gr.of(t) });
2339
+ P.dispatch({ effects: yr.of(t) });
2336
2340
  }
2337
- function Rr() {
2341
+ function _r() {
2338
2342
  const e = o.modelValue;
2339
2343
  if (P) {
2340
2344
  e !== P.state.doc.toString() && P.dispatch({ changes: { from: 0, to: P.state.doc.length, insert: e } });
@@ -2343,7 +2347,7 @@ const Vs = Z(
2343
2347
  const t = w.value;
2344
2348
  t.code !== e && (t.code = e);
2345
2349
  }
2346
- function Te() {
2350
+ function Ne() {
2347
2351
  return P ? P.state.doc.toString() : w.value.code;
2348
2352
  }
2349
2353
  function kt(e) {
@@ -2367,7 +2371,7 @@ const Vs = Z(
2367
2371
  ]
2368
2372
  }), /^untitled(-\d+)?\.[^.]+$/.test(t.name)) {
2369
2373
  const u = `${t.name.slice(0, t.name.lastIndexOf("."))}.${Mt(e).extension}`;
2370
- L.value.some((c) => c.id !== t.id && c.name === u) || (t.name = u, i("update:fileName", u));
2374
+ F.value.some((c) => c.id !== t.id && c.name === u) || (t.name = u, i("update:fileName", u));
2371
2375
  }
2372
2376
  i("update:language", e);
2373
2377
  }
@@ -2377,19 +2381,19 @@ const Vs = Z(
2377
2381
  return /\.[^.\\/]+$/.test(u) ? u : `${u}.${Mt(t).extension}`;
2378
2382
  }
2379
2383
  function wn(e) {
2380
- const t = Mt(e).extension, r = new Set(L.value.map((y) => y.name));
2384
+ const t = Mt(e).extension, r = new Set(F.value.map((h) => h.name));
2381
2385
  let u = `untitled.${t}`, c = 2;
2382
2386
  for (; r.has(u); )
2383
2387
  u = `untitled-${c}.${t}`, c += 1;
2384
2388
  return u;
2385
2389
  }
2386
2390
  function Sn(e) {
2387
- if (!L.value.some((S) => S.name === e)) return e;
2391
+ if (!F.value.some((S) => S.name === e)) return e;
2388
2392
  const t = e.lastIndexOf("."), r = t > 0 ? e.slice(0, t) : e, u = t > 0 ? e.slice(t) : "";
2389
- let c = 2, y = `${r}-${c}${u}`;
2390
- for (; L.value.some((S) => S.name === y); )
2391
- c += 1, y = `${r}-${c}${u}`;
2392
- return y;
2393
+ let c = 2, h = `${r}-${c}${u}`;
2394
+ for (; F.value.some((S) => S.name === h); )
2395
+ c += 1, h = `${r}-${c}${u}`;
2396
+ return h;
2393
2397
  }
2394
2398
  let We = 0;
2395
2399
  function Ir(e) {
@@ -2398,54 +2402,54 @@ const Vs = Z(
2398
2402
  async function Hr() {
2399
2403
  var t;
2400
2404
  if (!o.syncFilesOnRun) return;
2401
- const e = L.value.filter((r) => r.language === "python");
2405
+ const e = F.value.filter((r) => r.language === "python");
2402
2406
  for (const r of e) {
2403
2407
  if (!Ir(r.name)) {
2404
- h(`跳过同步文件:${r.name}(文件名不能包含路径分隔符)`);
2408
+ g(`跳过同步文件:${r.name}(文件名不能包含路径分隔符)`);
2405
2409
  continue;
2406
2410
  }
2407
2411
  const u = await j.writeFile(r.name, r.code);
2408
- u.ok || h(`同步文件失败:${r.name}(${((t = u.error) == null ? void 0 : t.message) ?? "未知错误"})`);
2412
+ u.ok || g(`同步文件失败:${r.name}(${((t = u.error) == null ? void 0 : t.message) ?? "未知错误"})`);
2409
2413
  }
2410
2414
  }
2411
2415
  function at() {
2412
- Y == null || Y.abort(), Y = null, _e.value = !1, nt.value = "", vt.value = !1;
2416
+ Y == null || Y.abort(), Y = null, Re.value = !1, nt.value = "", vt.value = !1;
2413
2417
  }
2414
- function ye() {
2418
+ function he() {
2415
2419
  at(), ae.value = "";
2416
- const e = D(f.value);
2417
- f.value = e, i("update:sqlConfig", D(e));
2420
+ const e = D(v.value);
2421
+ v.value = e, i("update:sqlConfig", D(e));
2418
2422
  }
2419
2423
  function Br() {
2420
- Re.value = !1, Fe.value = !0, ve();
2424
+ _e.value = !1, $e.value = !0, ve();
2421
2425
  }
2422
2426
  function Ur() {
2423
- f.value.mode !== "http" && (f.value = D({ ...f.value, mode: "http" }), i("update:sqlConfig", D(f.value))), Fe.value = !1, Re.value = !0, Qe.value = "", mt.value = !1, ve();
2427
+ v.value.mode !== "http" && (v.value = D({ ...v.value, mode: "http" }), i("update:sqlConfig", D(v.value))), $e.value = !1, _e.value = !0, Qe.value = "", mt.value = !1, ve();
2424
2428
  }
2425
2429
  function Ar() {
2426
- const e = f.value.connection.dialect, t = e === "sqlite" ? "mysql" : e;
2427
- f.value = D({
2430
+ const e = v.value.connection.dialect, t = e === "sqlite" ? "mysql" : e;
2431
+ v.value = D({
2428
2432
  mode: "http",
2429
- endpoint: f.value.endpoint,
2430
- headers: f.value.headers,
2431
- maxRows: f.value.maxRows,
2432
- timeoutMs: f.value.timeoutMs,
2433
+ endpoint: v.value.endpoint,
2434
+ headers: v.value.headers,
2435
+ maxRows: v.value.maxRows,
2436
+ timeoutMs: v.value.timeoutMs,
2433
2437
  connection: { dialect: t, port: lr(t) }
2434
- }), ne.value = "", ae.value = "", Pe.value = "", at(), i("update:sqlConfig", D(f.value)), Re.value = !1, Fe.value = !0, ve();
2438
+ }), ne.value = "", ae.value = "", Pe.value = "", at(), i("update:sqlConfig", D(v.value)), _e.value = !1, $e.value = !0, ve();
2435
2439
  }
2436
2440
  function xn() {
2437
- Fe.value = !1;
2441
+ $e.value = !1;
2438
2442
  }
2439
2443
  function Dr() {
2440
- const e = f.value;
2441
- e.mode === "sqlite" ? (e.connectionId = void 0, e.connection.dialect = "sqlite", e.connection.database || (e.connection.database = ":memory:"), ne.value = "") : (e.connection.dialect === "sqlite" && (e.connection.dialect = "mysql", e.connection.port = lr("mysql")), e.connection.database === ":memory:" && (e.connection.database = "")), ye(), e.mode === "http" && ve();
2444
+ const e = v.value;
2445
+ e.mode === "sqlite" ? (e.connectionId = void 0, e.connection.dialect = "sqlite", e.connection.database || (e.connection.database = ":memory:"), ne.value = "") : (e.connection.dialect === "sqlite" && (e.connection.dialect = "mysql", e.connection.port = lr("mysql")), e.connection.database === ":memory:" && (e.connection.database = "")), he(), e.mode === "http" && ve();
2442
2446
  }
2443
2447
  function zr() {
2444
- const e = f.value.connection, t = dt.find((u) => u.value === e.dialect), r = dt.map((u) => u.defaultPort);
2445
- t != null && t.defaultPort && (!e.port || r.includes(e.port)) && (e.port = t.defaultPort), ye();
2448
+ const e = v.value.connection, t = dt.find((u) => u.value === e.dialect), r = dt.map((u) => u.defaultPort);
2449
+ t != null && t.defaultPort && (!e.port || r.includes(e.port)) && (e.port = t.defaultPort), he();
2446
2450
  }
2447
2451
  async function ve() {
2448
- const e = D(f.value);
2452
+ const e = D(v.value);
2449
2453
  if (!e.endpoint) {
2450
2454
  Ce.value = [], Pe.value = "";
2451
2455
  return;
@@ -2457,8 +2461,8 @@ const Vs = Z(
2457
2461
  const r = await Ds(e, { signal: t.signal });
2458
2462
  if (se !== t) return;
2459
2463
  Ce.value = r;
2460
- const u = r.find((c) => c.id === f.value.connectionId);
2461
- u ? ne.value = u.name : f.value.connectionId && (f.value.connectionId = void 0, ne.value = "");
2464
+ const u = r.find((c) => c.id === v.value.connectionId);
2465
+ u ? ne.value = u.name : v.value.connectionId && (v.value.connectionId = void 0, ne.value = "");
2462
2466
  } catch (r) {
2463
2467
  if (se !== t) return;
2464
2468
  Ce.value = [], Pe.value = r instanceof Error ? r.message : String(r);
@@ -2467,12 +2471,12 @@ const Vs = Z(
2467
2471
  }
2468
2472
  }
2469
2473
  function En(e) {
2470
- f.value = D({
2474
+ v.value = D({
2471
2475
  mode: "http",
2472
- endpoint: f.value.endpoint,
2473
- headers: f.value.headers,
2474
- maxRows: f.value.maxRows,
2475
- timeoutMs: f.value.timeoutMs,
2476
+ endpoint: v.value.endpoint,
2477
+ headers: v.value.headers,
2478
+ maxRows: v.value.maxRows,
2479
+ timeoutMs: v.value.timeoutMs,
2476
2480
  connectionId: e.id,
2477
2481
  connection: {
2478
2482
  dialect: e.dialect,
@@ -2483,19 +2487,19 @@ const Vs = Z(
2483
2487
  database: e.database ?? "",
2484
2488
  options: e.options
2485
2489
  }
2486
- }), ne.value = e.name, ae.value = "", at(), i("update:sqlConfig", D(f.value));
2490
+ }), ne.value = e.name, ae.value = "", at(), i("update:sqlConfig", D(v.value));
2487
2491
  }
2488
2492
  function jr() {
2489
- Fe.value = !1, Re.value = !1;
2490
- const e = Ce.value.find((t) => t.id === f.value.connectionId);
2493
+ $e.value = !1, _e.value = !1;
2494
+ const e = Ce.value.find((t) => t.id === v.value.connectionId);
2491
2495
  if (!e) {
2492
- f.value.connectionId = void 0, f.value.connection.password = "", ne.value = "", ye();
2496
+ v.value.connectionId = void 0, v.value.connection.password = "", ne.value = "", he();
2493
2497
  return;
2494
2498
  }
2495
2499
  En(e);
2496
2500
  }
2497
2501
  function Vr(e) {
2498
- En(e), Re.value = !1, Fe.value = !0;
2502
+ En(e), _e.value = !1, $e.value = !0;
2499
2503
  }
2500
2504
  async function Qr() {
2501
2505
  if (re.value) return;
@@ -2504,7 +2508,7 @@ const Vs = Z(
2504
2508
  Ve.value = !1, ae.value = "请先填写连接名称";
2505
2509
  return;
2506
2510
  }
2507
- const t = D(f.value), r = {
2511
+ const t = D(v.value), r = {
2508
2512
  name: e,
2509
2513
  dialect: t.connection.dialect,
2510
2514
  host: t.connection.host,
@@ -2517,11 +2521,11 @@ const Vs = Z(
2517
2521
  re.value = !0, ae.value = "";
2518
2522
  try {
2519
2523
  const u = await zs(t, r, t.connectionId);
2520
- f.value = D({
2524
+ v.value = D({
2521
2525
  ...t,
2522
2526
  connectionId: u.id,
2523
2527
  connection: { ...t.connection, password: "" }
2524
- }), ne.value = u.name, Ve.value = !0, ae.value = "连接已保存", i("update:sqlConfig", D(f.value)), await ve();
2528
+ }), ne.value = u.name, Ve.value = !0, ae.value = "连接已保存", i("update:sqlConfig", D(v.value)), await ve();
2525
2529
  } catch (u) {
2526
2530
  Ve.value = !1, ae.value = u instanceof Error ? u.message : String(u);
2527
2531
  } finally {
@@ -2529,11 +2533,11 @@ const Vs = Z(
2529
2533
  }
2530
2534
  }
2531
2535
  async function Kr() {
2532
- const e = f.value.connectionId;
2536
+ const e = v.value.connectionId;
2533
2537
  if (!(!e || re.value) && !(typeof window < "u" && !window.confirm("确定删除该连接配置?"))) {
2534
2538
  re.value = !0, ae.value = "";
2535
2539
  try {
2536
- await ur(f.value, e), f.value.connectionId = void 0, ne.value = "", Ve.value = !0, ae.value = "连接已删除", i("update:sqlConfig", D(f.value)), await ve();
2540
+ await ur(v.value, e), v.value.connectionId = void 0, ne.value = "", Ve.value = !0, ae.value = "连接已删除", i("update:sqlConfig", D(v.value)), await ve();
2537
2541
  } catch (t) {
2538
2542
  Ve.value = !1, ae.value = t instanceof Error ? t.message : String(t);
2539
2543
  } finally {
@@ -2545,7 +2549,7 @@ const Vs = Z(
2545
2549
  if (!re.value && !(typeof window < "u" && !window.confirm(`确定删除连接“${e.name}”?`))) {
2546
2550
  re.value = !0, Qe.value = "";
2547
2551
  try {
2548
- await ur(f.value, e.id), f.value.connectionId === e.id && (f.value.connectionId = void 0, f.value.connection.password = "", ne.value = "", i("update:sqlConfig", D(f.value))), mt.value = !0, Qe.value = `已删除连接“${e.name}”`, await ve();
2552
+ await ur(v.value, e.id), v.value.connectionId === e.id && (v.value.connectionId = void 0, v.value.connection.password = "", ne.value = "", i("update:sqlConfig", D(v.value))), mt.value = !0, Qe.value = `已删除连接“${e.name}”`, await ve();
2549
2553
  } catch (t) {
2550
2554
  mt.value = !1, Qe.value = t instanceof Error ? t.message : String(t);
2551
2555
  } finally {
@@ -2554,12 +2558,12 @@ const Vs = Z(
2554
2558
  }
2555
2559
  }
2556
2560
  async function Zr() {
2557
- if (_e.value) return;
2558
- at(), _e.value = !0;
2561
+ if (Re.value) return;
2562
+ at(), Re.value = !0;
2559
2563
  const e = new AbortController();
2560
2564
  Y = e;
2561
2565
  try {
2562
- const t = await As(D(f.value), {
2566
+ const t = await As(D(v.value), {
2563
2567
  executor: o.sqlExecutor,
2564
2568
  signal: e.signal
2565
2569
  });
@@ -2569,7 +2573,7 @@ const Vs = Z(
2569
2573
  if (Y !== e) return;
2570
2574
  vt.value = !1, nt.value = t instanceof Error ? t.message : String(t);
2571
2575
  } finally {
2572
- Y === e && (Y = null, _e.value = !1);
2576
+ Y === e && (Y = null, Re.value = !1);
2573
2577
  }
2574
2578
  }
2575
2579
  function Gr(e) {
@@ -2584,12 +2588,12 @@ const Vs = Z(
2584
2588
  }
2585
2589
  async function Cn() {
2586
2590
  if (Ee.value)
2587
- return k.value !== w.value.id && h("另一个 SQL 正在执行,请等待或停止后再试"), null;
2588
- const e = Te();
2591
+ return k.value !== w.value.id && g("另一个 SQL 正在执行,请等待或停止后再试"), null;
2592
+ const e = Ne();
2589
2593
  if (!e.trim())
2590
- return h("SQL 内容为空,请输入要执行的语句"), null;
2591
- const t = D(f.value), r = ++rt, u = w.value.id;
2592
- Ee.value = !0, k.value = u, de = new AbortController(), Me(void 0), o.clearOutputOnRun && (fe(u).lines = [], fe(u).sqlResults = []), h(
2594
+ return g("SQL 内容为空,请输入要执行的语句"), null;
2595
+ const t = D(v.value), r = ++rt, u = w.value.id;
2596
+ Ee.value = !0, k.value = u, de = new AbortController(), Me(void 0), o.clearOutputOnRun && (fe(u).lines = [], fe(u).sqlResults = []), g(
2593
2597
  `开始执行 SQL(${t.mode === "sqlite" ? "浏览器内 SQLite" : "HTTP 服务"})`,
2594
2598
  u
2595
2599
  ), i("runStart");
@@ -2600,14 +2604,14 @@ const Vs = Z(
2600
2604
  });
2601
2605
  if (r !== rt) return null;
2602
2606
  if (fe(u).sqlResults = c.results ?? [], c.ok) {
2603
- const y = c.results ?? [], S = y.reduce(($, X) => $ + X.rows.length, 0);
2604
- h(
2605
- `SQL 执行完成:${y.length} 个结果集,共 ${S} 行,耗时 ${(c.durationMs / 1e3).toFixed(2)}s`,
2607
+ const h = c.results ?? [], S = h.reduce((L, X) => L + X.rows.length, 0);
2608
+ g(
2609
+ `SQL 执行完成:${h.length} 个结果集,共 ${S} 行,耗时 ${(c.durationMs / 1e3).toFixed(2)}s`,
2606
2610
  u
2607
2611
  );
2608
2612
  } else {
2609
- const y = c.error ?? { type: "SqlError", message: "SQL 执行失败" };
2610
- h(`SQL 执行出错:${y.type}`, u), ge("stderr", y.message, u), i("runOutput", { stream: "stderr", text: y.message }), i("sqlError", y);
2613
+ const h = c.error ?? { type: "SqlError", message: "SQL 执行失败" };
2614
+ g(`SQL 执行出错:${h.type}`, u), ye("stderr", h.message, u), i("runOutput", { stream: "stderr", text: h.message }), i("sqlError", h);
2611
2615
  }
2612
2616
  return i("sqlResult", c), i("runFinish", {
2613
2617
  ok: c.ok,
@@ -2616,58 +2620,58 @@ const Vs = Z(
2616
2620
  }), c;
2617
2621
  } catch (c) {
2618
2622
  if (r !== rt) return null;
2619
- const y = c instanceof Error ? c.message : String(c);
2620
- h(`SQL 执行失败:${y}`, u);
2621
- const S = { type: "SqlError", message: y };
2623
+ const h = c instanceof Error ? c.message : String(c);
2624
+ g(`SQL 执行失败:${h}`, u);
2625
+ const S = { type: "SqlError", message: h };
2622
2626
  return i("sqlError", S), i("runFinish", { ok: !1, durationMs: 0, error: qn(S) }), null;
2623
2627
  } finally {
2624
2628
  r === rt && (Ee.value = !1, de = null, k.value === u && (k.value = null));
2625
2629
  }
2626
2630
  }
2627
2631
  async function Yr(e) {
2628
- return e !== void 0 && (kt(e), w.value.language !== "sql" && jt("sql")), w.value.language !== "sql" ? (h("当前文件不是 SQL,无法执行"), null) : Cn();
2632
+ return e !== void 0 && (kt(e), w.value.language !== "sql" && jt("sql")), w.value.language !== "sql" ? (g("当前文件不是 SQL,无法执行"), null) : Cn();
2629
2633
  }
2630
2634
  function Xr(e) {
2631
2635
  const t = e.target.value === "server" ? "server" : "browser";
2632
2636
  if (t === "browser")
2633
- for (const r of [...M.keys()])
2637
+ for (const r of [...N.keys()])
2634
2638
  st(r, !1);
2635
- ce.value = t, i("update:runtime", t), h(t === "server" ? "已切换到服务端 Python 环境" : "已切换到浏览器 Python 环境");
2639
+ ce.value = t, i("update:runtime", t), g(t === "server" ? "已切换到服务端 Python 环境" : "已切换到浏览器 Python 环境");
2636
2640
  }
2637
2641
  function Pn(e, t, r, u) {
2638
2642
  if (!u) return;
2639
2643
  const c = u.replace(/\r\n/g, `
2640
2644
  `);
2641
- let y = r === "stdout" ? t.stdoutBuffer : t.stderrBuffer;
2642
- y += c;
2643
- const S = y.split(`
2644
- `), $ = S.pop() ?? "";
2645
- r === "stdout" ? t.stdoutBuffer = $ : t.stderrBuffer = $;
2645
+ let h = r === "stdout" ? t.stdoutBuffer : t.stderrBuffer;
2646
+ h += c;
2647
+ const S = h.split(`
2648
+ `), L = S.pop() ?? "";
2649
+ r === "stdout" ? t.stdoutBuffer = L : t.stderrBuffer = L;
2646
2650
  for (const X of S)
2647
- ge(r, X, e), i("runOutput", { stream: r, text: X });
2651
+ ye(r, X, e), i("runOutput", { stream: r, text: X });
2648
2652
  }
2649
2653
  function On(e, t) {
2650
- t.stdoutBuffer && (ge("stdout", t.stdoutBuffer, e), i("runOutput", { stream: "stdout", text: t.stdoutBuffer }), t.stdoutBuffer = ""), t.stderrBuffer && (ge("stderr", t.stderrBuffer, e), i("runOutput", { stream: "stderr", text: t.stderrBuffer }), t.stderrBuffer = "");
2654
+ t.stdoutBuffer && (ye("stdout", t.stdoutBuffer, e), i("runOutput", { stream: "stdout", text: t.stdoutBuffer }), t.stdoutBuffer = ""), t.stderrBuffer && (ye("stderr", t.stderrBuffer, e), i("runOutput", { stream: "stderr", text: t.stderrBuffer }), t.stderrBuffer = "");
2651
2655
  }
2652
2656
  function wt(e, t, r) {
2653
2657
  window.clearTimeout(t.pollTimer), On(e, t);
2654
- const u = M.get(e);
2655
- if (u && u.token === t.token && M.delete(e), r.error) {
2656
- h(`执行出错:${r.error.type}`, e), e === w.value.id && Me(r.error.line);
2657
- const y = {
2658
+ const u = N.get(e);
2659
+ if (u && u.token === t.token && N.delete(e), r.error) {
2660
+ g(`执行出错:${r.error.type}`, e), e === w.value.id && Me(r.error.line);
2661
+ const h = {
2658
2662
  type: r.error.type,
2659
2663
  message: r.error.message,
2660
2664
  line: r.error.line,
2661
2665
  traceback: r.error.traceback ?? ""
2662
2666
  };
2663
- i("runError", y), i("runFinish", { ok: !1, durationMs: r.durationMs ?? 0, error: y });
2667
+ i("runError", h), i("runFinish", { ok: !1, durationMs: r.durationMs ?? 0, error: h });
2664
2668
  return;
2665
2669
  }
2666
2670
  const c = r.durationMs ?? 0;
2667
- h(`执行完成,会话时长 ${(c / 1e3).toFixed(2)}s`, e), i("runFinish", { ok: !0, durationMs: c });
2671
+ g(`执行完成,会话时长 ${(c / 1e3).toFixed(2)}s`, e), i("runFinish", { ok: !0, durationMs: c });
2668
2672
  }
2669
2673
  function Qt(e, t, r, u) {
2670
- const c = M.get(e);
2674
+ const c = N.get(e);
2671
2675
  if (!(!c || c.token !== u)) {
2672
2676
  if (Pn(e, t, "stdout", r.stdout), Pn(e, t, "stderr", r.stderr), r.state === "exited") {
2673
2677
  wt(e, t, r);
@@ -2687,18 +2691,18 @@ const Vs = Z(
2687
2691
  }
2688
2692
  async function ta(e, t) {
2689
2693
  var u, c;
2690
- const r = M.get(e);
2694
+ const r = N.get(e);
2691
2695
  if (!(!r || r.token !== t || !r.sessionId))
2692
2696
  try {
2693
- const y = await _s(o.pythonEndpoint, r.sessionId, {
2697
+ const h = await Rs(o.pythonEndpoint, r.sessionId, {
2694
2698
  headers: o.pythonHeaders,
2695
2699
  signal: (u = r.abort) == null ? void 0 : u.signal
2696
2700
  });
2697
- Qt(e, r, y, t);
2698
- } catch (y) {
2699
- if (((c = M.get(e)) == null ? void 0 : c.token) !== t) return;
2700
- const S = y instanceof Error ? y.message : String(y);
2701
- h(`执行失败:${S}`, e), wt(e, r, {
2701
+ Qt(e, r, h, t);
2702
+ } catch (h) {
2703
+ if (((c = N.get(e)) == null ? void 0 : c.token) !== t) return;
2704
+ const S = h instanceof Error ? h.message : String(h);
2705
+ g(`执行失败:${S}`, e), wt(e, r, {
2702
2706
  sessionId: r.sessionId,
2703
2707
  durationMs: 0,
2704
2708
  error: { type: "RuntimeError", message: S }
@@ -2706,16 +2710,16 @@ const Vs = Z(
2706
2710
  }
2707
2711
  }
2708
2712
  async function na() {
2709
- var y;
2713
+ var h;
2710
2714
  const e = w.value.id;
2711
- if ((y = M.get(e)) != null && y.busy) return;
2715
+ if ((h = N.get(e)) != null && h.busy) return;
2712
2716
  if (!bt.value) {
2713
- h("未配置 Python 服务端点(pythonEndpoint)");
2717
+ g("未配置 Python 服务端点(pythonEndpoint)");
2714
2718
  return;
2715
2719
  }
2716
- const t = Te();
2720
+ const t = Ne();
2717
2721
  if (!t.trim()) {
2718
- h("代码为空,请输入要执行的 Python 代码");
2722
+ g("代码为空,请输入要执行的 Python 代码");
2719
2723
  return;
2720
2724
  }
2721
2725
  const r = ++xr, u = {
@@ -2729,27 +2733,27 @@ const Vs = Z(
2729
2733
  stdoutBuffer: "",
2730
2734
  stderrBuffer: ""
2731
2735
  };
2732
- M.set(e, u);
2733
- const c = M.get(e);
2734
- Me(void 0), o.clearOutputOnRun && (fe(e).lines = []), h("开始执行(服务端 Python)", e), i("runStart");
2736
+ N.set(e, u);
2737
+ const c = N.get(e);
2738
+ Me(void 0), o.clearOutputOnRun && (fe(e).lines = []), g("开始执行(服务端 Python)", e), i("runStart");
2735
2739
  try {
2736
- const S = await Fs(o.pythonEndpoint, t, {
2740
+ const S = await $s(o.pythonEndpoint, t, {
2737
2741
  stdin: o.stdin,
2738
2742
  headers: o.pythonHeaders,
2739
2743
  signal: c.abort.signal
2740
- }), $ = M.get(e);
2741
- if (!$ || $.token !== r) {
2744
+ }), L = N.get(e);
2745
+ if (!L || L.token !== r) {
2742
2746
  S.sessionId && rr(o.pythonEndpoint, S.sessionId, {
2743
2747
  headers: o.pythonHeaders
2744
2748
  });
2745
2749
  return;
2746
2750
  }
2747
- $.sessionId = S.sessionId, Qt(e, $, S, r);
2751
+ L.sessionId = S.sessionId, Qt(e, L, S, r);
2748
2752
  } catch (S) {
2749
- const $ = M.get(e);
2750
- if (!$ || $.token !== r) return;
2753
+ const L = N.get(e);
2754
+ if (!L || L.token !== r) return;
2751
2755
  const X = S instanceof Error ? S.message : String(S);
2752
- h(`执行失败:${X}`, e), wt(e, $, {
2756
+ g(`执行失败:${X}`, e), wt(e, L, {
2753
2757
  durationMs: 0,
2754
2758
  error: { type: "RuntimeError", message: X }
2755
2759
  });
@@ -2757,20 +2761,20 @@ const Vs = Z(
2757
2761
  }
2758
2762
  async function Mn() {
2759
2763
  var u, c;
2760
- const e = w.value.id, t = M.get(e);
2764
+ const e = w.value.id, t = N.get(e);
2761
2765
  if (!t || !t.waiting || !t.sessionId) return;
2762
2766
  const r = t.input;
2763
- t.input = "", t.waiting = !1, ge("stdout", r, e), i("runOutput", { stream: "stdout", text: r });
2767
+ t.input = "", t.waiting = !1, ye("stdout", r, e), i("runOutput", { stream: "stdout", text: r });
2764
2768
  try {
2765
- const y = await Rs(o.pythonEndpoint, t.sessionId, r, {
2769
+ const h = await _s(o.pythonEndpoint, t.sessionId, r, {
2766
2770
  headers: o.pythonHeaders,
2767
2771
  signal: (u = t.abort) == null ? void 0 : u.signal
2768
2772
  });
2769
- Qt(e, t, y, t.token);
2770
- } catch (y) {
2771
- if (((c = M.get(e)) == null ? void 0 : c.token) !== t.token) return;
2772
- const S = y instanceof Error ? y.message : String(y);
2773
- h(`执行失败:${S}`, e), wt(e, t, {
2773
+ Qt(e, t, h, t.token);
2774
+ } catch (h) {
2775
+ if (((c = N.get(e)) == null ? void 0 : c.token) !== t.token) return;
2776
+ const S = h instanceof Error ? h.message : String(h);
2777
+ g(`执行失败:${S}`, e), wt(e, t, {
2774
2778
  sessionId: t.sessionId,
2775
2779
  durationMs: 0,
2776
2780
  error: { type: "RuntimeError", message: S }
@@ -2779,13 +2783,13 @@ const Vs = Z(
2779
2783
  }
2780
2784
  function st(e, t = !0) {
2781
2785
  var u;
2782
- const r = M.get(e);
2783
- r && (window.clearTimeout(r.pollTimer), M.delete(e), (u = r.abort) == null || u.abort(), r.sessionId && rr(o.pythonEndpoint, r.sessionId, {
2786
+ const r = N.get(e);
2787
+ r && (window.clearTimeout(r.pollTimer), N.delete(e), (u = r.abort) == null || u.abort(), r.sessionId && rr(o.pythonEndpoint, r.sessionId, {
2784
2788
  headers: o.pythonHeaders
2785
- }), t && h("执行已中断", e));
2789
+ }), t && g("执行已中断", e));
2786
2790
  }
2787
- async function Tn() {
2788
- var c, y, S;
2791
+ async function Nn() {
2792
+ var c, h, S;
2789
2793
  if (w.value.language === "sql") {
2790
2794
  await Cn();
2791
2795
  return;
@@ -2795,7 +2799,7 @@ const Vs = Z(
2795
2799
  return;
2796
2800
  }
2797
2801
  if (I.value === "running") {
2798
- k.value !== w.value.id && h(
2802
+ k.value !== w.value.id && g(
2799
2803
  "浏览器环境共享同一个 Pyodide 实例,暂不支持同时运行多个文件;可切换到服务端环境后并行执行"
2800
2804
  );
2801
2805
  return;
@@ -2803,27 +2807,27 @@ const Vs = Z(
2803
2807
  if (I.value === "loading") return;
2804
2808
  const e = w.value.language;
2805
2809
  if (e !== "python") {
2806
- h(`当前文件为 ${Mt(e).label},仅支持执行 Python / SQL 代码`);
2810
+ g(`当前文件为 ${Mt(e).label},仅支持执行 Python / SQL 代码`);
2807
2811
  return;
2808
2812
  }
2809
2813
  We += 1;
2810
2814
  const t = We, r = w.value.id;
2811
- k.value = r, Me(void 0), o.clearOutputOnRun && (fe(r).lines = []), h("开始执行", r), i("runStart");
2812
- const u = Te();
2815
+ k.value = r, Me(void 0), o.clearOutputOnRun && (fe(r).lines = []), g("开始执行", r), i("runStart");
2816
+ const u = Ne();
2813
2817
  try {
2814
2818
  await Hr();
2815
- const $ = await j.run(u, {
2819
+ const L = await j.run(u, {
2816
2820
  stdin: o.stdin,
2817
2821
  onOutput: (X, it) => {
2818
- ge(X, it, r), i("runOutput", { stream: X, text: it });
2822
+ ye(X, it, r), i("runOutput", { stream: X, text: it });
2819
2823
  }
2820
2824
  });
2821
2825
  if (t !== We) return;
2822
- $.interrupted ? h("执行已中断", r) : $.ok ? h(`执行完成,耗时 ${($.durationMs / 1e3).toFixed(2)}s`, r) : (h(`执行出错:${((c = $.error) == null ? void 0 : c.type) ?? "未知错误"}`, r), (y = $.error) != null && y.traceback && (ge("stderr", $.error.traceback, r), i("runOutput", { stream: "stderr", text: $.error.traceback })), w.value.id === r && Me((S = $.error) == null ? void 0 : S.line), $.error && i("runError", $.error)), i("runFinish", $);
2823
- } catch ($) {
2826
+ L.interrupted ? g("执行已中断", r) : L.ok ? g(`执行完成,耗时 ${(L.durationMs / 1e3).toFixed(2)}s`, r) : (g(`执行出错:${((c = L.error) == null ? void 0 : c.type) ?? "未知错误"}`, r), (h = L.error) != null && h.traceback && (ye("stderr", L.error.traceback, r), i("runOutput", { stream: "stderr", text: L.error.traceback })), w.value.id === r && Me((S = L.error) == null ? void 0 : S.line), L.error && i("runError", L.error)), i("runFinish", L);
2827
+ } catch (L) {
2824
2828
  if (t !== We) return;
2825
- const X = $ instanceof Error ? $.message : String($);
2826
- h(`执行失败:${X}`, r);
2829
+ const X = L instanceof Error ? L.message : String(L);
2830
+ g(`执行失败:${X}`, r);
2827
2831
  const it = { type: "RuntimeError", message: X, traceback: "" };
2828
2832
  i("runError", it), i("runFinish", { ok: !1, durationMs: 0, error: it });
2829
2833
  } finally {
@@ -2835,30 +2839,30 @@ const Vs = Z(
2835
2839
  if (mn) return;
2836
2840
  const e = o.preloadPackages;
2837
2841
  if (e.length) {
2838
- mn = !0, h(`正在安装预置包:${e.join(", ")}`);
2842
+ mn = !0, g(`正在安装预置包:${e.join(", ")}`);
2839
2843
  try {
2840
2844
  const r = await j.loadPackages(e, {
2841
- onOutput: (u, c) => ge(u, c)
2845
+ onOutput: (u, c) => ye(u, c)
2842
2846
  });
2843
- h(
2847
+ g(
2844
2848
  r.ok ? `预置包安装完成(${(r.durationMs / 1e3).toFixed(1)}s)` : `预置包安装失败:${((t = r.error) == null ? void 0 : t.message) ?? "未知错误"}`
2845
2849
  );
2846
2850
  } catch (r) {
2847
- h(`预置包安装失败:${r instanceof Error ? r.message : String(r)}`);
2851
+ g(`预置包安装失败:${r instanceof Error ? r.message : String(r)}`);
2848
2852
  }
2849
2853
  }
2850
2854
  }
2851
- Fa(() => {
2855
+ $a(() => {
2852
2856
  const e = b.value;
2853
2857
  if (!e) return;
2854
- $r(), _t = !0;
2858
+ Lr(), Rt = !0;
2855
2859
  const t = [
2856
- gn.of([
2860
+ yn.of([
2857
2861
  nn.readOnly.of(o.readOnly),
2858
- $e.editable.of(!o.readOnly)
2862
+ Le.editable.of(!o.readOnly)
2859
2863
  ]),
2860
2864
  Ut.of(zt(w.value.language)),
2861
- Ht.of(Tt(ut(z.value)))
2865
+ Ht.of(Nt(ut(z.value)))
2862
2866
  ];
2863
2867
  try {
2864
2868
  P = ks(e, {
@@ -2870,30 +2874,30 @@ const Vs = Z(
2870
2874
  onDocChange: (r) => {
2871
2875
  w.value.code = r, r !== o.modelValue && i("update:modelValue", r);
2872
2876
  },
2873
- onRunShortcut: Tn
2877
+ onRunShortcut: Nn
2874
2878
  });
2875
2879
  } catch (r) {
2876
2880
  const u = r instanceof Error ? r.message : String(r);
2877
- console.error("[princess-python-editor] 编辑器初始化失败", r), h(`编辑器初始化失败:${u}`), e.innerHTML = "";
2881
+ console.error("[princess-python-editor] 编辑器初始化失败", r), g(`编辑器初始化失败:${u}`), e.innerHTML = "";
2878
2882
  const c = document.createElement("div");
2879
2883
  c.className = "vpe-init-error", c.textContent = `编辑器初始化失败:${u}`, e.appendChild(c);
2880
2884
  return;
2881
2885
  }
2882
- o.autofocus && P.focus(), yt = j.on("status", (r, u) => {
2883
- I.value = r, r === "ready" && (u && h(`Pyodide ${u} 就绪`), i("ready"), P && !o.disableLint && w.value.language === "python" && Qa(P)), i("statusChange", r);
2884
- }), ht = j.on("initError", (r) => {
2885
- h(`Pyodide 加载失败:${r}`), i("loadError", r);
2886
- }), I.value = j.status, pe.value && ve(), typeof ResizeObserver < "u" && p.value && (Je = new ResizeObserver(() => {
2886
+ o.autofocus && P.focus(), ht = j.on("status", (r, u) => {
2887
+ I.value = r, r === "ready" && (u && g(`Pyodide ${u} 就绪`), i("ready"), P && !o.disableLint && w.value.language === "python" && Qa(P)), i("statusChange", r);
2888
+ }), gt = j.on("initError", (r) => {
2889
+ g(`Pyodide 加载失败:${r}`), i("loadError", r);
2890
+ }), I.value = j.status, pe.value && ve(), typeof ResizeObserver < "u" && f.value && (Je = new ResizeObserver(() => {
2887
2891
  x.value !== null && Kt(x.value);
2888
- }), Je.observe(p.value)), o.preloadPackages.length ? j.waitReady().then(() => ra()).catch((r) => h(r.message)) : o.preload && j.waitReady().catch((r) => h(r.message));
2889
- }), _a(() => {
2890
- yt == null || yt(), ht == null || ht(), ot(), Je == null || Je.disconnect(), Je = null, de == null || de.abort(), de = null, Y == null || Y.abort(), Y = null, se == null || se.abort(), se = null, oe == null || oe.abort(), oe = null;
2891
- for (const e of [...M.keys()])
2892
+ }), Je.observe(f.value)), o.preloadPackages.length ? j.waitReady().then(() => ra()).catch((r) => g(r.message)) : o.preload && j.waitReady().catch((r) => g(r.message));
2893
+ }), Ra(() => {
2894
+ ht == null || ht(), gt == null || gt(), ot(), Je == null || Je.disconnect(), Je = null, de == null || de.abort(), de = null, Y == null || Y.abort(), Y = null, se == null || se.abort(), se = null, oe == null || oe.abort(), oe = null;
2895
+ for (const e of [...N.keys()])
2892
2896
  st(e, !1);
2893
- window.clearTimeout(It), window.clearTimeout(gt), kn(), P == null || P.destroy(), P = null;
2897
+ window.clearTimeout(It), window.clearTimeout(yt), kn(), P == null || P.destroy(), P = null;
2894
2898
  }), ee(
2895
2899
  () => o.modelValue,
2896
- () => Rr()
2900
+ () => _r()
2897
2901
  ), ee(
2898
2902
  () => o.outputHeight,
2899
2903
  () => {
@@ -2913,7 +2917,7 @@ const Vs = Z(
2913
2917
  () => o.theme,
2914
2918
  (e) => {
2915
2919
  e !== z.value && (z.value = e, P == null || P.dispatch({
2916
- effects: Ht.reconfigure(Tt(ut(e)))
2920
+ effects: Ht.reconfigure(Nt(ut(e)))
2917
2921
  }));
2918
2922
  }
2919
2923
  ), ee(
@@ -2925,7 +2929,7 @@ const Vs = Z(
2925
2929
  () => o.pythonEndpoint,
2926
2930
  () => {
2927
2931
  if (!bt.value) {
2928
- for (const e of [...M.keys()])
2932
+ for (const e of [...N.keys()])
2929
2933
  st(e, !1);
2930
2934
  ce.value !== "browser" && (ce.value = "browser", i("update:runtime", "browser"));
2931
2935
  }
@@ -2943,7 +2947,7 @@ const Vs = Z(
2943
2947
  () => o.readOnly,
2944
2948
  (e) => {
2945
2949
  P == null || P.dispatch({
2946
- effects: gn.reconfigure([nn.readOnly.of(e), $e.editable.of(!e)])
2950
+ effects: yn.reconfigure([nn.readOnly.of(e), Le.editable.of(!e)])
2947
2951
  });
2948
2952
  }
2949
2953
  ), ee(
@@ -2951,7 +2955,7 @@ const Vs = Z(
2951
2955
  (e) => {
2952
2956
  if (!e) return;
2953
2957
  const t = D(e);
2954
- JSON.stringify(t) !== JSON.stringify(f.value) && (f.value = t), pe.value && ve();
2958
+ JSON.stringify(t) !== JSON.stringify(v.value) && (v.value = t), pe.value && ve();
2955
2959
  },
2956
2960
  { deep: !0 }
2957
2961
  ), ee(pe, (e) => {
@@ -2960,61 +2964,61 @@ const Vs = Z(
2960
2964
  () => G.value.length,
2961
2965
  async () => {
2962
2966
  await Zn();
2963
- const e = _.value;
2967
+ const e = R.value;
2964
2968
  e && (e.scrollTop = e.scrollHeight);
2965
2969
  }
2966
- ), ee([L, qe], () => Fr(), { deep: !0 });
2967
- function Nn() {
2968
- Tn();
2970
+ ), ee([F, qe], () => $r(), { deep: !0 });
2971
+ function Tn() {
2972
+ Nn();
2969
2973
  }
2970
- function Ln() {
2974
+ function Fn() {
2971
2975
  var t;
2972
2976
  const e = w.value.id;
2973
- if (_e.value) {
2974
- at(), !o.sqlExecutor && f.value.mode === "sqlite" && j.interrupt(), h("已取消连接测试");
2977
+ if (Re.value) {
2978
+ at(), !o.sqlExecutor && v.value.mode === "sqlite" && j.interrupt(), g("已取消连接测试");
2975
2979
  return;
2976
2980
  }
2977
- if ((t = M.get(e)) != null && t.busy) {
2981
+ if ((t = N.get(e)) != null && t.busy) {
2978
2982
  st(e);
2979
2983
  return;
2980
2984
  }
2981
2985
  if (Ee.value && k.value === e) {
2982
- $n();
2986
+ Ln();
2983
2987
  return;
2984
2988
  }
2985
- I.value === "running" && k.value === e && Fn();
2989
+ I.value === "running" && k.value === e && $n();
2986
2990
  }
2987
- function $n(e = !0) {
2991
+ function Ln(e = !0) {
2988
2992
  const t = k.value;
2989
- rt += 1, Ee.value = !1, k.value = null, de == null || de.abort(), de = null, !o.sqlExecutor && f.value.mode === "sqlite" && j.interrupt(), e && h("执行已中断", t ?? void 0);
2993
+ rt += 1, Ee.value = !1, k.value = null, de == null || de.abort(), de = null, !o.sqlExecutor && v.value.mode === "sqlite" && j.interrupt(), e && g("执行已中断", t ?? void 0);
2990
2994
  }
2991
- function Fn(e = !0) {
2995
+ function $n(e = !0) {
2992
2996
  const t = k.value;
2993
- We += 1, k.value = null, j.interrupt(), e && h("执行已中断", t ?? void 0);
2997
+ We += 1, k.value = null, j.interrupt(), e && g("执行已中断", t ?? void 0);
2994
2998
  }
2995
- function _n() {
2999
+ function Rn() {
2996
3000
  fe().lines = [], fe().sqlResults = [];
2997
3001
  }
2998
- function Rn() {
3002
+ function _n() {
2999
3003
  var e;
3000
3004
  return ((e = E.value) == null ? void 0 : e.getBoundingClientRect().height) ?? 180;
3001
3005
  }
3002
3006
  function aa() {
3003
3007
  var t;
3004
- const e = ((t = p.value) == null ? void 0 : t.clientHeight) ?? 0;
3008
+ const e = ((t = f.value) == null ? void 0 : t.clientHeight) ?? 0;
3005
3009
  return Math.max(vr, e ? e - 180 : 600);
3006
3010
  }
3007
3011
  function Kt(e) {
3008
3012
  x.value = Math.round(Math.max(vr, Math.min(e, aa())));
3009
3013
  }
3010
3014
  function sa(e) {
3011
- e.button === 0 && (e.preventDefault(), F.value = !0, yn = e.clientY, At = Rn(), x.value = Math.round(At), document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", window.addEventListener("pointermove", In), window.addEventListener("pointerup", ot), window.addEventListener("pointercancel", ot));
3015
+ e.button === 0 && (e.preventDefault(), $.value = !0, hn = e.clientY, At = _n(), x.value = Math.round(At), document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", window.addEventListener("pointermove", In), window.addEventListener("pointerup", ot), window.addEventListener("pointercancel", ot));
3012
3016
  }
3013
3017
  function In(e) {
3014
- F.value && Kt(At + (yn - e.clientY));
3018
+ $.value && Kt(At + (hn - e.clientY));
3015
3019
  }
3016
3020
  function ot() {
3017
- F.value && (F.value = !1, document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("pointermove", In), window.removeEventListener("pointerup", ot), window.removeEventListener("pointercancel", ot));
3021
+ $.value && ($.value = !1, document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("pointermove", In), window.removeEventListener("pointerup", ot), window.removeEventListener("pointercancel", ot));
3018
3022
  }
3019
3023
  function oa() {
3020
3024
  x.value = null;
@@ -3022,39 +3026,39 @@ const Vs = Z(
3022
3026
  function ia(e) {
3023
3027
  if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
3024
3028
  e.preventDefault();
3025
- const t = x.value ?? Rn();
3029
+ const t = x.value ?? _n();
3026
3030
  Kt(t + (e.key === "ArrowUp" ? 16 : -16));
3027
3031
  }
3028
3032
  function Jt() {
3029
3033
  if (o.readOnly) return;
3030
3034
  const e = w.value.language, t = Ke(wn(e), e, "");
3031
- L.value.push(t), He(t.id), i("newFile", Ge(t));
3035
+ F.value.push(t), He(t.id), i("newFile", Ge(t));
3032
3036
  }
3033
3037
  function He(e) {
3034
3038
  if (e === qe.value) {
3035
3039
  xt();
3036
3040
  return;
3037
3041
  }
3038
- const t = L.value.find((r) => r.id === e);
3042
+ const t = F.value.find((r) => r.id === e);
3039
3043
  t && (qe.value = e, Zt(t));
3040
3044
  }
3041
3045
  function la(e) {
3042
- st(e, !1), Ee.value && k.value === e && $n(!1), I.value === "running" && k.value === e && Fn(!1);
3046
+ st(e, !1), Ee.value && k.value === e && Ln(!1), I.value === "running" && k.value === e && $n(!1);
3043
3047
  }
3044
3048
  function Hn(e) {
3045
3049
  if (o.readOnly) return;
3046
- const t = L.value.findIndex((c) => c.id === e);
3050
+ const t = F.value.findIndex((c) => c.id === e);
3047
3051
  if (t === -1) return;
3048
3052
  la(e);
3049
- const r = L.value.splice(t, 1)[0];
3053
+ const r = F.value.splice(t, 1)[0];
3050
3054
  if (!r) return;
3051
- if (q.delete(e), i("fileClose", Ge(r)), !L.value.length) {
3055
+ if (q.delete(e), i("fileClose", Ge(r)), !F.value.length) {
3052
3056
  const c = Ke(wn(r.language), r.language, "");
3053
- L.value.push(c), qe.value = c.id, Zt(c), i("newFile", Ge(c));
3057
+ F.value.push(c), qe.value = c.id, Zt(c), i("newFile", Ge(c));
3054
3058
  return;
3055
3059
  }
3056
3060
  if (e !== qe.value) return;
3057
- const u = L.value[Math.min(t, L.value.length - 1)];
3061
+ const u = F.value[Math.min(t, F.value.length - 1)];
3058
3062
  u && (qe.value = u.id, Zt(u));
3059
3063
  }
3060
3064
  function Zt(e) {
@@ -3070,7 +3074,7 @@ const Vs = Z(
3070
3074
  }
3071
3075
  async function Un() {
3072
3076
  var r;
3073
- const e = Te();
3077
+ const e = Ne();
3074
3078
  let t = !1;
3075
3079
  try {
3076
3080
  (r = navigator.clipboard) != null && r.writeText && (await navigator.clipboard.writeText(e), t = !0);
@@ -3079,7 +3083,7 @@ const Vs = Z(
3079
3083
  }
3080
3084
  return t || (t = ua(e)), t ? (Se.value = !0, window.clearTimeout(It), It = window.setTimeout(() => {
3081
3085
  Se.value = !1;
3082
- }, 1600), i("copy", e), !0) : (h("复制失败,请手动选择代码复制"), !1);
3086
+ }, 1600), i("copy", e), !0) : (g("复制失败,请手动选择代码复制"), !1);
3083
3087
  }
3084
3088
  function ua(e) {
3085
3089
  const t = document.createElement("textarea");
@@ -3095,7 +3099,7 @@ const Vs = Z(
3095
3099
  function An() {
3096
3100
  const e = w.value, t = Vt(e.name, e.language);
3097
3101
  Ie.value = t;
3098
- const r = new Blob([Te()], {
3102
+ const r = new Blob([Ne()], {
3099
3103
  type: e.language === "python" ? "text/x-python;charset=utf-8" : "text/plain;charset=utf-8"
3100
3104
  }), u = URL.createObjectURL(r), c = document.createElement("a");
3101
3105
  return c.href = u, c.download = t, c.style.display = "none", document.body.appendChild(c), c.click(), c.remove(), window.setTimeout(() => URL.revokeObjectURL(u), 1e3), i("download", t), t;
@@ -3110,12 +3114,12 @@ const Vs = Z(
3110
3114
  try {
3111
3115
  const t = await j.listFiles(".");
3112
3116
  if (!t.ok) {
3113
- et.value = [], h(`读取虚拟文件失败:${((e = t.error) == null ? void 0 : e.message) ?? "未知错误"}`);
3117
+ et.value = [], g(`读取虚拟文件失败:${((e = t.error) == null ? void 0 : e.message) ?? "未知错误"}`);
3114
3118
  return;
3115
3119
  }
3116
3120
  et.value = t.entries ?? [];
3117
3121
  } catch (t) {
3118
- et.value = [], h(`读取虚拟文件失败:${t instanceof Error ? t.message : String(t)}`);
3122
+ et.value = [], g(`读取虚拟文件失败:${t instanceof Error ? t.message : String(t)}`);
3119
3123
  } finally {
3120
3124
  Xe.value = !1;
3121
3125
  }
@@ -3146,13 +3150,13 @@ const Vs = Z(
3146
3150
  try {
3147
3151
  const r = await j.readFile(e);
3148
3152
  if (!r.ok || r.content === void 0)
3149
- return h(`下载失败:${e}(${((t = r.error) == null ? void 0 : t.message) ?? "未知错误"})`), null;
3153
+ return g(`下载失败:${e}(${((t = r.error) == null ? void 0 : t.message) ?? "未知错误"})`), null;
3150
3154
  const u = e.slice(e.lastIndexOf("/") + 1) || "download.txt", c = new Blob([r.content], {
3151
3155
  type: `${da(u)};charset=utf-8`
3152
- }), y = URL.createObjectURL(c), S = document.createElement("a");
3153
- return S.href = y, S.download = u, S.style.display = "none", document.body.appendChild(S), S.click(), S.remove(), window.setTimeout(() => URL.revokeObjectURL(y), 1e3), i("fsDownload", { path: r.path ?? e, name: u }), h(`已下载虚拟文件:${u}`), u;
3156
+ }), h = URL.createObjectURL(c), S = document.createElement("a");
3157
+ return S.href = h, S.download = u, S.style.display = "none", document.body.appendChild(S), S.click(), S.remove(), window.setTimeout(() => URL.revokeObjectURL(h), 1e3), i("fsDownload", { path: r.path ?? e, name: u }), g(`已下载虚拟文件:${u}`), u;
3154
3158
  } catch (r) {
3155
- return h(`下载失败:${r instanceof Error ? r.message : String(r)}`), null;
3159
+ return g(`下载失败:${r instanceof Error ? r.message : String(r)}`), null;
3156
3160
  }
3157
3161
  }
3158
3162
  function pa(e, t) {
@@ -3172,7 +3176,7 @@ const Vs = Z(
3172
3176
  const t = new Date(e);
3173
3177
  return Number.isNaN(t.getTime()) ? e : `更新时间:${t.toLocaleString()}`;
3174
3178
  }
3175
- function ga() {
3179
+ function ya() {
3176
3180
  xe.value = !xe.value, xe.value && (De.value = !1, Ye());
3177
3181
  }
3178
3182
  async function Ye() {
@@ -3196,44 +3200,44 @@ const Vs = Z(
3196
3200
  }
3197
3201
  async function jn() {
3198
3202
  if (!Oe.value)
3199
- return h("未配置文件服务端点(filesEndpoint)"), null;
3203
+ return g("未配置文件服务端点(filesEndpoint)"), null;
3200
3204
  if (W.value) return null;
3201
3205
  const e = w.value, t = Vt(e.name, e.language);
3202
3206
  t !== e.name && (Ie.value = t), W.value = !0;
3203
3207
  try {
3204
3208
  const r = await Ms(
3205
3209
  o.filesEndpoint,
3206
- { name: t, content: Te() },
3210
+ { name: t, content: Ne() },
3207
3211
  { headers: o.filesHeaders }
3208
3212
  );
3209
- return h(`已保存到服务端:${r.name}(${Gt(r.size)})`), xe.value && await Ye(), r;
3213
+ return g(`已保存到服务端:${r.name}(${Gt(r.size)})`), xe.value && await Ye(), r;
3210
3214
  } catch (r) {
3211
- return h(`保存到服务端失败:${St(r)}`), null;
3215
+ return g(`保存到服务端失败:${St(r)}`), null;
3212
3216
  } finally {
3213
3217
  W.value = !1;
3214
3218
  }
3215
3219
  }
3216
- async function ya(e) {
3220
+ async function ha(e) {
3217
3221
  if (!Oe.value || W.value) return !1;
3218
3222
  W.value = !0;
3219
3223
  try {
3220
- const t = await Ts(o.filesEndpoint, e.id, {
3224
+ const t = await Ns(o.filesEndpoint, e.id, {
3221
3225
  headers: o.filesHeaders
3222
3226
  }), r = cr(t.name), u = Ke(Sn(t.name), r, t.content);
3223
- return L.value.push(u), He(u.id), h(`已从服务端打开文件:${t.name}`), i("fileOpen", { name: u.name, code: t.content, language: r }), !0;
3227
+ return F.value.push(u), He(u.id), g(`已从服务端打开文件:${t.name}`), i("fileOpen", { name: u.name, code: t.content, language: r }), !0;
3224
3228
  } catch (t) {
3225
- return h(`打开服务端文件失败:${St(t)}`), !1;
3229
+ return g(`打开服务端文件失败:${St(t)}`), !1;
3226
3230
  } finally {
3227
3231
  W.value = !1;
3228
3232
  }
3229
3233
  }
3230
- async function ha(e) {
3234
+ async function ga(e) {
3231
3235
  if (!(!Oe.value || W.value) && !(typeof window < "u" && !window.confirm(`确定删除服务端文件“${e.name}”?`))) {
3232
3236
  W.value = !0;
3233
3237
  try {
3234
- await Ns(o.filesEndpoint, e.id, { headers: o.filesHeaders }), h(`已删除服务端文件:${e.name}`), await Ye();
3238
+ await Ts(o.filesEndpoint, e.id, { headers: o.filesHeaders }), g(`已删除服务端文件:${e.name}`), await Ye();
3235
3239
  } catch (t) {
3236
- h(`删除服务端文件失败:${St(t)}`);
3240
+ g(`删除服务端文件失败:${St(t)}`);
3237
3241
  } finally {
3238
3242
  W.value = !1;
3239
3243
  }
@@ -3241,22 +3245,22 @@ const Vs = Z(
3241
3245
  }
3242
3246
  function Vn() {
3243
3247
  var e;
3244
- (e = N.value) == null || e.click();
3248
+ (e = T.value) == null || e.click();
3245
3249
  }
3246
3250
  async function ba(e) {
3247
3251
  var u;
3248
3252
  const t = e.target, r = (u = t.files) == null ? void 0 : u[0];
3249
3253
  if (t.value = "", !!r) {
3250
3254
  if (r.size > 2 * 1024 * 1024) {
3251
- h(`文件过大:${(r.size / 1024 / 1024).toFixed(1)} MB(最多 2 MB)`);
3255
+ g(`文件过大:${(r.size / 1024 / 1024).toFixed(1)} MB(最多 2 MB)`);
3252
3256
  return;
3253
3257
  }
3254
3258
  try {
3255
- const c = await r.text(), y = cr(r.name), S = Ke(Sn(r.name), y, c);
3256
- L.value.push(S), He(S.id), h(`已打开文件:${S.name}`), i("fileOpen", { name: S.name, code: c, language: y });
3259
+ const c = await r.text(), h = cr(r.name), S = Ke(Sn(r.name), h, c);
3260
+ F.value.push(S), He(S.id), g(`已打开文件:${S.name}`), i("fileOpen", { name: S.name, code: c, language: h });
3257
3261
  } catch (c) {
3258
- const y = c instanceof Error ? c.message : String(c);
3259
- h(`读取文件失败:${y}`);
3262
+ const h = c instanceof Error ? c.message : String(c);
3263
+ g(`读取文件失败:${h}`);
3260
3264
  }
3261
3265
  }
3262
3266
  }
@@ -3272,12 +3276,12 @@ const Vs = Z(
3272
3276
  function xa(e) {
3273
3277
  const t = e.target.value;
3274
3278
  t !== z.value && (z.value = t, P == null || P.dispatch({
3275
- effects: Ht.reconfigure(Tt(ut(t)))
3279
+ effects: Ht.reconfigure(Nt(ut(t)))
3276
3280
  }), i("update:theme", t));
3277
3281
  }
3278
3282
  async function Qn(e) {
3279
3283
  var t, r;
3280
- await Zn(), (r = (t = O.value) == null ? void 0 : t.querySelector(`[data-file-id="${e}"]`)) == null || r.focus();
3284
+ await Zn(), (r = (t = M.value) == null ? void 0 : t.querySelector(`[data-file-id="${e}"]`)) == null || r.focus();
3281
3285
  }
3282
3286
  function Ea(e, t) {
3283
3287
  if (e.target !== e.currentTarget) return;
@@ -3287,9 +3291,9 @@ const Vs = Z(
3287
3291
  }
3288
3292
  if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
3289
3293
  e.preventDefault();
3290
- const r = L.value.findIndex((y) => y.id === t.id);
3294
+ const r = F.value.findIndex((h) => h.id === t.id);
3291
3295
  if (r < 0) return;
3292
- const u = e.key === "ArrowLeft" ? -1 : 1, c = L.value[(r + u + L.value.length) % L.value.length];
3296
+ const u = e.key === "ArrowLeft" ? -1 : 1, c = F.value[(r + u + F.value.length) % F.value.length];
3293
3297
  c && (He(c.id), Qn(c.id));
3294
3298
  }
3295
3299
  function xt() {
@@ -3297,37 +3301,37 @@ const Vs = Z(
3297
3301
  }
3298
3302
  async function qa(e) {
3299
3303
  var r;
3300
- h(`正在安装:${e.join(", ")}`);
3304
+ g(`正在安装:${e.join(", ")}`);
3301
3305
  let t;
3302
3306
  try {
3303
3307
  t = await j.loadPackages(e, {
3304
- onOutput: (u, c) => ge(u, c)
3308
+ onOutput: (u, c) => ye(u, c)
3305
3309
  });
3306
3310
  } catch (u) {
3307
3311
  const c = u instanceof Error ? u.message : String(u);
3308
- return h(`安装失败:${c}`), { ok: !1, durationMs: 0, error: { type: "RuntimeError", message: c } };
3312
+ return g(`安装失败:${c}`), { ok: !1, durationMs: 0, error: { type: "RuntimeError", message: c } };
3309
3313
  }
3310
- return h(t.ok ? "安装完成" : `安装失败:${((r = t.error) == null ? void 0 : r.message) ?? "未知错误"}`), t;
3314
+ return g(t.ok ? "安装完成" : `安装失败:${((r = t.error) == null ? void 0 : r.message) ?? "未知错误"}`), t;
3311
3315
  }
3312
3316
  function Ca() {
3313
- return j.checkSyntax(Te());
3317
+ return j.checkSyntax(Ne());
3314
3318
  }
3315
3319
  function Pa() {
3316
- return D(f.value);
3320
+ return D(v.value);
3317
3321
  }
3318
3322
  function Oa() {
3319
3323
  return P;
3320
3324
  }
3321
3325
  function Ma() {
3322
- return L.value.map(Ge);
3326
+ return F.value.map(Ge);
3323
3327
  }
3324
- function Ta() {
3328
+ function Na() {
3325
3329
  return Ge(w.value);
3326
3330
  }
3327
3331
  return n({
3328
- run: Nn,
3329
- stop: Ln,
3330
- clearOutput: _n,
3332
+ run: Tn,
3333
+ stop: Fn,
3334
+ clearOutput: Rn,
3331
3335
  clearCode: Bn,
3332
3336
  newFile: Jt,
3333
3337
  switchFile: He,
@@ -3343,41 +3347,41 @@ const Vs = Z(
3343
3347
  openSqlConfig: Br,
3344
3348
  closeSqlConfig: xn,
3345
3349
  getEditorView: Oa,
3346
- getCode: Te,
3350
+ getCode: Ne,
3347
3351
  setCode: kt,
3348
3352
  getFiles: Ma,
3349
- getActiveFile: Ta,
3353
+ getActiveFile: Na,
3350
3354
  writeFile: pa,
3351
3355
  readFile: fa,
3352
3356
  listFiles: va,
3353
3357
  downloadFile: zn,
3354
3358
  saveToServer: jn,
3355
3359
  refreshServerFiles: Ye,
3356
- clearPersistedState: _r
3357
- }), (e, t) => (m(), g("div", {
3360
+ clearPersistedState: Rr
3361
+ }), (e, t) => (p(), m("div", {
3358
3362
  ref_key: "rootEl",
3359
- ref: p,
3363
+ ref: f,
3360
3364
  class: le(["vpe-root", qr.value]),
3361
3365
  style: Gn(Er.value)
3362
3366
  }, [
3363
- s.showToolbar ? (m(), g("div", to, [
3367
+ s.showToolbar ? (p(), m("div", to, [
3364
3368
  l("div", no, [
3365
- Dt.value ? (m(), g("button", {
3369
+ Dt.value ? (p(), m("button", {
3366
3370
  key: 1,
3367
3371
  class: "vpe-btn vpe-btn--stop",
3368
3372
  type: "button",
3369
3373
  title: "中断执行",
3370
- onClick: Ln
3374
+ onClick: Fn
3371
3375
  }, [
3372
3376
  V(B(Qs)),
3373
3377
  t[19] || (t[19] = l("span", null, "停止", -1))
3374
- ])) : (m(), g("button", {
3378
+ ])) : (p(), m("button", {
3375
3379
  key: 0,
3376
3380
  class: "vpe-btn vpe-btn--primary",
3377
3381
  type: "button",
3378
3382
  title: Or.value,
3379
3383
  disabled: Mr.value,
3380
- onClick: Nn
3384
+ onClick: Tn
3381
3385
  }, [
3382
3386
  V(B(Vs)),
3383
3387
  t[18] || (t[18] = l("span", null, "运行", -1))
@@ -3386,7 +3390,8 @@ const Vs = Z(
3386
3390
  class: "vpe-divider",
3387
3391
  "aria-hidden": "true"
3388
3392
  }, null, -1)),
3389
- l("button", {
3393
+ s.showNewFile ? (p(), m("button", {
3394
+ key: 2,
3390
3395
  class: "vpe-btn",
3391
3396
  type: "button",
3392
3397
  title: "新建文件",
@@ -3396,8 +3401,9 @@ const Vs = Z(
3396
3401
  }, [
3397
3402
  V(B(Ks)),
3398
3403
  t[20] || (t[20] = l("span", null, "新建", -1))
3399
- ], 8, ao),
3400
- l("button", {
3404
+ ], 8, ao)) : O("", !0),
3405
+ s.showOpenFile ? (p(), m("button", {
3406
+ key: 3,
3401
3407
  class: "vpe-btn",
3402
3408
  type: "button",
3403
3409
  title: "打开本地文件",
@@ -3407,8 +3413,9 @@ const Vs = Z(
3407
3413
  }, [
3408
3414
  V(B(Js)),
3409
3415
  t[21] || (t[21] = l("span", null, "本地文件", -1))
3410
- ], 8, so),
3411
- l("button", {
3416
+ ], 8, so)) : O("", !0),
3417
+ s.showDownload ? (p(), m("button", {
3418
+ key: 4,
3412
3419
  class: "vpe-btn",
3413
3420
  type: "button",
3414
3421
  title: "下载当前文件",
@@ -3417,8 +3424,9 @@ const Vs = Z(
3417
3424
  }, [
3418
3425
  V(B(fr)),
3419
3426
  t[22] || (t[22] = l("span", null, "下载", -1))
3420
- ]),
3421
- l("button", {
3427
+ ])) : O("", !0),
3428
+ s.showVirtualFiles ? (p(), m("button", {
3429
+ key: 5,
3422
3430
  class: "vpe-btn vpe-toolbar-secondary",
3423
3431
  type: "button",
3424
3432
  title: "虚拟文件(下载 Python 生成的文件)",
@@ -3427,9 +3435,9 @@ const Vs = Z(
3427
3435
  }, [
3428
3436
  V(B(pr)),
3429
3437
  t[23] || (t[23] = l("span", null, "虚拟文件", -1))
3430
- ]),
3431
- Oe.value ? (m(), g("button", {
3432
- key: 2,
3438
+ ])) : O("", !0),
3439
+ Oe.value ? (p(), m("button", {
3440
+ key: 6,
3433
3441
  class: "vpe-btn",
3434
3442
  type: "button",
3435
3443
  title: W.value ? "正在处理服务端文件…" : "保存当前文件到服务端",
@@ -3439,20 +3447,20 @@ const Vs = Z(
3439
3447
  }, [
3440
3448
  V(B(Xs)),
3441
3449
  t[24] || (t[24] = l("span", null, "保存", -1))
3442
- ], 8, oo)) : T("", !0),
3443
- Oe.value ? (m(), g("button", {
3444
- key: 3,
3450
+ ], 8, oo)) : O("", !0),
3451
+ Oe.value ? (p(), m("button", {
3452
+ key: 7,
3445
3453
  class: "vpe-btn vpe-toolbar-secondary",
3446
3454
  type: "button",
3447
3455
  title: "查询服务端已保存文件",
3448
3456
  "aria-label": "已保存文件",
3449
- onClick: ga
3457
+ onClick: ya
3450
3458
  }, [
3451
3459
  V(B(eo)),
3452
3460
  t[25] || (t[25] = l("span", null, "已保存文件", -1))
3453
- ])) : T("", !0),
3454
- s.showSqlConfig && pe.value ? (m(), g("button", {
3455
- key: 4,
3461
+ ])) : O("", !0),
3462
+ s.showSqlConfig && pe.value ? (p(), m("button", {
3463
+ key: 8,
3456
3464
  class: "vpe-btn",
3457
3465
  type: "button",
3458
3466
  title: "新建连接",
@@ -3461,7 +3469,7 @@ const Vs = Z(
3461
3469
  }, [
3462
3470
  V(B(Ys)),
3463
3471
  t[26] || (t[26] = l("span", null, "新建连接", -1))
3464
- ])) : T("", !0),
3472
+ ])) : O("", !0),
3465
3473
  l("button", {
3466
3474
  class: le(["vpe-btn", { "vpe-btn--copied": Se.value }]),
3467
3475
  type: "button",
@@ -3469,8 +3477,8 @@ const Vs = Z(
3469
3477
  "aria-label": Se.value ? "已复制" : "复制代码",
3470
3478
  onClick: Un
3471
3479
  }, [
3472
- Se.value ? (m(), Wn(B(Gs), { key: 0 })) : (m(), Wn(B(Zs), { key: 1 })),
3473
- Se.value ? (m(), g("span", lo, "已复制")) : (m(), g("span", uo, "复制"))
3480
+ Se.value ? (p(), Wn(B(Gs), { key: 0 })) : (p(), Wn(B(Zs), { key: 1 })),
3481
+ Se.value ? (p(), m("span", lo, "已复制")) : (p(), m("span", uo, "复制"))
3474
3482
  ], 10, io),
3475
3483
  l("button", {
3476
3484
  class: "vpe-btn",
@@ -3498,7 +3506,7 @@ const Vs = Z(
3498
3506
  onBlur: ka,
3499
3507
  onKeydown: wa
3500
3508
  }, null, 544), [
3501
- [he, Ie.value]
3509
+ [ge, Ie.value]
3502
3510
  ])
3503
3511
  ]),
3504
3512
  l("select", {
@@ -3508,29 +3516,29 @@ const Vs = Z(
3508
3516
  "aria-label": "编辑器主题",
3509
3517
  onChange: xa
3510
3518
  }, [
3511
- (m(!0), g(A, null, te(B(ln), (r) => (m(), g("option", {
3519
+ (p(!0), m(A, null, te(B(ln), (r) => (p(), m("option", {
3512
3520
  key: r.value,
3513
3521
  value: r.value
3514
- }, R(r.label), 9, vo))), 128))
3522
+ }, _(r.label), 9, vo))), 128))
3515
3523
  ], 40, fo)
3516
3524
  ]),
3517
3525
  l("div", mo, [
3518
- s.showSqlConfig && pe.value && (f.value.mode === "http" || f.value.endpoint) ? (m(), g(A, { key: 0 }, [
3526
+ s.showSqlConfig && pe.value && (v.value.mode === "http" || v.value.endpoint) ? (p(), m(A, { key: 0 }, [
3519
3527
  J(l("select", {
3520
- "onUpdate:modelValue": t[1] || (t[1] = (r) => f.value.connectionId = r),
3528
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => v.value.connectionId = r),
3521
3529
  class: "vpe-select vpe-sql-connection",
3522
3530
  title: "切换已保存连接",
3523
3531
  "aria-label": "切换已保存连接",
3524
3532
  disabled: je.value,
3525
3533
  onChange: jr
3526
3534
  }, [
3527
- l("option", yo, R(je.value ? "加载中…" : Ce.value.length ? "选择连接" : "暂无已保存连接"), 1),
3528
- (m(!0), g(A, null, te(Ce.value, (r) => (m(), g("option", {
3535
+ l("option", ho, _(je.value ? "加载中…" : Ce.value.length ? "选择连接" : "暂无已保存连接"), 1),
3536
+ (p(!0), m(A, null, te(Ce.value, (r) => (p(), m("option", {
3529
3537
  key: r.id,
3530
3538
  value: r.id
3531
- }, R(r.name), 9, ho))), 128))
3532
- ], 40, go), [
3533
- [Et, f.value.connectionId]
3539
+ }, _(r.name), 9, go))), 128))
3540
+ ], 40, yo), [
3541
+ [Et, v.value.connectionId]
3534
3542
  ]),
3535
3543
  l("button", {
3536
3544
  class: "vpe-btn vpe-btn--sm vpe-sql-manage",
@@ -3539,7 +3547,7 @@ const Vs = Z(
3539
3547
  "aria-label": "管理连接配置",
3540
3548
  onClick: Ur
3541
3549
  }, " 管理 ")
3542
- ], 64)) : T("", !0),
3550
+ ], 64)) : O("", !0),
3543
3551
  l("div", bo, [
3544
3552
  l("span", {
3545
3553
  class: le(["vpe-status", `vpe-status--${Pr.value}`]),
@@ -3549,9 +3557,9 @@ const Vs = Z(
3549
3557
  class: "vpe-status-dot",
3550
3558
  "aria-hidden": "true"
3551
3559
  }, null, -1)),
3552
- l("span", wo, R(bn.value), 1)
3560
+ l("span", wo, _(bn.value), 1)
3553
3561
  ], 10, ko),
3554
- bt.value && hn.value ? (m(), g(A, { key: 0 }, [
3562
+ bt.value && gn.value ? (p(), m(A, { key: 0 }, [
3555
3563
  t[32] || (t[32] = l("span", {
3556
3564
  class: "vpe-chips-divider",
3557
3565
  "aria-hidden": "true"
@@ -3568,7 +3576,7 @@ const Vs = Z(
3568
3576
  ])], 544), [
3569
3577
  [Et, ce.value]
3570
3578
  ])
3571
- ], 64)) : T("", !0),
3579
+ ], 64)) : O("", !0),
3572
3580
  t[33] || (t[33] = l("span", {
3573
3581
  class: "vpe-chips-divider",
3574
3582
  "aria-hidden": "true"
@@ -3581,23 +3589,23 @@ const Vs = Z(
3581
3589
  disabled: s.readOnly,
3582
3590
  onChange: Sa
3583
3591
  }, [
3584
- (m(!0), g(A, null, te(B($t), (r) => (m(), g("option", {
3592
+ (p(!0), m(A, null, te(B(Lt), (r) => (p(), m("option", {
3585
3593
  key: r.value,
3586
3594
  value: r.value
3587
- }, R(r.label), 9, xo))), 128))
3595
+ }, _(r.label), 9, xo))), 128))
3588
3596
  ], 40, So)
3589
3597
  ])
3590
3598
  ])
3591
- ])) : T("", !0),
3592
- s.showTabs ? (m(), g("div", {
3599
+ ])) : O("", !0),
3600
+ s.showTabs ? (p(), m("div", {
3593
3601
  key: 1,
3594
3602
  ref_key: "tabsEl",
3595
- ref: O,
3603
+ ref: M,
3596
3604
  class: "vpe-tabs",
3597
3605
  role: "tablist",
3598
3606
  "aria-label": "文件"
3599
3607
  }, [
3600
- (m(!0), g(A, null, te(L.value, (r) => (m(), g("div", {
3608
+ (p(!0), m(A, null, te(F.value, (r) => (p(), m("div", {
3601
3609
  key: r.id,
3602
3610
  class: le(["vpe-tab", { "vpe-tab--active": r.id === w.value.id }]),
3603
3611
  role: "tab",
@@ -3612,7 +3620,7 @@ const Vs = Z(
3612
3620
  class: le(["vpe-tab-dot", `vpe-tab-dot--${r.language}`]),
3613
3621
  "aria-hidden": "true"
3614
3622
  }, null, 2),
3615
- l("span", qo, R(r.name), 1),
3623
+ l("span", qo, _(r.name), 1),
3616
3624
  l("button", {
3617
3625
  class: "vpe-tab-close",
3618
3626
  type: "button",
@@ -3624,7 +3632,8 @@ const Vs = Z(
3624
3632
  V(B(ct))
3625
3633
  ], 8, Co)
3626
3634
  ], 42, Eo))), 128)),
3627
- l("button", {
3635
+ s.showNewFile ? (p(), m("button", {
3636
+ key: 0,
3628
3637
  class: "vpe-tabs-add",
3629
3638
  type: "button",
3630
3639
  title: "新建文件",
@@ -3633,11 +3642,11 @@ const Vs = Z(
3633
3642
  onClick: Jt
3634
3643
  }, [
3635
3644
  V(B(Ws))
3636
- ], 8, Po)
3637
- ], 512)) : T("", !0),
3645
+ ], 8, Po)) : O("", !0)
3646
+ ], 512)) : O("", !0),
3638
3647
  l("input", {
3639
3648
  ref_key: "fileInputEl",
3640
- ref: N,
3649
+ ref: T,
3641
3650
  class: "vpe-file-hidden",
3642
3651
  type: "file",
3643
3652
  accept: ".py,.pyw,.sql,.js,.mjs,.cjs,.jsx,.ts,.json,.txt,text/x-python,text/plain,application/json",
@@ -3648,9 +3657,9 @@ const Vs = Z(
3648
3657
  ref: b,
3649
3658
  class: "vpe-editor"
3650
3659
  }, null, 512),
3651
- s.showOutput ? (m(), g("div", {
3660
+ s.showOutput ? (p(), m("div", {
3652
3661
  key: 2,
3653
- class: le(["vpe-output-resizer", { "vpe-output-resizer--active": F.value }]),
3662
+ class: le(["vpe-output-resizer", { "vpe-output-resizer--active": $.value }]),
3654
3663
  role: "separator",
3655
3664
  "aria-orientation": "horizontal",
3656
3665
  "aria-label": "调整输出面板高度",
@@ -3659,8 +3668,8 @@ const Vs = Z(
3659
3668
  onPointerdown: sa,
3660
3669
  onDblclick: oa,
3661
3670
  onKeydown: ia
3662
- }, null, 34)) : T("", !0),
3663
- s.showOutput ? (m(), g("div", {
3671
+ }, null, 34)) : O("", !0),
3672
+ s.showOutput ? (p(), m("div", {
3664
3673
  key: 3,
3665
3674
  ref_key: "outputPanelEl",
3666
3675
  ref: E,
@@ -3673,54 +3682,54 @@ const Vs = Z(
3673
3682
  class: "vpe-btn vpe-btn--sm",
3674
3683
  type: "button",
3675
3684
  title: "清空输出",
3676
- onClick: _n
3685
+ onClick: Rn
3677
3686
  }, [
3678
3687
  V(B(dr))
3679
3688
  ])
3680
3689
  ]),
3681
3690
  l("div", Mo, [
3682
- me.value.length ? (m(), g("div", To, [
3683
- (m(!0), g(A, null, te(me.value, (r, u) => (m(), g("section", {
3691
+ me.value.length ? (p(), m("div", No, [
3692
+ (p(!0), m(A, null, te(me.value, (r, u) => (p(), m("section", {
3684
3693
  key: u,
3685
3694
  class: "vpe-sql-result"
3686
3695
  }, [
3687
- l("div", No, [
3688
- l("span", null, "结果 " + R(u + 1), 1),
3689
- l("span", null, R(Wr(r)), 1)
3696
+ l("div", To, [
3697
+ l("span", null, "结果 " + _(u + 1), 1),
3698
+ l("span", null, _(Wr(r)), 1)
3690
3699
  ]),
3691
- r.columns.length ? (m(), g("div", Lo, [
3692
- l("table", $o, [
3700
+ r.columns.length ? (p(), m("div", Fo, [
3701
+ l("table", Lo, [
3693
3702
  l("thead", null, [
3694
3703
  l("tr", null, [
3695
- (m(!0), g(A, null, te(r.columns, (c, y) => (m(), g("th", { key: y }, R(c), 1))), 128))
3704
+ (p(!0), m(A, null, te(r.columns, (c, h) => (p(), m("th", { key: h }, _(c), 1))), 128))
3696
3705
  ])
3697
3706
  ]),
3698
3707
  l("tbody", null, [
3699
- (m(!0), g(A, null, te(r.rows, (c, y) => (m(), g("tr", { key: y }, [
3700
- (m(!0), g(A, null, te(c, (S, $) => (m(), g("td", {
3701
- key: $,
3708
+ (p(!0), m(A, null, te(r.rows, (c, h) => (p(), m("tr", { key: h }, [
3709
+ (p(!0), m(A, null, te(c, (S, L) => (p(), m("td", {
3710
+ key: L,
3702
3711
  class: le({ "vpe-sql-null": S === null })
3703
- }, R(Gr(S)), 3))), 128))
3712
+ }, _(Gr(S)), 3))), 128))
3704
3713
  ]))), 128))
3705
3714
  ])
3706
3715
  ]),
3707
- r.rows.length ? T("", !0) : (m(), g("div", Fo, "查询无数据"))
3708
- ])) : (m(), g("div", _o, "影响 " + R(r.affectedRows ?? 0) + " 行", 1))
3716
+ r.rows.length ? O("", !0) : (p(), m("div", $o, "查询无数据"))
3717
+ ])) : (p(), m("div", Ro, "影响 " + _(r.affectedRows ?? 0) + " 行", 1))
3709
3718
  ]))), 128))
3710
- ])) : T("", !0),
3719
+ ])) : O("", !0),
3711
3720
  l("pre", {
3712
3721
  ref_key: "outputEl",
3713
- ref: _,
3722
+ ref: R,
3714
3723
  class: "vpe-output-body"
3715
3724
  }, [
3716
- G.value.length ? (m(!0), g(A, { key: 0 }, te(G.value, (r) => (m(), g("span", {
3725
+ G.value.length ? (p(!0), m(A, { key: 0 }, te(G.value, (r) => (p(), m("span", {
3717
3726
  key: r.id,
3718
3727
  class: le(["vpe-line", `vpe-line--${r.stream}`])
3719
- }, R(r.text) + `
3720
- `, 3))), 128)) : (m(), g("span", Ro, "暂无输出,点击“运行”或按 Ctrl+Enter 执行代码"))
3728
+ }, _(r.text) + `
3729
+ `, 3))), 128)) : (p(), m("span", _o, "暂无输出,点击“运行”或按 Ctrl+Enter 执行代码"))
3721
3730
  ], 512)
3722
3731
  ]),
3723
- Ze.value && Ae.value && Dt.value ? (m(), g("div", Io, [
3732
+ Ze.value && Ae.value && Dt.value ? (p(), m("div", Io, [
3724
3733
  t[35] || (t[35] = l("span", {
3725
3734
  class: "vpe-terminal-prompt",
3726
3735
  "aria-hidden": "true"
@@ -3732,18 +3741,18 @@ const Vs = Z(
3732
3741
  spellcheck: "false",
3733
3742
  placeholder: "输入后按 Enter 发送给 input()",
3734
3743
  "aria-label": "标准输入",
3735
- onKeydown: Ra(Yn(Mn, ["prevent"]), ["enter"])
3744
+ onKeydown: _a(Yn(Mn, ["prevent"]), ["enter"])
3736
3745
  }, null, 40, Ho), [
3737
- [he, H.value]
3746
+ [ge, H.value]
3738
3747
  ]),
3739
3748
  l("button", {
3740
3749
  class: "vpe-btn vpe-btn--sm",
3741
3750
  type: "button",
3742
3751
  onClick: Mn
3743
3752
  }, " 发送 ")
3744
- ])) : T("", !0)
3745
- ], 4)) : T("", !0),
3746
- De.value ? (m(), g("div", Bo, [
3753
+ ])) : O("", !0)
3754
+ ], 4)) : O("", !0),
3755
+ De.value ? (p(), m("div", Bo, [
3747
3756
  l("div", Uo, [
3748
3757
  t[36] || (t[36] = l("span", { class: "vpe-fs-title" }, "虚拟文件", -1)),
3749
3758
  t[37] || (t[37] = l("span", {
@@ -3768,18 +3777,18 @@ const Vs = Z(
3768
3777
  ])
3769
3778
  ]),
3770
3779
  l("div", Do, [
3771
- Xe.value ? (m(), g("div", zo, "正在读取虚拟文件…")) : (m(), g(A, { key: 1 }, [
3772
- et.value.length ? T("", !0) : (m(), g("div", jo, " 暂无文件。运行 Python 代码创建文件后再刷新。 ")),
3773
- (m(!0), g(A, null, te(et.value, (r) => (m(), g("div", {
3780
+ Xe.value ? (p(), m("div", zo, "正在读取虚拟文件…")) : (p(), m(A, { key: 1 }, [
3781
+ et.value.length ? O("", !0) : (p(), m("div", jo, " 暂无文件。运行 Python 代码创建文件后再刷新。 ")),
3782
+ (p(!0), m(A, null, te(et.value, (r) => (p(), m("div", {
3774
3783
  key: r.path,
3775
3784
  class: le(["vpe-fs-item", { "vpe-fs-item--dir": r.isDirectory }])
3776
3785
  }, [
3777
3786
  l("span", {
3778
3787
  class: "vpe-fs-name",
3779
3788
  title: r.path
3780
- }, R(r.path), 9, Vo),
3781
- l("span", Qo, R(r.isDirectory ? "目录" : Gt(r.size)), 1),
3782
- r.isDirectory ? T("", !0) : (m(), g("button", {
3789
+ }, _(r.path), 9, Vo),
3790
+ l("span", Qo, _(r.isDirectory ? "目录" : Gt(r.size)), 1),
3791
+ r.isDirectory ? O("", !0) : (p(), m("button", {
3783
3792
  key: 0,
3784
3793
  class: "vpe-btn vpe-btn--sm",
3785
3794
  type: "button",
@@ -3792,8 +3801,8 @@ const Vs = Z(
3792
3801
  ], 2))), 128))
3793
3802
  ], 64))
3794
3803
  ])
3795
- ])) : T("", !0),
3796
- xe.value && Oe.value ? (m(), g("div", Jo, [
3804
+ ])) : O("", !0),
3805
+ xe.value && Oe.value ? (p(), m("div", Jo, [
3797
3806
  l("div", Zo, [
3798
3807
  t[38] || (t[38] = l("span", { class: "vpe-fs-title" }, "服务端文件", -1)),
3799
3808
  t[39] || (t[39] = l("span", {
@@ -3818,42 +3827,42 @@ const Vs = Z(
3818
3827
  ])
3819
3828
  ]),
3820
3829
  l("div", Wo, [
3821
- ft.value ? (m(), g("div", Yo, "正在读取服务端文件…")) : (m(), g(A, { key: 1 }, [
3822
- !tt.value.length && !ze.value ? (m(), g("div", Xo, " 暂无已保存文件。点击工具栏“保存”按钮把当前文件保存到服务端。 ")) : T("", !0),
3823
- (m(!0), g(A, null, te(tt.value, (r) => (m(), g("div", {
3830
+ ft.value ? (p(), m("div", Yo, "正在读取服务端文件…")) : (p(), m(A, { key: 1 }, [
3831
+ !tt.value.length && !ze.value ? (p(), m("div", Xo, " 暂无已保存文件。点击工具栏“保存”按钮把当前文件保存到服务端。 ")) : O("", !0),
3832
+ (p(!0), m(A, null, te(tt.value, (r) => (p(), m("div", {
3824
3833
  key: r.id,
3825
3834
  class: "vpe-fs-item"
3826
3835
  }, [
3827
3836
  l("span", {
3828
3837
  class: "vpe-fs-name",
3829
3838
  title: r.name
3830
- }, R(r.name), 9, ei),
3839
+ }, _(r.name), 9, ei),
3831
3840
  l("span", {
3832
3841
  class: "vpe-fs-size",
3833
3842
  title: ma(r.updatedAt)
3834
- }, R(Gt(r.size)), 9, ti),
3843
+ }, _(Gt(r.size)), 9, ti),
3835
3844
  l("button", {
3836
3845
  class: "vpe-btn vpe-btn--sm",
3837
3846
  type: "button",
3838
3847
  title: `打开 ${r.name}`,
3839
3848
  disabled: W.value,
3840
- onClick: (u) => ya(r)
3849
+ onClick: (u) => ha(r)
3841
3850
  }, " 打开 ", 8, ni),
3842
3851
  l("button", {
3843
3852
  class: "vpe-btn vpe-btn--sm",
3844
3853
  type: "button",
3845
3854
  title: `删除 ${r.name}`,
3846
3855
  disabled: W.value,
3847
- onClick: (u) => ha(r)
3856
+ onClick: (u) => ga(r)
3848
3857
  }, " 删除 ", 8, ri)
3849
3858
  ]))), 128)),
3850
- ze.value ? (m(), g("p", ai, R(ze.value), 1)) : T("", !0)
3859
+ ze.value ? (p(), m("p", ai, _(ze.value), 1)) : O("", !0)
3851
3860
  ], 64))
3852
3861
  ])
3853
- ])) : T("", !0),
3854
- Fe.value && pe.value ? (m(), g("div", si, [
3862
+ ])) : O("", !0),
3863
+ $e.value && pe.value ? (p(), m("div", si, [
3855
3864
  l("div", oi, [
3856
- l("span", ii, R(Tr.value), 1),
3865
+ l("span", ii, _(Nr.value), 1),
3857
3866
  t[40] || (t[40] = l("span", {
3858
3867
  class: "vpe-spacer",
3859
3868
  "aria-hidden": "true"
@@ -3872,32 +3881,32 @@ const Vs = Z(
3872
3881
  l("label", ui, [
3873
3882
  t[42] || (t[42] = l("span", { class: "vpe-sql-label" }, "执行方式", -1)),
3874
3883
  J(l("select", {
3875
- "onUpdate:modelValue": t[7] || (t[7] = (r) => f.value.mode = r),
3884
+ "onUpdate:modelValue": t[7] || (t[7] = (r) => v.value.mode = r),
3876
3885
  class: "vpe-sql-input",
3877
3886
  onChange: Dr
3878
3887
  }, [...t[41] || (t[41] = [
3879
3888
  l("option", { value: "sqlite" }, "浏览器内 SQLite(无需服务端)", -1),
3880
3889
  l("option", { value: "http" }, "HTTP 服务(后端网关)", -1)
3881
3890
  ])], 544), [
3882
- [Et, f.value.mode]
3891
+ [Et, v.value.mode]
3883
3892
  ])
3884
3893
  ]),
3885
- f.value.mode === "sqlite" ? (m(), g(A, { key: 0 }, [
3894
+ v.value.mode === "sqlite" ? (p(), m(A, { key: 0 }, [
3886
3895
  l("label", ci, [
3887
3896
  t[43] || (t[43] = l("span", { class: "vpe-sql-label" }, "数据库文件", -1)),
3888
3897
  J(l("input", {
3889
- "onUpdate:modelValue": t[8] || (t[8] = (r) => f.value.connection.database = r),
3898
+ "onUpdate:modelValue": t[8] || (t[8] = (r) => v.value.connection.database = r),
3890
3899
  class: "vpe-sql-input",
3891
3900
  type: "text",
3892
3901
  spellcheck: "false",
3893
3902
  placeholder: ":memory:",
3894
- onChange: ye
3903
+ onChange: he
3895
3904
  }, null, 544), [
3896
- [he, f.value.connection.database]
3905
+ [ge, v.value.connection.database]
3897
3906
  ])
3898
3907
  ]),
3899
3908
  t[44] || (t[44] = l("p", { class: "vpe-sql-hint" }, " SQLite 在浏览器内运行,数据仅保存在当前页面内存;“停止”或刷新后会丢失。 ", -1))
3900
- ], 64)) : (m(), g(A, { key: 1 }, [
3909
+ ], 64)) : (p(), m(A, { key: 1 }, [
3901
3910
  l("label", di, [
3902
3911
  t[45] || (t[45] = l("span", { class: "vpe-sql-label" }, "连接名称", -1)),
3903
3912
  J(l("input", {
@@ -3907,150 +3916,150 @@ const Vs = Z(
3907
3916
  spellcheck: "false",
3908
3917
  placeholder: "用于保存和切换连接"
3909
3918
  }, null, 512), [
3910
- [he, ne.value]
3919
+ [ge, ne.value]
3911
3920
  ])
3912
3921
  ]),
3913
3922
  l("label", pi, [
3914
3923
  t[46] || (t[46] = l("span", { class: "vpe-sql-label" }, "数据库类型", -1)),
3915
3924
  J(l("select", {
3916
- "onUpdate:modelValue": t[10] || (t[10] = (r) => f.value.connection.dialect = r),
3925
+ "onUpdate:modelValue": t[10] || (t[10] = (r) => v.value.connection.dialect = r),
3917
3926
  class: "vpe-sql-input",
3918
3927
  onChange: zr
3919
3928
  }, [
3920
- (m(!0), g(A, null, te(B(dt), (r) => (m(), g("option", {
3929
+ (p(!0), m(A, null, te(B(dt), (r) => (p(), m("option", {
3921
3930
  key: r.value,
3922
3931
  value: r.value
3923
- }, R(r.label), 9, fi))), 128))
3932
+ }, _(r.label), 9, fi))), 128))
3924
3933
  ], 544), [
3925
- [Et, f.value.connection.dialect]
3934
+ [Et, v.value.connection.dialect]
3926
3935
  ])
3927
3936
  ]),
3928
3937
  l("div", vi, [
3929
3938
  l("label", mi, [
3930
3939
  t[47] || (t[47] = l("span", { class: "vpe-sql-label" }, "主机", -1)),
3931
3940
  J(l("input", {
3932
- "onUpdate:modelValue": t[11] || (t[11] = (r) => f.value.connection.host = r),
3941
+ "onUpdate:modelValue": t[11] || (t[11] = (r) => v.value.connection.host = r),
3933
3942
  class: "vpe-sql-input",
3934
3943
  type: "text",
3935
3944
  spellcheck: "false",
3936
3945
  placeholder: "127.0.0.1",
3937
- onChange: ye
3946
+ onChange: he
3938
3947
  }, null, 544), [
3939
- [he, f.value.connection.host]
3948
+ [ge, v.value.connection.host]
3940
3949
  ])
3941
3950
  ]),
3942
- l("label", gi, [
3951
+ l("label", yi, [
3943
3952
  t[48] || (t[48] = l("span", { class: "vpe-sql-label" }, "端口", -1)),
3944
3953
  J(l("input", {
3945
- "onUpdate:modelValue": t[12] || (t[12] = (r) => f.value.connection.port = r),
3954
+ "onUpdate:modelValue": t[12] || (t[12] = (r) => v.value.connection.port = r),
3946
3955
  class: "vpe-sql-input",
3947
3956
  type: "number",
3948
3957
  min: "1",
3949
3958
  max: "65535",
3950
3959
  placeholder: "3306",
3951
- onChange: ye
3960
+ onChange: he
3952
3961
  }, null, 544), [
3953
3962
  [
3954
- he,
3955
- f.value.connection.port,
3963
+ ge,
3964
+ v.value.connection.port,
3956
3965
  void 0,
3957
3966
  { number: !0 }
3958
3967
  ]
3959
3968
  ])
3960
3969
  ])
3961
3970
  ]),
3962
- l("div", yi, [
3963
- l("label", hi, [
3971
+ l("div", hi, [
3972
+ l("label", gi, [
3964
3973
  t[49] || (t[49] = l("span", { class: "vpe-sql-label" }, "用户名", -1)),
3965
3974
  J(l("input", {
3966
- "onUpdate:modelValue": t[13] || (t[13] = (r) => f.value.connection.user = r),
3975
+ "onUpdate:modelValue": t[13] || (t[13] = (r) => v.value.connection.user = r),
3967
3976
  class: "vpe-sql-input",
3968
3977
  type: "text",
3969
3978
  autocomplete: "off",
3970
3979
  spellcheck: "false",
3971
- onChange: ye
3980
+ onChange: he
3972
3981
  }, null, 544), [
3973
- [he, f.value.connection.user]
3982
+ [ge, v.value.connection.user]
3974
3983
  ])
3975
3984
  ]),
3976
3985
  l("label", bi, [
3977
3986
  t[50] || (t[50] = l("span", { class: "vpe-sql-label" }, "密码", -1)),
3978
3987
  J(l("input", {
3979
- "onUpdate:modelValue": t[14] || (t[14] = (r) => f.value.connection.password = r),
3988
+ "onUpdate:modelValue": t[14] || (t[14] = (r) => v.value.connection.password = r),
3980
3989
  class: "vpe-sql-input",
3981
3990
  type: "password",
3982
3991
  autocomplete: "new-password",
3983
- placeholder: f.value.connectionId ? "已保存(留空不修改)" : "",
3984
- onChange: ye
3992
+ placeholder: v.value.connectionId ? "已保存(留空不修改)" : "",
3993
+ onChange: he
3985
3994
  }, null, 40, ki), [
3986
- [he, f.value.connection.password]
3995
+ [ge, v.value.connection.password]
3987
3996
  ])
3988
3997
  ])
3989
3998
  ]),
3990
3999
  l("label", wi, [
3991
4000
  t[51] || (t[51] = l("span", { class: "vpe-sql-label" }, "数据库名", -1)),
3992
4001
  J(l("input", {
3993
- "onUpdate:modelValue": t[15] || (t[15] = (r) => f.value.connection.database = r),
4002
+ "onUpdate:modelValue": t[15] || (t[15] = (r) => v.value.connection.database = r),
3994
4003
  class: "vpe-sql-input",
3995
4004
  type: "text",
3996
4005
  spellcheck: "false",
3997
4006
  placeholder: "database",
3998
- onChange: ye
4007
+ onChange: he
3999
4008
  }, null, 544), [
4000
- [he, f.value.connection.database]
4009
+ [ge, v.value.connection.database]
4001
4010
  ])
4002
4011
  ]),
4003
- s.sqlEndpointLocked ? T("", !0) : (m(), g("label", Si, [
4012
+ s.sqlEndpointLocked ? O("", !0) : (p(), m("label", Si, [
4004
4013
  t[52] || (t[52] = l("span", { class: "vpe-sql-label" }, "服务端点", -1)),
4005
4014
  J(l("input", {
4006
- "onUpdate:modelValue": t[16] || (t[16] = (r) => f.value.endpoint = r),
4015
+ "onUpdate:modelValue": t[16] || (t[16] = (r) => v.value.endpoint = r),
4007
4016
  class: "vpe-sql-input",
4008
4017
  type: "url",
4009
4018
  spellcheck: "false",
4010
4019
  placeholder: "https://example.com/api/sql",
4011
- onChange: ye
4020
+ onChange: he
4012
4021
  }, null, 544), [
4013
- [he, f.value.endpoint]
4022
+ [ge, v.value.endpoint]
4014
4023
  ])
4015
4024
  ])),
4016
- s.sqlEndpointLocked ? (m(), g("p", xi, "服务端点由系统预置,无需填写。")) : T("", !0),
4025
+ s.sqlEndpointLocked ? (p(), m("p", xi, "服务端点由系统预置,无需填写。")) : O("", !0),
4017
4026
  t[53] || (t[53] = l("p", { class: "vpe-sql-hint" }, " 执行时会把连接信息与 SQL POST 到该端点,由后端网关连接真实数据库。建议使用 HTTPS,并避免在前端配置高权限账号。 ", -1))
4018
4027
  ], 64)),
4019
4028
  l("div", Ei, [
4020
4029
  l("button", {
4021
4030
  class: "vpe-btn vpe-btn--primary",
4022
4031
  type: "button",
4023
- disabled: _e.value,
4032
+ disabled: Re.value,
4024
4033
  onClick: Zr
4025
- }, R(_e.value ? "测试中…" : "测试连接"), 9, qi),
4026
- f.value.mode === "http" ? (m(), g("button", {
4034
+ }, _(Re.value ? "测试中…" : "测试连接"), 9, qi),
4035
+ v.value.mode === "http" ? (p(), m("button", {
4027
4036
  key: 0,
4028
4037
  class: "vpe-btn",
4029
4038
  type: "button",
4030
4039
  disabled: re.value,
4031
4040
  onClick: Qr
4032
- }, " 保存 ", 8, Ci)) : T("", !0),
4033
- f.value.mode === "http" && f.value.connectionId ? (m(), g("button", {
4041
+ }, " 保存 ", 8, Ci)) : O("", !0),
4042
+ v.value.mode === "http" && v.value.connectionId ? (p(), m("button", {
4034
4043
  key: 1,
4035
4044
  class: "vpe-btn",
4036
4045
  type: "button",
4037
4046
  disabled: re.value,
4038
4047
  onClick: Kr
4039
- }, " 删除 ", 8, Pi)) : T("", !0),
4040
- nt.value ? (m(), g("span", {
4048
+ }, " 删除 ", 8, Pi)) : O("", !0),
4049
+ nt.value ? (p(), m("span", {
4041
4050
  key: 2,
4042
4051
  class: le(["vpe-sql-test", vt.value ? "vpe-sql-test--ok" : "vpe-sql-test--err"])
4043
- }, R(nt.value), 3)) : T("", !0),
4044
- f.value.mode === "http" && Pe.value ? (m(), g("span", Oi, R(Pe.value), 1)) : T("", !0),
4045
- f.value.mode === "http" && ae.value ? (m(), g("span", {
4052
+ }, _(nt.value), 3)) : O("", !0),
4053
+ v.value.mode === "http" && Pe.value ? (p(), m("span", Oi, _(Pe.value), 1)) : O("", !0),
4054
+ v.value.mode === "http" && ae.value ? (p(), m("span", {
4046
4055
  key: 4,
4047
4056
  class: le(["vpe-sql-test", Ve.value ? "vpe-sql-test--ok" : "vpe-sql-test--err"])
4048
- }, R(ae.value), 3)) : T("", !0)
4057
+ }, _(ae.value), 3)) : O("", !0)
4049
4058
  ])
4050
4059
  ])
4051
- ])) : T("", !0),
4052
- Re.value && pe.value ? (m(), g("div", Mi, [
4053
- l("div", Ti, [
4060
+ ])) : O("", !0),
4061
+ _e.value && pe.value ? (p(), m("div", Mi, [
4062
+ l("div", Ni, [
4054
4063
  t[54] || (t[54] = l("span", { class: "vpe-fs-title" }, "连接管理", -1)),
4055
4064
  t[55] || (t[55] = l("span", {
4056
4065
  class: "vpe-spacer",
@@ -4062,37 +4071,37 @@ const Vs = Z(
4062
4071
  title: "刷新连接列表",
4063
4072
  disabled: je.value,
4064
4073
  onClick: ve
4065
- }, " 刷新 ", 8, Ni),
4074
+ }, " 刷新 ", 8, Ti),
4066
4075
  l("button", {
4067
4076
  class: "vpe-btn vpe-btn--sm",
4068
4077
  type: "button",
4069
4078
  title: "关闭连接管理",
4070
4079
  "aria-label": "关闭连接管理",
4071
- onClick: t[17] || (t[17] = (r) => Re.value = !1)
4080
+ onClick: t[17] || (t[17] = (r) => _e.value = !1)
4072
4081
  }, [
4073
4082
  V(B(ct))
4074
4083
  ])
4075
4084
  ]),
4076
- l("div", Li, [
4077
- je.value ? (m(), g("div", $i, "正在读取连接…")) : (m(), g(A, { key: 1 }, [
4078
- Ce.value.length ? T("", !0) : (m(), g("div", Fi, " 暂无已保存连接,点击工具栏“新建连接”创建。 ")),
4079
- (m(!0), g(A, null, te(Ce.value, (r) => (m(), g("div", {
4085
+ l("div", Fi, [
4086
+ je.value ? (p(), m("div", Li, "正在读取连接…")) : (p(), m(A, { key: 1 }, [
4087
+ Ce.value.length ? O("", !0) : (p(), m("div", $i, " 暂无已保存连接,点击工具栏“新建连接”创建。 ")),
4088
+ (p(!0), m(A, null, te(Ce.value, (r) => (p(), m("div", {
4080
4089
  key: r.id,
4081
4090
  class: "vpe-sql-manager-item"
4082
4091
  }, [
4083
- l("div", _i, [
4092
+ l("div", Ri, [
4084
4093
  l("span", {
4085
4094
  class: "vpe-sql-manager-name",
4086
4095
  title: r.name
4087
- }, R(r.name), 9, Ri),
4096
+ }, _(r.name), 9, _i),
4088
4097
  l("span", Ii, [
4089
- Wt(R(r.dialect), 1),
4090
- r.database ? (m(), g(A, { key: 0 }, [
4091
- Wt(" · " + R(r.database), 1)
4092
- ], 64)) : T("", !0),
4093
- r.host ? (m(), g(A, { key: 1 }, [
4094
- Wt(" · " + R(r.host), 1)
4095
- ], 64)) : T("", !0)
4098
+ Wt(_(r.dialect), 1),
4099
+ r.database ? (p(), m(A, { key: 0 }, [
4100
+ Wt(" · " + _(r.database), 1)
4101
+ ], 64)) : O("", !0),
4102
+ r.host ? (p(), m(A, { key: 1 }, [
4103
+ Wt(" · " + _(r.host), 1)
4104
+ ], 64)) : O("", !0)
4096
4105
  ])
4097
4106
  ]),
4098
4107
  l("button", {
@@ -4109,32 +4118,32 @@ const Vs = Z(
4109
4118
  onClick: (u) => Jr(r)
4110
4119
  }, " 删除 ", 8, Bi)
4111
4120
  ]))), 128)),
4112
- Pe.value ? (m(), g("p", Ui, R(Pe.value), 1)) : T("", !0),
4113
- Qe.value ? (m(), g("p", {
4121
+ Pe.value ? (p(), m("p", Ui, _(Pe.value), 1)) : O("", !0),
4122
+ Qe.value ? (p(), m("p", {
4114
4123
  key: 2,
4115
4124
  class: le(["vpe-sql-hint", mt.value ? "vpe-sql-hint--ok" : "vpe-sql-hint--error"])
4116
- }, R(Qe.value), 3)) : T("", !0)
4125
+ }, _(Qe.value), 3)) : O("", !0)
4117
4126
  ], 64))
4118
4127
  ])
4119
- ])) : T("", !0)
4128
+ ])) : O("", !0)
4120
4129
  ], 6));
4121
4130
  }
4122
4131
  });
4123
4132
  function nl(s = {}) {
4124
4133
  var Ae;
4125
4134
  const n = un(s.pyodideUrl ? { pyodideUrl: s.pyodideUrl } : void 0), a = C(n.status), o = C(""), i = C([]);
4126
- let p = 0;
4135
+ let f = 0;
4127
4136
  const b = (H, k) => {
4128
- i.value.push({ id: ++p, stream: H, text: k });
4137
+ i.value.push({ id: ++f, stream: H, text: k });
4129
4138
  }, E = n.on("status", (H, k) => {
4130
4139
  a.value = H, k && (o.value = k);
4131
- }), _ = n.on("initError", (H) => {
4140
+ }), R = n.on("initError", (H) => {
4132
4141
  b("system", `[pyodide] 加载失败:${H}`);
4133
4142
  });
4134
4143
  Ia(() => {
4135
- E(), _();
4144
+ E(), R();
4136
4145
  });
4137
- const O = async (H, k = {}) => {
4146
+ const M = async (H, k = {}) => {
4138
4147
  var I;
4139
4148
  try {
4140
4149
  const z = await n.run(H, {
@@ -4149,7 +4158,7 @@ function nl(s = {}) {
4149
4158
  error: { type: "RuntimeError", message: z instanceof Error ? z.message : String(z), traceback: "" }
4150
4159
  };
4151
4160
  }
4152
- }, N = async (H, k) => {
4161
+ }, T = async (H, k) => {
4153
4162
  try {
4154
4163
  return await n.writeFile(H, k);
4155
4164
  } catch (I) {
@@ -4161,7 +4170,7 @@ function nl(s = {}) {
4161
4170
  } catch (k) {
4162
4171
  return { ok: !1, error: { type: "RuntimeError", message: k instanceof Error ? k.message : String(k), traceback: "" } };
4163
4172
  }
4164
- }, F = async (H = ".") => {
4173
+ }, $ = async (H = ".") => {
4165
4174
  try {
4166
4175
  return await n.listFiles(H);
4167
4176
  } catch (k) {
@@ -4196,33 +4205,33 @@ function nl(s = {}) {
4196
4205
  status: a,
4197
4206
  version: o,
4198
4207
  outputs: i,
4199
- runPython: O,
4208
+ runPython: M,
4200
4209
  install: q,
4201
4210
  checkSyntax: (H) => n.checkSyntax(H),
4202
4211
  interrupt: () => n.interrupt(),
4203
4212
  clearOutputs: () => {
4204
4213
  i.value = [];
4205
4214
  },
4206
- writeFile: N,
4215
+ writeFile: T,
4207
4216
  readFile: x,
4208
- listFiles: F,
4217
+ listFiles: $,
4209
4218
  /** 预加载并在就绪后 resolve */
4210
4219
  ready: () => n.waitReady()
4211
4220
  };
4212
4221
  }
4213
4222
  const rl = Ai;
4214
4223
  export {
4215
- yr as DEFAULT_PYODIDE_URL,
4224
+ hr as DEFAULT_PYODIDE_URL,
4216
4225
  tl as DEFAULT_SQL_CONFIG,
4217
4226
  ln as EDITOR_THEMES,
4218
- gs as MONO_FONT_STACK,
4227
+ ys as MONO_FONT_STACK,
4219
4228
  qs as PyodideRunner,
4220
4229
  rl as PythonEditor,
4221
4230
  dt as SQL_DIALECT_OPTIONS,
4222
4231
  ks as createEditor,
4223
- Fs as createPythonSession,
4232
+ $s as createPythonSession,
4224
4233
  Ai as default,
4225
- Ns as deleteServerFile,
4234
+ Ts as deleteServerFile,
4226
4235
  ur as deleteSqlConnection,
4227
4236
  lr as getDefaultSqlPort,
4228
4237
  un as getRunner,
@@ -4233,14 +4242,14 @@ export {
4233
4242
  Ds as listSqlConnections,
4234
4243
  ws as makePythonLinter,
4235
4244
  D as normalizeSqlConfig,
4236
- _s as pollPythonSession,
4237
- Ts as readServerFile,
4245
+ Rs as pollPythonSession,
4246
+ Ns as readServerFile,
4238
4247
  el as runPythonOnServer,
4239
4248
  kr as runSql,
4240
4249
  Ms as saveServerFile,
4241
4250
  zs as saveSqlConnection,
4242
- Rs as sendPythonSessionInput,
4243
- gr as setErrorLines,
4251
+ _s as sendPythonSessionInput,
4252
+ yr as setErrorLines,
4244
4253
  As as testSqlConnection,
4245
4254
  nl as usePyodide
4246
4255
  };