@openviking/react 0.1.2 → 0.1.4

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 (249) hide show
  1. package/LICENSE.arco-design +21 -0
  2. package/README.md +25 -15
  3. package/dist/0~0.js +19 -0
  4. package/dist/2~0.js +2360 -0
  5. package/dist/2~0.js.LICENSE.txt +23 -0
  6. package/dist/3c~0.js +2206 -0
  7. package/dist/3~0.js +1205 -1982
  8. package/dist/4~0.js +18 -0
  9. package/dist/9~0.js +43 -0
  10. package/dist/ae~0.js +487 -0
  11. package/dist/ark-message-list-view~0.js +530 -119
  12. package/dist/a~0.js +1289 -10
  13. package/dist/c7~0.js +38 -2
  14. package/dist/ck~0.js +23 -0
  15. package/dist/client/index.d.ts +2 -1
  16. package/dist/client/paths.d.ts +64 -0
  17. package/dist/client/provider.d.ts +5 -3
  18. package/dist/client/response.d.ts +31 -0
  19. package/dist/client/sse.d.ts +39 -0
  20. package/dist/client/stream.d.ts +26 -0
  21. package/dist/client/types.d.ts +109 -5
  22. package/dist/client.js +2 -239
  23. package/dist/components/agent-connect/agent-connect-copy.d.ts +19 -33
  24. package/dist/components/agent-connect/agent-connect-design.d.ts +1935 -167
  25. package/dist/components/agent-connect/agent-connect-instructions.d.ts +135 -0
  26. package/dist/components/agent-connect/locales/en-US.d.ts +20 -0
  27. package/dist/components/agent-connect/locales/zh-CN.d.ts +3 -0
  28. package/dist/components/agent-connect/style.css +14 -2
  29. package/dist/components/agent-connect/types.d.ts +2 -1
  30. package/dist/components/directory-tour/directory-tour.d.ts +3 -0
  31. package/dist/components/directory-tour/index.d.ts +3 -0
  32. package/dist/components/directory-tour/locales/en-US.d.ts +3 -0
  33. package/dist/components/directory-tour/locales/zh-CN.d.ts +3 -0
  34. package/dist/components/directory-tour/steps.d.ts +5 -0
  35. package/dist/components/directory-tour/style.css +237 -0
  36. package/dist/components/directory-tour/style.js +0 -0
  37. package/dist/components/directory-tour/types.d.ts +42 -0
  38. package/dist/components/directory-tour/use-tour-anchor.d.ts +5 -0
  39. package/dist/components/directory-tour/use-tour-position.d.ts +12 -0
  40. package/dist/components/directory-tour.js +40 -0
  41. package/dist/components/file-browser-entries/file-browser-entries-icons.d.ts +18 -0
  42. package/dist/components/file-browser-entries/file-browser-entries.d.ts +14 -0
  43. package/dist/components/file-browser-entries/index.d.ts +1 -0
  44. package/dist/components/file-browser-entries/labels.d.ts +3 -0
  45. package/dist/components/file-browser-entries/locales/en-US.d.ts +6 -0
  46. package/dist/components/file-browser-entries/locales/zh-CN.d.ts +6 -0
  47. package/dist/components/file-browser-entries/style.css +905 -0
  48. package/dist/components/file-browser-entries/style.js +0 -0
  49. package/dist/components/file-browser-entries/types.d.ts +63 -0
  50. package/dist/components/file-browser-entries.js +1 -0
  51. package/dist/components/file-preview/file-preview-adapters.d.ts +2 -1
  52. package/dist/components/file-preview/file-preview-body.d.ts +2 -1
  53. package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +2 -1
  54. package/dist/components/file-preview/file-preview-breadcrumb.d.ts +2 -1
  55. package/dist/components/file-preview/file-preview-directory.d.ts +33 -0
  56. package/dist/components/file-preview/file-preview-handle-adapters.d.ts +2 -1
  57. package/dist/components/file-preview/file-preview-header.d.ts +25 -3
  58. package/dist/components/file-preview/file-preview-image-frame.d.ts +5 -0
  59. package/dist/components/file-preview/file-preview-labels.d.ts +2 -14
  60. package/dist/components/file-preview/file-preview-level-tabs.d.ts +7 -0
  61. package/dist/components/file-preview/file-preview-markdown-images.d.ts +13 -0
  62. package/dist/components/file-preview/file-preview-panels.d.ts +44 -0
  63. package/dist/components/file-preview/file-preview-state.d.ts +10 -3
  64. package/dist/components/file-preview/file-preview-viewer.d.ts +2 -1
  65. package/dist/components/file-preview/file-preview.d.ts +1 -1
  66. package/dist/components/file-preview/index.d.ts +2 -1
  67. package/dist/components/file-preview/level-selection.d.ts +25 -0
  68. package/dist/components/file-preview/locales/en-US.d.ts +16 -0
  69. package/dist/components/file-preview/locales/zh-CN.d.ts +16 -0
  70. package/dist/components/file-preview/style.css +234 -3
  71. package/dist/components/file-preview/types.d.ts +134 -11
  72. package/dist/components/file-preview/use-directory-level.d.ts +30 -0
  73. package/dist/components/file-preview/use-file-preview-actions-context.d.ts +6 -2
  74. package/dist/components/file-preview/use-file-preview-actions.d.ts +1 -1
  75. package/dist/components/file-preview/use-file-preview-levels.d.ts +7 -0
  76. package/dist/components/file-preview/use-file-preview-view-state.d.ts +15 -0
  77. package/dist/components/file-preview.js +1 -1
  78. package/dist/components/file-tree/file-tree-info-labels.d.ts +0 -15
  79. package/dist/components/file-tree/file-tree-info-tooltip.d.ts +7 -7
  80. package/dist/components/file-tree/file-tree-labels.d.ts +4 -0
  81. package/dist/components/file-tree/file-tree-row-context.d.ts +0 -5
  82. package/dist/components/file-tree/file-tree-row-shared.d.ts +1 -4
  83. package/dist/components/file-tree/file-tree-toolbar.d.ts +11 -0
  84. package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +8 -8
  85. package/dist/components/file-tree/locales/en-US.d.ts +69 -0
  86. package/dist/components/file-tree/locales/zh-CN.d.ts +69 -0
  87. package/dist/components/file-tree/style.css +207 -42
  88. package/dist/components/file-tree/types.d.ts +58 -10
  89. package/dist/components/file-tree/use-file-tree-actions.d.ts +4 -1
  90. package/dist/components/scope-switcher/labels.d.ts +3 -0
  91. package/dist/components/scope-switcher/locales/en-US.d.ts +8 -0
  92. package/dist/components/scope-switcher/locales/zh-CN.d.ts +8 -0
  93. package/dist/components/scope-switcher/scope-panel.d.ts +1 -1
  94. package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
  95. package/dist/components/scope-switcher/style.css +14 -2
  96. package/dist/components/scope-switcher/types.d.ts +11 -5
  97. package/dist/components/style.css +10144 -6840
  98. package/dist/components/tui/locales/en-US.d.ts +35 -0
  99. package/dist/components/tui/locales/zh-CN.d.ts +35 -0
  100. package/dist/components/tui/style.css +310 -18
  101. package/dist/components/tui/tui-copy-button.d.ts +1 -1
  102. package/dist/components/tui/tui-empty.d.ts +25 -0
  103. package/dist/components/tui/tui-labels.d.ts +2 -2
  104. package/dist/components/tui/tui.d.ts +1 -1
  105. package/dist/components/tui/types.d.ts +35 -12
  106. package/dist/components/tui.js +1 -1
  107. package/dist/components/viking-bot/ark-adapter.d.ts +2 -0
  108. package/dist/components/viking-bot/ark-message-body.d.ts +1 -7
  109. package/dist/components/viking-bot/ark-message-list-view.d.ts +1 -1
  110. package/dist/components/viking-bot/ark-message-row.d.ts +3 -1
  111. package/dist/components/viking-bot/bot-popover.d.ts +9 -0
  112. package/dist/components/viking-bot/capabilities.d.ts +49 -0
  113. package/dist/components/viking-bot/composer-attachments.d.ts +13 -0
  114. package/dist/components/viking-bot/composer-controls.d.ts +10 -0
  115. package/dist/components/viking-bot/composer-footer.d.ts +17 -0
  116. package/dist/components/viking-bot/composer-references.d.ts +20 -0
  117. package/dist/components/viking-bot/composer-text.d.ts +10 -0
  118. package/dist/components/viking-bot/index.d.ts +3 -1
  119. package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +1 -1
  120. package/dist/components/viking-bot/interaction/labels.d.ts +2 -1
  121. package/dist/components/viking-bot/interaction/locales/en-US.d.ts +17 -0
  122. package/dist/components/viking-bot/interaction/locales/zh-CN.d.ts +17 -0
  123. package/dist/components/viking-bot/interaction/types.d.ts +8 -3
  124. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +1 -1
  125. package/dist/components/viking-bot/labels.d.ts +2 -0
  126. package/dist/components/viking-bot/locales/en-US.d.ts +40 -0
  127. package/dist/components/viking-bot/locales/zh-CN.d.ts +40 -0
  128. package/dist/components/viking-bot/markdown-links.d.ts +27 -0
  129. package/dist/components/viking-bot/message-activity.d.ts +7 -0
  130. package/dist/components/viking-bot/message-code-block.d.ts +8 -0
  131. package/dist/components/viking-bot/message-footer.d.ts +8 -0
  132. package/dist/components/viking-bot/message-markdown.d.ts +9 -0
  133. package/dist/components/viking-bot/model.d.ts +37 -3
  134. package/dist/components/viking-bot/quick-input-tracker.d.ts +16 -0
  135. package/dist/components/viking-bot/quick-inputs.d.ts +6 -0
  136. package/dist/components/viking-bot/reference-picker.d.ts +16 -0
  137. package/dist/components/viking-bot/session-actions.d.ts +11 -0
  138. package/dist/components/viking-bot/style.css +1486 -48
  139. package/dist/components/viking-bot/tool-activity.d.ts +9 -0
  140. package/dist/components/viking-bot/tool-result-links.d.ts +6 -0
  141. package/dist/components/viking-bot/types.d.ts +21 -9
  142. package/dist/components/viking-bot/use-quick-input.d.ts +17 -0
  143. package/dist/components/viking-bot/viking-bot.d.ts +1 -6
  144. package/dist/components/viking-bot/welcome.d.ts +8 -0
  145. package/dist/components/viking-bot.js +1 -1
  146. package/dist/c~0.js +533 -66
  147. package/dist/e~0.js +333 -0
  148. package/dist/file-preview-viewer~0.js +90 -8
  149. package/dist/f~0.js +39 -47
  150. package/dist/h~0.js +5 -1
  151. package/dist/icons/console-icons.d.ts +12 -0
  152. package/dist/icons/index.d.ts +2 -0
  153. package/dist/icons/viking-bot-icons.d.ts +6 -0
  154. package/dist/icons.js +1 -0
  155. package/dist/index.d.ts +4 -0
  156. package/dist/index.js +3 -1
  157. package/dist/k~0.js +1 -0
  158. package/dist/lg~0.js +155 -0
  159. package/dist/lk~0.js +37 -8
  160. package/dist/l~0.js +1447 -25
  161. package/dist/modules/console/command-messages.d.ts +19 -0
  162. package/dist/modules/console/command-parser.d.ts +15 -0
  163. package/dist/modules/console/command-specs.d.ts +15 -0
  164. package/dist/modules/console/commands.d.ts +6 -0
  165. package/dist/modules/console/console-history.d.ts +10 -0
  166. package/dist/modules/console/console-toolbar.d.ts +18 -0
  167. package/dist/modules/console/console.d.ts +1 -3
  168. package/dist/modules/console/controller.d.ts +17 -0
  169. package/dist/modules/console/index.d.ts +2 -0
  170. package/dist/modules/console/labels.d.ts +61 -0
  171. package/dist/modules/console/locales/en-US.d.ts +49 -0
  172. package/dist/modules/console/locales/zh-CN.d.ts +3 -0
  173. package/dist/modules/console/localize-records.d.ts +11 -0
  174. package/dist/modules/console/results.d.ts +2 -0
  175. package/dist/modules/console/style.css +10905 -15
  176. package/dist/modules/console/types.d.ts +59 -80
  177. package/dist/modules/console/use-console.d.ts +3 -0
  178. package/dist/modules/console.js +1 -1
  179. package/dist/modules/file-browser/file-browser-detail-icons.d.ts +10 -0
  180. package/dist/modules/file-browser/file-browser-detail.d.ts +34 -0
  181. package/dist/modules/file-browser/file-browser-empty.d.ts +3 -0
  182. package/dist/modules/file-browser/file-browser-failure.d.ts +22 -0
  183. package/dist/modules/file-browser/file-browser-icons.d.ts +18 -0
  184. package/dist/modules/file-browser/file-browser-labels.d.ts +27 -0
  185. package/dist/modules/file-browser/file-browser-layout.d.ts +27 -0
  186. package/dist/modules/file-browser/file-browser-toolbar.d.ts +17 -0
  187. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +32 -0
  188. package/dist/modules/file-browser/file-browser.d.ts +14 -5
  189. package/dist/modules/file-browser/find-result.d.ts +24 -0
  190. package/dist/modules/file-browser/fs-directories.d.ts +33 -0
  191. package/dist/modules/file-browser/fs-file-kind.d.ts +19 -0
  192. package/dist/modules/file-browser/fs-icon.d.ts +17 -0
  193. package/dist/modules/file-browser/fs-model.d.ts +106 -0
  194. package/dist/modules/file-browser/fs-page.d.ts +16 -0
  195. package/dist/modules/file-browser/fs-path.d.ts +16 -0
  196. package/dist/modules/file-browser/fs-read-directory.d.ts +16 -0
  197. package/dist/modules/file-browser/fs-scope.d.ts +22 -0
  198. package/dist/modules/file-browser/fs-stat.d.ts +25 -0
  199. package/dist/modules/file-browser/index.d.ts +3 -1
  200. package/dist/modules/file-browser/locales/en-US.d.ts +25 -0
  201. package/dist/modules/file-browser/locales/zh-CN.d.ts +25 -0
  202. package/dist/modules/file-browser/style.css +6388 -41
  203. package/dist/modules/file-browser/types.d.ts +206 -52
  204. package/dist/modules/file-browser/use-container-width.d.ts +17 -0
  205. package/dist/modules/file-browser/use-file-browser.d.ts +54 -0
  206. package/dist/modules/file-browser/use-fs-preview.d.ts +65 -0
  207. package/dist/modules/file-browser/use-fs-search.d.ts +35 -0
  208. package/dist/modules/file-browser/use-fs-tree.d.ts +43 -0
  209. package/dist/modules/file-browser/use-request-scope.d.ts +39 -0
  210. package/dist/modules/file-browser.js +1 -1
  211. package/dist/modules/scope-cascade/labels.d.ts +6 -0
  212. package/dist/modules/scope-cascade/locales/en-US.d.ts +6 -0
  213. package/dist/modules/scope-cascade/locales/zh-CN.d.ts +3 -0
  214. package/dist/modules/scope-cascade/scope-cascade.d.ts +1 -1
  215. package/dist/modules/scope-cascade/style.css +14 -2
  216. package/dist/modules/scope-cascade/types.d.ts +3 -0
  217. package/dist/modules/style.css +17338 -77
  218. package/dist/nx~0.js +15 -0
  219. package/dist/n~0.js +403 -144
  220. package/dist/o~0.js +106 -0
  221. package/dist/p~0.js +27 -0
  222. package/dist/rslib-runtime~0.js +42 -0
  223. package/dist/r~0.js +152 -0
  224. package/dist/shared/components/divider/divider.d.ts +18 -0
  225. package/dist/shared/components/divider/index.d.ts +1 -0
  226. package/dist/shared/components/divider/types.d.ts +35 -0
  227. package/dist/shared/components/drawer/drawer.d.ts +13 -0
  228. package/dist/shared/components/drawer/index.d.ts +1 -0
  229. package/dist/shared/components/overlay/types.d.ts +7 -0
  230. package/dist/shared/components/{tooltip/use-tooltip-position.d.ts → overlay/use-overlay-position.d.ts} +6 -6
  231. package/dist/shared/components/popover/index.d.ts +1 -0
  232. package/dist/shared/components/popover/popover.d.ts +23 -0
  233. package/dist/shared/components/popover/types.d.ts +50 -0
  234. package/dist/shared/components/resizable/clamp.d.ts +13 -0
  235. package/dist/shared/components/resizable/index.d.ts +2 -0
  236. package/dist/shared/components/resizable/resizable-handle.d.ts +25 -0
  237. package/dist/shared/components/resizable/types.d.ts +48 -0
  238. package/dist/shared/components/tooltip/types.d.ts +5 -5
  239. package/dist/shared/components/tooltip/use-portal-theme.d.ts +3 -0
  240. package/dist/shared/locale.d.ts +6 -0
  241. package/dist/style.css +27753 -7176
  242. package/dist/u~0.js +75 -58
  243. package/dist/viking-bot-composer~0.js +434 -77
  244. package/dist/viking-bot-interaction~0.js +11 -11
  245. package/package.json +18 -4
  246. package/dist/components/file-tree/file-tree-tooltip.d.ts +0 -17
  247. package/dist/components/tui/tui-labels-zh.d.ts +0 -2
  248. package/dist/g~0.js +0 -1207
  249. package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +0 -10
