@tangle-network/agent-app 0.58.15 → 0.58.16

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 (77) hide show
  1. package/dist/VaultPane-RIJM452Y.js +7 -0
  2. package/dist/assistant/index.js +13 -11
  3. package/dist/assistant/index.js.map +1 -1
  4. package/dist/chat-react/index.js +4 -4
  5. package/dist/chat-routes/index.js +4 -4
  6. package/dist/chat-store/index.js +2 -2
  7. package/dist/chunk-B7CL7ENS.js +118 -0
  8. package/dist/chunk-B7CL7ENS.js.map +1 -0
  9. package/dist/{chunk-POE5UUUT.js → chunk-BDCATWBV.js} +3 -3
  10. package/dist/{chunk-NWR5CERQ.js → chunk-FNRUXPXE.js} +2 -2
  11. package/dist/{chunk-57TTYY6T.js → chunk-GEGCSRYQ.js} +2 -2
  12. package/dist/{chunk-WTGSLW5X.js → chunk-HTAFI247.js} +4 -4
  13. package/dist/{chunk-MLG7YSTS.js → chunk-KSLVMA2D.js} +3 -3
  14. package/dist/{chunk-T5U7LDQW.js → chunk-OFQUM5FP.js} +52 -15
  15. package/dist/chunk-OFQUM5FP.js.map +1 -0
  16. package/dist/chunk-PV33JZKV.js +115 -0
  17. package/dist/chunk-PV33JZKV.js.map +1 -0
  18. package/dist/{chunk-TUNRLEDH.js → chunk-Q3BLSWYP.js} +2 -2
  19. package/dist/{chunk-GIBNG64C.js → chunk-S5MKEU2E.js} +2607 -1438
  20. package/dist/chunk-S5MKEU2E.js.map +1 -0
  21. package/dist/{chunk-EN5CP7T7.js → chunk-T5PPQPOD.js} +5 -111
  22. package/dist/chunk-T5PPQPOD.js.map +1 -0
  23. package/dist/{chunk-DWUBICLW.js → chunk-UGPV7VEW.js} +569 -236
  24. package/dist/chunk-UGPV7VEW.js.map +1 -0
  25. package/dist/{chunk-EXBAVMMK.js → chunk-XOBVWCOA.js} +347 -311
  26. package/dist/chunk-XOBVWCOA.js.map +1 -0
  27. package/dist/{mention-editor-W2GG2NZ7.js → mention-editor-4D32JTDS.js} +2 -2
  28. package/dist/preset-cloudflare/index.js +3 -3
  29. package/dist/profile/index.js +4 -2
  30. package/dist/profile/index.js.map +1 -1
  31. package/dist/profile-editor/index.d.ts +185 -0
  32. package/dist/profile-editor/index.js +18 -0
  33. package/dist/profile-editor/index.js.map +1 -0
  34. package/dist/profile-editor/server.d.ts +112 -0
  35. package/dist/profile-editor/server.js +635 -0
  36. package/dist/profile-editor/server.js.map +1 -0
  37. package/dist/public-consultation/index.js +4 -4
  38. package/dist/skills/frontmatter.d.ts +43 -0
  39. package/dist/skills/index.d.ts +1 -38
  40. package/dist/skills/index.js +4 -2
  41. package/dist/skills-placement/index.js +2 -1
  42. package/dist/skills-placement/index.js.map +1 -1
  43. package/dist/stories/fixtures/profile-editor.d.ts +17 -0
  44. package/dist/studio-react/index.js +3 -3
  45. package/dist/teams/invitations-api.js +3 -3
  46. package/dist/vault/VaultPane.d.ts +4 -4
  47. package/dist/vault/VaultTree.d.ts +39 -0
  48. package/dist/vault/contracts.d.ts +17 -7
  49. package/dist/vault/index.d.ts +5 -4
  50. package/dist/vault/index.js +7 -3
  51. package/dist/vault/lazy.js +1 -1
  52. package/dist/web-react/agent-profile-editor.d.ts +63 -1
  53. package/dist/web-react/agent-profile-files.d.ts +38 -0
  54. package/dist/web-react/agent-profile-form-kit.d.ts +87 -0
  55. package/dist/web-react/agent-profile-github-source.d.ts +35 -0
  56. package/dist/web-react/agent-profile-mcp-servers.d.ts +20 -0
  57. package/dist/web-react/agent-profile-suggest-input.d.ts +31 -0
  58. package/dist/web-react/agent-session-controls.d.ts +51 -0
  59. package/dist/web-react/controls.d.ts +29 -3
  60. package/dist/web-react/index.d.ts +3 -2
  61. package/dist/web-react/index.js +23 -15
  62. package/dist/workspace-react/index.js +4 -4
  63. package/package.json +11 -1
  64. package/dist/VaultPane-SPXE7XAC.js +0 -7
  65. package/dist/chunk-DWUBICLW.js.map +0 -1
  66. package/dist/chunk-EN5CP7T7.js.map +0 -1
  67. package/dist/chunk-EXBAVMMK.js.map +0 -1
  68. package/dist/chunk-GIBNG64C.js.map +0 -1
  69. package/dist/chunk-T5U7LDQW.js.map +0 -1
  70. /package/dist/{VaultPane-SPXE7XAC.js.map → VaultPane-RIJM452Y.js.map} +0 -0
  71. /package/dist/{chunk-POE5UUUT.js.map → chunk-BDCATWBV.js.map} +0 -0
  72. /package/dist/{chunk-NWR5CERQ.js.map → chunk-FNRUXPXE.js.map} +0 -0
  73. /package/dist/{chunk-57TTYY6T.js.map → chunk-GEGCSRYQ.js.map} +0 -0
  74. /package/dist/{chunk-WTGSLW5X.js.map → chunk-HTAFI247.js.map} +0 -0
  75. /package/dist/{chunk-MLG7YSTS.js.map → chunk-KSLVMA2D.js.map} +0 -0
  76. /package/dist/{chunk-TUNRLEDH.js.map → chunk-Q3BLSWYP.js.map} +0 -0
  77. /package/dist/{mention-editor-W2GG2NZ7.js.map → mention-editor-4D32JTDS.js.map} +0 -0
@@ -2,15 +2,16 @@
2
2
  import {
3
3
  Component,
4
4
  forwardRef,
5
- useCallback,
6
- useEffect as useEffect2,
5
+ useCallback as useCallback2,
6
+ useEffect as useEffect3,
7
7
  useImperativeHandle,
8
8
  useLayoutEffect,
9
- useMemo,
10
- useRef as useRef2,
11
- useState
9
+ useId,
10
+ useMemo as useMemo2,
11
+ useRef as useRef3,
12
+ useState as useState2
12
13
  } from "react";
13
- import { Download, Folder, Plus, RefreshCw, Trash2 } from "lucide-react";
14
+ import { Download, Folder as Folder2, Plus, RefreshCw, Trash2 } from "lucide-react";
14
15
 
15
16
  // src/vault/ConfirmDialog.tsx
16
17
  import { useEffect, useRef } from "react";
@@ -111,9 +112,334 @@ function ConfirmDialog({
111
112
  );
112
113
  }
113
114
 
