@vistagenic/vista 0.3.6 → 0.3.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.
Files changed (68) hide show
  1. package/bin/flashpack-agent-playground.mjs +134 -0
  2. package/bin/flashpack-boot.mjs +504 -0
  3. package/bin/flashpack-ssr-loader.mjs +42 -0
  4. package/bin/flashpack-ssr.mjs +81 -0
  5. package/bin/flashpack-vendor.mjs +97 -0
  6. package/bin/vista.js +56 -42
  7. package/dist/ai/providers/base.js +7 -1
  8. package/dist/bin/build-rsc.js +16 -0
  9. package/dist/bin/build.js +17 -11
  10. package/dist/bin/deploy.js +7 -0
  11. package/dist/bin/dev-client-runtime.d.ts +6 -0
  12. package/dist/bin/dev-client-runtime.js +99 -0
  13. package/dist/bin/dev-error-overlay-snippet.js +79 -21
  14. package/dist/bin/dev-error-overlay-snippet.ts +840 -0
  15. package/dist/bin/devtools-indicator-snippet.js +29 -13
  16. package/dist/bin/file-scanner.js +7 -24
  17. package/dist/bin/generate.js +94 -2
  18. package/dist/bin/webpack.config.js +3 -1
  19. package/dist/build/rsc/compiler.d.ts +14 -0
  20. package/dist/build/rsc/compiler.js +66 -6
  21. package/dist/build/rsc/server-manifest.js +5 -4
  22. package/dist/config.d.ts +5 -0
  23. package/dist/config.js +15 -1
  24. package/dist/deploy/adapters/render.js +2 -2
  25. package/dist/deploy/index.d.ts +1 -0
  26. package/dist/deploy/index.js +3 -0
  27. package/dist/deploy/runtime-pack.js +22 -1
  28. package/dist/deploy/utils.js +16 -6
  29. package/dist/flashpack/command.d.ts +1 -0
  30. package/dist/flashpack/command.js +42 -76
  31. package/dist/flashpack/runtime.d.ts +12 -0
  32. package/dist/flashpack/runtime.js +124 -22
  33. package/dist/metadata/generate.d.ts +1 -0
  34. package/dist/metadata/generate.js +117 -21
  35. package/dist/metadata/index.d.ts +5 -0
  36. package/dist/metadata/index.js +15 -1
  37. package/dist/metadata/json-ld.d.ts +15 -0
  38. package/dist/metadata/json-ld.js +19 -0
  39. package/dist/metadata/merge.d.ts +17 -0
  40. package/dist/metadata/merge.js +161 -0
  41. package/dist/metadata/routes.d.ts +66 -0
  42. package/dist/metadata/routes.js +143 -0
  43. package/dist/metadata/types.d.ts +1 -1
  44. package/dist/metadata/types.js +3 -1
  45. package/dist/og/image-response.d.ts +38 -0
  46. package/dist/og/image-response.js +88 -0
  47. package/dist/og/index.d.ts +2 -0
  48. package/dist/og/index.js +5 -0
  49. package/dist/rust/index.d.ts +13 -0
  50. package/dist/rust/index.js +132 -0
  51. package/dist/server/engine.js +13 -3
  52. package/dist/server/logger.js +2 -1
  53. package/dist/server/project-alias-resolver.d.ts +7 -0
  54. package/dist/server/project-alias-resolver.js +70 -0
  55. package/dist/server/rsc-engine.js +93 -16
  56. package/dist/server/static-generator.js +4 -3
  57. package/dist/server/typed-api-runtime.js +92 -0
  58. package/docs/ai.md +69 -0
  59. package/docs/app.md +30 -0
  60. package/docs/cli.md +29 -0
  61. package/docs/index.md +18 -0
  62. package/docs/rag.md +54 -0
  63. package/native/win32-x64/flashpack-cli.exe +0 -0
  64. package/package.json +196 -178
  65. package/skills/README.md +9 -0
  66. package/skills/vista-agent/SKILL.md +28 -0
  67. package/skills/vista-dev-loop/SKILL.md +25 -0
  68. package/skills/vista-rag/SKILL.md +26 -0