package/dist/l~0.js CHANGED
@@ -1,44 +1,1466 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- function FileBrowserToolbarButton({ icon, children, onClick, disabled, className, ...rest }) {
3
- return /*#__PURE__*/ jsxs("button", {
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
3
+ import { FilePreview as file_preview_FilePreview } from "./3~0.js";
4
+ import { Tooltip } from "./r~0.js";
5
+ import { getFileTypeColor, resolveFileTypeIconKey, FolderIcon, getFileTypeIcon } from "./k~0.js";
6
+ import { FileBrowserEntries } from "./2~0.js";
7
+ import { FileTree as file_tree_FileTree } from "./n~0.js";
8
+ import { resolveLocale } from "./nx~0.js";
9
+ import { OV_PATHS } from "./ck~0.js";
10
+ import { useOvClient } from "./ae~0.js";
11
+ function clampResizableWidth(width, min, max) {
12
+ const rounded = Math.round(width);
13
+ const lower = Math.max(min, rounded);
14
+ return Math.min(Math.max(min, max), lower);
15
+ }
16
+ function ResizableHandle({ label, min, max, value, step = 16, direction = 1, onResize, className, ...rest }) {
17
+ const dragRef = useRef(null);
18
+ const [dragging, setDragging] = useState(false);
19
+ const endDrag = (event)=>{
20
+ if (!dragRef.current) return;
21
+ dragRef.current = null;
22
+ setDragging(false);
23
+ if (event.currentTarget.hasPointerCapture(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);
24
+ };
25
+ const handlePointerDown = (event)=>{
26
+ if (!onResize) return;
27
+ if (0 !== event.button) return;
28
+ event.preventDefault();
29
+ event.currentTarget.setPointerCapture(event.pointerId);
30
+ dragRef.current = {
31
+ pointerId: event.pointerId,
32
+ x: event.clientX,
33
+ width: value
34
+ };
35
+ setDragging(true);
36
+ };
37
+ const handlePointerMove = (event)=>{
38
+ const drag = dragRef.current;
39
+ if (!drag || !onResize || drag.pointerId !== event.pointerId) return;
40
+ onResize(clampResizableWidth(drag.width + (event.clientX - drag.x) * direction, min, max));
41
+ };
42
+ const handleKeyDown = (event)=>{
43
+ if (!onResize) return;
44
+ if ('ArrowLeft' !== event.key && 'ArrowRight' !== event.key) return;
45
+ event.preventDefault();
46
+ const delta = ('ArrowRight' === event.key ? step : -step) * direction;
47
+ onResize(clampResizableWidth(value + delta, min, max));
48
+ };
49
+ return /*#__PURE__*/ jsx("div", {
4
50
  ...rest,
5
- type: "button",
6
- disabled: disabled,
51
+ role: "separator",
52
+ tabIndex: onResize ? 0 : void 0,
53
+ "aria-label": label,
54
+ "aria-orientation": "vertical",
55
+ "aria-valuemin": min,
56
+ "aria-valuemax": max,
57
+ "aria-valuenow": Math.round(value),
58
+ "data-dragging": dragging || void 0,
7
59
  className: [
8
- 'ov-file-browser__toolbar-button',
60
+ 'ov-resizable-handle',
9
61
  className
10
62
  ].filter(Boolean).join(' '),
11
- onClick: onClick,
63
+ onPointerDown: handlePointerDown,
64
+ onPointerMove: handlePointerMove,
65
+ onPointerUp: endDrag,
66
+ onPointerCancel: endDrag,
67
+ onKeyDown: handleKeyDown,
68
+ children: /*#__PURE__*/ jsx("span", {
69
+ "aria-hidden": "true",
70
+ className: "ov-resizable-handle__line"
71
+ })
72
+ });
73
+ }
74
+ const SIZE = 14;
75
+ function iconProps(size = SIZE) {
76
+ return {
77
+ width: size,
78
+ height: size,
79
+ viewBox: '0 0 16 16',
80
+ fill: 'none',
81
+ stroke: 'currentColor',
82
+ strokeWidth: 1.4,
83
+ strokeLinecap: 'round',
84
+ strokeLinejoin: 'round',
85
+ 'aria-hidden': true,
86
+ focusable: 'false'
87
+ };
88
+ }
89
+ function CopyIcon({ size = 12 }) {
90
+ return /*#__PURE__*/ jsxs("svg", {
91
+ ...iconProps(size),
92
+ children: [
93
+ /*#__PURE__*/ jsx("rect", {
94
+ x: "5.5",
95
+ y: "5.5",
96
+ width: "8",
97
+ height: "8",
98
+ rx: "1.5"
99
+ }),
100
+ /*#__PURE__*/ jsx("path", {
101
+ d: "M10.5 5.5v-1a1.5 1.5 0 0 0-1.5-1.5H4a1.5 1.5 0 0 0-1.5 1.5v5A1.5 1.5 0 0 0 4 11h1"
102
+ })
103
+ ]
104
+ });
105
+ }
106
+ function DownloadIcon() {
107
+ return /*#__PURE__*/ jsxs("svg", {
108
+ ...iconProps(),
12
109
  children: [
13
- /*#__PURE__*/ jsx("span", {
14
- className: "ov-file-browser__toolbar-button-icon",
15
- "aria-hidden": "true",
16
- children: icon
17
- }),
18
- /*#__PURE__*/ jsx("span", {
19
- className: "ov-file-browser__toolbar-button-label",
20
- children: children
110
+ /*#__PURE__*/ jsx("path", {
111
+ d: "M8 2.5v8"
112
+ }),
113
+ /*#__PURE__*/ jsx("path", {
114
+ d: "M5 7.5 8 10.5l3-3"
115
+ }),
116
+ /*#__PURE__*/ jsx("path", {
117
+ d: "M2.5 12.5h11"
21
118
  })
22
119
  ]
23
120
  });
24
121
  }
25
- function FileBrowser({ className, style, labels }) {
122
+ function FileBrowserDetail({ tabs, activeKey, locale, labels, footer, viewLabels, onActiveKeyChange }) {
123
+ return /*#__PURE__*/ jsx("div", {
124
+ className: "ov-file-browser__detail",
125
+ children: /*#__PURE__*/ jsx(file_preview_FilePreview, {
126
+ tabs: decorateTabs(tabs, viewLabels, footer),
127
+ activeKey: activeKey ?? void 0,
128
+ locale: locale,
129
+ labels: labels,
130
+ onActiveKeyChange: onActiveKeyChange
131
+ })
132
+ });
133
+ }
134
+ function decorateTabs(tabs, viewLabels, footer) {
135
+ return tabs.map((tab)=>{
136
+ if ('content' === tab.kind) return tab;
137
+ return {
138
+ ...tab,
139
+ slots: {
140
+ ...tab.slots,
141
+ footer,
142
+ actions: (actions)=>/*#__PURE__*/ jsxs("div", {
143
+ className: "ov-file-browser__detail-actions",
144
+ children: [
145
+ actions.canSwitchView ? /*#__PURE__*/ jsxs("div", {
146
+ className: "ov-file-browser__segmented",
147
+ role: "group",
148
+ "aria-label": viewLabels.viewSwitch,
149
+ children: [
150
+ /*#__PURE__*/ jsx("button", {
151
+ type: "button",
152
+ className: "ov-file-browser__segment",
153
+ "data-active": 'preview' === actions.viewMode || void 0,
154
+ onClick: ()=>actions.setViewMode('preview'),
155
+ children: viewLabels.preview
156
+ }),
157
+ /*#__PURE__*/ jsx("button", {
158
+ type: "button",
159
+ className: "ov-file-browser__segment",
160
+ "data-active": 'source' === actions.viewMode || void 0,
161
+ onClick: ()=>actions.setViewMode('source'),
162
+ children: viewLabels.source
163
+ })
164
+ ]
165
+ }) : null,
166
+ actions.canCopyContent || actions.canDownload ? /*#__PURE__*/ jsx("span", {
167
+ "aria-hidden": "true",
168
+ className: "ov-file-browser__detail-sep"
169
+ }) : null,
170
+ actions.canCopyContent ? /*#__PURE__*/ jsx("button", {
171
+ type: "button",
172
+ className: "ov-file-browser__detail-icon",
173
+ "aria-label": viewLabels.copyContent,
174
+ title: viewLabels.copyContent,
175
+ onClick: ()=>void actions.copyContent(),
176
+ children: /*#__PURE__*/ jsx(CopyIcon, {})
177
+ }) : null,
178
+ actions.canDownload ? /*#__PURE__*/ jsx("button", {
179
+ type: "button",
180
+ className: "ov-file-browser__detail-icon",
181
+ "aria-label": viewLabels.download,
182
+ title: viewLabels.download,
183
+ onClick: ()=>actions.download(),
184
+ children: /*#__PURE__*/ jsx(DownloadIcon, {})
185
+ }) : null
186
+ ]
187
+ })
188
+ }
189
+ };
190
+ });
191
+ }
192
+ const empty_state_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgQAAAEYCAYAAAAj/u7rAAAlNElEQVR42u2dX2gk15WHDYIBwYBgQDAgEAgEgoEBgWHAEDD4aWFesmTBL1kIO1mWQGDA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KboMGsGOIBd0GSAEMBLtYiYhiKKY3R2ZxMglQoAQIAQIwTILwRFCwCQ2p7nUHhnkcjoh0JhILhACaghgLIkKqCFg3ZtcVrSGIL4myAU1BAAAAECXAQAAACAEAAAAgBAsaw2B1sTbMTUE46Jche14jXXagmoyomRNa9+dTmeFfBSQy4hcTlsjJMhFdg3BoueHA0mXQfFdBo1gJ2rTZVAEzVa4SWV8gbk8DnYQ/MnReEiXAV0GCAH5QAgQAoQAIUAIEAKEgHwgBDMVAiYxhAAhQAgQgtkRx51VyQBrZjl6vVMRUM4YdIvr+9Z20OzrUEwuJazkcnJ0bXODNLyGoJufIF5HCAAAAIAuAwAAAEAIAAAAACFgHwIwdRfJqnLGPgT0zpNL9iFgHwKEgC6DJS86Us4YNIqh1Qo3j6iMLy6XDXJJlwFdBggBQoAQIATLnUsv3EAIEAKEACFACBAChAAhQAgQAoQAIZgM7Q7X8tobYcTkNvY+BOqbT3OmWgLyUYxgSQronS8gl0F7XVJALqeRqvaGIBfZQqDcLPINJAcSAAAAEAIAAABACAAAAAAhGNVX2llRARJrjvnW0ZQz9iEoaF+H9NxTPumdJ5dzUVeV5o+izOrmh4NIlwFdBnNdxBV1K+Mp0iymIE7nJrmky4AuA4SALgO6DBa0Mr69kSQJT1zIJV0GdBkgBAAAAIAQAAAAAEIAAAAAZfP/TtCG1/0dD6wAAAAASUVORK5CYII=";
193
+ function FileBrowserEmpty({ label }) {
26
194
  return /*#__PURE__*/ jsxs("div", {
195
+ className: "ov-file-browser__empty",
196
+ children: [
197
+ /*#__PURE__*/ jsx("img", {
198
+ className: "ov-file-browser__empty-art",
199
+ src: empty_state_namespaceObject,
200
+ alt: "",
201
+ "aria-hidden": "true"
202
+ }),
203
+ /*#__PURE__*/ jsx("p", {
204
+ className: "ov-file-browser__empty-label",
205
+ children: label
206
+ })
207
+ ]
208
+ });
209
+ }
210
+ function FileBrowserFailure({ message, detail, retryLabel, onRetry }) {
211
+ return /*#__PURE__*/ jsxs("div", {
212
+ className: "ov-file-browser__failure",
213
+ role: "alert",
214
+ children: [
215
+ /*#__PURE__*/ jsx("p", {
216
+ className: "ov-file-browser__failure-title",
217
+ children: message
218
+ }),
219
+ detail ? /*#__PURE__*/ jsx("p", {
220
+ className: "ov-file-browser__failure-detail",
221
+ children: detail
222
+ }) : null,
223
+ /*#__PURE__*/ jsx("button", {
224
+ type: "button",
225
+ className: "ov-file-browser__failure-retry",
226
+ onClick: onRetry,
227
+ children: retryLabel
228
+ })
229
+ ]
230
+ });
231
+ }
232
+ const TREE_MIN_WIDTH = 200;
233
+ const DETAIL_MIN_WIDTH = 320;
234
+ const RESIZE_FOOTPRINT = 24;
235
+ const TREE_MAX_WIDTH = 520;
236
+ function resolveTreeMaxWidth(containerWidth) {
237
+ if (!containerWidth) return TREE_MAX_WIDTH;
238
+ return Math.max(TREE_MIN_WIDTH, Math.min(TREE_MAX_WIDTH, containerWidth - DETAIL_MIN_WIDTH - RESIZE_FOOTPRINT));
239
+ }
240
+ const file_browser_icons_SIZE = 16;
241
+ const strokeProps = {
242
+ width: file_browser_icons_SIZE,
243
+ height: file_browser_icons_SIZE,
244
+ viewBox: '0 0 48 48',
245
+ fill: 'none',
246
+ stroke: 'currentColor',
247
+ strokeWidth: 4,
248
+ 'aria-hidden': true,
249
+ focusable: 'false'
250
+ };
251
+ function SearchIcon() {
252
+ return /*#__PURE__*/ jsx("svg", {
253
+ ...strokeProps,
254
+ children: /*#__PURE__*/ jsx("path", {
255
+ d: "M33.072 33.071c6.248-6.248 6.248-16.379 0-22.627-6.249-6.249-16.38-6.249-22.628 0-6.248 6.248-6.248 16.379 0 22.627 6.248 6.248 16.38 6.248 22.628 0Zm0 0 8.485 8.485"
256
+ })
257
+ });
258
+ }
259
+ function RefreshIcon() {
260
+ return /*#__PURE__*/ jsx("svg", {
261
+ ...strokeProps,
262
+ children: /*#__PURE__*/ jsx("path", {
263
+ d: "M38.837 18C36.463 12.136 30.715 8 24 8 15.163 8 8 15.163 8 24s7.163 16 16 16c7.455 0 13.72-5.1 15.496-12M40 8v10H30"
264
+ })
265
+ });
266
+ }
267
+ function FileBrowserToolbar({ searchId, query, refreshing, canRefresh, placeholder, refreshLabel, onQueryChange, onRefresh }) {
268
+ return /*#__PURE__*/ jsxs("div", {
269
+ className: "ov-file-browser__toolbar",
270
+ children: [
271
+ /*#__PURE__*/ jsxs("label", {
272
+ className: "ov-file-browser__search",
273
+ htmlFor: searchId,
274
+ children: [
275
+ /*#__PURE__*/ jsx("span", {
276
+ className: "ov-file-browser__search-icon",
277
+ children: /*#__PURE__*/ jsx(SearchIcon, {})
278
+ }),
279
+ /*#__PURE__*/ jsx("input", {
280
+ id: searchId,
281
+ type: "search",
282
+ className: "ov-file-browser__search-input",
283
+ placeholder: placeholder,
284
+ value: query,
285
+ onChange: (event)=>onQueryChange(event.target.value)
286
+ })
287
+ ]
288
+ }),
289
+ /*#__PURE__*/ jsx(Tooltip, {
290
+ content: refreshLabel,
291
+ children: /*#__PURE__*/ jsx("button", {
292
+ type: "button",
293
+ className: [
294
+ 'ov-file-browser__refresh',
295
+ refreshing ? 'ov-file-browser__refresh--spinning' : ''
296
+ ].filter(Boolean).join(' '),
297
+ "aria-label": refreshLabel,
298
+ disabled: !canRefresh,
299
+ onClick: onRefresh,
300
+ children: /*#__PURE__*/ jsx(RefreshIcon, {})
301
+ })
302
+ })
303
+ ]
304
+ });
305
+ }
306
+ function fileTypeIcon(name) {
307
+ const Icon = getFileTypeIcon(name);
308
+ const key = resolveFileTypeIconKey(name);
309
+ return /*#__PURE__*/ jsx(Icon, {
310
+ className: "ov-file-tree__file-type-icon",
311
+ style: {
312
+ '--ov-file-tree-icon-light': getFileTypeColor(key, 'light'),
313
+ '--ov-file-tree-icon-dark': getFileTypeColor(key, 'dark')
314
+ }
315
+ });
316
+ }
317
+ function directoryIcon() {
318
+ return /*#__PURE__*/ jsx(FolderIcon, {
319
+ className: "ov-file-tree__file-type-icon"
320
+ });
321
+ }
322
+ function FileBrowserTreePane({ entries, locale, searchId, browser, treeLabels, searchPlaceholder, refreshLabel, searchLoading, searchEmpty, searchErrorLabel, retryLabel }) {
323
+ return /*#__PURE__*/ jsxs(Fragment, {
324
+ children: [
325
+ /*#__PURE__*/ jsx(FileBrowserEntries, {
326
+ ...entries,
327
+ locale: locale,
328
+ className: "ov-file-browser__entries"
329
+ }),
330
+ /*#__PURE__*/ jsx(FileBrowserToolbar, {
331
+ searchId: searchId,
332
+ query: browser.query,
333
+ refreshing: browser.refreshing,
334
+ canRefresh: browser.isReady,
335
+ placeholder: searchPlaceholder,
336
+ refreshLabel: refreshLabel,
337
+ onQueryChange: browser.actions.setQuery,
338
+ onRefresh: ()=>void browser.actions.refresh()
339
+ }),
340
+ /*#__PURE__*/ jsx("div", {
341
+ className: "ov-file-browser__tree-scroll",
342
+ children: /*#__PURE__*/ jsx(file_tree_FileTree, {
343
+ locale: locale,
344
+ rows: browser.rows,
345
+ selectedId: browser.selectedId,
346
+ isReady: browser.isReady,
347
+ labels: treeLabels,
348
+ emptyFallback: browser.searching ? browser.searchError ? /*#__PURE__*/ jsxs("div", {
349
+ className: "ov-file-browser__hint ov-file-browser__hint--error",
350
+ children: [
351
+ /*#__PURE__*/ jsx("p", {
352
+ className: "ov-file-browser__failure-title",
353
+ children: searchErrorLabel
354
+ }),
355
+ /*#__PURE__*/ jsx("p", {
356
+ className: "ov-file-browser__failure-detail",
357
+ children: browser.searchError.message
358
+ }),
359
+ /*#__PURE__*/ jsx("button", {
360
+ type: "button",
361
+ className: "ov-file-browser__retry",
362
+ onClick: ()=>void browser.actions.refresh(),
363
+ children: retryLabel
364
+ })
365
+ ]
366
+ }) : /*#__PURE__*/ jsx("p", {
367
+ className: "ov-file-browser__hint",
368
+ children: browser.searchLoading ? searchLoading : searchEmpty
369
+ }) : void 0,
370
+ renderRowIcon: (row)=>fileTypeIcon(row.name),
371
+ operations: {
372
+ select: browser.actions.select,
373
+ toggleExpand: browser.actions.toggleExpand,
374
+ loadMore: browser.actions.loadMore,
375
+ retry: browser.actions.retry
376
+ }
377
+ })
378
+ })
379
+ ]
380
+ });
381
+ }
382
+ const messages = {
383
+ formatCharacterCount: (count)=>`${count.toLocaleString('en-US')} ${1 === count ? 'character' : 'characters'}`,
384
+ empty: 'Select a file to preview',
385
+ error: 'Failed to load the directory',
386
+ retry: 'Retry',
387
+ refresh: 'Refresh',
388
+ searchPlaceholder: 'Search files ⌘+K...',
389
+ searchEmpty: 'No matching resources',
390
+ searchFailed: 'Failed to run the search',
391
+ loading: 'Loading…',
392
+ searchLoading: 'Searching…',
393
+ previewMode: 'Preview',
394
+ sourceMode: 'Source',
395
+ copyPath: 'Copy path',
396
+ copyContent: 'Copy content',
397
+ download: 'Download',
398
+ history: 'Version history',
399
+ viewSwitch: 'Switch view',
400
+ resizeTree: 'Resize the directory tree',
401
+ l0Summary: 'L0 Summary',
402
+ l1Overview: 'L1 Overview',
403
+ summaryEmpty: 'No summary generated yet',
404
+ summaryFailed: 'The summary could not be loaded.'
405
+ };
406
+ const en_US = messages;
407
+ const zh_CN_messages = {
408
+ formatCharacterCount: (count)=>`${count.toLocaleString('zh-CN')} 个字符`,
409
+ empty: '选择一个文件查看内容',
410
+ error: '目录加载失败',
411
+ retry: '重试',
412
+ refresh: '刷新',
413
+ searchPlaceholder: '搜索文件 ⌘+K...',
414
+ searchEmpty: '没有匹配的资源',
415
+ searchFailed: '搜索失败',
416
+ loading: '加载中…',
417
+ searchLoading: '搜索中…',
418
+ previewMode: '预览',
419
+ sourceMode: '源码',
420
+ copyPath: '复制路径',
421
+ copyContent: '复制正文',
422
+ download: '下载',
423
+ history: '版本历史',
424
+ viewSwitch: '切换视图',
425
+ resizeTree: '调整目录树宽度',
426
+ l0Summary: 'L0 摘要',
427
+ l1Overview: 'L1 总览',
428
+ summaryEmpty: '暂无生成内容',
429
+ summaryFailed: '摘要加载失败。'
430
+ };
431
+ const zh_CN = zh_CN_messages;
432
+ const LOCALES = {
433
+ 'en-US': en_US,
434
+ 'zh-CN': zh_CN
435
+ };
436
+ function resolveLabels(labels, locale) {
437
+ return {
438
+ ...resolveLocale(LOCALES, locale, labels),
439
+ tree: labels?.tree,
440
+ previewLabels: labels?.preview
441
+ };
442
+ }
443
+ function resolvePreviewLabels(text) {
444
+ return {
445
+ loading: text.loading,
446
+ copyPath: text.copyPath,
447
+ download: text.download,
448
+ ...text.previewLabels
449
+ };
450
+ }
451
+ function resolveSummaryLabels(locale, labels) {
452
+ const text = resolveLabels(labels, locale);
453
+ return {
454
+ l0: text.l0Summary,
455
+ l1: text.l1Overview,
456
+ failure: text.summaryFailed
457
+ };
458
+ }
459
+ function useContainerWidth() {
460
+ const ref = useRef(null);
461
+ const [width, setWidth] = useState(0);
462
+ useEffect(()=>{
463
+ const element = ref.current;
464
+ if (!element) return;
465
+ const update = (next)=>setWidth((current)=>current === next ? current : next);
466
+ update(Math.round(element.getBoundingClientRect().width));
467
+ const observer = new ResizeObserver(([entry])=>{
468
+ if (entry) update(Math.round(entry.contentRect.width));
469
+ });
470
+ observer.observe(element);
471
+ return ()=>observer.disconnect();
472
+ }, []);
473
+ return {
474
+ ref,
475
+ width
476
+ };
477
+ }
478
+ const emptyDir = ()=>({
479
+ entries: [],
480
+ hasMore: false,
481
+ loading: false,
482
+ error: null
483
+ });
484
+ function mergePage(current, page, offset) {
485
+ const previous = current ?? emptyDir();
486
+ return {
487
+ entries: 0 === offset ? page.entries : [
488
+ ...previous.entries,
489
+ ...page.entries
490
+ ],
491
+ hasMore: page.hasMore,
492
+ loading: false,
493
+ error: null
494
+ };
495
+ }
496
+ function nameFromUri(uri) {
497
+ const trimmed = uri.replace(/\/+$/, '');
498
+ const index = trimmed.lastIndexOf('/');
499
+ const name = index < 0 ? trimmed : trimmed.slice(index + 1);
500
+ return name || trimmed;
501
+ }
502
+ function toEntryRow(entry, depth, expanded, index, busy) {
503
+ const isDir = true === entry.isDir;
504
+ return {
505
+ kind: 'entry',
506
+ id: void 0 === index ? entry.uri : `${entry.uri}#${index}`,
507
+ depth,
508
+ uri: entry.uri,
509
+ name: nameFromUri(entry.uri),
510
+ type: isDir ? 'directory' : 'file',
511
+ expanded: isDir ? expanded : void 0,
512
+ busy: busy || void 0
513
+ };
514
+ }
515
+ function toFileTab(entry, content, maxLines, icon, openParent) {
516
+ const name = nameFromUri(entry.uri);
517
+ return {
518
+ kind: 'file',
519
+ key: entry.uri,
520
+ title: name,
521
+ icon,
522
+ operations: {
523
+ openParent
524
+ },
525
+ source: {
526
+ content,
527
+ fileName: name,
528
+ path: entry.uri,
529
+ truncated: content.split('\n').length >= maxLines
530
+ }
531
+ };
532
+ }
533
+ function toDirectoryTab(uri, summary, labels, openParent, icon) {
534
+ const name = nameFromUri(uri);
535
+ const levelBody = (body, failure)=>void 0 === failure ? body : `> ${failure || labels.failure}`;
536
+ return {
537
+ kind: 'directory',
538
+ key: uri,
539
+ title: name,
540
+ icon,
541
+ levels: [
542
+ {
543
+ key: 'l0',
544
+ label: labels.l0,
545
+ source: {
546
+ content: levelBody(summary.abstract, summary.abstractError),
547
+ fileName: `${name}.md`,
548
+ path: uri,
549
+ fileType: 'markdown'
550
+ }
551
+ },
552
+ {
553
+ key: 'l1',
554
+ label: labels.l1,
555
+ source: {
556
+ content: levelBody(summary.overview, summary.overviewError),
557
+ fileName: `${name}.md`,
558
+ path: uri,
559
+ fileType: 'markdown'
560
+ }
561
+ }
562
+ ],
563
+ operations: {
564
+ openParent
565
+ }
566
+ };
567
+ }
568
+ function flattenTree(uri, depth, dirs, expanded) {
569
+ const dir = dirs[uri];
570
+ if (!dir) return [];
571
+ const rows = [];
572
+ for (const entry of dir.entries){
573
+ const isOpen = expanded.has(entry.uri);
574
+ const loadingChildren = isOpen && dirs[entry.uri]?.loading === true;
575
+ rows.push(toEntryRow(entry, depth, isOpen, void 0, loadingChildren));
576
+ if (isOpen) {
577
+ const children = flattenTree(entry.uri, depth + 1, dirs, expanded);
578
+ if (children.length > 0) rows.push(...children);
579
+ else if (loadingChildren) rows.push({
580
+ kind: 'loading',
581
+ id: `${entry.uri}::loading`,
582
+ depth: depth + 1,
583
+ parentId: entry.uri
584
+ });
585
+ else rows.push({
586
+ kind: 'empty',
587
+ id: `${entry.uri}::empty`,
588
+ depth: depth + 1,
589
+ parentId: entry.uri
590
+ });
591
+ }
592
+ }
593
+ if (dir.error) rows.push({
594
+ kind: 'error',
595
+ id: `${uri}::error`,
596
+ depth,
597
+ parentId: uri
598
+ });
599
+ else if (dir.hasMore) rows.push({
600
+ kind: 'load-more',
601
+ id: `${uri}::more`,
602
+ depth,
603
+ parentId: uri,
604
+ loading: dir.loading
605
+ });
606
+ return rows;
607
+ }
608
+ function isAbort(error) {
609
+ return 'object' == typeof error && null !== error && 'AbortError' === error.name;
610
+ }
611
+ function toError(cause) {
612
+ return cause instanceof Error ? cause : new Error(String(cause));
613
+ }
614
+ const BINARY_EXTENSIONS = new Set([
615
+ 'png',
616
+ 'jpg',
617
+ 'jpeg',
618
+ 'gif',
619
+ 'webp',
620
+ 'avif',
621
+ 'bmp',
622
+ 'ico',
623
+ 'svg',
624
+ 'pdf',
625
+ 'doc',
626
+ 'docx',
627
+ 'ppt',
628
+ 'pptx',
629
+ 'xls',
630
+ 'xlsx',
631
+ 'mp4',
632
+ 'webm',
633
+ 'mov',
634
+ 'mp3',
635
+ 'wav',
636
+ 'ogg',
637
+ 'm4a',
638
+ 'zip',
639
+ 'gz',
640
+ 'tar',
641
+ 'ovpack'
642
+ ]);
643
+ function isBinaryFile(name) {
644
+ const dot = name.lastIndexOf('.');
645
+ if (dot < 0 || dot === name.length - 1) return false;
646
+ return BINARY_EXTENSIONS.has(name.slice(dot + 1).toLowerCase());
647
+ }
648
+ const MIME_BY_EXTENSION = {
649
+ png: 'image/png',
650
+ jpg: 'image/jpeg',
651
+ jpeg: 'image/jpeg',
652
+ gif: 'image/gif',
653
+ webp: 'image/webp',
654
+ avif: 'image/avif',
655
+ bmp: 'image/bmp',
656
+ ico: 'image/x-icon',
657
+ svg: 'image/svg+xml',
658
+ pdf: 'application/pdf',
659
+ doc: 'application/msword',
660
+ docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
661
+ ppt: 'application/vnd.ms-powerpoint',
662
+ pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
663
+ xls: 'application/vnd.ms-excel',
664
+ xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
665
+ mp4: 'video/mp4',
666
+ webm: 'video/webm',
667
+ mov: 'video/quicktime',
668
+ mp3: 'audio/mpeg',
669
+ wav: 'audio/wav',
670
+ ogg: 'audio/ogg',
671
+ m4a: 'audio/mp4',
672
+ zip: 'application/zip',
673
+ gz: 'application/gzip',
674
+ tar: 'application/x-tar'
675
+ };
676
+ function mimeTypeOf(name) {
677
+ const dot = name.lastIndexOf('.');
678
+ if (dot < 0) return 'application/octet-stream';
679
+ return MIME_BY_EXTENSION[name.slice(dot + 1).toLowerCase()] ?? 'application/octet-stream';
680
+ }
681
+ function toBinaryTab(uri, name, file, icon, openParent) {
682
+ return {
683
+ kind: 'file',
684
+ key: uri,
685
+ title: name,
686
+ icon,
687
+ operations: {
688
+ openParent
689
+ },
690
+ source: {
691
+ file,
692
+ fileName: name,
693
+ path: uri
694
+ }
695
+ };
696
+ }
697
+ async function readDirectory(client, uri, options) {
698
+ const read = (path)=>client.request({
699
+ method: 'GET',
700
+ path,
701
+ query: {
702
+ uri
703
+ },
704
+ options
705
+ }).then((value)=>({
706
+ ok: true,
707
+ text: 'string' == typeof value ? value : ''
708
+ })).catch((cause)=>({
709
+ ok: false,
710
+ cause
711
+ }));
712
+ const [abstractResult, overviewResult] = await Promise.all([
713
+ read(OV_PATHS.contentAbstract),
714
+ read(OV_PATHS.contentOverview)
715
+ ]);
716
+ const aborted = [
717
+ abstractResult,
718
+ overviewResult
719
+ ].find((result)=>!result.ok && isAbort(result.cause));
720
+ if (aborted && !aborted.ok) throw aborted.cause;
721
+ if (!abstractResult.ok && !overviewResult.ok) throw abstractResult.cause;
722
+ const reason = (result)=>result.ok ? void 0 : result.cause instanceof Error ? result.cause.message : String(result.cause);
723
+ return {
724
+ abstract: abstractResult.ok ? abstractResult.text : '',
725
+ overview: overviewResult.ok ? overviewResult.text : '',
726
+ abstractError: reason(abstractResult),
727
+ overviewError: reason(overviewResult)
728
+ };
729
+ }
730
+ async function resolveIsDirectory(client, uri, options) {
731
+ try {
732
+ const result = await client.request({
733
+ method: 'GET',
734
+ path: OV_PATHS.fsStat,
735
+ query: {
736
+ uri
737
+ },
738
+ options
739
+ });
740
+ return result?.isDir === true || result?.is_dir === true;
741
+ } catch {
742
+ return false;
743
+ }
744
+ }
745
+ function abortError() {
746
+ const error = new Error('Aborted');
747
+ error.name = 'AbortError';
748
+ return error;
749
+ }
750
+ const MAX_LINES = 2000;
751
+ function useFsPreview({ client, uri, resourceType = 'file', labels = resolveSummaryLabels('en-US'), formatCharacterCount = resolveLabels(void 0, 'en-US').formatCharacterCount, openParent, generation = 0, requestOptions }) {
752
+ const [directory, setDirectory] = useState(null);
753
+ const [tabs, setTabs] = useState(null);
754
+ const [activeKey, setActiveKey] = useState(null);
755
+ const [error, setError] = useState(null);
756
+ const [characterCount, setCharacterCount] = useState();
757
+ useEffect(()=>{
758
+ setDirectory(null);
759
+ if (!client || !uri) {
760
+ setTabs(null);
761
+ setActiveKey(null);
762
+ setError(null);
763
+ setCharacterCount(void 0);
764
+ return;
765
+ }
766
+ const controller = new AbortController();
767
+ setTabs([
768
+ loadingTab(uri, 'file' !== resourceType)
769
+ ]);
770
+ setActiveKey(uri);
771
+ setActiveKey(null);
772
+ setError(null);
773
+ setCharacterCount(void 0);
774
+ const options = {
775
+ ...requestOptions,
776
+ signal: controller.signal
777
+ };
778
+ const read = (async ()=>{
779
+ const isDir = 'unknown' === resourceType ? await resolveIsDirectory(client, uri, options) : 'directory' === resourceType;
780
+ if (controller.signal.aborted) throw abortError();
781
+ return isDir ? {
782
+ summary: await readDirectory(client, uri, options)
783
+ } : {
784
+ tab: await readFile(client, uri, options, openParent)
785
+ };
786
+ })();
787
+ read.then((result)=>{
788
+ if (controller.signal.aborted) return;
789
+ if (result.summary) {
790
+ setDirectory({
791
+ uri,
792
+ summary: result.summary
793
+ });
794
+ setActiveKey(uri);
795
+ return;
796
+ }
797
+ const tab = result.tab;
798
+ setTabs([
799
+ tab
800
+ ]);
801
+ setActiveKey(tab.key);
802
+ const body = tab.source.content ?? '';
803
+ setCharacterCount(body.length);
804
+ }, (cause)=>{
805
+ if (isAbort(cause) || controller.signal.aborted) return;
806
+ setTabs([]);
807
+ setError(cause instanceof Error ? cause : new Error(String(cause)));
808
+ });
809
+ return ()=>controller.abort();
810
+ }, [
811
+ client,
812
+ uri,
813
+ resourceType,
814
+ openParent,
815
+ generation,
816
+ requestOptions
817
+ ]);
818
+ const directoryTab = directory?.uri === uri ? toDirectoryTab(directory.uri, directory.summary, labels, openParent, directoryIcon()) : void 0;
819
+ const count = directoryTab ? (directoryTab.levels[0].source.content ?? '').length : characterCount;
820
+ return {
821
+ tabs: directoryTab ? [
822
+ directoryTab
823
+ ] : tabs,
824
+ activeKey,
825
+ error,
826
+ footer: void 0 === count ? void 0 : formatCharacterCount(count),
827
+ setActiveKey
828
+ };
829
+ }
830
+ function loadingTab(uri, isDirectory) {
831
+ if (isDirectory) return {
832
+ kind: 'directory',
833
+ key: uri,
834
+ loading: true,
835
+ levels: [
836
+ {
837
+ key: 'l0',
838
+ label: '',
839
+ source: {
840
+ fileName: `${nameFromUri(uri)}.md`,
841
+ path: uri,
842
+ fileType: 'markdown',
843
+ content: ''
844
+ }
845
+ },
846
+ {
847
+ key: 'l1',
848
+ label: '',
849
+ source: {
850
+ fileName: `${nameFromUri(uri)}.md`,
851
+ path: uri,
852
+ fileType: 'markdown',
853
+ content: ''
854
+ }
855
+ }
856
+ ]
857
+ };
858
+ return {
859
+ kind: 'file',
860
+ key: uri,
861
+ loading: true,
862
+ source: {
863
+ fileName: nameFromUri(uri),
864
+ path: uri,
865
+ content: ''
866
+ }
867
+ };
868
+ }
869
+ async function readFile(client, uri, options, openParent) {
870
+ const name = nameFromUri(uri);
871
+ const icon = fileTypeIcon(name);
872
+ if (isBinaryFile(name)) {
873
+ const blob = await client.request({
874
+ method: 'GET',
875
+ path: OV_PATHS.contentDownload,
876
+ query: {
877
+ uri
878
+ },
879
+ responseType: 'blob',
880
+ options
881
+ });
882
+ const typed = new Blob([
883
+ blob
884
+ ], {
885
+ type: mimeTypeOf(name)
886
+ });
887
+ return toBinaryTab(uri, name, typed, icon, openParent);
888
+ }
889
+ const content = await client.request({
890
+ method: 'GET',
891
+ path: OV_PATHS.contentRead,
892
+ query: {
893
+ uri,
894
+ limit: MAX_LINES
895
+ },
896
+ options
897
+ });
898
+ return toFileTab({
899
+ uri
900
+ }, 'string' == typeof content ? content : '', MAX_LINES, icon, openParent);
901
+ }
902
+ function mergeFindResult(result) {
903
+ const seen = new Set();
904
+ const entries = [];
905
+ for (const group of [
906
+ result?.memories,
907
+ result?.resources,
908
+ result?.skills
909
+ ])for (const item of group ?? []){
910
+ const uri = item?.uri;
911
+ if (!(!uri || seen.has(uri))) {
912
+ seen.add(uri);
913
+ entries.push({
914
+ uri,
915
+ isDir: false,
916
+ abstract: item.abstract?.trim() || void 0
917
+ });
918
+ }
919
+ }
920
+ return entries;
921
+ }
922
+ const LIMIT = 20;
923
+ function useFsSearch({ client, query, targetUri, generation = 0, requestOptions }) {
924
+ const [results, setResults] = useState(null);
925
+ const [loading, setLoading] = useState(false);
926
+ const [error, setError] = useState(null);
927
+ useEffect(()=>{
928
+ if (!client || !query) {
929
+ setResults(null);
930
+ setLoading(false);
931
+ setError(null);
932
+ return;
933
+ }
934
+ const controller = new AbortController();
935
+ setLoading(true);
936
+ setError(null);
937
+ client.request({
938
+ method: 'POST',
939
+ path: OV_PATHS.searchFind,
940
+ body: {
941
+ query,
942
+ target_uri: targetUri,
943
+ limit: LIMIT
944
+ },
945
+ options: {
946
+ ...requestOptions,
947
+ signal: controller.signal
948
+ }
949
+ }).then((result)=>{
950
+ if (controller.signal.aborted) return;
951
+ setResults(mergeFindResult(result));
952
+ setLoading(false);
953
+ }, (cause)=>{
954
+ if (isAbort(cause) || controller.signal.aborted) return;
955
+ setResults([]);
956
+ setError(toError(cause));
957
+ setLoading(false);
958
+ });
959
+ return ()=>controller.abort();
960
+ }, [
961
+ client,
962
+ query,
963
+ targetUri,
964
+ generation,
965
+ requestOptions
966
+ ]);
967
+ return {
968
+ results,
969
+ loading,
970
+ error
971
+ };
972
+ }
973
+ function knownDirectories(rootUri, dirs) {
974
+ const known = new Set([
975
+ rootUri
976
+ ]);
977
+ for (const [parent, level] of Object.entries(dirs)){
978
+ known.add(parent);
979
+ for (const entry of level.entries)if (true === entry.isDir) known.add(entry.uri);
980
+ }
981
+ return known;
982
+ }
983
+ function knownFiles(dirs) {
984
+ const known = new Set();
985
+ for (const level of Object.values(dirs))for (const entry of level.entries)if (true !== entry.isDir) known.add(entry.uri);
986
+ return known;
987
+ }
988
+ function useKnownFile(dirs) {
989
+ const files = useMemo(()=>knownFiles(dirs), [
990
+ dirs
991
+ ]);
992
+ return useCallback((uri)=>files.has(uri), [
993
+ files
994
+ ]);
995
+ }
996
+ const ids = new WeakMap();
997
+ let nextId = 1;
998
+ function idOf(value) {
999
+ if (!value) return 0;
1000
+ const existing = ids.get(value);
1001
+ if (void 0 !== existing) return existing;
1002
+ const assigned = nextId++;
1003
+ ids.set(value, assigned);
1004
+ return assigned;
1005
+ }
1006
+ function fieldKey(value) {
1007
+ if (void 0 === value) return 'inherit';
1008
+ if ('function' == typeof value) return `fn#${idOf(value)}`;
1009
+ return `value:${value}`;
1010
+ }
1011
+ function scopeKeyOf(client, options, rootUri) {
1012
+ return JSON.stringify([
1013
+ idOf(client),
1014
+ void 0 === rootUri ? 'inherit-root' : `root:${rootUri}`,
1015
+ options?.baseURL === void 0 ? 'inherit-base' : `base:${options.baseURL}`,
1016
+ fieldKey(options?.apiKey),
1017
+ fieldKey(options?.accountId),
1018
+ fieldKey(options?.userId),
1019
+ fieldKey(options?.resourceId)
1020
+ ]);
1021
+ }
1022
+ function useRequestScope(client, requestOptions, rootUri) {
1023
+ const scopeKey = scopeKeyOf(client, requestOptions, rootUri);
1024
+ const scopeRef = useRef({
1025
+ key: scopeKey,
1026
+ controller: new AbortController()
1027
+ });
1028
+ const handleRef = useRef({
1029
+ current: ()=>scopeRef.current
1030
+ });
1031
+ useEffect(()=>{
1032
+ const current = scopeRef.current;
1033
+ if (current.key === scopeKey) return;
1034
+ current.controller.abort();
1035
+ scopeRef.current = {
1036
+ key: scopeKey,
1037
+ controller: new AbortController()
1038
+ };
1039
+ }, [
1040
+ scopeKey
1041
+ ]);
1042
+ useEffect(()=>()=>{
1043
+ scopeRef.current.controller.abort();
1044
+ scopeRef.current = {
1045
+ key: scopeRef.current.key,
1046
+ controller: new AbortController()
1047
+ };
1048
+ }, []);
1049
+ return handleRef.current;
1050
+ }
1051
+ function expandChain(rootUri, targetUri) {
1052
+ if (!targetUri) return [];
1053
+ const base = rootUri.endsWith('/') ? rootUri : `${rootUri}/`;
1054
+ if (!targetUri.startsWith(base)) return [];
1055
+ const rest = targetUri.slice(base.length).split('/').filter(Boolean);
1056
+ return rest.map((_, index)=>`${base}${rest.slice(0, index + 1).join('/')}`);
1057
+ }
1058
+ const PAGE_SIZE = 200;
1059
+ async function loadPage(client, uri, offset, signal, requestOptions) {
1060
+ const envelope = await client.requestEnvelope({
1061
+ method: 'GET',
1062
+ path: OV_PATHS.fsLs,
1063
+ query: {
1064
+ uri,
1065
+ output: 'agent',
1066
+ node_limit: PAGE_SIZE,
1067
+ offset
1068
+ },
1069
+ options: {
1070
+ ...requestOptions,
1071
+ signal
1072
+ }
1073
+ });
1074
+ return {
1075
+ entries: envelope.result ?? [],
1076
+ hasMore: envelope.hasMore
1077
+ };
1078
+ }
1079
+ function useFsTree({ client, rootUri, defaultExpandedUri, requestOptions }) {
1080
+ const [dirs, setDirs] = useState({});
1081
+ const [expanded, setExpanded] = useState(()=>new Set([
1082
+ rootUri
1083
+ ]));
1084
+ const [isReady, setReady] = useState(false);
1085
+ const [error, setError] = useState(null);
1086
+ const dirsRef = useRef(dirs);
1087
+ dirsRef.current = dirs;
1088
+ const expandedRef = useRef(expanded);
1089
+ expandedRef.current = expanded;
1090
+ useEffect(()=>{
1091
+ if (!client) return;
1092
+ const controller = new AbortController();
1093
+ setReady(false);
1094
+ setError(null);
1095
+ setExpanded(new Set([
1096
+ rootUri
1097
+ ]));
1098
+ setDirs({
1099
+ [rootUri]: {
1100
+ ...emptyDir(),
1101
+ loading: true
1102
+ }
1103
+ });
1104
+ const run = async ()=>{
1105
+ const root = await loadPage(client, rootUri, 0, controller.signal, requestOptions);
1106
+ if (controller.signal.aborted) return;
1107
+ setDirs({
1108
+ [rootUri]: mergePage(void 0, root, 0)
1109
+ });
1110
+ const chain = expandChain(rootUri, defaultExpandedUri);
1111
+ for (const uri of chain){
1112
+ let page;
1113
+ try {
1114
+ page = await loadPage(client, uri, 0, controller.signal, requestOptions);
1115
+ } catch (cause) {
1116
+ if (isAbort(cause) || controller.signal.aborted) return;
1117
+ break;
1118
+ }
1119
+ if (controller.signal.aborted) return;
1120
+ setExpanded((prev)=>new Set(prev).add(uri));
1121
+ setDirs((prev)=>({
1122
+ ...prev,
1123
+ [uri]: mergePage(prev[uri], page, 0)
1124
+ }));
1125
+ }
1126
+ if (controller.signal.aborted) return;
1127
+ setReady(true);
1128
+ };
1129
+ run().catch((cause)=>{
1130
+ if (isAbort(cause) || controller.signal.aborted) return;
1131
+ const failure = toError(cause);
1132
+ setError(failure);
1133
+ setDirs({
1134
+ [rootUri]: {
1135
+ ...emptyDir(),
1136
+ loading: false,
1137
+ error: failure
1138
+ }
1139
+ });
1140
+ setReady(true);
1141
+ });
1142
+ return ()=>controller.abort();
1143
+ }, [
1144
+ client,
1145
+ rootUri,
1146
+ defaultExpandedUri,
1147
+ requestOptions
1148
+ ]);
1149
+ const scope = useRequestScope(client, requestOptions, rootUri);
1150
+ const state = useMemo(()=>{
1151
+ const fetchPage = async (uri, offset)=>{
1152
+ if (!client) return;
1153
+ const current = scope.current();
1154
+ const { signal } = current.controller;
1155
+ if (signal.aborted) return;
1156
+ if (uri === rootUri) setError(null);
1157
+ setDirs((prev)=>({
1158
+ ...prev,
1159
+ [uri]: {
1160
+ ...prev[uri] ?? emptyDir(),
1161
+ loading: true,
1162
+ error: null
1163
+ }
1164
+ }));
1165
+ try {
1166
+ const page = await loadPage(client, uri, offset, signal, requestOptions);
1167
+ if (signal.aborted || scope.current().key !== current.key) return;
1168
+ setDirs((prev)=>({
1169
+ ...prev,
1170
+ [uri]: mergePage(prev[uri], page, offset)
1171
+ }));
1172
+ } catch (cause) {
1173
+ if (isAbort(cause) || signal.aborted) return;
1174
+ const failure = toError(cause);
1175
+ if (uri === rootUri) setError(failure);
1176
+ setDirs((prev)=>({
1177
+ ...prev,
1178
+ [uri]: {
1179
+ ...prev[uri] ?? emptyDir(),
1180
+ loading: false,
1181
+ error: failure
1182
+ }
1183
+ }));
1184
+ }
1185
+ };
1186
+ return {
1187
+ open: async (uri)=>{
1188
+ setExpanded((prev)=>new Set(prev).add(uri));
1189
+ if (!dirsRef.current[uri]) await fetchPage(uri, 0);
1190
+ },
1191
+ toggleExpand: async (row)=>{
1192
+ const isOpen = expandedRef.current.has(row.uri);
1193
+ setExpanded((prev)=>{
1194
+ const next = new Set(prev);
1195
+ if (isOpen) next.delete(row.uri);
1196
+ else next.add(row.uri);
1197
+ return next;
1198
+ });
1199
+ if (!isOpen && !dirsRef.current[row.uri]) await fetchPage(row.uri, 0);
1200
+ },
1201
+ loadMore: (parentId)=>fetchPage(parentId, dirsRef.current[parentId]?.entries.length ?? 0),
1202
+ retry: (parentId)=>fetchPage(parentId, 0),
1203
+ refresh: async ()=>{
1204
+ if (!client) return;
1205
+ const current = scope.current();
1206
+ const open = [
1207
+ ...expandedRef.current
1208
+ ];
1209
+ setError(null);
1210
+ setDirs({});
1211
+ for (const uri of open){
1212
+ if (scope.current().key !== current.key) return;
1213
+ await fetchPage(uri, 0);
1214
+ }
1215
+ }
1216
+ };
1217
+ }, [
1218
+ client,
1219
+ rootUri,
1220
+ requestOptions,
1221
+ scope
1222
+ ]);
1223
+ const rows = useMemo(()=>flattenTree(rootUri, 0, dirs, expanded), [
1224
+ rootUri,
1225
+ dirs,
1226
+ expanded
1227
+ ]);
1228
+ const directoryUris = useMemo(()=>knownDirectories(rootUri, dirs), [
1229
+ rootUri,
1230
+ dirs
1231
+ ]);
1232
+ const isKnownFile = useKnownFile(dirs);
1233
+ return {
1234
+ rows,
1235
+ isReady,
1236
+ error,
1237
+ directoryUris,
1238
+ isKnownFile,
1239
+ ...state
1240
+ };
1241
+ }
1242
+ function useFileBrowser({ rootUri, locale = 'en-US', controlled = false, summaryLabels, formatCharacterCount, defaultExpandedUri, currentUri, requestOptions, onUriChange }) {
1243
+ const client = useOvClient();
1244
+ const [query, setQuery] = useState('');
1245
+ const [pendingUri, setPendingUri] = useState(currentUri);
1246
+ const [refreshing, setRefreshing] = useState(false);
1247
+ const [refreshGeneration, setRefreshGeneration] = useState(0);
1248
+ const tree = useFsTree({
1249
+ client,
1250
+ rootUri,
1251
+ defaultExpandedUri,
1252
+ requestOptions
1253
+ });
1254
+ const search = useFsSearch({
1255
+ client,
1256
+ query,
1257
+ targetUri: rootUri,
1258
+ generation: refreshGeneration,
1259
+ requestOptions
1260
+ });
1261
+ const activeUri = controlled ? currentUri : pendingUri;
1262
+ const resourceType = null === activeUri ? 'file' : tree.directoryUris.has(activeUri) ? 'directory' : tree.isKnownFile(activeUri) ? 'file' : 'unknown';
1263
+ const openTree = tree.open;
1264
+ const notifyUriChange = useRef(onUriChange);
1265
+ notifyUriChange.current = onUriChange;
1266
+ const openParent = useMemo(()=>async (uri)=>{
1267
+ setPendingUri(uri);
1268
+ notifyUriChange.current(uri);
1269
+ await openTree(uri);
1270
+ }, [
1271
+ openTree
1272
+ ]);
1273
+ const preview = useFsPreview({
1274
+ client,
1275
+ uri: activeUri,
1276
+ resourceType,
1277
+ labels: summaryLabels ?? resolveSummaryLabels(locale),
1278
+ formatCharacterCount: formatCharacterCount ?? resolveLabels(void 0, locale).formatCharacterCount,
1279
+ openParent,
1280
+ generation: refreshGeneration,
1281
+ requestOptions
1282
+ });
1283
+ const rows = useMemo(()=>{
1284
+ if (null === search.results) return tree.rows;
1285
+ return search.results.map((entry, index)=>toEntryRow(entry, 0, false, index));
1286
+ }, [
1287
+ search.results,
1288
+ tree.rows
1289
+ ]);
1290
+ const selectedId = useMemo(()=>{
1291
+ if (!activeUri || null === search.results) return activeUri;
1292
+ const index = search.results.findIndex((entry)=>entry.uri === activeUri);
1293
+ return index < 0 ? activeUri : `${activeUri}#${index}`;
1294
+ }, [
1295
+ activeUri,
1296
+ search.results
1297
+ ]);
1298
+ const { open, toggleExpand, loadMore, retry, refresh } = tree;
1299
+ const actions = useMemo(()=>({
1300
+ select: async (row)=>{
1301
+ setPendingUri(row.uri);
1302
+ notifyUriChange.current(row.uri);
1303
+ if ('directory' === row.type) await open(row.uri);
1304
+ },
1305
+ toggleExpand,
1306
+ loadMore: async (row)=>{
1307
+ const parentId = 'parentId' in row ? row.parentId : void 0;
1308
+ if (parentId) await loadMore(parentId);
1309
+ },
1310
+ retry: async (row)=>{
1311
+ const parentId = 'parentId' in row ? row.parentId : void 0;
1312
+ if (parentId) await retry(parentId);
1313
+ },
1314
+ refresh: async ()=>{
1315
+ setRefreshing(true);
1316
+ try {
1317
+ setRefreshGeneration((generation)=>generation + 1);
1318
+ await refresh();
1319
+ } finally{
1320
+ setRefreshing(false);
1321
+ }
1322
+ },
1323
+ setPreviewKey: preview.setActiveKey,
1324
+ setQuery
1325
+ }), [
1326
+ preview.setActiveKey,
1327
+ open,
1328
+ toggleExpand,
1329
+ loadMore,
1330
+ retry,
1331
+ refresh
1332
+ ]);
1333
+ return {
1334
+ rows,
1335
+ selectedId,
1336
+ currentUri: activeUri,
1337
+ isReady: tree.isReady,
1338
+ error: tree.error ?? search.error ?? preview.error,
1339
+ treeError: tree.error,
1340
+ previewError: preview.error,
1341
+ searchError: search.error,
1342
+ previewTabs: preview.tabs,
1343
+ previewKey: preview.activeKey,
1344
+ previewFooter: preview.footer,
1345
+ query,
1346
+ searching: null !== search.results,
1347
+ searchLoading: search.loading,
1348
+ refreshing,
1349
+ actions
1350
+ };
1351
+ }
1352
+ function FileBrowser({ uri, defaultUri, rootUri = 'viking://', defaultExpandedUri, locale, agentConnect, onUriChange, onImportResources, renderImportResources, labels, requestOptions, className, style, ...rest }) {
1353
+ const [internalUri, setInternalUri] = useState(()=>defaultUri ?? null);
1354
+ const [preferredTreeWidth, setPreferredTreeWidth] = useState(352);
1355
+ const searchId = useId();
1356
+ const isControlled = void 0 !== uri;
1357
+ const currentUri = isControlled ? uri : internalUri;
1358
+ const text = resolveLabels(labels, locale);
1359
+ const { ref: layoutRef, width: layoutWidth } = useContainerWidth();
1360
+ const treeMaxWidth = resolveTreeMaxWidth(layoutWidth);
1361
+ const treeWidth = Math.min(preferredTreeWidth, treeMaxWidth);
1362
+ const changeUri = useCallback((next)=>{
1363
+ if (!isControlled) setInternalUri(next);
1364
+ onUriChange?.(next);
1365
+ }, [
1366
+ isControlled,
1367
+ onUriChange
1368
+ ]);
1369
+ const summaryLabels = useMemo(()=>({
1370
+ l0: text.l0Summary,
1371
+ l1: text.l1Overview,
1372
+ failure: text.summaryFailed
1373
+ }), [
1374
+ text.l0Summary,
1375
+ text.l1Overview,
1376
+ text.summaryFailed
1377
+ ]);
1378
+ const previewLabels = useMemo(()=>resolvePreviewLabels(resolveLabels(labels, locale)), [
1379
+ labels,
1380
+ locale
1381
+ ]);
1382
+ const browser = useFileBrowser({
1383
+ rootUri,
1384
+ locale,
1385
+ controlled: isControlled,
1386
+ summaryLabels,
1387
+ formatCharacterCount: text.formatCharacterCount,
1388
+ defaultExpandedUri,
1389
+ currentUri,
1390
+ requestOptions,
1391
+ onUriChange: changeUri
1392
+ });
1393
+ return /*#__PURE__*/ jsxs("div", {
1394
+ ...rest,
1395
+ ref: layoutRef,
27
1396
  className: [
28
- 'ov-module-placeholder',
1397
+ 'ov-file-browser',
29
1398
  className
30
1399
  ].filter(Boolean).join(' '),
31
- style: style,
1400
+ style: {
1401
+ ...style,
1402
+ '--ov-file-browser-tree-width': `${treeWidth}px`
1403
+ },
32
1404
  children: [
33
- /*#__PURE__*/ jsx("p", {
34
- className: "ov-module-placeholder__title",
35
- children: labels?.title ?? 'File browser'
1405
+ /*#__PURE__*/ jsx("div", {
1406
+ className: "ov-file-browser__tree",
1407
+ children: /*#__PURE__*/ jsx(FileBrowserTreePane, {
1408
+ entries: {
1409
+ agentConnect,
1410
+ onImportResources,
1411
+ renderImportResources,
1412
+ labels: labels?.entries
1413
+ },
1414
+ searchId: searchId,
1415
+ browser: browser,
1416
+ treeLabels: text.tree,
1417
+ locale: locale,
1418
+ searchPlaceholder: text.searchPlaceholder,
1419
+ refreshLabel: text.refresh,
1420
+ searchLoading: text.searchLoading,
1421
+ searchEmpty: text.searchEmpty,
1422
+ searchErrorLabel: text.searchFailed,
1423
+ retryLabel: text.retry
1424
+ })
36
1425
  }),
37
- /*#__PURE__*/ jsx("p", {
38
- className: "ov-module-placeholder__description",
39
- children: labels?.description ?? 'Placeholder. Functionality is not available yet.'
1426
+ /*#__PURE__*/ jsx(ResizableHandle, {
1427
+ label: text.resizeTree,
1428
+ min: 200,
1429
+ max: treeMaxWidth,
1430
+ value: treeWidth,
1431
+ onResize: setPreferredTreeWidth,
1432
+ className: "ov-file-browser__resizer"
1433
+ }),
1434
+ browser.previewTabs && browser.previewTabs.length > 0 ? /*#__PURE__*/ jsx(FileBrowserDetail, {
1435
+ tabs: browser.previewTabs,
1436
+ activeKey: browser.previewKey,
1437
+ locale: locale,
1438
+ labels: previewLabels,
1439
+ footer: browser.previewFooter,
1440
+ viewLabels: {
1441
+ preview: text.previewMode,
1442
+ source: text.sourceMode,
1443
+ copyPath: text.copyPath,
1444
+ copyContent: text.copyContent,
1445
+ download: text.download,
1446
+ viewSwitch: text.viewSwitch
1447
+ },
1448
+ onActiveKeyChange: browser.actions.setPreviewKey
1449
+ }) : browser.currentUri && browser.previewError ? /*#__PURE__*/ jsx("div", {
1450
+ className: "ov-file-browser__detail",
1451
+ children: /*#__PURE__*/ jsx(FileBrowserFailure, {
1452
+ message: text.error,
1453
+ detail: browser.previewError.message,
1454
+ retryLabel: text.retry,
1455
+ onRetry: ()=>void browser.actions.refresh()
1456
+ })
1457
+ }) : /*#__PURE__*/ jsx("div", {
1458
+ className: "ov-file-browser__detail",
1459
+ children: /*#__PURE__*/ jsx(FileBrowserEmpty, {
1460
+ label: text.empty
1461
+ })
40
1462
  })
41
1463
  ]
42
1464
  });
43
1465
  }
44
- export { FileBrowser, FileBrowserToolbarButton };
1466
+ export { FileBrowser, useFileBrowser };