@floegence/floe-webapp-core 0.35.7 → 0.35.9

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.
@@ -0,0 +1,1020 @@
1
+ import { clampTerminalCursor as g } from "./editorModel.js";
2
+ import { normalizeTerminalWorkspaceProfile as b } from "./workspaceProfile.js";
3
+ const k = 4, E = [
4
+ { label: "git status", kind: "command", detail: "git", score: 124 },
5
+ { label: "ls -la", kind: "command", detail: "shell", score: 118 },
6
+ { label: "pwd", kind: "command", detail: "shell", score: 116 },
7
+ { label: "git diff", kind: "command", detail: "git", score: 114 },
8
+ { label: "cat README.md", kind: "command", detail: "file", score: 112 },
9
+ { label: "git log --oneline -10", kind: "command", detail: "git", score: 110 },
10
+ {
11
+ label: "mkdir -p src/components",
12
+ kind: "command",
13
+ detail: "shell",
14
+ score: 96
15
+ },
16
+ { label: "touch .env.local", kind: "command", detail: "shell", score: 94 },
17
+ {
18
+ label: "curl -I https://example.com",
19
+ kind: "command",
20
+ detail: "network",
21
+ score: 90
22
+ },
23
+ { label: "clear", kind: "command", detail: "shell", score: 92 },
24
+ { label: "date", kind: "command", detail: "shell", score: 88 },
25
+ { label: "help", kind: "command", detail: "shell", score: 84 }
26
+ ], v = [
27
+ {
28
+ id: "git-commit-message",
29
+ label: 'git commit -m ""',
30
+ matchText: "git commit",
31
+ detail: "snippet",
32
+ score: 120,
33
+ cursorOffset: 15
34
+ },
35
+ {
36
+ id: "git-checkout-branch",
37
+ label: 'git checkout -b ""',
38
+ matchText: "git checkout",
39
+ detail: "snippet",
40
+ score: 118,
41
+ cursorOffset: 17
42
+ },
43
+ {
44
+ id: "find-by-name",
45
+ label: 'find . -name ""',
46
+ matchText: "find",
47
+ detail: "find",
48
+ score: 108,
49
+ cursorOffset: 14
50
+ },
51
+ {
52
+ id: "grep-recursive-src",
53
+ label: 'grep -R "" src/',
54
+ matchText: "grep",
55
+ detail: "grep",
56
+ score: 106,
57
+ cursorOffset: 9
58
+ },
59
+ {
60
+ id: "vim-readme",
61
+ label: "vim README.md",
62
+ matchText: "vim",
63
+ detail: "editor",
64
+ score: 104
65
+ },
66
+ {
67
+ id: "vim-package-json",
68
+ label: "vim package.json",
69
+ matchText: "vim",
70
+ detail: "editor",
71
+ score: 102
72
+ },
73
+ {
74
+ id: "uname-all",
75
+ label: "uname -a",
76
+ matchText: "uname",
77
+ detail: "system",
78
+ score: 100
79
+ },
80
+ {
81
+ id: "echo-path",
82
+ label: 'echo "$PATH"',
83
+ matchText: "echo",
84
+ detail: "env",
85
+ score: 100
86
+ },
87
+ {
88
+ id: "sed-readme-range",
89
+ label: "sed -n '1,20p' README.md",
90
+ matchText: "sed",
91
+ detail: "text",
92
+ score: 98,
93
+ cursorOffset: 8
94
+ },
95
+ {
96
+ id: "awk-print-first-column",
97
+ label: "awk '{print $1}' package.json",
98
+ matchText: "awk",
99
+ detail: "text",
100
+ score: 96,
101
+ cursorOffset: 5
102
+ },
103
+ {
104
+ id: "head-readme",
105
+ label: "head -n 20 README.md",
106
+ matchText: "head",
107
+ detail: "text",
108
+ score: 94
109
+ },
110
+ {
111
+ id: "tail-readme",
112
+ label: "tail -n 20 README.md",
113
+ matchText: "tail",
114
+ detail: "text",
115
+ score: 92
116
+ },
117
+ {
118
+ id: "less-readme",
119
+ label: "less README.md",
120
+ matchText: "less",
121
+ detail: "pager",
122
+ score: 90
123
+ },
124
+ {
125
+ id: "wc-lines-readme",
126
+ label: "wc -l README.md",
127
+ matchText: "wc",
128
+ detail: "text",
129
+ score: 88
130
+ },
131
+ {
132
+ id: "mkdir-components",
133
+ label: "mkdir -p src/components",
134
+ matchText: "mkdir",
135
+ detail: "shell",
136
+ score: 86
137
+ },
138
+ {
139
+ id: "touch-env-local",
140
+ label: "touch .env.local",
141
+ matchText: "touch",
142
+ detail: "shell",
143
+ score: 84
144
+ },
145
+ {
146
+ id: "chmod-script-executable",
147
+ label: "chmod +x scripts/dev.mjs",
148
+ matchText: "chmod",
149
+ detail: "permissions",
150
+ score: 82
151
+ },
152
+ {
153
+ id: "sort-readme",
154
+ label: "sort README.md",
155
+ matchText: "sort",
156
+ detail: "text",
157
+ score: 80
158
+ },
159
+ {
160
+ id: "cut-package-fields",
161
+ label: 'cut -d ":" -f 1 package.json',
162
+ matchText: "cut",
163
+ detail: "text",
164
+ score: 78
165
+ },
166
+ {
167
+ id: "curl-head",
168
+ label: "curl -I https://example.com",
169
+ matchText: "curl",
170
+ detail: "network",
171
+ score: 76
172
+ },
173
+ {
174
+ id: "tar-create-archive",
175
+ label: "tar -czf floe-webapp.tgz packages/",
176
+ matchText: "tar",
177
+ detail: "archive",
178
+ score: 74
179
+ },
180
+ {
181
+ id: "ssh-example-host",
182
+ label: "ssh user@example.com",
183
+ matchText: "ssh",
184
+ detail: "remote",
185
+ score: 72
186
+ },
187
+ {
188
+ id: "scp-readme",
189
+ label: "scp README.md user@example.com:/tmp/",
190
+ matchText: "scp",
191
+ detail: "remote",
192
+ score: 70
193
+ }
194
+ ], R = {
195
+ uname: [
196
+ {
197
+ id: "uname-flag-a",
198
+ kind: "subcommand",
199
+ label: "uname -a",
200
+ insertText: "-a",
201
+ matchText: "-a",
202
+ detail: "system",
203
+ score: 128
204
+ },
205
+ {
206
+ id: "uname-flag-sr",
207
+ kind: "subcommand",
208
+ label: "uname -sr",
209
+ insertText: "-sr",
210
+ matchText: "-sr",
211
+ detail: "system",
212
+ score: 124
213
+ },
214
+ {
215
+ id: "uname-flag-m",
216
+ kind: "subcommand",
217
+ label: "uname -m",
218
+ insertText: "-m",
219
+ matchText: "-m",
220
+ detail: "system",
221
+ score: 122
222
+ }
223
+ ],
224
+ echo: [
225
+ {
226
+ id: "echo-token-path",
227
+ kind: "snippet",
228
+ label: 'echo "$PATH"',
229
+ insertText: '"$PATH"',
230
+ matchText: "$PATH",
231
+ detail: "env",
232
+ score: 126
233
+ },
234
+ {
235
+ id: "echo-token-shell",
236
+ kind: "snippet",
237
+ label: 'echo "$SHELL"',
238
+ insertText: '"$SHELL"',
239
+ matchText: "$SHELL",
240
+ detail: "env",
241
+ score: 124
242
+ },
243
+ {
244
+ id: "echo-token-hello",
245
+ kind: "snippet",
246
+ label: 'echo "hello world"',
247
+ insertText: '"hello world"',
248
+ matchText: "hello world",
249
+ detail: "env",
250
+ score: 120
251
+ }
252
+ ],
253
+ sed: [
254
+ {
255
+ id: "sed-flag-n",
256
+ kind: "subcommand",
257
+ label: "sed -n '1,20p' README.md",
258
+ insertText: "-n",
259
+ matchText: "-n",
260
+ detail: "text",
261
+ score: 126
262
+ },
263
+ {
264
+ id: "sed-flag-E",
265
+ kind: "subcommand",
266
+ label: "sed -E 's/floe/Floe/g' README.md",
267
+ insertText: "-E",
268
+ matchText: "-E",
269
+ detail: "text",
270
+ score: 122
271
+ },
272
+ {
273
+ id: "sed-flag-e",
274
+ kind: "subcommand",
275
+ label: "sed -e 's/floe/Floe/g' README.md",
276
+ insertText: "-e",
277
+ matchText: "-e",
278
+ detail: "text",
279
+ score: 118
280
+ }
281
+ ],
282
+ awk: [
283
+ {
284
+ id: "awk-program-print-first-column",
285
+ kind: "snippet",
286
+ label: "awk '{print $1}' package.json",
287
+ insertText: "'{print $1}'",
288
+ matchText: "'{print $1}'",
289
+ detail: "text",
290
+ score: 126
291
+ },
292
+ {
293
+ id: "awk-program-first-lines",
294
+ kind: "snippet",
295
+ label: "awk 'NR<=20 {print}' README.md",
296
+ insertText: "'NR<=20 {print}'",
297
+ matchText: "'NR<=20 {print}'",
298
+ detail: "text",
299
+ score: 122
300
+ },
301
+ {
302
+ id: "awk-program-match-scripts",
303
+ kind: "snippet",
304
+ label: `awk '/scripts/ {print NR ":" $0}' package.json`,
305
+ insertText: `'/scripts/ {print NR ":" $0}'`,
306
+ matchText: `'/scripts/ {print NR ":" $0}'`,
307
+ detail: "text",
308
+ score: 120
309
+ }
310
+ ],
311
+ grep: [
312
+ {
313
+ id: "grep-flag-R",
314
+ kind: "subcommand",
315
+ label: 'grep -R "" src/',
316
+ insertText: "-R",
317
+ matchText: "-R",
318
+ detail: "grep",
319
+ score: 124
320
+ },
321
+ {
322
+ id: "grep-flag-n",
323
+ kind: "subcommand",
324
+ label: 'grep -n "" README.md',
325
+ insertText: "-n",
326
+ matchText: "-n",
327
+ detail: "grep",
328
+ score: 122
329
+ },
330
+ {
331
+ id: "grep-flag-i",
332
+ kind: "subcommand",
333
+ label: 'grep -i "" README.md',
334
+ insertText: "-i",
335
+ matchText: "-i",
336
+ detail: "grep",
337
+ score: 120
338
+ }
339
+ ],
340
+ find: [
341
+ {
342
+ id: "find-flag-name",
343
+ kind: "subcommand",
344
+ label: 'find . -name ""',
345
+ insertText: "-name",
346
+ matchText: "-name",
347
+ detail: "find",
348
+ score: 124
349
+ },
350
+ {
351
+ id: "find-flag-type",
352
+ kind: "subcommand",
353
+ label: "find . -type f",
354
+ insertText: "-type",
355
+ matchText: "-type",
356
+ detail: "find",
357
+ score: 122
358
+ },
359
+ {
360
+ id: "find-flag-maxdepth",
361
+ kind: "subcommand",
362
+ label: "find . -maxdepth 2",
363
+ insertText: "-maxdepth",
364
+ matchText: "-maxdepth",
365
+ detail: "find",
366
+ score: 120
367
+ }
368
+ ],
369
+ head: [
370
+ {
371
+ id: "head-flag-n",
372
+ kind: "subcommand",
373
+ label: "head -n 20 README.md",
374
+ insertText: "-n 20",
375
+ matchText: "-n",
376
+ detail: "text",
377
+ score: 124
378
+ },
379
+ {
380
+ id: "head-flag-c",
381
+ kind: "subcommand",
382
+ label: "head -c 128 README.md",
383
+ insertText: "-c 128",
384
+ matchText: "-c",
385
+ detail: "text",
386
+ score: 120
387
+ }
388
+ ],
389
+ tail: [
390
+ {
391
+ id: "tail-flag-n",
392
+ kind: "subcommand",
393
+ label: "tail -n 20 README.md",
394
+ insertText: "-n 20",
395
+ matchText: "-n",
396
+ detail: "text",
397
+ score: 124
398
+ },
399
+ {
400
+ id: "tail-flag-c",
401
+ kind: "subcommand",
402
+ label: "tail -c 128 README.md",
403
+ insertText: "-c 128",
404
+ matchText: "-c",
405
+ detail: "text",
406
+ score: 120
407
+ }
408
+ ],
409
+ wc: [
410
+ {
411
+ id: "wc-flag-l",
412
+ kind: "subcommand",
413
+ label: "wc -l README.md",
414
+ insertText: "-l",
415
+ matchText: "-l",
416
+ detail: "text",
417
+ score: 124
418
+ },
419
+ {
420
+ id: "wc-flag-w",
421
+ kind: "subcommand",
422
+ label: "wc -w README.md",
423
+ insertText: "-w",
424
+ matchText: "-w",
425
+ detail: "text",
426
+ score: 122
427
+ },
428
+ {
429
+ id: "wc-flag-c",
430
+ kind: "subcommand",
431
+ label: "wc -c README.md",
432
+ insertText: "-c",
433
+ matchText: "-c",
434
+ detail: "text",
435
+ score: 120
436
+ }
437
+ ],
438
+ mkdir: [
439
+ {
440
+ id: "mkdir-flag-p",
441
+ kind: "snippet",
442
+ label: "mkdir -p src/components",
443
+ insertText: "-p src/components",
444
+ matchText: "-p",
445
+ detail: "shell",
446
+ score: 124,
447
+ nextCursorOffset: 3
448
+ }
449
+ ],
450
+ chmod: [
451
+ {
452
+ id: "chmod-plus-x",
453
+ kind: "snippet",
454
+ label: "chmod +x scripts/dev.mjs",
455
+ insertText: "+x scripts/dev.mjs",
456
+ matchText: "+x",
457
+ detail: "permissions",
458
+ score: 126,
459
+ nextCursorOffset: 3
460
+ },
461
+ {
462
+ id: "chmod-755",
463
+ kind: "snippet",
464
+ label: "chmod 755 scripts/dev.mjs",
465
+ insertText: "755 scripts/dev.mjs",
466
+ matchText: "755",
467
+ detail: "permissions",
468
+ score: 122,
469
+ nextCursorOffset: 4
470
+ },
471
+ {
472
+ id: "chmod-644",
473
+ kind: "snippet",
474
+ label: "chmod 644 package.json",
475
+ insertText: "644 package.json",
476
+ matchText: "644",
477
+ detail: "permissions",
478
+ score: 120,
479
+ nextCursorOffset: 4
480
+ }
481
+ ],
482
+ sort: [
483
+ {
484
+ id: "sort-flag-u",
485
+ kind: "snippet",
486
+ label: "sort -u package.json",
487
+ insertText: "-u package.json",
488
+ matchText: "-u",
489
+ detail: "text",
490
+ score: 124,
491
+ nextCursorOffset: 3
492
+ },
493
+ {
494
+ id: "sort-flag-r",
495
+ kind: "snippet",
496
+ label: "sort -r README.md",
497
+ insertText: "-r README.md",
498
+ matchText: "-r",
499
+ detail: "text",
500
+ score: 122,
501
+ nextCursorOffset: 3
502
+ }
503
+ ],
504
+ cut: [
505
+ {
506
+ id: "cut-delimiter-field",
507
+ kind: "snippet",
508
+ label: 'cut -d ":" -f 1 package.json',
509
+ insertText: '-d ":" -f 1 package.json',
510
+ matchText: "-d",
511
+ detail: "text",
512
+ score: 124,
513
+ nextCursorOffset: 3
514
+ },
515
+ {
516
+ id: "cut-field-only",
517
+ kind: "snippet",
518
+ label: "cut -f 1 README.md",
519
+ insertText: "-f 1 README.md",
520
+ matchText: "-f",
521
+ detail: "text",
522
+ score: 120,
523
+ nextCursorOffset: 3
524
+ }
525
+ ],
526
+ curl: [
527
+ {
528
+ id: "curl-head",
529
+ kind: "snippet",
530
+ label: "curl -I https://example.com",
531
+ insertText: "-I https://example.com",
532
+ matchText: "-I",
533
+ detail: "network",
534
+ score: 126,
535
+ nextCursorOffset: 3
536
+ },
537
+ {
538
+ id: "curl-follow",
539
+ kind: "snippet",
540
+ label: "curl -L https://example.com",
541
+ insertText: "-L https://example.com",
542
+ matchText: "-L",
543
+ detail: "network",
544
+ score: 122,
545
+ nextCursorOffset: 3
546
+ },
547
+ {
548
+ id: "curl-auth-header",
549
+ kind: "snippet",
550
+ label: 'curl -H "Authorization: Bearer " https://api.example.com',
551
+ insertText: '-H "Authorization: Bearer " https://api.example.com',
552
+ matchText: "-H",
553
+ detail: "network",
554
+ score: 120,
555
+ nextCursorOffset: 26
556
+ }
557
+ ],
558
+ tar: [
559
+ {
560
+ id: "tar-create",
561
+ kind: "snippet",
562
+ label: "tar -czf floe-webapp.tgz packages/",
563
+ insertText: "-czf floe-webapp.tgz packages/",
564
+ matchText: "-czf",
565
+ detail: "archive",
566
+ score: 126,
567
+ nextCursorOffset: 5
568
+ },
569
+ {
570
+ id: "tar-extract",
571
+ kind: "snippet",
572
+ label: "tar -xzf floe-webapp.tgz",
573
+ insertText: "-xzf floe-webapp.tgz",
574
+ matchText: "-xzf",
575
+ detail: "archive",
576
+ score: 122,
577
+ nextCursorOffset: 5
578
+ },
579
+ {
580
+ id: "tar-list",
581
+ kind: "snippet",
582
+ label: "tar -tf floe-webapp.tgz",
583
+ insertText: "-tf floe-webapp.tgz",
584
+ matchText: "-tf",
585
+ detail: "archive",
586
+ score: 120,
587
+ nextCursorOffset: 4
588
+ }
589
+ ],
590
+ ssh: [
591
+ {
592
+ id: "ssh-user-host",
593
+ kind: "snippet",
594
+ label: "ssh user@example.com",
595
+ insertText: "user@example.com",
596
+ matchText: "user@example.com",
597
+ detail: "remote",
598
+ score: 124
599
+ },
600
+ {
601
+ id: "ssh-port",
602
+ kind: "snippet",
603
+ label: "ssh -p 22 user@example.com",
604
+ insertText: "-p 22 user@example.com",
605
+ matchText: "-p",
606
+ detail: "remote",
607
+ score: 120,
608
+ nextCursorOffset: 3
609
+ }
610
+ ],
611
+ scp: [
612
+ {
613
+ id: "scp-file-to-host",
614
+ kind: "snippet",
615
+ label: "scp README.md user@example.com:/tmp/",
616
+ insertText: "README.md user@example.com:/tmp/",
617
+ matchText: "README.md",
618
+ detail: "remote",
619
+ score: 124
620
+ },
621
+ {
622
+ id: "scp-recursive",
623
+ kind: "snippet",
624
+ label: "scp -r scripts/ user@example.com:/tmp/scripts/",
625
+ insertText: "-r scripts/ user@example.com:/tmp/scripts/",
626
+ matchText: "-r",
627
+ detail: "remote",
628
+ score: 120,
629
+ nextCursorOffset: 3
630
+ }
631
+ ]
632
+ }, w = {
633
+ ls: "dir",
634
+ cat: "file",
635
+ vim: "file-or-dir",
636
+ less: "file",
637
+ head: "file",
638
+ tail: "file",
639
+ wc: "file",
640
+ sed: "file",
641
+ awk: "file",
642
+ grep: "file-or-dir",
643
+ touch: "file",
644
+ chmod: "file-or-dir",
645
+ sort: "file",
646
+ cut: "file"
647
+ }, A = {
648
+ ls: 1,
649
+ cat: 1,
650
+ vim: 1,
651
+ less: 1,
652
+ head: 3,
653
+ tail: 3,
654
+ wc: 2,
655
+ sed: 3,
656
+ awk: 2,
657
+ grep: 2,
658
+ touch: 1,
659
+ chmod: 1,
660
+ sort: 1,
661
+ cut: 2
662
+ }, O = ({
663
+ context: e,
664
+ request: t
665
+ }) => {
666
+ const a = e.value.trim().toLowerCase();
667
+ return [...t.history ?? []].reverse().map((i) => i.trim()).filter((i) => i && P(i, a)).map(
668
+ (i, l) => d(e, {
669
+ id: `history-${i}-${l}`,
670
+ kind: "history",
671
+ label: i,
672
+ detail: "history",
673
+ score: 140 - l
674
+ })
675
+ );
676
+ }, S = ({
677
+ context: e,
678
+ profile: t
679
+ }) => e.tokens.length > 1 || e.activeTokenIndex > 0 ? [] : [
680
+ ...t.scripts.map((i, l) => ({
681
+ suggestion: d(e, {
682
+ id: `root-script-${i}`,
683
+ kind: "script",
684
+ label: `pnpm ${i}`,
685
+ detail: "script",
686
+ score: H(i, l)
687
+ }),
688
+ label: `pnpm ${i}`,
689
+ matchText: `pnpm ${i}`
690
+ })),
691
+ ...E.map((i) => ({
692
+ suggestion: d(e, {
693
+ id: `root-${i.label}`,
694
+ kind: i.kind,
695
+ label: i.label,
696
+ detail: i.detail,
697
+ score: i.score
698
+ }),
699
+ label: i.label,
700
+ matchText: i.label
701
+ }))
702
+ ].filter((i) => m(e, i)).map((i) => i.suggestion), M = ({
703
+ context: e,
704
+ profile: t
705
+ }) => !e.command || e.activeTokenIndex === 0 ? [] : e.command === "git" ? c(e, [
706
+ {
707
+ id: "git-status",
708
+ kind: "subcommand",
709
+ label: "git status",
710
+ insertText: "status",
711
+ matchText: "status",
712
+ detail: "git",
713
+ score: 132
714
+ },
715
+ {
716
+ id: "git-diff",
717
+ kind: "subcommand",
718
+ label: "git diff",
719
+ insertText: "diff",
720
+ matchText: "diff",
721
+ detail: "git",
722
+ score: 128
723
+ },
724
+ {
725
+ id: "git-log",
726
+ kind: "subcommand",
727
+ label: "git log --oneline -10",
728
+ insertText: "log --oneline -10",
729
+ matchText: "log",
730
+ detail: "git",
731
+ score: 126
732
+ },
733
+ {
734
+ id: "git-add",
735
+ kind: "subcommand",
736
+ label: "git add .",
737
+ insertText: "add .",
738
+ matchText: "add",
739
+ detail: "git",
740
+ score: 124
741
+ },
742
+ {
743
+ id: "git-checkout",
744
+ kind: "snippet",
745
+ label: 'git checkout -b ""',
746
+ insertText: 'checkout -b ""',
747
+ matchText: "checkout",
748
+ detail: "snippet",
749
+ score: 122,
750
+ nextCursorOffset: 13
751
+ },
752
+ {
753
+ id: "git-commit",
754
+ kind: "snippet",
755
+ label: 'git commit -m ""',
756
+ insertText: 'commit -m ""',
757
+ matchText: "commit",
758
+ detail: "snippet",
759
+ score: 120,
760
+ nextCursorOffset: 11
761
+ }
762
+ ]) : e.command === "pnpm" ? c(
763
+ e,
764
+ t.scripts.map((a, i) => ({
765
+ id: `pnpm-${a}`,
766
+ kind: "script",
767
+ label: `pnpm ${a}`,
768
+ insertText: a,
769
+ matchText: a,
770
+ detail: "script",
771
+ score: 130 - i
772
+ }))
773
+ ) : e.command === "ls" ? c(e, [
774
+ {
775
+ id: "ls-la",
776
+ kind: "command",
777
+ label: "ls -la",
778
+ insertText: "-la",
779
+ matchText: "-la",
780
+ detail: "flag",
781
+ score: 124
782
+ }
783
+ ]) : c(
784
+ e,
785
+ R[e.command] ?? []
786
+ ), C = ({
787
+ context: e,
788
+ profile: t
789
+ }) => {
790
+ if (!e.command)
791
+ return [];
792
+ const a = A[e.command] ?? 1;
793
+ if (e.activeTokenIndex < a && !e.activeTokenPrefix)
794
+ return [];
795
+ const i = _(e.command, t);
796
+ return i.length ? i.map(({ item: l, detail: r }, s) => ({
797
+ suggestion: h(e, {
798
+ id: `path-${e.command}-${l}`,
799
+ kind: "path",
800
+ label: p(e, l),
801
+ insertText: l,
802
+ detail: r,
803
+ score: 118 - s
804
+ }),
805
+ matchText: l,
806
+ label: p(e, l)
807
+ })).filter((l) => m(e, l)).map((l) => l.suggestion) : [];
808
+ }, I = ({
809
+ context: e
810
+ }) => o(e.value) ? e.activeTokenIndex > 0 ? [] : e.tokens.length > 1 && e.activeTokenIndex === 0 ? [] : v.map((t) => ({
811
+ suggestion: d(e, {
812
+ id: `snippet-${t.id}`,
813
+ kind: "snippet",
814
+ label: t.label,
815
+ detail: t.detail,
816
+ score: t.score,
817
+ nextCursorOffset: t.cursorOffset
818
+ }),
819
+ matchText: t.matchText,
820
+ label: t.label
821
+ })).filter((t) => m(e, t)).map((t) => t.suggestion) : [], D = [
822
+ O,
823
+ S,
824
+ M,
825
+ C,
826
+ I
827
+ ];
828
+ function $(e, t) {
829
+ const a = b(e.profile), i = N(
830
+ e.value,
831
+ e.cursor
832
+ ), l = e.maxItems ?? k, r = t?.providers ?? D;
833
+ return L(
834
+ r.flatMap((s) => s({ request: e, profile: a, context: i }))
835
+ ).sort(z).slice(0, l);
836
+ }
837
+ function U(e, t, a) {
838
+ const i = $(
839
+ {
840
+ value: e.value,
841
+ cursor: e.cursor,
842
+ history: t?.history,
843
+ profile: t?.profile,
844
+ maxItems: 1
845
+ },
846
+ a
847
+ )[0];
848
+ return i ? y(e, i) : e;
849
+ }
850
+ function y(e, t) {
851
+ return {
852
+ value: e.value.slice(0, t.replaceFrom) + t.insertText + e.value.slice(t.replaceTo),
853
+ cursor: t.nextCursor,
854
+ historyIndex: null,
855
+ draft: ""
856
+ };
857
+ }
858
+ function d(e, t) {
859
+ const a = t.insertText ?? t.label;
860
+ return {
861
+ id: t.id,
862
+ kind: t.kind,
863
+ label: t.label,
864
+ insertText: a,
865
+ replaceFrom: 0,
866
+ replaceTo: t.replaceTo ?? e.value.length,
867
+ nextCursor: t.nextCursorOffset ?? a.length,
868
+ score: t.score,
869
+ detail: t.detail
870
+ };
871
+ }
872
+ function h(e, t) {
873
+ const a = t.replaceFrom ?? e.activeReplaceFrom, i = t.replaceTo ?? e.activeReplaceTo;
874
+ return {
875
+ id: t.id,
876
+ kind: t.kind,
877
+ label: t.label,
878
+ insertText: t.insertText,
879
+ replaceFrom: a,
880
+ replaceTo: i,
881
+ nextCursor: a + (t.nextCursorOffset ?? t.insertText.length),
882
+ score: t.score,
883
+ detail: t.detail
884
+ };
885
+ }
886
+ function m(e, t) {
887
+ const a = o(
888
+ e.activeTokenIndex === 0 && e.tokens.length <= 1 ? e.value.trim() : e.activeTokenPrefix
889
+ );
890
+ if (!a) return !0;
891
+ const i = o(t.matchText ?? t.label), l = o(t.label);
892
+ return i.startsWith(a) || l.startsWith(a);
893
+ }
894
+ function N(e, t = e.length) {
895
+ const a = g(t, e.length), i = j(e), l = i.find(
896
+ (n) => n.from <= a && a <= n.to
897
+ ), r = a === 0 || /\s/.test(e[a - 1] ?? ""), s = l ? i.indexOf(l) : i.filter((n) => n.to <= a).length, f = l?.from ?? a, u = l?.to ?? a, x = l?.text ?? "", T = l ? e.slice(l.from, a) : "";
898
+ return {
899
+ value: e,
900
+ cursor: a,
901
+ tokens: i,
902
+ command: i[0]?.text ?? null,
903
+ activeTokenIndex: s,
904
+ activeTokenPrefix: T,
905
+ activeTokenText: x,
906
+ activeReplaceFrom: f,
907
+ activeReplaceTo: u,
908
+ atTokenBoundary: r
909
+ };
910
+ }
911
+ function c(e, t) {
912
+ return t.filter((a) => m(e, a)).map(
913
+ (a) => h(e, {
914
+ id: a.id,
915
+ kind: a.kind,
916
+ label: a.label,
917
+ insertText: a.insertText,
918
+ detail: a.detail,
919
+ score: a.score,
920
+ nextCursorOffset: a.nextCursorOffset
921
+ })
922
+ );
923
+ }
924
+ function P(e, t) {
925
+ return t ? e.toLowerCase().startsWith(t) : !0;
926
+ }
927
+ function z(e, t) {
928
+ return t.score !== e.score ? t.score - e.score : e.label.localeCompare(t.label);
929
+ }
930
+ function L(e) {
931
+ const t = /* @__PURE__ */ new Set(), a = [];
932
+ for (const i of e) {
933
+ const l = `${i.kind}:${i.label}:${i.insertText}:${i.replaceFrom}:${i.replaceTo}`;
934
+ t.has(l) || (t.add(l), a.push(i));
935
+ }
936
+ return a;
937
+ }
938
+ function _(e, t) {
939
+ const a = w[e];
940
+ return a ? a === "file" ? t.files.map((i) => ({ item: i, detail: "file" })) : a === "dir" ? t.directories.map((i) => ({ item: `${i}/`, detail: "dir" })) : [
941
+ ...t.files.map((i) => ({ item: i, detail: "file" })),
942
+ ...t.directories.map((i) => ({ item: `${i}/`, detail: "dir" }))
943
+ ] : [];
944
+ }
945
+ function p(e, t) {
946
+ return (e.value.slice(0, e.activeReplaceFrom) + t + e.value.slice(e.activeReplaceTo)).trimEnd();
947
+ }
948
+ function j(e) {
949
+ const t = [];
950
+ let a = -1, i = null, l = !1;
951
+ for (let r = 0; r < e.length; r += 1) {
952
+ const s = e[r] ?? "";
953
+ if (a === -1) {
954
+ if (/\s/.test(s)) continue;
955
+ a = r;
956
+ }
957
+ if (l) {
958
+ l = !1;
959
+ continue;
960
+ }
961
+ if (s === "\\" && i !== "single") {
962
+ l = !0;
963
+ continue;
964
+ }
965
+ if (i === null) {
966
+ if (s === "'") {
967
+ i = "single";
968
+ continue;
969
+ }
970
+ if (s === '"') {
971
+ i = "double";
972
+ continue;
973
+ }
974
+ /\s/.test(s) && (t.push({
975
+ text: e.slice(a, r),
976
+ from: a,
977
+ to: r
978
+ }), a = -1);
979
+ continue;
980
+ }
981
+ if (i === "single" && s === "'") {
982
+ i = null;
983
+ continue;
984
+ }
985
+ i === "double" && s === '"' && (i = null);
986
+ }
987
+ return a !== -1 && t.push({
988
+ text: e.slice(a),
989
+ from: a,
990
+ to: e.length
991
+ }), t;
992
+ }
993
+ function o(e) {
994
+ return e.trim().toLowerCase();
995
+ }
996
+ function H(e, t) {
997
+ return {
998
+ dev: 117,
999
+ test: 115,
1000
+ build: 114,
1001
+ lint: 111,
1002
+ typecheck: 109,
1003
+ verify: 107
1004
+ }[e] ?? 105 - t;
1005
+ }
1006
+ export {
1007
+ D as DEFAULT_TERMINAL_SUGGESTION_PROVIDERS,
1008
+ y as applyTerminalSuggestion,
1009
+ U as autocompleteTerminalInput,
1010
+ d as createTerminalFullLineSuggestion,
1011
+ h as createTerminalTokenSuggestion,
1012
+ $ as getTerminalSuggestions,
1013
+ m as matchesTerminalSuggestionPrefix,
1014
+ N as parseTerminalSuggestionContext,
1015
+ M as terminalCommandTokenSuggestionProvider,
1016
+ O as terminalHistorySuggestionProvider,
1017
+ C as terminalPathSuggestionProvider,
1018
+ S as terminalRootSuggestionProvider,
1019
+ I as terminalSnippetSuggestionProvider
1020
+ };