@@ -0,0 +1,840 @@
1
+ /**
2
+ * Returns a JS snippet that installs the Vista dev error overlay.
3
+ * It supports Next.js-style error pagination and indicator restore.
4
+ */
5
+ export function getDevErrorOverlayBootstrapSource(): string {
6
+ return String.raw`
7
+ (function installVistaDevErrorOverlay() {
8
+ if (typeof window === 'undefined' || typeof document === 'undefined') return;
9
+ if (window.__VISTA_DEV_ERROR_OVERLAY__) return;
10
+
11
+ var STYLE_ID = '__vista-dev-error-overlay-style';
12
+ var ROOT_ID = '__vista-dev-error-overlay';
13
+ var root = null;
14
+ var messageNode = null;
15
+ var titleNode = null;
16
+ var detailNode = null;
17
+ var stackNode = null;
18
+ var filesWrapNode = null;
19
+ var filesNode = null;
20
+ var tabNameNodes = null;
21
+ var crumbsNode = null;
22
+ var statusLnNode = null;
23
+ var statusLangNode = null;
24
+ var kindNode = null;
25
+ var sourceBadgeNode = null;
26
+ var fileTabsNode = null;
27
+ var copyButton = null;
28
+ var minimizeButton = null;
29
+ var reloadButton = null;
30
+ var paginationNode = null;
31
+ var prevButton = null;
32
+ var nextButton = null;
33
+ var countNode = null;
34
+ var mainNode = null;
35
+ var panelExpandButton = null;
36
+ var listenersBound = false;
37
+ var state = {
38
+ open: false,
39
+ minimized: false,
40
+ entries: [],
41
+ activeIndex: 0,
42
+ fileTab: 0,
43
+ };
44
+
45
+ function getIndicator() {
46
+ return window.__VISTA_DEVTOOLS_INDICATOR__;
47
+ }
48
+
49
+ function escapeHtml(value) {
50
+ return String(value || '')
51
+ .replace(/&/g, '&')
52
+ .replace(/</g, '&lt;')
53
+ .replace(/>/g, '&gt;')
54
+ .replace(/"/g, '&quot;')
55
+ .replace(/'/g, '&#039;');
56
+ }
57
+
58
+ function highlightSource(text) {
59
+ var html = '';
60
+ var i = 0;
61
+ var keywords = /^(import|from|function|return|const|let|var|export|default|class|extends|if|else|async|await|new|type|interface|true|false|null|undefined|typeof|void|as|of|in|for|while|switch|case|break|continue|try|catch|finally|this)\b/;
62
+ while (i < text.length) {
63
+ var ch = text.charAt(i);
64
+ if (ch === "'" || ch === '"' || ch === String.fromCharCode(96)) {
65
+ var j = i + 1;
66
+ while (j < text.length && text.charAt(j) !== ch) {
67
+ j += text.charAt(j) === '\\' ? 2 : 1;
68
+ }
69
+ html += '<span class="vista-tok-str">' + escapeHtml(text.slice(i, Math.min(j + 1, text.length))) + '</span>';
70
+ i = j + 1;
71
+ continue;
72
+ }
73
+ if (ch === '/' && text.charAt(i + 1) === '/') {
74
+ html += '<span class="vista-tok-cmt">' + escapeHtml(text.slice(i)) + '</span>';
75
+ break;
76
+ }
77
+ if (ch === '<' && /[A-Za-z/]/.test(text.charAt(i + 1) || '')) {
78
+ var tag = text.slice(i).match(/^<\/?[A-Za-z][\w.-]*/);
79
+ if (tag) {
80
+ html += '<span class="vista-tok-tag">' + escapeHtml(tag[0]) + '</span>';
81
+ i += tag[0].length;
82
+ continue;
83
+ }
84
+ }
85
+ if (/[A-Za-z_$]/.test(ch)) {
86
+ var ident = text.slice(i).match(/^[A-Za-z_$][\w$]*/);
87
+ if (ident) {
88
+ html += keywords.test(ident[0])
89
+ ? '<span class="vista-tok-kw">' + escapeHtml(ident[0]) + '</span>'
90
+ : escapeHtml(ident[0]);
91
+ i += ident[0].length;
92
+ continue;
93
+ }
94
+ }
95
+ html += escapeHtml(ch);
96
+ i += 1;
97
+ }
98
+ return html;
99
+ }
100
+
101
+ function fileBasename(file) {
102
+ var normalized = String(file || '').replace(/\\/g, '/').replace(/:\d+(?::\d+)?$/, '');
103
+ return normalized.split('/').filter(Boolean).pop() || 'untitled';
104
+ }
105
+
106
+ function fileBreadcrumb(file) {
107
+ var normalized = String(file || '').replace(/\\/g, '/').replace(/:\d+(?::\d+)?$/, '');
108
+ return normalized.split('/').filter(Boolean).join(' › ') || 'Source';
109
+ }
110
+
111
+ function languageFromFile(file) {
112
+ var ext = String(file || '').replace(/:\d+(?::\d+)?$/, '').split('.').pop().toLowerCase();
113
+ if (ext === 'tsx') return 'TypeScript React';
114
+ if (ext === 'ts') return 'TypeScript';
115
+ if (ext === 'jsx') return 'JavaScript React';
116
+ if (ext === 'js' || ext === 'mjs' || ext === 'cjs') return 'JavaScript';
117
+ if (ext === 'css') return 'CSS';
118
+ if (ext === 'json') return 'JSON';
119
+ return 'Plain Text';
120
+ }
121
+
122
+ function parseFileLocation(file) {
123
+ var match = String(file || '').match(/:(\d+)(?::(\d+))?$/);
124
+ return {
125
+ line: match ? Number(match[1]) : 0,
126
+ column: match && match[2] ? Number(match[2]) : 1,
127
+ };
128
+ }
129
+
130
+ function renderIdeCode(codeFrame, errorLine, errorColumn) {
131
+ var rawLines = String(codeFrame || '').split(/\r?\n/);
132
+ var rows = [];
133
+ for (var i = 0; i < rawLines.length; i += 1) {
134
+ var line = rawLines[i];
135
+ var numbered = line.match(/^(\s*>)?\s*(\d+)\s+\|(.*)$/);
136
+ if (!numbered) continue;
137
+ var src = numbered[3];
138
+ if (src.charAt(0) === ' ') src = src.slice(1);
139
+ var isError = !!(numbered[1] && numbered[1].indexOf('>') !== -1);
140
+ var squiggleAt = -1;
141
+ var next = rawLines[i + 1] || '';
142
+ var caret = next.match(/\|(.*)$/);
143
+ if (caret && caret[1].indexOf('^') !== -1) {
144
+ var mark = caret[1];
145
+ if (mark.charAt(0) === ' ') mark = mark.slice(1);
146
+ squiggleAt = Math.max(0, mark.indexOf('^'));
147
+ isError = true;
148
+ i += 1;
149
+ }
150
+ rows.push({ n: Number(numbered[2]), text: src, error: isError, squiggleAt: squiggleAt });
151
+ }
152
+ if (!rows.length) {
153
+ return '<div class="vista-error-editor"><div class="vista-error-editor-line"><span class="vista-error-gutter"></span><span class="vista-error-source">' + highlightSource(String(codeFrame || '')) + '</span></div></div>';
154
+ }
155
+ var min = rows[0].n;
156
+ var max = rows[0].n;
157
+ var byN = {};
158
+ for (var r = 0; r < rows.length; r += 1) {
159
+ byN[rows[r].n] = rows[r];
160
+ if (rows[r].n < min) min = rows[r].n;
161
+ if (rows[r].n > max) max = rows[r].n;
162
+ }
163
+ var html = '';
164
+ for (var n = min; n <= max; n += 1) {
165
+ var row = byN[n] || { n: n, text: '', error: Number(errorLine) === n, squiggleAt: -1 };
166
+ if (row.squiggleAt < 0 && Number(errorLine) === n && errorColumn) {
167
+ row.squiggleAt = Math.max(0, Number(errorColumn) - 1);
168
+ row.error = true;
169
+ }
170
+ html += '<div class="vista-error-editor-line' + (row.error ? ' is-error' : '') + '">';
171
+ html += '<span class="vista-error-gutter">' + row.n + '</span>';
172
+ html += '<span class="vista-error-source">' + highlightSource(row.text);
173
+ if (row.squiggleAt >= 0) {
174
+ html += '<span class="vista-error-squiggle" style="width:3.2ch;margin-left:' + row.squiggleAt + 'ch"></span>';
175
+ }
176
+ html += '</span></div>';
177
+ }
178
+ return '<div class="vista-error-editor">' + html + '</div>';
179
+ }
180
+
181
+ function colorizeBlock(value) {
182
+ return renderIdeCode(value);
183
+ }
184
+
185
+ function createStyle() {
186
+ if (document.getElementById(STYLE_ID)) return;
187
+ var style = document.createElement('style');
188
+ style.id = STYLE_ID;
189
+ style.textContent = [
190
+ '#' + ROOT_ID + '{position:fixed;inset:0;z-index:2147482500;display:flex;align-items:center;justify-content:center;padding:20px;overflow:hidden;}',
191
+ '#' + ROOT_ID + '[hidden]{display:none;}',
192
+ '#' + ROOT_ID + ' .vista-ov-backdrop{position:absolute;inset:0;background:rgba(0,0,0,0.72);}',
193
+ '#' + ROOT_ID + ' .vista-ov-panel{position:relative;width:min(1180px,calc(100vw - 32px));height:min(820px,calc(100vh - 32px));display:flex;flex-direction:column;overflow:hidden;border-radius:8px;border:1px solid #2b2b2b;background:#1e1e1e;box-shadow:0 24px 80px rgba(0,0,0,0.62);color:#ededed;font-family:"Segoe UI",ui-sans-serif,system-ui,-apple-system,sans-serif;animation:vista-ov-in 160ms ease;}',
194
+ '#' + ROOT_ID + ' .vista-ov-titlebar{display:flex;align-items:center;justify-content:space-between;gap:12px;height:38px;padding:0 10px;background:#181818;border-bottom:1px solid #2b2b2b;flex-shrink:0;}',
195
+ '#' + ROOT_ID + ' .vista-ov-traffic{display:inline-flex;align-items:center;gap:6px;width:54px;}',
196
+ '#' + ROOT_ID + ' .vista-ov-traffic span{width:10px;height:10px;border-radius:999px;}',
197
+ '#' + ROOT_ID + ' .vista-ov-traffic .is-close{background:#ff5f57;}',
198
+ '#' + ROOT_ID + ' .vista-ov-traffic .is-min{background:#febc2e;}',
199
+ '#' + ROOT_ID + ' .vista-ov-traffic .is-max{background:#28c840;}',
200
+ '#' + ROOT_ID + ' .vista-ov-window-title{min-width:0;flex:1;text-align:center;color:#c6c6c6;font-size:12px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}',
201
+ '#' + ROOT_ID + ' .vista-ov-pagination{display:inline-flex;align-items:center;gap:2px;}',
202
+ '#' + ROOT_ID + ' .vista-ov-pagination[hidden]{display:none;}',
203
+ '#' + ROOT_ID + ' .vista-ov-page-btn{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:6px;background:transparent;color:#a1a1a1;font-size:16px;line-height:1;cursor:pointer;}',
204
+ '#' + ROOT_ID + ' .vista-ov-page-btn:disabled{opacity:0.28;cursor:default;}',
205
+ '#' + ROOT_ID + ' .vista-ov-page-btn:not(:disabled):hover{background:#171717;color:#ededed;}',
206
+ '#' + ROOT_ID + ' .vista-ov-page-count{font-size:13px;font-weight:500;color:#a1a1a1;min-width:36px;text-align:center;font-variant-numeric:tabular-nums;padding:0 4px;}',
207
+ '#' + ROOT_ID + ' .vista-ov-workbench{display:flex;flex:1;min-height:0;}',
208
+ '#' + ROOT_ID + ' .vista-ov-activity{width:48px;flex-shrink:0;display:flex;flex-direction:column;align-items:center;padding-top:8px;background:#181818;border-right:1px solid #2b2b2b;}',
209
+ '#' + ROOT_ID + ' .vista-ov-activity-item{width:48px;height:40px;display:inline-flex;align-items:center;justify-content:center;color:#ffffff;box-shadow:inset 2px 0 0 #0078d4;}',
210
+ '#' + ROOT_ID + ' .vista-ov-activity-item svg{width:22px;height:22px;display:block;}',
211
+ '#' + ROOT_ID + ' .vista-ov-main{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;}',
212
+ '#' + ROOT_ID + ' .vista-ov-tabbar{display:flex;align-items:stretch;justify-content:space-between;height:35px;background:#181818;border-bottom:1px solid #2b2b2b;flex-shrink:0;}',
213
+ '#' + ROOT_ID + ' .vista-ov-tabs{display:flex;min-width:0;overflow:hidden;scrollbar-width:none;}',
214
+ '#' + ROOT_ID + ' .vista-ov-tabs::-webkit-scrollbar{display:none;}',
215
+ '#' + ROOT_ID + ' .vista-ov-tab{display:inline-flex;align-items:center;gap:8px;height:35px;padding:0 14px;border:0;border-right:1px solid #2b2b2b;background:#1e1e1e;color:#cccccc;font-size:12px;box-shadow:inset 0 -1px 0 #0078d4;cursor:pointer;}',
216
+ '#' + ROOT_ID + ' .vista-ov-tab.is-inactive{background:#181818;color:#8b8b8b;box-shadow:none;}',
217
+ '#' + ROOT_ID + ' .vista-ov-tab svg{width:14px;height:14px;}',
218
+ '#' + ROOT_ID + ' .vista-ov-actions{display:inline-flex;gap:2px;align-items:center;}',
219
+ '#' + ROOT_ID + ' .vista-ov-btn{width:28px;height:28px;padding:0;border:0;border-radius:6px;background:transparent;color:#a1a1a1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;}',
220
+ '#' + ROOT_ID + ' .vista-ov-btn:hover{background:#171717;color:#ededed;}',
221
+ '#' + ROOT_ID + ' .vista-ov-btn svg{width:14px;height:14px;display:block;}',
222
+ '#' + ROOT_ID + ' .vista-ov-btn:focus-visible{outline:2px solid #ededed;outline-offset:1px;}',
223
+ '#' + ROOT_ID + ' .vista-ov-crumbs{height:24px;padding:0 12px;display:flex;align-items:center;background:#1e1e1e;border-bottom:1px solid #2b2b2b;color:#8b8b8b;font-size:11px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}',
224
+ '#' + ROOT_ID + ' .vista-ov-code{display:flex;flex-direction:column;flex:1;min-height:0;background:#1e1e1e;overflow:hidden;}',
225
+ '#' + ROOT_ID + ' .vista-ov-code[hidden]{display:none;}',
226
+ '#' + ROOT_ID + ' .vista-ov-editor-host{flex:1;min-height:0;overflow:auto;}',
227
+ '#' + ROOT_ID + ' .vista-error-editor{margin:0;min-height:100%;padding:8px 0 12px;font-size:13px;line-height:20px;font-family:ui-monospace,SFMono-Regular,"Cascadia Code",Menlo,Consolas,monospace;background:#1e1e1e;}',
228
+ '#' + ROOT_ID + ' .vista-error-editor-line{display:grid;grid-template-columns:56px minmax(0,1fr);min-height:20px;}',
229
+ '#' + ROOT_ID + ' .vista-error-editor-line.is-error{background:rgba(248,81,73,0.12);}',
230
+ '#' + ROOT_ID + ' .vista-error-gutter{padding:0 12px 0 0;border-right:1px solid #2b2b2b;color:#6e7681;text-align:right;user-select:none;font-variant-numeric:tabular-nums;}',
231
+ '#' + ROOT_ID + ' .vista-error-editor-line.is-error .vista-error-gutter{color:#f85149;font-weight:600;}',
232
+ '#' + ROOT_ID + ' .vista-error-source{position:relative;padding:0 16px 0 12px;color:#d4d4d4;white-space:pre;overflow:hidden;}',
233
+ '#' + ROOT_ID + ' .vista-error-squiggle{position:absolute;left:12px;bottom:0;height:4px;width:3.2ch;background-image:url("data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'6\' height=\'4\' viewBox=\'0 0 6 4\'%3E%3Cpath d=\'M0 3 Q1.5 0 3 3 T6 3\' fill=\'none\' stroke=\'%23f85149\' stroke-width=\'1.4\'/%3E%3C/svg%3E");background-repeat:repeat-x;background-size:6px 4px;pointer-events:none;}',
234
+ '#' + ROOT_ID + ' .vista-tok-kw{color:#c586c0;}',
235
+ '#' + ROOT_ID + ' .vista-tok-str{color:#ce9178;}',
236
+ '#' + ROOT_ID + ' .vista-tok-cmt{color:#6a9955;font-style:italic;}',
237
+ '#' + ROOT_ID + ' .vista-tok-tag{color:#4ec9b0;}',
238
+ '#' + ROOT_ID + ' .vista-tok-num{color:#b5cea8;}',
239
+ '#' + ROOT_ID + ' .vista-ov-statusbar{display:flex;align-items:center;justify-content:space-between;gap:12px;height:22px;padding:0 10px;background:#007acc;color:#fff;font-size:12px;flex-shrink:0;}',
240
+ '#' + ROOT_ID + ' .vista-ov-panel-dock{display:flex;flex-direction:column;background:#181818;border-top:1px solid #2b2b2b;overflow:hidden;flex:0 0 auto;max-height:38%;min-height:148px;}',
241
+ '#' + ROOT_ID + ' .vista-ov-panel-tabs{display:flex;align-items:center;gap:16px;height:32px;padding:0 8px 0 12px;border-bottom:1px solid #2b2b2b;color:#bbbbbb;font-size:11px;font-weight:600;letter-spacing:0.06em;flex-shrink:0;}',
242
+ '#' + ROOT_ID + ' .vista-ov-panel-tabs .is-active{color:#fff;box-shadow:inset 0 -1px 0 #fff;padding-bottom:8px;}',
243
+ '#' + ROOT_ID + ' .vista-ov-panel-toggle{margin-left:auto;}',
244
+ '#' + ROOT_ID + ' .vista-ov-panel-toggle[hidden]{display:none;}',
245
+ '#' + ROOT_ID + ' .vista-ov-panel-toggle .vista-ide-icon-restore{display:none;}',
246
+ '#' + ROOT_ID + ' .vista-ov-main[data-panel-expanded="true"] .vista-ov-tabbar,' +
247
+ '#' + ROOT_ID + ' .vista-ov-main[data-panel-expanded="true"] .vista-ov-crumbs,' +
248
+ '#' + ROOT_ID + ' .vista-ov-main[data-panel-expanded="true"] .vista-ov-code,' +
249
+ '#' + ROOT_ID + ' .vista-ov-main[data-panel-expanded="true"] .vista-ov-statusbar{display:none;}',
250
+ '#' + ROOT_ID + ' .vista-ov-main[data-panel-expanded="true"] .vista-ov-panel-dock{flex:1;max-height:none;min-height:0;border-top:0;}',
251
+ '#' + ROOT_ID + ' .vista-ov-main[data-panel-expanded="true"] .vista-ide-icon-expand{display:none;}',
252
+ '#' + ROOT_ID + ' .vista-ov-main[data-panel-expanded="true"] .vista-ide-icon-restore{display:block;}',
253
+ '#' + ROOT_ID + ' .vista-ov-main[data-terminal="true"] .vista-ov-tabbar,' +
254
+ '#' + ROOT_ID + ' .vista-ov-main[data-terminal="true"] .vista-ov-crumbs,' +
255
+ '#' + ROOT_ID + ' .vista-ov-main[data-terminal="true"] .vista-ov-code,' +
256
+ '#' + ROOT_ID + ' .vista-ov-main[data-terminal="true"] .vista-ov-statusbar{display:none;}',
257
+ '#' + ROOT_ID + ' .vista-ov-main[data-terminal="true"] .vista-ov-panel-dock{flex:1;max-height:none;min-height:0;border-top:0;}',
258
+ '#' + ROOT_ID + ' .vista-ov-main[data-terminal="true"] .vista-ov-panel-toggle{display:none;}',
259
+ '#' + ROOT_ID + ' .vista-ov-body{flex:1;min-height:0;overflow:auto;padding:10px 14px 14px;}',
260
+ '#' + ROOT_ID + ' .vista-ov-editor-host,' + '#' + ROOT_ID + ' .vista-ov-body{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,0.16) transparent;}',
261
+ '#' + ROOT_ID + ' .vista-ov-editor-host::-webkit-scrollbar,' + '#' + ROOT_ID + ' .vista-ov-body::-webkit-scrollbar{width:6px;height:6px;}',
262
+ '#' + ROOT_ID + ' .vista-ov-editor-host::-webkit-scrollbar-track,' + '#' + ROOT_ID + ' .vista-ov-body::-webkit-scrollbar-track,' +
263
+ '#' + ROOT_ID + ' .vista-ov-editor-host::-webkit-scrollbar-corner,' + '#' + ROOT_ID + ' .vista-ov-body::-webkit-scrollbar-corner{background:transparent;}',
264
+ '#' + ROOT_ID + ' .vista-ov-editor-host::-webkit-scrollbar-thumb,' + '#' + ROOT_ID + ' .vista-ov-body::-webkit-scrollbar-thumb{background-color:rgba(255,255,255,0.16);border-radius:999px;}',
265
+ '#' + ROOT_ID + ' .vista-ov-editor-host::-webkit-scrollbar-thumb:hover,' + '#' + ROOT_ID + ' .vista-ov-body::-webkit-scrollbar-thumb:hover{background-color:rgba(255,255,255,0.34);}',
266
+ '#' + ROOT_ID + ' .vista-ov-kind{margin:0;color:#f85149;font-size:12px;font-weight:600;}',
267
+ '#' + ROOT_ID + ' .vista-ov-kind.is-hydration{color:#d29922;}',
268
+ '#' + ROOT_ID + ' .vista-ov-kind.is-server{color:#58a6ff;}',
269
+ '#' + ROOT_ID + ' .vista-ov-source-badge{padding:0 7px;border-radius:999px;font-size:10px;font-weight:600;letter-spacing:0.04em;text-transform:uppercase;background:rgba(255,255,255,0.12);}',
270
+ '#' + ROOT_ID + ' .vista-ov-source-badge.is-server{background:#1f6feb;}',
271
+ '#' + ROOT_ID + ' .vista-ov-source-badge.is-hydration{background:#9e6a03;}',
272
+ '#' + ROOT_ID + ' .vista-ov-source-badge.is-client{background:#238636;}',
273
+ '#' + ROOT_ID + ' .vista-ov-title{margin:6px 0 0;font-size:14px;line-height:1.45;font-weight:600;color:#e6edf3;word-break:break-word;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;}',
274
+ '#' + ROOT_ID + ' .vista-ov-detail{margin:8px 0 0;font-size:12px;line-height:1.5;color:#8b949e;white-space:pre-wrap;word-break:break-word;}',
275
+ '#' + ROOT_ID + ' .vista-ov-detail[hidden]{display:none;}',
276
+ '#' + ROOT_ID + ' .vista-ov-stack{margin:12px 0 0;padding:12px 14px;border:1px solid #30363d;border-radius:6px;background:#0d1117;color:#e6edf3;font-size:12px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;white-space:pre-wrap;word-break:break-word;overflow:auto;max-height:min(52vh,520px);}',
277
+ '#' + ROOT_ID + ' .vista-ov-stack[hidden]{display:none;}',
278
+ '#' + ROOT_ID + ' .vista-ov-stack .vista-ov-stack-file{color:#79c0ff;}',
279
+ '@keyframes vista-ov-in{from{opacity:0;transform:translateY(8px) scale(0.98);}to{opacity:1;transform:translateY(0) scale(1);}}',
280
+ '@media (max-width: 720px){',
281
+ ' #' + ROOT_ID + '{padding:10px;}',
282
+ '}',
283
+ ].join('');
284
+ document.head.appendChild(style);
285
+ }
286
+
287
+ function ensureMounted() {
288
+ createStyle();
289
+ if (!root) {
290
+ root = document.getElementById(ROOT_ID);
291
+ }
292
+ if (!root) {
293
+ root = document.createElement('div');
294
+ root.id = ROOT_ID;
295
+ root.hidden = true;
296
+ root.innerHTML = [
297
+ '<div class="vista-ov-backdrop"></div>',
298
+ '<section class="vista-ov-panel" role="dialog" aria-modal="true" aria-label="Vista build error overlay">',
299
+ ' <div class="vista-ov-titlebar">',
300
+ ' <div class="vista-ov-traffic" aria-hidden="true"><span class="is-close"></span><span class="is-min"></span><span class="is-max"></span></div>',
301
+ ' <div class="vista-ov-window-title">Vista — <span data-vista-tab-name>untitled</span></div>',
302
+ ' <div class="vista-ov-actions">',
303
+ ' <button type="button" class="vista-ov-btn" data-vista-copy aria-label="Copy error">',
304
+ ' <svg viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><rect x="9" y="9" width="10" height="10" rx="2" stroke="currentColor" stroke-width="1.6"/><rect x="5" y="5" width="10" height="10" rx="2" stroke="currentColor" stroke-width="1.6"/></svg>',
305
+ ' </button>',
306
+ ' <button type="button" class="vista-ov-btn" data-vista-minimize aria-label="Minimize">',
307
+ ' <svg viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M5 12H19" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>',
308
+ ' </button>',
309
+ ' <button type="button" class="vista-ov-btn" data-vista-reload aria-label="Reload">',
310
+ ' <svg viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20 11A8 8 0 1 0 12 20" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M20 4V11H13" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>',
311
+ ' </button>',
312
+ ' <div class="vista-ov-pagination" data-vista-pagination hidden>',
313
+ ' <button type="button" class="vista-ov-page-btn" data-vista-prev aria-label="Previous error">‹</button>',
314
+ ' <span class="vista-ov-page-count" data-vista-count>1/1</span>',
315
+ ' <button type="button" class="vista-ov-page-btn" data-vista-next aria-label="Next error">›</button>',
316
+ ' </div>',
317
+ ' </div>',
318
+ ' </div>',
319
+ ' <div class="vista-ov-workbench">',
320
+ ' <aside class="vista-ov-activity" aria-hidden="true"><span class="vista-ov-activity-item"><svg viewBox="0 0 24 24" fill="none"><rect x="4" y="3" width="10" height="13" rx="1.2" stroke="currentColor" stroke-width="1.6"/><rect x="10" y="8" width="10" height="13" rx="1.2" stroke="currentColor" stroke-width="1.6"/></svg></span></aside>',
321
+ ' <div class="vista-ov-main" data-vista-ide-main>',
322
+ ' <div class="vista-ov-tabbar">',
323
+ ' <div class="vista-ov-tabs" data-vista-file-tabs><button type="button" class="vista-ov-tab" data-vista-file-tab="0"><svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><rect x="3" y="2" width="10" height="12" rx="1.5" stroke="#4fc1ff" stroke-width="1.4"/><path d="M6 6h4M6 9h4M6 12h2" stroke="#4fc1ff" stroke-width="1.2" stroke-linecap="round"/></svg><span data-vista-tab-name>untitled</span></button></div>',
324
+ ' </div>',
325
+ ' <div class="vista-ov-crumbs" data-vista-crumbs>Source</div>',
326
+ ' <div class="vista-ov-code" data-vista-files-wrap>',
327
+ ' <div class="vista-ov-editor-host" data-vista-message></div>',
328
+ ' </div>',
329
+ ' <div class="vista-ov-statusbar"><span data-vista-status-ln>Ready</span><span data-vista-status-lang>Plain Text</span><span class="vista-ov-source-badge" data-vista-source-badge>Build</span><span>UTF-8</span></div>',
330
+ ' <div class="vista-ov-panel-dock">',
331
+ ' <div class="vista-ov-panel-tabs"><span class="is-active">PROBLEMS</span><span>OUTPUT</span><button type="button" class="vista-ov-btn vista-ov-panel-toggle" data-vista-panel-expand aria-label="Expand problems panel" aria-pressed="false"><svg class="vista-ide-icon-expand" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3 6.5V3h3.5M13 6.5V3h-3.5M3 9.5V13h3.5M13 9.5V13h-3.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg><svg class="vista-ide-icon-restore" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M6.5 3v3.5H3M9.5 3v3.5H13M6.5 13V9.5H3M9.5 13V9.5H13" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg></button></div>',
332
+ ' <div class="vista-ov-body">',
333
+ ' <p class="vista-ov-kind" data-vista-ov-kind>Build Error</p>',
334
+ ' <h1 class="vista-ov-title" data-vista-ov-title>Build Error</h1>',
335
+ ' <p class="vista-ov-detail" data-vista-ov-detail hidden></p>',
336
+ ' <pre class="vista-ov-stack" data-vista-ov-stack hidden></pre>',
337
+ ' </div>',
338
+ ' </div>',
339
+ ' </div>',
340
+ ' </div>',
341
+ '</section>',
342
+ ].join('');
343
+ document.body.appendChild(root);
344
+ } else if (!root.isConnected && document.body) {
345
+ document.body.appendChild(root);
346
+ }
347
+
348
+ var backdrop = root.querySelector('.vista-ov-backdrop');
349
+ messageNode = root.querySelector('[data-vista-message]');
350
+ titleNode = root.querySelector('[data-vista-ov-title]');
351
+ detailNode = root.querySelector('[data-vista-ov-detail]');
352
+ stackNode = root.querySelector('[data-vista-ov-stack]');
353
+ filesWrapNode = root.querySelector('[data-vista-files-wrap]');
354
+ tabNameNodes = root.querySelectorAll('[data-vista-tab-name]');
355
+ crumbsNode = root.querySelector('[data-vista-crumbs]');
356
+ statusLnNode = root.querySelector('[data-vista-status-ln]');
357
+ statusLangNode = root.querySelector('[data-vista-status-lang]');
358
+ kindNode = root.querySelector('[data-vista-ov-kind]');
359
+ sourceBadgeNode = root.querySelector('[data-vista-source-badge]');
360
+ fileTabsNode = root.querySelector('[data-vista-file-tabs]');
361
+ copyButton = root.querySelector('[data-vista-copy]');
362
+ minimizeButton = root.querySelector('[data-vista-minimize]');
363
+ reloadButton = root.querySelector('[data-vista-reload]');
364
+ paginationNode = root.querySelector('[data-vista-pagination]');
365
+ prevButton = root.querySelector('[data-vista-prev]');
366
+ nextButton = root.querySelector('[data-vista-next]');
367
+ countNode = root.querySelector('[data-vista-count]');
368
+ mainNode = root.querySelector('[data-vista-ide-main]');
369
+ panelExpandButton = root.querySelector('[data-vista-panel-expand]');
370
+
371
+ if (listenersBound) return;
372
+ listenersBound = true;
373
+
374
+ if (fileTabsNode) {
375
+ fileTabsNode.addEventListener('click', function (event) {
376
+ var target = event.target && event.target.closest ? event.target.closest('[data-vista-file-tab]') : null;
377
+ if (!target) return;
378
+ state.fileTab = Number(target.getAttribute('data-vista-file-tab') || 0);
379
+ renderCurrent();
380
+ });
381
+ }
382
+ if (copyButton) {
383
+ copyButton.addEventListener('click', function () {
384
+ copyCurrentMessage();
385
+ });
386
+ }
387
+ if (minimizeButton) {
388
+ minimizeButton.addEventListener('click', function () {
389
+ minimize();
390
+ });
391
+ }
392
+ if (reloadButton) {
393
+ reloadButton.addEventListener('click', function () {
394
+ reloadPage();
395
+ });
396
+ }
397
+ if (prevButton) {
398
+ prevButton.addEventListener('click', function () {
399
+ moveActiveIndex(-1);
400
+ });
401
+ }
402
+ if (nextButton) {
403
+ nextButton.addEventListener('click', function () {
404
+ moveActiveIndex(1);
405
+ });
406
+ }
407
+ if (panelExpandButton && mainNode) {
408
+ panelExpandButton.addEventListener('click', function () {
409
+ if (mainNode.getAttribute('data-terminal') === 'true') return;
410
+ var expanded = mainNode.getAttribute('data-panel-expanded') === 'true';
411
+ if (expanded) {
412
+ mainNode.removeAttribute('data-panel-expanded');
413
+ panelExpandButton.setAttribute('aria-pressed', 'false');
414
+ panelExpandButton.setAttribute('aria-label', 'Expand problems panel');
415
+ } else {
416
+ mainNode.setAttribute('data-panel-expanded', 'true');
417
+ panelExpandButton.setAttribute('aria-pressed', 'true');
418
+ panelExpandButton.setAttribute('aria-label', 'Restore problems panel');
419
+ }
420
+ });
421
+ }
422
+ if (backdrop) {
423
+ backdrop.addEventListener('click', function () {
424
+ minimize();
425
+ });
426
+ }
427
+ if (root) {
428
+ root.addEventListener('keydown', function (event) {
429
+ if (event.key === 'ArrowLeft') {
430
+ moveActiveIndex(-1);
431
+ } else if (event.key === 'ArrowRight') {
432
+ moveActiveIndex(1);
433
+ } else if (event.key === 'Escape') {
434
+ if (mainNode && mainNode.getAttribute('data-panel-expanded') === 'true' && mainNode.getAttribute('data-terminal') !== 'true') {
435
+ mainNode.removeAttribute('data-panel-expanded');
436
+ if (panelExpandButton) {
437
+ panelExpandButton.setAttribute('aria-pressed', 'false');
438
+ panelExpandButton.setAttribute('aria-label', 'Expand problems panel');
439
+ }
440
+ return;
441
+ }
442
+ minimize();
443
+ }
444
+ });
445
+ }
446
+ }
447
+
448
+ function normalizeMessages(input) {
449
+ if (Array.isArray(input)) {
450
+ return input
451
+ .map(function (entry) {
452
+ return typeof entry === 'string' ? entry : String(entry || '');
453
+ })
454
+ .filter(function (entry) {
455
+ return entry.trim().length > 0;
456
+ });
457
+ }
458
+
459
+ if (input && typeof input === 'object' && Array.isArray(input.errors)) {
460
+ return normalizeMessages(input.errors);
461
+ }
462
+
463
+ var raw = typeof input === 'string' ? input : String(input || '');
464
+ if (raw.trim().length === 0) {
465
+ return [];
466
+ }
467
+
468
+ var splitByWebpack = raw.split(/\n(?=ERROR in\s)/g).filter(function (entry) {
469
+ return entry.trim().length > 0;
470
+ });
471
+ if (splitByWebpack.length > 1) {
472
+ return splitByWebpack;
473
+ }
474
+ return [raw];
475
+ }
476
+
477
+ function parseMessage(input) {
478
+ var raw = typeof input === 'string' ? input : String(input || 'Unknown build error.');
479
+ var lines = raw.split(/\r?\n/);
480
+ var trimmedLines = [];
481
+ for (var i = 0; i < lines.length; i += 1) {
482
+ var entry = lines[i] ? lines[i].trim() : '';
483
+ if (entry.length > 0) {
484
+ trimmedLines.push(entry);
485
+ }
486
+ }
487
+
488
+ var kind = 'build';
489
+ var headline = trimmedLines.length ? trimmedLines[0] : 'Build Error';
490
+ if (/hydration/i.test(headline) || /hydration|did not match|server rendered html/i.test(raw)) {
491
+ kind = 'hydration';
492
+ } else if (/server error|flight ssr|ssr failed/i.test(headline + ' ' + raw)) {
493
+ kind = 'server';
494
+ } else if (/runtime|unhandled promise/i.test(headline)) {
495
+ kind = 'runtime';
496
+ } else if (/TypeError|ReferenceError|SyntaxError|RangeError|EvalError|URIError|AggregateError/i.test(raw)) {
497
+ kind = 'runtime';
498
+ }
499
+
500
+ // Prefer the real exception line over a generic "Runtime Error" label.
501
+ var title = headline;
502
+ var exceptionLine = '';
503
+ for (var t = 0; t < trimmedLines.length; t += 1) {
504
+ if (/^(TypeError|ReferenceError|SyntaxError|RangeError|EvalError|URIError|AggregateError|Error)\b/.test(trimmedLines[t])) {
505
+ exceptionLine = trimmedLines[t];
506
+ break;
507
+ }
508
+ }
509
+ if (exceptionLine) {
510
+ title = exceptionLine;
511
+ } else if (kind === 'runtime' && trimmedLines.length > 1 && /^(runtime error|unhandled)/i.test(headline)) {
512
+ title = trimmedLines[1];
513
+ }
514
+ if (title.length > 180) {
515
+ title = title.slice(0, 177) + '...';
516
+ }
517
+
518
+ var files = [];
519
+ var filePattern = /(?:[A-Za-z]:)?[\\/\w.@+-]+\.(?:tsx?|jsx?|mjs|cjs|css|json|mdx?)(?::\d+(?::\d+)?)?/;
520
+ for (var fileIdx = 0; fileIdx < lines.length; fileIdx += 1) {
521
+ var maybeFile = lines[fileIdx].match(filePattern);
522
+ if (!maybeFile) continue;
523
+ var normalized = maybeFile[0].replace(/\\/g, '/').replace(/^\.\//, '');
524
+ if (files.indexOf(normalized) === -1) {
525
+ files.push(normalized);
526
+ }
527
+ if (files.length >= 8) break;
528
+ }
529
+
530
+ var stackStart = -1;
531
+ for (var s = 0; s < lines.length; s += 1) {
532
+ if (/^\s*at\s+/.test(lines[s]) || /^(TypeError|ReferenceError|SyntaxError|RangeError|Error)\b/.test(lines[s].trim())) {
533
+ stackStart = s;
534
+ break;
535
+ }
536
+ }
537
+ var stackText = '';
538
+ if (stackStart !== -1) {
539
+ stackText = lines.slice(stackStart).join('\n').replace(/^\n+/, '').trim();
540
+ } else if (kind === 'runtime' || kind === 'server') {
541
+ var bodyLines = trimmedLines.slice(/^(runtime error|unhandled|server error)/i.test(headline) ? 1 : 0);
542
+ stackText = bodyLines.join('\n');
543
+ }
544
+
545
+ var hints = [];
546
+ if (/['"]use client['"]/.test(raw)) {
547
+ hints.push("Client hook detected in a Server Component. Add 'use client' to the top of that file.");
548
+ }
549
+ if (/Cannot find module/i.test(raw) || /Module not found/i.test(raw)) {
550
+ hints.push('A module import failed to resolve. Check the import path or install the missing package.');
551
+ }
552
+ if (/Unexpected token/i.test(raw) || /SyntaxError/i.test(raw)) {
553
+ hints.push('A syntax issue is blocking compilation. Start from the first highlighted file and fix parsing errors.');
554
+ }
555
+ if (/Type error/i.test(raw) || /TS\d{3,5}/i.test(raw)) {
556
+ hints.push('TypeScript validation failed. Fix the first type error first to reduce cascading issues.');
557
+ }
558
+ if (/Structure Validation Failed/i.test(raw)) {
559
+ hints.push('App structure rules failed. Verify route files, layout/page naming, and required conventions.');
560
+ }
561
+ if (/reading ['"]map['"]/i.test(raw)) {
562
+ hints.push('Something expected an array was undefined. Check the prop or data passed into .map().');
563
+ }
564
+ if (hints.length === 0 && files.length > 0 && kind === 'build') {
565
+ hints.push('Start with the first file above, then re-run after each fix.');
566
+ }
567
+
568
+ return {
569
+ raw: raw,
570
+ title: title,
571
+ files: files,
572
+ hints: hints,
573
+ stack: stackText,
574
+ kind: kind,
575
+ timestamp: new Date(),
576
+ };
577
+ }
578
+
579
+ function fillList(node, values, wrapNode) {
580
+ if (!node) return;
581
+ while (node.firstChild) node.removeChild(node.firstChild);
582
+ if (!values || values.length === 0) {
583
+ if (wrapNode) wrapNode.hidden = false;
584
+ return;
585
+ }
586
+ for (var i = 0; i < values.length; i += 1) {
587
+ var item = document.createElement('li');
588
+ item.textContent = values[i];
589
+ node.appendChild(item);
590
+ }
591
+ if (wrapNode) wrapNode.hidden = false;
592
+ }
593
+
594
+ function currentEntry() {
595
+ if (!state.entries || state.entries.length === 0) return null;
596
+ var index = state.activeIndex;
597
+ if (index < 0) index = 0;
598
+ if (index > state.entries.length - 1) index = state.entries.length - 1;
599
+ return state.entries[index];
600
+ }
601
+
602
+ function updatePagination() {
603
+ var total = state.entries.length;
604
+ var current = total === 0 ? 0 : state.activeIndex + 1;
605
+ if (countNode) {
606
+ countNode.textContent = current + '/' + (total || 1);
607
+ }
608
+ if (paginationNode) {
609
+ paginationNode.hidden = total <= 1;
610
+ }
611
+ if (prevButton) {
612
+ prevButton.disabled = state.activeIndex <= 0;
613
+ }
614
+ if (nextButton) {
615
+ nextButton.disabled = state.activeIndex >= total - 1;
616
+ }
617
+ }
618
+
619
+ function entryHasCode(parsed) {
620
+ if (!parsed) return false;
621
+ if (parsed.kind === 'server' || parsed.kind === 'hydration') return false;
622
+ return /(\s*>)?\s*\d+\s+\|/.test(String(parsed.raw || ''));
623
+ }
624
+
625
+ function renderCurrent() {
626
+ var parsed = currentEntry();
627
+ if (!parsed || !root) return;
628
+ var files = parsed.files && parsed.files.length ? parsed.files : [''];
629
+ if (state.fileTab > files.length - 1) state.fileTab = 0;
630
+ var file = files[state.fileTab] || files[0] || '';
631
+ var loc = parseFileLocation(file);
632
+ var tabName = fileBasename(file);
633
+ var kind = parsed.kind || 'build';
634
+ var kindLabel = kind === 'hydration' ? 'Hydration Error' : kind === 'server' ? 'Server Error' : kind === 'runtime' ? 'Unhandled Runtime Error' : 'Build Error';
635
+ var badge = kind === 'hydration' ? 'Hydration' : kind === 'server' ? 'Server' : kind === 'runtime' ? 'Client' : 'Build';
636
+ var terminal = !entryHasCode(parsed);
637
+ var titleName = terminal ? kindLabel : tabName;
638
+ if (kindNode) {
639
+ kindNode.textContent = kindLabel;
640
+ kindNode.className = 'vista-ov-kind' + (kind === 'hydration' || kind === 'server' ? ' is-' + kind : '');
641
+ }
642
+ if (titleNode) titleNode.textContent = parsed.title || 'Build Error';
643
+ if (detailNode) {
644
+ var hintText = (parsed.hints || []).join(' ');
645
+ if (kind === 'hydration' && hintText.indexOf('HTML') === -1) {
646
+ hintText = 'Server HTML did not match the client. ' + hintText;
647
+ }
648
+ detailNode.textContent = hintText;
649
+ detailNode.hidden = hintText.length === 0;
650
+ }
651
+ if (stackNode) {
652
+ var stackBody = String(parsed.stack || '').trim();
653
+ if (!stackBody && terminal) {
654
+ stackBody = String(parsed.raw || '').trim();
655
+ }
656
+ if (stackBody) {
657
+ var stackHtml = escapeHtml(stackBody).replace(
658
+ /((?:[A-Za-z]:)?[\\/\w.@+-]+\.(?:tsx?|jsx?|mjs|cjs)(?::\d+(?::\d+)?)?)/g,
659
+ '<span class="vista-ov-stack-file">$1</span>'
660
+ );
661
+ stackNode.innerHTML = stackHtml;
662
+ stackNode.hidden = false;
663
+ } else {
664
+ stackNode.textContent = '';
665
+ stackNode.hidden = true;
666
+ }
667
+ }
668
+ if (fileTabsNode) {
669
+ var tabs = '';
670
+ for (var i = 0; i < files.length; i += 1) {
671
+ var name = fileBasename(files[i] || 'untitled');
672
+ tabs += '<button type="button" class="vista-ov-tab' + (i === state.fileTab ? '' : ' is-inactive') + '" data-vista-file-tab="' + i + '">';
673
+ tabs += '<svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><rect x="3" y="2" width="10" height="12" rx="1.5" stroke="#4fc1ff" stroke-width="1.4"/><path d="M6 6h4M6 9h4M6 12h2" stroke="#4fc1ff" stroke-width="1.2" stroke-linecap="round"/></svg>';
674
+ tabs += '<span>' + escapeHtml(name) + '</span></button>';
675
+ }
676
+ fileTabsNode.innerHTML = tabs;
677
+ }
678
+ if (tabNameNodes) {
679
+ for (var t = 0; t < tabNameNodes.length; t += 1) {
680
+ if (tabNameNodes[t].closest && tabNameNodes[t].closest('[data-vista-file-tabs]')) continue;
681
+ tabNameNodes[t].textContent = titleName;
682
+ }
683
+ }
684
+ if (crumbsNode) crumbsNode.textContent = fileBreadcrumb(file);
685
+ if (statusLnNode) statusLnNode.textContent = loc.line ? ('Ln ' + loc.line + ', Col ' + loc.column) : 'Ready';
686
+ if (statusLangNode) statusLangNode.textContent = languageFromFile(file);
687
+ if (sourceBadgeNode) {
688
+ sourceBadgeNode.textContent = badge;
689
+ sourceBadgeNode.className = 'vista-ov-source-badge' + (kind === 'build' ? '' : ' is-' + (kind === 'runtime' ? 'client' : kind));
690
+ }
691
+ if (messageNode) messageNode.innerHTML = renderIdeCode(parsed.raw, loc.line, loc.column);
692
+ if (filesWrapNode) filesWrapNode.hidden = false;
693
+ if (mainNode) {
694
+ if (terminal) {
695
+ mainNode.setAttribute('data-terminal', 'true');
696
+ mainNode.removeAttribute('data-panel-expanded');
697
+ } else {
698
+ mainNode.removeAttribute('data-terminal');
699
+ }
700
+ }
701
+ if (panelExpandButton) {
702
+ panelExpandButton.hidden = terminal;
703
+ if (terminal) {
704
+ panelExpandButton.setAttribute('aria-pressed', 'false');
705
+ panelExpandButton.setAttribute('aria-label', 'Expand problems panel');
706
+ }
707
+ }
708
+ updatePagination();
709
+ }
710
+
711
+ function moveActiveIndex(offset) {
712
+ if (!state.entries || state.entries.length <= 1) return;
713
+ var next = state.activeIndex + offset;
714
+ if (next < 0 || next >= state.entries.length) return;
715
+ state.activeIndex = next;
716
+ state.fileTab = 0;
717
+ renderCurrent();
718
+ }
719
+
720
+ function copyCurrentMessage() {
721
+ var entry = currentEntry();
722
+ if (!entry) return;
723
+ var text = entry.raw;
724
+ if (navigator && navigator.clipboard && navigator.clipboard.writeText) {
725
+ navigator.clipboard.writeText(text).catch(function () {});
726
+ return;
727
+ }
728
+ var textarea = document.createElement('textarea');
729
+ textarea.value = text;
730
+ textarea.style.position = 'fixed';
731
+ textarea.style.opacity = '0';
732
+ textarea.style.pointerEvents = 'none';
733
+ document.body.appendChild(textarea);
734
+ textarea.focus();
735
+ textarea.select();
736
+ try {
737
+ document.execCommand('copy');
738
+ } catch (e) {}
739
+ document.body.removeChild(textarea);
740
+ }
741
+
742
+ function reloadPage() {
743
+ if (typeof window === 'undefined') return;
744
+ window.location.reload();
745
+ }
746
+
747
+ function openFromState() {
748
+ ensureMounted();
749
+ if (!state.entries || state.entries.length === 0) return false;
750
+ state.open = true;
751
+ state.minimized = false;
752
+ renderCurrent();
753
+ if (root) root.hidden = false;
754
+ var indicator = getIndicator();
755
+ if (indicator && typeof indicator.clearError === 'function') {
756
+ indicator.clearError();
757
+ }
758
+ return true;
759
+ }
760
+
761
+ function show(input) {
762
+ ensureMounted();
763
+ var messages = normalizeMessages(input);
764
+ if (messages.length === 0) {
765
+ return;
766
+ }
767
+ state.entries = messages.map(function (message) {
768
+ return parseMessage(message);
769
+ });
770
+ state.activeIndex = 0;
771
+ openFromState();
772
+ }
773
+
774
+ function capture(input) {
775
+ ensureMounted();
776
+ var messages = normalizeMessages(input);
777
+ if (messages.length === 0) {
778
+ return;
779
+ }
780
+ state.entries = messages.map(function (message) {
781
+ return parseMessage(message);
782
+ });
783
+ state.activeIndex = 0;
784
+ state.open = false;
785
+ state.minimized = true;
786
+ if (root) root.hidden = true;
787
+ var entry = currentEntry();
788
+ var indicator = getIndicator();
789
+ if (indicator && typeof indicator.setError === 'function') {
790
+ indicator.setError(entry ? entry.title || 'Build error' : 'Build error', state.entries.length);
791
+ }
792
+ }
793
+
794
+ function minimize() {
795
+ var entry = currentEntry();
796
+ if (!entry) return false;
797
+ ensureMounted();
798
+ state.open = false;
799
+ state.minimized = true;
800
+ if (root) root.hidden = true;
801
+ var indicator = getIndicator();
802
+ if (indicator && typeof indicator.setError === 'function') {
803
+ indicator.setError(entry.title || 'Build error', state.entries.length);
804
+ }
805
+ return true;
806
+ }
807
+
808
+ function clear() {
809
+ state.open = false;
810
+ state.minimized = false;
811
+ state.entries = [];
812
+ state.activeIndex = 0;
813
+ if (root) root.hidden = true;
814
+ var indicator = getIndicator();
815
+ if (indicator && typeof indicator.clearError === 'function') {
816
+ indicator.clearError();
817
+ }
818
+ }
819
+
820
+ function restoreFromIndicator() {
821
+ if (!state.minimized || !state.entries || state.entries.length === 0) return false;
822
+ return openFromState();
823
+ }
824
+
825
+ window.__VISTA_DEV_ERROR_OVERLAY__ = {
826
+ show: show,
827
+ capture: capture,
828
+ minimize: minimize,
829
+ clear: clear,
830
+ restoreFromIndicator: restoreFromIndicator,
831
+ isOpen: function () {
832
+ return state.open;
833
+ },
834
+ hasError: function () {
835
+ return state.entries && state.entries.length > 0;
836
+ },
837
+ };
838
+ })();
839
+ `;
840
+ }