115
+ // src/vault/VaultTree.tsx
116
+ import { useCallback, useEffect as useEffect2, useMemo, useRef as useRef2, useState } from "react";
117
+ import {
118
+ ChevronRight,
119
+ File,
120
+ FileCode,
121
+ FileImage,
122
+ FileJson,
123
+ FileSpreadsheet,
124
+ FileText,
125
+ Folder,
126
+ FolderOpen
127
+ } from "lucide-react";
128
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
129
+ var VAULT_TREE_CHILD_PAGE = 200;
130
+ var STORAGE_PREFIX = "tangle:vault-tree:";
131
+ var STORED_PATH_LIMIT = 1e3;
132
+ function storageFor(key) {
133
+ if (!key || typeof window === "undefined") return null;
134
+ try {
135
+ return window.localStorage;
136
+ } catch {
137
+ return null;
138
+ }
139
+ }
140
+ function readExpanded(key) {
141
+ const storage = storageFor(key);
142
+ if (!storage) return /* @__PURE__ */ new Set();
143
+ try {
144
+ const raw = storage.getItem(STORAGE_PREFIX + key);
145
+ const parsed = raw ? JSON.parse(raw) : [];
146
+ return new Set(Array.isArray(parsed) ? parsed.filter((item) => typeof item === "string") : []);
147
+ } catch {
148
+ return /* @__PURE__ */ new Set();
149
+ }
150
+ }
151
+ function writeExpanded(key, expanded) {
152
+ const storage = storageFor(key);
153
+ if (!storage) return;
154
+ try {
155
+ const paths = [...expanded].slice(-STORED_PATH_LIMIT);
156
+ if (paths.length === 0) storage.removeItem(STORAGE_PREFIX + key);
157
+ else storage.setItem(STORAGE_PREFIX + key, JSON.stringify(paths));
158
+ } catch {
159
+ }
160
+ }
161
+ var collator = new Intl.Collator(void 0, { numeric: true, sensitivity: "base" });
162
+ function sortChildren(children) {
163
+ if (!children?.length) return [];
164
+ return [...children].sort((a, b) => {
165
+ if (a.type !== b.type) return a.type === "directory" ? -1 : 1;
166
+ return collator.compare(a.name, b.name);
167
+ });
168
+ }
169
+ var FILE_ICONS = {
170
+ md: FileText,
171
+ mdx: FileText,
172
+ txt: FileText,
173
+ pdf: FileText,
174
+ doc: FileText,
175
+ docx: FileText,
176
+ csv: FileSpreadsheet,
177
+ tsv: FileSpreadsheet,
178
+ xls: FileSpreadsheet,
179
+ xlsx: FileSpreadsheet,
180
+ json: FileJson,
181
+ png: FileImage,
182
+ jpg: FileImage,
183
+ jpeg: FileImage,
184
+ gif: FileImage,
185
+ webp: FileImage,
186
+ svg: FileImage,
187
+ ts: FileCode,
188
+ tsx: FileCode,
189
+ js: FileCode,
190
+ jsx: FileCode,
191
+ py: FileCode,
192
+ html: FileCode,
193
+ css: FileCode,
194
+ yaml: FileCode,
195
+ yml: FileCode
196
+ };
197
+ function fileIcon(name) {
198
+ const dot = name.lastIndexOf(".");
199
+ return dot > 0 && FILE_ICONS[name.slice(dot + 1).toLowerCase()] || File;
200
+ }
201
+ function VaultTree({
202
+ root,
203
+ selectedPath,
204
+ activeFolder,
205
+ onSelect,
206
+ onFolderToggle,
207
+ storageKey,
208
+ expandAll = false,
209
+ label = "Files",
210
+ className
211
+ }) {
212
+ const [expansion, setExpansion] = useState(() => ({ key: storageKey, expanded: readExpanded(storageKey) }));
213
+ let keyed = expansion;
214
+ if (expansion.key !== storageKey) {
215
+ keyed = { key: storageKey, expanded: readExpanded(storageKey) };
216
+ setExpansion(keyed);
217
+ }
218
+ const expandedPaths = keyed.expanded;
219
+ const [pageLimits, setPageLimits] = useState(() => /* @__PURE__ */ new Map());
220
+ const [focusedPath, setFocusedPath] = useState(null);
221
+ const rowRefs = useRef2(/* @__PURE__ */ new Map());
222
+ const pendingFocusRef = useRef2(null);
223
+ const pendingRevealRef = useRef2(null);
224
+ const index = useMemo(() => {
225
+ const nodes = /* @__PURE__ */ new Map();
226
+ const parents = /* @__PURE__ */ new Map();
227
+ const children = /* @__PURE__ */ new Map();
228
+ const visit = (node, parent) => {
229
+ nodes.set(node.path, node);
230
+ parents.set(node.path, parent);
231
+ if (node.type === "directory") {
232
+ const sorted = sortChildren(node.children);
233
+ children.set(node.path, sorted);
234
+ for (const child of sorted) visit(child, node.path);
235
+ }
236
+ };
237
+ const top = sortChildren(root.children);
238
+ children.set(null, top);
239
+ for (const node of top) visit(node, null);
240
+ return { nodes, parents, children };
241
+ }, [root]);
242
+ const isOpen = useCallback(
243
+ (path) => expandAll || expandedPaths.has(path),
244
+ [expandAll, expandedPaths]
245
+ );
246
+ const rows = useMemo(() => {
247
+ const out = [];
248
+ const walk = (parent, depth) => {
249
+ const kids = index.children.get(parent) ?? [];
250
+ const limit = parent === null ? kids.length : Math.max(VAULT_TREE_CHILD_PAGE, pageLimits.get(parent) ?? 0);
251
+ const shown = Math.min(kids.length, limit);
252
+ kids.slice(0, shown).forEach((node, i) => {
253
+ out.push({ kind: "node", node, depth, parent, posInSet: i + 1, setSize: kids.length });
254
+ if (node.type === "directory" && isOpen(node.path)) walk(node.path, depth + 1);
255
+ });
256
+ if (parent !== null && shown < kids.length) {
257
+ out.push({ kind: "more", parent, depth, hidden: kids.length - shown });
258
+ }
259
+ };
260
+ walk(null, 0);
261
+ return out;
262
+ }, [index, isOpen, pageLimits]);
263
+ const nodeRows = useMemo(
264
+ () => rows.filter((row) => row.kind === "node"),
265
+ [rows]
266
+ );
267
+ const updateExpanded = useCallback((change) => {
268
+ setExpansion((current) => {
269
+ const base = current.key === storageKey ? current.expanded : readExpanded(storageKey);
270
+ const next = new Set(base);
271
+ change(next);
272
+ writeExpanded(storageKey, next);
273
+ return { key: storageKey, expanded: next };
274
+ });
275
+ }, [storageKey]);
276
+ const setFolderOpen = useCallback((path, open) => {
277
+ if (expandAll || expandedPaths.has(path) === open) return;
278
+ updateExpanded((next) => {
279
+ if (open) next.add(path);
280
+ else next.delete(path);
281
+ });
282
+ onFolderToggle?.(path, open);
283
+ }, [expandAll, expandedPaths, updateExpanded, onFolderToggle]);
284
+ useEffect2(() => {
285
+ if (!selectedPath || !index.nodes.has(selectedPath)) return;
286
+ const ancestors = [];
287
+ for (let parent = index.parents.get(selectedPath) ?? null; parent; parent = index.parents.get(parent) ?? null) {
288
+ ancestors.push(parent);
289
+ }
290
+ pendingRevealRef.current = selectedPath;
291
+ if (ancestors.some((path) => !expandedPaths.has(path))) {
292
+ updateExpanded((next) => {
293
+ for (const path of ancestors) next.add(path);
294
+ });
295
+ }
296
+ }, [selectedPath, index]);
297
+ useEffect2(() => {
298
+ const reveal = pendingRevealRef.current;
299
+ if (reveal && rowRefs.current.has(reveal)) {
300
+ pendingRevealRef.current = null;
301
+ rowRefs.current.get(reveal)?.scrollIntoView?.({ block: "nearest" });
302
+ }
303
+ const focus = pendingFocusRef.current;
304
+ if (focus && rowRefs.current.has(focus)) {
305
+ pendingFocusRef.current = null;
306
+ rowRefs.current.get(focus)?.focus();
307
+ }
308
+ }, [rows]);
309
+ const visiblePaths = useMemo(() => new Set(nodeRows.map((row) => row.node.path)), [nodeRows]);
310
+ const tabStop = focusedPath && visiblePaths.has(focusedPath) && focusedPath || selectedPath && visiblePaths.has(selectedPath) && selectedPath || nodeRows[0]?.node.path || null;
311
+ const focusRow = useCallback((path) => {
312
+ if (!path) return;
313
+ setFocusedPath(path);
314
+ const element = rowRefs.current.get(path);
315
+ if (element) element.focus();
316
+ else pendingFocusRef.current = path;
317
+ }, []);
318
+ const activate = useCallback((node) => {
319
+ setFocusedPath(node.path);
320
+ if (node.type === "directory") setFolderOpen(node.path, !isOpen(node.path));
321
+ else onSelect(node.path);
322
+ }, [isOpen, onSelect, setFolderOpen]);
323
+ const onKeyDown = useCallback((event, node) => {
324
+ const at = nodeRows.findIndex((row) => row.node.path === node.path);
325
+ if (at < 0) return;
326
+ const dir = node.type === "directory";
327
+ const open = dir && isOpen(node.path);
328
+ let handled = true;
329
+ switch (event.key) {
330
+ case "ArrowDown":
331
+ focusRow(nodeRows[at + 1]?.node.path);
332
+ break;
333
+ case "ArrowUp":
334
+ focusRow(nodeRows[at - 1]?.node.path);
335
+ break;
336
+ case "Home":
337
+ focusRow(nodeRows[0]?.node.path);
338
+ break;
339
+ case "End":
340
+ focusRow(nodeRows[nodeRows.length - 1]?.node.path);
341
+ break;
342
+ case "ArrowRight":
343
+ if (dir && !open) setFolderOpen(node.path, true);
344
+ else if (open) {
345
+ const child = nodeRows[at + 1];
346
+ if (child?.parent === node.path) focusRow(child.node.path);
347
+ }
348
+ break;
349
+ case "ArrowLeft":
350
+ if (open && !expandAll) setFolderOpen(node.path, false);
351
+ else focusRow(index.parents.get(node.path));
352
+ break;
353
+ case "Enter":
354
+ case " ":
355
+ activate(node);
356
+ break;
357
+ default:
358
+ handled = false;
359
+ }
360
+ if (handled) {
361
+ event.preventDefault();
362
+ event.stopPropagation();
363
+ }
364
+ }, [nodeRows, isOpen, focusRow, setFolderOpen, expandAll, index, activate]);
365
+ return /* @__PURE__ */ jsx2("div", { role: "tree", "aria-label": label, "data-vault-tree-rows": true, className: `flex flex-col gap-px ${className ?? ""}`, children: rows.map((row) => {
366
+ if (row.kind === "more") {
367
+ return /* @__PURE__ */ jsxs2(
368
+ "button",
369
+ {
370
+ type: "button",
371
+ onClick: () => setPageLimits((current) => {
372
+ const next = new Map(current);
373
+ next.set(row.parent, Math.max(VAULT_TREE_CHILD_PAGE, current.get(row.parent) ?? 0) + VAULT_TREE_CHILD_PAGE);
374
+ return next;
375
+ }),
376
+ style: { paddingInlineStart: `calc(${row.depth} * 1rem + 2.25rem)` },
377
+ className: "flex min-h-8 w-full items-center rounded-md pr-2 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
378
+ children: [
379
+ "Show ",
380
+ Math.min(row.hidden, VAULT_TREE_CHILD_PAGE),
381
+ " more of ",
382
+ row.hidden
383
+ ]
384
+ },
385
+ `more:${row.parent}`
386
+ );
387
+ }
388
+ const { node, depth } = row;
389
+ const dir = node.type === "directory";
390
+ const open = dir && isOpen(node.path);
391
+ const selected = !dir && node.path === selectedPath;
392
+ const active = dir && node.path === activeFolder;
393
+ const Icon = dir ? open ? FolderOpen : Folder : fileIcon(node.name);
394
+ return /* @__PURE__ */ jsxs2(
395
+ "div",
396
+ {
397
+ ref: (element) => {
398
+ if (element) rowRefs.current.set(node.path, element);
399
+ else rowRefs.current.delete(node.path);
400
+ },
401
+ role: "treeitem",
402
+ "aria-level": depth + 1,
403
+ "aria-posinset": row.posInSet,
404
+ "aria-setsize": row.setSize,
405
+ "aria-expanded": dir ? open : void 0,
406
+ "aria-selected": dir ? void 0 : selected,
407
+ "aria-current": active ? "true" : void 0,
408
+ tabIndex: node.path === tabStop ? 0 : -1,
409
+ title: node.path,
410
+ "data-vault-tree-item": node.type,
411
+ "data-path": node.path,
412
+ "data-selected": selected ? "true" : void 0,
413
+ onClick: () => activate(node),
414
+ onFocus: () => setFocusedPath(node.path),
415
+ onKeyDown: (event) => onKeyDown(event, node),
416
+ style: { paddingInlineStart: `calc(${depth} * 1rem + 0.25rem)` },
417
+ className: [
418
+ "group flex min-h-8 w-full cursor-pointer select-none items-center gap-1.5 rounded-md pr-2 text-sm transition-colors [@media(pointer:coarse)]:min-h-10",
419
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
420
+ selected ? "bg-[var(--accent-surface-soft)] font-medium text-[var(--accent-text)]" : active ? "bg-muted font-medium text-foreground" : "text-foreground hover:bg-muted"
421
+ ].join(" "),
422
+ children: [
423
+ /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: "flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: dir && /* @__PURE__ */ jsx2(ChevronRight, { className: `size-3.5 transition-transform duration-fast ${open ? "rotate-90" : ""}` }) }),
424
+ /* @__PURE__ */ jsx2(
425
+ Icon,
426
+ {
427
+ "aria-hidden": "true",
428
+ className: `size-4 shrink-0 ${selected ? "text-[var(--accent-text)]" : "text-muted-foreground"}`
429
+ }
430
+ ),
431
+ /* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate", children: node.name })
432
+ ]
433
+ },
434
+ node.path
435
+ );
436
+ }) });
437
+ }
438
+
114
439
  // src/vault/VaultPane.tsx
115
- import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
440
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
116
441
  var DOCK_SIDE_MIN_PX = 960;
442
+ var TREE_ICON_BUTTON = "inline-flex size-8 shrink-0 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [@media(pointer:coarse)]:size-10";
117
443
  var IDENTITY_CODEC = {
118
444
  parse: (raw) => raw,
119
445
  serialize: (parts) => typeof parts === "string" ? parts : String(parts ?? "")
@@ -155,20 +481,6 @@ function findDirectory(nodes, path) {
155
481
  }
156
482
  return null;
157
483
  }
158
- function treeClickTarget(event) {
159
- const read = (el) => {
160
- const path2 = el.dataset.itemPath;
161
- return path2 ? { path: path2, type: el.dataset.itemType ?? "" } : null;
162
- };
163
- const path = event.nativeEvent.composedPath?.() ?? [];
164
- for (const item of path) {
165
- if (!(item instanceof HTMLElement)) continue;
166
- if (item.dataset.type !== "item") continue;
167
- return read(item);
168
- }
169
- const target = event.target instanceof HTMLElement ? event.target.closest('[data-type="item"]') : null;
170
- return target instanceof HTMLElement ? read(target) : null;
171
- }
172
484
  function filterNodes(nodes, q) {
173
485
  const out = [];
174
486
  for (const node of nodes) {
@@ -194,13 +506,13 @@ var EditorErrorBoundary = class extends Component {
194
506
  render() {
195
507
  if (this.state.error) {
196
508
  const msg = this.state.error instanceof Error ? this.state.error.message : typeof this.state.error === "string" ? this.state.error : `${this.props.label} did not load. Reload the page to try again.`;
197
- return /* @__PURE__ */ jsxs2("div", { className: "flex h-full flex-1 flex-col items-center justify-center p-8 text-center", children: [
198
- /* @__PURE__ */ jsxs2("h3", { className: "mb-1 text-sm font-medium text-foreground", children: [
509
+ return /* @__PURE__ */ jsxs3("div", { className: "flex h-full flex-1 flex-col items-center justify-center p-8 text-center", children: [
510
+ /* @__PURE__ */ jsxs3("h3", { className: "mb-1 text-sm font-medium text-foreground", children: [
199
511
  this.props.label,
200
512
  " failed to load"
201
513
  ] }),
202
- /* @__PURE__ */ jsx2("p", { className: "mb-4 max-w-xs text-xs text-muted-foreground", children: String(msg) }),
203
- /* @__PURE__ */ jsx2(
514
+ /* @__PURE__ */ jsx3("p", { className: "mb-4 max-w-xs text-xs text-muted-foreground", children: String(msg) }),
515
+ /* @__PURE__ */ jsx3(
204
516
  "button",
205
517
  {
206
518
  type: "button",
@@ -218,29 +530,29 @@ var EditorErrorBoundary = class extends Component {
218
530
  }
219
531
  };
220
532
  function SkeletonRegion({ label, className, children }) {
221
- return /* @__PURE__ */ jsxs2(Fragment, { children: [
222
- /* @__PURE__ */ jsx2("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "sr-only", children: label }),
223
- /* @__PURE__ */ jsx2("div", { className, "aria-hidden": "true", children })
533
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
534
+ /* @__PURE__ */ jsx3("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "sr-only", children: label }),
535
+ /* @__PURE__ */ jsx3("div", { className, "aria-hidden": "true", children })
224
536
  ] });
225
537
  }
226
538
  function TreeSkeleton() {
227
- return /* @__PURE__ */ jsx2(SkeletonRegion, { label: "Loading files\u2026", className: "space-y-2 p-4", children: [32, 48, 40, 52].map((w, i) => /* @__PURE__ */ jsx2("div", { className: "h-4 animate-pulse rounded bg-muted", style: { width: `${w * 4}px` } }, i)) });
539
+ return /* @__PURE__ */ jsx3(SkeletonRegion, { label: "Loading files\u2026", className: "space-y-2 p-4", children: [32, 48, 40, 52].map((w, i) => /* @__PURE__ */ jsx3("div", { className: "h-4 animate-pulse rounded bg-muted", style: { width: `${w * 4}px` } }, i)) });
228
540
  }
229
541
  function EditorSkeleton() {
230
- return /* @__PURE__ */ jsxs2(SkeletonRegion, { label: "Loading file\u2026", className: "space-y-3 p-8", children: [
231
- /* @__PURE__ */ jsx2("div", { className: "h-5 w-1/2 animate-pulse rounded bg-muted" }),
232
- /* @__PURE__ */ jsx2("div", { className: "h-4 w-full animate-pulse rounded bg-muted" }),
233
- /* @__PURE__ */ jsx2("div", { className: "h-4 w-3/4 animate-pulse rounded bg-muted" }),
234
- /* @__PURE__ */ jsx2("div", { className: "h-4 w-2/3 animate-pulse rounded bg-muted" })
542
+ return /* @__PURE__ */ jsxs3(SkeletonRegion, { label: "Loading file\u2026", className: "space-y-3 p-8", children: [
543
+ /* @__PURE__ */ jsx3("div", { className: "h-5 w-1/2 animate-pulse rounded bg-muted" }),
544
+ /* @__PURE__ */ jsx3("div", { className: "h-4 w-full animate-pulse rounded bg-muted" }),
545
+ /* @__PURE__ */ jsx3("div", { className: "h-4 w-3/4 animate-pulse rounded bg-muted" }),
546
+ /* @__PURE__ */ jsx3("div", { className: "h-4 w-2/3 animate-pulse rounded bg-muted" })
235
547
  ] });
236
548
  }
237
549
  function ReadErrorState({ message, onRetry }) {
238
- return /* @__PURE__ */ jsxs2("div", { className: "flex h-full flex-col items-center justify-center gap-3 p-8 text-center", children: [
239
- /* @__PURE__ */ jsxs2("div", { children: [
240
- /* @__PURE__ */ jsx2("h3", { className: "text-sm font-medium text-foreground", children: "Couldn't open this file" }),
241
- /* @__PURE__ */ jsx2("p", { className: "mt-1 max-w-md text-xs text-muted-foreground", children: message })
550
+ return /* @__PURE__ */ jsxs3("div", { className: "flex h-full flex-col items-center justify-center gap-3 p-8 text-center", children: [
551
+ /* @__PURE__ */ jsxs3("div", { children: [
552
+ /* @__PURE__ */ jsx3("h3", { className: "text-sm font-medium text-foreground", children: "Couldn't open this file" }),
553
+ /* @__PURE__ */ jsx3("p", { className: "mt-1 max-w-md text-xs text-muted-foreground", children: message })
242
554
  ] }),
243
- /* @__PURE__ */ jsx2(
555
+ /* @__PURE__ */ jsx3(
244
556
  "button",
245
557
  {
246
558
  type: "button",
@@ -252,15 +564,15 @@ function ReadErrorState({ message, onRetry }) {
252
564
  ] });
253
565
  }
254
566
  function TreeErrorState({ label, message, onRetry }) {
255
- return /* @__PURE__ */ jsxs2("div", { role: "alert", className: "flex h-full flex-col items-center justify-center gap-3 p-6 text-center", children: [
256
- /* @__PURE__ */ jsxs2("div", { children: [
257
- /* @__PURE__ */ jsxs2("h3", { className: "text-sm font-medium text-foreground", children: [
567
+ return /* @__PURE__ */ jsxs3("div", { role: "alert", className: "flex h-full flex-col items-center justify-center gap-3 p-6 text-center", children: [
568
+ /* @__PURE__ */ jsxs3("div", { children: [
569
+ /* @__PURE__ */ jsxs3("h3", { className: "text-sm font-medium text-foreground", children: [
258
570
  "Couldn't load ",
259
571
  label
260
572
  ] }),
261
- /* @__PURE__ */ jsx2("p", { className: "mt-1 max-w-xs text-xs text-muted-foreground", children: message })
573
+ /* @__PURE__ */ jsx3("p", { className: "mt-1 max-w-xs text-xs text-muted-foreground", children: message })
262
574
  ] }),
263
- /* @__PURE__ */ jsx2(
575
+ /* @__PURE__ */ jsx3(
264
576
  "button",
265
577
  {
266
578
  type: "button",
@@ -272,19 +584,19 @@ function TreeErrorState({ label, message, onRetry }) {
272
584
  ] });
273
585
  }
274
586
  function TreeEmptyState({ canCreate, onCreate }) {
275
- return /* @__PURE__ */ jsxs2("div", { className: "flex h-full flex-col items-center justify-center gap-3 p-6 text-center", children: [
276
- /* @__PURE__ */ jsxs2("div", { children: [
277
- /* @__PURE__ */ jsx2("h3", { className: "text-sm font-medium text-foreground", children: "No files yet" }),
278
- /* @__PURE__ */ jsx2("p", { className: "mt-1 max-w-xs text-xs text-muted-foreground", children: canCreate ? "Create a file to start." : "Files appear here once they are added." })
587
+ return /* @__PURE__ */ jsxs3("div", { className: "flex h-full flex-col items-center justify-center gap-3 p-6 text-center", children: [
588
+ /* @__PURE__ */ jsxs3("div", { children: [
589
+ /* @__PURE__ */ jsx3("h3", { className: "text-sm font-medium text-foreground", children: "No files yet" }),
590
+ /* @__PURE__ */ jsx3("p", { className: "mt-1 max-w-xs text-xs text-muted-foreground", children: canCreate ? "Create a file to start." : "Files appear here once they are added." })
279
591
  ] }),
280
- canCreate && /* @__PURE__ */ jsxs2(
592
+ canCreate && /* @__PURE__ */ jsxs3(
281
593
  "button",
282
594
  {
283
595
  type: "button",
284
596
  onClick: onCreate,
285
597
  className: "inline-flex h-8 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90",
286
598
  children: [
287
- /* @__PURE__ */ jsx2(Plus, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
599
+ /* @__PURE__ */ jsx3(Plus, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
288
600
  "New file"
289
601
  ]
290
602
  }
@@ -292,13 +604,13 @@ function TreeEmptyState({ canCreate, onCreate }) {
292
604
  ] });
293
605
  }
294
606
  function TreeNoMatchState({ query, onClear }) {
295
- return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-3 p-6 text-center", children: [
296
- /* @__PURE__ */ jsxs2("p", { className: "max-w-xs break-words text-xs text-muted-foreground", children: [
607
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-3 p-6 text-center", children: [
608
+ /* @__PURE__ */ jsxs3("p", { className: "max-w-xs break-words text-xs text-muted-foreground", children: [
297
609
  "No files match \u201C",
298
610
  query,
299
611
  "\u201D."
300
612
  ] }),
301
- /* @__PURE__ */ jsx2(
613
+ /* @__PURE__ */ jsx3(
302
614
  "button",
303
615
  {
304
616
  type: "button",
@@ -315,16 +627,16 @@ function OperationErrorAlert({
315
627
  onRetry,
316
628
  onDismiss
317
629
  }) {
318
- return /* @__PURE__ */ jsxs2(
630
+ return /* @__PURE__ */ jsxs3(
319
631
  "div",
320
632
  {
321
633
  role: "alert",
322
634
  className: "flex shrink-0 items-center justify-between gap-3 border-b border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-[var(--surface-danger-text)]",
323
635
  children: [
324
- /* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1", children: message }),
325
- /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-3", children: [
326
- /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": retryLabel, onClick: onRetry, className: "font-medium underline-offset-2 hover:underline", children: "Retry" }),
327
- /* @__PURE__ */ jsx2("button", { type: "button", onClick: onDismiss, className: "underline-offset-2 hover:underline", children: "Dismiss" })
636
+ /* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1", children: message }),
637
+ /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-3", children: [
638
+ /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": retryLabel, onClick: onRetry, className: "font-medium underline-offset-2 hover:underline", children: "Retry" }),
639
+ /* @__PURE__ */ jsx3("button", { type: "button", onClick: onDismiss, className: "underline-offset-2 hover:underline", children: "Dismiss" })
328
640
  ] })
329
641
  ]
330
642
  }
@@ -334,6 +646,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
334
646
  const {
335
647
  port,
336
648
  renderTree,
649
+ treeStateKey,
337
650
  renderArtifact,
338
651
  renderDock,
339
652
  canWrite = true,
@@ -361,20 +674,21 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
361
674
  const isMarkdownCapable = codec !== void 0;
362
675
  const persistentDock = dockToggle === false;
363
676
  const dockToggleCfg = dockToggle ? dockToggle : { label: "Discuss", disabledWhenDirty: true };
364
- const [tree, setTree] = useState([]);
365
- const [treeLoading, setTreeLoading] = useState(true);
366
- const [treeLoaded, setTreeLoaded] = useState(false);
367
- const [treeError, setTreeError] = useState(null);
368
- const [internalPath, setInternalPath] = useState(null);
677
+ const [tree, setTree] = useState2([]);
678
+ const [treeLoading, setTreeLoading] = useState2(true);
679
+ const [treeLoaded, setTreeLoaded] = useState2(false);
680
+ const [treeError, setTreeError] = useState2(null);
681
+ const [internalPath, setInternalPath] = useState2(null);
369
682
  const selectedPath = controlled ? controlledPath ?? null : internalPath;
370
- const [filesOpen, setFilesOpen] = useState(false);
683
+ const [filesOpen, setFilesOpen] = useState2(false);
371
684
  const showFiles = filesOpen || !selectedPath;
372
- const searchRef = useRef2(null);
373
- const documentRef = useRef2(null);
374
- useEffect2(() => {
685
+ const searchRef = useRef3(null);
686
+ const documentRef = useRef3(null);
687
+ const treeHeadingId = useId();
688
+ useEffect3(() => {
375
689
  setFilesOpen(false);
376
690
  }, [selectedPath]);
377
- const showDocument = useCallback(() => {
691
+ const showDocument = useCallback2(() => {
378
692
  const focused = document.activeElement;
379
693
  setFilesOpen(false);
380
694
  requestAnimationFrame(() => {
@@ -383,27 +697,27 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
383
697
  }
384
698
  });
385
699
  }, []);
386
- const [selectedFile, setSelectedFile] = useState(null);
387
- const [displayReadyPath, setDisplayReadyPath] = useState(null);
388
- const [fileLoading, setFileLoading] = useState(false);
389
- const [readError, setReadError] = useState(null);
390
- const [reloadNonce, setReloadNonce] = useState(0);
391
- const [saving, setSaving] = useState(false);
392
- const [saveError, setSaveError] = useState(null);
393
- const [editorMode, setEditorMode] = useState("rich");
394
- const [richDraft, setRichDraft] = useState("");
395
- const [sourceDraft, setSourceDraft] = useState("");
396
- const [isDirty, setIsDirty] = useState(false);
397
- const [createOpen, setCreateOpen] = useState(false);
398
- const [newPath, setNewPath] = useState("");
399
- const [creating, setCreating] = useState(false);
400
- const [createError, setCreateError] = useState(null);
401
- const [deleteOpen, setDeleteOpen] = useState(false);
402
- const [deleting, setDeleting] = useState(false);
403
- const [deleteError, setDeleteError] = useState(null);
404
- const [dockOpen, setDockOpen] = useState(false);
405
- const rootRef = useRef2(null);
406
- const [dockInline, setDockInline] = useState(false);
700
+ const [selectedFile, setSelectedFile] = useState2(null);
701
+ const [displayReadyPath, setDisplayReadyPath] = useState2(null);
702
+ const [fileLoading, setFileLoading] = useState2(false);
703
+ const [readError, setReadError] = useState2(null);
704
+ const [reloadNonce, setReloadNonce] = useState2(0);
705
+ const [saving, setSaving] = useState2(false);
706
+ const [saveError, setSaveError] = useState2(null);
707
+ const [editorMode, setEditorMode] = useState2("rich");
708
+ const [richDraft, setRichDraft] = useState2("");
709
+ const [sourceDraft, setSourceDraft] = useState2("");
710
+ const [isDirty, setIsDirty] = useState2(false);
711
+ const [createOpen, setCreateOpen] = useState2(false);
712
+ const [newPath, setNewPath] = useState2("");
713
+ const [creating, setCreating] = useState2(false);
714
+ const [createError, setCreateError] = useState2(null);
715
+ const [deleteOpen, setDeleteOpen] = useState2(false);
716
+ const [deleting, setDeleting] = useState2(false);
717
+ const [deleteError, setDeleteError] = useState2(null);
718
+ const [dockOpen, setDockOpen] = useState2(false);
719
+ const rootRef = useRef3(null);
720
+ const [dockInline, setDockInline] = useState2(false);
407
721
  useLayoutEffect(() => {
408
722
  const root = rootRef.current;
409
723
  if (!root || !renderDock || typeof ResizeObserver === "undefined") return;
@@ -415,19 +729,19 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
415
729
  observer.observe(root);
416
730
  return () => observer.disconnect();
417
731
  }, [renderDock]);
418
- const [pendingNav, setPendingNav] = useState(null);
419
- const [query, setQuery] = useState("");
420
- const [folderPath, setFolderPath] = useState(null);
421
- const dirtyRef = useRef2(isDirty);
732
+ const [pendingNav, setPendingNav] = useState2(null);
733
+ const [query, setQuery] = useState2("");
734
+ const [folderPath, setFolderPath] = useState2(null);
735
+ const dirtyRef = useRef3(isDirty);
422
736
  dirtyRef.current = isDirty;
423
- const treeRequestRef = useRef2(0);
424
- const savedContentRef = useRef2("");
425
- const loadedPathRef = useRef2(null);
426
- const onOperationErrorRef = useRef2(onOperationError);
737
+ const treeRequestRef = useRef3(0);
738
+ const savedContentRef = useRef3("");
739
+ const loadedPathRef = useRef3(null);
740
+ const onOperationErrorRef = useRef3(onOperationError);
427
741
  onOperationErrorRef.current = onOperationError;
428
- const pendingOpenRef = useRef2(null);
429
- const previousPortRef = useRef2(port);
430
- const finishPendingOpen = useCallback((opened, clearNavigation = true) => {
742
+ const pendingOpenRef = useRef3(null);
743
+ const previousPortRef = useRef3(port);
744
+ const finishPendingOpen = useCallback2((opened, clearNavigation = true) => {
431
745
  const pending = pendingOpenRef.current;
432
746
  if (!pending) return;
433
747
  pendingOpenRef.current = null;
@@ -436,43 +750,43 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
436
750
  }
437
751
  pending.resolve(opened);
438
752
  }, []);
439
- useEffect2(() => () => finishPendingOpen(false, false), [finishPendingOpen]);
440
- useEffect2(() => {
753
+ useEffect3(() => () => finishPendingOpen(false, false), [finishPendingOpen]);
754
+ useEffect3(() => {
441
755
  if (previousPortRef.current !== port) finishPendingOpen(false);
442
756
  previousPortRef.current = port;
443
757
  }, [port, finishPendingOpen]);
444
- useEffect2(() => {
758
+ useEffect3(() => {
445
759
  const pending = pendingOpenRef.current;
446
760
  if (!pending) return;
447
761
  if (selectedPath === pending.path) pending.selected = true;
448
762
  else if (pending.selected || selectedPath !== pending.fromPath) finishPendingOpen(false);
449
763
  }, [selectedPath, finishPendingOpen]);
450
- const treePaths = useMemo(
764
+ const treePaths = useMemo2(
451
765
  () => collectTreePaths(tree, { files: /* @__PURE__ */ new Set(), directories: /* @__PURE__ */ new Set() }),
452
766
  [tree]
453
767
  );
454
- const resolvedSelectedPath = useMemo(() => {
768
+ const resolvedSelectedPath = useMemo2(() => {
455
769
  if (!selectedPath) return null;
456
770
  const listed = resolveTreePath(selectedPath, treePaths);
457
771
  if (listed?.type === "directory") return null;
458
772
  return listed?.path ?? selectedPath;
459
773
  }, [selectedPath, treePaths]);
460
- const activeFolderNode = useMemo(
774
+ const activeFolderNode = useMemo2(
461
775
  () => folderPath ? findDirectory(tree, folderPath) : null,
462
776
  [tree, folderPath]
463
777
  );
464
778
  const activeFolder = activeFolderNode?.path ?? null;
465
- const treeRoot = useMemo(
779
+ const treeRoot = useMemo2(
466
780
  () => ({ name: label, path: "", type: "directory", children: tree }),
467
781
  [tree, label]
468
782
  );
469
- const visibleRoot = useMemo(() => {
783
+ const visibleRoot = useMemo2(() => {
470
784
  const q = query.trim().toLowerCase();
471
785
  if (!q) return treeRoot;
472
786
  const base = activeFolderNode ?? treeRoot;
473
787
  return { ...base, children: filterNodes(base.children ?? [], q) };
474
788
  }, [treeRoot, activeFolderNode, query]);
475
- const commitPath = useCallback(
789
+ const commitPath = useCallback2(
476
790
  (next) => {
477
791
  if (controlled) {
478
792
  const decision = onSelectedPathChange?.(next);
@@ -484,7 +798,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
484
798
  },
485
799
  [controlled, onSelectedPathChange]
486
800
  );
487
- const reportFailure = useCallback((operation, phase, error, fallback, path) => {
801
+ const reportFailure = useCallback2((operation, phase, error, fallback, path) => {
488
802
  const failure = {
489
803
  operation,
490
804
  phase,
@@ -499,7 +813,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
499
813
  }
500
814
  return failure;
501
815
  }, []);
502
- const refresh = useCallback(async (context = LIST_CONTEXT) => {
816
+ const refresh = useCallback2(async (context = LIST_CONTEXT) => {
503
817
  const request = ++treeRequestRef.current;
504
818
  setTreeLoading(true);
505
819
  setTreeError(null);
@@ -524,25 +838,25 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
524
838
  if (request === treeRequestRef.current) setTreeLoading(false);
525
839
  }
526
840
  }, [port, reportFailure, label]);
527
- useEffect2(() => {
841
+ useEffect3(() => {
528
842
  setTree([]);
529
843
  setTreeLoaded(false);
530
844
  setTreeError(null);
531
845
  setSelectedFile(null);
532
846
  }, [port]);
533
- useEffect2(() => {
847
+ useEffect3(() => {
534
848
  void refresh();
535
849
  return () => {
536
850
  treeRequestRef.current += 1;
537
851
  };
538
852
  }, [refresh, refreshKey]);
539
- const retryTree = useCallback(async () => {
853
+ const retryTree = useCallback2(async () => {
540
854
  if (!treeError) return;
541
855
  const { context } = treeError;
542
856
  const recovered = await refresh(context);
543
857
  if (recovered && context.selectAfterRecovery) commitPath(context.selectAfterRecovery);
544
858
  }, [treeError, refresh, commitPath]);
545
- useEffect2(() => {
859
+ useEffect3(() => {
546
860
  if (!selectedPath) {
547
861
  setSelectedFile(null);
548
862
  setFileLoading(false);
@@ -592,7 +906,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
592
906
  cancelled = true;
593
907
  };
594
908
  }, [port, selectedPath, resolvedSelectedPath, treeLoading, treeLoaded, treeError, isDirty, saving, reloadNonce, commitPath, reportFailure, finishPendingOpen]);
595
- useEffect2(() => {
909
+ useEffect3(() => {
596
910
  if (!selectedFile) {
597
911
  loadedPathRef.current = null;
598
912
  setDisplayReadyPath(null);
@@ -615,13 +929,13 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
615
929
  setSaveError(null);
616
930
  setDockOpen(false);
617
931
  }, [selectedFile?.path, selectedFile?.content, activeCodec]);
618
- useEffect2(() => {
932
+ useEffect3(() => {
619
933
  const pending = pendingOpenRef.current;
620
934
  if (pending?.loaded && pending.path === selectedPath && selectedFile?.path === pending.path && displayReadyPath === pending.path && sourceDraft === selectedFile.content && !fileLoading) {
621
935
  finishPendingOpen(true);
622
936
  }
623
937
  }, [selectedPath, selectedFile, displayReadyPath, sourceDraft, fileLoading, finishPendingOpen]);
624
- const guardedOpen = useCallback((rawPath, resolve) => {
938
+ const guardedOpen = useCallback2((rawPath, resolve) => {
625
939
  const target = resolveTreePath(rawPath, treePaths);
626
940
  if (!rawPath.trim() || target?.type === "directory") {
627
941
  resolve?.(false);
@@ -660,10 +974,16 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
660
974
  useImperativeHandle(ref, () => ({
661
975
  openFile: (path) => new Promise((resolve) => guardedOpen(path, resolve))
662
976
  }), [guardedOpen]);
663
- const toggleFolder = useCallback((path) => {
977
+ const toggleFolder = useCallback2((path) => {
664
978
  setFolderPath((current) => current === path ? null : path);
665
979
  }, []);
666
- const selectFileRef = useRef2(() => {
980
+ const handleFolderToggle = useCallback2((path, expanded) => {
981
+ setFolderPath((current) => {
982
+ if (expanded) return path;
983
+ return current && (current === path || current.startsWith(`${path}/`)) ? null : current;
984
+ });
985
+ }, []);
986
+ const selectFileRef = useRef3(() => {
667
987
  });
668
988
  selectFileRef.current = (rawPath) => {
669
989
  const target = resolveTreePath(rawPath, treePaths);
@@ -674,8 +994,8 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
674
994
  }
675
995
  toggleFolder(target.path);
676
996
  };
677
- const handleTreeSelect = useCallback((path) => selectFileRef.current(path), []);
678
- const confirmDiscard = useCallback(() => {
997
+ const handleTreeSelect = useCallback2((path) => selectFileRef.current(path), []);
998
+ const confirmDiscard = useCallback2(() => {
679
999
  const nav = pendingNav;
680
1000
  setPendingNav(null);
681
1001
  if (!nav) return;
@@ -687,7 +1007,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
687
1007
  setIsDirty(false);
688
1008
  showDocument();
689
1009
  }, [pendingNav, commitPath, showDocument, finishPendingOpen]);
690
- const showRichMode = useCallback(() => {
1010
+ const showRichMode = useCallback2(() => {
691
1011
  setEditorMode((mode) => {
692
1012
  if (mode === "rich") return mode;
693
1013
  setRichDraft(activeCodec.parse(sourceDraft));
@@ -695,7 +1015,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
695
1015
  return "rich";
696
1016
  });
697
1017
  }, [activeCodec, sourceDraft]);
698
- const showSourceMode = useCallback(() => {
1018
+ const showSourceMode = useCallback2(() => {
699
1019
  setEditorMode((mode) => {
700
1020
  if (mode === "source") return mode;
701
1021
  const content = isDirty ? activeCodec.serialize(richDraft) : savedContentRef.current;
@@ -704,17 +1024,17 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
704
1024
  return "source";
705
1025
  });
706
1026
  }, [activeCodec, isDirty, richDraft]);
707
- const onSourceChange = useCallback((next) => {
1027
+ const onSourceChange = useCallback2((next) => {
708
1028
  dirtyRef.current = next !== savedContentRef.current;
709
1029
  setSourceDraft(next);
710
1030
  setIsDirty(dirtyRef.current);
711
1031
  }, []);
712
- const onRichChange = useCallback((next) => {
1032
+ const onRichChange = useCallback2((next) => {
713
1033
  dirtyRef.current = activeCodec.serialize(next) !== savedContentRef.current;
714
1034
  setRichDraft(next);
715
1035
  setIsDirty(dirtyRef.current);
716
1036
  }, [activeCodec]);
717
- const saveCurrent = useCallback(async () => {
1037
+ const saveCurrent = useCallback2(async () => {
718
1038
  if (!selectedFile) return;
719
1039
  const content = editorMode === "source" ? sourceDraft : activeCodec.serialize(richDraft);
720
1040
  setSaving(true);
@@ -732,7 +1052,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
732
1052
  setSaving(false);
733
1053
  }
734
1054
  }, [selectedFile, editorMode, sourceDraft, richDraft, activeCodec, port, reportFailure]);
735
- const handleCreate = useCallback(async () => {
1055
+ const handleCreate = useCallback2(async () => {
736
1056
  const trimmed = newPath.trim();
737
1057
  if (!trimmed || !trimmed.split("/").pop()?.trim()) return;
738
1058
  setCreating(true);
@@ -754,7 +1074,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
754
1074
  setCreating(false);
755
1075
  }
756
1076
  }, [newPath, port, refresh, commitPath, reportFailure]);
757
- const handleDelete = useCallback(async () => {
1077
+ const handleDelete = useCallback2(async () => {
758
1078
  if (!selectedFile) return;
759
1079
  const path = selectedFile.path;
760
1080
  setDeleting(true);
@@ -785,12 +1105,12 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
785
1105
  const trimmedQuery = query.trim();
786
1106
  let treeContent;
787
1107
  if (!treeLoaded && (treeLoading || !treeError)) {
788
- treeContent = /* @__PURE__ */ jsx2(TreeSkeleton, {});
1108
+ treeContent = /* @__PURE__ */ jsx3(TreeSkeleton, {});
789
1109
  } else if (!treeLoaded && treeError) {
790
- treeContent = /* @__PURE__ */ jsx2(TreeErrorState, { label, message: treeFailureMessage(treeError.failure, label), onRetry: () => void retryTree() });
1110
+ treeContent = /* @__PURE__ */ jsx3(TreeErrorState, { label, message: treeFailureMessage(treeError.failure, label), onRetry: () => void retryTree() });
791
1111
  } else {
792
- treeContent = /* @__PURE__ */ jsxs2(Fragment, { children: [
793
- treeError && /* @__PURE__ */ jsx2(
1112
+ treeContent = /* @__PURE__ */ jsxs3(Fragment, { children: [
1113
+ treeError && /* @__PURE__ */ jsx3(
794
1114
  OperationErrorAlert,
795
1115
  {
796
1116
  message: treeFailureMessage(treeError.failure, label),
@@ -799,20 +1119,32 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
799
1119
  onDismiss: () => setTreeError(null)
800
1120
  }
801
1121
  ),
802
- vaultEmpty && !trimmedQuery ? treeEmptyState !== void 0 ? treeEmptyState : /* @__PURE__ */ jsx2(TreeEmptyState, { canCreate, onCreate: openCreate }) : trimmedQuery && (visibleRoot.children?.length ?? 0) === 0 ? /* @__PURE__ */ jsx2(TreeNoMatchState, { query: trimmedQuery, onClear: () => setQuery("") }) : renderTree({
1122
+ vaultEmpty && !trimmedQuery ? treeEmptyState !== void 0 ? treeEmptyState : /* @__PURE__ */ jsx3(TreeEmptyState, { canCreate, onCreate: openCreate }) : trimmedQuery && (visibleRoot.children?.length ?? 0) === 0 ? /* @__PURE__ */ jsx3(TreeNoMatchState, { query: trimmedQuery, onClear: () => setQuery("") }) : renderTree ? renderTree({
803
1123
  root: visibleRoot,
804
1124
  selectedPath: resolvedSelectedPath ?? void 0,
805
1125
  onSelect: handleTreeSelect
806
- })
1126
+ }) : /* @__PURE__ */ jsx3(
1127
+ VaultTree,
1128
+ {
1129
+ root: visibleRoot,
1130
+ selectedPath: resolvedSelectedPath ?? void 0,
1131
+ activeFolder,
1132
+ onSelect: handleTreeSelect,
1133
+ onFolderToggle: handleFolderToggle,
1134
+ storageKey: treeStateKey,
1135
+ expandAll: !!trimmedQuery,
1136
+ label
1137
+ }
1138
+ )
807
1139
  ] });
808
1140
  }
809
- return /* @__PURE__ */ jsx2(EditorErrorBoundary, { label, onReset: () => {
1141
+ return /* @__PURE__ */ jsx3(EditorErrorBoundary, { label, onReset: () => {
810
1142
  commitPath(null);
811
1143
  setSelectedFile(null);
812
- }, children: /* @__PURE__ */ jsxs2("div", { ref: rootRef, className: `flex min-h-0 min-w-0 flex-1 overflow-hidden ${className ?? ""}`, children: [
813
- /* @__PURE__ */ jsxs2("div", { className: "@container/vault flex min-w-0 flex-1 flex-col", children: [
814
- selectedPath && /* @__PURE__ */ jsxs2("nav", { "aria-label": `${label} navigation`, className: "flex shrink-0 items-center gap-1 border-b border-border p-2 @[45rem]/vault:hidden", children: [
815
- /* @__PURE__ */ jsx2(
1144
+ }, children: /* @__PURE__ */ jsxs3("div", { ref: rootRef, className: `flex min-h-0 min-w-0 flex-1 overflow-hidden ${className ?? ""}`, children: [
1145
+ /* @__PURE__ */ jsxs3("div", { className: "@container/vault flex min-w-0 flex-1 flex-col", children: [
1146
+ selectedPath && /* @__PURE__ */ jsxs3("nav", { "aria-label": `${label} navigation`, className: "flex shrink-0 items-center gap-1 border-b border-border p-2 @[45rem]/vault:hidden", children: [
1147
+ /* @__PURE__ */ jsx3(
816
1148
  "button",
817
1149
  {
818
1150
  type: "button",
@@ -830,7 +1162,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
830
1162
  children: "Files"
831
1163
  }
832
1164
  ),
833
- selectedPath && /* @__PURE__ */ jsx2(
1165
+ selectedPath && /* @__PURE__ */ jsx3(
834
1166
  "button",
835
1167
  {
836
1168
  type: "button",
@@ -842,74 +1174,73 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
842
1174
  }
843
1175
  )
844
1176
  ] }),
845
- /* @__PURE__ */ jsxs2("div", { className: "flex min-h-0 min-w-0 flex-1", children: [
846
- /* @__PURE__ */ jsxs2("div", { "data-vault-tree": true, className: `${showFiles ? "flex" : "hidden"} min-w-0 flex-1 flex-col bg-background @[45rem]/vault:flex ${treeSpansPane ? "" : "border-r border-border @[45rem]/vault:w-[23rem] @[45rem]/vault:min-w-[23rem] @[45rem]/vault:flex-none"}`, children: [
847
- /* @__PURE__ */ jsxs2("div", { className: "flex h-14 shrink-0 items-center gap-2 border-b border-border px-4", children: [
848
- /* @__PURE__ */ jsx2("div", { className: "min-w-0 flex-1", children: !vaultEmpty && /* @__PURE__ */ jsx2(
849
- "input",
850
- {
851
- ref: searchRef,
852
- type: "text",
853
- value: query,
854
- onChange: (e) => setQuery(e.target.value),
855
- placeholder: activeFolder ? `Search ${activeFolder}\u2026` : "Search\u2026",
856
- "aria-label": `Search ${noun}`,
857
- className: "h-8 w-full rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground"
858
- }
859
- ) }),
860
- /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-1", children: [
861
- headerActions,
862
- /* @__PURE__ */ jsx2(
863
- "button",
864
- {
865
- type: "button",
866
- "aria-label": `Refresh ${noun}`,
867
- title: "Refresh",
868
- onClick: () => void refresh(),
869
- className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
870
- children: /* @__PURE__ */ jsx2(RefreshCw, { className: "h-4 w-4", "aria-hidden": "true" })
871
- }
872
- ),
873
- canCreate && /* @__PURE__ */ jsx2(
874
- "button",
1177
+ /* @__PURE__ */ jsxs3("div", { className: "flex min-h-0 min-w-0 flex-1", children: [
1178
+ /* @__PURE__ */ jsx3("div", { "data-vault-tree": true, className: `${showFiles ? "flex" : "hidden"} min-w-0 flex-1 flex-col p-2 @[45rem]/vault:flex @[45rem]/vault:p-3 ${treeSpansPane ? "" : "@[45rem]/vault:w-[23rem] @[45rem]/vault:min-w-[23rem] @[45rem]/vault:flex-none"}`, children: /* @__PURE__ */ jsxs3(
1179
+ "section",
1180
+ {
1181
+ "aria-labelledby": treeHeadingId,
1182
+ "data-vault-tree-surface": true,
1183
+ className: "flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card text-card-foreground shadow-raised",
1184
+ children: [
1185
+ /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-2 px-3 pb-2 pt-3", children: [
1186
+ /* @__PURE__ */ jsx3("h2", { id: treeHeadingId, className: "min-w-0 flex-1 truncate text-sm font-semibold text-foreground", children: label }),
1187
+ /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-1", children: [
1188
+ headerActions,
1189
+ /* @__PURE__ */ jsx3(
1190
+ "button",
1191
+ {
1192
+ type: "button",
1193
+ "aria-label": `Refresh ${noun}`,
1194
+ title: "Refresh",
1195
+ onClick: () => void refresh(),
1196
+ className: `${TREE_ICON_BUTTON} text-muted-foreground hover:bg-muted hover:text-foreground`,
1197
+ children: /* @__PURE__ */ jsx3(RefreshCw, { className: "size-4", "aria-hidden": "true" })
1198
+ }
1199
+ ),
1200
+ canCreate && /* @__PURE__ */ jsx3(
1201
+ "button",
1202
+ {
1203
+ type: "button",
1204
+ title: "New file",
1205
+ "aria-label": activeFolder ? `New file in ${activeFolder}` : "New file",
1206
+ onClick: openCreate,
1207
+ className: `${TREE_ICON_BUTTON} bg-primary text-primary-foreground hover:bg-primary/90`,
1208
+ children: /* @__PURE__ */ jsx3(Plus, { className: "size-4", "aria-hidden": "true" })
1209
+ }
1210
+ )
1211
+ ] })
1212
+ ] }),
1213
+ !vaultEmpty && /* @__PURE__ */ jsx3("div", { className: "shrink-0 px-3 pb-2", children: /* @__PURE__ */ jsx3(
1214
+ "input",
875
1215
  {
876
- type: "button",
877
- title: "New file",
878
- "aria-label": activeFolder ? `New file in ${activeFolder}` : "New file",
879
- onClick: openCreate,
880
- className: "inline-flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground transition-colors hover:bg-primary/90",
881
- children: /* @__PURE__ */ jsx2(Plus, { className: "h-4 w-4", "aria-hidden": "true" })
1216
+ ref: searchRef,
1217
+ type: "search",
1218
+ value: query,
1219
+ onChange: (e) => setQuery(e.target.value),
1220
+ placeholder: activeFolder ? `Search ${activeFolder}\u2026` : `Search ${noun}\u2026`,
1221
+ "aria-label": `Search ${noun}`,
1222
+ className: "h-8 w-full rounded-md border border-border bg-input px-3 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [@media(pointer:coarse)]:h-10 [@media(pointer:coarse)]:text-base"
882
1223
  }
883
- )
884
- ] })
885
- ] }),
886
- activeFolder && /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1.5 border-b border-border bg-muted/40 px-4 py-1.5 text-xs", children: [
887
- /* @__PURE__ */ jsx2(Folder, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
888
- /* @__PURE__ */ jsx2("span", { "data-vault-folder": true, className: "min-w-0 flex-1 truncate font-medium text-foreground", title: activeFolder, children: activeFolder }),
889
- /* @__PURE__ */ jsx2(
890
- "button",
891
- {
892
- type: "button",
893
- "aria-label": "Clear the active folder",
894
- onClick: () => setFolderPath(null),
895
- className: "shrink-0 rounded px-1 text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline",
896
- children: "Clear"
897
- }
898
- )
899
- ] }),
900
- /* @__PURE__ */ jsx2(
901
- "div",
902
- {
903
- className: "flex-1 overflow-y-auto",
904
- onClickCapture: (event) => {
905
- const target = treeClickTarget(event);
906
- if (target) handleTreeSelect(target.path);
907
- },
908
- children: treeContent
909
- }
910
- )
911
- ] }),
912
- /* @__PURE__ */ jsxs2(
1224
+ ) }),
1225
+ activeFolder && /* @__PURE__ */ jsxs3("div", { className: "mx-3 mb-2 flex shrink-0 items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs", children: [
1226
+ /* @__PURE__ */ jsx3(Folder2, { className: "size-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
1227
+ /* @__PURE__ */ jsx3("span", { "data-vault-folder": true, className: "min-w-0 flex-1 truncate font-medium text-foreground", title: activeFolder, children: activeFolder }),
1228
+ /* @__PURE__ */ jsx3(
1229
+ "button",
1230
+ {
1231
+ type: "button",
1232
+ "aria-label": "Clear the active folder",
1233
+ onClick: () => setFolderPath(null),
1234
+ className: "shrink-0 rounded px-1 text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1235
+ children: "Clear"
1236
+ }
1237
+ )
1238
+ ] }),
1239
+ /* @__PURE__ */ jsx3("div", { className: "min-h-0 flex-1 overflow-y-auto border-t border-border px-1.5 py-1.5", children: treeContent })
1240
+ ]
1241
+ }
1242
+ ) }),
1243
+ /* @__PURE__ */ jsxs3(
913
1244
  "div",
914
1245
  {
915
1246
  ref: documentRef,
@@ -918,11 +1249,11 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
918
1249
  tabIndex: -1,
919
1250
  className: `${showFiles || treeSpansPane ? "hidden" : "flex"} min-w-0 flex-1 flex-col overflow-hidden ${treeSpansPane ? "" : "@[45rem]/vault:flex"}`,
920
1251
  children: [
921
- selectedFile && /* @__PURE__ */ jsxs2("div", { className: `flex h-14 shrink-0 items-center justify-between gap-2 border-b border-border px-4 ${pathBarClassName ?? "bg-card"}`, children: [
922
- /* @__PURE__ */ jsx2("span", { "data-vault-path": true, className: "min-w-0 flex-1 truncate text-xs font-medium text-foreground", children: selectedFile.path }),
923
- /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-1", children: [
924
- canWrite && isMarkdownCapable && /* @__PURE__ */ jsxs2("div", { className: "mr-1 flex items-center gap-1", children: [
925
- /* @__PURE__ */ jsx2(
1252
+ selectedFile && /* @__PURE__ */ jsxs3("div", { className: `flex h-14 shrink-0 items-center justify-between gap-2 border-b border-border px-4 ${pathBarClassName ?? "bg-card"}`, children: [
1253
+ /* @__PURE__ */ jsx3("span", { "data-vault-path": true, className: "min-w-0 flex-1 truncate text-xs font-medium text-foreground", children: selectedFile.path }),
1254
+ /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-1", children: [
1255
+ canWrite && isMarkdownCapable && /* @__PURE__ */ jsxs3("div", { className: "mr-1 flex items-center gap-1", children: [
1256
+ /* @__PURE__ */ jsx3(
926
1257
  "button",
927
1258
  {
928
1259
  type: "button",
@@ -933,7 +1264,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
933
1264
  children: "Rich"
934
1265
  }
935
1266
  ),
936
- /* @__PURE__ */ jsx2(
1267
+ /* @__PURE__ */ jsx3(
937
1268
  "button",
938
1269
  {
939
1270
  type: "button",
@@ -945,7 +1276,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
945
1276
  }
946
1277
  )
947
1278
  ] }),
948
- renderDock && (!persistentDock || dockInline) && /* @__PURE__ */ jsx2(
1279
+ renderDock && (!persistentDock || dockInline) && /* @__PURE__ */ jsx3(
949
1280
  "button",
950
1281
  {
951
1282
  type: "button",
@@ -959,7 +1290,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
959
1290
  }
960
1291
  ),
961
1292
  fileActions?.(selectedFile),
962
- onDownloadFile && /* @__PURE__ */ jsx2(
1293
+ onDownloadFile && /* @__PURE__ */ jsx3(
963
1294
  "button",
964
1295
  {
965
1296
  type: "button",
@@ -967,10 +1298,10 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
967
1298
  title: "Download file",
968
1299
  onClick: () => onDownloadFile(selectedFile),
969
1300
  className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
970
- children: /* @__PURE__ */ jsx2(Download, { className: "h-4 w-4" })
1301
+ children: /* @__PURE__ */ jsx3(Download, { className: "h-4 w-4" })
971
1302
  }
972
1303
  ),
973
- canDelete && /* @__PURE__ */ jsx2(
1304
+ canDelete && /* @__PURE__ */ jsx3(
974
1305
  "button",
975
1306
  {
976
1307
  type: "button",
@@ -981,12 +1312,12 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
981
1312
  setDeleteOpen(true);
982
1313
  },
983
1314
  className: "inline-flex h-7 w-7 items-center justify-center rounded text-[var(--surface-danger-text)] transition-colors hover:bg-destructive/10",
984
- children: /* @__PURE__ */ jsx2(Trash2, { className: "h-4 w-4" })
1315
+ children: /* @__PURE__ */ jsx3(Trash2, { className: "h-4 w-4" })
985
1316
  }
986
1317
  )
987
1318
  ] })
988
1319
  ] }),
989
- selectedFile && saveError && /* @__PURE__ */ jsx2(
1320
+ selectedFile && saveError && /* @__PURE__ */ jsx3(
990
1321
  OperationErrorAlert,
991
1322
  {
992
1323
  message: saveError.message,
@@ -995,7 +1326,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
995
1326
  onDismiss: () => setSaveError(null)
996
1327
  }
997
1328
  ),
998
- readError && selectedFile?.path === resolvedSelectedPath && /* @__PURE__ */ jsx2(
1329
+ readError && selectedFile?.path === resolvedSelectedPath && /* @__PURE__ */ jsx3(
999
1330
  OperationErrorAlert,
1000
1331
  {
1001
1332
  message: readError,
@@ -1004,7 +1335,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
1004
1335
  onDismiss: () => setReadError(null)
1005
1336
  }
1006
1337
  ),
1007
- /* @__PURE__ */ jsx2("div", { className: "flex-1 overflow-hidden", children: fileLoading && selectedFile?.path !== resolvedSelectedPath ? /* @__PURE__ */ jsx2(EditorSkeleton, {}) : readError && selectedFile?.path !== resolvedSelectedPath ? /* @__PURE__ */ jsx2(ReadErrorState, { message: readError, onRetry: () => setReloadNonce((n) => n + 1) }) : selectedFile && renderDock && dockInline && dockOpen ? /* @__PURE__ */ jsx2("div", { "data-vault-dock": "inline", className: "flex h-full min-h-0 flex-col overflow-y-auto", children: renderDock({ file: selectedFile, open: true, onClose: () => setDockOpen(false), placement: "inline" }) }) : selectedFile && canWrite && isMarkdownCapable && editorMode === "source" ? /* @__PURE__ */ jsx2(
1338
+ /* @__PURE__ */ jsx3("div", { className: "flex-1 overflow-hidden", children: fileLoading && selectedFile?.path !== resolvedSelectedPath ? /* @__PURE__ */ jsx3(EditorSkeleton, {}) : readError && selectedFile?.path !== resolvedSelectedPath ? /* @__PURE__ */ jsx3(ReadErrorState, { message: readError, onRetry: () => setReloadNonce((n) => n + 1) }) : selectedFile && renderDock && dockInline && dockOpen ? /* @__PURE__ */ jsx3("div", { "data-vault-dock": "inline", className: "flex h-full min-h-0 flex-col overflow-y-auto", children: renderDock({ file: selectedFile, open: true, onClose: () => setDockOpen(false), placement: "inline" }) }) : selectedFile && canWrite && isMarkdownCapable && editorMode === "source" ? /* @__PURE__ */ jsx3(
1008
1339
  SourceEditor,
1009
1340
  {
1010
1341
  path: selectedFile.path,
@@ -1036,7 +1367,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
1036
1367
  } : () => setDockOpen(false),
1037
1368
  placement: "side"
1038
1369
  }),
1039
- /* @__PURE__ */ jsx2(
1370
+ /* @__PURE__ */ jsx3(
1040
1371
  ConfirmDialog,
1041
1372
  {
1042
1373
  open: createOpen,
@@ -1050,8 +1381,8 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
1050
1381
  setNewPath("");
1051
1382
  setCreateError(null);
1052
1383
  },
1053
- children: /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
1054
- /* @__PURE__ */ jsx2(
1384
+ children: /* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
1385
+ /* @__PURE__ */ jsx3(
1055
1386
  "input",
1056
1387
  {
1057
1388
  value: newPath,
@@ -1062,11 +1393,11 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
1062
1393
  className: "h-9 w-full rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground"
1063
1394
  }
1064
1395
  ),
1065
- createError && /* @__PURE__ */ jsx2("p", { role: "alert", className: "text-xs text-[var(--surface-danger-text)]", children: createError.message })
1396
+ createError && /* @__PURE__ */ jsx3("p", { role: "alert", className: "text-xs text-[var(--surface-danger-text)]", children: createError.message })
1066
1397
  ] })
1067
1398
  }
1068
1399
  ),
1069
- /* @__PURE__ */ jsx2(
1400
+ /* @__PURE__ */ jsx3(
1070
1401
  ConfirmDialog,
1071
1402
  {
1072
1403
  open: deleteOpen,
@@ -1080,10 +1411,10 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
1080
1411
  setDeleteOpen(false);
1081
1412
  setDeleteError(null);
1082
1413
  },
1083
- children: deleteError && /* @__PURE__ */ jsx2("p", { role: "alert", className: "text-xs text-[var(--surface-danger-text)]", children: deleteError.message })
1414
+ children: deleteError && /* @__PURE__ */ jsx3("p", { role: "alert", className: "text-xs text-[var(--surface-danger-text)]", children: deleteError.message })
1084
1415
  }
1085
1416
  ),
1086
- /* @__PURE__ */ jsx2(
1417
+ /* @__PURE__ */ jsx3(
1087
1418
  ConfirmDialog,
1088
1419
  {
1089
1420
  open: pendingNav !== null,
@@ -1108,12 +1439,12 @@ function SourceEditor({
1108
1439
  onChange,
1109
1440
  onSave
1110
1441
  }) {
1111
- return /* @__PURE__ */ jsxs2("div", { className: "flex h-full min-h-0 flex-col bg-background", children: [
1112
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between gap-2 border-b border-border px-4 py-2", children: [
1113
- /* @__PURE__ */ jsx2("p", { className: "truncate font-mono text-xs text-muted-foreground", children: path }),
1114
- /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-2", children: [
1115
- /* @__PURE__ */ jsx2("span", { className: "rounded-full border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground", children: dirty ? "Unsaved changes" : "Saved" }),
1116
- /* @__PURE__ */ jsx2(
1442
+ return /* @__PURE__ */ jsxs3("div", { className: "flex h-full min-h-0 flex-col bg-background", children: [
1443
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-2 border-b border-border px-4 py-2", children: [
1444
+ /* @__PURE__ */ jsx3("p", { className: "truncate font-mono text-xs text-muted-foreground", children: path }),
1445
+ /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-2", children: [
1446
+ /* @__PURE__ */ jsx3("span", { className: "rounded-full border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground", children: dirty ? "Unsaved changes" : "Saved" }),
1447
+ /* @__PURE__ */ jsx3(
1117
1448
  "button",
1118
1449
  {
1119
1450
  type: "button",
@@ -1125,7 +1456,7 @@ function SourceEditor({
1125
1456
  )
1126
1457
  ] })
1127
1458
  ] }),
1128
- /* @__PURE__ */ jsx2(
1459
+ /* @__PURE__ */ jsx3(
1129
1460
  "textarea",
1130
1461
  {
1131
1462
  value: content,
@@ -1140,6 +1471,8 @@ function SourceEditor({
1140
1471
 
1141
1472
  export {
1142
1473
  ConfirmDialog,
1474
+ VAULT_TREE_CHILD_PAGE,
1475
+ VaultTree,
1143
1476
  VaultPane
1144
1477
  };
1145
- //# sourceMappingURL=chunk-DWUBICLW.js.map
1478
+ //# sourceMappingURL=chunk-UGPV7VEW.js.map