@onerjs/code-input 0.1.6 → 0.1.8

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.
@@ -1,5 +1,5 @@
1
- import { defineComponent as Bt, ref as R, computed as q, watch as ze, nextTick as P, onMounted as Ot, onBeforeUnmount as Nt, openBlock as I, createElementBlock as H, normalizeStyle as ce, normalizeClass as le, createElementVNode as B, withModifiers as De, Fragment as je, renderList as Fe, toDisplayString as Y, createCommentVNode as K, createTextVNode as Wt } from "vue";
2
- const zt = [
1
+ import { defineComponent as Dt, ref as E, computed as q, watch as Ze, nextTick as V, onMounted as jt, onBeforeUnmount as Ft, openBlock as I, createElementBlock as H, normalizeStyle as he, normalizeClass as ie, createElementVNode as A, withModifiers as Ue, Fragment as Ye, renderList as Xe, toDisplayString as Y, createCommentVNode as K, createTextVNode as Pt } from "vue";
2
+ const Vt = [
3
3
  {
4
4
  label: "Math",
5
5
  kind: "class",
@@ -134,8 +134,8 @@ const zt = [
134
134
  kind: "function",
135
135
  detail: "(id: number) => void"
136
136
  }
137
- ], Dt = /[\w$]/;
138
- function jt(n, s) {
137
+ ], qt = /[\w$]/;
138
+ function Kt(n, s) {
139
139
  const o = [];
140
140
  let e = null;
141
141
  for (let S = 0; S < s; S++) {
@@ -163,22 +163,22 @@ function jt(n, s) {
163
163
  let r = i.index - 1;
164
164
  for (; r >= 0 && /\s/.test(n[r]); ) r--;
165
165
  const f = r;
166
- for (; r >= 0 && Dt.test(n[r]); ) r--;
166
+ for (; r >= 0 && qt.test(n[r]); ) r--;
167
167
  const u = n.slice(r + 1, f + 1);
168
168
  if (!u) return null;
169
169
  let a = s;
170
170
  for (; a > 0 && /[\w$'"]/.test(n[a - 1]); ) a--;
171
171
  const d = n.slice(a, s);
172
- let $ = d, z = null;
173
- return d && (d[0] === "'" || d[0] === '"') && (z = d[0], $ = d.slice(1)), {
172
+ let T = d, D = null;
173
+ return d && (d[0] === "'" || d[0] === '"') && (D = d[0], T = d.slice(1)), {
174
174
  functionName: u,
175
175
  paramIndex: i.commas,
176
- prefix: $,
176
+ prefix: T,
177
177
  replaceStart: a,
178
- quote: z
178
+ quote: D
179
179
  };
180
180
  }
181
- const Pe = [
181
+ const Je = [
182
182
  "break",
183
183
  "case",
184
184
  "catch",
@@ -223,7 +223,7 @@ const Pe = [
223
223
  "undefined",
224
224
  "NaN",
225
225
  "Infinity"
226
- ], Ft = [
226
+ ], Zt = [
227
227
  "abstract",
228
228
  "any",
229
229
  "as",
@@ -253,23 +253,23 @@ const Pe = [
253
253
  "type",
254
254
  "unknown"
255
255
  ];
256
- function et(n) {
257
- return n === "typescript" ? [...Pe, ...Ft] : Pe;
256
+ function rt(n) {
257
+ return n === "typescript" ? [...Je, ...Zt] : Je;
258
258
  }
259
- function Ve(n) {
260
- return new Set(et(n));
259
+ function Qe(n) {
260
+ return new Set(rt(n));
261
261
  }
262
- const Pt = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/, qe = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, Vt = /^[A-Za-z_$]/;
263
- function tt(n, s) {
264
- const o = n.slice(0, s), e = Pt.exec(o);
262
+ const Ut = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/, Ge = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, Yt = /^[A-Za-z_$]/;
263
+ function ct(n, s) {
264
+ const o = n.slice(0, s), e = Ut.exec(o);
265
265
  if (!e) return { prefix: "", chain: [] };
266
266
  const i = e[1] ?? "", r = e[2] ?? "", f = i.split(".").filter(Boolean).map((u) => u.replace(/\?$/, ""));
267
267
  return { prefix: r, chain: f };
268
268
  }
269
- function Ke(n, s) {
269
+ function et(n, s) {
270
270
  const o = [], e = /* @__PURE__ */ new Set();
271
271
  let i;
272
- for (qe.lastIndex = 0; (i = qe.exec(n)) && !(i.index >= s); ) {
272
+ for (Ge.lastIndex = 0; (i = Ge.exec(n)) && !(i.index >= s); ) {
273
273
  const r = i[1];
274
274
  if (e.has(r)) continue;
275
275
  e.add(r);
@@ -282,7 +282,7 @@ function Ke(n, s) {
282
282
  }
283
283
  return o;
284
284
  }
285
- function nt(n, s) {
285
+ function ut(n, s) {
286
286
  let o = s;
287
287
  for (const e of n) {
288
288
  if (!o) return null;
@@ -292,7 +292,7 @@ function nt(n, s) {
292
292
  }
293
293
  return o;
294
294
  }
295
- function qt(n, s) {
295
+ function Xt(n, s) {
296
296
  const o = n.toLowerCase(), e = s.toLowerCase(), i = o.indexOf(e);
297
297
  if (i === 0) return 1e3 - o.length;
298
298
  if (i > 0) return 800 - i;
@@ -301,60 +301,60 @@ function qt(n, s) {
301
301
  o[a] === e[r] && (u >= 0 && (f += a - u - 1), u = a, r++);
302
302
  return r !== e.length ? null : 400 - f - o.length;
303
303
  }
304
- function lt(n, s) {
304
+ function dt(n, s) {
305
305
  if (!s) return n;
306
306
  const o = [];
307
307
  for (const e of n) {
308
- const i = qt(e.label, s);
308
+ const i = Xt(e.label, s);
309
309
  i !== null && o.push({ item: e, score: i });
310
310
  }
311
311
  return o.sort((e, i) => i.score - e.score || e.item.label.localeCompare(i.item.label)), o.map((e) => e.item);
312
312
  }
313
- function Kt(n) {
313
+ function Jt(n) {
314
314
  const s = /* @__PURE__ */ new Set(), o = [];
315
315
  for (const e of n)
316
316
  s.has(e.label) || (s.add(e.label), o.push(e));
317
317
  return o;
318
318
  }
319
- function Zt(n, s, o) {
320
- const { prefix: e, chain: i } = tt(n, s);
321
- if (o.auto && (!e && i.length === 0 || e && !Vt.test(e)))
319
+ function Qt(n, s, o) {
320
+ const { prefix: e, chain: i } = ct(n, s);
321
+ if (o.auto && (!e && i.length === 0 || e && !Yt.test(e)))
322
322
  return null;
323
323
  const r = o.declared ?? [], f = [...r, ...o.completions];
324
324
  let u;
325
325
  if (i.length > 0) {
326
- const d = nt(i, f);
326
+ const d = ut(i, f);
327
327
  if (!d || d.length === 0) return null;
328
328
  u = d;
329
329
  } else
330
330
  u = [
331
331
  ...o.completions,
332
332
  ...r,
333
- ...et(o.language).map((d) => ({
333
+ ...rt(o.language).map((d) => ({
334
334
  label: d,
335
335
  kind: "keyword"
336
336
  }))
337
337
  ];
338
- const a = lt(Kt(u), e);
338
+ const a = dt(Jt(u), e);
339
339
  return a.length === 0 ? null : {
340
340
  items: a,
341
341
  start: s - e.length,
342
342
  end: s
343
343
  };
344
344
  }
345
- const Ut = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
346
- function Yt(n, s, o, e) {
345
+ const Gt = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
346
+ function en(n, s, o, e) {
347
347
  const i = n.slice(s, o);
348
348
  if (!i) return null;
349
- const r = [...e.declared ?? [], ...e.completions], f = Ut.exec(n.slice(0, s));
349
+ const r = [...e.declared ?? [], ...e.completions], f = Gt.exec(n.slice(0, s));
350
350
  if (f) {
351
- const u = f[1].split(".").filter(Boolean).map(($) => $.replace(/\?$/, "")), a = nt(u, r), d = a == null ? void 0 : a.find(($) => $.label === i);
351
+ const u = f[1].split(".").filter(Boolean).map((T) => T.replace(/\?$/, "")), a = ut(u, r), d = a == null ? void 0 : a.find((T) => T.label === i);
352
352
  if (d) return d;
353
353
  }
354
354
  return r.find((u) => u.label === i) ?? null;
355
355
  }
356
- const Z = "[A-Za-z_$][\\w$]*", Ze = "(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";
357
- function Ue(n, s) {
356
+ const Z = "[A-Za-z_$][\\w$]*", tt = "(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";
357
+ function nt(n, s) {
358
358
  let o = 0, e = !1, i = s;
359
359
  for (let r = s; r < n.length; r++) {
360
360
  const f = n[r];
@@ -369,23 +369,23 @@ function Ue(n, s) {
369
369
  }
370
370
  return { end: i, body: n.slice(s + 1, i) };
371
371
  }
372
- function Ye(n) {
372
+ function lt(n) {
373
373
  return n.trim().replace(/[,;]$/, "").trim();
374
374
  }
375
- function Xt(n) {
375
+ function tn(n) {
376
376
  return /^(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:interface|class|type|function|const|let|var|namespace|enum)\b/.test(
377
377
  n
378
378
  );
379
379
  }
380
- function ie(n, s) {
380
+ function oe(n, s) {
381
381
  const o = n[s];
382
382
  let e = o.lastIndexOf("}");
383
383
  const i = o.lastIndexOf(";");
384
384
  if (i > e && (e = i), e === -1) return;
385
385
  const r = o.slice(e + 1).replace(/^[\s;]+/, "").trim();
386
- !r || !Xt(r) || (n[s] = o.slice(0, e + 1), n.splice(s + 1, 0, r));
386
+ !r || !tn(r) || (n[s] = o.slice(0, e + 1), n.splice(s + 1, 0, r));
387
387
  }
388
- function G(n) {
388
+ function J(n) {
389
389
  return n.length ? n.join(`
390
390
  `).replace(/^\s*\/\*\*?/, "").replace(/\*\/\s*$/, "").split(`
391
391
  `).map((s) => s.replace(/^\s*\*+\s?/, "").replace(/^\s*\/\/\s?/, "")).join(`
@@ -393,14 +393,14 @@ function G(n) {
393
393
 
394
394
  `).trim() : "";
395
395
  }
396
- function Xe(n) {
396
+ function it(n) {
397
397
  return n.split(`
398
398
  `).filter((s) => !/^\s*(\/\/|\/\*|\*)/.test(s)).join(`
399
399
  `).replace(/\n{2,}/g, `
400
400
  `).trim();
401
401
  }
402
- function Je(n) {
403
- const s = [], o = /* @__PURE__ */ new Set(), e = new RegExp(`^${Ze}(${Z})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`), i = new RegExp(`^${Ze}(${Z})(\\?)?\\s*:\\s*(.+?);?$`);
402
+ function ot(n) {
403
+ const s = [], o = /* @__PURE__ */ new Set(), e = new RegExp(`^${tt}(${Z})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`), i = new RegExp(`^${tt}(${Z})(\\?)?\\s*:\\s*(.+?);?$`);
404
404
  let r = [], f = !1;
405
405
  for (const u of n) {
406
406
  const a = u.trim();
@@ -422,44 +422,44 @@ function Je(n) {
422
422
  }
423
423
  const d = e.exec(a);
424
424
  if (d) {
425
- const z = G(r);
425
+ const D = J(r);
426
426
  r = [];
427
427
  const S = d[1];
428
428
  if (o.has(S)) continue;
429
429
  o.add(S), s.push({
430
430
  label: S,
431
431
  kind: "function",
432
- detail: `(${d[3].trim()}) => ${Ye(d[4])}`,
433
- documentation: z || void 0
432
+ detail: `(${d[3].trim()}) => ${lt(d[4])}`,
433
+ documentation: D || void 0
434
434
  });
435
435
  continue;
436
436
  }
437
- const $ = i.exec(a);
438
- if ($) {
439
- const z = G(r);
437
+ const T = i.exec(a);
438
+ if (T) {
439
+ const D = J(r);
440
440
  r = [];
441
- const S = $[1];
441
+ const S = T[1];
442
442
  if (o.has(S)) continue;
443
443
  o.add(S);
444
- const b = Ye($[3]), v = /^\(|=>/.test(b) ? "function" : "property";
444
+ const b = lt(T[3]), v = /^\(|=>/.test(b) ? "function" : "property";
445
445
  s.push({
446
446
  label: S,
447
447
  kind: v,
448
448
  detail: b,
449
- documentation: z || void 0
449
+ documentation: D || void 0
450
450
  });
451
451
  }
452
452
  }
453
453
  return s;
454
454
  }
455
- function it(n) {
455
+ function ft(n) {
456
456
  const s = [], o = /(['"])((?:\\.|(?!\1).)*)\1/g;
457
457
  let e;
458
458
  for (; e = o.exec(n); )
459
459
  s.push(e[2]);
460
460
  return s;
461
461
  }
462
- function Jt(n, s) {
462
+ function nn(n, s) {
463
463
  const o = [];
464
464
  let e = 0, i = "", r = null;
465
465
  for (let f = 0; f < n.length; f++) {
@@ -480,15 +480,15 @@ function Jt(n, s) {
480
480
  }
481
481
  return o.push(i), o;
482
482
  }
483
- function Gt(n, s) {
484
- const o = n.trim(), e = it(o);
483
+ function ln(n, s) {
484
+ const o = n.trim(), e = ft(o);
485
485
  if (e.length) return e;
486
486
  const i = s.get(o.replace(/\[\]$/, ""));
487
487
  return (i == null ? void 0 : i.literals) ?? [];
488
488
  }
489
- function Qt(n, s) {
489
+ function on(n, s) {
490
490
  const o = n.trim();
491
- return o ? Jt(o, ",").map((e) => {
491
+ return o ? nn(o, ",").map((e) => {
492
492
  const i = new RegExp(`^\\s*(${Z})\\s*(\\?)?\\s*:\\s*(.+)$`).exec(e);
493
493
  if (!i)
494
494
  return { name: e.trim(), type: "", optional: !1, literals: [] };
@@ -497,52 +497,52 @@ function Qt(n, s) {
497
497
  name: i[1],
498
498
  optional: !!i[2],
499
499
  type: r,
500
- literals: Gt(r, s)
500
+ literals: ln(r, s)
501
501
  };
502
502
  }) : [];
503
503
  }
504
- function ot(n) {
504
+ function pt(n) {
505
505
  const s = n.replace(/\[\]/g, "").replace(/<[^>]*>/g, "").replace(/\s*\|\s*null\s*/g, "").trim(), o = new RegExp(`^(${Z})$`).exec(s);
506
506
  return o ? o[1] : null;
507
507
  }
508
- function en(n) {
508
+ function an(n) {
509
509
  const s = n.trim();
510
510
  if (!s || s.endsWith(";")) return !1;
511
511
  const o = (s.match(/[(<[{]/g) ?? []).length, e = (s.match(/[)>\]}]/g) ?? []).length;
512
512
  return /[|&,(<]\s*$/.test(s) || o > e;
513
513
  }
514
- function at(n, s, o, e = 0) {
514
+ function mt(n, s, o, e = 0) {
515
515
  return e > 6 ? n : n.map((i) => {
516
516
  if (i.kind !== "property" || !i.detail) return i;
517
- const r = ot(i.detail), f = r ? s.get(r) : void 0;
517
+ const r = pt(i.detail), f = r ? s.get(r) : void 0;
518
518
  if (!f || o.has(f.label)) return i;
519
519
  const u = new Set(o);
520
520
  return u.add(f.label), {
521
521
  ...i,
522
522
  type: f.type,
523
- members: at(f.members, s, u, e + 1)
523
+ members: mt(f.members, s, u, e + 1)
524
524
  };
525
525
  });
526
526
  }
527
- const tn = 50, oe = /* @__PURE__ */ new Map(), nn = { items: [], signatures: /* @__PURE__ */ new Map() };
528
- function st(n) {
529
- if (!n || !n.trim()) return nn;
530
- const s = oe.get(n);
527
+ const sn = 50, ae = /* @__PURE__ */ new Map(), rn = { items: [], signatures: /* @__PURE__ */ new Map() };
528
+ function ht(n) {
529
+ if (!n || !n.trim()) return rn;
530
+ const s = ae.get(n);
531
531
  if (s) return s;
532
- const o = an(n);
533
- if (oe.size >= tn) {
534
- const e = oe.keys().next().value;
535
- e !== void 0 && oe.delete(e);
532
+ const o = dn(n);
533
+ if (ae.size >= sn) {
534
+ const e = ae.keys().next().value;
535
+ e !== void 0 && ae.delete(e);
536
536
  }
537
- return oe.set(n, o), o;
537
+ return ae.set(n, o), o;
538
538
  }
539
- function ln(n) {
540
- return st(n).items;
539
+ function cn(n) {
540
+ return ht(n).items;
541
541
  }
542
- function on(n) {
543
- return st(n).signatures;
542
+ function un(n) {
543
+ return ht(n).signatures;
544
544
  }
545
- function an(n) {
545
+ function dn(n) {
546
546
  const s = n.split(`
547
547
  `), o = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${Z})`), r = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${Z})`), f = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${Z})\\s*=`);
548
548
  let u = [], a = !1;
@@ -566,62 +566,62 @@ function an(n) {
566
566
  }
567
567
  const W = i.exec(v);
568
568
  if (W && v.includes("{")) {
569
- const w = G(u);
569
+ const w = J(u);
570
570
  u = [];
571
- const { end: T, body: L } = Ue(s, b), g = W[1];
571
+ const { end: $, body: L } = nt(s, b), g = W[1];
572
572
  o.set(g, {
573
573
  label: g,
574
- type: Xe(
575
- s.slice(b, T + 1).join(`
574
+ type: it(
575
+ s.slice(b, $ + 1).join(`
576
576
  `).replace(/^\s*export\s+/, "")
577
577
  ),
578
- members: Je(L),
578
+ members: ot(L),
579
579
  kind: "interface",
580
580
  documentation: w || void 0
581
- }), ie(s, T), b = T;
581
+ }), oe(s, $), b = $;
582
582
  continue;
583
583
  }
584
- const O = r.exec(v);
585
- if (O && v.includes("{")) {
586
- const w = G(u);
584
+ const N = r.exec(v);
585
+ if (N && v.includes("{")) {
586
+ const w = J(u);
587
587
  u = [];
588
- const { end: T, body: L } = Ue(s, b), g = O[1];
588
+ const { end: $, body: L } = nt(s, b), g = N[1];
589
589
  o.set(g, {
590
590
  label: g,
591
- type: Xe(
592
- s.slice(b, T + 1).join(`
591
+ type: it(
592
+ s.slice(b, $ + 1).join(`
593
593
  `).replace(/^\s*export\s+/, "")
594
594
  ),
595
- members: Je(L),
595
+ members: ot(L),
596
596
  kind: "class",
597
597
  documentation: w || void 0
598
- }), ie(s, T), b = T;
598
+ }), oe(s, $), b = $;
599
599
  continue;
600
600
  }
601
- const M = f.exec(v);
602
- if (M) {
603
- const w = G(u);
601
+ const R = f.exec(v);
602
+ if (R) {
603
+ const w = J(u);
604
604
  u = [];
605
- const T = [s[b]];
605
+ const $ = [s[b]];
606
606
  let L = b;
607
- for (; en(T.join(`
607
+ for (; an($.join(`
608
608
  `)) && L + 1 < s.length; )
609
- L++, T.push(s[L]);
610
- const g = T.join(`
609
+ L++, $.push(s[L]);
610
+ const g = $.join(`
611
611
  `).replace(/^\s*export\s+/, "").replace(/;\s*$/, "").trim();
612
- o.set(M[1], {
613
- label: M[1],
612
+ o.set(R[1], {
613
+ label: R[1],
614
614
  type: g,
615
615
  members: [],
616
616
  kind: "type",
617
617
  documentation: w || void 0,
618
- literals: it(g)
619
- }), ie(s, L), b = L;
618
+ literals: ft(g)
619
+ }), oe(s, L), b = L;
620
620
  continue;
621
621
  }
622
622
  u = [];
623
623
  }
624
- const d = [], $ = /* @__PURE__ */ new Set(), z = new RegExp(
624
+ const d = [], T = /* @__PURE__ */ new Set(), D = new RegExp(
625
625
  `^(?:export\\s+)?(?:declare\\s+)?function\\s+(${Z})\\s*\\(([^)]*)\\)\\s*:\\s*([^;{]+)`
626
626
  ), S = new RegExp(
627
627
  `^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${Z})\\s*:\\s*([^=;]+)`
@@ -645,36 +645,36 @@ function an(n) {
645
645
  u = [];
646
646
  continue;
647
647
  }
648
- const W = z.exec(v);
648
+ const W = D.exec(v);
649
649
  if (W) {
650
- ie(s, b);
651
- const M = G(u);
650
+ oe(s, b);
651
+ const R = J(u);
652
652
  u = [];
653
653
  const w = W[1];
654
- $.has(w) || ($.add(w), d.push({
654
+ T.has(w) || (T.add(w), d.push({
655
655
  label: w,
656
656
  kind: "function",
657
657
  detail: `(${W[2].trim()}) => ${W[3].trim()}`,
658
- documentation: M || void 0
659
- })), e.set(w, { name: w, params: Qt(W[2], o) });
658
+ documentation: R || void 0
659
+ })), e.set(w, { name: w, params: on(W[2], o) });
660
660
  continue;
661
661
  }
662
- const O = S.exec(v);
663
- if (O) {
664
- ie(s, b);
665
- const M = G(u);
662
+ const N = S.exec(v);
663
+ if (N) {
664
+ oe(s, b);
665
+ const R = J(u);
666
666
  u = [];
667
- const w = O[1];
668
- if ($.has(w)) continue;
669
- $.add(w);
670
- const T = O[2].trim(), L = ot(T), g = L ? o.get(L) : void 0, ae = (g == null ? void 0 : g.kind) === "class" ? "class" : /^\(|=>/.test(T) ? "function" : "variable";
667
+ const w = N[1];
668
+ if (T.has(w)) continue;
669
+ T.add(w);
670
+ const $ = N[2].trim(), L = pt($), g = L ? o.get(L) : void 0, se = (g == null ? void 0 : g.kind) === "class" ? "class" : /^\(|=>/.test($) ? "function" : "variable";
671
671
  d.push({
672
672
  label: w,
673
- kind: ae,
674
- detail: T,
673
+ kind: se,
674
+ detail: $,
675
675
  type: g == null ? void 0 : g.type,
676
- documentation: M || (g == null ? void 0 : g.documentation) || void 0,
677
- members: g ? at(g.members, o, /* @__PURE__ */ new Set([g.label])) : void 0
676
+ documentation: R || (g == null ? void 0 : g.documentation) || void 0,
677
+ members: g ? mt(g.members, o, /* @__PURE__ */ new Set([g.label])) : void 0
678
678
  });
679
679
  continue;
680
680
  }
@@ -682,7 +682,7 @@ function an(n) {
682
682
  }
683
683
  return { items: d, signatures: e };
684
684
  }
685
- function we(n, s, o, e) {
685
+ function Me(n, s, o, e) {
686
686
  if (!o || !e) return null;
687
687
  const i = Math.max(0, s - 1), r = n.lastIndexOf(o, i);
688
688
  if (r === -1 || n.lastIndexOf(e, i) > r) return null;
@@ -692,16 +692,16 @@ function we(n, s, o, e) {
692
692
  end: u === -1 ? n.length : u
693
693
  };
694
694
  }
695
- function Hn(n, s, o, e) {
696
- return we(n, s, o, e) !== null;
695
+ function Bn(n, s, o, e) {
696
+ return Me(n, s, o, e) !== null;
697
697
  }
698
- const Ge = /[A-Za-z_$]/, sn = /[\w$]/, Qe = /\s/;
699
- function ue(n, s) {
698
+ const at = /[A-Za-z_$]/, fn = /[\w$]/, st = /\s/;
699
+ function ge(n, s) {
700
700
  const o = [], e = n.length;
701
701
  let i = 0;
702
702
  for (; i < e; ) {
703
703
  const r = n[i], f = n[i + 1];
704
- if (Qe.test(r)) {
704
+ if (st.test(r)) {
705
705
  i++;
706
706
  continue;
707
707
  }
@@ -756,32 +756,32 @@ function ue(n, s) {
756
756
  o.push({ start: i, end: a, type: "number" }), i = a;
757
757
  continue;
758
758
  }
759
- if (Ge.test(r)) {
759
+ if (at.test(r)) {
760
760
  let a = i + 1;
761
- for (; a < e && sn.test(n[a]); ) a++;
762
- const d = n.slice(i, a), $ = s.keywords.has(d) ? "keyword" : s.builtins.has(d) ? "builtin" : "identifier";
763
- o.push({ start: i, end: a, type: $ }), i = a;
761
+ for (; a < e && fn.test(n[a]); ) a++;
762
+ const d = n.slice(i, a), T = s.keywords.has(d) ? "keyword" : s.builtins.has(d) ? "builtin" : "identifier";
763
+ o.push({ start: i, end: a, type: T }), i = a;
764
764
  continue;
765
765
  }
766
766
  let u = i + 1;
767
767
  for (; u < e; ) {
768
768
  const a = n[u];
769
- if (Qe.test(a) || Ge.test(a) || /[0-9]/.test(a) || a === '"' || a === "'" || a === "`" || a === "/") break;
769
+ if (st.test(a) || at.test(a) || /[0-9]/.test(a) || a === '"' || a === "'" || a === "`" || a === "/") break;
770
770
  u++;
771
771
  }
772
772
  o.push({ start: i, end: u, type: "punctuation" }), i = u;
773
773
  }
774
774
  return o;
775
775
  }
776
- const rn = {
776
+ const pn = {
777
777
  "&": "&amp;",
778
778
  "<": "&lt;",
779
779
  ">": "&gt;"
780
780
  };
781
781
  function Q(n) {
782
- return n.replace(/[&<>]/g, (s) => rn[s] ?? s);
782
+ return n.replace(/[&<>]/g, (s) => pn[s] ?? s);
783
783
  }
784
- function de(n, s, o = 0) {
784
+ function be(n, s, o = 0) {
785
785
  let e = "", i = 0;
786
786
  for (const r of s) {
787
787
  r.start > i && (e += Q(n.slice(i, r.start)));
@@ -790,8 +790,8 @@ function de(n, s, o = 0) {
790
790
  }
791
791
  return i < n.length && (e += Q(n.slice(i))), e;
792
792
  }
793
- function cn(n, s, o, e) {
794
- if (!o || !e) return de(n, ue(n, s));
793
+ function mn(n, s, o, e) {
794
+ if (!o || !e) return be(n, ge(n, s));
795
795
  let i = "", r = 0;
796
796
  for (; r < n.length; ) {
797
797
  const f = n.indexOf(o, r);
@@ -801,42 +801,42 @@ function cn(n, s, o, e) {
801
801
  }
802
802
  i += Q(n.slice(r, f));
803
803
  const u = n.indexOf(e, f + o.length), a = u === -1 ? n.length : u, d = n.slice(f + o.length, a);
804
- i += `<span class="tok-brace">${Q(o)}</span>`, i += de(d, ue(d, s), f + o.length), u === -1 ? r = a : (i += `<span class="tok-brace">${Q(e)}</span>`, r = u + e.length);
804
+ i += `<span class="tok-brace">${Q(o)}</span>`, i += be(d, ge(d, s), f + o.length), u === -1 ? r = a : (i += `<span class="tok-brace">${Q(e)}</span>`, r = u + e.length);
805
805
  }
806
806
  return i;
807
807
  }
808
- const un = {
808
+ const hn = {
809
809
  key: 0,
810
810
  class: "gutter",
811
811
  "aria-hidden": "true"
812
- }, dn = ["innerHTML"], fn = ["value", "readonly", "placeholder"], pn = ["onMouseenter", "onClick"], mn = { class: "popup-label" }, hn = {
812
+ }, gn = ["innerHTML"], bn = ["value", "readonly", "placeholder"], vn = ["onMouseenter", "onClick"], yn = { class: "popup-label" }, kn = {
813
813
  key: 0,
814
814
  class: "popup-detail"
815
- }, gn = { class: "hover-head" }, bn = { class: "hover-name" }, vn = {
815
+ }, wn = { class: "hover-head" }, xn = { class: "hover-name" }, Tn = {
816
816
  key: 0,
817
817
  class: "hover-colon"
818
- }, yn = {
818
+ }, $n = {
819
819
  key: 0,
820
820
  class: "hover-type"
821
- }, kn = {
821
+ }, Cn = {
822
822
  key: 0,
823
823
  class: "hover-doc"
824
- }, wn = {
824
+ }, Sn = {
825
825
  key: 1,
826
826
  class: "hover-def"
827
- }, xn = ["innerHTML"], $n = ["title", "aria-label"], Tn = {
827
+ }, En = ["innerHTML"], Rn = ["title", "aria-label"], Mn = {
828
828
  key: 0,
829
829
  viewBox: "0 0 16 16",
830
830
  width: "14",
831
831
  height: "14",
832
832
  "aria-hidden": "true"
833
- }, Cn = {
833
+ }, In = {
834
834
  key: 1,
835
835
  viewBox: "0 0 16 16",
836
836
  width: "14",
837
837
  height: "14",
838
838
  "aria-hidden": "true"
839
- }, Sn = /* @__PURE__ */ Bt({
839
+ }, Hn = /* @__PURE__ */ Dt({
840
840
  __name: "CodeEditor",
841
841
  props: {
842
842
  modelValue: {},
@@ -886,77 +886,77 @@ const un = {
886
886
  "End",
887
887
  "PageUp",
888
888
  "PageDown"
889
- ]), a = R(e.modelValue), d = R(), $ = R(), z = R(), S = R(), b = R(), v = R(), W = R(), O = R([]), M = R(0), w = R(!1), T = R({ start: 0, end: 0 }), L = R({}), g = R(null), ae = R({}), rt = q(
890
- () => e.tsTypes ? ln(e.tsTypes) : []
891
- ), ct = q(
892
- () => e.tsTypes ? on(e.tsTypes) : /* @__PURE__ */ new Map()
893
- ), xe = q(() => [
894
- ...zt,
895
- ...rt.value,
889
+ ]), a = E(e.modelValue), d = E(), T = E(), D = E(), S = E(), b = E(), v = E(), W = E(), N = E([]), R = E(0), w = E(!1), $ = E({ start: 0, end: 0 }), L = E({}), g = E(null), se = E({}), gt = q(
890
+ () => e.tsTypes ? cn(e.tsTypes) : []
891
+ ), bt = q(
892
+ () => e.tsTypes ? un(e.tsTypes) : /* @__PURE__ */ new Map()
893
+ ), Ie = q(() => [
894
+ ...Vt,
895
+ ...gt.value,
896
896
  ...e.completions
897
- ]), fe = q(
898
- () => e.mode === "template" ? [...e.templateCompletions, ...xe.value] : xe.value
899
- ), ut = q(() => {
897
+ ]), ve = q(
898
+ () => e.mode === "template" ? [...e.templateCompletions, ...Ie.value] : Ie.value
899
+ ), vt = q(() => {
900
900
  const t = {
901
- keywords: Ve(e.language),
902
- builtins: new Set(fe.value.map((l) => l.label))
901
+ keywords: Qe(e.language),
902
+ builtins: new Set(ve.value.map((l) => l.label))
903
903
  };
904
- return e.mode === "template" ? `${cn(a.value, t, e.templateOpen, e.templateClose)}
905
- ` : `${de(a.value, ue(a.value, t))}
904
+ return e.mode === "template" ? `${mn(a.value, t, e.templateOpen, e.templateClose)}
905
+ ` : `${be(a.value, ge(a.value, t))}
906
906
  `;
907
- }), dt = q(() => a.value.split(`
908
- `).length), F = R(e.defaultExpanded), pe = R(!1), me = q(() => e.collapsible && !F.value), ft = q(() => {
907
+ }), yt = q(() => a.value.split(`
908
+ `).length), P = E(e.defaultExpanded), ye = E(!1), re = q(() => e.collapsible && !P.value), kt = q(() => {
909
909
  const t = {};
910
910
  return e.collapsible && (t.height = e.collapsedHeight), t;
911
- }), pt = q(() => {
911
+ }), wt = q(() => {
912
912
  const t = {
913
913
  "--ce-radius": e.borderRadius,
914
914
  "--ce-collapsed-height": e.collapsedHeight
915
915
  };
916
- return e.background && (t["--ce-bg"] = e.background), e.borderColor && (t["--ce-border"] = e.borderColor), e.collapsible ? { ...t, height: F.value ? e.minHeight : e.collapsedHeight } : { ...t, height: e.minHeight };
916
+ return e.background && (t["--ce-bg"] = e.background), e.borderColor && (t["--ce-border"] = e.borderColor), e.collapsible ? { ...t, height: P.value ? e.minHeight : e.collapsedHeight } : { ...t, height: e.minHeight };
917
917
  });
918
- let $e = 0;
919
- function Te(t) {
920
- if (F.value === t) return;
918
+ let He = 0;
919
+ function Le(t) {
920
+ if (P.value === t) return;
921
921
  const l = d.value;
922
- t && l && ($e = l.scrollTop), F.value = t, e.collapsible && (pe.value = !0), i(t ? "expand" : "collapse"), _(), j(), P(() => {
923
- if (he(), !F.value && l) {
922
+ t && l && (He = l.scrollTop), P.value = t, e.collapsible && (ye.value = !0), i(t ? "expand" : "collapse"), _(), F(), V(() => {
923
+ if (ke(), !P.value && l) {
924
924
  const c = Math.max(0, l.scrollHeight - l.clientHeight);
925
- l.scrollTop = Math.max(0, Math.min($e, c)), D(!0), document.activeElement === l && X();
925
+ l.scrollTop = Math.max(0, Math.min(He, c)), j(!0), document.activeElement === l && X();
926
926
  return;
927
927
  }
928
- D(!0), t && e.collapseOnBlur && l && document.activeElement !== l && l.focus();
928
+ j(!0), t && e.collapseOnBlur && l && document.activeElement !== l && l.focus();
929
929
  });
930
930
  }
931
- function mt() {
932
- pe.value = !1;
931
+ function xt() {
932
+ ye.value = !1;
933
933
  }
934
- function ht() {
935
- Te(!F.value);
934
+ function Tt() {
935
+ Le(!P.value);
936
936
  }
937
- ze(
937
+ Ze(
938
938
  () => e.modelValue,
939
939
  (t) => {
940
940
  t !== a.value && (a.value = t, _());
941
941
  }
942
- ), ze(a, () => {
943
- P(() => D(!0));
942
+ ), Ze(a, () => {
943
+ V(() => j(!0));
944
944
  });
945
- function Ce(t) {
945
+ function _e(t) {
946
946
  return r[t];
947
947
  }
948
- function gt(t) {
949
- return t ? de(
948
+ function $t(t) {
949
+ return t ? be(
950
950
  t,
951
- ue(t, { keywords: Ve("typescript"), builtins: /* @__PURE__ */ new Set() })
951
+ ge(t, { keywords: Qe("typescript"), builtins: /* @__PURE__ */ new Set() })
952
952
  ) : "";
953
953
  }
954
- let ee = { top: 14, bottom: 14, left: 16, right: 16, lineHeight: 22 };
955
- function he() {
954
+ let G = { top: 14, bottom: 14, left: 16, right: 16, lineHeight: 22 };
955
+ function ke() {
956
956
  const t = d.value;
957
957
  if (!t) return;
958
958
  const l = window.getComputedStyle(t);
959
- ee = {
959
+ G = {
960
960
  top: parseFloat(l.paddingTop) || 0,
961
961
  bottom: parseFloat(l.paddingBottom) || 0,
962
962
  left: parseFloat(l.paddingLeft) || 0,
@@ -964,35 +964,39 @@ const un = {
964
964
  lineHeight: parseFloat(l.lineHeight) || 22
965
965
  };
966
966
  }
967
- function D(t = !1) {
967
+ function j(t = !1) {
968
968
  const l = d.value;
969
969
  if (!l) return;
970
970
  const c = S.value;
971
971
  if (c && (c.style.transform = `translate(${-l.scrollLeft}px, ${-l.scrollTop}px)`), b.value && (b.value.style.transform = `translateY(${-l.scrollTop}px)`), t) {
972
972
  const p = `${a.value}|${e.mode}|${l.clientWidth}|${l.clientHeight}`;
973
- p !== Ee && (Ee = p, bt());
973
+ p !== Be && (Be = p, Ct());
974
974
  }
975
975
  }
976
976
  function X() {
977
977
  const t = d.value;
978
978
  if (!t) return;
979
- const l = Re();
979
+ const l = Oe();
980
980
  if (!l) return;
981
- const c = t.getBoundingClientRect(), p = t.offsetWidth ? c.width / t.offsetWidth : 1, h = t.offsetHeight ? c.height / t.offsetHeight : 1;
982
- let m = t.scrollTop;
983
- if (me.value) {
984
- const Ne = t.clientHeight * h, We = ee.top * h, It = ee.bottom * h, Ht = l.lineHeight * h, Lt = Ne - We - It, _t = l.top + t.scrollTop * h - We - Math.max(0, (Lt - Ht) / 2), At = Math.max(0, t.scrollHeight * h - Ne);
985
- m = Math.max(0, Math.min(_t, At)) / h;
981
+ const c = t.getBoundingClientRect(), p = t.offsetWidth ? c.width / t.offsetWidth : 1, h = t.offsetHeight ? c.height / t.offsetHeight : 1, m = t.clientHeight * h, x = G.top * h, k = G.bottom * h, y = l.lineHeight * h, C = t.scrollTop * h, B = Math.max(0, t.scrollHeight * h - m), z = (re.value ? 8 : 14) * h;
982
+ let M = t.scrollTop;
983
+ if (re.value) {
984
+ const me = m - x - k, le = l.top + C - x - Math.max(0, (me - y) / 2);
985
+ M = Math.max(0, Math.min(le, B)) / h;
986
+ } else {
987
+ const me = x, Ee = m - k, le = l.top, Ke = le + y;
988
+ let Re = C;
989
+ le < me + z ? Re = C + (le - me - z) : Ke > Ee - z && (Re = C + (Ke - Ee + z)), M = Math.max(0, Math.min(Re, B)) / h;
986
990
  }
987
- const x = t.clientWidth * p, k = ee.left * p, y = ee.right * p, C = t.scrollLeft * p, E = l.left + C, V = C + k, N = C + x - y, A = 8 * p;
988
- let J = t.scrollLeft;
989
- E < V + A ? J = Math.max(0, (E - k - A) / p) : E > N - A && (J = Math.max(0, (E - k - x + y + A) / p));
990
- const U = Math.abs(m - t.scrollTop) > 0.5, Oe = Math.abs(J - t.scrollLeft) > 0.5;
991
- !U && !Oe || (U && (t.scrollTop = m), Oe && (t.scrollLeft = J), D());
992
- }
993
- let Se = [], Ee = "", se = 0, ge = -1, be = -1, ve = { x: 0, y: 0 };
994
- function bt() {
995
- const t = d.value, l = z.value;
991
+ const O = t.clientWidth * p, te = G.left * p, U = G.right * p, Se = t.scrollLeft * p, de = l.left + Se, Wt = Se + te, zt = Se + O - U, fe = 8 * p;
992
+ let pe = t.scrollLeft;
993
+ de < Wt + fe ? pe = Math.max(0, (de - te - fe) / p) : de > zt - fe && (pe = Math.max(0, (de - te - O + U + fe) / p));
994
+ const Ve = Math.abs(M - t.scrollTop) > 0.5, qe = Math.abs(pe - t.scrollLeft) > 0.5;
995
+ !Ve && !qe || (Ve && (t.scrollTop = M), qe && (t.scrollLeft = pe), j());
996
+ }
997
+ let Ae = [], Be = "", ce = 0, we = -1, xe = -1, Te = { x: 0, y: 0 };
998
+ function Ct() {
999
+ const t = d.value, l = D.value;
996
1000
  if (!t || !l) return;
997
1001
  const c = t.getBoundingClientRect(), p = [];
998
1002
  l.querySelectorAll("[data-start]").forEach((h) => {
@@ -1005,32 +1009,32 @@ const un = {
1005
1009
  top: m.top - c.top + t.scrollTop,
1006
1010
  bottom: m.bottom - c.top + t.scrollTop
1007
1011
  });
1008
- }), Se = p;
1012
+ }), Ae = p;
1009
1013
  }
1010
- function vt(t, l) {
1011
- for (const c of Se)
1014
+ function St(t, l) {
1015
+ for (const c of Ae)
1012
1016
  if (t >= c.left - 1 && t <= c.right + 1 && l >= c.top && l <= c.bottom)
1013
1017
  return c;
1014
1018
  return null;
1015
1019
  }
1016
- function j() {
1017
- g.value = null, se = 0, ge = -1, be = -1;
1020
+ function F() {
1021
+ g.value = null, ce = 0, we = -1, xe = -1;
1018
1022
  }
1019
- function yt(t) {
1023
+ function Et(t) {
1020
1024
  const l = W.value, c = d.value;
1021
1025
  if (!l || !c) return;
1022
- const p = c.getBoundingClientRect(), h = p.left + t.left - c.scrollLeft, m = p.left + t.right - c.scrollLeft, x = p.top + t.top - c.scrollTop, k = p.top + t.bottom - c.scrollTop, y = 12, C = 8, E = l.offsetWidth, V = l.offsetHeight;
1023
- let N = h, A = k + C;
1024
- N + E > window.innerWidth - y && (N = m - E), A + V > window.innerHeight - y && (A = x - V - C), N = Math.max(y, Math.min(N, window.innerWidth - y - E)), A = Math.max(y, A), ae.value = { left: `${N}px`, top: `${A}px` };
1026
+ const p = c.getBoundingClientRect(), h = p.left + t.left - c.scrollLeft, m = p.left + t.right - c.scrollLeft, x = p.top + t.top - c.scrollTop, k = p.top + t.bottom - c.scrollTop, y = 12, C = 8, B = l.offsetWidth, z = l.offsetHeight;
1027
+ let M = h, O = k + C;
1028
+ M + B > window.innerWidth - y && (M = m - B), O + z > window.innerHeight - y && (O = x - z - C), M = Math.max(y, Math.min(M, window.innerWidth - y - B)), O = Math.max(y, O), se.value = { left: `${M}px`, top: `${O}px` };
1025
1029
  }
1026
- function kt(t, l) {
1030
+ function Rt(t, l) {
1027
1031
  const c = d.value;
1028
1032
  if (!c || e.readonly || !e.hover || w.value) {
1029
- j();
1033
+ F();
1030
1034
  return;
1031
1035
  }
1032
1036
  if (c.selectionStart !== c.selectionEnd) {
1033
- j();
1037
+ F();
1034
1038
  return;
1035
1039
  }
1036
1040
  const p = W.value;
@@ -1039,29 +1043,29 @@ const un = {
1039
1043
  if (t >= k.left && t <= k.right && l >= k.top && l <= k.bottom)
1040
1044
  return;
1041
1045
  }
1042
- const h = c.getBoundingClientRect(), m = vt(t - h.left + c.scrollLeft, l - h.top + c.scrollTop);
1046
+ const h = c.getBoundingClientRect(), m = St(t - h.left + c.scrollLeft, l - h.top + c.scrollTop);
1043
1047
  if (!m) {
1044
- j();
1048
+ F();
1045
1049
  return;
1046
1050
  }
1047
- if (g.value && ge === m.start && be === m.end)
1051
+ if (g.value && we === m.start && xe === m.end)
1048
1052
  return;
1049
- const x = Yt(c.value, m.start, m.end, {
1050
- completions: fe.value,
1051
- declared: Ke(c.value, m.start)
1053
+ const x = en(c.value, m.start, m.end, {
1054
+ completions: ve.value,
1055
+ declared: et(c.value, m.start)
1052
1056
  });
1053
1057
  if (!x) {
1054
- j();
1058
+ F();
1055
1059
  return;
1056
1060
  }
1057
- g.value = x, ge = m.start, be = m.end, P(() => yt(m));
1061
+ g.value = x, we = m.start, xe = m.end, V(() => Et(m));
1058
1062
  }
1059
- function wt(t) {
1060
- ve = { x: t.clientX, y: t.clientY }, !se && (se = requestAnimationFrame(() => {
1061
- se = 0, kt(ve.x, ve.y);
1063
+ function Mt(t) {
1064
+ Te = { x: t.clientX, y: t.clientY }, !ce && (ce = requestAnimationFrame(() => {
1065
+ ce = 0, Rt(Te.x, Te.y);
1062
1066
  }));
1063
1067
  }
1064
- function Re() {
1068
+ function Oe() {
1065
1069
  const t = d.value;
1066
1070
  if (!t) return null;
1067
1071
  const l = window.getComputedStyle(t), c = document.createElement("div"), p = parseFloat(l.paddingLeft) || 0, h = parseFloat(l.paddingRight) || 0, m = t.getBoundingClientRect();
@@ -1096,27 +1100,27 @@ const un = {
1096
1100
  x.textContent = "​", c.appendChild(x), document.body.appendChild(c);
1097
1101
  const k = x.getBoundingClientRect();
1098
1102
  document.body.removeChild(c);
1099
- const y = parseFloat(l.lineHeight) || 22, C = k.height, E = C > 0 && C < y ? (y - C) / 2 : 0;
1103
+ const y = parseFloat(l.lineHeight) || 22, C = k.height, B = C > 0 && C < y ? (y - C) / 2 : 0;
1100
1104
  return {
1101
1105
  left: k.left - m.left - t.scrollLeft,
1102
- top: k.top - m.top - t.scrollTop - E,
1106
+ top: k.top - m.top - t.scrollTop - B,
1103
1107
  lineHeight: y
1104
1108
  };
1105
1109
  }
1106
- async function Me() {
1107
- await P();
1108
- const t = $.value, l = v.value, c = Re();
1110
+ async function Ne() {
1111
+ await V();
1112
+ const t = T.value, l = v.value, c = Oe();
1109
1113
  if (!t || !l || !c) return;
1110
- const p = 4, h = 8, m = window.innerWidth, x = window.innerHeight, k = t.getBoundingClientRect(), y = l.scrollHeight, C = x - (k.top + c.top + c.lineHeight) - p - h, E = k.top + c.top - p - h, V = C >= Math.min(y, 180) || C >= E, N = Math.min(248, Math.max(V ? C : E, 96)), A = Math.min(y, N), J = l.offsetWidth || 280;
1114
+ const p = 4, h = 8, m = window.innerWidth, x = window.innerHeight, k = t.getBoundingClientRect(), y = l.scrollHeight, C = x - (k.top + c.top + c.lineHeight) - p - h, B = k.top + c.top - p - h, z = C >= Math.min(y, 180) || C >= B, M = Math.min(248, Math.max(z ? C : B, 96)), O = Math.min(y, M), te = l.offsetWidth || 280;
1111
1115
  let U = c.left;
1112
- k.left + U + J > m - h && (U = m - h - J - k.left), U = Math.max(U, h - k.left), L.value = {
1116
+ k.left + U + te > m - h && (U = m - h - te - k.left), U = Math.max(U, h - k.left), L.value = {
1113
1117
  left: `${U}px`,
1114
- top: `${V ? c.top + c.lineHeight + p : c.top - p - A}px`,
1115
- maxHeight: `${N}px`
1118
+ top: `${z ? c.top + c.lineHeight + p : c.top - p - O}px`,
1119
+ maxHeight: `${M}px`
1116
1120
  };
1117
1121
  }
1118
1122
  function _() {
1119
- w.value = !1, O.value = [], M.value = 0, j();
1123
+ w.value = !1, N.value = [], R.value = 0, F();
1120
1124
  }
1121
1125
  function ne(t = !1) {
1122
1126
  var k;
@@ -1128,24 +1132,27 @@ const un = {
1128
1132
  }
1129
1133
  const c = l.selectionStart;
1130
1134
  let p = !t;
1131
- const h = jt(l.value, c);
1135
+ const h = Kt(l.value, c);
1132
1136
  if (h) {
1133
- const y = (k = ct.value.get(h.functionName)) == null ? void 0 : k.params[h.paramIndex], C = (y == null ? void 0 : y.literals) ?? [];
1137
+ const y = (k = bt.value.get(h.functionName)) == null ? void 0 : k.params[h.paramIndex], C = (y == null ? void 0 : y.literals) ?? [];
1134
1138
  if (C.length) {
1135
- const E = h.quote ?? "'", V = C.map((A) => ({
1136
- label: `${E}${A}${E}`,
1139
+ const B = h.quote, z = C.map((O) => ({
1140
+ label: `'${O}'`,
1137
1141
  kind: "value",
1138
1142
  detail: y == null ? void 0 : y.type,
1139
- insertText: `${E}${A}${E}`
1140
- })), N = lt(V, h.prefix);
1141
- if (N.length) {
1142
- O.value = N, T.value = { start: h.replaceStart, end: c }, M.value = 0, w.value = !0, Me();
1143
+ insertText: B ? O : `'${O}'`
1144
+ })), M = dt(z, h.prefix);
1145
+ if (M.length) {
1146
+ N.value = M, $.value = {
1147
+ start: B ? h.replaceStart + 1 : h.replaceStart,
1148
+ end: c
1149
+ }, R.value = 0, w.value = !0, Ne();
1143
1150
  return;
1144
1151
  }
1145
1152
  }
1146
1153
  }
1147
1154
  if (e.mode === "template") {
1148
- const y = we(
1155
+ const y = Me(
1149
1156
  l.value,
1150
1157
  c,
1151
1158
  e.templateOpen,
@@ -1157,10 +1164,10 @@ const un = {
1157
1164
  }
1158
1165
  t && l.value.slice(y.start, c).trim() === "" && (p = !0);
1159
1166
  }
1160
- const m = Zt(l.value, c, {
1167
+ const m = Qt(l.value, c, {
1161
1168
  language: e.language,
1162
- completions: fe.value,
1163
- declared: Ke(l.value, c),
1169
+ completions: ve.value,
1170
+ declared: et(l.value, c),
1164
1171
  auto: !p
1165
1172
  });
1166
1173
  if (!m) {
@@ -1169,7 +1176,7 @@ const un = {
1169
1176
  }
1170
1177
  let x = m.items;
1171
1178
  if (e.completionFilter) {
1172
- const y = tt(l.value, c);
1179
+ const y = ct(l.value, c);
1173
1180
  if (x = e.completionFilter(x, {
1174
1181
  prefix: y.prefix,
1175
1182
  chain: y.chain,
@@ -1182,44 +1189,44 @@ const un = {
1182
1189
  return;
1183
1190
  }
1184
1191
  }
1185
- O.value = x, T.value = { start: m.start, end: m.end }, M.value = 0, w.value = !0, Me();
1192
+ N.value = x, $.value = { start: m.start, end: m.end }, R.value = 0, w.value = !0, Ne();
1186
1193
  }
1187
- function xt(t) {
1194
+ function It(t) {
1188
1195
  a.value = t, i("update:modelValue", t), i("change", t);
1189
1196
  }
1190
- function re(t, l, c, p = t + c.length) {
1197
+ function ue(t, l, c, p = t + c.length) {
1191
1198
  const h = d.value;
1192
1199
  if (!h) return;
1193
1200
  const m = h.value.slice(0, t) + c + h.value.slice(l);
1194
- xt(m), _(), P(() => {
1195
- h.value = m, h.setSelectionRange(p, p), h.focus(), D(!0), X();
1201
+ It(m), _(), V(() => {
1202
+ h.value = m, h.setSelectionRange(p, p), h.focus(), j(!0), X();
1196
1203
  });
1197
1204
  }
1198
- function Ie(t = O.value[M.value]) {
1205
+ function We(t = N.value[R.value]) {
1199
1206
  if (!t) return;
1200
1207
  const l = t.insertText ?? t.label;
1201
- re(T.value.start, T.value.end, l), _();
1208
+ ue($.value.start, $.value.end, l), _();
1202
1209
  }
1203
- function He(t) {
1204
- const l = O.value.length;
1205
- l && (M.value = (M.value + t + l) % l, P(() => {
1210
+ function ze(t) {
1211
+ const l = N.value.length;
1212
+ l && (R.value = (R.value + t + l) % l, V(() => {
1206
1213
  var c, p;
1207
1214
  (p = (c = v.value) == null ? void 0 : c.querySelector(".is-active")) == null || p.scrollIntoView({ block: "nearest" });
1208
1215
  }));
1209
1216
  }
1210
- function $t(t) {
1217
+ function Ht(t) {
1211
1218
  const l = t.target;
1212
- a.value = l.value, i("update:modelValue", l.value), i("change", l.value), j(), D(), X(), P(X), ne(!0);
1219
+ a.value = l.value, i("update:modelValue", l.value), i("change", l.value), F(), j(), X(), V(X), ne(!0);
1213
1220
  }
1214
- function Tt(t) {
1215
- if (_(), j(), !e.collapsible || !e.collapseOnBlur || !F.value) return;
1221
+ function Lt(t) {
1222
+ if (_(), F(), !e.collapsible || !e.collapseOnBlur || !P.value) return;
1216
1223
  const l = t.relatedTarget;
1217
- l && l.closest(".expand-toggle") || Te(!1);
1224
+ l && l.closest(".expand-toggle") || Le(!1);
1218
1225
  }
1219
- function Ct() {
1220
- Le(), X();
1226
+ function _t() {
1227
+ De(), X();
1221
1228
  }
1222
- function Le() {
1229
+ function De() {
1223
1230
  const t = d.value;
1224
1231
  if (!t || e.readonly) return;
1225
1232
  if (t.selectionStart !== t.selectionEnd) {
@@ -1232,7 +1239,7 @@ const un = {
1232
1239
  return;
1233
1240
  }
1234
1241
  if (e.mode === "template") {
1235
- const c = we(
1242
+ const c = Me(
1236
1243
  t.value,
1237
1244
  l,
1238
1245
  e.templateOpen,
@@ -1245,31 +1252,31 @@ const un = {
1245
1252
  }
1246
1253
  _();
1247
1254
  }
1248
- let ye = 0;
1249
- function _e() {
1250
- window.clearTimeout(ye), ye = window.setTimeout(() => {
1251
- ye = 0, Le(), X();
1255
+ let $e = 0;
1256
+ function je() {
1257
+ window.clearTimeout($e), $e = window.setTimeout(() => {
1258
+ $e = 0, De(), X();
1252
1259
  }, 0);
1253
1260
  }
1254
- function Ae(t) {
1261
+ function Fe(t) {
1255
1262
  t.target !== d.value && w.value && _();
1256
1263
  }
1257
- function St() {
1258
- j(), D(), me.value && Et();
1264
+ function At() {
1265
+ F(), j(), re.value && Bt();
1259
1266
  }
1260
- let ke = 0;
1261
- function Et() {
1262
- window.clearTimeout(ke), ke = window.setTimeout(() => {
1263
- ke = 0, Rt();
1267
+ let Ce = 0;
1268
+ function Bt() {
1269
+ window.clearTimeout(Ce), Ce = window.setTimeout(() => {
1270
+ Ce = 0, Ot();
1264
1271
  }, 120);
1265
1272
  }
1266
- function Rt() {
1273
+ function Ot() {
1267
1274
  const t = d.value;
1268
1275
  if (!t) return;
1269
- const l = ee.lineHeight, c = t.scrollTop, p = Math.round(c / l) * l;
1270
- Math.abs(p - c) < 0.5 || (t.scrollTop = p, D());
1276
+ const l = G.lineHeight, c = t.scrollTop, p = Math.round(c / l) * l;
1277
+ Math.abs(p - c) < 0.5 || (t.scrollTop = p, j());
1271
1278
  }
1272
- function Mt(t) {
1279
+ function Nt(t) {
1273
1280
  var h;
1274
1281
  const l = d.value;
1275
1282
  if (!l) return;
@@ -1280,15 +1287,15 @@ const un = {
1280
1287
  }
1281
1288
  if (w.value) {
1282
1289
  if (t.key === "ArrowDown") {
1283
- t.preventDefault(), He(1);
1290
+ t.preventDefault(), ze(1);
1284
1291
  return;
1285
1292
  }
1286
1293
  if (t.key === "ArrowUp") {
1287
- t.preventDefault(), He(-1);
1294
+ t.preventDefault(), ze(-1);
1288
1295
  return;
1289
1296
  }
1290
1297
  if (t.key === "Enter" || t.key === "Tab") {
1291
- t.preventDefault(), Ie();
1298
+ t.preventDefault(), We();
1292
1299
  return;
1293
1300
  }
1294
1301
  if (t.key === "Escape") {
@@ -1296,12 +1303,12 @@ const un = {
1296
1303
  return;
1297
1304
  }
1298
1305
  if (p || c) {
1299
- _(), p && !c && _e();
1306
+ _(), p && !c && je();
1300
1307
  return;
1301
1308
  }
1302
1309
  }
1303
1310
  if (p && !c) {
1304
- _e();
1311
+ je();
1305
1312
  return;
1306
1313
  }
1307
1314
  if (t.key === "Enter" && !c && !t.shiftKey) {
@@ -1309,83 +1316,83 @@ const un = {
1309
1316
  if (m !== l.selectionEnd) return;
1310
1317
  const x = l.value.lastIndexOf(`
1311
1318
  `, m - 1) + 1, k = l.value.slice(x, m), y = ((h = k.match(/^[ \t]*/)) == null ? void 0 : h[0]) ?? "", C = /[{[(]$/.test(k.trimEnd()) ? " " : "";
1312
- t.preventDefault(), re(m, m, `
1319
+ t.preventDefault(), ue(m, m, `
1313
1320
  ${y}${C}`);
1314
1321
  return;
1315
1322
  }
1316
1323
  if (t.key === "Tab") {
1317
- t.preventDefault(), re(l.selectionStart, l.selectionEnd, " ");
1324
+ t.preventDefault(), ue(l.selectionStart, l.selectionEnd, " ");
1318
1325
  return;
1319
1326
  }
1320
1327
  if (t.key.length === 1 && !c && !t.altKey && f[t.key]) {
1321
1328
  if (l.selectionStart !== l.selectionEnd) return;
1322
1329
  const m = l.selectionStart, x = l.value[m - 1], k = l.value[m];
1323
1330
  if ((t.key === '"' || t.key === "'") && x && /[\w$]/.test(x) || k !== void 0 && !/[\s)\]},;:]/.test(k)) return;
1324
- t.preventDefault(), re(m, m, t.key + f[t.key], m + 1), e.mode === "template" && P(() => ne(!0));
1331
+ t.preventDefault(), ue(m, m, t.key + f[t.key], m + 1), e.mode === "template" && V(() => ne(!0));
1325
1332
  }
1326
1333
  }
1327
- function Be() {
1328
- w.value && _(), j(), P(() => {
1329
- he(), D(!0);
1334
+ function Pe() {
1335
+ w.value && _(), F(), V(() => {
1336
+ ke(), j(!0);
1330
1337
  });
1331
1338
  }
1332
- let te = null;
1333
- return Ot(() => {
1334
- window.addEventListener("resize", Be), window.addEventListener("scroll", Ae, !0), P(() => {
1335
- he(), D(!0);
1336
- }), typeof ResizeObserver < "u" && d.value && (te = new ResizeObserver(() => {
1337
- D(!0), X();
1338
- }), te.observe(d.value));
1339
- }), Nt(() => {
1340
- window.removeEventListener("resize", Be), window.removeEventListener("scroll", Ae, !0), te == null || te.disconnect(), te = null;
1339
+ let ee = null;
1340
+ return jt(() => {
1341
+ window.addEventListener("resize", Pe), window.addEventListener("scroll", Fe, !0), V(() => {
1342
+ ke(), j(!0);
1343
+ }), typeof ResizeObserver < "u" && d.value && (ee = new ResizeObserver(() => {
1344
+ j(!0), X();
1345
+ }), ee.observe(d.value));
1346
+ }), Ft(() => {
1347
+ window.removeEventListener("resize", Pe), window.removeEventListener("scroll", Fe, !0), ee == null || ee.disconnect(), ee = null;
1341
1348
  }), s({ focus: () => {
1342
1349
  var t;
1343
1350
  return (t = d.value) == null ? void 0 : t.focus();
1344
1351
  } }), (t, l) => (I(), H("div", {
1345
- class: le(["code-input", { "is-collapsible": n.collapsible }]),
1346
- style: ce(ft.value)
1352
+ class: ie(["code-input", { "is-collapsible": n.collapsible }]),
1353
+ style: he(kt.value)
1347
1354
  }, [
1348
- B("div", {
1349
- class: le(["code-editor", {
1355
+ A("div", {
1356
+ class: ie(["code-editor", {
1350
1357
  "is-readonly": n.readonly,
1351
1358
  "is-dark": n.theme === "dark",
1352
- "is-collapsed": me.value,
1353
- "is-expanding": pe.value
1359
+ "is-collapsed": re.value,
1360
+ "is-expanding": ye.value
1354
1361
  }]),
1355
- style: ce(pt.value),
1356
- onAnimationend: De(mt, ["self"])
1362
+ style: he(wt.value),
1363
+ onAnimationend: Ue(xt, ["self"])
1357
1364
  }, [
1358
- n.lineNumbers ? (I(), H("div", un, [
1359
- B("div", {
1365
+ n.lineNumbers ? (I(), H("div", hn, [
1366
+ A("div", {
1360
1367
  ref_key: "gutterInner",
1361
1368
  ref: b,
1362
1369
  class: "gutter-inner code-font"
1363
1370
  }, [
1364
- (I(!0), H(je, null, Fe(dt.value, (c) => (I(), H("div", {
1371
+ (I(!0), H(Ye, null, Xe(yt.value, (c) => (I(), H("div", {
1365
1372
  key: c,
1366
1373
  class: "gutter-line"
1367
1374
  }, Y(c), 1))), 128))
1368
1375
  ], 512)
1369
1376
  ])) : K("", !0),
1370
- B("div", {
1377
+ A("div", {
1371
1378
  ref_key: "stage",
1372
- ref: $,
1379
+ ref: T,
1373
1380
  class: "stage"
1374
1381
  }, [
1375
- B("div", {
1382
+ A("div", {
1376
1383
  ref_key: "highlightLayer",
1377
- ref: z,
1384
+ ref: D,
1378
1385
  class: "highlight code-font"
1379
1386
  }, [
1380
- B("pre", {
1387
+ A("pre", {
1381
1388
  ref_key: "highlightInner",
1382
1389
  ref: S,
1383
1390
  class: "code-font"
1384
1391
  }, [
1385
- B("code", { innerHTML: ut.value }, null, 8, dn)
1392
+ A("code", { innerHTML: vt.value }, null, 8, gn)
1386
1393
  ], 512)
1387
1394
  ], 512),
1388
- B("textarea", {
1395
+ A("textarea", {
1389
1396
  ref_key: "textarea",
1390
1397
  ref: d,
1391
1398
  class: "code-font input",
@@ -1397,58 +1404,58 @@ ${y}${C}`);
1397
1404
  autocapitalize: "off",
1398
1405
  autocorrect: "off",
1399
1406
  wrap: "off",
1400
- onInput: $t,
1401
- onKeydown: Mt,
1402
- onScroll: St,
1403
- onClick: Ct,
1404
- onMousemove: wt,
1405
- onMouseleave: j,
1406
- onBlur: Tt
1407
- }, null, 40, fn),
1407
+ onInput: Ht,
1408
+ onKeydown: Nt,
1409
+ onScroll: At,
1410
+ onClick: _t,
1411
+ onMousemove: Mt,
1412
+ onMouseleave: F,
1413
+ onBlur: Lt
1414
+ }, null, 40, bn),
1408
1415
  w.value ? (I(), H("ul", {
1409
1416
  key: 0,
1410
1417
  ref_key: "popup",
1411
1418
  ref: v,
1412
1419
  class: "popup",
1413
- style: ce(L.value),
1414
- onMousedown: l[0] || (l[0] = De(() => {
1420
+ style: he(L.value),
1421
+ onMousedown: l[0] || (l[0] = Ue(() => {
1415
1422
  }, ["prevent"]))
1416
1423
  }, [
1417
- (I(!0), H(je, null, Fe(O.value, (c, p) => (I(), H("li", {
1424
+ (I(!0), H(Ye, null, Xe(N.value, (c, p) => (I(), H("li", {
1418
1425
  key: `${c.label}-${p}`,
1419
- class: le(["popup-item", { "is-active": p === M.value }]),
1420
- onMouseenter: (h) => M.value = p,
1421
- onClick: (h) => Ie(c)
1426
+ class: ie(["popup-item", { "is-active": p === R.value }]),
1427
+ onMouseenter: (h) => R.value = p,
1428
+ onClick: (h) => We(c)
1422
1429
  }, [
1423
- B("span", {
1424
- class: le(["badge", `badge-${c.kind}`])
1425
- }, Y(Ce(c.kind)), 3),
1426
- B("span", mn, Y(c.label), 1),
1427
- c.detail ? (I(), H("span", hn, Y(c.detail), 1)) : K("", !0)
1428
- ], 42, pn))), 128))
1430
+ A("span", {
1431
+ class: ie(["badge", `badge-${c.kind}`])
1432
+ }, Y(_e(c.kind)), 3),
1433
+ A("span", yn, Y(c.label), 1),
1434
+ c.detail ? (I(), H("span", kn, Y(c.detail), 1)) : K("", !0)
1435
+ ], 42, vn))), 128))
1429
1436
  ], 36)) : K("", !0),
1430
1437
  g.value ? (I(), H("div", {
1431
1438
  key: 1,
1432
1439
  ref_key: "hoverCard",
1433
1440
  ref: W,
1434
1441
  class: "hover-card",
1435
- style: ce(ae.value)
1442
+ style: he(se.value)
1436
1443
  }, [
1437
- B("div", gn, [
1438
- B("span", {
1439
- class: le(["badge", `badge-${g.value.kind}`])
1440
- }, Y(Ce(g.value.kind)), 3),
1441
- B("span", bn, [
1442
- Wt(Y(g.value.label), 1),
1443
- g.value.detail ? (I(), H("span", vn, ":")) : K("", !0)
1444
+ A("div", wn, [
1445
+ A("span", {
1446
+ class: ie(["badge", `badge-${g.value.kind}`])
1447
+ }, Y(_e(g.value.kind)), 3),
1448
+ A("span", xn, [
1449
+ Pt(Y(g.value.label), 1),
1450
+ g.value.detail ? (I(), H("span", Tn, ":")) : K("", !0)
1444
1451
  ]),
1445
- g.value.detail ? (I(), H("span", yn, Y(g.value.detail), 1)) : K("", !0)
1452
+ g.value.detail ? (I(), H("span", $n, Y(g.value.detail), 1)) : K("", !0)
1446
1453
  ]),
1447
- g.value.documentation ? (I(), H("p", kn, Y(g.value.documentation), 1)) : K("", !0),
1448
- g.value.type ? (I(), H("pre", wn, [
1449
- B("code", {
1450
- innerHTML: gt(g.value.type)
1451
- }, null, 8, xn)
1454
+ g.value.documentation ? (I(), H("p", Cn, Y(g.value.documentation), 1)) : K("", !0),
1455
+ g.value.type ? (I(), H("pre", Sn, [
1456
+ A("code", {
1457
+ innerHTML: $t(g.value.type)
1458
+ }, null, 8, En)
1452
1459
  ])) : K("", !0)
1453
1460
  ], 4)) : K("", !0)
1454
1461
  ], 512),
@@ -1456,12 +1463,12 @@ ${y}${C}`);
1456
1463
  key: 1,
1457
1464
  type: "button",
1458
1465
  class: "expand-toggle",
1459
- title: F.value ? "收起" : "展开",
1460
- "aria-label": F.value ? "收起编辑器" : "展开编辑器",
1461
- onClick: ht
1466
+ title: P.value ? "收起" : "展开",
1467
+ "aria-label": P.value ? "收起编辑器" : "展开编辑器",
1468
+ onClick: Tt
1462
1469
  }, [
1463
- F.value ? (I(), H("svg", Cn, [...l[2] || (l[2] = [
1464
- B("path", {
1470
+ P.value ? (I(), H("svg", In, [...l[2] || (l[2] = [
1471
+ A("path", {
1465
1472
  d: "M11 2 5 8 11 14",
1466
1473
  fill: "none",
1467
1474
  stroke: "currentColor",
@@ -1469,8 +1476,8 @@ ${y}${C}`);
1469
1476
  "stroke-linecap": "round",
1470
1477
  "stroke-linejoin": "round"
1471
1478
  }, null, -1)
1472
- ])])) : (I(), H("svg", Tn, [...l[1] || (l[1] = [
1473
- B("path", {
1479
+ ])])) : (I(), H("svg", Mn, [...l[1] || (l[1] = [
1480
+ A("path", {
1474
1481
  d: "M6 2 12 8 6 14",
1475
1482
  fill: "none",
1476
1483
  stroke: "currentColor",
@@ -1479,35 +1486,35 @@ ${y}${C}`);
1479
1486
  "stroke-linejoin": "round"
1480
1487
  }, null, -1)
1481
1488
  ])]))
1482
- ], 8, $n)) : K("", !0)
1489
+ ], 8, Rn)) : K("", !0)
1483
1490
  ], 38)
1484
1491
  ], 6));
1485
1492
  }
1486
- }), En = (n, s) => {
1493
+ }), Ln = (n, s) => {
1487
1494
  const o = n.__vccOpts || n;
1488
1495
  for (const [e, i] of s)
1489
1496
  o[e] = i;
1490
1497
  return o;
1491
- }, Rn = /* @__PURE__ */ En(Sn, [["__scopeId", "data-v-38bf31d4"]]), Ln = {
1498
+ }, _n = /* @__PURE__ */ Ln(Hn, [["__scopeId", "data-v-3779a6df"]]), On = {
1492
1499
  install(n) {
1493
- n.component("CodeInput", Rn);
1500
+ n.component("CodeInput", _n);
1494
1501
  }
1495
1502
  };
1496
1503
  export {
1497
- Rn as CodeEditor,
1498
- Zt as collectCompletions,
1499
- Ln as default,
1500
- zt as defaultCompletions,
1501
- jt as findArgumentContext,
1502
- we as findTemplateRange,
1503
- Ve as getKeywordSet,
1504
- et as getKeywords,
1505
- de as highlight,
1506
- cn as highlightTemplate,
1507
- Hn as isInsideTemplate,
1508
- ln as parseTsCompletions,
1509
- on as parseTsSignatures,
1510
- Yt as resolveHoverItem,
1511
- Ke as scanDeclarations,
1512
- ue as tokenize
1504
+ _n as CodeEditor,
1505
+ Qt as collectCompletions,
1506
+ On as default,
1507
+ Vt as defaultCompletions,
1508
+ Kt as findArgumentContext,
1509
+ Me as findTemplateRange,
1510
+ Qe as getKeywordSet,
1511
+ rt as getKeywords,
1512
+ be as highlight,
1513
+ mn as highlightTemplate,
1514
+ Bn as isInsideTemplate,
1515
+ cn as parseTsCompletions,
1516
+ un as parseTsSignatures,
1517
+ en as resolveHoverItem,
1518
+ et as scanDeclarations,
1519
+ ge as tokenize
1513
1520
  };