@onerjs/code-input 0.1.0 → 0.1.2

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 mt, ref as $, computed as P, watch as Ie, nextTick as O, onMounted as ht, onBeforeUnmount as bt, openBlock as T, createElementBlock as C, normalizeStyle as te, normalizeClass as ne, createElementVNode as I, Fragment as Me, renderList as He, toDisplayString as F, createCommentVNode as z, withModifiers as gt, createTextVNode as vt } from "vue";
2
- const yt = [
1
+ import { defineComponent as wt, ref as C, computed as V, watch as Be, nextTick as j, onMounted as $t, onBeforeUnmount as Ct, openBlock as S, createElementBlock as E, normalizeStyle as ae, normalizeClass as te, createElementVNode as R, withModifiers as Le, Fragment as Oe, renderList as Ne, toDisplayString as K, createCommentVNode as D, createTextVNode as Tt } from "vue";
2
+ const St = [
3
3
  {
4
4
  label: "Math",
5
5
  kind: "class",
@@ -134,7 +134,7 @@ const yt = [
134
134
  kind: "function",
135
135
  detail: "(id: number) => void"
136
136
  }
137
- ], Ae = [
137
+ ], ze = [
138
138
  "break",
139
139
  "case",
140
140
  "catch",
@@ -179,7 +179,7 @@ const yt = [
179
179
  "undefined",
180
180
  "NaN",
181
181
  "Infinity"
182
- ], kt = [
182
+ ], Et = [
183
183
  "abstract",
184
184
  "any",
185
185
  "as",
@@ -209,414 +209,534 @@ const yt = [
209
209
  "type",
210
210
  "unknown"
211
211
  ];
212
- function Fe(o) {
213
- return o === "typescript" ? [...Ae, ...kt] : Ae;
212
+ function Ye(l) {
213
+ return l === "typescript" ? [...ze, ...Et] : ze;
214
214
  }
215
- function Le(o) {
216
- return new Set(Fe(o));
215
+ function je(l) {
216
+ return new Set(Ye(l));
217
217
  }
218
- const wt = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/, Be = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, xt = /^[A-Za-z_$]/;
219
- function $t(o, r) {
220
- const i = o.slice(0, r), n = wt.exec(i);
221
- if (!n) return { prefix: "", chain: [] };
222
- const l = n[1] ?? "", c = n[2] ?? "", u = l.split(".").filter(Boolean).map((d) => d.replace(/\?$/, ""));
218
+ const It = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/, De = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, Rt = /^[A-Za-z_$]/;
219
+ function Je(l, s) {
220
+ const a = l.slice(0, s), t = It.exec(a);
221
+ if (!t) return { prefix: "", chain: [] };
222
+ const o = t[1] ?? "", c = t[2] ?? "", u = o.split(".").filter(Boolean).map((d) => d.replace(/\?$/, ""));
223
223
  return { prefix: c, chain: u };
224
224
  }
225
- function Oe(o, r) {
226
- const i = [], n = /* @__PURE__ */ new Set();
227
- let l;
228
- for (Be.lastIndex = 0; (l = Be.exec(o)) && !(l.index >= r); ) {
229
- const c = l[1];
230
- if (n.has(c)) continue;
231
- n.add(c);
232
- const u = l[0].slice(0, l[0].indexOf(c)).trim();
233
- i.push({
225
+ function We(l, s) {
226
+ const a = [], t = /* @__PURE__ */ new Set();
227
+ let o;
228
+ for (De.lastIndex = 0; (o = De.exec(l)) && !(o.index >= s); ) {
229
+ const c = o[1];
230
+ if (t.has(c)) continue;
231
+ t.add(c);
232
+ const u = o[0].slice(0, o[0].indexOf(c)).trim();
233
+ a.push({
234
234
  label: c,
235
235
  kind: u === "function" ? "function" : u === "class" ? "class" : "variable",
236
236
  detail: "当前文件"
237
237
  });
238
238
  }
239
- return i;
239
+ return a;
240
240
  }
241
- function Ve(o, r) {
242
- let i = r;
243
- for (const n of o) {
244
- if (!i) return null;
245
- const l = i.find((c) => c.label === n);
246
- if (!l) return null;
247
- i = l.members ?? [];
241
+ function Ge(l, s) {
242
+ let a = s;
243
+ for (const t of l) {
244
+ if (!a) return null;
245
+ const o = a.find((c) => c.label === t);
246
+ if (!o) return null;
247
+ a = o.members ?? [];
248
248
  }
249
- return i;
249
+ return a;
250
250
  }
251
- function Tt(o, r) {
252
- const i = o.toLowerCase(), n = r.toLowerCase(), l = i.indexOf(n);
253
- if (l === 0) return 1e3 - i.length;
254
- if (l > 0) return 800 - l;
251
+ function Mt(l, s) {
252
+ const a = l.toLowerCase(), t = s.toLowerCase(), o = a.indexOf(t);
253
+ if (o === 0) return 1e3 - a.length;
254
+ if (o > 0) return 800 - o;
255
255
  let c = 0, u = 0, d = -1;
256
- for (let a = 0; a < i.length && c < n.length; a++)
257
- i[a] === n[c] && (d >= 0 && (u += a - d - 1), d = a, c++);
258
- return c !== n.length ? null : 400 - u - i.length;
256
+ for (let i = 0; i < a.length && c < t.length; i++)
257
+ a[i] === t[c] && (d >= 0 && (u += i - d - 1), d = i, c++);
258
+ return c !== t.length ? null : 400 - u - a.length;
259
259
  }
260
- function Ct(o, r) {
261
- if (!r) return o;
262
- const i = [];
263
- for (const n of o) {
264
- const l = Tt(n.label, r);
265
- l !== null && i.push({ item: n, score: l });
260
+ function _t(l, s) {
261
+ if (!s) return l;
262
+ const a = [];
263
+ for (const t of l) {
264
+ const o = Mt(t.label, s);
265
+ o !== null && a.push({ item: t, score: o });
266
266
  }
267
- return i.sort((n, l) => l.score - n.score || n.item.label.localeCompare(l.item.label)), i.map((n) => n.item);
267
+ return a.sort((t, o) => o.score - t.score || t.item.label.localeCompare(o.item.label)), a.map((t) => t.item);
268
268
  }
269
- function St(o) {
270
- const r = /* @__PURE__ */ new Set(), i = [];
271
- for (const n of o)
272
- r.has(n.label) || (r.add(n.label), i.push(n));
273
- return i;
269
+ function Ht(l) {
270
+ const s = /* @__PURE__ */ new Set(), a = [];
271
+ for (const t of l)
272
+ s.has(t.label) || (s.add(t.label), a.push(t));
273
+ return a;
274
274
  }
275
- function Et(o, r, i) {
276
- const { prefix: n, chain: l } = $t(o, r);
277
- if (i.auto && (!n && l.length === 0 || n && !xt.test(n)))
275
+ function At(l, s, a) {
276
+ const { prefix: t, chain: o } = Je(l, s);
277
+ if (a.auto && (!t && o.length === 0 || t && !Rt.test(t)))
278
278
  return null;
279
- const c = i.declared ?? [], u = [...c, ...i.completions];
279
+ const c = a.declared ?? [], u = [...c, ...a.completions];
280
280
  let d;
281
- if (l.length > 0) {
282
- const f = Ve(l, u);
283
- if (!f || f.length === 0) return null;
284
- d = f;
281
+ if (o.length > 0) {
282
+ const p = Ge(o, u);
283
+ if (!p || p.length === 0) return null;
284
+ d = p;
285
285
  } else
286
286
  d = [
287
- ...i.completions,
287
+ ...a.completions,
288
288
  ...c,
289
- ...Fe(i.language).map((f) => ({
290
- label: f,
289
+ ...Ye(a.language).map((p) => ({
290
+ label: p,
291
291
  kind: "keyword"
292
292
  }))
293
293
  ];
294
- const a = Ct(St(d), n);
295
- return a.length === 0 ? null : {
296
- items: a,
297
- start: r - n.length,
298
- end: r
294
+ const i = _t(Ht(d), t);
295
+ return i.length === 0 ? null : {
296
+ items: i,
297
+ start: s - t.length,
298
+ end: s
299
299
  };
300
300
  }
301
- const _t = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
302
- function Rt(o, r, i, n) {
303
- const l = o.slice(r, i);
304
- if (!l) return null;
305
- const c = [...n.declared ?? [], ...n.completions], u = _t.exec(o.slice(0, r));
301
+ const Bt = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
302
+ function Lt(l, s, a, t) {
303
+ const o = l.slice(s, a);
304
+ if (!o) return null;
305
+ const c = [...t.declared ?? [], ...t.completions], u = Bt.exec(l.slice(0, s));
306
306
  if (u) {
307
- const d = u[1].split(".").filter(Boolean).map((b) => b.replace(/\?$/, "")), a = Ve(d, c), f = a == null ? void 0 : a.find((b) => b.label === l);
308
- if (f) return f;
307
+ const d = u[1].split(".").filter(Boolean).map((M) => M.replace(/\?$/, "")), i = Ge(d, c), p = i == null ? void 0 : i.find((M) => M.label === o);
308
+ if (p) return p;
309
309
  }
310
- return c.find((d) => d.label === l) ?? null;
310
+ return c.find((d) => d.label === o) ?? null;
311
311
  }
312
- const V = "[A-Za-z_$][\\w$]*", Ne = "(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";
313
- function We(o, r) {
314
- let i = 0, n = !1, l = r;
315
- for (let c = r; c < o.length; c++) {
316
- const u = o[c];
312
+ const Z = "[A-Za-z_$][\\w$]*", Fe = "(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";
313
+ function Pe(l, s) {
314
+ let a = 0, t = !1, o = s;
315
+ for (let c = s; c < l.length; c++) {
316
+ const u = l[c];
317
317
  for (let d = 0; d < u.length; d++) {
318
- const a = u[d];
319
- a === "{" ? (i++, n = !0) : a === "}" && i--;
318
+ const i = u[d];
319
+ i === "{" ? (a++, t = !0) : i === "}" && a--;
320
320
  }
321
- if (n && i <= 0) {
322
- l = c;
321
+ if (t && a <= 0) {
322
+ o = c;
323
323
  break;
324
324
  }
325
325
  }
326
- return { end: l, body: o.slice(r + 1, l) };
326
+ return { end: o, body: l.slice(s + 1, o) };
327
327
  }
328
- function ze(o) {
329
- return o.trim().replace(/[,;]$/, "").trim();
328
+ function Ve(l) {
329
+ return l.trim().replace(/[,;]$/, "").trim();
330
+ }
331
+ function Ot(l) {
332
+ return /^(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:interface|class|type|function|const|let|var|namespace|enum)\b/.test(
333
+ l
334
+ );
330
335
  }
331
- function De(o) {
332
- const r = [], i = /* @__PURE__ */ new Set(), n = new RegExp(`^${Ne}(${V})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`), l = new RegExp(`^${Ne}(${V})(\\?)?\\s*:\\s*(.+?);?$`);
333
- for (const c of o) {
334
- const u = c.trim();
335
- if (!u || u.startsWith("//") || u.startsWith("/*") || u.startsWith("*") || u.startsWith("}"))
336
+ function ne(l, s) {
337
+ const a = l[s];
338
+ let t = a.lastIndexOf("}");
339
+ const o = a.lastIndexOf(";");
340
+ if (o > t && (t = o), t === -1) return;
341
+ const c = a.slice(t + 1).replace(/^[\s;]+/, "").trim();
342
+ !c || !Ot(c) || (l[s] = a.slice(0, t + 1), l.splice(s + 1, 0, c));
343
+ }
344
+ function U(l) {
345
+ return l.length ? l.join(`
346
+ `).replace(/^\s*\/\*\*?/, "").replace(/\*\/\s*$/, "").split(`
347
+ `).map((s) => s.replace(/^\s*\*+\s?/, "").replace(/^\s*\/\/\s?/, "")).join(`
348
+ `).replace(/\n{3,}/g, `
349
+
350
+ `).trim() : "";
351
+ }
352
+ function Ke(l) {
353
+ return l.split(`
354
+ `).filter((s) => !/^\s*(\/\/|\/\*|\*)/.test(s)).join(`
355
+ `).replace(/\n{2,}/g, `
356
+ `).trim();
357
+ }
358
+ function Ze(l) {
359
+ const s = [], a = /* @__PURE__ */ new Set(), t = new RegExp(`^${Fe}(${Z})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`), o = new RegExp(`^${Fe}(${Z})(\\?)?\\s*:\\s*(.+?);?$`);
360
+ let c = [], u = !1;
361
+ for (const d of l) {
362
+ const i = d.trim();
363
+ if (u) {
364
+ c.push(i), i.includes("*/") && (u = !1);
336
365
  continue;
337
- const d = n.exec(u);
338
- if (d) {
339
- const f = d[1];
340
- if (i.has(f)) continue;
341
- i.add(f), r.push({
342
- label: f,
366
+ }
367
+ if (i.startsWith("/*")) {
368
+ c.push(i), i.includes("*/") || (u = !0);
369
+ continue;
370
+ }
371
+ if (i.startsWith("//")) {
372
+ c.push(i);
373
+ continue;
374
+ }
375
+ if (!i || i.startsWith("}") || i.startsWith("[")) {
376
+ c = [];
377
+ continue;
378
+ }
379
+ const p = t.exec(i);
380
+ if (p) {
381
+ const W = U(c);
382
+ c = [];
383
+ const g = p[1];
384
+ if (a.has(g)) continue;
385
+ a.add(g), s.push({
386
+ label: g,
343
387
  kind: "function",
344
- detail: `(${d[3].trim()}) => ${ze(d[4])}`
388
+ detail: `(${p[3].trim()}) => ${Ve(p[4])}`,
389
+ documentation: W || void 0
345
390
  });
346
391
  continue;
347
392
  }
348
- const a = l.exec(u);
349
- if (a) {
350
- const f = a[1];
351
- if (i.has(f)) continue;
352
- i.add(f);
353
- const b = ze(a[3]), y = /^\(|=>/.test(b) ? "function" : "property";
354
- r.push({ label: f, kind: y, detail: b });
393
+ const M = o.exec(i);
394
+ if (M) {
395
+ const W = U(c);
396
+ c = [];
397
+ const g = M[1];
398
+ if (a.has(g)) continue;
399
+ a.add(g);
400
+ const b = Ve(M[3]), H = /^\(|=>/.test(b) ? "function" : "property";
401
+ s.push({
402
+ label: g,
403
+ kind: H,
404
+ detail: b,
405
+ documentation: W || void 0
406
+ });
355
407
  }
356
408
  }
357
- return r;
409
+ return s;
358
410
  }
359
- function Ke(o) {
360
- const r = o.replace(/\[\]/g, "").replace(/<[^>]*>/g, "").replace(/\s*\|\s*null\s*/g, "").trim(), i = new RegExp(`^(${V})$`).exec(r);
361
- return i ? i[1] : null;
411
+ function Xe(l) {
412
+ const s = l.replace(/\[\]/g, "").replace(/<[^>]*>/g, "").replace(/\s*\|\s*null\s*/g, "").trim(), a = new RegExp(`^(${Z})$`).exec(s);
413
+ return a ? a[1] : null;
362
414
  }
363
- function It(o) {
364
- const r = o.trim();
365
- if (!r || r.endsWith(";")) return !1;
366
- const i = (r.match(/[(<[{]/g) ?? []).length, n = (r.match(/[)>\]}]/g) ?? []).length;
367
- return /[|&,(<]\s*$/.test(r) || i > n;
415
+ function Nt(l) {
416
+ const s = l.trim();
417
+ if (!s || s.endsWith(";")) return !1;
418
+ const a = (s.match(/[(<[{]/g) ?? []).length, t = (s.match(/[)>\]}]/g) ?? []).length;
419
+ return /[|&,(<]\s*$/.test(s) || a > t;
368
420
  }
369
- function Ze(o, r, i, n = 0) {
370
- return n > 6 ? o : o.map((l) => {
371
- if (l.kind !== "property" || !l.detail) return l;
372
- const c = Ke(l.detail), u = c ? r.get(c) : void 0;
373
- if (!u || i.has(u.label)) return l;
374
- const d = new Set(i);
421
+ function Qe(l, s, a, t = 0) {
422
+ return t > 6 ? l : l.map((o) => {
423
+ if (o.kind !== "property" || !o.detail) return o;
424
+ const c = Xe(o.detail), u = c ? s.get(c) : void 0;
425
+ if (!u || a.has(u.label)) return o;
426
+ const d = new Set(a);
375
427
  return d.add(u.label), {
376
- ...l,
428
+ ...o,
377
429
  type: u.type,
378
- members: Ze(u.members, r, d, n + 1)
430
+ members: Qe(u.members, s, d, t + 1)
379
431
  };
380
432
  });
381
433
  }
382
- function Mt(o) {
383
- if (!o || !o.trim()) return [];
384
- const r = o.split(`
385
- `), i = /* @__PURE__ */ new Map(), n = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${V})`), l = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${V})`), c = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${V})\\s*=`);
386
- for (let b = 0; b < r.length; b++) {
387
- const y = r[b].trim();
388
- if (!y || y.startsWith("//") || y.startsWith("/*") || y.startsWith("*")) continue;
389
- const A = n.exec(y);
390
- if (A && y.includes("{")) {
391
- const { end: w, body: x } = We(r, b), g = A[1];
392
- i.set(g, {
393
- label: g,
394
- type: r.slice(b, w + 1).join(`
395
- `).replace(/^\s*export\s+/, "").trim(),
396
- members: De(x),
397
- kind: "interface"
398
- }), b = w;
434
+ const zt = 50, le = /* @__PURE__ */ new Map();
435
+ function jt(l) {
436
+ if (!l || !l.trim()) return [];
437
+ const s = le.get(l);
438
+ if (s) return s;
439
+ const a = Dt(l);
440
+ if (le.size >= zt) {
441
+ const t = le.keys().next().value;
442
+ t !== void 0 && le.delete(t);
443
+ }
444
+ return le.set(l, a), a;
445
+ }
446
+ function Dt(l) {
447
+ const s = l.split(`
448
+ `), a = /* @__PURE__ */ new Map(), t = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${Z})`), o = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${Z})`), c = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${Z})\\s*=`);
449
+ let u = [], d = !1;
450
+ for (let g = 0; g < s.length; g++) {
451
+ const b = s[g].trim();
452
+ if (d) {
453
+ u.push(b), b.includes("*/") && (d = !1);
399
454
  continue;
400
455
  }
401
- const L = l.exec(y);
402
- if (L && y.includes("{")) {
403
- const { end: w, body: x } = We(r, b), g = L[1];
404
- i.set(g, {
405
- label: g,
406
- type: r.slice(b, w + 1).join(`
407
- `).replace(/^\s*export\s+/, "").trim(),
408
- members: De(x),
409
- kind: "class"
410
- }), b = w;
456
+ if (b.startsWith("/*")) {
457
+ u.push(b), b.includes("*/") || (d = !0);
458
+ continue;
459
+ }
460
+ if (b.startsWith("//")) {
461
+ u.push(b);
411
462
  continue;
412
463
  }
413
- const S = c.exec(y);
414
- if (S) {
415
- const w = [r[b]];
416
- let x = b;
417
- for (; It(w.join(`
418
- `)) && x + 1 < r.length; )
419
- x++, w.push(r[x]);
420
- const g = w.join(`
464
+ if (!b) {
465
+ u = [];
466
+ continue;
467
+ }
468
+ const H = t.exec(b);
469
+ if (H && b.includes("{")) {
470
+ const w = U(u);
471
+ u = [];
472
+ const { end: y, body: T } = Pe(s, g), k = H[1];
473
+ a.set(k, {
474
+ label: k,
475
+ type: Ke(
476
+ s.slice(g, y + 1).join(`
477
+ `).replace(/^\s*export\s+/, "")
478
+ ),
479
+ members: Ze(T),
480
+ kind: "interface",
481
+ documentation: w || void 0
482
+ }), ne(s, y), g = y;
483
+ continue;
484
+ }
485
+ const O = o.exec(b);
486
+ if (O && b.includes("{")) {
487
+ const w = U(u);
488
+ u = [];
489
+ const { end: y, body: T } = Pe(s, g), k = O[1];
490
+ a.set(k, {
491
+ label: k,
492
+ type: Ke(
493
+ s.slice(g, y + 1).join(`
494
+ `).replace(/^\s*export\s+/, "")
495
+ ),
496
+ members: Ze(T),
497
+ kind: "class",
498
+ documentation: w || void 0
499
+ }), ne(s, y), g = y;
500
+ continue;
501
+ }
502
+ const A = c.exec(b);
503
+ if (A) {
504
+ const w = U(u);
505
+ u = [];
506
+ const y = [s[g]];
507
+ let T = g;
508
+ for (; Nt(y.join(`
509
+ `)) && T + 1 < s.length; )
510
+ T++, y.push(s[T]);
511
+ const k = y.join(`
421
512
  `).replace(/^\s*export\s+/, "").replace(/;\s*$/, "").trim();
422
- i.set(S[1], {
423
- label: S[1],
424
- type: g,
513
+ a.set(A[1], {
514
+ label: A[1],
515
+ type: k,
425
516
  members: [],
426
- kind: "type"
427
- }), b = x;
517
+ kind: "type",
518
+ documentation: w || void 0
519
+ }), ne(s, T), g = T;
520
+ continue;
428
521
  }
522
+ u = [];
429
523
  }
430
- const u = [], d = /* @__PURE__ */ new Set(), a = new RegExp(
431
- `^(?:export\\s+)?(?:declare\\s+)?function\\s+(${V})\\s*\\(([^)]*)\\)\\s*:\\s*([^;{]+)`
432
- ), f = new RegExp(
433
- `^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${V})\\s*:\\s*([^=;]+)`
524
+ const i = [], p = /* @__PURE__ */ new Set(), M = new RegExp(
525
+ `^(?:export\\s+)?(?:declare\\s+)?function\\s+(${Z})\\s*\\(([^)]*)\\)\\s*:\\s*([^;{]+)`
526
+ ), W = new RegExp(
527
+ `^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${Z})\\s*:\\s*([^=;]+)`
434
528
  );
435
- for (const b of r) {
436
- const y = b.trim();
437
- if (!y || y.startsWith("//") || y.startsWith("/*") || y.startsWith("*")) continue;
438
- const A = a.exec(y);
439
- if (A) {
440
- const S = A[1];
441
- d.has(S) || (d.add(S), u.push({
442
- label: S,
529
+ u = [], d = !1;
530
+ for (let g = 0; g < s.length; g++) {
531
+ const b = s[g].trim();
532
+ if (d) {
533
+ u.push(b), b.includes("*/") && (d = !1);
534
+ continue;
535
+ }
536
+ if (b.startsWith("/*")) {
537
+ u.push(b), b.includes("*/") || (d = !0);
538
+ continue;
539
+ }
540
+ if (b.startsWith("//")) {
541
+ u.push(b);
542
+ continue;
543
+ }
544
+ if (!b) {
545
+ u = [];
546
+ continue;
547
+ }
548
+ const H = M.exec(b);
549
+ if (H) {
550
+ ne(s, g);
551
+ const A = U(u);
552
+ u = [];
553
+ const w = H[1];
554
+ p.has(w) || (p.add(w), i.push({
555
+ label: w,
443
556
  kind: "function",
444
- detail: `(${A[2].trim()}) => ${A[3].trim()}`
557
+ detail: `(${H[2].trim()}) => ${H[3].trim()}`,
558
+ documentation: A || void 0
445
559
  }));
446
560
  continue;
447
561
  }
448
- const L = f.exec(y);
449
- if (L) {
450
- const S = L[1];
451
- if (d.has(S)) continue;
452
- d.add(S);
453
- const w = L[2].trim(), x = Ke(w), g = x ? i.get(x) : void 0, N = (g == null ? void 0 : g.kind) === "class" ? "class" : /^\(|=>/.test(w) ? "function" : "variable";
454
- u.push({
455
- label: S,
456
- kind: N,
457
- detail: w,
458
- type: g == null ? void 0 : g.type,
459
- members: g ? Ze(g.members, i, /* @__PURE__ */ new Set([g.label])) : void 0
562
+ const O = W.exec(b);
563
+ if (O) {
564
+ ne(s, g);
565
+ const A = U(u);
566
+ u = [];
567
+ const w = O[1];
568
+ if (p.has(w)) continue;
569
+ p.add(w);
570
+ const y = O[2].trim(), T = Xe(y), k = T ? a.get(T) : void 0, $ = (k == null ? void 0 : k.kind) === "class" ? "class" : /^\(|=>/.test(y) ? "function" : "variable";
571
+ i.push({
572
+ label: w,
573
+ kind: $,
574
+ detail: y,
575
+ type: k == null ? void 0 : k.type,
576
+ documentation: A || (k == null ? void 0 : k.documentation) || void 0,
577
+ members: k ? Qe(k.members, a, /* @__PURE__ */ new Set([k.label])) : void 0
460
578
  });
579
+ continue;
461
580
  }
581
+ u = [];
462
582
  }
463
- return u;
583
+ return i;
464
584
  }
465
- function pe(o, r, i, n) {
466
- if (!i || !n) return null;
467
- const l = Math.max(0, r - 1), c = o.lastIndexOf(i, l);
468
- if (c === -1 || o.lastIndexOf(n, l) > c) return null;
469
- const d = o.indexOf(n, c + i.length);
585
+ function ve(l, s, a, t) {
586
+ if (!a || !t) return null;
587
+ const o = Math.max(0, s - 1), c = l.lastIndexOf(a, o);
588
+ if (c === -1 || l.lastIndexOf(t, o) > c) return null;
589
+ const d = l.indexOf(t, c + a.length);
470
590
  return {
471
- start: c + i.length,
472
- end: d === -1 ? o.length : d
591
+ start: c + a.length,
592
+ end: d === -1 ? l.length : d
473
593
  };
474
594
  }
475
- function tn(o, r, i, n) {
476
- return pe(o, r, i, n) !== null;
595
+ function dn(l, s, a, t) {
596
+ return ve(l, s, a, t) !== null;
477
597
  }
478
- const je = /[A-Za-z_$]/, Ht = /[\w$]/, Pe = /\s/;
479
- function le(o, r) {
480
- const i = [], n = o.length;
481
- let l = 0;
482
- for (; l < n; ) {
483
- const c = o[l], u = o[l + 1];
484
- if (Pe.test(c)) {
485
- l++;
598
+ const qe = /[A-Za-z_$]/, Wt = /[\w$]/, Ue = /\s/;
599
+ function se(l, s) {
600
+ const a = [], t = l.length;
601
+ let o = 0;
602
+ for (; o < t; ) {
603
+ const c = l[o], u = l[o + 1];
604
+ if (Ue.test(c)) {
605
+ o++;
486
606
  continue;
487
607
  }
488
608
  if (c === "/" && u === "/") {
489
- let a = o.indexOf(`
490
- `, l);
491
- a === -1 && (a = n), i.push({ start: l, end: a, type: "comment" }), l = a;
609
+ let i = l.indexOf(`
610
+ `, o);
611
+ i === -1 && (i = t), a.push({ start: o, end: i, type: "comment" }), o = i;
492
612
  continue;
493
613
  }
494
614
  if (c === "/" && u === "*") {
495
- const a = o.indexOf("*/", l + 2), f = a === -1 ? n : a + 2;
496
- i.push({ start: l, end: f, type: "comment" }), l = f;
615
+ const i = l.indexOf("*/", o + 2), p = i === -1 ? t : i + 2;
616
+ a.push({ start: o, end: p, type: "comment" }), o = p;
497
617
  continue;
498
618
  }
499
619
  if (c === '"' || c === "'") {
500
- let a = l + 1;
501
- for (; a < n; ) {
502
- if (o[a] === "\\") {
503
- a += 2;
620
+ let i = o + 1;
621
+ for (; i < t; ) {
622
+ if (l[i] === "\\") {
623
+ i += 2;
504
624
  continue;
505
625
  }
506
- if (o[a] === `
626
+ if (l[i] === `
507
627
  `) break;
508
- if (o[a] === c) {
509
- a++;
628
+ if (l[i] === c) {
629
+ i++;
510
630
  break;
511
631
  }
512
- a++;
632
+ i++;
513
633
  }
514
- i.push({ start: l, end: a, type: "string" }), l = a;
634
+ a.push({ start: o, end: i, type: "string" }), o = i;
515
635
  continue;
516
636
  }
517
637
  if (c === "`") {
518
- let a = l + 1;
519
- for (; a < n; ) {
520
- if (o[a] === "\\") {
521
- a += 2;
638
+ let i = o + 1;
639
+ for (; i < t; ) {
640
+ if (l[i] === "\\") {
641
+ i += 2;
522
642
  continue;
523
643
  }
524
- if (o[a] === "`") {
525
- a++;
644
+ if (l[i] === "`") {
645
+ i++;
526
646
  break;
527
647
  }
528
- a++;
648
+ i++;
529
649
  }
530
- i.push({ start: l, end: a, type: "template" }), l = a;
650
+ a.push({ start: o, end: i, type: "template" }), o = i;
531
651
  continue;
532
652
  }
533
653
  if (/[0-9]/.test(c) || c === "." && /[0-9]/.test(u ?? "")) {
534
- let a = l + 1;
535
- for (; a < n && /[\w.]/.test(o[a]); ) a++;
536
- i.push({ start: l, end: a, type: "number" }), l = a;
654
+ let i = o + 1;
655
+ for (; i < t && /[\w.]/.test(l[i]); ) i++;
656
+ a.push({ start: o, end: i, type: "number" }), o = i;
537
657
  continue;
538
658
  }
539
- if (je.test(c)) {
540
- let a = l + 1;
541
- for (; a < n && Ht.test(o[a]); ) a++;
542
- const f = o.slice(l, a), b = r.keywords.has(f) ? "keyword" : r.builtins.has(f) ? "builtin" : "identifier";
543
- i.push({ start: l, end: a, type: b }), l = a;
659
+ if (qe.test(c)) {
660
+ let i = o + 1;
661
+ for (; i < t && Wt.test(l[i]); ) i++;
662
+ const p = l.slice(o, i), M = s.keywords.has(p) ? "keyword" : s.builtins.has(p) ? "builtin" : "identifier";
663
+ a.push({ start: o, end: i, type: M }), o = i;
544
664
  continue;
545
665
  }
546
- let d = l + 1;
547
- for (; d < n; ) {
548
- const a = o[d];
549
- if (Pe.test(a) || je.test(a) || /[0-9]/.test(a) || a === '"' || a === "'" || a === "`" || a === "/") break;
666
+ let d = o + 1;
667
+ for (; d < t; ) {
668
+ const i = l[d];
669
+ if (Ue.test(i) || qe.test(i) || /[0-9]/.test(i) || i === '"' || i === "'" || i === "`" || i === "/") break;
550
670
  d++;
551
671
  }
552
- i.push({ start: l, end: d, type: "punctuation" }), l = d;
672
+ a.push({ start: o, end: d, type: "punctuation" }), o = d;
553
673
  }
554
- return i;
674
+ return a;
555
675
  }
556
- const At = {
676
+ const Ft = {
557
677
  "&": "&amp;",
558
678
  "<": "&lt;",
559
679
  ">": "&gt;"
560
680
  };
561
- function Z(o) {
562
- return o.replace(/[&<>]/g, (r) => At[r] ?? r);
681
+ function Y(l) {
682
+ return l.replace(/[&<>]/g, (s) => Ft[s] ?? s);
563
683
  }
564
- function oe(o, r, i = 0) {
565
- let n = "", l = 0;
566
- for (const c of r) {
567
- c.start > l && (n += Z(o.slice(l, c.start)));
568
- const u = Z(o.slice(c.start, c.end));
569
- n += `<span class="tok-${c.type}" data-start="${c.start + i}" data-end="${c.end + i}">${u}</span>`, l = c.end;
684
+ function re(l, s, a = 0) {
685
+ let t = "", o = 0;
686
+ for (const c of s) {
687
+ c.start > o && (t += Y(l.slice(o, c.start)));
688
+ const u = Y(l.slice(c.start, c.end));
689
+ t += `<span class="tok-${c.type}" data-start="${c.start + a}" data-end="${c.end + a}">${u}</span>`, o = c.end;
570
690
  }
571
- return l < o.length && (n += Z(o.slice(l))), n;
691
+ return o < l.length && (t += Y(l.slice(o))), t;
572
692
  }
573
- function Lt(o, r, i, n) {
574
- if (!i || !n) return oe(o, le(o, r));
575
- let l = "", c = 0;
576
- for (; c < o.length; ) {
577
- const u = o.indexOf(i, c);
693
+ function Pt(l, s, a, t) {
694
+ if (!a || !t) return re(l, se(l, s));
695
+ let o = "", c = 0;
696
+ for (; c < l.length; ) {
697
+ const u = l.indexOf(a, c);
578
698
  if (u === -1) {
579
- l += Z(o.slice(c));
699
+ o += Y(l.slice(c));
580
700
  break;
581
701
  }
582
- l += Z(o.slice(c, u));
583
- const d = o.indexOf(n, u + i.length), a = d === -1 ? o.length : d, f = o.slice(u + i.length, a);
584
- l += `<span class="tok-brace">${Z(i)}</span>`, l += oe(f, le(f, r), u + i.length), d === -1 ? c = a : (l += `<span class="tok-brace">${Z(n)}</span>`, c = d + n.length);
702
+ o += Y(l.slice(c, u));
703
+ const d = l.indexOf(t, u + a.length), i = d === -1 ? l.length : d, p = l.slice(u + a.length, i);
704
+ o += `<span class="tok-brace">${Y(a)}</span>`, o += re(p, se(p, s), u + a.length), d === -1 ? c = i : (o += `<span class="tok-brace">${Y(t)}</span>`, c = d + t.length);
585
705
  }
586
- return l;
706
+ return o;
587
707
  }
588
- const Bt = {
708
+ const Vt = {
589
709
  key: 0,
590
710
  class: "gutter",
591
711
  "aria-hidden": "true"
592
- }, Ot = ["innerHTML"], Nt = ["value", "readonly", "placeholder"], Wt = ["onMouseenter", "onClick"], zt = { class: "popup-label" }, Dt = {
712
+ }, Kt = ["innerHTML"], Zt = ["value", "readonly", "placeholder"], qt = ["onMouseenter", "onClick"], Ut = { class: "popup-label" }, Yt = {
593
713
  key: 0,
594
714
  class: "popup-detail"
595
- }, jt = { class: "hover-head" }, Pt = { class: "hover-name" }, Ft = {
715
+ }, Jt = { class: "hover-head" }, Gt = { class: "hover-name" }, Xt = {
596
716
  key: 0,
597
717
  class: "hover-colon"
598
- }, Vt = {
718
+ }, Qt = {
599
719
  key: 0,
600
720
  class: "hover-type"
601
- }, Kt = {
721
+ }, en = {
602
722
  key: 0,
603
723
  class: "hover-doc"
604
- }, Zt = {
724
+ }, tn = {
605
725
  key: 1,
606
726
  class: "hover-def"
607
- }, qt = ["innerHTML"], Ut = ["title", "aria-label"], Yt = {
727
+ }, nn = ["innerHTML"], ln = ["title", "aria-label"], on = {
608
728
  key: 0,
609
729
  viewBox: "0 0 16 16",
610
730
  width: "14",
611
731
  height: "14",
612
732
  "aria-hidden": "true"
613
- }, Jt = {
733
+ }, an = {
614
734
  key: 1,
615
735
  viewBox: "0 0 16 16",
616
736
  width: "14",
617
737
  height: "14",
618
738
  "aria-hidden": "true"
619
- }, Gt = /* @__PURE__ */ mt({
739
+ }, sn = /* @__PURE__ */ wt({
620
740
  __name: "CodeEditor",
621
741
  props: {
622
742
  modelValue: {},
@@ -624,6 +744,7 @@ const Bt = {
624
744
  language: { default: "javascript" },
625
745
  completions: { default: () => [] },
626
746
  tsTypes: { default: "" },
747
+ completionFilter: {},
627
748
  templateCompletions: { default: () => [] },
628
749
  templateOpen: { default: "{{" },
629
750
  templateClose: { default: "}}" },
@@ -636,11 +757,12 @@ const Bt = {
636
757
  defaultExpanded: { type: Boolean, default: !1 },
637
758
  collapsedHeight: { default: "34px" },
638
759
  collapseOnBlur: { type: Boolean, default: !1 },
760
+ borderRadius: { default: "4px" },
639
761
  minHeight: { default: "260px" }
640
762
  },
641
763
  emits: ["update:modelValue", "change", "expand", "collapse"],
642
- setup(o, { expose: r, emit: i }) {
643
- const n = o, l = i, c = {
764
+ setup(l, { expose: s, emit: a }) {
765
+ const t = l, o = a, c = {
644
766
  variable: "变量",
645
767
  function: "函数",
646
768
  property: "属性",
@@ -661,166 +783,176 @@ const Bt = {
661
783
  "End",
662
784
  "PageUp",
663
785
  "PageDown"
664
- ]), a = $(n.modelValue), f = $(), b = $(), y = $(), A = $(), L = $(), S = $(), w = $(), x = $([]), g = $(0), N = $(!1), ie = $({ start: 0, end: 0 }), me = $({}), E = $(null), he = $({}), qe = P(
665
- () => n.tsTypes ? Mt(n.tsTypes) : []
666
- ), be = P(() => [
667
- ...yt,
668
- ...qe.value,
669
- ...n.completions
670
- ]), ae = P(
671
- () => n.mode === "template" ? [...n.templateCompletions, ...be.value] : be.value
672
- ), Ue = P(() => {
786
+ ]), i = C(t.modelValue), p = C(), M = C(), W = C(), g = C(), b = C(), H = C(), O = C(), A = C([]), w = C(0), y = C(!1), T = C({ start: 0, end: 0 }), k = C({}), $ = C(null), ye = C({}), et = V(
787
+ () => t.tsTypes ? jt(t.tsTypes) : []
788
+ ), ke = V(() => [
789
+ ...St,
790
+ ...et.value,
791
+ ...t.completions
792
+ ]), ce = V(
793
+ () => t.mode === "template" ? [...t.templateCompletions, ...ke.value] : ke.value
794
+ ), tt = V(() => {
673
795
  const e = {
674
- keywords: Le(n.language),
675
- builtins: new Set(ae.value.map((t) => t.label))
796
+ keywords: je(t.language),
797
+ builtins: new Set(ce.value.map((n) => n.label))
676
798
  };
677
- return n.mode === "template" ? `${Lt(a.value, e, n.templateOpen, n.templateClose)}
678
- ` : `${oe(a.value, le(a.value, e))}
799
+ return t.mode === "template" ? `${Pt(i.value, e, t.templateOpen, t.templateClose)}
800
+ ` : `${re(i.value, se(i.value, e))}
679
801
  `;
680
- }), Ye = P(() => a.value.split(`
681
- `).length), W = $(n.defaultExpanded), q = P(() => n.collapsible && !W.value), Je = P(() => q.value ? { "--ce-collapsed-height": n.collapsedHeight } : { height: n.minHeight }), Ge = P(
682
- () => q.value ? { height: n.collapsedHeight } : {}
683
- );
684
- let ge = 0;
685
- function ve(e) {
686
- if (W.value === e) return;
687
- const t = f.value;
688
- e && t && (ge = t.scrollTop), W.value = e, l(e ? "expand" : "collapse"), _(), H(), O(() => {
689
- if (se(), !W.value && t) {
690
- const s = Math.max(0, t.scrollHeight - t.clientHeight);
691
- t.scrollTop = Math.max(0, Math.min(ge, s)), B(!0), document.activeElement === t && Y();
802
+ }), nt = V(() => i.value.split(`
803
+ `).length), N = C(t.defaultExpanded), ue = C(!1), de = V(() => t.collapsible && !N.value), lt = V(() => {
804
+ const e = {};
805
+ return t.collapsible && (e.height = t.collapsedHeight), e;
806
+ }), ot = V(() => {
807
+ const e = {
808
+ "--ce-radius": t.borderRadius,
809
+ "--ce-collapsed-height": t.collapsedHeight
810
+ };
811
+ return t.collapsible ? { ...e, height: N.value ? t.minHeight : t.collapsedHeight } : { ...e, height: t.minHeight };
812
+ });
813
+ let xe = 0;
814
+ function we(e) {
815
+ if (N.value === e) return;
816
+ const n = p.value;
817
+ e && n && (xe = n.scrollTop), N.value = e, t.collapsible && (ue.value = !0), o(e ? "expand" : "collapse"), I(), L(), j(() => {
818
+ if (fe(), !N.value && n) {
819
+ const r = Math.max(0, n.scrollHeight - n.clientHeight);
820
+ n.scrollTop = Math.max(0, Math.min(xe, r)), z(!0), document.activeElement === n && G();
692
821
  return;
693
822
  }
694
- B(!0), e && n.collapseOnBlur && t && document.activeElement !== t && t.focus();
823
+ z(!0), e && t.collapseOnBlur && n && document.activeElement !== n && n.focus();
695
824
  });
696
825
  }
697
- function Xe() {
698
- ve(!W.value);
826
+ function it() {
827
+ ue.value = !1;
699
828
  }
700
- Ie(
701
- () => n.modelValue,
829
+ function at() {
830
+ we(!N.value);
831
+ }
832
+ Be(
833
+ () => t.modelValue,
702
834
  (e) => {
703
- e !== a.value && (a.value = e, _());
835
+ e !== i.value && (i.value = e, I());
704
836
  }
705
- ), Ie(a, () => {
706
- O(() => B(!0));
837
+ ), Be(i, () => {
838
+ j(() => z(!0));
707
839
  });
708
- function ye(e) {
840
+ function $e(e) {
709
841
  return c[e];
710
842
  }
711
- function Qe(e) {
712
- return e ? oe(
843
+ function st(e) {
844
+ return e ? re(
713
845
  e,
714
- le(e, { keywords: Le("typescript"), builtins: /* @__PURE__ */ new Set() })
846
+ se(e, { keywords: je("typescript"), builtins: /* @__PURE__ */ new Set() })
715
847
  ) : "";
716
848
  }
717
- let U = { top: 14, bottom: 14, lineHeight: 22 };
718
- function se() {
719
- const e = f.value;
849
+ let J = { top: 14, bottom: 14, lineHeight: 22 };
850
+ function fe() {
851
+ const e = p.value;
720
852
  if (!e) return;
721
- const t = window.getComputedStyle(e);
722
- U = {
723
- top: parseFloat(t.paddingTop) || 0,
724
- bottom: parseFloat(t.paddingBottom) || 0,
725
- lineHeight: parseFloat(t.lineHeight) || 22
853
+ const n = window.getComputedStyle(e);
854
+ J = {
855
+ top: parseFloat(n.paddingTop) || 0,
856
+ bottom: parseFloat(n.paddingBottom) || 0,
857
+ lineHeight: parseFloat(n.lineHeight) || 22
726
858
  };
727
859
  }
728
- function B(e = !1) {
729
- const t = f.value;
730
- if (!t) return;
731
- const s = A.value;
732
- if (s && (s.style.transform = `translate(${-t.scrollLeft}px, ${-t.scrollTop}px)`), L.value && (L.value.style.transform = `translateY(${-t.scrollTop}px)`), e) {
733
- const m = `${a.value}|${n.mode}|${t.clientWidth}|${t.clientHeight}`;
734
- m !== we && (we = m, et());
860
+ function z(e = !1) {
861
+ const n = p.value;
862
+ if (!n) return;
863
+ const r = g.value;
864
+ if (r && (r.style.transform = `translate(${-n.scrollLeft}px, ${-n.scrollTop}px)`), b.value && (b.value.style.transform = `translateY(${-n.scrollTop}px)`), e) {
865
+ const m = `${i.value}|${t.mode}|${n.clientWidth}|${n.clientHeight}`;
866
+ m !== Te && (Te = m, rt());
735
867
  }
736
868
  }
737
- function Y() {
738
- const e = f.value;
739
- if (!e || !q.value) return;
740
- const t = xe();
741
- if (!t) return;
742
- const s = e.clientHeight - U.top - U.bottom, h = t.top + e.scrollTop - U.top - Math.max(0, (s - t.lineHeight) / 2), p = Math.max(0, e.scrollHeight - e.clientHeight), k = Math.max(0, Math.min(h, p));
743
- Math.abs(k - e.scrollTop) > 0.5 && (e.scrollTop = k, B());
869
+ function G() {
870
+ const e = p.value;
871
+ if (!e || !de.value) return;
872
+ const n = Se();
873
+ if (!n) return;
874
+ const r = e.clientHeight - J.top - J.bottom, h = n.top + e.scrollTop - J.top - Math.max(0, (r - n.lineHeight) / 2), f = Math.max(0, e.scrollHeight - e.clientHeight), v = Math.max(0, Math.min(h, f));
875
+ Math.abs(v - e.scrollTop) > 0.5 && (e.scrollTop = v, z());
744
876
  }
745
- let ke = [], we = "", Q = 0, re = -1, ce = -1, ue = { x: 0, y: 0 };
746
- function et() {
747
- const e = f.value, t = y.value;
748
- if (!e || !t) return;
749
- const s = e.getBoundingClientRect(), m = [];
750
- t.querySelectorAll("[data-start]").forEach((h) => {
751
- const p = h.getBoundingClientRect();
877
+ let Ce = [], Te = "", oe = 0, pe = -1, me = -1, he = { x: 0, y: 0 };
878
+ function rt() {
879
+ const e = p.value, n = W.value;
880
+ if (!e || !n) return;
881
+ const r = e.getBoundingClientRect(), m = [];
882
+ n.querySelectorAll("[data-start]").forEach((h) => {
883
+ const f = h.getBoundingClientRect();
752
884
  m.push({
753
885
  start: Number(h.dataset.start),
754
886
  end: Number(h.dataset.end),
755
- left: p.left - s.left + e.scrollLeft,
756
- right: p.right - s.left + e.scrollLeft,
757
- top: p.top - s.top + e.scrollTop,
758
- bottom: p.bottom - s.top + e.scrollTop
887
+ left: f.left - r.left + e.scrollLeft,
888
+ right: f.right - r.left + e.scrollLeft,
889
+ top: f.top - r.top + e.scrollTop,
890
+ bottom: f.bottom - r.top + e.scrollTop
759
891
  });
760
- }), ke = m;
892
+ }), Ce = m;
761
893
  }
762
- function tt(e, t) {
763
- for (const s of ke)
764
- if (e >= s.left - 1 && e <= s.right + 1 && t >= s.top && t <= s.bottom)
765
- return s;
894
+ function ct(e, n) {
895
+ for (const r of Ce)
896
+ if (e >= r.left - 1 && e <= r.right + 1 && n >= r.top && n <= r.bottom)
897
+ return r;
766
898
  return null;
767
899
  }
768
- function H() {
769
- E.value = null, Q = 0, re = -1, ce = -1;
900
+ function L() {
901
+ $.value = null, oe = 0, pe = -1, me = -1;
770
902
  }
771
- function nt(e) {
772
- const t = w.value, s = f.value;
773
- if (!t || !s) return;
774
- const m = s.getBoundingClientRect(), h = m.left + e.left - s.scrollLeft, p = m.left + e.right - s.scrollLeft, k = m.top + e.top - s.scrollTop, v = m.top + e.bottom - s.scrollTop, R = 12, M = 8, D = t.offsetWidth, G = t.offsetHeight;
775
- let j = h, K = v + M;
776
- j + D > window.innerWidth - R && (j = p - D), K + G > window.innerHeight - R && (K = k - G - M), j = Math.max(R, Math.min(j, window.innerWidth - R - D)), K = Math.max(R, K), he.value = { left: `${j}px`, top: `${K}px` };
903
+ function ut(e) {
904
+ const n = O.value, r = p.value;
905
+ if (!n || !r) return;
906
+ const m = r.getBoundingClientRect(), h = m.left + e.left - r.scrollLeft, f = m.left + e.right - r.scrollLeft, v = m.top + e.top - r.scrollTop, x = m.top + e.bottom - r.scrollTop, _ = 12, B = 8, F = n.offsetWidth, Q = n.offsetHeight;
907
+ let P = h, q = x + B;
908
+ P + F > window.innerWidth - _ && (P = f - F), q + Q > window.innerHeight - _ && (q = v - Q - B), P = Math.max(_, Math.min(P, window.innerWidth - _ - F)), q = Math.max(_, q), ye.value = { left: `${P}px`, top: `${q}px` };
777
909
  }
778
- function lt(e, t) {
779
- const s = f.value;
780
- if (!s || n.readonly || !n.hover || N.value) {
781
- H();
910
+ function dt(e, n) {
911
+ const r = p.value;
912
+ if (!r || t.readonly || !t.hover || y.value) {
913
+ L();
782
914
  return;
783
915
  }
784
- if (s.selectionStart !== s.selectionEnd) {
785
- H();
916
+ if (r.selectionStart !== r.selectionEnd) {
917
+ L();
786
918
  return;
787
919
  }
788
- const m = w.value;
789
- if (E.value && m) {
790
- const v = m.getBoundingClientRect();
791
- if (e >= v.left && e <= v.right && t >= v.top && t <= v.bottom)
920
+ const m = O.value;
921
+ if ($.value && m) {
922
+ const x = m.getBoundingClientRect();
923
+ if (e >= x.left && e <= x.right && n >= x.top && n <= x.bottom)
792
924
  return;
793
925
  }
794
- const h = s.getBoundingClientRect(), p = tt(e - h.left + s.scrollLeft, t - h.top + s.scrollTop);
795
- if (!p) {
796
- H();
926
+ const h = r.getBoundingClientRect(), f = ct(e - h.left + r.scrollLeft, n - h.top + r.scrollTop);
927
+ if (!f) {
928
+ L();
797
929
  return;
798
930
  }
799
- if (E.value && re === p.start && ce === p.end)
931
+ if ($.value && pe === f.start && me === f.end)
800
932
  return;
801
- const k = Rt(s.value, p.start, p.end, {
802
- completions: ae.value,
803
- declared: Oe(s.value, p.start)
933
+ const v = Lt(r.value, f.start, f.end, {
934
+ completions: ce.value,
935
+ declared: We(r.value, f.start)
804
936
  });
805
- if (!k) {
806
- H();
937
+ if (!v) {
938
+ L();
807
939
  return;
808
940
  }
809
- E.value = k, re = p.start, ce = p.end, O(() => nt(p));
941
+ $.value = v, pe = f.start, me = f.end, j(() => ut(f));
810
942
  }
811
- function ot(e) {
812
- ue = { x: e.clientX, y: e.clientY }, !Q && (Q = requestAnimationFrame(() => {
813
- Q = 0, lt(ue.x, ue.y);
943
+ function ft(e) {
944
+ he = { x: e.clientX, y: e.clientY }, !oe && (oe = requestAnimationFrame(() => {
945
+ oe = 0, dt(he.x, he.y);
814
946
  }));
815
947
  }
816
- function xe() {
817
- const e = f.value;
948
+ function Se() {
949
+ const e = p.value;
818
950
  if (!e) return null;
819
- const t = window.getComputedStyle(e), s = document.createElement("div"), m = parseFloat(t.paddingLeft) || 0, h = parseFloat(t.paddingRight) || 0, p = e.getBoundingClientRect();
820
- Object.assign(s.style, {
951
+ const n = window.getComputedStyle(e), r = document.createElement("div"), m = parseFloat(n.paddingLeft) || 0, h = parseFloat(n.paddingRight) || 0, f = e.getBoundingClientRect();
952
+ Object.assign(r.style, {
821
953
  position: "fixed",
822
- left: `${p.left}px`,
823
- top: `${p.top}px`,
954
+ left: `${f.left}px`,
955
+ top: `${f.top}px`,
824
956
  visibility: "hidden",
825
957
  pointerEvents: "none",
826
958
  zIndex: "-1",
@@ -829,394 +961,415 @@ const Bt = {
829
961
  wordBreak: "normal",
830
962
  boxSizing: "content-box",
831
963
  width: `${e.clientWidth - m - h}px`,
832
- paddingTop: t.paddingTop,
833
- paddingRight: t.paddingRight,
834
- paddingBottom: t.paddingBottom,
835
- paddingLeft: t.paddingLeft,
964
+ paddingTop: n.paddingTop,
965
+ paddingRight: n.paddingRight,
966
+ paddingBottom: n.paddingBottom,
967
+ paddingLeft: n.paddingLeft,
836
968
  border: "0",
837
- fontFamily: t.fontFamily,
838
- fontSize: t.fontSize,
839
- fontWeight: t.fontWeight,
840
- fontStyle: t.fontStyle,
841
- fontVariant: t.fontVariant,
842
- letterSpacing: t.letterSpacing,
843
- lineHeight: t.lineHeight,
844
- textTransform: t.textTransform,
845
- tabSize: t.tabSize
846
- }), s.textContent = e.value.slice(0, e.selectionStart);
847
- const k = document.createElement("span");
848
- k.textContent = "​", s.appendChild(k), document.body.appendChild(s);
849
- const v = k.getBoundingClientRect();
850
- document.body.removeChild(s);
851
- const R = parseFloat(t.lineHeight) || 22, M = v.height, D = M > 0 && M < R ? (R - M) / 2 : 0;
969
+ fontFamily: n.fontFamily,
970
+ fontSize: n.fontSize,
971
+ fontWeight: n.fontWeight,
972
+ fontStyle: n.fontStyle,
973
+ fontVariant: n.fontVariant,
974
+ letterSpacing: n.letterSpacing,
975
+ lineHeight: n.lineHeight,
976
+ textTransform: n.textTransform,
977
+ tabSize: n.tabSize
978
+ }), r.textContent = e.value.slice(0, e.selectionStart);
979
+ const v = document.createElement("span");
980
+ v.textContent = "​", r.appendChild(v), document.body.appendChild(r);
981
+ const x = v.getBoundingClientRect();
982
+ document.body.removeChild(r);
983
+ const _ = parseFloat(n.lineHeight) || 22, B = x.height, F = B > 0 && B < _ ? (_ - B) / 2 : 0;
852
984
  return {
853
- left: v.left - p.left - e.scrollLeft,
854
- top: v.top - p.top - e.scrollTop - D,
855
- lineHeight: R
985
+ left: x.left - f.left - e.scrollLeft,
986
+ top: x.top - f.top - e.scrollTop - F,
987
+ lineHeight: _
856
988
  };
857
989
  }
858
- async function it() {
859
- await O();
860
- const e = b.value, t = S.value, s = xe();
861
- if (!e || !t || !s) return;
862
- const m = 4, h = 8, p = window.innerWidth, k = window.innerHeight, v = e.getBoundingClientRect(), R = t.scrollHeight, M = k - (v.top + s.top + s.lineHeight) - m - h, D = v.top + s.top - m - h, G = M >= Math.min(R, 180) || M >= D, j = Math.min(248, Math.max(G ? M : D, 96)), K = Math.min(R, j), Re = t.offsetWidth || 280;
863
- let X = s.left;
864
- v.left + X + Re > p - h && (X = p - h - Re - v.left), X = Math.max(X, h - v.left), me.value = {
865
- left: `${X}px`,
866
- top: `${G ? s.top + s.lineHeight + m : s.top - m - K}px`,
867
- maxHeight: `${j}px`
990
+ async function pt() {
991
+ await j();
992
+ const e = M.value, n = H.value, r = Se();
993
+ if (!e || !n || !r) return;
994
+ const m = 4, h = 8, f = window.innerWidth, v = window.innerHeight, x = e.getBoundingClientRect(), _ = n.scrollHeight, B = v - (x.top + r.top + r.lineHeight) - m - h, F = x.top + r.top - m - h, Q = B >= Math.min(_, 180) || B >= F, P = Math.min(248, Math.max(Q ? B : F, 96)), q = Math.min(_, P), Ae = n.offsetWidth || 280;
995
+ let ee = r.left;
996
+ x.left + ee + Ae > f - h && (ee = f - h - Ae - x.left), ee = Math.max(ee, h - x.left), k.value = {
997
+ left: `${ee}px`,
998
+ top: `${Q ? r.top + r.lineHeight + m : r.top - m - q}px`,
999
+ maxHeight: `${P}px`
868
1000
  };
869
1001
  }
870
- function _() {
871
- N.value = !1, x.value = [], g.value = 0, H();
1002
+ function I() {
1003
+ y.value = !1, A.value = [], w.value = 0, L();
872
1004
  }
873
- function J(e = !1) {
874
- const t = f.value;
875
- if (!t || n.readonly) return;
876
- if (t.selectionStart !== t.selectionEnd) {
877
- _();
1005
+ function X(e = !1) {
1006
+ const n = p.value;
1007
+ if (!n || t.readonly) return;
1008
+ if (n.selectionStart !== n.selectionEnd) {
1009
+ I();
878
1010
  return;
879
1011
  }
880
- const s = t.selectionStart;
1012
+ const r = n.selectionStart;
881
1013
  let m = !e;
882
- if (n.mode === "template") {
883
- const p = pe(
884
- t.value,
885
- s,
886
- n.templateOpen,
887
- n.templateClose
1014
+ if (t.mode === "template") {
1015
+ const v = ve(
1016
+ n.value,
1017
+ r,
1018
+ t.templateOpen,
1019
+ t.templateClose
888
1020
  );
889
- if (!p) {
890
- _();
1021
+ if (!v) {
1022
+ I();
891
1023
  return;
892
1024
  }
893
- e && t.value.slice(p.start, s).trim() === "" && (m = !0);
1025
+ e && n.value.slice(v.start, r).trim() === "" && (m = !0);
894
1026
  }
895
- const h = Et(t.value, s, {
896
- language: n.language,
897
- completions: ae.value,
898
- declared: Oe(t.value, s),
1027
+ const h = At(n.value, r, {
1028
+ language: t.language,
1029
+ completions: ce.value,
1030
+ declared: We(n.value, r),
899
1031
  auto: !m
900
1032
  });
901
1033
  if (!h) {
902
- _();
1034
+ I();
903
1035
  return;
904
1036
  }
905
- x.value = h.items, ie.value = { start: h.start, end: h.end }, g.value = 0, N.value = !0, it();
1037
+ let f = h.items;
1038
+ if (t.completionFilter) {
1039
+ const v = Je(n.value, r);
1040
+ if (f = t.completionFilter(f, {
1041
+ prefix: v.prefix,
1042
+ chain: v.chain,
1043
+ text: n.value,
1044
+ position: r,
1045
+ mode: t.mode,
1046
+ language: t.language
1047
+ }), f.length === 0) {
1048
+ I();
1049
+ return;
1050
+ }
1051
+ }
1052
+ A.value = f, T.value = { start: h.start, end: h.end }, w.value = 0, y.value = !0, pt();
906
1053
  }
907
- function at(e) {
908
- a.value = e, l("update:modelValue", e), l("change", e);
1054
+ function mt(e) {
1055
+ i.value = e, o("update:modelValue", e), o("change", e);
909
1056
  }
910
- function ee(e, t, s, m = e + s.length) {
911
- const h = f.value;
1057
+ function ie(e, n, r, m = e + r.length) {
1058
+ const h = p.value;
912
1059
  if (!h) return;
913
- const p = h.value.slice(0, e) + s + h.value.slice(t);
914
- at(p), _(), O(() => {
915
- h.value = p, h.setSelectionRange(m, m), h.focus(), B(!0), Y();
1060
+ const f = h.value.slice(0, e) + r + h.value.slice(n);
1061
+ mt(f), I(), j(() => {
1062
+ h.value = f, h.setSelectionRange(m, m), h.focus(), z(!0), G();
916
1063
  });
917
1064
  }
918
- function $e(e = x.value[g.value]) {
1065
+ function Ee(e = A.value[w.value]) {
919
1066
  if (!e) return;
920
- const t = e.insertText ?? e.label;
921
- ee(ie.value.start, ie.value.end, t), _();
1067
+ const n = e.insertText ?? e.label;
1068
+ ie(T.value.start, T.value.end, n), I();
922
1069
  }
923
- function Te(e) {
924
- const t = x.value.length;
925
- t && (g.value = (g.value + e + t) % t, O(() => {
926
- var s, m;
927
- (m = (s = S.value) == null ? void 0 : s.querySelector(".is-active")) == null || m.scrollIntoView({ block: "nearest" });
1070
+ function Ie(e) {
1071
+ const n = A.value.length;
1072
+ n && (w.value = (w.value + e + n) % n, j(() => {
1073
+ var r, m;
1074
+ (m = (r = H.value) == null ? void 0 : r.querySelector(".is-active")) == null || m.scrollIntoView({ block: "nearest" });
928
1075
  }));
929
1076
  }
930
- function st(e) {
931
- const t = e.target;
932
- a.value = t.value, l("update:modelValue", t.value), l("change", t.value), H(), B(), O(Y), J(!0);
1077
+ function ht(e) {
1078
+ const n = e.target;
1079
+ i.value = n.value, o("update:modelValue", n.value), o("change", n.value), L(), z(), j(G), X(!0);
933
1080
  }
934
- function rt(e) {
935
- if (_(), H(), !n.collapsible || !n.collapseOnBlur || !W.value) return;
936
- const t = e.relatedTarget;
937
- t && t.closest(".expand-toggle") || ve(!1);
1081
+ function bt(e) {
1082
+ if (I(), L(), !t.collapsible || !t.collapseOnBlur || !N.value) return;
1083
+ const n = e.relatedTarget;
1084
+ n && n.closest(".expand-toggle") || we(!1);
938
1085
  }
939
- function ct() {
940
- Ce(), Y();
1086
+ function gt() {
1087
+ Re(), G();
941
1088
  }
942
- function Ce() {
943
- const e = f.value;
944
- if (!e || n.readonly) return;
1089
+ function Re() {
1090
+ const e = p.value;
1091
+ if (!e || t.readonly) return;
945
1092
  if (e.selectionStart !== e.selectionEnd) {
946
- _();
1093
+ I();
947
1094
  return;
948
1095
  }
949
- const t = e.selectionStart;
950
- if (t > 0 && e.value[t - 1] === ".") {
951
- J(!0);
1096
+ const n = e.selectionStart;
1097
+ if (n > 0 && e.value[n - 1] === ".") {
1098
+ X(!0);
952
1099
  return;
953
1100
  }
954
- if (n.mode === "template") {
955
- const s = pe(
1101
+ if (t.mode === "template") {
1102
+ const r = ve(
956
1103
  e.value,
957
- t,
958
- n.templateOpen,
959
- n.templateClose
1104
+ n,
1105
+ t.templateOpen,
1106
+ t.templateClose
960
1107
  );
961
- if (s && e.value.slice(s.start, t).trim() === "") {
962
- J(!0);
1108
+ if (r && e.value.slice(r.start, n).trim() === "") {
1109
+ X(!0);
963
1110
  return;
964
1111
  }
965
1112
  }
966
- _();
1113
+ I();
967
1114
  }
968
- let de = 0;
969
- function Se() {
970
- window.clearTimeout(de), de = window.setTimeout(() => {
971
- de = 0, Ce(), Y();
1115
+ let be = 0;
1116
+ function Me() {
1117
+ window.clearTimeout(be), be = window.setTimeout(() => {
1118
+ be = 0, Re(), G();
972
1119
  }, 0);
973
1120
  }
974
- function Ee(e) {
975
- e.target !== f.value && N.value && _();
1121
+ function _e(e) {
1122
+ e.target !== p.value && y.value && I();
976
1123
  }
977
- function ut() {
978
- H(), B(), q.value && dt();
1124
+ function vt() {
1125
+ L(), z(), de.value && yt();
979
1126
  }
980
- let fe = 0;
981
- function dt() {
982
- window.clearTimeout(fe), fe = window.setTimeout(() => {
983
- fe = 0, ft();
1127
+ let ge = 0;
1128
+ function yt() {
1129
+ window.clearTimeout(ge), ge = window.setTimeout(() => {
1130
+ ge = 0, kt();
984
1131
  }, 120);
985
1132
  }
986
- function ft() {
987
- const e = f.value;
1133
+ function kt() {
1134
+ const e = p.value;
988
1135
  if (!e) return;
989
- const t = U.lineHeight, s = e.scrollTop, m = Math.round(s / t) * t;
990
- Math.abs(m - s) < 0.5 || (e.scrollTop = m, B());
1136
+ const n = J.lineHeight, r = e.scrollTop, m = Math.round(r / n) * n;
1137
+ Math.abs(m - r) < 0.5 || (e.scrollTop = m, z());
991
1138
  }
992
- function pt(e) {
1139
+ function xt(e) {
993
1140
  var h;
994
- const t = f.value;
995
- if (!t) return;
996
- const s = e.metaKey || e.ctrlKey, m = d.has(e.key);
997
- if (e.key === " " && s) {
998
- e.preventDefault(), J(!1);
1141
+ const n = p.value;
1142
+ if (!n) return;
1143
+ const r = e.metaKey || e.ctrlKey, m = d.has(e.key);
1144
+ if (e.key === " " && r) {
1145
+ e.preventDefault(), X(!1);
999
1146
  return;
1000
1147
  }
1001
- if (N.value) {
1148
+ if (y.value) {
1002
1149
  if (e.key === "ArrowDown") {
1003
- e.preventDefault(), Te(1);
1150
+ e.preventDefault(), Ie(1);
1004
1151
  return;
1005
1152
  }
1006
1153
  if (e.key === "ArrowUp") {
1007
- e.preventDefault(), Te(-1);
1154
+ e.preventDefault(), Ie(-1);
1008
1155
  return;
1009
1156
  }
1010
1157
  if (e.key === "Enter" || e.key === "Tab") {
1011
- e.preventDefault(), $e();
1158
+ e.preventDefault(), Ee();
1012
1159
  return;
1013
1160
  }
1014
1161
  if (e.key === "Escape") {
1015
- e.preventDefault(), _();
1162
+ e.preventDefault(), I();
1016
1163
  return;
1017
1164
  }
1018
- if (m || s) {
1019
- _(), m && !s && Se();
1165
+ if (m || r) {
1166
+ I(), m && !r && Me();
1020
1167
  return;
1021
1168
  }
1022
1169
  }
1023
- if (m && !s) {
1024
- Se();
1170
+ if (m && !r) {
1171
+ Me();
1025
1172
  return;
1026
1173
  }
1027
- if (e.key === "Enter" && !s && !e.shiftKey) {
1028
- const p = t.selectionStart;
1029
- if (p !== t.selectionEnd) return;
1030
- const k = t.value.lastIndexOf(`
1031
- `, p - 1) + 1, v = t.value.slice(k, p), R = ((h = v.match(/^[ \t]*/)) == null ? void 0 : h[0]) ?? "", M = /[{[(]$/.test(v.trimEnd()) ? " " : "";
1032
- e.preventDefault(), ee(p, p, `
1033
- ${R}${M}`);
1174
+ if (e.key === "Enter" && !r && !e.shiftKey) {
1175
+ const f = n.selectionStart;
1176
+ if (f !== n.selectionEnd) return;
1177
+ const v = n.value.lastIndexOf(`
1178
+ `, f - 1) + 1, x = n.value.slice(v, f), _ = ((h = x.match(/^[ \t]*/)) == null ? void 0 : h[0]) ?? "", B = /[{[(]$/.test(x.trimEnd()) ? " " : "";
1179
+ e.preventDefault(), ie(f, f, `
1180
+ ${_}${B}`);
1034
1181
  return;
1035
1182
  }
1036
1183
  if (e.key === "Tab") {
1037
- e.preventDefault(), ee(t.selectionStart, t.selectionEnd, " ");
1184
+ e.preventDefault(), ie(n.selectionStart, n.selectionEnd, " ");
1038
1185
  return;
1039
1186
  }
1040
- if (e.key.length === 1 && !s && !e.altKey && u[e.key]) {
1041
- if (t.selectionStart !== t.selectionEnd) return;
1042
- const p = t.selectionStart, k = t.value[p - 1], v = t.value[p];
1043
- if ((e.key === '"' || e.key === "'") && k && /[\w$]/.test(k) || v !== void 0 && !/[\s)\]},;:]/.test(v)) return;
1044
- e.preventDefault(), ee(p, p, e.key + u[e.key], p + 1), n.mode === "template" && O(() => J(!0));
1187
+ if (e.key.length === 1 && !r && !e.altKey && u[e.key]) {
1188
+ if (n.selectionStart !== n.selectionEnd) return;
1189
+ const f = n.selectionStart, v = n.value[f - 1], x = n.value[f];
1190
+ if ((e.key === '"' || e.key === "'") && v && /[\w$]/.test(v) || x !== void 0 && !/[\s)\]},;:]/.test(x)) return;
1191
+ e.preventDefault(), ie(f, f, e.key + u[e.key], f + 1), t.mode === "template" && j(() => X(!0));
1045
1192
  }
1046
1193
  }
1047
- function _e() {
1048
- N.value && _(), H(), O(() => {
1049
- se(), B(!0);
1194
+ function He() {
1195
+ y.value && I(), L(), j(() => {
1196
+ fe(), z(!0);
1050
1197
  });
1051
1198
  }
1052
- return ht(() => {
1053
- window.addEventListener("resize", _e), window.addEventListener("scroll", Ee, !0), O(() => {
1054
- se(), B(!0);
1199
+ return $t(() => {
1200
+ window.addEventListener("resize", He), window.addEventListener("scroll", _e, !0), j(() => {
1201
+ fe(), z(!0);
1055
1202
  });
1056
- }), bt(() => {
1057
- window.removeEventListener("resize", _e), window.removeEventListener("scroll", Ee, !0);
1058
- }), r({ focus: () => {
1203
+ }), Ct(() => {
1204
+ window.removeEventListener("resize", He), window.removeEventListener("scroll", _e, !0);
1205
+ }), s({ focus: () => {
1059
1206
  var e;
1060
- return (e = f.value) == null ? void 0 : e.focus();
1061
- } }), (e, t) => (T(), C("div", {
1062
- class: ne(["code-editor", {
1063
- "is-readonly": o.readonly,
1064
- "is-dark": o.theme === "dark",
1065
- "is-collapsed": q.value
1066
- }]),
1067
- style: te(Je.value)
1207
+ return (e = p.value) == null ? void 0 : e.focus();
1208
+ } }), (e, n) => (S(), E("div", {
1209
+ class: te(["code-input", { "is-collapsible": l.collapsible }]),
1210
+ style: ae(lt.value)
1068
1211
  }, [
1069
- o.lineNumbers && !q.value ? (T(), C("div", Bt, [
1070
- I("div", {
1071
- ref_key: "gutterInner",
1072
- ref: L,
1073
- class: "gutter-inner code-font"
1074
- }, [
1075
- (T(!0), C(Me, null, He(Ye.value, (s) => (T(), C("div", {
1076
- key: s,
1077
- class: "gutter-line"
1078
- }, F(s), 1))), 128))
1079
- ], 512)
1080
- ])) : z("", !0),
1081
- I("div", {
1082
- ref_key: "stage",
1083
- ref: b,
1084
- class: "stage",
1085
- style: te(Ge.value)
1212
+ R("div", {
1213
+ class: te(["code-editor", {
1214
+ "is-readonly": l.readonly,
1215
+ "is-dark": l.theme === "dark",
1216
+ "is-collapsed": de.value,
1217
+ "is-expanding": ue.value
1218
+ }]),
1219
+ style: ae(ot.value),
1220
+ onAnimationend: Le(it, ["self"])
1086
1221
  }, [
1087
- I("div", {
1088
- ref_key: "highlightLayer",
1089
- ref: y,
1090
- class: "highlight code-font"
1091
- }, [
1092
- I("pre", {
1093
- ref_key: "highlightInner",
1094
- ref: A,
1095
- class: "code-font"
1222
+ l.lineNumbers ? (S(), E("div", Vt, [
1223
+ R("div", {
1224
+ ref_key: "gutterInner",
1225
+ ref: b,
1226
+ class: "gutter-inner code-font"
1096
1227
  }, [
1097
- I("code", { innerHTML: Ue.value }, null, 8, Ot)
1228
+ (S(!0), E(Oe, null, Ne(nt.value, (r) => (S(), E("div", {
1229
+ key: r,
1230
+ class: "gutter-line"
1231
+ }, K(r), 1))), 128))
1098
1232
  ], 512)
1099
- ], 512),
1100
- I("textarea", {
1101
- ref_key: "textarea",
1102
- ref: f,
1103
- class: "code-font input",
1104
- value: a.value,
1105
- readonly: o.readonly,
1106
- placeholder: o.placeholder,
1107
- spellcheck: "false",
1108
- autocomplete: "off",
1109
- autocapitalize: "off",
1110
- autocorrect: "off",
1111
- wrap: "soft",
1112
- onInput: st,
1113
- onKeydown: pt,
1114
- onScroll: ut,
1115
- onClick: ct,
1116
- onMousemove: ot,
1117
- onMouseleave: H,
1118
- onBlur: rt
1119
- }, null, 40, Nt),
1120
- N.value ? (T(), C("ul", {
1121
- key: 0,
1122
- ref_key: "popup",
1123
- ref: S,
1124
- class: "popup",
1125
- style: te(me.value),
1126
- onMousedown: t[0] || (t[0] = gt(() => {
1127
- }, ["prevent"]))
1233
+ ])) : D("", !0),
1234
+ R("div", {
1235
+ ref_key: "stage",
1236
+ ref: M,
1237
+ class: "stage"
1128
1238
  }, [
1129
- (T(!0), C(Me, null, He(x.value, (s, m) => (T(), C("li", {
1130
- key: `${s.label}-${m}`,
1131
- class: ne(["popup-item", { "is-active": m === g.value }]),
1132
- onMouseenter: (h) => g.value = m,
1133
- onClick: (h) => $e(s)
1239
+ R("div", {
1240
+ ref_key: "highlightLayer",
1241
+ ref: W,
1242
+ class: "highlight code-font"
1243
+ }, [
1244
+ R("pre", {
1245
+ ref_key: "highlightInner",
1246
+ ref: g,
1247
+ class: "code-font"
1248
+ }, [
1249
+ R("code", { innerHTML: tt.value }, null, 8, Kt)
1250
+ ], 512)
1251
+ ], 512),
1252
+ R("textarea", {
1253
+ ref_key: "textarea",
1254
+ ref: p,
1255
+ class: "code-font input",
1256
+ value: i.value,
1257
+ readonly: l.readonly,
1258
+ placeholder: l.placeholder,
1259
+ spellcheck: "false",
1260
+ autocomplete: "off",
1261
+ autocapitalize: "off",
1262
+ autocorrect: "off",
1263
+ wrap: "soft",
1264
+ onInput: ht,
1265
+ onKeydown: xt,
1266
+ onScroll: vt,
1267
+ onClick: gt,
1268
+ onMousemove: ft,
1269
+ onMouseleave: L,
1270
+ onBlur: bt
1271
+ }, null, 40, Zt),
1272
+ y.value ? (S(), E("ul", {
1273
+ key: 0,
1274
+ ref_key: "popup",
1275
+ ref: H,
1276
+ class: "popup",
1277
+ style: ae(k.value),
1278
+ onMousedown: n[0] || (n[0] = Le(() => {
1279
+ }, ["prevent"]))
1134
1280
  }, [
1135
- I("span", {
1136
- class: ne(["badge", `badge-${s.kind}`])
1137
- }, F(ye(s.kind)), 3),
1138
- I("span", zt, F(s.label), 1),
1139
- s.detail ? (T(), C("span", Dt, F(s.detail), 1)) : z("", !0)
1140
- ], 42, Wt))), 128))
1141
- ], 36)) : z("", !0),
1142
- E.value ? (T(), C("div", {
1281
+ (S(!0), E(Oe, null, Ne(A.value, (r, m) => (S(), E("li", {
1282
+ key: `${r.label}-${m}`,
1283
+ class: te(["popup-item", { "is-active": m === w.value }]),
1284
+ onMouseenter: (h) => w.value = m,
1285
+ onClick: (h) => Ee(r)
1286
+ }, [
1287
+ R("span", {
1288
+ class: te(["badge", `badge-${r.kind}`])
1289
+ }, K($e(r.kind)), 3),
1290
+ R("span", Ut, K(r.label), 1),
1291
+ r.detail ? (S(), E("span", Yt, K(r.detail), 1)) : D("", !0)
1292
+ ], 42, qt))), 128))
1293
+ ], 36)) : D("", !0),
1294
+ $.value ? (S(), E("div", {
1295
+ key: 1,
1296
+ ref_key: "hoverCard",
1297
+ ref: O,
1298
+ class: "hover-card",
1299
+ style: ae(ye.value)
1300
+ }, [
1301
+ R("div", Jt, [
1302
+ R("span", {
1303
+ class: te(["badge", `badge-${$.value.kind}`])
1304
+ }, K($e($.value.kind)), 3),
1305
+ R("span", Gt, [
1306
+ Tt(K($.value.label), 1),
1307
+ $.value.detail ? (S(), E("span", Xt, ":")) : D("", !0)
1308
+ ]),
1309
+ $.value.detail ? (S(), E("span", Qt, K($.value.detail), 1)) : D("", !0)
1310
+ ]),
1311
+ $.value.documentation ? (S(), E("p", en, K($.value.documentation), 1)) : D("", !0),
1312
+ $.value.type ? (S(), E("pre", tn, [
1313
+ R("code", {
1314
+ innerHTML: st($.value.type)
1315
+ }, null, 8, nn)
1316
+ ])) : D("", !0)
1317
+ ], 4)) : D("", !0)
1318
+ ], 512),
1319
+ l.collapsible ? (S(), E("button", {
1143
1320
  key: 1,
1144
- ref_key: "hoverCard",
1145
- ref: w,
1146
- class: "hover-card",
1147
- style: te(he.value)
1321
+ type: "button",
1322
+ class: "expand-toggle",
1323
+ title: N.value ? "收起" : "展开",
1324
+ "aria-label": N.value ? "收起编辑器" : "展开编辑器",
1325
+ onClick: at
1148
1326
  }, [
1149
- I("div", jt, [
1150
- I("span", {
1151
- class: ne(["badge", `badge-${E.value.kind}`])
1152
- }, F(ye(E.value.kind)), 3),
1153
- I("span", Pt, [
1154
- vt(F(E.value.label), 1),
1155
- E.value.detail ? (T(), C("span", Ft, ":")) : z("", !0)
1156
- ]),
1157
- E.value.detail ? (T(), C("span", Vt, F(E.value.detail), 1)) : z("", !0)
1158
- ]),
1159
- E.value.documentation ? (T(), C("p", Kt, F(E.value.documentation), 1)) : z("", !0),
1160
- E.value.type ? (T(), C("pre", Zt, [
1161
- I("code", {
1162
- innerHTML: Qe(E.value.type)
1163
- }, null, 8, qt)
1164
- ])) : z("", !0)
1165
- ], 4)) : z("", !0)
1166
- ], 4),
1167
- o.collapsible ? (T(), C("button", {
1168
- key: 1,
1169
- type: "button",
1170
- class: "expand-toggle",
1171
- title: W.value ? "收起" : "展开",
1172
- "aria-label": W.value ? "收起编辑器" : "展开编辑器",
1173
- onClick: Xe
1174
- }, [
1175
- W.value ? (T(), C("svg", Jt, [...t[2] || (t[2] = [
1176
- I("path", {
1177
- d: "M11 2 5 8 11 14",
1178
- fill: "none",
1179
- stroke: "currentColor",
1180
- "stroke-width": "1.6",
1181
- "stroke-linecap": "round",
1182
- "stroke-linejoin": "round"
1183
- }, null, -1)
1184
- ])])) : (T(), C("svg", Yt, [...t[1] || (t[1] = [
1185
- I("path", {
1186
- d: "M6 2 12 8 6 14",
1187
- fill: "none",
1188
- stroke: "currentColor",
1189
- "stroke-width": "1.6",
1190
- "stroke-linecap": "round",
1191
- "stroke-linejoin": "round"
1192
- }, null, -1)
1193
- ])]))
1194
- ], 8, Ut)) : z("", !0)
1327
+ N.value ? (S(), E("svg", an, [...n[2] || (n[2] = [
1328
+ R("path", {
1329
+ d: "M11 2 5 8 11 14",
1330
+ fill: "none",
1331
+ stroke: "currentColor",
1332
+ "stroke-width": "1.6",
1333
+ "stroke-linecap": "round",
1334
+ "stroke-linejoin": "round"
1335
+ }, null, -1)
1336
+ ])])) : (S(), E("svg", on, [...n[1] || (n[1] = [
1337
+ R("path", {
1338
+ d: "M6 2 12 8 6 14",
1339
+ fill: "none",
1340
+ stroke: "currentColor",
1341
+ "stroke-width": "1.6",
1342
+ "stroke-linecap": "round",
1343
+ "stroke-linejoin": "round"
1344
+ }, null, -1)
1345
+ ])]))
1346
+ ], 8, ln)) : D("", !0)
1347
+ ], 38)
1195
1348
  ], 6));
1196
1349
  }
1197
- }), Xt = (o, r) => {
1198
- const i = o.__vccOpts || o;
1199
- for (const [n, l] of r)
1200
- i[n] = l;
1201
- return i;
1202
- }, Qt = /* @__PURE__ */ Xt(Gt, [["__scopeId", "data-v-dc3651c9"]]), nn = {
1203
- install(o) {
1204
- o.component("CodeInput", Qt);
1350
+ }), rn = (l, s) => {
1351
+ const a = l.__vccOpts || l;
1352
+ for (const [t, o] of s)
1353
+ a[t] = o;
1354
+ return a;
1355
+ }, cn = /* @__PURE__ */ rn(sn, [["__scopeId", "data-v-fcbf39fe"]]), fn = {
1356
+ install(l) {
1357
+ l.component("CodeInput", cn);
1205
1358
  }
1206
1359
  };
1207
1360
  export {
1208
- Qt as CodeEditor,
1209
- Et as collectCompletions,
1210
- nn as default,
1211
- yt as defaultCompletions,
1212
- pe as findTemplateRange,
1213
- Le as getKeywordSet,
1214
- Fe as getKeywords,
1215
- oe as highlight,
1216
- Lt as highlightTemplate,
1217
- tn as isInsideTemplate,
1218
- Mt as parseTsCompletions,
1219
- Rt as resolveHoverItem,
1220
- Oe as scanDeclarations,
1221
- le as tokenize
1361
+ cn as CodeEditor,
1362
+ At as collectCompletions,
1363
+ fn as default,
1364
+ St as defaultCompletions,
1365
+ ve as findTemplateRange,
1366
+ je as getKeywordSet,
1367
+ Ye as getKeywords,
1368
+ re as highlight,
1369
+ Pt as highlightTemplate,
1370
+ dn as isInsideTemplate,
1371
+ jt as parseTsCompletions,
1372
+ Lt as resolveHoverItem,
1373
+ We as scanDeclarations,
1374
+ se as tokenize
1222
1375
  };