@opengeni/react 6.5.2-canary.41607687019001 → 6.7.0

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 (1154) hide show
  1. package/dist/app/app-state.d.ts +4 -0
  2. package/dist/app/app-state.js +19 -14
  3. package/dist/app/components/Composer.js +25 -23
  4. package/dist/app/components/agent/agent-capability-picker.js +10 -8
  5. package/dist/app/components/artifacts/artifact-browse-controls.js +4 -4
  6. package/dist/app/components/artifacts/artifact-library.js +21 -19
  7. package/dist/app/components/artifacts/artifact-page-chrome.js +3 -3
  8. package/dist/app/components/artifacts/artifact-viewer.js +23 -22
  9. package/dist/app/components/artifacts/artifact-viewer.js.map +1 -1
  10. package/dist/app/components/artifacts/chat-interactive-block.js +12 -12
  11. package/dist/app/components/artifacts/copy-artifact-link.js +7 -5
  12. package/dist/app/components/artifacts/file-reach-dialog.js +11 -9
  13. package/dist/app/components/artifacts/inline-chat-image.js +18 -18
  14. package/dist/app/components/artifacts/retained-file-preview.js +24 -23
  15. package/dist/app/components/artifacts/retained-text-preview.js +3 -3
  16. package/dist/app/components/artifacts/site-audience.js +6 -5
  17. package/dist/app/components/artifacts/site-conversations.js +16 -14
  18. package/dist/app/components/artifacts/site-data.js +18 -16
  19. package/dist/app/components/artifacts/site-public-link.js +3 -2
  20. package/dist/app/components/artifacts/site-publishing-page.js +39 -37
  21. package/dist/app/components/artifacts/site-publishing.js +34 -32
  22. package/dist/app/components/artifacts/site-settings.js +38 -36
  23. package/dist/app/components/artifacts/site-version-menu.js +8 -7
  24. package/dist/app/components/billing-class-mark.js +3 -3
  25. package/dist/app/components/bots/bot-launch-strip.js +17 -17
  26. package/dist/app/components/bots/bot-template-dialog.js +30 -28
  27. package/dist/app/components/bots/bot-template-shortcuts.js +19 -19
  28. package/dist/app/components/bots/bot-templates-page.js +38 -36
  29. package/dist/app/components/bots/bot-templates-page.js.map +1 -1
  30. package/dist/app/components/capabilities/capability-detail-sheet.js +13 -11
  31. package/dist/app/components/capabilities/capability-logo-source.js +13 -13
  32. package/dist/app/components/capabilities/capability-logo.js +4 -3
  33. package/dist/app/components/capabilities/connector-tool-permissions.js +8 -6
  34. package/dist/app/components/capabilities/native-connect-setup.js +14 -14
  35. package/dist/app/components/capabilities/own-logins-shared-heads-up.js +7 -6
  36. package/dist/app/components/capabilities/perform-capability-action.js +7 -6
  37. package/dist/app/components/capabilities/prepared-mcp-setup-card.js +17 -17
  38. package/dist/app/components/capabilities/session-capability-card.js +72 -70
  39. package/dist/app/components/capabilities/session-capability-card.js.map +1 -1
  40. package/dist/app/components/capabilities/session-chrome-card.js +28 -26
  41. package/dist/app/components/capabilities/session-connection-accounts.js +4 -3
  42. package/dist/app/components/capabilities/session-custom-mcp-card.js +20 -19
  43. package/dist/app/components/capabilities/session-github-card.js +22 -20
  44. package/dist/app/components/capabilities/session-machine-card.js +27 -25
  45. package/dist/app/components/capabilities/session-personal-github-card.js +16 -16
  46. package/dist/app/components/capabilities/session-plugin-card.js +10 -9
  47. package/dist/app/components/capabilities/use-capabilities-catalog.js +4 -3
  48. package/dist/app/components/capabilities/use-connection-accounts.js +5 -4
  49. package/dist/app/components/command-menu/chat-status.js +15 -13
  50. package/dist/app/components/command-menu/chat-switcher.js +35 -33
  51. package/dist/app/components/command-menu/chat-switcher.js.map +1 -1
  52. package/dist/app/components/command-menu/command-menu.js +53 -50
  53. package/dist/app/components/command-menu/command-menu.js.map +1 -1
  54. package/dist/app/components/command-menu/shortcut-sheet.js +18 -16
  55. package/dist/app/components/command-menu/shortcut-sheet.js.map +1 -1
  56. package/dist/app/components/common.js +4 -3
  57. package/dist/app/components/composer-capabilities-menu-body.js +4 -4
  58. package/dist/app/components/composer-mobile-plus-panel.js +8 -8
  59. package/dist/app/components/composer-mobile-plus.js +1 -1
  60. package/dist/app/components/credit-required-gate.js +3 -3
  61. package/dist/app/components/credit-required-prompt.js +10 -8
  62. package/dist/app/components/credit-required-prompt.js.map +1 -1
  63. package/dist/app/components/credits/checkout-credits-celebration.js +3 -2
  64. package/dist/app/components/credits/checkout-return.js +3 -2
  65. package/dist/app/components/credits/checkout-return.js.map +1 -1
  66. package/dist/app/components/credits/coupon-redeem.js +5 -4
  67. package/dist/app/components/credits/credit-refusal-notice.js +7 -5
  68. package/dist/app/components/cross-slot-deep-link-recovery.js +5 -4
  69. package/dist/app/components/desktop/app-shots.js +13 -11
  70. package/dist/app/components/desktop/computer-use.js +6 -4
  71. package/dist/app/components/desktop/this-computer.js +9 -7
  72. package/dist/app/components/feedback.js +5 -4
  73. package/dist/app/components/follow-up-repository-menu-body.js +8 -6
  74. package/dist/app/components/follow-up-repository-menu-body.js.map +1 -1
  75. package/dist/app/components/follow-up-repository-picker.js +1 -1
  76. package/dist/app/components/github-app-connect-launcher.js +5 -4
  77. package/dist/app/components/in-app-help-link.js +3 -3
  78. package/dist/app/components/knowledge/agent-learning-settings.js +3 -2
  79. package/dist/app/components/knowledge/agent-learning-settings.js.map +1 -1
  80. package/dist/app/components/machines/connect-machine-dialog.js +18 -16
  81. package/dist/app/components/manual-repository-editor.js +3 -2
  82. package/dist/app/components/markdown.js +6 -6
  83. package/dist/app/components/models/models-ui.js +12 -10
  84. package/dist/app/components/my-things.js +12 -10
  85. package/dist/app/components/my-things.js.map +1 -1
  86. package/dist/app/components/new-session-starters.js +3 -3
  87. package/dist/app/components/own-where-it-works.js +9 -7
  88. package/dist/app/components/personal-resource-attachment-surface.js +4 -4
  89. package/dist/app/components/pickers.js +5 -5
  90. package/dist/app/components/rail/channel-create-dialog.js +7 -5
  91. package/dist/app/components/rail/project-glyph.js +17 -17
  92. package/dist/app/components/rail/project-profile.js +31 -29
  93. package/dist/app/components/rail/rail-context.js +3 -3
  94. package/dist/app/components/rail/rail-sections.js +68 -66
  95. package/dist/app/components/rail/session-header.js +59 -57
  96. package/dist/app/components/rail/session-list.js +66 -64
  97. package/dist/app/components/rail/session-row-content.js +4 -4
  98. package/dist/app/components/rail/session-row-hover-details.js +14 -12
  99. package/dist/app/components/rail/session-shell.js +90 -88
  100. package/dist/app/components/rail/site-session-group-heading.js +8 -8
  101. package/dist/app/components/repository-picker.js +8 -6
  102. package/dist/app/components/secrets/session-secrets-panel.js +4 -3
  103. package/dist/app/components/secrets/vault-model.js +3 -2
  104. package/dist/app/components/session/agent-configuration-panel.js +25 -23
  105. package/dist/app/components/session/agent-configuration-panel.js.map +1 -1
  106. package/dist/app/components/session/artifact-link-boundary.js +3 -3
  107. package/dist/app/components/session/artifact-session-page.js +11 -9
  108. package/dist/app/components/session/banners.js +8 -8
  109. package/dist/app/components/session/codex-usage-notice.js +5 -3
  110. package/dist/app/components/session/console-new-conversation.js +42 -40
  111. package/dist/app/components/session/context-text-reader.js +3 -2
  112. package/dist/app/components/session/descendant-requests.js +39 -37
  113. package/dist/app/components/session/descendant-requests.js.map +1 -1
  114. package/dist/app/components/session/editable-artifacts-workspace.js +36 -34
  115. package/dist/app/components/session/editable-artifacts-workspace.js.map +1 -1
  116. package/dist/app/components/session/failed-session-banner.js +13 -11
  117. package/dist/app/components/session/failed-session-banner.js.map +1 -1
  118. package/dist/app/components/session/failure-recovery-boundary.js +3 -3
  119. package/dist/app/components/session/human-input-delegation-record.js +2 -2
  120. package/dist/app/components/session/human-input.js +33 -31
  121. package/dist/app/components/session/inspector.js +57 -55
  122. package/dist/app/components/session/inspector.js.map +1 -1
  123. package/dist/app/components/session/message-actions.js +5 -4
  124. package/dist/app/components/session/message-actions.js.map +1 -1
  125. package/dist/app/components/session/message-resource-attachments.js +12 -11
  126. package/dist/app/components/session/message-resource-attachments.js.map +1 -1
  127. package/dist/app/components/session/model-context-inspector.js +6 -4
  128. package/dist/app/components/session/model-recovery-notice.js +3 -3
  129. package/dist/app/components/session/new-session-settings-menu.js +11 -9
  130. package/dist/app/components/session/new-session-setup-strip.js +18 -18
  131. package/dist/app/components/session/sandbox-recovery-actions.js +3 -3
  132. package/dist/app/components/session/sandbox-switcher.js +10 -9
  133. package/dist/app/components/session/sandbox-workspace.js +47 -46
  134. package/dist/app/components/session/search-markdown-highlight.js +7 -7
  135. package/dist/app/components/session/search-results-view.js +8 -8
  136. package/dist/app/components/session/session-admin-access.js +13 -11
  137. package/dist/app/components/session/session-admission-notice.js +7 -5
  138. package/dist/app/components/session/session-avatar-picker.js +22 -20
  139. package/dist/app/components/session/session-avatar.js +16 -16
  140. package/dist/app/components/session/session-machine-access-notice.js +7 -5
  141. package/dist/app/components/session/session-profile-dialog.js +29 -27
  142. package/dist/app/components/session/session-profile-editor.js +30 -28
  143. package/dist/app/components/session/session-retention.js +10 -8
  144. package/dist/app/components/session/session-search-dialog.js +10 -10
  145. package/dist/app/components/session/session-skill-reviews.js +2 -1
  146. package/dist/app/components/session/session-skill-reviews.js.map +1 -1
  147. package/dist/app/components/session/session-tenancy-control.js +13 -11
  148. package/dist/app/components/session/session-tenancy-control.js.map +1 -1
  149. package/dist/app/components/session/session-unattended-setting.js +7 -5
  150. package/dist/app/components/session/session-usage-limit-section.js +11 -9
  151. package/dist/app/components/session/share-chat-dialog.js +9 -7
  152. package/dist/app/components/session/site-origin-link.js +3 -3
  153. package/dist/app/components/session/subagents.js +8 -8
  154. package/dist/app/components/session/subscription-account-indicator.js +6 -6
  155. package/dist/app/components/session-connectors-menu-body.js +4 -3
  156. package/dist/app/components/session-connectors-menu-body.js.map +1 -1
  157. package/dist/app/components/settings/row-select.js +7 -5
  158. package/dist/app/components/toaster.js +3 -2
  159. package/dist/app/components/transcription-settings.js +11 -9
  160. package/dist/app/components/ui/destructive-confirm.js +11 -9
  161. package/dist/app/components/usage/usage-entry.js +5 -5
  162. package/dist/app/components/window-bar.js +16 -14
  163. package/dist/app/components/workspace-composer-plus.js +22 -21
  164. package/dist/app/components/workspace-reach.js +6 -4
  165. package/dist/app/components/workspace-tenant-boundary.js +5 -4
  166. package/dist/app/embed/memory-navigation.js +3 -3
  167. package/dist/app/embed/session-app.js +211 -209
  168. package/dist/app/lib/actions/actions-provider.js +15 -13
  169. package/dist/app/lib/agent-capabilities.js +3 -3
  170. package/dist/app/lib/app-surfaces.js +7 -6
  171. package/dist/app/lib/archive-session.d.ts +9 -4
  172. package/dist/app/lib/archive-session.js +4 -2
  173. package/dist/app/lib/bot-templates.js +3 -2
  174. package/dist/app/lib/capabilities.js +3 -2
  175. package/dist/app/lib/codex-usage-query.js +2 -2
  176. package/dist/app/lib/composer-connectors.js +17 -16
  177. package/dist/app/lib/console-site.js +2 -2
  178. package/dist/app/lib/console-text.js +2 -2
  179. package/dist/app/lib/events.js +9 -9
  180. package/dist/app/lib/failed-session-copy.js +3 -3
  181. package/dist/app/lib/inbox.js +4 -2
  182. package/dist/app/lib/model-access-onboarding.js +3 -3
  183. package/dist/app/lib/move-chat-to-machine.js +3 -3
  184. package/dist/app/lib/navigation.js +2 -2
  185. package/dist/app/lib/session-branch-cache.js +6 -6
  186. package/dist/app/lib/session-create.js +4 -4
  187. package/dist/app/lib/session-group-pagination.js +6 -6
  188. package/dist/app/lib/session-hover-facts.js +13 -11
  189. package/dist/app/lib/session-model.js +2 -2
  190. package/dist/app/lib/session-rail.js +3 -3
  191. package/dist/app/lib/session-rename.js +3 -3
  192. package/dist/app/lib/session-restart-operation-controller.js +4 -3
  193. package/dist/app/lib/session-tenancy.js +3 -2
  194. package/dist/app/lib/session-usage-limit.js +3 -2
  195. package/dist/app/lib/sessions-group.js +5 -5
  196. package/dist/app/lib/site-publishing.js +3 -2
  197. package/dist/app/lib/site-tool-consent-dialog.js +9 -7
  198. package/dist/app/lib/site-tool-consent-dialog.js.map +1 -1
  199. package/dist/app/lib/site-tool-consent.js +1 -1
  200. package/dist/app/lib/subscription-plans.js +3 -2
  201. package/dist/app/lib/toast.js +2 -1
  202. package/dist/app/lib/turn-failure-analytics.js +4 -4
  203. package/dist/app/lib/use-duplicate-site.js +6 -5
  204. package/dist/app/lib/use-follow-up-repositories.js +6 -5
  205. package/dist/app/lib/use-workspace-integrations.js +4 -3
  206. package/dist/app/lib/use-workspace-machines.js +4 -4
  207. package/dist/app/lib/use-workspace-model-catalog.js +5 -4
  208. package/dist/app/lib/use-workspace-rigs.js +2 -2
  209. package/dist/app/lib/workspace-navigation-preference.js +4 -4
  210. package/dist/app/lib/workspace-scope-context.js +3 -3
  211. package/dist/app/routes/artifacts.js +67 -66
  212. package/dist/app/routes/artifacts.js.map +1 -1
  213. package/dist/app/routes/retained-artifact.js +42 -40
  214. package/dist/app/routes/retained-artifact.js.map +1 -1
  215. package/dist/app/routes/session-unavailable.js +8 -7
  216. package/dist/app/routes/session.js +119 -117
  217. package/dist/app/routes/sessions-index-hydration.js +5 -5
  218. package/dist/app/routes/sessions-index.js +104 -102
  219. package/dist/app/routes/site-view.js +67 -65
  220. package/dist/app/routes/site-view.js.map +1 -1
  221. package/dist/artifacts-document.js +4 -4
  222. package/dist/artifacts-presentation.js +4 -4
  223. package/dist/artifacts-spreadsheet.js +4 -4
  224. package/dist/artifacts.js +10 -10
  225. package/dist/automations.js +17 -15
  226. package/dist/automations.js.map +1 -1
  227. package/dist/browser-viewer-TC27OCIP.js +23 -0
  228. package/dist/chat-interactive-block-RWPQBHVS.js +18 -0
  229. package/dist/chunk-2BDT3UZQ.js +229 -0
  230. package/dist/chunk-2CLNIEK4.js +373 -0
  231. package/dist/chunk-2FSBSCZJ.js +451 -0
  232. package/dist/chunk-2I7HDP53.js +199 -0
  233. package/dist/chunk-2INLDVK3.js +15 -0
  234. package/dist/chunk-2KALVELR.js +126 -0
  235. package/dist/chunk-2M3J7ZWQ.js +418 -0
  236. package/dist/chunk-2OP6WLGV.js +708 -0
  237. package/dist/chunk-2RG7NIAS.js +2936 -0
  238. package/dist/chunk-2STUPWEL.js +135 -0
  239. package/dist/chunk-2YUOVM3G.js +271 -0
  240. package/dist/chunk-2Z3NQNTM.js +3670 -0
  241. package/dist/chunk-3CPWWGNK.js +920 -0
  242. package/dist/chunk-3ED2U6XE.js +37 -0
  243. package/dist/chunk-3GZA4BUW.js +216 -0
  244. package/dist/chunk-3IK6UYO6.js +1022 -0
  245. package/dist/chunk-3PZ7JZI2.js +431 -0
  246. package/dist/chunk-4DVJ6ONS.js +50 -0
  247. package/dist/chunk-4DVNUCRR.js +2386 -0
  248. package/dist/chunk-4DVNUCRR.js.map +1 -0
  249. package/dist/chunk-4E3ZJRTZ.js +41 -0
  250. package/dist/chunk-4SAWSRAA.js +141 -0
  251. package/dist/chunk-53AGXXZM.js +307 -0
  252. package/dist/chunk-54YW6SZZ.js +818 -0
  253. package/dist/chunk-57AZS3IE.js +2317 -0
  254. package/dist/chunk-5CPEEAFD.js +143 -0
  255. package/dist/chunk-5EWSRZ2Y.js +340 -0
  256. package/dist/chunk-5IE76VCY.js +387 -0
  257. package/dist/chunk-5NWEKLDZ.js +170 -0
  258. package/dist/chunk-5O2FCCHZ.js +198 -0
  259. package/dist/chunk-5QAY6K77.js +399 -0
  260. package/dist/chunk-5YKW2K6I.js +625 -0
  261. package/dist/chunk-5YKW2K6I.js.map +1 -0
  262. package/dist/chunk-6BCXNDEI.js +4116 -0
  263. package/dist/chunk-6BCXNDEI.js.map +1 -0
  264. package/dist/chunk-6DK6Z4UN.js +2599 -0
  265. package/dist/chunk-6DVCC7QS.js +702 -0
  266. package/dist/chunk-6JHU2UBS.js +2058 -0
  267. package/dist/chunk-6PZ7OBYU.js +490 -0
  268. package/dist/chunk-6WD2INST.js +539 -0
  269. package/dist/chunk-6WD2INST.js.map +1 -0
  270. package/dist/chunk-6WGRDRMA.js +163 -0
  271. package/dist/chunk-77WAKEAH.js +186 -0
  272. package/dist/chunk-7T2ZE3VT.js +5558 -0
  273. package/dist/chunk-7T2ZE3VT.js.map +1 -0
  274. package/dist/chunk-7TDO3CUM.js +393 -0
  275. package/dist/chunk-7TIX2UAR.js +247 -0
  276. package/dist/chunk-7V5REBCP.js +148 -0
  277. package/dist/chunk-7VMZGLYI.js +339 -0
  278. package/dist/chunk-7W37NS3I.js +236 -0
  279. package/dist/chunk-7X6SDK2C.js +111 -0
  280. package/dist/chunk-7ZNUHRP5.js +95 -0
  281. package/dist/chunk-A36PZALD.js +84 -0
  282. package/dist/chunk-AUI6VA63.js +107 -0
  283. package/dist/chunk-AW2MQB37.js +24 -0
  284. package/dist/chunk-AWKES45Y.js +198 -0
  285. package/dist/chunk-AXHZYXUV.js +132 -0
  286. package/dist/chunk-BHNSJVBC.js +129 -0
  287. package/dist/chunk-BJEJFISW.js +50 -0
  288. package/dist/chunk-BJFH6JI5.js +422 -0
  289. package/dist/chunk-BMICEQZQ.js +960 -0
  290. package/dist/chunk-BTLBYBLU.js +29 -0
  291. package/dist/chunk-BXBDYNRP.js +89 -0
  292. package/dist/chunk-C372BFOV.js +357 -0
  293. package/dist/chunk-C43KRXGA.js +234 -0
  294. package/dist/chunk-C43KRXGA.js.map +1 -0
  295. package/dist/chunk-CMKGILJK.js +4824 -0
  296. package/dist/chunk-CRAOSVHC.js +50 -0
  297. package/dist/chunk-CRU35QQH.js +281 -0
  298. package/dist/chunk-CUIWCGMA.js +172 -0
  299. package/dist/chunk-D5TWNFFE.js +38 -0
  300. package/dist/chunk-DF5EAHDN.js +4461 -0
  301. package/dist/chunk-DJAXC5OK.js +56 -0
  302. package/dist/chunk-DXBYWSL5.js +3550 -0
  303. package/dist/chunk-DXR5PDFP.js +84 -0
  304. package/dist/chunk-DZWARC4M.js +267 -0
  305. package/dist/chunk-DZXEDSQI.js +106 -0
  306. package/dist/chunk-E7XERZWC.js +48 -0
  307. package/dist/chunk-ECJBYNLJ.js +79 -0
  308. package/dist/chunk-EDI6SJ2N.js +43 -0
  309. package/dist/chunk-EWSOC6WF.js +114 -0
  310. package/dist/chunk-F2OPHAUN.js +103 -0
  311. package/dist/chunk-F4ISQGGM.js +81 -0
  312. package/dist/chunk-FO4LYKJL.js +197 -0
  313. package/dist/chunk-FPXASDG5.js +73 -0
  314. package/dist/chunk-FSOQDUCG.js +117 -0
  315. package/dist/chunk-FSOQDUCG.js.map +1 -0
  316. package/dist/chunk-FVXBNBHO.js +157 -0
  317. package/dist/chunk-FYWT2O76.js +34 -0
  318. package/dist/chunk-FYWT2O76.js.map +1 -0
  319. package/dist/chunk-FZC5N55X.js +981 -0
  320. package/dist/chunk-GAVYGBFI.js +99 -0
  321. package/dist/chunk-GFIMOUDT.js +846 -0
  322. package/dist/chunk-GFIMOUDT.js.map +1 -0
  323. package/dist/chunk-GKVJIDHF.js +33 -0
  324. package/dist/chunk-GVN5SZLX.js +212 -0
  325. package/dist/chunk-H3T7IWNA.js +134 -0
  326. package/dist/chunk-HAX4LCR5.js +261 -0
  327. package/dist/chunk-HC4JFZVU.js +121 -0
  328. package/dist/chunk-HEFPPMBQ.js +581 -0
  329. package/dist/chunk-HGKTHF2U.js +1356 -0
  330. package/dist/chunk-HGKTHF2U.js.map +1 -0
  331. package/dist/chunk-HNLR7Q4Z.js +83 -0
  332. package/dist/chunk-HSOXMJOT.js +12 -0
  333. package/dist/chunk-I4MRDSUF.js +281 -0
  334. package/dist/chunk-I4QEJ62Y.js +202 -0
  335. package/dist/chunk-I5B5L6Q4.js +56 -0
  336. package/dist/chunk-I5QZJODL.js +264 -0
  337. package/dist/chunk-I7ITSXSJ.js +603 -0
  338. package/dist/chunk-I7XIZRFD.js +390 -0
  339. package/dist/chunk-IDANQPRH.js +82 -0
  340. package/dist/chunk-IFB3WJ36.js +212 -0
  341. package/dist/chunk-IHTAKKTK.js +264 -0
  342. package/dist/chunk-IKXNLWAL.js +205 -0
  343. package/dist/chunk-IKXNLWAL.js.map +1 -0
  344. package/dist/chunk-ILDXWY37.js +173 -0
  345. package/dist/chunk-IMDQUHBJ.js +570 -0
  346. package/dist/chunk-IMZCQBOT.js +119 -0
  347. package/dist/chunk-IXPTECSC.js +403 -0
  348. package/dist/chunk-J255A3N5.js +71 -0
  349. package/dist/chunk-J5F5HPPW.js +141 -0
  350. package/dist/chunk-JDTGRRNU.js +5045 -0
  351. package/dist/chunk-JDTGRRNU.js.map +1 -0
  352. package/dist/chunk-JEA3QDX7.js +2469 -0
  353. package/dist/chunk-JEUPAVYY.js +156 -0
  354. package/dist/chunk-JKHKLL5W.js +194 -0
  355. package/dist/chunk-JQL7ZH6C.js +650 -0
  356. package/dist/chunk-JWB44UGJ.js +57 -0
  357. package/dist/chunk-JZ4NLCAP.js +333 -0
  358. package/dist/chunk-K2A5PXQ5.js +412 -0
  359. package/dist/chunk-K56XV3C3.js +623 -0
  360. package/dist/chunk-K6GAXXVA.js +23 -0
  361. package/dist/chunk-KCBMFSMS.js +199 -0
  362. package/dist/chunk-KF2FV3ZJ.js +268 -0
  363. package/dist/chunk-KJD65EJP.js +278 -0
  364. package/dist/chunk-KLEUWIMZ.js +386 -0
  365. package/dist/chunk-KODELWYT.js +309 -0
  366. package/dist/chunk-KRDR5RJD.js +83 -0
  367. package/dist/chunk-KUDGXAF7.js +914 -0
  368. package/dist/chunk-KY2R73CG.js +171 -0
  369. package/dist/chunk-KY2R73CG.js.map +1 -0
  370. package/dist/chunk-KYS77RPN.js +85 -0
  371. package/dist/chunk-L7YTNTIK.js +368 -0
  372. package/dist/chunk-LHPNABDH.js +686 -0
  373. package/dist/chunk-MFROMEKA.js +401 -0
  374. package/dist/chunk-MIHN76LX.js +2656 -0
  375. package/dist/chunk-MIYFS2XN.js +42 -0
  376. package/dist/chunk-MJUCFQMS.js +65 -0
  377. package/dist/chunk-MM4FNWI4.js +3064 -0
  378. package/dist/chunk-MNZG4OHU.js +790 -0
  379. package/dist/chunk-MVW6HNPI.js +250 -0
  380. package/dist/chunk-MVW6HNPI.js.map +1 -0
  381. package/dist/chunk-N6AACDUW.js +200 -0
  382. package/dist/chunk-NC55IFN3.js +781 -0
  383. package/dist/chunk-NC7PVOEK.js +98 -0
  384. package/dist/chunk-NCYMNCJO.js +70 -0
  385. package/dist/chunk-ND2BXV3P.js +259 -0
  386. package/dist/chunk-NDBTFUO6.js +272 -0
  387. package/dist/chunk-NDQJZ7HF.js +206 -0
  388. package/dist/chunk-NGJJJPZZ.js +162 -0
  389. package/dist/chunk-NJTSNNE7.js +251 -0
  390. package/dist/chunk-NPGISCU6.js +4159 -0
  391. package/dist/chunk-NPGISCU6.js.map +1 -0
  392. package/dist/chunk-NRTE7DNV.js +1270 -0
  393. package/dist/chunk-NULUNM7H.js +290 -0
  394. package/dist/chunk-NUNZS36W.js +227 -0
  395. package/dist/chunk-NW53H5RW.js +2424 -0
  396. package/dist/chunk-NXCMHIKI.js +263 -0
  397. package/dist/chunk-O3LKCBP5.js +159 -0
  398. package/dist/chunk-O4EA4F3W.js +103 -0
  399. package/dist/chunk-O4EA4F3W.js.map +1 -0
  400. package/dist/chunk-O4OOG3D6.js +116 -0
  401. package/dist/chunk-O4OOG3D6.js.map +1 -0
  402. package/dist/chunk-O6N4ABCA.js +376 -0
  403. package/dist/chunk-O732GAFC.js +112 -0
  404. package/dist/chunk-OF4TIKYC.js +690 -0
  405. package/dist/chunk-OMPVOMPP.js +70 -0
  406. package/dist/chunk-OPJJSKUK.js +118 -0
  407. package/dist/chunk-OPWCMA4D.js +196 -0
  408. package/dist/chunk-ORJPS5VN.js +1193 -0
  409. package/dist/chunk-OSY5K7L7.js +187 -0
  410. package/dist/chunk-OV6QJRT4.js +45 -0
  411. package/dist/chunk-OVKYVZMW.js +108 -0
  412. package/dist/chunk-OZCBM3UC.js +171 -0
  413. package/dist/chunk-P3A2EINJ.js +61 -0
  414. package/dist/chunk-PTAG4PDC.js +27 -0
  415. package/dist/chunk-PTF5B7TJ.js +298 -0
  416. package/dist/chunk-Q3DPEYX4.js +848 -0
  417. package/dist/chunk-Q6CGOPJD.js +215 -0
  418. package/dist/chunk-Q6CGOPJD.js.map +1 -0
  419. package/dist/chunk-QB2KMIDP.js +100 -0
  420. package/dist/chunk-QCSJ4CWE.js +1067 -0
  421. package/dist/chunk-QIOQ2NPQ.js +414 -0
  422. package/dist/chunk-QK5EFEUT.js +353 -0
  423. package/dist/chunk-QPQBLYQJ.js +41 -0
  424. package/dist/chunk-QPSGCC5D.js +184 -0
  425. package/dist/chunk-QZAAUQRN.js +474 -0
  426. package/dist/chunk-QZM6YDJW.js +489 -0
  427. package/dist/chunk-QZM6YDJW.js.map +1 -0
  428. package/dist/chunk-RGBI63KJ.js +188 -0
  429. package/dist/chunk-RLBKLAEY.js +138 -0
  430. package/dist/chunk-RMFKVOM7.js +304 -0
  431. package/dist/chunk-ROKQU7WG.js +258 -0
  432. package/dist/chunk-RPVREAU7.js +251 -0
  433. package/dist/chunk-RQKLF42C.js +723 -0
  434. package/dist/chunk-SC6RRD2D.js +38 -0
  435. package/dist/chunk-SC6RRD2D.js.map +1 -0
  436. package/dist/chunk-SEO7TICN.js +94 -0
  437. package/dist/chunk-SHHJCL7X.js +432 -0
  438. package/dist/chunk-SIRLACNZ.js +114 -0
  439. package/dist/chunk-SKPHMYAA.js +237 -0
  440. package/dist/chunk-SODC7T6L.js +1583 -0
  441. package/dist/chunk-SQJIKMN3.js +366 -0
  442. package/dist/chunk-SVINDKVW.js +26 -0
  443. package/dist/chunk-SYCDHPZF.js +335 -0
  444. package/dist/chunk-T2QX3FDP.js +133 -0
  445. package/dist/chunk-T3OWFVMS.js +1187 -0
  446. package/dist/chunk-T6XI5FLY.js +61 -0
  447. package/dist/chunk-T7OXJZCX.js +62 -0
  448. package/dist/chunk-TAT5USZN.js +353 -0
  449. package/dist/chunk-TPQTRNER.js +172 -0
  450. package/dist/chunk-TUIN4MB7.js +266 -0
  451. package/dist/chunk-TX3VECZU.js +71 -0
  452. package/dist/chunk-TXLIEOJX.js +9624 -0
  453. package/dist/chunk-U3DN4HEY.js +27 -0
  454. package/dist/chunk-U7XM7CB4.js +191 -0
  455. package/dist/chunk-UJK53QFL.js +140 -0
  456. package/dist/chunk-UMTXA2TH.js +319 -0
  457. package/dist/chunk-UPDSXFK5.js +199 -0
  458. package/dist/chunk-UTIAXH52.js +269 -0
  459. package/dist/chunk-UVN5TMHU.js +1184 -0
  460. package/dist/chunk-V4Z4B2E3.js +52 -0
  461. package/dist/chunk-V4Z4B2E3.js.map +1 -0
  462. package/dist/chunk-VGYXW3VG.js +246 -0
  463. package/dist/chunk-VS7AHPCZ.js +255 -0
  464. package/dist/chunk-VTTAJOQ7.js +121 -0
  465. package/dist/chunk-VWPOLUAO.js +99 -0
  466. package/dist/chunk-X3MWB2QU.js +3851 -0
  467. package/dist/chunk-X6KAJI3V.js +211 -0
  468. package/dist/chunk-XBLRHV5R.js +50 -0
  469. package/dist/chunk-XDFP2LMW.js +605 -0
  470. package/dist/chunk-XEQMZB3C.js +525 -0
  471. package/dist/chunk-XEYLT5VA.js +223 -0
  472. package/dist/chunk-XHIQ5I6N.js +918 -0
  473. package/dist/chunk-XLH7QY2R.js +378 -0
  474. package/dist/chunk-XWFAMUZQ.js +113 -0
  475. package/dist/chunk-Y4BB2KS2.js +294 -0
  476. package/dist/chunk-Y4BB2KS2.js.map +1 -0
  477. package/dist/chunk-Y4OBB2VN.js +84 -0
  478. package/dist/chunk-YCVD6CI3.js +234 -0
  479. package/dist/chunk-YENLNISG.js +270 -0
  480. package/dist/chunk-YIRVLKAX.js +351 -0
  481. package/dist/chunk-YL73CVNK.js +390 -0
  482. package/dist/chunk-YLS6QE5G.js +288 -0
  483. package/dist/chunk-YNF2OC54.js +366 -0
  484. package/dist/chunk-YNF2OC54.js.map +1 -0
  485. package/dist/chunk-YPWU5KPE.js +147 -0
  486. package/dist/chunk-YQXTDZSU.js +2984 -0
  487. package/dist/chunk-YSJEAAOL.js +178 -0
  488. package/dist/chunk-YWIFM7D7.js +499 -0
  489. package/dist/chunk-YWVI6ZMK.js +103 -0
  490. package/dist/chunk-Z4FMAFNH.js +847 -0
  491. package/dist/chunk-Z654FWNU.js +136 -0
  492. package/dist/chunk-Z7Y523PS.js +130 -0
  493. package/dist/chunk-ZD67RM6G.js +60 -0
  494. package/dist/chunk-ZEG4VPBL.js +187 -0
  495. package/dist/chunk-ZHDFQITM.js +283 -0
  496. package/dist/chunk-ZHDFQITM.js.map +1 -0
  497. package/dist/chunk-ZLYCOBHW.js +75 -0
  498. package/dist/chunk-ZNJ5MTXV.js +89 -0
  499. package/dist/chunk-ZSGY3H53.js +155 -0
  500. package/dist/chunk-ZTPXACWB.js +1788 -0
  501. package/dist/chunk-ZUA3JMI6.js +107 -0
  502. package/dist/chunk-ZYAZUPPV.js +559 -0
  503. package/dist/composer.js +8 -8
  504. package/dist/computer-viewer-TDDO25AV.js +21 -0
  505. package/dist/connect.js +12 -12
  506. package/dist/desktop-dictation.js +12 -10
  507. package/dist/desktop-dictation.js.map +1 -1
  508. package/dist/desktop.js +2 -2
  509. package/dist/editor.js +2 -2
  510. package/dist/embedded-new-voice-2G3VLPVQ.js +24 -0
  511. package/dist/embedded-voice-T5IWOWGD.js +24 -0
  512. package/dist/fleet-decision-row-WM64KXP3.js +361 -0
  513. package/dist/in-chat-connect-model.js +5 -5
  514. package/dist/index.js +51 -51
  515. package/dist/interaction.js +5 -5
  516. package/dist/machines.js +3 -3
  517. package/dist/meetings-recorder.js +1 -1
  518. package/dist/meetings.js +40 -32
  519. package/dist/meetings.js.map +1 -1
  520. package/dist/messages/en.d.ts +3 -0
  521. package/dist/messages.js +1 -1
  522. package/dist/model-policy-picker-menu-SMC6J6QN.js +22 -0
  523. package/dist/payment-page-card-G4U63KUV.js +223 -0
  524. package/dist/platform-activity-row-BUZGZAKZ.js +128 -0
  525. package/dist/queue-surface-implementation-4KUZ4PJV.js +908 -0
  526. package/dist/realtime.js +4 -4
  527. package/dist/recorder-host-WF2RRR56.js +69 -0
  528. package/dist/recorder-host-WF2RRR56.js.map +1 -0
  529. package/dist/recordings.js +3 -3
  530. package/dist/sandbox-files-ESDMOFSD.js +27 -0
  531. package/dist/session-app.js +211 -209
  532. package/dist/session-connect-cards-Q53KMMYY.js +25 -0
  533. package/dist/session-list-model.js +2 -2
  534. package/dist/session-realtime-CF3I35WJ.js +30 -0
  535. package/dist/session-realtime.js +2 -2
  536. package/dist/session-ui.js +33 -31
  537. package/dist/session.js +5 -5
  538. package/dist/sites.js +2 -2
  539. package/dist/terminal.js +2 -2
  540. package/dist/this-computer.js +3 -3
  541. package/dist/timeline-annotation-markers-CJK4RYZ4.js +157 -0
  542. package/dist/timeline-annotation-selection-67GF5H26.js +208 -0
  543. package/dist/timeline-annotations-dialog-ONJPQDJQ.js +283 -0
  544. package/dist/ui/access-list.js +11 -9
  545. package/dist/ui/access-list.js.map +1 -1
  546. package/dist/ui/api-error.d.ts +6 -3
  547. package/dist/ui/api-error.js +2 -1
  548. package/dist/ui/cadence-picker.js +6 -4
  549. package/dist/ui/choice-cards.js +5 -3
  550. package/dist/ui/confirm-dialog.js +2 -2
  551. package/dist/ui/copy-field.js +5 -3
  552. package/dist/ui/detail-page.js +2 -2
  553. package/dist/ui/detail-sheet.js +2 -2
  554. package/dist/ui/diff-view.js +4 -3
  555. package/dist/ui/disclosure.js +3 -3
  556. package/dist/ui/email-chips-input.js +5 -3
  557. package/dist/ui/error-message.js +2 -1
  558. package/dist/ui/error-reference.d.ts +15 -0
  559. package/dist/ui/error-text.d.ts +10 -0
  560. package/dist/ui/error-text.js +9 -0
  561. package/dist/ui/error-text.js.map +1 -0
  562. package/dist/ui/field.js +4 -2
  563. package/dist/ui/flush-form-page.js +8 -6
  564. package/dist/ui/form-dialog.js +7 -5
  565. package/dist/ui/list-row.js +3 -3
  566. package/dist/ui/load-failure.js +3 -2
  567. package/dist/ui/load-failure.js.map +1 -1
  568. package/dist/ui/notice.js +3 -1
  569. package/dist/ui/relative-time.js +2 -2
  570. package/dist/ui/revision-history.js +9 -7
  571. package/dist/ui/revision-history.js.map +1 -1
  572. package/dist/ui/role-select.js +10 -8
  573. package/dist/ui/segmented-control.js +4 -2
  574. package/dist/ui/select-menu.js +5 -3
  575. package/dist/ui/setting-row.js +3 -1
  576. package/dist/ui/switch.js +4 -2
  577. package/dist/ui/usage-meter.js +3 -3
  578. package/dist/ui/word-list-row.js +4 -2
  579. package/dist/usage.js +2 -2
  580. package/dist/workbench.js +4 -4
  581. package/package.json +5 -6
  582. package/src/app/app-state.tsx +126 -14
  583. package/src/app/components/artifacts/site-data.tsx +2 -2
  584. package/src/app/components/artifacts/site-settings.tsx +2 -2
  585. package/src/app/components/rail/session-list.tsx +7 -8
  586. package/src/app/components/rail/session-shell.tsx +3 -3
  587. package/src/app/components/repository-picker.tsx +8 -1
  588. package/src/app/components/session/model-context-inspector.tsx +2 -1
  589. package/src/app/components/session/session-admin-access.tsx +2 -2
  590. package/src/app/lib/actions/chat-operations.ts +4 -4
  591. package/src/app/lib/archive-session.test.tsx +265 -2
  592. package/src/app/lib/archive-session.tsx +175 -9
  593. package/src/app/lib/copy-link.ts +2 -2
  594. package/src/app/lib/inbox.tsx +2 -2
  595. package/src/app/lib/session-failure-toasts.ts +3 -2
  596. package/src/app/lib/toast.test.tsx +215 -0
  597. package/src/app/lib/toast.tsx +67 -2
  598. package/src/app/personal-github-reconnect.test.tsx +356 -0
  599. package/src/app/routes/artifacts.tsx +1 -2
  600. package/src/components/tool-action-review.tsx +14 -1
  601. package/src/meetings/delete-meeting-dialog.tsx +2 -1
  602. package/src/meetings/meeting-ask.tsx +2 -1
  603. package/src/meetings/meeting-detail-page.tsx +2 -1
  604. package/src/meetings/meeting-notes.tsx +2 -1
  605. package/src/meetings/meeting-settings.tsx +4 -1
  606. package/src/meetings/meeting-transcript.tsx +4 -1
  607. package/src/meetings/recorder-context.tsx +10 -0
  608. package/src/meetings/recorder-host.test.tsx +60 -2
  609. package/src/meetings/recorder-host.tsx +16 -3
  610. package/src/meetings/recorder-panel.tsx +2 -1
  611. package/src/meetings/recorder-workspace.test.tsx +26 -1
  612. package/src/messages/en.ts +6 -0
  613. package/src/ui/api-error.test.ts +29 -5
  614. package/src/ui/api-error.tsx +10 -4
  615. package/src/ui/error-message.tsx +8 -0
  616. package/src/ui/error-reference.test.ts +54 -0
  617. package/src/ui/error-reference.ts +51 -0
  618. package/src/ui/error-text.test.tsx +66 -0
  619. package/src/ui/error-text.tsx +49 -0
  620. package/src/ui/field.tsx +4 -1
  621. package/src/ui/notice.tsx +7 -2
  622. package/src/ui/setting-row.tsx +4 -1
  623. package/styles/app.css +12 -0
  624. package/styles/compiled.css +9 -0
  625. package/dist/browser-viewer-NOP5EAUO.js +0 -23
  626. package/dist/chat-interactive-block-G7O44JHR.js +0 -18
  627. package/dist/chunk-26RWVLRD.js +0 -135
  628. package/dist/chunk-2AHTY7OT.js +0 -247
  629. package/dist/chunk-2GDNWKSC.js +0 -3670
  630. package/dist/chunk-2JENKGCE.js +0 -339
  631. package/dist/chunk-2KYQC4T5.js +0 -155
  632. package/dist/chunk-2RREGDQH.js +0 -708
  633. package/dist/chunk-2T7DX6KR.js +0 -353
  634. package/dist/chunk-2VB2O4FQ.js +0 -920
  635. package/dist/chunk-2VTTKH23.js +0 -94
  636. package/dist/chunk-2XNG2KNT.js +0 -172
  637. package/dist/chunk-2YC6JQRO.js +0 -399
  638. package/dist/chunk-2ZVRJRXC.js +0 -27
  639. package/dist/chunk-35737UT4.js +0 -162
  640. package/dist/chunk-366XZ4PM.js +0 -41
  641. package/dist/chunk-36MIDGAH.js +0 -199
  642. package/dist/chunk-3FD76LXM.js +0 -212
  643. package/dist/chunk-3OVIXY4O.js +0 -213
  644. package/dist/chunk-3OVIXY4O.js.map +0 -1
  645. package/dist/chunk-3QNRBEYH.js +0 -432
  646. package/dist/chunk-3QX55WLC.js +0 -15
  647. package/dist/chunk-3USJPT2S.js +0 -1022
  648. package/dist/chunk-42CMQ5VR.js +0 -251
  649. package/dist/chunk-4LPOWQJY.js +0 -42
  650. package/dist/chunk-4NBTZRKT.js +0 -79
  651. package/dist/chunk-4OXI6HCV.js +0 -118
  652. package/dist/chunk-4SZZAFYQ.js +0 -2317
  653. package/dist/chunk-4TQL3WP2.js +0 -140
  654. package/dist/chunk-4Y6BK7IU.js +0 -196
  655. package/dist/chunk-4YD7YZC5.js +0 -373
  656. package/dist/chunk-5DTST3TP.js +0 -81
  657. package/dist/chunk-5FH5LQVS.js +0 -130
  658. package/dist/chunk-5KWMYPJV.js +0 -847
  659. package/dist/chunk-5MUJDC6C.js +0 -84
  660. package/dist/chunk-5QM2WPKV.js +0 -41
  661. package/dist/chunk-5WUN7XPD.js +0 -1184
  662. package/dist/chunk-64PO2WXU.js +0 -1067
  663. package/dist/chunk-6AHATAAY.js +0 -431
  664. package/dist/chunk-6ED2YWBT.js +0 -56
  665. package/dist/chunk-6GXVYAGR.js +0 -170
  666. package/dist/chunk-6H4SJBPE.js +0 -85
  667. package/dist/chunk-6MT3HHUB.js +0 -84
  668. package/dist/chunk-6UHCBH4G.js +0 -198
  669. package/dist/chunk-6WLX3NR3.js +0 -198
  670. package/dist/chunk-73NXYYWE.js +0 -112
  671. package/dist/chunk-76ERNKIZ.js +0 -603
  672. package/dist/chunk-776QZ573.js +0 -57
  673. package/dist/chunk-7BYWOFVH.js +0 -171
  674. package/dist/chunk-7O5CGGIQ.js +0 -108
  675. package/dist/chunk-7QOHRZ67.js +0 -251
  676. package/dist/chunk-7WIDB4PL.js +0 -2058
  677. package/dist/chunk-7WKP3DYJ.js +0 -37
  678. package/dist/chunk-7XOVTPDI.js +0 -227
  679. package/dist/chunk-AB5MBIXY.js +0 -281
  680. package/dist/chunk-ADNMXBCX.js +0 -1193
  681. package/dist/chunk-AFBJTUFK.js +0 -202
  682. package/dist/chunk-ALVRWCXE.js +0 -61
  683. package/dist/chunk-AOHU6O3M.js +0 -247
  684. package/dist/chunk-AOHU6O3M.js.map +0 -1
  685. package/dist/chunk-APW4T4SW.js +0 -270
  686. package/dist/chunk-AXBSYWKX.js +0 -2656
  687. package/dist/chunk-B2I5ZW35.js +0 -422
  688. package/dist/chunk-B3LMRTRF.js +0 -223
  689. package/dist/chunk-BE2XENG2.js +0 -292
  690. package/dist/chunk-BE2XENG2.js.map +0 -1
  691. package/dist/chunk-BF4SADKX.js +0 -29
  692. package/dist/chunk-BKP43KK4.js +0 -1788
  693. package/dist/chunk-BM3NEZ6X.js +0 -781
  694. package/dist/chunk-BT3BAGB5.js +0 -216
  695. package/dist/chunk-BTSYDIVJ.js +0 -357
  696. package/dist/chunk-BUBNGKWG.js +0 -70
  697. package/dist/chunk-BVUJV5WR.js +0 -126
  698. package/dist/chunk-BZO5ZMUP.js +0 -27
  699. package/dist/chunk-C3HUF3M2.js +0 -157
  700. package/dist/chunk-C5QCAOES.js +0 -264
  701. package/dist/chunk-CGK6ALQU.js +0 -159
  702. package/dist/chunk-CPYGO76Q.js +0 -335
  703. package/dist/chunk-CQH4FWYA.js +0 -490
  704. package/dist/chunk-CZP5QXNB.js +0 -234
  705. package/dist/chunk-D2TOWEYH.js +0 -266
  706. package/dist/chunk-D6L4GHRH.js +0 -340
  707. package/dist/chunk-DKT3N37I.js +0 -50
  708. package/dist/chunk-DMMJIFKA.js +0 -84
  709. package/dist/chunk-DO74DQC7.js +0 -26
  710. package/dist/chunk-DOFJZ2JU.js +0 -83
  711. package/dist/chunk-DSXVY5WZ.js +0 -119
  712. package/dist/chunk-E337C2VK.js +0 -82
  713. package/dist/chunk-E6NRSRBE.js +0 -114
  714. package/dist/chunk-E6SQKHAU.js +0 -114
  715. package/dist/chunk-E7UIVD7F.js +0 -236
  716. package/dist/chunk-EGBII4CP.js +0 -229
  717. package/dist/chunk-EILSAQVJ.js +0 -200
  718. package/dist/chunk-ELL6HSYR.js +0 -307
  719. package/dist/chunk-EUBGLFFR.js +0 -73
  720. package/dist/chunk-EW6RNWSH.js +0 -212
  721. package/dist/chunk-EYUT5Y6V.js +0 -2599
  722. package/dist/chunk-F7U3QPZ3.js +0 -304
  723. package/dist/chunk-FBTJKSTM.js +0 -1270
  724. package/dist/chunk-FC2FTSK3.js +0 -2424
  725. package/dist/chunk-FOGNA3BU.js +0 -148
  726. package/dist/chunk-FQFKHNC7.js +0 -650
  727. package/dist/chunk-FTCHM755.js +0 -50
  728. package/dist/chunk-FXSHP4JZ.js +0 -3550
  729. package/dist/chunk-G6ZZC543.js +0 -818
  730. package/dist/chunk-G7FU6PUA.js +0 -100
  731. package/dist/chunk-GA4YEAMX.js +0 -3851
  732. package/dist/chunk-GE33BGB7.js +0 -12
  733. package/dist/chunk-GQ67HSJY.js +0 -570
  734. package/dist/chunk-GXXZ3WAK.js +0 -106
  735. package/dist/chunk-H2TCRX3H.js +0 -237
  736. package/dist/chunk-HLL4PBO7.js +0 -60
  737. package/dist/chunk-HLOEPV5C.js +0 -259
  738. package/dist/chunk-HUAGBS4O.js +0 -56
  739. package/dist/chunk-I36GSRUJ.js +0 -211
  740. package/dist/chunk-I6VBHT7S.js +0 -261
  741. package/dist/chunk-ICNNNOXE.js +0 -333
  742. package/dist/chunk-ICX64J4U.js +0 -172
  743. package/dist/chunk-ID36Y46W.js +0 -5046
  744. package/dist/chunk-ID36Y46W.js.map +0 -1
  745. package/dist/chunk-IGVVXLKJ.js +0 -559
  746. package/dist/chunk-IKJLSBUI.js +0 -2984
  747. package/dist/chunk-IKMUFDVS.js +0 -50
  748. package/dist/chunk-IKUNOX7F.js +0 -255
  749. package/dist/chunk-ILKDYBON.js +0 -288
  750. package/dist/chunk-IVYJX3OY.js +0 -187
  751. package/dist/chunk-JCY4CMDH.js +0 -107
  752. package/dist/chunk-JJZPLGIP.js +0 -474
  753. package/dist/chunk-JW33RV4V.js +0 -143
  754. package/dist/chunk-JWPA6ZPZ.js +0 -351
  755. package/dist/chunk-JZ4QXS6D.js +0 -50
  756. package/dist/chunk-K42OUZQ3.js +0 -386
  757. package/dist/chunk-K5TOVX5A.js +0 -206
  758. package/dist/chunk-K63HGHZX.js +0 -99
  759. package/dist/chunk-K6R5T44I.js +0 -75
  760. package/dist/chunk-KHJ5PXFM.js +0 -914
  761. package/dist/chunk-KJZRQ55O.js +0 -2319
  762. package/dist/chunk-KJZRQ55O.js.map +0 -1
  763. package/dist/chunk-KKI55ZMW.js +0 -65
  764. package/dist/chunk-KRPLAAFP.js +0 -199
  765. package/dist/chunk-KVFEZDBO.js +0 -134
  766. package/dist/chunk-L4I665WK.js +0 -45
  767. package/dist/chunk-L4OF77LE.js +0 -110
  768. package/dist/chunk-L4OF77LE.js.map +0 -1
  769. package/dist/chunk-LA5T52RM.js +0 -70
  770. package/dist/chunk-LM2W5YAT.js +0 -401
  771. package/dist/chunk-LQ62ECE6.js +0 -390
  772. package/dist/chunk-LQDUHU3Y.js +0 -71
  773. package/dist/chunk-LRJIYTZW.js +0 -4157
  774. package/dist/chunk-LRJIYTZW.js.map +0 -1
  775. package/dist/chunk-LRN6GYAZ.js +0 -138
  776. package/dist/chunk-M4SDVTKJ.js +0 -790
  777. package/dist/chunk-MA6O7CM6.js +0 -99
  778. package/dist/chunk-MBIBB6GI.js +0 -197
  779. package/dist/chunk-MF3ZFB4H.js +0 -199
  780. package/dist/chunk-MJJGJMYJ.js +0 -98
  781. package/dist/chunk-MLJADQFI.js +0 -4824
  782. package/dist/chunk-MQG7RV3B.js +0 -62
  783. package/dist/chunk-MTTGSQA5.js +0 -186
  784. package/dist/chunk-MW7Y3T55.js +0 -525
  785. package/dist/chunk-MYUFMVCH.js +0 -121
  786. package/dist/chunk-N3OARGH2.js +0 -61
  787. package/dist/chunk-NB2HMRT2.js +0 -353
  788. package/dist/chunk-NFDFYWMV.js +0 -141
  789. package/dist/chunk-NWGNFN3N.js +0 -1187
  790. package/dist/chunk-NWJRPDIO.js +0 -840
  791. package/dist/chunk-NWJRPDIO.js.map +0 -1
  792. package/dist/chunk-NXWBBZJV.js +0 -267
  793. package/dist/chunk-NY2QWROL.js +0 -71
  794. package/dist/chunk-O2IOPP3R.js +0 -848
  795. package/dist/chunk-O2UWH5RG.js +0 -141
  796. package/dist/chunk-O5YWDLYF.js +0 -393
  797. package/dist/chunk-OBMCZO7E.js +0 -121
  798. package/dist/chunk-OD3DCCCB.js +0 -132
  799. package/dist/chunk-OMH7R6I3.js +0 -390
  800. package/dist/chunk-OSA5EQG5.js +0 -113
  801. package/dist/chunk-OSJ3MUTZ.js +0 -2936
  802. package/dist/chunk-OWAYJ2OV.js +0 -368
  803. package/dist/chunk-OYXBFSGK.js +0 -269
  804. package/dist/chunk-PC2EBA5G.js +0 -4116
  805. package/dist/chunk-PC2EBA5G.js.map +0 -1
  806. package/dist/chunk-PC2MVXIP.js +0 -363
  807. package/dist/chunk-PC2MVXIP.js.map +0 -1
  808. package/dist/chunk-PENGLDR5.js +0 -309
  809. package/dist/chunk-PSMAWRPL.js +0 -191
  810. package/dist/chunk-PW4IMTYR.js +0 -702
  811. package/dist/chunk-PW54V7T5.js +0 -387
  812. package/dist/chunk-Q2EXYSMO.js +0 -24
  813. package/dist/chunk-Q2XJK5I4.js +0 -51
  814. package/dist/chunk-Q2XJK5I4.js.map +0 -1
  815. package/dist/chunk-Q4EFRI6X.js +0 -258
  816. package/dist/chunk-Q52CXW6C.js +0 -48
  817. package/dist/chunk-Q6XQ2R37.js +0 -184
  818. package/dist/chunk-QAJ53XBW.js +0 -23
  819. package/dist/chunk-QDTKECT4.js +0 -129
  820. package/dist/chunk-QE3ZFGI3.js +0 -43
  821. package/dist/chunk-QHHSUR2Y.js +0 -298
  822. package/dist/chunk-QHNVNR7B.js +0 -173
  823. package/dist/chunk-QIK2Q6N5.js +0 -376
  824. package/dist/chunk-QWL4L366.js +0 -38
  825. package/dist/chunk-R3J2PTVQ.js +0 -690
  826. package/dist/chunk-RBRX5ZS3.js +0 -319
  827. package/dist/chunk-REX6JIC7.js +0 -33
  828. package/dist/chunk-RGZ7EEC3.js +0 -537
  829. package/dist/chunk-RGZ7EEC3.js.map +0 -1
  830. package/dist/chunk-RIPS7GFR.js +0 -960
  831. package/dist/chunk-RTBZNFNV.js +0 -1354
  832. package/dist/chunk-RTBZNFNV.js.map +0 -1
  833. package/dist/chunk-SKMNW4SW.js +0 -187
  834. package/dist/chunk-SRFARKXC.js +0 -623
  835. package/dist/chunk-SWIHWCTW.js +0 -4461
  836. package/dist/chunk-TA5CFTO4.js +0 -103
  837. package/dist/chunk-TF4ZVJLI.js +0 -156
  838. package/dist/chunk-TG7DADJR.js +0 -9624
  839. package/dist/chunk-TI4R2ZD5.js +0 -623
  840. package/dist/chunk-TI4R2ZD5.js.map +0 -1
  841. package/dist/chunk-TNKWOUWP.js +0 -412
  842. package/dist/chunk-TNUSPXPW.js +0 -5555
  843. package/dist/chunk-TNUSPXPW.js.map +0 -1
  844. package/dist/chunk-TNYFHKVV.js +0 -366
  845. package/dist/chunk-TPMZBOFH.js +0 -178
  846. package/dist/chunk-TW3LKRJF.js +0 -263
  847. package/dist/chunk-TZAO65I4.js +0 -83
  848. package/dist/chunk-U5EFEMYU.js +0 -89
  849. package/dist/chunk-U6M4LS3M.js +0 -378
  850. package/dist/chunk-UI4HI5QK.js +0 -918
  851. package/dist/chunk-UJDOWCQ3.js +0 -272
  852. package/dist/chunk-UJUQ2QOX.js +0 -581
  853. package/dist/chunk-UQ3IM6FY.js +0 -133
  854. package/dist/chunk-UYE47LO6.js +0 -246
  855. package/dist/chunk-VADHIT26.js +0 -89
  856. package/dist/chunk-VFQ3H6CO.js +0 -163
  857. package/dist/chunk-VGUN6VB2.js +0 -188
  858. package/dist/chunk-VGWWEVSD.js +0 -723
  859. package/dist/chunk-VIEFJ2DM.js +0 -2469
  860. package/dist/chunk-VLXM36VS.js +0 -268
  861. package/dist/chunk-W3BFRR2G.js +0 -499
  862. package/dist/chunk-W5MPXR3A.js +0 -981
  863. package/dist/chunk-W5OWKVZG.js +0 -136
  864. package/dist/chunk-W6FRORMX.js +0 -486
  865. package/dist/chunk-W6FRORMX.js.map +0 -1
  866. package/dist/chunk-W7XROSZO.js +0 -232
  867. package/dist/chunk-W7XROSZO.js.map +0 -1
  868. package/dist/chunk-WEZ5PXZP.js +0 -403
  869. package/dist/chunk-WHWUWN2X.js +0 -197
  870. package/dist/chunk-WHWUWN2X.js.map +0 -1
  871. package/dist/chunk-WLEDGIVS.js +0 -114
  872. package/dist/chunk-WLEDGIVS.js.map +0 -1
  873. package/dist/chunk-WNDAKLHG.js +0 -281
  874. package/dist/chunk-WTJ4PLMU.js +0 -103
  875. package/dist/chunk-WV2KPJUW.js +0 -107
  876. package/dist/chunk-X3VY5EGY.js +0 -277
  877. package/dist/chunk-X3VY5EGY.js.map +0 -1
  878. package/dist/chunk-XDBYWVCW.js +0 -418
  879. package/dist/chunk-XF7MA4U5.js +0 -36
  880. package/dist/chunk-XF7MA4U5.js.map +0 -1
  881. package/dist/chunk-XOSQP3YA.js +0 -605
  882. package/dist/chunk-XYBV4ZJQ.js +0 -271
  883. package/dist/chunk-YBKVGLQR.js +0 -147
  884. package/dist/chunk-YDCUBUWH.js +0 -1583
  885. package/dist/chunk-YG6NARQY.js +0 -51
  886. package/dist/chunk-YG6NARQY.js.map +0 -1
  887. package/dist/chunk-YSVD5HI4.js +0 -278
  888. package/dist/chunk-YT3WGNG6.js +0 -290
  889. package/dist/chunk-YYICQDK4.js +0 -414
  890. package/dist/chunk-YYLMZLI6.js +0 -686
  891. package/dist/chunk-ZAMTKG5U.js +0 -95
  892. package/dist/chunk-ZDLYSXKN.js +0 -111
  893. package/dist/chunk-ZG447FSS.js +0 -194
  894. package/dist/chunk-ZIT5KD4Q.js +0 -264
  895. package/dist/chunk-ZUDOVDKR.js +0 -3064
  896. package/dist/chunk-ZW2ECJ3A.js +0 -451
  897. package/dist/computer-viewer-LPZ763KF.js +0 -21
  898. package/dist/embedded-new-voice-YVMKSLKJ.js +0 -24
  899. package/dist/embedded-voice-BJPQFXSU.js +0 -24
  900. package/dist/fleet-decision-row-AA4H5CDT.js +0 -361
  901. package/dist/model-policy-picker-menu-HSMWVO4P.js +0 -22
  902. package/dist/payment-page-card-3LTSFJGN.js +0 -223
  903. package/dist/platform-activity-row-5VYV6TX4.js +0 -128
  904. package/dist/queue-surface-implementation-NXHZUKD2.js +0 -908
  905. package/dist/recorder-host-ZKRWTDBM.js +0 -57
  906. package/dist/recorder-host-ZKRWTDBM.js.map +0 -1
  907. package/dist/sandbox-files-YCMLQUFU.js +0 -27
  908. package/dist/session-connect-cards-KSQLMRM5.js +0 -25
  909. package/dist/session-realtime-ZR6JLG3Y.js +0 -30
  910. package/dist/timeline-annotation-markers-YAHDPWVG.js +0 -157
  911. package/dist/timeline-annotation-selection-KHXNCEJP.js +0 -208
  912. package/dist/timeline-annotations-dialog-Y4XD3N7B.js +0 -283
  913. /package/dist/{browser-viewer-NOP5EAUO.js.map → browser-viewer-TC27OCIP.js.map} +0 -0
  914. /package/dist/{chat-interactive-block-G7O44JHR.js.map → chat-interactive-block-RWPQBHVS.js.map} +0 -0
  915. /package/dist/{chunk-EGBII4CP.js.map → chunk-2BDT3UZQ.js.map} +0 -0
  916. /package/dist/{chunk-4YD7YZC5.js.map → chunk-2CLNIEK4.js.map} +0 -0
  917. /package/dist/{chunk-ZW2ECJ3A.js.map → chunk-2FSBSCZJ.js.map} +0 -0
  918. /package/dist/{chunk-KRPLAAFP.js.map → chunk-2I7HDP53.js.map} +0 -0
  919. /package/dist/{chunk-3QX55WLC.js.map → chunk-2INLDVK3.js.map} +0 -0
  920. /package/dist/{chunk-BVUJV5WR.js.map → chunk-2KALVELR.js.map} +0 -0
  921. /package/dist/{chunk-XDBYWVCW.js.map → chunk-2M3J7ZWQ.js.map} +0 -0
  922. /package/dist/{chunk-2RREGDQH.js.map → chunk-2OP6WLGV.js.map} +0 -0
  923. /package/dist/{chunk-OSJ3MUTZ.js.map → chunk-2RG7NIAS.js.map} +0 -0
  924. /package/dist/{chunk-26RWVLRD.js.map → chunk-2STUPWEL.js.map} +0 -0
  925. /package/dist/{chunk-XYBV4ZJQ.js.map → chunk-2YUOVM3G.js.map} +0 -0
  926. /package/dist/{chunk-2GDNWKSC.js.map → chunk-2Z3NQNTM.js.map} +0 -0
  927. /package/dist/{chunk-2VB2O4FQ.js.map → chunk-3CPWWGNK.js.map} +0 -0
  928. /package/dist/{chunk-7WKP3DYJ.js.map → chunk-3ED2U6XE.js.map} +0 -0
  929. /package/dist/{chunk-BT3BAGB5.js.map → chunk-3GZA4BUW.js.map} +0 -0
  930. /package/dist/{chunk-3USJPT2S.js.map → chunk-3IK6UYO6.js.map} +0 -0
  931. /package/dist/{chunk-6AHATAAY.js.map → chunk-3PZ7JZI2.js.map} +0 -0
  932. /package/dist/{chunk-JZ4QXS6D.js.map → chunk-4DVJ6ONS.js.map} +0 -0
  933. /package/dist/{chunk-5QM2WPKV.js.map → chunk-4E3ZJRTZ.js.map} +0 -0
  934. /package/dist/{chunk-NFDFYWMV.js.map → chunk-4SAWSRAA.js.map} +0 -0
  935. /package/dist/{chunk-ELL6HSYR.js.map → chunk-53AGXXZM.js.map} +0 -0
  936. /package/dist/{chunk-G6ZZC543.js.map → chunk-54YW6SZZ.js.map} +0 -0
  937. /package/dist/{chunk-4SZZAFYQ.js.map → chunk-57AZS3IE.js.map} +0 -0
  938. /package/dist/{chunk-JW33RV4V.js.map → chunk-5CPEEAFD.js.map} +0 -0
  939. /package/dist/{chunk-D6L4GHRH.js.map → chunk-5EWSRZ2Y.js.map} +0 -0
  940. /package/dist/{chunk-PW54V7T5.js.map → chunk-5IE76VCY.js.map} +0 -0
  941. /package/dist/{chunk-6GXVYAGR.js.map → chunk-5NWEKLDZ.js.map} +0 -0
  942. /package/dist/{chunk-6UHCBH4G.js.map → chunk-5O2FCCHZ.js.map} +0 -0
  943. /package/dist/{chunk-2YC6JQRO.js.map → chunk-5QAY6K77.js.map} +0 -0
  944. /package/dist/{chunk-EYUT5Y6V.js.map → chunk-6DK6Z4UN.js.map} +0 -0
  945. /package/dist/{chunk-PW4IMTYR.js.map → chunk-6DVCC7QS.js.map} +0 -0
  946. /package/dist/{chunk-7WIDB4PL.js.map → chunk-6JHU2UBS.js.map} +0 -0
  947. /package/dist/{chunk-CQH4FWYA.js.map → chunk-6PZ7OBYU.js.map} +0 -0
  948. /package/dist/{chunk-VFQ3H6CO.js.map → chunk-6WGRDRMA.js.map} +0 -0
  949. /package/dist/{chunk-MTTGSQA5.js.map → chunk-77WAKEAH.js.map} +0 -0
  950. /package/dist/{chunk-O5YWDLYF.js.map → chunk-7TDO3CUM.js.map} +0 -0
  951. /package/dist/{chunk-2AHTY7OT.js.map → chunk-7TIX2UAR.js.map} +0 -0
  952. /package/dist/{chunk-FOGNA3BU.js.map → chunk-7V5REBCP.js.map} +0 -0
  953. /package/dist/{chunk-2JENKGCE.js.map → chunk-7VMZGLYI.js.map} +0 -0
  954. /package/dist/{chunk-E7UIVD7F.js.map → chunk-7W37NS3I.js.map} +0 -0
  955. /package/dist/{chunk-ZDLYSXKN.js.map → chunk-7X6SDK2C.js.map} +0 -0
  956. /package/dist/{chunk-ZAMTKG5U.js.map → chunk-7ZNUHRP5.js.map} +0 -0
  957. /package/dist/{chunk-DMMJIFKA.js.map → chunk-A36PZALD.js.map} +0 -0
  958. /package/dist/{chunk-WV2KPJUW.js.map → chunk-AUI6VA63.js.map} +0 -0
  959. /package/dist/{chunk-Q2EXYSMO.js.map → chunk-AW2MQB37.js.map} +0 -0
  960. /package/dist/{chunk-6WLX3NR3.js.map → chunk-AWKES45Y.js.map} +0 -0
  961. /package/dist/{chunk-OD3DCCCB.js.map → chunk-AXHZYXUV.js.map} +0 -0
  962. /package/dist/{chunk-QDTKECT4.js.map → chunk-BHNSJVBC.js.map} +0 -0
  963. /package/dist/{chunk-FTCHM755.js.map → chunk-BJEJFISW.js.map} +0 -0
  964. /package/dist/{chunk-B2I5ZW35.js.map → chunk-BJFH6JI5.js.map} +0 -0
  965. /package/dist/{chunk-RIPS7GFR.js.map → chunk-BMICEQZQ.js.map} +0 -0
  966. /package/dist/{chunk-BF4SADKX.js.map → chunk-BTLBYBLU.js.map} +0 -0
  967. /package/dist/{chunk-U5EFEMYU.js.map → chunk-BXBDYNRP.js.map} +0 -0
  968. /package/dist/{chunk-BTSYDIVJ.js.map → chunk-C372BFOV.js.map} +0 -0
  969. /package/dist/{chunk-MLJADQFI.js.map → chunk-CMKGILJK.js.map} +0 -0
  970. /package/dist/{chunk-DKT3N37I.js.map → chunk-CRAOSVHC.js.map} +0 -0
  971. /package/dist/{chunk-WNDAKLHG.js.map → chunk-CRU35QQH.js.map} +0 -0
  972. /package/dist/{chunk-2XNG2KNT.js.map → chunk-CUIWCGMA.js.map} +0 -0
  973. /package/dist/{chunk-QWL4L366.js.map → chunk-D5TWNFFE.js.map} +0 -0
  974. /package/dist/{chunk-SWIHWCTW.js.map → chunk-DF5EAHDN.js.map} +0 -0
  975. /package/dist/{chunk-HUAGBS4O.js.map → chunk-DJAXC5OK.js.map} +0 -0
  976. /package/dist/{chunk-FXSHP4JZ.js.map → chunk-DXBYWSL5.js.map} +0 -0
  977. /package/dist/{chunk-5MUJDC6C.js.map → chunk-DXR5PDFP.js.map} +0 -0
  978. /package/dist/{chunk-NXWBBZJV.js.map → chunk-DZWARC4M.js.map} +0 -0
  979. /package/dist/{chunk-GXXZ3WAK.js.map → chunk-DZXEDSQI.js.map} +0 -0
  980. /package/dist/{chunk-Q52CXW6C.js.map → chunk-E7XERZWC.js.map} +0 -0
  981. /package/dist/{chunk-4NBTZRKT.js.map → chunk-ECJBYNLJ.js.map} +0 -0
  982. /package/dist/{chunk-QE3ZFGI3.js.map → chunk-EDI6SJ2N.js.map} +0 -0
  983. /package/dist/{chunk-E6NRSRBE.js.map → chunk-EWSOC6WF.js.map} +0 -0
  984. /package/dist/{chunk-TA5CFTO4.js.map → chunk-F2OPHAUN.js.map} +0 -0
  985. /package/dist/{chunk-5DTST3TP.js.map → chunk-F4ISQGGM.js.map} +0 -0
  986. /package/dist/{chunk-MBIBB6GI.js.map → chunk-FO4LYKJL.js.map} +0 -0
  987. /package/dist/{chunk-EUBGLFFR.js.map → chunk-FPXASDG5.js.map} +0 -0
  988. /package/dist/{chunk-C3HUF3M2.js.map → chunk-FVXBNBHO.js.map} +0 -0
  989. /package/dist/{chunk-W5MPXR3A.js.map → chunk-FZC5N55X.js.map} +0 -0
  990. /package/dist/{chunk-MA6O7CM6.js.map → chunk-GAVYGBFI.js.map} +0 -0
  991. /package/dist/{chunk-REX6JIC7.js.map → chunk-GKVJIDHF.js.map} +0 -0
  992. /package/dist/{chunk-EW6RNWSH.js.map → chunk-GVN5SZLX.js.map} +0 -0
  993. /package/dist/{chunk-KVFEZDBO.js.map → chunk-H3T7IWNA.js.map} +0 -0
  994. /package/dist/{chunk-I6VBHT7S.js.map → chunk-HAX4LCR5.js.map} +0 -0
  995. /package/dist/{chunk-OBMCZO7E.js.map → chunk-HC4JFZVU.js.map} +0 -0
  996. /package/dist/{chunk-UJUQ2QOX.js.map → chunk-HEFPPMBQ.js.map} +0 -0
  997. /package/dist/{chunk-DOFJZ2JU.js.map → chunk-HNLR7Q4Z.js.map} +0 -0
  998. /package/dist/{chunk-GE33BGB7.js.map → chunk-HSOXMJOT.js.map} +0 -0
  999. /package/dist/{chunk-AB5MBIXY.js.map → chunk-I4MRDSUF.js.map} +0 -0
  1000. /package/dist/{chunk-AFBJTUFK.js.map → chunk-I4QEJ62Y.js.map} +0 -0
  1001. /package/dist/{chunk-6ED2YWBT.js.map → chunk-I5B5L6Q4.js.map} +0 -0
  1002. /package/dist/{chunk-C5QCAOES.js.map → chunk-I5QZJODL.js.map} +0 -0
  1003. /package/dist/{chunk-76ERNKIZ.js.map → chunk-I7ITSXSJ.js.map} +0 -0
  1004. /package/dist/{chunk-OMH7R6I3.js.map → chunk-I7XIZRFD.js.map} +0 -0
  1005. /package/dist/{chunk-E337C2VK.js.map → chunk-IDANQPRH.js.map} +0 -0
  1006. /package/dist/{chunk-3FD76LXM.js.map → chunk-IFB3WJ36.js.map} +0 -0
  1007. /package/dist/{chunk-ZIT5KD4Q.js.map → chunk-IHTAKKTK.js.map} +0 -0
  1008. /package/dist/{chunk-QHNVNR7B.js.map → chunk-ILDXWY37.js.map} +0 -0
  1009. /package/dist/{chunk-GQ67HSJY.js.map → chunk-IMDQUHBJ.js.map} +0 -0
  1010. /package/dist/{chunk-DSXVY5WZ.js.map → chunk-IMZCQBOT.js.map} +0 -0
  1011. /package/dist/{chunk-WEZ5PXZP.js.map → chunk-IXPTECSC.js.map} +0 -0
  1012. /package/dist/{chunk-NY2QWROL.js.map → chunk-J255A3N5.js.map} +0 -0
  1013. /package/dist/{chunk-O2UWH5RG.js.map → chunk-J5F5HPPW.js.map} +0 -0
  1014. /package/dist/{chunk-VIEFJ2DM.js.map → chunk-JEA3QDX7.js.map} +0 -0
  1015. /package/dist/{chunk-TF4ZVJLI.js.map → chunk-JEUPAVYY.js.map} +0 -0
  1016. /package/dist/{chunk-ZG447FSS.js.map → chunk-JKHKLL5W.js.map} +0 -0
  1017. /package/dist/{chunk-FQFKHNC7.js.map → chunk-JQL7ZH6C.js.map} +0 -0
  1018. /package/dist/{chunk-776QZ573.js.map → chunk-JWB44UGJ.js.map} +0 -0
  1019. /package/dist/{chunk-ICNNNOXE.js.map → chunk-JZ4NLCAP.js.map} +0 -0
  1020. /package/dist/{chunk-TNKWOUWP.js.map → chunk-K2A5PXQ5.js.map} +0 -0
  1021. /package/dist/{chunk-SRFARKXC.js.map → chunk-K56XV3C3.js.map} +0 -0
  1022. /package/dist/{chunk-QAJ53XBW.js.map → chunk-K6GAXXVA.js.map} +0 -0
  1023. /package/dist/{chunk-MF3ZFB4H.js.map → chunk-KCBMFSMS.js.map} +0 -0
  1024. /package/dist/{chunk-VLXM36VS.js.map → chunk-KF2FV3ZJ.js.map} +0 -0
  1025. /package/dist/{chunk-YSVD5HI4.js.map → chunk-KJD65EJP.js.map} +0 -0
  1026. /package/dist/{chunk-K42OUZQ3.js.map → chunk-KLEUWIMZ.js.map} +0 -0
  1027. /package/dist/{chunk-PENGLDR5.js.map → chunk-KODELWYT.js.map} +0 -0
  1028. /package/dist/{chunk-TZAO65I4.js.map → chunk-KRDR5RJD.js.map} +0 -0
  1029. /package/dist/{chunk-KHJ5PXFM.js.map → chunk-KUDGXAF7.js.map} +0 -0
  1030. /package/dist/{chunk-6H4SJBPE.js.map → chunk-KYS77RPN.js.map} +0 -0
  1031. /package/dist/{chunk-OWAYJ2OV.js.map → chunk-L7YTNTIK.js.map} +0 -0
  1032. /package/dist/{chunk-YYLMZLI6.js.map → chunk-LHPNABDH.js.map} +0 -0
  1033. /package/dist/{chunk-LM2W5YAT.js.map → chunk-MFROMEKA.js.map} +0 -0
  1034. /package/dist/{chunk-AXBSYWKX.js.map → chunk-MIHN76LX.js.map} +0 -0
  1035. /package/dist/{chunk-4LPOWQJY.js.map → chunk-MIYFS2XN.js.map} +0 -0
  1036. /package/dist/{chunk-KKI55ZMW.js.map → chunk-MJUCFQMS.js.map} +0 -0
  1037. /package/dist/{chunk-ZUDOVDKR.js.map → chunk-MM4FNWI4.js.map} +0 -0
  1038. /package/dist/{chunk-M4SDVTKJ.js.map → chunk-MNZG4OHU.js.map} +0 -0
  1039. /package/dist/{chunk-EILSAQVJ.js.map → chunk-N6AACDUW.js.map} +0 -0
  1040. /package/dist/{chunk-BM3NEZ6X.js.map → chunk-NC55IFN3.js.map} +0 -0
  1041. /package/dist/{chunk-MJJGJMYJ.js.map → chunk-NC7PVOEK.js.map} +0 -0
  1042. /package/dist/{chunk-LA5T52RM.js.map → chunk-NCYMNCJO.js.map} +0 -0
  1043. /package/dist/{chunk-HLOEPV5C.js.map → chunk-ND2BXV3P.js.map} +0 -0
  1044. /package/dist/{chunk-UJDOWCQ3.js.map → chunk-NDBTFUO6.js.map} +0 -0
  1045. /package/dist/{chunk-K5TOVX5A.js.map → chunk-NDQJZ7HF.js.map} +0 -0
  1046. /package/dist/{chunk-35737UT4.js.map → chunk-NGJJJPZZ.js.map} +0 -0
  1047. /package/dist/{chunk-42CMQ5VR.js.map → chunk-NJTSNNE7.js.map} +0 -0
  1048. /package/dist/{chunk-FBTJKSTM.js.map → chunk-NRTE7DNV.js.map} +0 -0
  1049. /package/dist/{chunk-YT3WGNG6.js.map → chunk-NULUNM7H.js.map} +0 -0
  1050. /package/dist/{chunk-7XOVTPDI.js.map → chunk-NUNZS36W.js.map} +0 -0
  1051. /package/dist/{chunk-FC2FTSK3.js.map → chunk-NW53H5RW.js.map} +0 -0
  1052. /package/dist/{chunk-TW3LKRJF.js.map → chunk-NXCMHIKI.js.map} +0 -0
  1053. /package/dist/{chunk-CGK6ALQU.js.map → chunk-O3LKCBP5.js.map} +0 -0
  1054. /package/dist/{chunk-QIK2Q6N5.js.map → chunk-O6N4ABCA.js.map} +0 -0
  1055. /package/dist/{chunk-73NXYYWE.js.map → chunk-O732GAFC.js.map} +0 -0
  1056. /package/dist/{chunk-R3J2PTVQ.js.map → chunk-OF4TIKYC.js.map} +0 -0
  1057. /package/dist/{chunk-BUBNGKWG.js.map → chunk-OMPVOMPP.js.map} +0 -0
  1058. /package/dist/{chunk-4OXI6HCV.js.map → chunk-OPJJSKUK.js.map} +0 -0
  1059. /package/dist/{chunk-4Y6BK7IU.js.map → chunk-OPWCMA4D.js.map} +0 -0
  1060. /package/dist/{chunk-ADNMXBCX.js.map → chunk-ORJPS5VN.js.map} +0 -0
  1061. /package/dist/{chunk-SKMNW4SW.js.map → chunk-OSY5K7L7.js.map} +0 -0
  1062. /package/dist/{chunk-L4I665WK.js.map → chunk-OV6QJRT4.js.map} +0 -0
  1063. /package/dist/{chunk-7O5CGGIQ.js.map → chunk-OVKYVZMW.js.map} +0 -0
  1064. /package/dist/{chunk-7BYWOFVH.js.map → chunk-OZCBM3UC.js.map} +0 -0
  1065. /package/dist/{chunk-ALVRWCXE.js.map → chunk-P3A2EINJ.js.map} +0 -0
  1066. /package/dist/{chunk-BZO5ZMUP.js.map → chunk-PTAG4PDC.js.map} +0 -0
  1067. /package/dist/{chunk-QHHSUR2Y.js.map → chunk-PTF5B7TJ.js.map} +0 -0
  1068. /package/dist/{chunk-O2IOPP3R.js.map → chunk-Q3DPEYX4.js.map} +0 -0
  1069. /package/dist/{chunk-G7FU6PUA.js.map → chunk-QB2KMIDP.js.map} +0 -0
  1070. /package/dist/{chunk-64PO2WXU.js.map → chunk-QCSJ4CWE.js.map} +0 -0
  1071. /package/dist/{chunk-YYICQDK4.js.map → chunk-QIOQ2NPQ.js.map} +0 -0
  1072. /package/dist/{chunk-NB2HMRT2.js.map → chunk-QK5EFEUT.js.map} +0 -0
  1073. /package/dist/{chunk-366XZ4PM.js.map → chunk-QPQBLYQJ.js.map} +0 -0
  1074. /package/dist/{chunk-Q6XQ2R37.js.map → chunk-QPSGCC5D.js.map} +0 -0
  1075. /package/dist/{chunk-JJZPLGIP.js.map → chunk-QZAAUQRN.js.map} +0 -0
  1076. /package/dist/{chunk-VGUN6VB2.js.map → chunk-RGBI63KJ.js.map} +0 -0
  1077. /package/dist/{chunk-LRN6GYAZ.js.map → chunk-RLBKLAEY.js.map} +0 -0
  1078. /package/dist/{chunk-F7U3QPZ3.js.map → chunk-RMFKVOM7.js.map} +0 -0
  1079. /package/dist/{chunk-Q4EFRI6X.js.map → chunk-ROKQU7WG.js.map} +0 -0
  1080. /package/dist/{chunk-7QOHRZ67.js.map → chunk-RPVREAU7.js.map} +0 -0
  1081. /package/dist/{chunk-VGWWEVSD.js.map → chunk-RQKLF42C.js.map} +0 -0
  1082. /package/dist/{chunk-2VTTKH23.js.map → chunk-SEO7TICN.js.map} +0 -0
  1083. /package/dist/{chunk-3QNRBEYH.js.map → chunk-SHHJCL7X.js.map} +0 -0
  1084. /package/dist/{chunk-E6SQKHAU.js.map → chunk-SIRLACNZ.js.map} +0 -0
  1085. /package/dist/{chunk-H2TCRX3H.js.map → chunk-SKPHMYAA.js.map} +0 -0
  1086. /package/dist/{chunk-YDCUBUWH.js.map → chunk-SODC7T6L.js.map} +0 -0
  1087. /package/dist/{chunk-TNYFHKVV.js.map → chunk-SQJIKMN3.js.map} +0 -0
  1088. /package/dist/{chunk-DO74DQC7.js.map → chunk-SVINDKVW.js.map} +0 -0
  1089. /package/dist/{chunk-CPYGO76Q.js.map → chunk-SYCDHPZF.js.map} +0 -0
  1090. /package/dist/{chunk-UQ3IM6FY.js.map → chunk-T2QX3FDP.js.map} +0 -0
  1091. /package/dist/{chunk-NWGNFN3N.js.map → chunk-T3OWFVMS.js.map} +0 -0
  1092. /package/dist/{chunk-N3OARGH2.js.map → chunk-T6XI5FLY.js.map} +0 -0
  1093. /package/dist/{chunk-MQG7RV3B.js.map → chunk-T7OXJZCX.js.map} +0 -0
  1094. /package/dist/{chunk-2T7DX6KR.js.map → chunk-TAT5USZN.js.map} +0 -0
  1095. /package/dist/{chunk-ICX64J4U.js.map → chunk-TPQTRNER.js.map} +0 -0
  1096. /package/dist/{chunk-D2TOWEYH.js.map → chunk-TUIN4MB7.js.map} +0 -0
  1097. /package/dist/{chunk-LQDUHU3Y.js.map → chunk-TX3VECZU.js.map} +0 -0
  1098. /package/dist/{chunk-TG7DADJR.js.map → chunk-TXLIEOJX.js.map} +0 -0
  1099. /package/dist/{chunk-2ZVRJRXC.js.map → chunk-U3DN4HEY.js.map} +0 -0
  1100. /package/dist/{chunk-PSMAWRPL.js.map → chunk-U7XM7CB4.js.map} +0 -0
  1101. /package/dist/{chunk-4TQL3WP2.js.map → chunk-UJK53QFL.js.map} +0 -0
  1102. /package/dist/{chunk-RBRX5ZS3.js.map → chunk-UMTXA2TH.js.map} +0 -0
  1103. /package/dist/{chunk-36MIDGAH.js.map → chunk-UPDSXFK5.js.map} +0 -0
  1104. /package/dist/{chunk-OYXBFSGK.js.map → chunk-UTIAXH52.js.map} +0 -0
  1105. /package/dist/{chunk-5WUN7XPD.js.map → chunk-UVN5TMHU.js.map} +0 -0
  1106. /package/dist/{chunk-UYE47LO6.js.map → chunk-VGYXW3VG.js.map} +0 -0
  1107. /package/dist/{chunk-IKUNOX7F.js.map → chunk-VS7AHPCZ.js.map} +0 -0
  1108. /package/dist/{chunk-MYUFMVCH.js.map → chunk-VTTAJOQ7.js.map} +0 -0
  1109. /package/dist/{chunk-K63HGHZX.js.map → chunk-VWPOLUAO.js.map} +0 -0
  1110. /package/dist/{chunk-GA4YEAMX.js.map → chunk-X3MWB2QU.js.map} +0 -0
  1111. /package/dist/{chunk-I36GSRUJ.js.map → chunk-X6KAJI3V.js.map} +0 -0
  1112. /package/dist/{chunk-IKMUFDVS.js.map → chunk-XBLRHV5R.js.map} +0 -0
  1113. /package/dist/{chunk-XOSQP3YA.js.map → chunk-XDFP2LMW.js.map} +0 -0
  1114. /package/dist/{chunk-MW7Y3T55.js.map → chunk-XEQMZB3C.js.map} +0 -0
  1115. /package/dist/{chunk-B3LMRTRF.js.map → chunk-XEYLT5VA.js.map} +0 -0
  1116. /package/dist/{chunk-UI4HI5QK.js.map → chunk-XHIQ5I6N.js.map} +0 -0
  1117. /package/dist/{chunk-U6M4LS3M.js.map → chunk-XLH7QY2R.js.map} +0 -0
  1118. /package/dist/{chunk-OSA5EQG5.js.map → chunk-XWFAMUZQ.js.map} +0 -0
  1119. /package/dist/{chunk-6MT3HHUB.js.map → chunk-Y4OBB2VN.js.map} +0 -0
  1120. /package/dist/{chunk-CZP5QXNB.js.map → chunk-YCVD6CI3.js.map} +0 -0
  1121. /package/dist/{chunk-APW4T4SW.js.map → chunk-YENLNISG.js.map} +0 -0
  1122. /package/dist/{chunk-JWPA6ZPZ.js.map → chunk-YIRVLKAX.js.map} +0 -0
  1123. /package/dist/{chunk-LQ62ECE6.js.map → chunk-YL73CVNK.js.map} +0 -0
  1124. /package/dist/{chunk-ILKDYBON.js.map → chunk-YLS6QE5G.js.map} +0 -0
  1125. /package/dist/{chunk-YBKVGLQR.js.map → chunk-YPWU5KPE.js.map} +0 -0
  1126. /package/dist/{chunk-IKJLSBUI.js.map → chunk-YQXTDZSU.js.map} +0 -0
  1127. /package/dist/{chunk-TPMZBOFH.js.map → chunk-YSJEAAOL.js.map} +0 -0
  1128. /package/dist/{chunk-W3BFRR2G.js.map → chunk-YWIFM7D7.js.map} +0 -0
  1129. /package/dist/{chunk-WTJ4PLMU.js.map → chunk-YWVI6ZMK.js.map} +0 -0
  1130. /package/dist/{chunk-5KWMYPJV.js.map → chunk-Z4FMAFNH.js.map} +0 -0
  1131. /package/dist/{chunk-W5OWKVZG.js.map → chunk-Z654FWNU.js.map} +0 -0
  1132. /package/dist/{chunk-5FH5LQVS.js.map → chunk-Z7Y523PS.js.map} +0 -0
  1133. /package/dist/{chunk-HLL4PBO7.js.map → chunk-ZD67RM6G.js.map} +0 -0
  1134. /package/dist/{chunk-IVYJX3OY.js.map → chunk-ZEG4VPBL.js.map} +0 -0
  1135. /package/dist/{chunk-K6R5T44I.js.map → chunk-ZLYCOBHW.js.map} +0 -0
  1136. /package/dist/{chunk-VADHIT26.js.map → chunk-ZNJ5MTXV.js.map} +0 -0
  1137. /package/dist/{chunk-2KYQC4T5.js.map → chunk-ZSGY3H53.js.map} +0 -0
  1138. /package/dist/{chunk-BKP43KK4.js.map → chunk-ZTPXACWB.js.map} +0 -0
  1139. /package/dist/{chunk-JCY4CMDH.js.map → chunk-ZUA3JMI6.js.map} +0 -0
  1140. /package/dist/{chunk-IGVVXLKJ.js.map → chunk-ZYAZUPPV.js.map} +0 -0
  1141. /package/dist/{computer-viewer-LPZ763KF.js.map → computer-viewer-TDDO25AV.js.map} +0 -0
  1142. /package/dist/{embedded-new-voice-YVMKSLKJ.js.map → embedded-new-voice-2G3VLPVQ.js.map} +0 -0
  1143. /package/dist/{embedded-voice-BJPQFXSU.js.map → embedded-voice-T5IWOWGD.js.map} +0 -0
  1144. /package/dist/{fleet-decision-row-AA4H5CDT.js.map → fleet-decision-row-WM64KXP3.js.map} +0 -0
  1145. /package/dist/{model-policy-picker-menu-HSMWVO4P.js.map → model-policy-picker-menu-SMC6J6QN.js.map} +0 -0
  1146. /package/dist/{payment-page-card-3LTSFJGN.js.map → payment-page-card-G4U63KUV.js.map} +0 -0
  1147. /package/dist/{platform-activity-row-5VYV6TX4.js.map → platform-activity-row-BUZGZAKZ.js.map} +0 -0
  1148. /package/dist/{queue-surface-implementation-NXHZUKD2.js.map → queue-surface-implementation-4KUZ4PJV.js.map} +0 -0
  1149. /package/dist/{sandbox-files-YCMLQUFU.js.map → sandbox-files-ESDMOFSD.js.map} +0 -0
  1150. /package/dist/{session-connect-cards-KSQLMRM5.js.map → session-connect-cards-Q53KMMYY.js.map} +0 -0
  1151. /package/dist/{session-realtime-ZR6JLG3Y.js.map → session-realtime-CF3I35WJ.js.map} +0 -0
  1152. /package/dist/{timeline-annotation-markers-YAHDPWVG.js.map → timeline-annotation-markers-CJK4RYZ4.js.map} +0 -0
  1153. /package/dist/{timeline-annotation-selection-KHXNCEJP.js.map → timeline-annotation-selection-67GF5H26.js.map} +0 -0
  1154. /package/dist/{timeline-annotations-dialog-Y4XD3N7B.js.map → timeline-annotations-dialog-ONJPQDJQ.js.map} +0 -0
@@ -0,0 +1,3064 @@
1
+ "use client";
2
+ import {
3
+ PierreFile
4
+ } from "./chunk-XWFAMUZQ.js";
5
+ import {
6
+ useThemeType
7
+ } from "./chunk-B27E3V37.js";
8
+ import {
9
+ prefersReducedMotion
10
+ } from "./chunk-OCN4S7WN.js";
11
+ import {
12
+ MENU_BUTTON_CLASS,
13
+ MENU_SEPARATOR_CLASS,
14
+ MENU_SURFACE_CLASS
15
+ } from "./chunk-PNNTR6KP.js";
16
+ import {
17
+ usePortalContainer
18
+ } from "./chunk-UD6AAZSC.js";
19
+ import {
20
+ usePortalTokenSource,
21
+ usePortalTokenStyle
22
+ } from "./chunk-XEA5BCMA.js";
23
+ import {
24
+ CodeEditor
25
+ } from "./chunk-KLEUWIMZ.js";
26
+ import {
27
+ sandboxAcceptsLiveIo
28
+ } from "./chunk-QV3DJVRZ.js";
29
+ import {
30
+ useOpenGeni
31
+ } from "./chunk-TVQCDDSZ.js";
32
+ import {
33
+ cn
34
+ } from "./chunk-TXS65BB2.js";
35
+ import {
36
+ createOpenGeniText,
37
+ useOpenGeniText
38
+ } from "./chunk-7T2ZE3VT.js";
39
+
40
+ // src/components/sandbox-files.tsx
41
+ import { FileCode2Icon, FileWarningIcon, LoaderCircleIcon } from "lucide-react";
42
+ import { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef3, useState as useState3 } from "react";
43
+ import { Group, Panel, Separator } from "react-resizable-panels";
44
+
45
+ // src/hooks/use-sandbox-files.ts
46
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
47
+ var englishText = createOpenGeniText();
48
+ var CapturedFileUnavailableError = class extends Error {
49
+ constructor(path, reason, t = englishText) {
50
+ super(
51
+ reason === "too-large" ? t("hooks.useSandboxFiles.pathExceedsTheCapturedPreview", { path }) : reason === "content-missing" ? t("hooks.useSandboxFiles.pathIsNoLongerAvailable", { path }) : t("hooks.useSandboxFiles.pathWasNotChangedIn", { path })
52
+ );
53
+ this.path = path;
54
+ this.reason = reason;
55
+ this.name = "CapturedFileUnavailableError";
56
+ }
57
+ code = "captured_file_unavailable";
58
+ };
59
+ var FileWriteConflictError = class extends Error {
60
+ constructor(path, expectedContent, liveContent, t = englishText) {
61
+ super(t("hooks.useSandboxFiles.pathChangedOnTheMachine", { path }));
62
+ this.path = path;
63
+ this.expectedContent = expectedContent;
64
+ this.liveContent = liveContent;
65
+ this.name = "FileWriteConflictError";
66
+ }
67
+ code = "file_write_conflict";
68
+ };
69
+ function normalizeRoot(root) {
70
+ const slashNormalized = root.replaceAll("\\", "/").replace(/^\.\/+/, "");
71
+ if (slashNormalized === "/") return "/";
72
+ const normalized = slashNormalized.replace(/\/+$/, "");
73
+ return normalized === "." ? "" : normalized;
74
+ }
75
+ function isAbsoluteTreePath(path) {
76
+ return path.startsWith("/") || /^[A-Za-z]:\//u.test(path);
77
+ }
78
+ function joinTreeRoot(root, path) {
79
+ if (!root || isAbsoluteTreePath(path)) return path;
80
+ return root === "/" ? `/${path}` : `${root}/${path}`;
81
+ }
82
+ function qualifyStatusPath(root, path, treeRoot) {
83
+ const normalized = normalizeRoot(root);
84
+ const workspaceRelative = joinTreeRoot(normalized, path);
85
+ return joinTreeRoot(normalizeRoot(treeRoot), workspaceRelative);
86
+ }
87
+ function summarizeStatuses(statuses) {
88
+ const repositories = statuses.filter(({ status }) => status.isRepo);
89
+ return {
90
+ branch: repositories.length === 1 ? repositories[0]?.status.head ?? null : null,
91
+ isRepo: repositories.length > 0,
92
+ repoCount: repositories.length,
93
+ ahead: repositories.reduce((sum, { status }) => sum + status.ahead, 0),
94
+ behind: repositories.reduce((sum, { status }) => sum + status.behind, 0),
95
+ dirtyCount: repositories.reduce((sum, { status }) => sum + status.files.length, 0)
96
+ };
97
+ }
98
+ function parentOf(path) {
99
+ const i = path.lastIndexOf("/");
100
+ return i <= 0 ? "" : path.slice(0, i);
101
+ }
102
+ function parentWithinTree(path, rootPath) {
103
+ const parent = parentOf(path);
104
+ return parent === "" && normalizeRoot(rootPath) === "/" && path.startsWith("/") ? "/" : parent;
105
+ }
106
+ function leafOf(path) {
107
+ const i = path.lastIndexOf("/");
108
+ return i < 0 ? path : path.slice(i + 1);
109
+ }
110
+ function sortNodes(nodes) {
111
+ return [...nodes].sort((a, b) => {
112
+ if (a.kind !== b.kind) return a.kind === "dir" ? -1 : 1;
113
+ return a.name.localeCompare(b.name, void 0, { sensitivity: "base" });
114
+ });
115
+ }
116
+ function fsNodeToTree(node, captureComplete = false) {
117
+ const kind = node.type === "dir" ? "dir" : "file";
118
+ const mappedChildren = node.children && node.children.length > 0 ? node.children.map((child) => fsNodeToTree(child, captureComplete)) : captureComplete && kind === "dir" ? [] : void 0;
119
+ return {
120
+ path: node.path,
121
+ name: node.name,
122
+ kind,
123
+ size: node.sizeBytes,
124
+ ...kind === "dir" ? { children: mappedChildren } : {},
125
+ // A collapsed residue dir from the capture index — carried through so the
126
+ // tree can show an inline "contents on machine" row cold instead of nothing.
127
+ ...kind === "dir" && node.truncated ? { truncated: true } : {}
128
+ };
129
+ }
130
+ var GIT_STATUS_TO_TREE = {
131
+ added: "added",
132
+ modified: "modified",
133
+ deleted: "deleted",
134
+ renamed: "renamed",
135
+ copied: "added",
136
+ untracked: "untracked",
137
+ typechange: "modified"
138
+ };
139
+ function replaceChildren(nodes, targetPath, children) {
140
+ return nodes.map((node) => {
141
+ if (node.path === targetPath) {
142
+ return { ...node, children };
143
+ }
144
+ if (node.kind === "dir" && node.children && targetPath.startsWith(`${node.path}/`)) {
145
+ return {
146
+ ...node,
147
+ children: replaceChildren(node.children, targetPath, children)
148
+ };
149
+ }
150
+ return node;
151
+ });
152
+ }
153
+ function findNodeByPath(nodes, path) {
154
+ for (const node of nodes) {
155
+ if (node.path === path) return node;
156
+ if (node.kind === "dir" && node.children && path.startsWith(`${node.path}/`)) {
157
+ const hit = findNodeByPath(node.children, path);
158
+ if (hit) return hit;
159
+ }
160
+ }
161
+ return void 0;
162
+ }
163
+ var FS_LIST_BATCH_REQUEST_LIMIT = 16;
164
+ function initialDirectoryFrontier(rootPath, repoPaths) {
165
+ const root = normalizeRoot(rootPath);
166
+ const rootParts = root.split("/").filter(Boolean);
167
+ const rootPrefix = root.startsWith("//") ? "//" : root.startsWith("/") ? "/" : "";
168
+ const paths = /* @__PURE__ */ new Set();
169
+ for (const repoPath of repoPaths) {
170
+ const canonicalRepoPath = joinTreeRoot(root, normalizeRoot(repoPath));
171
+ const parts = canonicalRepoPath.split("/").filter(Boolean);
172
+ if (rootParts.some((part, index) => parts[index] !== part)) continue;
173
+ for (let depth = rootParts.length + 1; depth <= parts.length; depth += 1) {
174
+ const path = parts.slice(0, depth).join("/");
175
+ paths.add(`${rootPrefix}${path}`);
176
+ }
177
+ }
178
+ return [...paths].sort((a, b) => a.split("/").length - b.split("/").length || a.localeCompare(b)).slice(0, 8);
179
+ }
180
+ function parentIsLoaded(nodes, parent, rootPath = "") {
181
+ if (parent === normalizeRoot(rootPath)) return true;
182
+ const node = findNodeByPath(nodes, parent);
183
+ return Boolean(node && node.kind === "dir" && node.children !== void 0);
184
+ }
185
+ function insertNode(nodes, parent, child, rootPath = "") {
186
+ if (parent === normalizeRoot(rootPath)) {
187
+ if (nodes.some((n) => n.path === child.path)) return nodes;
188
+ return sortNodes([...nodes, child]);
189
+ }
190
+ return nodes.map((node) => {
191
+ if (node.path === parent) {
192
+ if (node.kind !== "dir" || node.children === void 0) return node;
193
+ if (node.children.some((n) => n.path === child.path)) return node;
194
+ return { ...node, children: sortNodes([...node.children, child]) };
195
+ }
196
+ if (node.kind === "dir" && node.children && parent.startsWith(`${node.path}/`)) {
197
+ return { ...node, children: insertNode(node.children, parent, child, rootPath) };
198
+ }
199
+ return node;
200
+ });
201
+ }
202
+ function removeNode(nodes, path, rootPath = "") {
203
+ const parent = parentWithinTree(path, rootPath);
204
+ if (parent === normalizeRoot(rootPath)) {
205
+ if (!nodes.some((n) => n.path === path)) return nodes;
206
+ return nodes.filter((n) => n.path !== path);
207
+ }
208
+ return nodes.map((node) => {
209
+ if (node.path === parent) {
210
+ if (node.kind !== "dir" || node.children === void 0) return node;
211
+ return {
212
+ ...node,
213
+ children: node.children.filter((n) => n.path !== path)
214
+ };
215
+ }
216
+ if (node.kind === "dir" && node.children && parent.startsWith(`${node.path}/`)) {
217
+ return { ...node, children: removeNode(node.children, path, rootPath) };
218
+ }
219
+ return node;
220
+ });
221
+ }
222
+ function sameNodeShallow(a, b) {
223
+ return a.path === b.path && a.kind === b.kind && a.name === b.name && (a.size ?? null) === (b.size ?? null) && (a.status ?? void 0) === (b.status ?? void 0) && (a.truncated ?? false) === (b.truncated ?? false);
224
+ }
225
+ function mergeChildren(current, listed) {
226
+ const byPath = new Map(current.map((n) => [n.path, n]));
227
+ const merged = listed.map((next) => {
228
+ const existing = byPath.get(next.path);
229
+ if (!existing) return next;
230
+ if (existing.kind === "dir" && next.kind === "dir" && existing.children !== void 0) {
231
+ const candidate = { ...next, children: existing.children };
232
+ return sameNodeShallow(existing, candidate) ? existing : candidate;
233
+ }
234
+ if (existing.children === next.children && sameNodeShallow(existing, next)) {
235
+ return existing;
236
+ }
237
+ return next;
238
+ });
239
+ return sortNodes(merged);
240
+ }
241
+ function mergeRootChildren(nodes, listed) {
242
+ return mergeChildren(nodes, listed);
243
+ }
244
+ function repathNode(node, fromPrefix, toPrefix) {
245
+ const newPath = toPrefix + node.path.slice(fromPrefix.length);
246
+ const next = { ...node, path: newPath, name: leafOf(newPath) };
247
+ if (node.children) next.children = node.children.map((c) => repathNode(c, fromPrefix, toPrefix));
248
+ return next;
249
+ }
250
+ function decodeBase64Bytes(value) {
251
+ const binary = atob(value);
252
+ const bytes = new Uint8Array(binary.length);
253
+ for (let index = 0; index < binary.length; index += 1) {
254
+ bytes[index] = binary.charCodeAt(index);
255
+ }
256
+ return bytes;
257
+ }
258
+ function decodeBase64Text(value) {
259
+ return new TextDecoder().decode(decodeBase64Bytes(value));
260
+ }
261
+ function encodeBase64Bytes(bytes) {
262
+ let binary = "";
263
+ const chunkSize = 32768;
264
+ for (let offset = 0; offset < bytes.length; offset += chunkSize) {
265
+ binary += String.fromCharCode(...bytes.subarray(offset, offset + chunkSize));
266
+ }
267
+ return btoa(binary);
268
+ }
269
+ async function assertCapturedHash(bytes, expected) {
270
+ if (!expected) throw new Error("Captured file is missing its integrity hash.");
271
+ if (!globalThis.crypto?.subtle) {
272
+ throw new Error("Captured file integrity verification is unavailable in this browser.");
273
+ }
274
+ const buffer = new ArrayBuffer(bytes.byteLength);
275
+ new Uint8Array(buffer).set(bytes);
276
+ const digest = new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", buffer));
277
+ const actual = [...digest].map((byte) => byte.toString(16).padStart(2, "0")).join("");
278
+ if (actual !== expected) throw new Error("Captured file content failed its integrity check.");
279
+ }
280
+ function useSandboxFiles(sessionId, options = {}) {
281
+ const t = useOpenGeniText();
282
+ const { client, workspaceId } = useOpenGeni(options);
283
+ const enabled = (options.enabled ?? true) && Boolean(sessionId);
284
+ const active = options.active ?? true;
285
+ const rootPath = options.rootPath ?? "";
286
+ const routeEpoch = options.route?.epoch ?? null;
287
+ const routeRoot = options.route?.root ?? null;
288
+ const route = useMemo(
289
+ () => routeEpoch !== null && routeRoot !== null ? { epoch: routeEpoch, root: routeRoot } : void 0,
290
+ [routeEpoch, routeRoot]
291
+ );
292
+ const repoPathsKey = [
293
+ ...new Set((options.repoPaths?.length ? options.repoPaths : [rootPath]).map(normalizeRoot))
294
+ ].join("\0");
295
+ const repoPaths = useMemo(() => repoPathsKey.split("\0"), [repoPathsKey]);
296
+ const capture = options.capture ?? null;
297
+ const isLive = sandboxAcceptsLiveIo(options.liveness);
298
+ const acceptsEventReads = options.liveness === void 0 || isLive;
299
+ const acceptsEventReadsRef = useRef(acceptsEventReads);
300
+ acceptsEventReadsRef.current = acceptsEventReads;
301
+ const hasLiveIoFence = options.liveness !== void 0;
302
+ const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${rootPath}\0${repoPathsKey}\0${routeEpoch ?? ""}\0${routeRoot ?? ""}`;
303
+ const [tree, setTree] = useState([]);
304
+ const treeRef = useRef([]);
305
+ const [loading, setLoading] = useState(false);
306
+ const [expandingPaths, setExpandingPaths] = useState(/* @__PURE__ */ new Set());
307
+ const [error, setError] = useState(null);
308
+ const [gitSummary, setGitSummary] = useState(null);
309
+ const [gitLoading, setGitLoading] = useState(false);
310
+ const [contentRevision, setContentRevision] = useState(0);
311
+ const [stateIdentity, setStateIdentity] = useState(identityKey);
312
+ const [source, setSource] = useState(null);
313
+ const sourceRef = useRef(null);
314
+ const statusRef = useRef(/* @__PURE__ */ new Map());
315
+ const refreshGenerationRef = useRef(0);
316
+ const refreshAbortRef = useRef(null);
317
+ const identityAbortRef = useRef(new AbortController());
318
+ const eventReadAbortRef = useRef(new AbortController());
319
+ const identityGenerationRef = useRef(0);
320
+ const lastSeqRef = useRef(0);
321
+ const pendingParentsRef = useRef(/* @__PURE__ */ new Set());
322
+ const pendingGitRef = useRef(false);
323
+ const eventReconcileInFlightRef = useRef(null);
324
+ const eventReconcilePendingRef = useRef(false);
325
+ const debounceRef = useRef(null);
326
+ const ownRevisionsRef = useRef(/* @__PURE__ */ new Set());
327
+ const onMutationError = options.onMutationError;
328
+ treeRef.current = tree;
329
+ const applyStatus = useCallback((nodes) => {
330
+ const overlay = statusRef.current;
331
+ const walk = (list) => {
332
+ let changed = false;
333
+ const out = list.map((node) => {
334
+ const nextChildren = node.children ? walk(node.children) : node.children;
335
+ const wantStatus = node.kind === "file" ? overlay.get(node.path) : void 0;
336
+ const childrenChanged = nextChildren !== node.children;
337
+ const statusChanged = (node.status ?? void 0) !== (wantStatus ?? void 0);
338
+ if (!childrenChanged && !statusChanged) return node;
339
+ changed = true;
340
+ const next = {
341
+ ...node,
342
+ ...node.children ? { children: nextChildren } : {}
343
+ };
344
+ if (wantStatus) next.status = wantStatus;
345
+ else delete next.status;
346
+ return next;
347
+ });
348
+ return changed ? out : list;
349
+ };
350
+ return walk(nodes);
351
+ }, []);
352
+ const refresh = useCallback(async () => {
353
+ if (!sessionId) return;
354
+ refreshAbortRef.current?.abort();
355
+ const refreshAbort = new AbortController();
356
+ refreshAbortRef.current = refreshAbort;
357
+ const generation = refreshGenerationRef.current += 1;
358
+ setLoading(true);
359
+ setGitLoading(true);
360
+ setError(null);
361
+ try {
362
+ const frontierPaths = initialDirectoryFrontier(rootPath, repoPaths);
363
+ const listRequests = [rootPath, ...frontierPaths].map((path) => ({
364
+ path,
365
+ depth: 1,
366
+ ...route ? { route } : {}
367
+ }));
368
+ const listedBatch = await client.fsListBatch(
369
+ workspaceId,
370
+ sessionId,
371
+ { requests: listRequests },
372
+ { signal: refreshAbort.signal }
373
+ );
374
+ if (refreshGenerationRef.current !== generation) return;
375
+ const listed = listedBatch.results[0];
376
+ if (!listed) throw new Error("Workspace list batch did not return the root result.");
377
+ const children = (listed.root.children ?? []).map((node) => fsNodeToTree(node));
378
+ setTree((prev) => {
379
+ let hydrated = prev.length === 0 ? children : mergeRootChildren(prev, children);
380
+ for (const [index, path] of frontierPaths.entries()) {
381
+ const prefetched = listedBatch.results[index + 1];
382
+ if (!prefetched) continue;
383
+ hydrated = replaceChildren(
384
+ hydrated,
385
+ path,
386
+ (prefetched.root.children ?? []).map((node) => fsNodeToTree(node))
387
+ );
388
+ }
389
+ return applyStatus(hydrated);
390
+ });
391
+ sourceRef.current = "live";
392
+ setSource("live");
393
+ setLoading(false);
394
+ const statuses = repoPaths.length > 0 ? await client.gitReadBatch(
395
+ workspaceId,
396
+ sessionId,
397
+ {
398
+ requests: repoPaths.map((root) => ({
399
+ status: { path: root }
400
+ }))
401
+ },
402
+ { signal: refreshAbort.signal }
403
+ ).then(
404
+ (batch) => batch.results.map((result, index) => ({
405
+ root: repoPaths[index] ?? "",
406
+ status: result.status
407
+ }))
408
+ ).catch(() => null) : [];
409
+ if (refreshGenerationRef.current !== generation) return;
410
+ if (statuses) {
411
+ const overlay = /* @__PURE__ */ new Map();
412
+ for (const { root, status } of statuses) {
413
+ for (const file of status.files) {
414
+ const code = file.worktree ?? file.index;
415
+ const mapped = code ? GIT_STATUS_TO_TREE[code] : void 0;
416
+ if (mapped) overlay.set(qualifyStatusPath(root, file.path, rootPath), mapped);
417
+ }
418
+ }
419
+ statusRef.current = overlay;
420
+ setGitSummary(summarizeStatuses(statuses));
421
+ } else {
422
+ statusRef.current = /* @__PURE__ */ new Map();
423
+ setGitSummary(null);
424
+ }
425
+ setGitLoading(false);
426
+ setTree((prev) => applyStatus(prev));
427
+ } catch (cause) {
428
+ if (refreshGenerationRef.current !== generation) return;
429
+ setError(cause instanceof Error ? cause : new Error(String(cause)));
430
+ } finally {
431
+ if (refreshGenerationRef.current === generation) setLoading(false);
432
+ if (refreshGenerationRef.current === generation) setGitLoading(false);
433
+ if (refreshAbortRef.current === refreshAbort) refreshAbortRef.current = null;
434
+ }
435
+ }, [client, workspaceId, sessionId, rootPath, repoPaths, route, applyStatus]);
436
+ const seedFromCapture = useCallback(
437
+ (manifest) => {
438
+ const overlay = /* @__PURE__ */ new Map();
439
+ for (const file of manifest.files) {
440
+ if (file.deleted) continue;
441
+ const mapped = GIT_STATUS_TO_TREE[file.status];
442
+ if (mapped) overlay.set(file.path, mapped);
443
+ }
444
+ statusRef.current = overlay;
445
+ const children = (manifest.treeIndex.children ?? []).map((node) => fsNodeToTree(node, true));
446
+ setTree(
447
+ (prev) => applyStatus(prev.length === 0 ? children : mergeRootChildren(prev, children))
448
+ );
449
+ sourceRef.current = "capture";
450
+ setSource("capture");
451
+ setGitSummary({
452
+ branch: manifest.repos.length === 1 ? manifest.repos[0]?.head ?? null : null,
453
+ isRepo: manifest.repos.length > 0,
454
+ repoCount: manifest.repos.length,
455
+ ahead: manifest.repos.reduce((sum, repo) => sum + repo.ahead, 0),
456
+ behind: manifest.repos.reduce((sum, repo) => sum + repo.behind, 0),
457
+ dirtyCount: manifest.files.length
458
+ });
459
+ setGitLoading(false);
460
+ setError(null);
461
+ },
462
+ [applyStatus]
463
+ );
464
+ const expand = useCallback(
465
+ async (path) => {
466
+ if (!sessionId) return;
467
+ if (source === "capture" && capture) return;
468
+ const identityGeneration = identityGenerationRef.current;
469
+ const identitySignal = identityAbortRef.current.signal;
470
+ setExpandingPaths((prev) => {
471
+ const next = new Set(prev);
472
+ next.add(path);
473
+ return next;
474
+ });
475
+ try {
476
+ const listed = await client.fsList(
477
+ workspaceId,
478
+ sessionId,
479
+ { path, depth: 1, ...route ? { route } : {} },
480
+ { signal: identitySignal }
481
+ );
482
+ if (identityGenerationRef.current !== identityGeneration) return;
483
+ const children = (listed.root.children ?? []).map((node) => fsNodeToTree(node));
484
+ setTree((prev) => applyStatus(replaceChildren(prev, path, children)));
485
+ } catch (cause) {
486
+ if (identityGenerationRef.current !== identityGeneration) return;
487
+ setError(cause instanceof Error ? cause : new Error(String(cause)));
488
+ } finally {
489
+ if (identityGenerationRef.current === identityGeneration) {
490
+ setExpandingPaths((prev) => {
491
+ if (!prev.has(path)) return prev;
492
+ const next = new Set(prev);
493
+ next.delete(path);
494
+ return next;
495
+ });
496
+ }
497
+ }
498
+ },
499
+ [client, workspaceId, sessionId, capture, source, route, applyStatus]
500
+ );
501
+ const readFile = useCallback(
502
+ async (path, requestOptions = {}) => {
503
+ if (!sessionId) throw new Error("no session");
504
+ const identitySignal = identityAbortRef.current.signal;
505
+ const signal = requestOptions.signal ? AbortSignal.any([identitySignal, requestOptions.signal]) : identitySignal;
506
+ const captured = capture?.files.find((file) => file.path === path && !file.deleted);
507
+ if (source === "capture" && capture) {
508
+ if (!captured) {
509
+ throw new CapturedFileUnavailableError(path, "not-captured", t);
510
+ }
511
+ for (let attempt = 0; attempt < 2; attempt += 1) {
512
+ const result = await client.getWorkspaceCaptureFile(
513
+ workspaceId,
514
+ sessionId,
515
+ path,
516
+ capture.revision,
517
+ { signal }
518
+ );
519
+ if (result.path !== path || result.revision !== capture.revision) {
520
+ throw new Error(
521
+ "Captured file identity did not match the requested workspace revision."
522
+ );
523
+ }
524
+ if (result.hash !== captured.hash || result.sizeBytes !== captured.sizeBytes || result.isBinary !== captured.isBinary || result.tooLarge !== captured.tooLarge) {
525
+ throw new Error("Captured file metadata did not match its manifest.");
526
+ }
527
+ if (result.tooLarge) {
528
+ throw new CapturedFileUnavailableError(path, "too-large", t);
529
+ }
530
+ let bytes;
531
+ let encoding;
532
+ let content;
533
+ if (result.content !== null && result.encoding !== null) {
534
+ encoding = result.encoding;
535
+ content = result.content;
536
+ bytes = encoding === "base64" ? decodeBase64Bytes(content) : new TextEncoder().encode(content);
537
+ } else if (result.contentUrl) {
538
+ const response = await fetch(result.contentUrl.url, {
539
+ credentials: "omit",
540
+ cache: "no-store",
541
+ referrerPolicy: "no-referrer",
542
+ signal: AbortSignal.any([signal, AbortSignal.timeout(3e4)])
543
+ }).catch(() => null);
544
+ if (!response?.ok) {
545
+ if (attempt === 0 && (response === null || response.status === 401 || response.status === 403)) {
546
+ continue;
547
+ }
548
+ throw new Error("Captured file download failed.");
549
+ }
550
+ bytes = new Uint8Array(await response.arrayBuffer());
551
+ encoding = result.isBinary ? "base64" : "utf8";
552
+ content = result.isBinary ? encodeBase64Bytes(bytes) : new TextDecoder().decode(bytes);
553
+ } else {
554
+ throw new CapturedFileUnavailableError(path, "content-missing", t);
555
+ }
556
+ if (bytes.byteLength !== result.sizeBytes) {
557
+ throw new Error("Captured file size did not match its manifest.");
558
+ }
559
+ await assertCapturedHash(bytes, result.hash);
560
+ return {
561
+ path,
562
+ encoding,
563
+ content,
564
+ sizeBytes: result.sizeBytes,
565
+ truncated: false,
566
+ isBinary: result.isBinary,
567
+ revision: result.revision
568
+ };
569
+ }
570
+ throw new Error("Captured file download failed after refreshing its URL.");
571
+ }
572
+ return await client.fsRead(
573
+ workspaceId,
574
+ sessionId,
575
+ { path, ...route ? { route } : {} },
576
+ { signal }
577
+ );
578
+ },
579
+ [client, workspaceId, sessionId, capture, source, route, t]
580
+ );
581
+ const reconcilePath = useCallback(
582
+ async (path, requestSignal) => {
583
+ if (!sessionId) return;
584
+ const identityGeneration = identityGenerationRef.current;
585
+ const identitySignal = identityAbortRef.current.signal;
586
+ const signal = requestSignal ? AbortSignal.any([identitySignal, requestSignal]) : identitySignal;
587
+ if (!parentIsLoaded(treeRef.current, path, rootPath)) return;
588
+ try {
589
+ const listed = await client.fsList(
590
+ workspaceId,
591
+ sessionId,
592
+ { path, depth: 1, ...route ? { route } : {} },
593
+ { signal }
594
+ );
595
+ if (identityGenerationRef.current !== identityGeneration) return;
596
+ const children = (listed.root.children ?? []).map((node) => fsNodeToTree(node));
597
+ if (path === normalizeRoot(rootPath)) {
598
+ setTree((prev) => applyStatus(mergeRootChildren(prev, children)));
599
+ } else
600
+ setTree((prev) => {
601
+ const existing = findNodeByPath(prev, path);
602
+ const merged = existing?.children ? mergeChildren(existing.children, children) : children;
603
+ return applyStatus(replaceChildren(prev, path, merged));
604
+ });
605
+ } catch {
606
+ }
607
+ },
608
+ [client, workspaceId, sessionId, rootPath, route, applyStatus]
609
+ );
610
+ const reconcilePaths = useCallback(
611
+ async (requestedPaths, requestSignal) => {
612
+ if (!sessionId) return;
613
+ const identityGeneration = identityGenerationRef.current;
614
+ const identitySignal = identityAbortRef.current.signal;
615
+ const signal = requestSignal ? AbortSignal.any([identitySignal, requestSignal]) : identitySignal;
616
+ const paths = [...new Set(requestedPaths)].filter(
617
+ (path) => parentIsLoaded(treeRef.current, path, rootPath)
618
+ );
619
+ for (let offset = 0; offset < paths.length; offset += FS_LIST_BATCH_REQUEST_LIMIT) {
620
+ const chunk = paths.slice(offset, offset + FS_LIST_BATCH_REQUEST_LIMIT);
621
+ try {
622
+ const listed = await client.fsListBatch(
623
+ workspaceId,
624
+ sessionId,
625
+ {
626
+ requests: chunk.map((path) => ({
627
+ path,
628
+ depth: 1,
629
+ ...route ? { route } : {}
630
+ }))
631
+ },
632
+ { signal }
633
+ );
634
+ if (identityGenerationRef.current !== identityGeneration) return;
635
+ setTree((previous) => {
636
+ let next = previous;
637
+ for (const [index, path] of chunk.entries()) {
638
+ const result = listed.results[index];
639
+ if (!result) continue;
640
+ const children = (result.root.children ?? []).map((node) => fsNodeToTree(node));
641
+ if (path === normalizeRoot(rootPath)) {
642
+ next = mergeRootChildren(next, children);
643
+ } else {
644
+ const existing = findNodeByPath(next, path);
645
+ const merged = existing?.children ? mergeChildren(existing.children, children) : children;
646
+ next = replaceChildren(next, path, merged);
647
+ }
648
+ }
649
+ return applyStatus(next);
650
+ });
651
+ } catch {
652
+ }
653
+ }
654
+ },
655
+ [client, workspaceId, sessionId, rootPath, route, applyStatus]
656
+ );
657
+ const runOptimistic = useCallback(
658
+ async (opName, apply, op, reconcileParents) => {
659
+ const identityGeneration = identityGenerationRef.current;
660
+ const snapshot = treeRef.current;
661
+ setError(null);
662
+ setTree(applyStatus(apply(snapshot)));
663
+ try {
664
+ const res = await op();
665
+ if (identityGenerationRef.current !== identityGeneration) return res;
666
+ if (res && typeof res === "object" && "revision" in res) {
667
+ const rev = res.revision;
668
+ if (typeof rev === "number") ownRevisionsRef.current.add(rev);
669
+ }
670
+ for (const parent of reconcileParents) {
671
+ if (identityGenerationRef.current !== identityGeneration) return res;
672
+ await reconcilePath(parent);
673
+ }
674
+ return res;
675
+ } catch (cause) {
676
+ const err = cause instanceof Error ? cause : new Error(String(cause));
677
+ if (identityGenerationRef.current !== identityGeneration) throw err;
678
+ setTree(applyStatus(snapshot));
679
+ if (err instanceof FileWriteConflictError) throw err;
680
+ setError(err);
681
+ onMutationError?.(err, opName);
682
+ throw err;
683
+ }
684
+ },
685
+ [applyStatus, reconcilePath, onMutationError]
686
+ );
687
+ const writeFile = useCallback(
688
+ async (path, content, writeOptions = {}) => {
689
+ if (!sessionId) throw new Error("no session");
690
+ const identityGeneration = identityGenerationRef.current;
691
+ const identitySignal = identityAbortRef.current.signal;
692
+ const parent = parentWithinTree(path, rootPath);
693
+ const exists = Boolean(findNodeByPath(tree, path));
694
+ const node = {
695
+ path,
696
+ name: leafOf(path),
697
+ kind: "file",
698
+ size: content.length
699
+ };
700
+ return await runOptimistic(
701
+ "write",
702
+ (nodes) => exists ? nodes : insertNode(nodes, parent, node, rootPath),
703
+ async () => {
704
+ if (!writeOptions.force && writeOptions.expectedContent !== void 0) {
705
+ const live = await client.fsRead(
706
+ workspaceId,
707
+ sessionId,
708
+ { path, ...route ? { route } : {} },
709
+ { signal: identitySignal }
710
+ );
711
+ if (identityGenerationRef.current !== identityGeneration) {
712
+ throw new Error(t("hooks.useSandboxFiles.fileSaveCancelledBecauseThe"));
713
+ }
714
+ const liveContent = live.encoding === "base64" ? decodeBase64Text(live.content) : live.content;
715
+ if (live.truncated || live.isBinary || liveContent !== writeOptions.expectedContent) {
716
+ throw new FileWriteConflictError(path, writeOptions.expectedContent, liveContent, t);
717
+ }
718
+ }
719
+ if (identityGenerationRef.current !== identityGeneration) {
720
+ throw new Error(t("hooks.useSandboxFiles.fileSaveCancelledBecauseThe"));
721
+ }
722
+ return await client.fsWrite(workspaceId, sessionId, {
723
+ path,
724
+ content,
725
+ overwrite: true,
726
+ ...route ? { route } : {}
727
+ });
728
+ },
729
+ exists ? [] : [parent]
730
+ );
731
+ },
732
+ [client, workspaceId, sessionId, tree, rootPath, route, runOptimistic, t]
733
+ );
734
+ const createFile = useCallback(
735
+ async (path) => {
736
+ if (!sessionId) throw new Error("no session");
737
+ const parent = parentWithinTree(path, rootPath);
738
+ const node = {
739
+ path,
740
+ name: leafOf(path),
741
+ kind: "file",
742
+ size: 0
743
+ };
744
+ await runOptimistic(
745
+ t("hooks.useSandboxFiles.createFile"),
746
+ (nodes) => insertNode(nodes, parent, node, rootPath),
747
+ () => client.fsWrite(workspaceId, sessionId, {
748
+ path,
749
+ content: "",
750
+ overwrite: false,
751
+ ...route ? { route } : {}
752
+ }),
753
+ [parent]
754
+ );
755
+ },
756
+ [client, workspaceId, sessionId, rootPath, route, runOptimistic, t]
757
+ );
758
+ const createDir = useCallback(
759
+ async (path) => {
760
+ if (!sessionId) throw new Error("no session");
761
+ const parent = parentWithinTree(path, rootPath);
762
+ const node = {
763
+ path,
764
+ name: leafOf(path),
765
+ kind: "dir",
766
+ children: []
767
+ };
768
+ await runOptimistic(
769
+ t("hooks.useSandboxFiles.createFolder"),
770
+ (nodes) => insertNode(nodes, parent, node, rootPath),
771
+ () => client.fsMkdir(workspaceId, sessionId, {
772
+ path,
773
+ recursive: true,
774
+ ...route ? { route } : {}
775
+ }),
776
+ [parent]
777
+ );
778
+ },
779
+ [client, workspaceId, sessionId, rootPath, route, runOptimistic, t]
780
+ );
781
+ const deleteEntry = useCallback(
782
+ async (path, recursive = false) => {
783
+ if (!sessionId) throw new Error("no session");
784
+ await runOptimistic(
785
+ "delete",
786
+ (nodes) => removeNode(nodes, path, rootPath),
787
+ () => client.fsDelete(workspaceId, sessionId, {
788
+ path,
789
+ recursive,
790
+ ...route ? { route } : {}
791
+ }),
792
+ [parentWithinTree(path, rootPath)]
793
+ );
794
+ },
795
+ [client, workspaceId, sessionId, rootPath, route, runOptimistic]
796
+ );
797
+ const moveEntry = useCallback(
798
+ async (path, newPath, opts) => {
799
+ if (!sessionId) throw new Error("no session");
800
+ const from = parentWithinTree(path, rootPath);
801
+ const to = parentWithinTree(newPath, rootPath);
802
+ await runOptimistic(
803
+ "move",
804
+ (nodes) => {
805
+ const moving = findNodeByPath(nodes, path);
806
+ if (!moving) return nodes;
807
+ const moved = repathNode(moving, path, newPath);
808
+ return insertNode(removeNode(nodes, path, rootPath), to, moved, rootPath);
809
+ },
810
+ () => client.fsMove(workspaceId, sessionId, {
811
+ path,
812
+ newPath,
813
+ overwrite: opts?.overwrite ?? false,
814
+ ...route ? { route } : {}
815
+ }),
816
+ to === from ? [from] : [from, to]
817
+ );
818
+ },
819
+ [client, workspaceId, sessionId, rootPath, route, runOptimistic]
820
+ );
821
+ const captureRef = useRef(capture);
822
+ captureRef.current = capture;
823
+ const captureRevision = capture?.revision ?? null;
824
+ const previousIdentityRef = useRef(identityKey);
825
+ useEffect(() => {
826
+ refreshAbortRef.current?.abort();
827
+ refreshAbortRef.current = null;
828
+ refreshGenerationRef.current += 1;
829
+ eventReadAbortRef.current.abort();
830
+ eventReadAbortRef.current = new AbortController();
831
+ const identityChanged = previousIdentityRef.current !== identityKey;
832
+ previousIdentityRef.current = identityKey;
833
+ if (identityChanged || !enabled) {
834
+ if (identityChanged) eventReconcileInFlightRef.current = null;
835
+ identityAbortRef.current.abort();
836
+ identityAbortRef.current = new AbortController();
837
+ identityGenerationRef.current += 1;
838
+ lastSeqRef.current = 0;
839
+ pendingParentsRef.current = /* @__PURE__ */ new Set();
840
+ pendingGitRef.current = false;
841
+ eventReconcilePendingRef.current = false;
842
+ if (debounceRef.current) {
843
+ clearTimeout(debounceRef.current);
844
+ debounceRef.current = null;
845
+ }
846
+ ownRevisionsRef.current = /* @__PURE__ */ new Set();
847
+ statusRef.current = /* @__PURE__ */ new Map();
848
+ treeRef.current = [];
849
+ setTree([]);
850
+ setStateIdentity(identityKey);
851
+ setExpandingPaths(/* @__PURE__ */ new Set());
852
+ sourceRef.current = null;
853
+ setSource(null);
854
+ setLoading(false);
855
+ setError(null);
856
+ setGitSummary(null);
857
+ setGitLoading(false);
858
+ setContentRevision(0);
859
+ }
860
+ if (!enabled) {
861
+ return;
862
+ }
863
+ const currentCapture = captureRevision !== null ? captureRef.current : null;
864
+ if (currentCapture && (identityChanged || !isLive || sourceRef.current !== "live")) {
865
+ seedFromCapture(currentCapture);
866
+ }
867
+ if (!active) {
868
+ if (!active) {
869
+ setLoading(false);
870
+ setGitLoading(false);
871
+ }
872
+ return;
873
+ }
874
+ if (isLive || !hasLiveIoFence && !currentCapture) {
875
+ void refresh();
876
+ }
877
+ return () => {
878
+ refreshAbortRef.current?.abort();
879
+ refreshAbortRef.current = null;
880
+ refreshGenerationRef.current += 1;
881
+ eventReadAbortRef.current.abort();
882
+ eventReconcilePendingRef.current = false;
883
+ };
884
+ }, [
885
+ enabled,
886
+ active,
887
+ isLive,
888
+ hasLiveIoFence,
889
+ captureRevision,
890
+ identityKey,
891
+ refresh,
892
+ seedFromCapture
893
+ ]);
894
+ const refreshGitOverlay = useCallback(
895
+ async (requestSignal) => {
896
+ if (!sessionId) return;
897
+ const identityGeneration = identityGenerationRef.current;
898
+ const identitySignal = identityAbortRef.current.signal;
899
+ const signal = requestSignal ? AbortSignal.any([identitySignal, requestSignal]) : identitySignal;
900
+ setGitLoading(true);
901
+ try {
902
+ const batch = await client.gitReadBatch(
903
+ workspaceId,
904
+ sessionId,
905
+ { requests: repoPaths.map((root) => ({ status: { path: root } })) },
906
+ { signal }
907
+ );
908
+ const statuses = batch.results.map((result, index) => ({
909
+ root: repoPaths[index] ?? "",
910
+ status: result.status
911
+ }));
912
+ if (identityGenerationRef.current !== identityGeneration) return;
913
+ const overlay = /* @__PURE__ */ new Map();
914
+ for (const { root, status } of statuses) {
915
+ for (const file of status.files) {
916
+ const code = file.worktree ?? file.index;
917
+ const mapped = code ? GIT_STATUS_TO_TREE[code] : void 0;
918
+ if (mapped) overlay.set(qualifyStatusPath(root, file.path, rootPath), mapped);
919
+ }
920
+ }
921
+ statusRef.current = overlay;
922
+ setGitSummary(summarizeStatuses(statuses));
923
+ setTree((prev) => applyStatus(prev));
924
+ } catch {
925
+ } finally {
926
+ if (identityGenerationRef.current === identityGeneration) setGitLoading(false);
927
+ }
928
+ },
929
+ [client, workspaceId, sessionId, repoPaths, rootPath, applyStatus]
930
+ );
931
+ const performEventReconcile = useCallback(async () => {
932
+ const parents = pendingParentsRef.current;
933
+ pendingParentsRef.current = /* @__PURE__ */ new Set();
934
+ const wantGit = pendingGitRef.current;
935
+ pendingGitRef.current = false;
936
+ const signal = eventReadAbortRef.current.signal;
937
+ const paths = [...parents];
938
+ await reconcilePaths(paths, signal);
939
+ if (wantGit) await refreshGitOverlay(signal);
940
+ }, [reconcilePaths, refreshGitOverlay]);
941
+ const performEventReconcileRef = useRef(performEventReconcile);
942
+ performEventReconcileRef.current = performEventReconcile;
943
+ const reconcilePendingEvents = useCallback(async () => {
944
+ eventReconcilePendingRef.current = true;
945
+ const existing = eventReconcileInFlightRef.current;
946
+ if (existing) return await existing;
947
+ const identityGeneration = identityGenerationRef.current;
948
+ const run = (async () => {
949
+ while (eventReconcilePendingRef.current && identityGenerationRef.current === identityGeneration) {
950
+ eventReconcilePendingRef.current = false;
951
+ await performEventReconcileRef.current();
952
+ }
953
+ })();
954
+ eventReconcileInFlightRef.current = run;
955
+ try {
956
+ await run;
957
+ } finally {
958
+ if (eventReconcileInFlightRef.current === run) eventReconcileInFlightRef.current = null;
959
+ }
960
+ }, []);
961
+ const events = options.events;
962
+ useEffect(() => {
963
+ if (!enabled || !events) return;
964
+ if (!active || !acceptsEventReads) {
965
+ for (const event of events) {
966
+ if (event.sequence > lastSeqRef.current) lastSeqRef.current = event.sequence;
967
+ }
968
+ if (debounceRef.current) {
969
+ clearTimeout(debounceRef.current);
970
+ debounceRef.current = null;
971
+ }
972
+ pendingParentsRef.current = /* @__PURE__ */ new Set();
973
+ pendingGitRef.current = false;
974
+ eventReconcilePendingRef.current = false;
975
+ return;
976
+ }
977
+ let sawNew = false;
978
+ let contentChanged = false;
979
+ for (const event of events) {
980
+ if (event.sequence <= lastSeqRef.current) continue;
981
+ if (event.type === "fs.changed") {
982
+ sawNew = true;
983
+ const payload = event.payload;
984
+ if (!payload || typeof payload !== "object") continue;
985
+ if (payload.source === "write") continue;
986
+ if (typeof payload.revision === "number" && ownRevisionsRef.current.has(payload.revision))
987
+ continue;
988
+ contentChanged = true;
989
+ for (const change of payload.changes ?? []) {
990
+ pendingParentsRef.current.add(parentWithinTree(change.path, rootPath));
991
+ if (change.oldPath) {
992
+ pendingParentsRef.current.add(parentWithinTree(change.oldPath, rootPath));
993
+ }
994
+ }
995
+ } else if (event.type === "git.changed") {
996
+ sawNew = true;
997
+ const payload = event.payload;
998
+ if (payload && typeof payload === "object" && typeof payload.revision === "number" && ownRevisionsRef.current.has(payload.revision))
999
+ continue;
1000
+ pendingGitRef.current = true;
1001
+ }
1002
+ }
1003
+ for (const event of events)
1004
+ if (event.sequence > lastSeqRef.current) lastSeqRef.current = event.sequence;
1005
+ if (!sawNew) return;
1006
+ if (contentChanged) setContentRevision((revision) => revision + 1);
1007
+ if (debounceRef.current) clearTimeout(debounceRef.current);
1008
+ const identityGeneration = identityGenerationRef.current;
1009
+ debounceRef.current = setTimeout(() => {
1010
+ debounceRef.current = null;
1011
+ if (identityGenerationRef.current !== identityGeneration) return;
1012
+ if (!acceptsEventReadsRef.current) {
1013
+ pendingParentsRef.current = /* @__PURE__ */ new Set();
1014
+ pendingGitRef.current = false;
1015
+ return;
1016
+ }
1017
+ void reconcilePendingEvents();
1018
+ }, 150);
1019
+ }, [enabled, active, acceptsEventReads, events, rootPath, reconcilePendingEvents]);
1020
+ useEffect(() => {
1021
+ if (active && acceptsEventReads) return;
1022
+ if (debounceRef.current) {
1023
+ clearTimeout(debounceRef.current);
1024
+ debounceRef.current = null;
1025
+ }
1026
+ pendingParentsRef.current = /* @__PURE__ */ new Set();
1027
+ pendingGitRef.current = false;
1028
+ eventReconcilePendingRef.current = false;
1029
+ }, [active, acceptsEventReads]);
1030
+ useEffect(
1031
+ () => () => {
1032
+ refreshAbortRef.current?.abort();
1033
+ identityAbortRef.current.abort();
1034
+ eventReadAbortRef.current.abort();
1035
+ eventReconcilePendingRef.current = false;
1036
+ identityGenerationRef.current += 1;
1037
+ if (debounceRef.current) clearTimeout(debounceRef.current);
1038
+ },
1039
+ []
1040
+ );
1041
+ const identityMatches = enabled && stateIdentity === identityKey;
1042
+ return {
1043
+ tree: identityMatches ? tree : [],
1044
+ expand,
1045
+ expandingPaths: identityMatches ? expandingPaths : /* @__PURE__ */ new Set(),
1046
+ readFile,
1047
+ writeFile,
1048
+ createFile,
1049
+ createDir,
1050
+ deleteEntry,
1051
+ moveEntry,
1052
+ refresh,
1053
+ contentRevision: identityMatches ? contentRevision : 0,
1054
+ source: identityMatches ? source : null,
1055
+ capturedAt: identityMatches && source === "capture" ? capture?.capturedAt ?? null : null,
1056
+ gitSummary: identityMatches ? gitSummary : null,
1057
+ gitLoading: identityMatches && gitLoading,
1058
+ loading: identityMatches && loading,
1059
+ error: identityMatches ? error : null
1060
+ };
1061
+ }
1062
+
1063
+ // src/file-node-visibility.ts
1064
+ function pathIsInsideDirectory(path, directory) {
1065
+ if (!path.startsWith(directory) || path === directory) return false;
1066
+ if (directory.endsWith("/") || directory.endsWith("\\")) return true;
1067
+ const boundary = path[directory.length];
1068
+ return boundary === "/" || boundary === "\\";
1069
+ }
1070
+ function visibleFileTree(nodes, predicate, parent = null, depth = 0) {
1071
+ if (!predicate) return nodes;
1072
+ const visible = [];
1073
+ for (const node of nodes) {
1074
+ if (!predicate(node, { depth, parent })) continue;
1075
+ visible.push(
1076
+ node.children === void 0 ? node : {
1077
+ ...node,
1078
+ children: visibleFileTree(node.children, predicate, node, depth + 1)
1079
+ }
1080
+ );
1081
+ }
1082
+ return visible;
1083
+ }
1084
+ function filePathVisibility(nodes, path, predicate, parent = null, depth = 0) {
1085
+ if (!predicate) return "visible";
1086
+ for (const node of nodes) {
1087
+ if (node.path !== path && !pathIsInsideDirectory(path, node.path)) continue;
1088
+ if (!predicate(node, { depth, parent })) return "hidden";
1089
+ if (node.path === path) return "visible";
1090
+ if (node.kind !== "dir" || node.children === void 0) return "unknown";
1091
+ return filePathVisibility(node.children, path, predicate, node, depth + 1);
1092
+ }
1093
+ return "unknown";
1094
+ }
1095
+
1096
+ // src/components/file-browser.tsx
1097
+ import {
1098
+ ChevronRightIcon,
1099
+ FileIcon,
1100
+ FilePlusIcon,
1101
+ FolderIcon,
1102
+ FolderPlusIcon,
1103
+ PencilIcon,
1104
+ RefreshCwIcon,
1105
+ TriangleAlertIcon,
1106
+ Trash2Icon
1107
+ } from "lucide-react";
1108
+ import {
1109
+ useCallback as useCallback2,
1110
+ useEffect as useEffect3,
1111
+ useId,
1112
+ useLayoutEffect,
1113
+ useMemo as useMemo3,
1114
+ useRef as useRef2,
1115
+ useState as useState2
1116
+ } from "react";
1117
+ import { AlertDialog } from "radix-ui";
1118
+ import { VList } from "virtua";
1119
+
1120
+ // src/lib/use-unicode-fonts.ts
1121
+ import { useEffect as useEffect2, useMemo as useMemo2 } from "react";
1122
+ var japaneseScript = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u;
1123
+ var arabicScript = /[\u0600-\u06ff\u0750-\u077f\u0870-\u08ff\ufb50-\ufdff\ufe70-\ufefc]/u;
1124
+ function useUnicodeFallbackFonts(values) {
1125
+ const content = useMemo2(() => collectUnicodeContent(values), [values]);
1126
+ useEffect2(() => {
1127
+ if (content.japanese) {
1128
+ void import("./noto-sans-jp-loader.generated-MR5L6V7K.js").then(({ loadNotoSansJp }) => loadNotoSansJp(content.japanese)).catch(() => void 0);
1129
+ }
1130
+ if (content.arabic) {
1131
+ void import("./noto-sans-arabic-loader-XSH2KYWJ.js").then(({ loadNotoSansArabic }) => loadNotoSansArabic()).catch(() => void 0);
1132
+ }
1133
+ }, [content.arabic, content.japanese]);
1134
+ }
1135
+ function collectUnicodeContent(values) {
1136
+ const japanese = /* @__PURE__ */ new Set();
1137
+ const arabic = /* @__PURE__ */ new Set();
1138
+ for (const value of values) {
1139
+ for (const character of value) {
1140
+ if (japaneseScript.test(character)) japanese.add(character);
1141
+ if (arabicScript.test(character)) arabic.add(character);
1142
+ }
1143
+ }
1144
+ return { japanese: [...japanese].join(""), arabic: [...arabic].join("") };
1145
+ }
1146
+
1147
+ // src/components/file-browser.tsx
1148
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1149
+ var STATUS_TINT = {
1150
+ added: "text-og-status-idle",
1151
+ modified: "text-og-status-running",
1152
+ deleted: "text-og-status-failed line-through",
1153
+ renamed: "text-og-accent",
1154
+ untracked: "text-og-fg-subtle"
1155
+ };
1156
+ var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect3 : useLayoutEffect;
1157
+ function parentOf2(path) {
1158
+ const i = path.lastIndexOf("/");
1159
+ return i <= 0 ? "" : path.slice(0, i);
1160
+ }
1161
+ function joinPath(parent, name) {
1162
+ return parent ? `${parent}/${name}` : name;
1163
+ }
1164
+ function itemKey(item) {
1165
+ switch (item.type) {
1166
+ case "node":
1167
+ return item.node.path;
1168
+ case "create":
1169
+ return `create:${item.parent}`;
1170
+ case "skeleton":
1171
+ return `skeleton:${item.path}`;
1172
+ case "residue":
1173
+ return `residue:${item.path}`;
1174
+ }
1175
+ }
1176
+ function pathIsInsideDirectory2(path, directory) {
1177
+ if (!path.startsWith(directory) || path === directory) return false;
1178
+ if (directory.endsWith("/") || directory.endsWith("\\")) return true;
1179
+ const boundary = path[directory.length];
1180
+ return boundary === "/" || boundary === "\\";
1181
+ }
1182
+ function findNode(nodes, path) {
1183
+ for (const node of nodes) {
1184
+ if (node.path === path) return node;
1185
+ if (node.kind === "dir" && node.children && pathIsInsideDirectory2(path, node.path)) {
1186
+ const hit = findNode(node.children, path);
1187
+ if (hit) return hit;
1188
+ }
1189
+ }
1190
+ return void 0;
1191
+ }
1192
+ function traceRevealPath(nodes, targetPath) {
1193
+ for (const node of nodes) {
1194
+ if (node.path === targetPath) {
1195
+ return {
1196
+ directories: node.kind === "dir" ? [node.path] : [],
1197
+ frontier: node.kind === "dir" && node.children === void 0 ? node.path : null
1198
+ };
1199
+ }
1200
+ if (node.kind !== "dir" || !pathIsInsideDirectory2(targetPath, node.path)) continue;
1201
+ if (node.children === void 0) {
1202
+ return { directories: [node.path], frontier: node.path };
1203
+ }
1204
+ const child = traceRevealPath(node.children, targetPath);
1205
+ return {
1206
+ directories: [node.path, ...child.directories],
1207
+ frontier: child.frontier
1208
+ };
1209
+ }
1210
+ return { directories: [], frontier: null };
1211
+ }
1212
+ function FileBrowser({
1213
+ result,
1214
+ fallback,
1215
+ onSelectFile,
1216
+ selectedPath,
1217
+ isNodeVisible,
1218
+ revealPath,
1219
+ revealPathRequestId,
1220
+ renderNode,
1221
+ emptyState,
1222
+ editable = true,
1223
+ confirmDelete,
1224
+ className
1225
+ }) {
1226
+ const t = useOpenGeniText();
1227
+ const [expanded, setExpanded] = useState2(/* @__PURE__ */ new Set());
1228
+ const [loadingPaths, setLoadingPaths] = useState2(/* @__PURE__ */ new Set());
1229
+ const [active, setActive] = useState2(null);
1230
+ const [draftCreate, setDraftCreate] = useState2(null);
1231
+ const [draftRename, setDraftRename] = useState2(null);
1232
+ const [dragOver, setDragOver] = useState2(null);
1233
+ const [menu, setMenu] = useState2(null);
1234
+ const [pendingDelete, setPendingDelete] = useState2(null);
1235
+ const [busy, setBusy] = useState2(false);
1236
+ const [coarsePointer, setCoarsePointer] = useState2(false);
1237
+ const [revealRequest, setRevealRequest] = useState2(null);
1238
+ const handledRevealRequestRef = useRef2(null);
1239
+ const attemptedRevealPathsRef = useRef2(/* @__PURE__ */ new Set());
1240
+ const treeId = useId();
1241
+ const container = usePortalTokenSource();
1242
+ const containerRef = container.currentRef;
1243
+ const deleteReturnFocusRef = useRef2(null);
1244
+ const vlistRef = useRef2(null);
1245
+ const portalTokenStyle = usePortalTokenStyle(container.source);
1246
+ const getTreeElement = useCallback2(
1247
+ () => typeof document === "undefined" ? null : document.getElementById(treeId),
1248
+ [treeId]
1249
+ );
1250
+ const visibleTree = useMemo3(
1251
+ () => visibleFileTree(result.tree, isNodeVisible),
1252
+ [isNodeVisible, result.tree]
1253
+ );
1254
+ useBrowserLayoutEffect(() => {
1255
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
1256
+ const query = window.matchMedia("(pointer: coarse)");
1257
+ const update = () => setCoarsePointer(query.matches);
1258
+ update();
1259
+ if (typeof query.addEventListener === "function") {
1260
+ query.addEventListener("change", update);
1261
+ return () => query.removeEventListener("change", update);
1262
+ }
1263
+ if (typeof query.addListener === "function") {
1264
+ query.addListener(update);
1265
+ return () => query.removeListener(update);
1266
+ }
1267
+ }, []);
1268
+ const effectiveRevealRequestId = revealPath ? revealPathRequestId ?? revealPath : null;
1269
+ useEffect3(() => {
1270
+ if (!revealPath || effectiveRevealRequestId === null) {
1271
+ setRevealRequest(null);
1272
+ return;
1273
+ }
1274
+ const handled = handledRevealRequestRef.current;
1275
+ if (handled?.path === revealPath && handled.requestId === effectiveRevealRequestId) return;
1276
+ handledRevealRequestRef.current = {
1277
+ path: revealPath,
1278
+ requestId: effectiveRevealRequestId
1279
+ };
1280
+ attemptedRevealPathsRef.current = /* @__PURE__ */ new Set();
1281
+ setActive(null);
1282
+ setRevealRequest({ path: revealPath, requestId: effectiveRevealRequestId });
1283
+ }, [effectiveRevealRequestId, revealPath]);
1284
+ const visibleActive = active && findNode(visibleTree, active) ? active : null;
1285
+ const cursor = visibleActive ?? (selectedPath && findNode(visibleTree, selectedPath) ? selectedPath : null);
1286
+ useEffect3(() => {
1287
+ if (active !== null && visibleActive === null) setActive(null);
1288
+ }, [active, visibleActive]);
1289
+ const expand = useCallback2(
1290
+ async (path) => {
1291
+ const node = findNode(visibleTree, path);
1292
+ if (node && node.kind === "dir" && node.children === void 0) {
1293
+ setLoadingPaths((prev) => new Set(prev).add(path));
1294
+ try {
1295
+ await result.expand(path);
1296
+ } finally {
1297
+ setLoadingPaths((prev) => {
1298
+ const next = new Set(prev);
1299
+ next.delete(path);
1300
+ return next;
1301
+ });
1302
+ }
1303
+ }
1304
+ },
1305
+ [result, visibleTree]
1306
+ );
1307
+ const open = useCallback2(
1308
+ (path) => {
1309
+ setExpanded((prev) => new Set(prev).add(path));
1310
+ void expand(path);
1311
+ },
1312
+ [expand]
1313
+ );
1314
+ useEffect3(() => {
1315
+ if (!revealRequest) return;
1316
+ const trace = traceRevealPath(visibleTree, revealRequest.path);
1317
+ if (trace.directories.length > 0) {
1318
+ setExpanded((previous) => {
1319
+ const next = new Set(previous);
1320
+ let changed = false;
1321
+ for (const path of trace.directories) {
1322
+ if (next.has(path)) continue;
1323
+ next.add(path);
1324
+ changed = true;
1325
+ }
1326
+ return changed ? next : previous;
1327
+ });
1328
+ }
1329
+ const frontier = trace.frontier;
1330
+ if (!frontier || attemptedRevealPathsRef.current.has(frontier) || loadingPaths.has(frontier) || result.expandingPaths.has(frontier)) {
1331
+ return;
1332
+ }
1333
+ attemptedRevealPathsRef.current.add(frontier);
1334
+ void expand(frontier);
1335
+ }, [expand, loadingPaths, result.expandingPaths, revealRequest, visibleTree]);
1336
+ const toggle = useCallback2(
1337
+ async (node) => {
1338
+ if (node.kind !== "dir") return;
1339
+ const isOpen = expanded.has(node.path);
1340
+ setExpanded((prev) => {
1341
+ const next = new Set(prev);
1342
+ if (isOpen) next.delete(node.path);
1343
+ else next.add(node.path);
1344
+ return next;
1345
+ });
1346
+ if (!isOpen) await expand(node.path);
1347
+ },
1348
+ [expanded, expand]
1349
+ );
1350
+ const cold = result.source !== "live";
1351
+ const renderItems = useMemo3(() => {
1352
+ const items = [];
1353
+ if (draftCreate && draftCreate.parent === "") {
1354
+ items.push({ type: "create", parent: "", kind: draftCreate.kind, depth: 0 });
1355
+ }
1356
+ const walk = (nodes, depth) => {
1357
+ for (const node of nodes) {
1358
+ items.push({ type: "node", node, depth });
1359
+ if (node.kind !== "dir" || !expanded.has(node.path)) continue;
1360
+ if (draftCreate && draftCreate.parent === node.path) {
1361
+ items.push({
1362
+ type: "create",
1363
+ parent: node.path,
1364
+ kind: draftCreate.kind,
1365
+ depth: depth + 1
1366
+ });
1367
+ }
1368
+ const childless = node.children === void 0 || node.children.length === 0;
1369
+ const isLoading = loadingPaths.has(node.path) || result.expandingPaths.has(node.path);
1370
+ if (node.truncated && childless && cold && !isLoading) {
1371
+ items.push({ type: "residue", path: node.path, depth: depth + 1 });
1372
+ } else if (node.children && node.children.length > 0) {
1373
+ walk(node.children, depth + 1);
1374
+ } else if (isLoading && childless) {
1375
+ items.push({ type: "skeleton", path: node.path, depth: depth + 1 });
1376
+ }
1377
+ }
1378
+ };
1379
+ walk(visibleTree, 0);
1380
+ return items;
1381
+ }, [visibleTree, expanded, draftCreate, loadingPaths, result.expandingPaths, cold]);
1382
+ const unicodeFontPaths = useMemo3(
1383
+ () => renderItems.flatMap((item) => item.type === "node" ? [item.node.path] : []),
1384
+ [renderItems]
1385
+ );
1386
+ useUnicodeFallbackFonts(unicodeFontPaths);
1387
+ const flatRows = useMemo3(
1388
+ () => renderItems.flatMap(
1389
+ (item) => item.type === "node" ? [{ node: item.node, depth: item.depth }] : []
1390
+ ),
1391
+ [renderItems]
1392
+ );
1393
+ const rowIndexByPath = useMemo3(
1394
+ () => new Map(flatRows.map((row, index) => [row.node.path, index])),
1395
+ [flatRows]
1396
+ );
1397
+ const treePositionByPath = useMemo3(() => {
1398
+ const positions = /* @__PURE__ */ new Map();
1399
+ const visit = (nodes) => {
1400
+ nodes.forEach((node, index) => {
1401
+ positions.set(node.path, { position: index + 1, setSize: nodes.length });
1402
+ if (node.children) visit(node.children);
1403
+ });
1404
+ };
1405
+ visit(visibleTree);
1406
+ return positions;
1407
+ }, [visibleTree]);
1408
+ const cursorIndex = cursor ? rowIndexByPath.get(cursor) ?? -1 : -1;
1409
+ const activeDescendantId = cursorIndex >= 0 ? `${treeId}-item-${cursorIndex}` : void 0;
1410
+ const supportsMutation = editable && result.source === "live" && result.error === null && !result.loading;
1411
+ const performDelete = useCallback2(
1412
+ async (node) => {
1413
+ if (!supportsMutation) return;
1414
+ const recursive = node.kind === "dir";
1415
+ setBusy(true);
1416
+ try {
1417
+ await result.deleteEntry(node.path, recursive);
1418
+ } catch {
1419
+ } finally {
1420
+ setBusy(false);
1421
+ }
1422
+ },
1423
+ [supportsMutation, result]
1424
+ );
1425
+ const runDelete = useCallback2(
1426
+ async (node, returnFocus) => {
1427
+ if (!supportsMutation) return;
1428
+ setMenu(null);
1429
+ if (!confirmDelete) {
1430
+ deleteReturnFocusRef.current = returnFocus ?? (typeof document !== "undefined" && document.activeElement instanceof HTMLElement ? document.activeElement : null);
1431
+ setPendingDelete(node);
1432
+ return;
1433
+ }
1434
+ if (await confirmDelete(node)) await performDelete(node);
1435
+ },
1436
+ [supportsMutation, confirmDelete, performDelete]
1437
+ );
1438
+ const closePendingDelete = useCallback2(
1439
+ (restoreTrigger) => {
1440
+ const returnTarget = restoreTrigger ? deleteReturnFocusRef.current : getTreeElement();
1441
+ deleteReturnFocusRef.current = null;
1442
+ setPendingDelete(null);
1443
+ if (typeof window !== "undefined") {
1444
+ window.requestAnimationFrame(() => {
1445
+ const target = returnTarget?.isConnected ? returnTarget : getTreeElement();
1446
+ target?.focus();
1447
+ });
1448
+ }
1449
+ },
1450
+ [getTreeElement]
1451
+ );
1452
+ const commitCreate = useCallback2(
1453
+ async (name) => {
1454
+ const draft = draftCreate;
1455
+ setDraftCreate(null);
1456
+ if (!draft || !supportsMutation) return;
1457
+ const trimmed = name.trim().replace(/\/+$/, "");
1458
+ if (!trimmed) return;
1459
+ const path = joinPath(draft.parent, trimmed);
1460
+ setBusy(true);
1461
+ try {
1462
+ if (draft.kind === "dir") {
1463
+ await result.createDir(path);
1464
+ open(path);
1465
+ } else {
1466
+ await result.createFile(path);
1467
+ setActive(path);
1468
+ onSelectFile?.(path);
1469
+ }
1470
+ } catch {
1471
+ } finally {
1472
+ setBusy(false);
1473
+ }
1474
+ },
1475
+ [draftCreate, supportsMutation, result, open, onSelectFile]
1476
+ );
1477
+ const commitRename = useCallback2(
1478
+ async (name) => {
1479
+ const draft = draftRename;
1480
+ setDraftRename(null);
1481
+ if (!draft || !supportsMutation) return;
1482
+ const node = findNode(visibleTree, draft.path);
1483
+ const trimmed = name.trim().replace(/\/+$/, "");
1484
+ if (!node || !trimmed || trimmed === node.name) return;
1485
+ const newPath = joinPath(parentOf2(draft.path), trimmed);
1486
+ setBusy(true);
1487
+ try {
1488
+ await result.moveEntry(draft.path, newPath);
1489
+ if (node.kind === "file" && (selectedPath === draft.path || active === draft.path)) {
1490
+ setActive(newPath);
1491
+ onSelectFile?.(newPath);
1492
+ }
1493
+ } catch {
1494
+ } finally {
1495
+ setBusy(false);
1496
+ }
1497
+ },
1498
+ [draftRename, supportsMutation, result, selectedPath, active, onSelectFile, visibleTree]
1499
+ );
1500
+ const startCreate = useCallback2(
1501
+ (kind) => {
1502
+ if (!supportsMutation) return;
1503
+ const anchor = cursor ? findNode(visibleTree, cursor) : void 0;
1504
+ const parent = anchor ? anchor.kind === "dir" ? anchor.path : parentOf2(anchor.path) : "";
1505
+ if (parent) open(parent);
1506
+ setDraftRename(null);
1507
+ setMenu(null);
1508
+ setDraftCreate({ parent, kind });
1509
+ },
1510
+ [supportsMutation, cursor, open, visibleTree]
1511
+ );
1512
+ const startRename = useCallback2(
1513
+ (node) => {
1514
+ if (!supportsMutation) return;
1515
+ setDraftCreate(null);
1516
+ setMenu(null);
1517
+ setDraftRename({ path: node.path });
1518
+ },
1519
+ [supportsMutation]
1520
+ );
1521
+ const onDropOnto = useCallback2(
1522
+ async (targetDir, sourcePath) => {
1523
+ setDragOver(null);
1524
+ if (!supportsMutation || !sourcePath) return;
1525
+ const src = findNode(visibleTree, sourcePath);
1526
+ if (!src) return;
1527
+ if (parentOf2(sourcePath) === targetDir) return;
1528
+ if (targetDir === sourcePath || targetDir.startsWith(`${sourcePath}/`)) return;
1529
+ const newPath = joinPath(targetDir, src.name);
1530
+ if (newPath === sourcePath) return;
1531
+ setBusy(true);
1532
+ try {
1533
+ await result.moveEntry(sourcePath, newPath);
1534
+ if (src.kind === "file" && (selectedPath === sourcePath || active === sourcePath)) {
1535
+ setActive(newPath);
1536
+ onSelectFile?.(newPath);
1537
+ }
1538
+ } catch {
1539
+ } finally {
1540
+ setBusy(false);
1541
+ }
1542
+ },
1543
+ [supportsMutation, result, selectedPath, active, onSelectFile, visibleTree]
1544
+ );
1545
+ const onKeyDown = useCallback2(
1546
+ (e) => {
1547
+ if (draftCreate || draftRename) return;
1548
+ if (flatRows.length === 0) return;
1549
+ const idx = flatRows.findIndex((r) => r.node.path === cursor);
1550
+ const move = (next) => {
1551
+ const clamped = Math.max(0, Math.min(flatRows.length - 1, next));
1552
+ const row = flatRows[clamped];
1553
+ if (row) setActive(row.node.path);
1554
+ e.preventDefault();
1555
+ };
1556
+ const cur = idx >= 0 ? flatRows[idx] : void 0;
1557
+ switch (e.key) {
1558
+ case "ArrowDown":
1559
+ move(idx < 0 ? 0 : idx + 1);
1560
+ break;
1561
+ case "ArrowUp":
1562
+ move(idx < 0 ? 0 : idx - 1);
1563
+ break;
1564
+ case "Home":
1565
+ move(0);
1566
+ break;
1567
+ case "End":
1568
+ move(flatRows.length - 1);
1569
+ break;
1570
+ case "PageDown": {
1571
+ const pageSize = Math.max(
1572
+ 1,
1573
+ Math.floor((containerRef.current?.clientHeight || 280) / (coarsePointer ? 44 : 28)) - 1
1574
+ );
1575
+ move((idx < 0 ? 0 : idx) + pageSize);
1576
+ break;
1577
+ }
1578
+ case "PageUp": {
1579
+ const pageSize = Math.max(
1580
+ 1,
1581
+ Math.floor((containerRef.current?.clientHeight || 280) / (coarsePointer ? 44 : 28)) - 1
1582
+ );
1583
+ move((idx < 0 ? 0 : idx) - pageSize);
1584
+ break;
1585
+ }
1586
+ case "ArrowRight":
1587
+ if (cur?.node.kind === "dir") {
1588
+ if (!expanded.has(cur.node.path)) open(cur.node.path);
1589
+ else move(idx + 1);
1590
+ e.preventDefault();
1591
+ }
1592
+ break;
1593
+ case "ArrowLeft":
1594
+ if (cur) {
1595
+ if (cur.node.kind === "dir" && expanded.has(cur.node.path)) {
1596
+ setExpanded((prev) => {
1597
+ const n = new Set(prev);
1598
+ n.delete(cur.node.path);
1599
+ return n;
1600
+ });
1601
+ } else {
1602
+ const parent = parentOf2(cur.node.path);
1603
+ if (parent) setActive(parent);
1604
+ }
1605
+ e.preventDefault();
1606
+ }
1607
+ break;
1608
+ case "Enter":
1609
+ if (cur) {
1610
+ if (cur.node.kind === "dir") void toggle(cur.node);
1611
+ else onSelectFile?.(cur.node.path);
1612
+ e.preventDefault();
1613
+ }
1614
+ break;
1615
+ case "ContextMenu":
1616
+ case "F10":
1617
+ if (cur && supportsMutation && (e.key === "ContextMenu" || e.shiftKey)) {
1618
+ const rowIndex = rowIndexByPath.get(cur.node.path) ?? 0;
1619
+ const row = document.getElementById(`${treeId}-item-${rowIndex}`);
1620
+ const rect = row?.getBoundingClientRect();
1621
+ setMenu({
1622
+ node: cur.node,
1623
+ x: rect ? rect.left + Math.min(32, rect.width / 2) : 8,
1624
+ y: rect ? rect.bottom : 8
1625
+ });
1626
+ e.preventDefault();
1627
+ } else if (e.key === "F10") {
1628
+ break;
1629
+ }
1630
+ break;
1631
+ case "F2":
1632
+ if (cur) {
1633
+ startRename(cur.node);
1634
+ e.preventDefault();
1635
+ }
1636
+ break;
1637
+ case "Delete":
1638
+ case "Backspace":
1639
+ if (cur && supportsMutation) {
1640
+ void runDelete(cur.node);
1641
+ e.preventDefault();
1642
+ }
1643
+ break;
1644
+ }
1645
+ },
1646
+ [
1647
+ draftCreate,
1648
+ draftRename,
1649
+ flatRows,
1650
+ cursor,
1651
+ expanded,
1652
+ open,
1653
+ toggle,
1654
+ onSelectFile,
1655
+ startRename,
1656
+ runDelete,
1657
+ supportsMutation,
1658
+ coarsePointer,
1659
+ containerRef,
1660
+ rowIndexByPath,
1661
+ treeId
1662
+ ]
1663
+ );
1664
+ useEffect3(() => {
1665
+ if (!menu) return;
1666
+ const close = () => setMenu(null);
1667
+ window.addEventListener("click", close);
1668
+ window.addEventListener("scroll", close, true);
1669
+ window.addEventListener("resize", close);
1670
+ return () => {
1671
+ window.removeEventListener("click", close);
1672
+ window.removeEventListener("scroll", close, true);
1673
+ window.removeEventListener("resize", close);
1674
+ };
1675
+ }, [menu]);
1676
+ const showErrorEmpty = result.error && visibleTree.length === 0 && !draftCreate;
1677
+ const showDegradedTree = result.error && visibleTree.length > 0;
1678
+ const showEmpty = !result.loading && visibleTree.length === 0 && !draftCreate;
1679
+ const showToolbar = supportsMutation || result.loading;
1680
+ const usesVirtualTree = !showErrorEmpty && !showEmpty && renderItems.length > 500;
1681
+ const renderNodeRow = (node, depth) => {
1682
+ const isOpen = expanded.has(node.path);
1683
+ if (renderNode) {
1684
+ return /* @__PURE__ */ jsx("div", { children: renderNode(node, depth, isOpen) });
1685
+ }
1686
+ const isDir = node.kind === "dir";
1687
+ const isSelected = node.path === selectedPath || node.path === active;
1688
+ const isCursor = node.path === cursor;
1689
+ const isLoading = loadingPaths.has(node.path) || result.expandingPaths.has(node.path);
1690
+ const isRenaming = draftRename?.path === node.path;
1691
+ const isDropTarget = dragOver === (isDir ? node.path : parentOf2(node.path));
1692
+ const dropDir = isDir ? node.path : parentOf2(node.path);
1693
+ const treePosition = treePositionByPath.get(node.path);
1694
+ return /* @__PURE__ */ jsx(
1695
+ "div",
1696
+ {
1697
+ id: `${treeId}-item-${rowIndexByPath.get(node.path) ?? 0}`,
1698
+ role: "treeitem",
1699
+ "aria-level": depth + 1,
1700
+ "aria-posinset": treePosition?.position,
1701
+ "aria-setsize": treePosition?.setSize,
1702
+ "aria-expanded": isDir ? isOpen : void 0,
1703
+ "aria-selected": isCursor || void 0,
1704
+ "aria-busy": isLoading || void 0,
1705
+ onDragOver: supportsMutation ? (e) => {
1706
+ e.preventDefault();
1707
+ e.dataTransfer.dropEffect = "move";
1708
+ setDragOver(dropDir);
1709
+ } : void 0,
1710
+ onDragLeave: supportsMutation ? (e) => {
1711
+ e.stopPropagation();
1712
+ setDragOver((cur) => cur === dropDir ? null : cur);
1713
+ } : void 0,
1714
+ onDrop: supportsMutation ? (e) => {
1715
+ e.preventDefault();
1716
+ e.stopPropagation();
1717
+ const src = e.dataTransfer.getData("text/og-path");
1718
+ void onDropOnto(dropDir, src);
1719
+ } : void 0,
1720
+ children: isRenaming ? /* @__PURE__ */ jsx(
1721
+ InlineInput,
1722
+ {
1723
+ depth,
1724
+ kind: node.kind,
1725
+ initialValue: node.name,
1726
+ onCommit: (name) => void commitRename(name),
1727
+ onCancel: () => setDraftRename(null)
1728
+ }
1729
+ ) : /* @__PURE__ */ jsxs(
1730
+ "button",
1731
+ {
1732
+ type: "button",
1733
+ tabIndex: -1,
1734
+ draggable: supportsMutation || void 0,
1735
+ onDragStart: supportsMutation ? (e) => {
1736
+ e.dataTransfer.setData("text/og-path", node.path);
1737
+ e.dataTransfer.effectAllowed = "move";
1738
+ } : void 0,
1739
+ onClick: () => {
1740
+ setActive(node.path);
1741
+ if (isDir) void toggle(node);
1742
+ else onSelectFile?.(node.path);
1743
+ },
1744
+ onDoubleClick: () => supportsMutation && startRename(node),
1745
+ onContextMenu: (e) => {
1746
+ if (!supportsMutation) return;
1747
+ e.preventDefault();
1748
+ setActive(node.path);
1749
+ setMenu({ node, x: e.clientX, y: e.clientY });
1750
+ },
1751
+ className: cn(
1752
+ "group relative flex min-h-7 w-full items-center gap-1 truncate rounded-og-sm px-1 py-0.5 text-left text-og-sm pointer-coarse:min-h-11",
1753
+ "hover:bg-og-surface-2",
1754
+ isSelected && "bg-og-surface-2",
1755
+ isCursor && "outline outline-1 -outline-offset-1 outline-og-accent",
1756
+ isDropTarget && "bg-og-accent-soft ring-1 ring-inset ring-og-accent",
1757
+ // A thin progress shimmer on the expanding row — no per-node spinner.
1758
+ isLoading && "after:pointer-events-none after:absolute after:inset-x-1 after:bottom-0 after:h-px after:animate-pulse after:rounded-full after:bg-og-accent-soft",
1759
+ node.status ? STATUS_TINT[node.status] : void 0
1760
+ ),
1761
+ style: { paddingLeft: `${depth * 12 + 4}px` },
1762
+ children: [
1763
+ isDir ? /* @__PURE__ */ jsx(
1764
+ ChevronRightIcon,
1765
+ {
1766
+ className: cn(
1767
+ "size-3 shrink-0 transition-transform",
1768
+ isOpen && "rotate-90",
1769
+ isLoading && "text-og-accent"
1770
+ )
1771
+ }
1772
+ ) : /* @__PURE__ */ jsx("span", { className: "inline-block w-3 shrink-0" }),
1773
+ isDir ? /* @__PURE__ */ jsx(FolderIcon, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx(FileIcon, { className: "size-3.5 shrink-0" }),
1774
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: node.name }),
1775
+ supportsMutation && /* @__PURE__ */ jsx(
1776
+ "span",
1777
+ {
1778
+ role: "button",
1779
+ tabIndex: -1,
1780
+ "aria-label": t("fileBrowser.moreActions"),
1781
+ onClick: (e) => {
1782
+ e.preventDefault();
1783
+ e.stopPropagation();
1784
+ setActive(node.path);
1785
+ const rect = e.currentTarget.getBoundingClientRect();
1786
+ setMenu({ node, x: rect.right, y: rect.bottom });
1787
+ },
1788
+ className: "ml-auto hidden shrink-0 px-1 text-og-fg-subtle hover:text-og-fg group-hover:inline",
1789
+ children: "\u22EF"
1790
+ }
1791
+ )
1792
+ ]
1793
+ }
1794
+ )
1795
+ }
1796
+ );
1797
+ };
1798
+ const renderItem = (item) => {
1799
+ switch (item.type) {
1800
+ case "node":
1801
+ return renderNodeRow(item.node, item.depth);
1802
+ case "create":
1803
+ return /* @__PURE__ */ jsx(
1804
+ InlineInput,
1805
+ {
1806
+ depth: item.depth,
1807
+ kind: item.kind,
1808
+ initialValue: "",
1809
+ onCommit: (name) => void commitCreate(name),
1810
+ onCancel: () => setDraftCreate(null)
1811
+ }
1812
+ );
1813
+ case "skeleton":
1814
+ return /* @__PURE__ */ jsx(
1815
+ "div",
1816
+ {
1817
+ role: "group",
1818
+ "aria-hidden": true,
1819
+ style: { paddingLeft: `${item.depth * 12 + 4}px` },
1820
+ className: "space-y-1 py-1",
1821
+ children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx(
1822
+ "div",
1823
+ {
1824
+ className: "h-2.5 animate-pulse rounded-og-sm bg-og-surface-2",
1825
+ style: { width: `${70 - i * 12}%` }
1826
+ },
1827
+ i
1828
+ ))
1829
+ }
1830
+ );
1831
+ case "residue":
1832
+ return /* @__PURE__ */ jsxs(
1833
+ "div",
1834
+ {
1835
+ style: { paddingLeft: `${item.depth * 12 + 4}px` },
1836
+ className: "flex items-center gap-1.5 py-0.5 pr-1 text-og-xs italic text-og-fg-subtle",
1837
+ children: [
1838
+ /* @__PURE__ */ jsx("span", { className: "inline-block w-3 shrink-0" }),
1839
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: t("fileBrowser.contentsOnMachineOpenWhen") })
1840
+ ]
1841
+ }
1842
+ );
1843
+ }
1844
+ };
1845
+ useEffect3(() => {
1846
+ if (!cursor) return;
1847
+ const index = renderItems.findIndex((it) => it.type === "node" && it.node.path === cursor);
1848
+ if (index >= 0) vlistRef.current?.scrollToIndex(index);
1849
+ }, [cursor, renderItems]);
1850
+ useEffect3(() => {
1851
+ if (!revealRequest) return;
1852
+ const index = renderItems.findIndex(
1853
+ (item) => item.type === "node" && item.node.path === revealRequest.path
1854
+ );
1855
+ if (index < 0) return;
1856
+ if (usesVirtualTree) {
1857
+ vlistRef.current?.scrollToIndex(index);
1858
+ } else {
1859
+ document.getElementById(`${treeId}-item-${index}`)?.scrollIntoView?.({ block: "nearest" });
1860
+ }
1861
+ setRevealRequest(
1862
+ (current) => current?.path === revealRequest.path && current.requestId === revealRequest.requestId ? null : current
1863
+ );
1864
+ }, [renderItems, revealRequest, treeId, usesVirtualTree]);
1865
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-0 min-w-0 flex-col", className), children: [
1866
+ showToolbar && /* @__PURE__ */ jsxs(
1867
+ "div",
1868
+ {
1869
+ role: "toolbar",
1870
+ "aria-label": t("fileBrowser.fileActions"),
1871
+ className: "flex shrink-0 flex-wrap items-center gap-0.5 border-b border-og-border px-1 py-1",
1872
+ children: [
1873
+ supportsMutation ? /* @__PURE__ */ jsxs(Fragment, { children: [
1874
+ /* @__PURE__ */ jsx(
1875
+ ToolbarButton,
1876
+ {
1877
+ label: t("fileBrowser.newFile"),
1878
+ onClick: () => startCreate("file"),
1879
+ disabled: busy,
1880
+ children: /* @__PURE__ */ jsx(FilePlusIcon, { className: "size-3.5" })
1881
+ }
1882
+ ),
1883
+ /* @__PURE__ */ jsx(
1884
+ ToolbarButton,
1885
+ {
1886
+ label: t("fileBrowser.newFolder"),
1887
+ onClick: () => startCreate("dir"),
1888
+ disabled: busy,
1889
+ children: /* @__PURE__ */ jsx(FolderPlusIcon, { className: "size-3.5" })
1890
+ }
1891
+ ),
1892
+ /* @__PURE__ */ jsx(
1893
+ ToolbarButton,
1894
+ {
1895
+ label: t("fileBrowser.rename"),
1896
+ onClick: () => {
1897
+ const node = cursor ? findNode(visibleTree, cursor) : void 0;
1898
+ if (node) startRename(node);
1899
+ },
1900
+ disabled: busy || !cursor,
1901
+ children: /* @__PURE__ */ jsx(PencilIcon, { className: "size-3.5" })
1902
+ }
1903
+ ),
1904
+ /* @__PURE__ */ jsx(
1905
+ ToolbarButton,
1906
+ {
1907
+ label: t("fileBrowser.delete"),
1908
+ onClick: (event) => {
1909
+ const node = cursor ? findNode(visibleTree, cursor) : void 0;
1910
+ if (node) void runDelete(node, event.currentTarget);
1911
+ },
1912
+ disabled: busy || !cursor,
1913
+ children: /* @__PURE__ */ jsx(Trash2Icon, { className: "size-3.5" })
1914
+ }
1915
+ )
1916
+ ] }) : null,
1917
+ /* @__PURE__ */ jsx("span", { className: "ml-auto" }),
1918
+ /* @__PURE__ */ jsx(
1919
+ ToolbarButton,
1920
+ {
1921
+ label: t("fileBrowser.refresh"),
1922
+ onClick: () => void result.refresh(),
1923
+ disabled: busy || result.loading,
1924
+ children: /* @__PURE__ */ jsx(RefreshCwIcon, { className: cn("size-3.5", result.loading && "animate-spin") })
1925
+ }
1926
+ )
1927
+ ]
1928
+ }
1929
+ ),
1930
+ showDegradedTree ? /* @__PURE__ */ jsxs(
1931
+ "div",
1932
+ {
1933
+ role: "status",
1934
+ "aria-live": "polite",
1935
+ "data-opengeni-files-degraded": true,
1936
+ className: "flex shrink-0 items-center gap-2 border-b border-og-status-running/30 bg-og-status-running/10 px-2 py-1.5 text-og-xs text-og-fg-muted",
1937
+ children: [
1938
+ /* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-3.5 shrink-0 text-og-status-running", "aria-hidden": true }),
1939
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: result.source === "capture" ? t("fileBrowser.liveFilesAreTemporarilyUnavailable") : t("fileBrowser.liveRefreshFailedShowingThe") }),
1940
+ /* @__PURE__ */ jsxs(
1941
+ "button",
1942
+ {
1943
+ type: "button",
1944
+ onClick: () => void result.refresh(),
1945
+ disabled: result.loading,
1946
+ className: "inline-flex min-h-7 shrink-0 items-center gap-1 rounded-og-sm border border-og-border bg-og-surface-1 px-2 font-medium text-og-fg transition-colors hover:border-og-border-strong focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
1947
+ children: [
1948
+ /* @__PURE__ */ jsx(
1949
+ RefreshCwIcon,
1950
+ {
1951
+ className: cn("size-3", result.loading && "animate-spin motion-reduce:animate-none"),
1952
+ "aria-hidden": true
1953
+ }
1954
+ ),
1955
+ t("fileBrowser.retry")
1956
+ ]
1957
+ }
1958
+ )
1959
+ ]
1960
+ }
1961
+ ) : null,
1962
+ /* @__PURE__ */ jsx(
1963
+ "div",
1964
+ {
1965
+ ref: container.ref,
1966
+ onFocus: (event) => {
1967
+ if (event.target.id === treeId && cursorIndex < 0) {
1968
+ const first = flatRows[0];
1969
+ if (first) setActive(first.node.path);
1970
+ }
1971
+ },
1972
+ onKeyDown,
1973
+ onDragOver: supportsMutation ? (e) => {
1974
+ e.preventDefault();
1975
+ e.dataTransfer.dropEffect = "move";
1976
+ setDragOver("");
1977
+ } : void 0,
1978
+ onDrop: supportsMutation ? (e) => {
1979
+ e.preventDefault();
1980
+ const src = e.dataTransfer.getData("text/og-path");
1981
+ void onDropOnto("", src);
1982
+ } : void 0,
1983
+ className: cn(
1984
+ "flex min-h-0 min-w-0 flex-1 flex-col p-1",
1985
+ dragOver === "" && "ring-1 ring-inset ring-og-accent"
1986
+ ),
1987
+ "data-opengeni-file-tree": true,
1988
+ children: showErrorEmpty ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-2 p-2 text-og-sm text-og-fg-subtle", children: [
1989
+ /* @__PURE__ */ jsx("div", { children: fallback ?? t("fileBrowser.couldNotLoadFilesMessage", {
1990
+ message: result.error?.message ?? t("fileBrowser.refreshTheFileListTo")
1991
+ }) }),
1992
+ /* @__PURE__ */ jsxs(
1993
+ "button",
1994
+ {
1995
+ type: "button",
1996
+ onClick: () => void result.refresh(),
1997
+ disabled: result.loading,
1998
+ className: "inline-flex items-center gap-1.5 rounded-og-sm border border-og-border px-2 py-1 text-og-xs font-medium text-og-fg-muted transition-colors hover:border-og-border-strong hover:text-og-fg disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
1999
+ children: [
2000
+ /* @__PURE__ */ jsx(
2001
+ RefreshCwIcon,
2002
+ {
2003
+ className: cn("size-3.5", result.loading && "animate-spin"),
2004
+ "aria-hidden": true
2005
+ }
2006
+ ),
2007
+ t("fileBrowser.retry")
2008
+ ]
2009
+ }
2010
+ )
2011
+ ] }) : showEmpty ? /* @__PURE__ */ jsx("div", { className: "p-2 text-og-sm text-og-fg-subtle", children: emptyState ?? t("fileBrowser.thisDirectoryIsEmpty") }) : !usesVirtualTree ? /* @__PURE__ */ jsx(
2012
+ "div",
2013
+ {
2014
+ id: treeId,
2015
+ role: "tree",
2016
+ "aria-label": t("fileBrowser.workspaceFiles"),
2017
+ "aria-activedescendant": activeDescendantId,
2018
+ "aria-multiselectable": false,
2019
+ tabIndex: 0,
2020
+ className: "min-h-0 min-w-0 flex-1 overflow-auto outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
2021
+ children: renderItems.map((item) => /* @__PURE__ */ jsx("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
2022
+ }
2023
+ ) : (
2024
+ // Virtualized: only the rows in/near the viewport mount, so a 3k-node
2025
+ // tree stays responsive. The flat item list already carries the
2026
+ // expanded subtree + synthetic (create/skeleton/residue) rows.
2027
+ /* @__PURE__ */ jsx(
2028
+ VList,
2029
+ {
2030
+ ref: vlistRef,
2031
+ id: treeId,
2032
+ role: "tree",
2033
+ "aria-label": t("fileBrowser.workspaceFiles"),
2034
+ "aria-activedescendant": activeDescendantId,
2035
+ "aria-multiselectable": false,
2036
+ tabIndex: 0,
2037
+ className: "min-h-0 flex-1 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
2038
+ itemSize: coarsePointer ? 44 : 28,
2039
+ ssrCount: Math.min(32, renderItems.length),
2040
+ children: renderItems.map((item) => /* @__PURE__ */ jsx("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
2041
+ }
2042
+ )
2043
+ )
2044
+ }
2045
+ ),
2046
+ menu && menu.node && /* @__PURE__ */ jsx(
2047
+ ContextMenu,
2048
+ {
2049
+ node: menu.node,
2050
+ x: menu.x,
2051
+ y: menu.y,
2052
+ onRename: () => menu.node && startRename(menu.node),
2053
+ onDelete: () => menu.node && void runDelete(menu.node),
2054
+ onNewFile: () => startCreate("file"),
2055
+ onNewFolder: () => startCreate("dir"),
2056
+ onClose: () => {
2057
+ setMenu(null);
2058
+ window.requestAnimationFrame(() => getTreeElement()?.focus());
2059
+ }
2060
+ }
2061
+ ),
2062
+ pendingDelete ? /* @__PURE__ */ jsx(
2063
+ DeleteDialog,
2064
+ {
2065
+ node: pendingDelete,
2066
+ busy,
2067
+ portalTokenStyle,
2068
+ onCancel: () => closePendingDelete(true),
2069
+ onConfirm: () => {
2070
+ const node = pendingDelete;
2071
+ closePendingDelete(false);
2072
+ void performDelete(node);
2073
+ }
2074
+ }
2075
+ ) : null
2076
+ ] });
2077
+ }
2078
+ function DeleteDialog({
2079
+ node,
2080
+ busy,
2081
+ portalTokenStyle,
2082
+ onCancel,
2083
+ onConfirm
2084
+ }) {
2085
+ const t = useOpenGeniText();
2086
+ const portalContainer = usePortalContainer();
2087
+ const cancelRef = useRef2(null);
2088
+ const [open, setOpen] = useState2(true);
2089
+ const closeIntentRef = useRef2("cancel");
2090
+ const settledRef = useRef2(false);
2091
+ const settleTimerRef = useRef2(null);
2092
+ const settle = () => {
2093
+ if (settledRef.current) return;
2094
+ settledRef.current = true;
2095
+ if (closeIntentRef.current === "confirm") {
2096
+ onConfirm();
2097
+ } else {
2098
+ onCancel();
2099
+ }
2100
+ };
2101
+ const scheduleSettle = () => {
2102
+ if (settleTimerRef.current !== null) return;
2103
+ settleTimerRef.current = setTimeout(() => {
2104
+ settleTimerRef.current = null;
2105
+ settle();
2106
+ }, 0);
2107
+ };
2108
+ useEffect3(
2109
+ () => () => {
2110
+ if (settleTimerRef.current !== null) clearTimeout(settleTimerRef.current);
2111
+ },
2112
+ []
2113
+ );
2114
+ return /* @__PURE__ */ jsx(
2115
+ AlertDialog.Root,
2116
+ {
2117
+ open,
2118
+ onOpenChange: (nextOpen) => {
2119
+ if (!nextOpen && !busy) {
2120
+ setOpen(false);
2121
+ scheduleSettle();
2122
+ }
2123
+ },
2124
+ children: /* @__PURE__ */ jsxs(
2125
+ AlertDialog.Portal,
2126
+ {
2127
+ container: portalContainer ?? (typeof document === "undefined" ? null : document.body),
2128
+ children: [
2129
+ /* @__PURE__ */ jsx(AlertDialog.Overlay, { className: "og-root fixed inset-0 z-[100] bg-black/45 backdrop-blur-[2px]" }),
2130
+ /* @__PURE__ */ jsxs(
2131
+ AlertDialog.Content,
2132
+ {
2133
+ className: "og-root fixed left-1/2 top-1/2 z-[101] max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-sm -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-og-lg border border-og-border-strong bg-og-surface-1 p-4 text-og-fg shadow-2xl outline-hidden",
2134
+ style: portalTokenStyle,
2135
+ onOpenAutoFocus: (event) => {
2136
+ event.preventDefault();
2137
+ cancelRef.current?.focus();
2138
+ },
2139
+ onCloseAutoFocus: (event) => {
2140
+ event.preventDefault();
2141
+ scheduleSettle();
2142
+ },
2143
+ onEscapeKeyDown: (event) => {
2144
+ event.stopPropagation();
2145
+ if (busy) {
2146
+ event.preventDefault();
2147
+ } else {
2148
+ closeIntentRef.current = "cancel";
2149
+ }
2150
+ },
2151
+ children: [
2152
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
2153
+ /* @__PURE__ */ jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-og-status-failed/12 text-og-status-failed", children: /* @__PURE__ */ jsx(Trash2Icon, { className: "size-4", "aria-hidden": true }) }),
2154
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2155
+ /* @__PURE__ */ jsxs(AlertDialog.Title, { className: "text-og-sm font-semibold", children: [
2156
+ t("fileBrowser.delete"),
2157
+ " ",
2158
+ node.kind === "dir" ? t("fileBrowser.folder") : t("fileBrowser.file"),
2159
+ "?"
2160
+ ] }),
2161
+ /* @__PURE__ */ jsxs(AlertDialog.Description, { className: "mt-1 text-og-sm leading-relaxed text-og-fg-muted", children: [
2162
+ /* @__PURE__ */ jsx("span", { className: "break-all font-og-mono text-og-fg", children: node.path }),
2163
+ node.kind === "dir" ? " and everything inside it will be permanently removed." : " will be permanently removed."
2164
+ ] })
2165
+ ] })
2166
+ ] }),
2167
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 flex justify-end gap-2", children: [
2168
+ /* @__PURE__ */ jsx(AlertDialog.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(
2169
+ "button",
2170
+ {
2171
+ ref: cancelRef,
2172
+ type: "button",
2173
+ onClick: () => {
2174
+ closeIntentRef.current = "cancel";
2175
+ },
2176
+ disabled: busy,
2177
+ className: "min-h-9 rounded-og-md border border-og-border px-3 text-og-sm font-medium text-og-fg hover:bg-og-surface-2 disabled:opacity-50 pointer-coarse:min-h-11",
2178
+ children: t("fileBrowser.cancel")
2179
+ }
2180
+ ) }),
2181
+ /* @__PURE__ */ jsx(AlertDialog.Action, { asChild: true, children: /* @__PURE__ */ jsx(
2182
+ "button",
2183
+ {
2184
+ type: "button",
2185
+ onClick: () => {
2186
+ closeIntentRef.current = "confirm";
2187
+ },
2188
+ disabled: busy,
2189
+ className: "min-h-9 rounded-og-md bg-og-danger-fill px-3 text-og-sm font-semibold text-og-danger-fg shadow-sm hover:brightness-110 disabled:opacity-50 pointer-coarse:min-h-11",
2190
+ children: t("fileBrowser.deletePermanently")
2191
+ }
2192
+ ) })
2193
+ ] })
2194
+ ]
2195
+ }
2196
+ )
2197
+ ]
2198
+ }
2199
+ )
2200
+ }
2201
+ );
2202
+ }
2203
+ function ToolbarButton({
2204
+ label,
2205
+ onClick,
2206
+ disabled,
2207
+ children
2208
+ }) {
2209
+ return /* @__PURE__ */ jsx(
2210
+ "button",
2211
+ {
2212
+ type: "button",
2213
+ title: label,
2214
+ "aria-label": label,
2215
+ onClick,
2216
+ disabled,
2217
+ className: cn(
2218
+ "inline-flex size-7 items-center justify-center rounded-og-sm p-1 text-og-fg-muted max-[1023px]:size-11 pointer-coarse:min-h-11 pointer-coarse:min-w-11",
2219
+ "hover:bg-og-surface-2 hover:text-og-fg",
2220
+ "disabled:cursor-not-allowed disabled:opacity-40"
2221
+ ),
2222
+ children
2223
+ }
2224
+ );
2225
+ }
2226
+ function InlineInput({
2227
+ depth,
2228
+ kind,
2229
+ initialValue,
2230
+ onCommit,
2231
+ onCancel
2232
+ }) {
2233
+ const t = useOpenGeniText();
2234
+ const [value, setValue] = useState2(initialValue);
2235
+ const ref = useRef2(null);
2236
+ const doneRef = useRef2(false);
2237
+ useEffect3(() => {
2238
+ const el = ref.current;
2239
+ if (!el) return;
2240
+ el.focus();
2241
+ const dot = initialValue.lastIndexOf(".");
2242
+ if (initialValue && dot > 0) el.setSelectionRange(0, dot);
2243
+ else el.select();
2244
+ }, [initialValue]);
2245
+ const finish = (commit) => {
2246
+ if (doneRef.current) return;
2247
+ doneRef.current = true;
2248
+ if (commit) onCommit(value);
2249
+ else onCancel();
2250
+ };
2251
+ return /* @__PURE__ */ jsxs(
2252
+ "div",
2253
+ {
2254
+ className: "flex items-center gap-1 px-1 py-0.5",
2255
+ style: { paddingLeft: `${depth * 12 + 4}px` },
2256
+ children: [
2257
+ /* @__PURE__ */ jsx("span", { className: "inline-block w-3 shrink-0" }),
2258
+ kind === "dir" ? /* @__PURE__ */ jsx(FolderIcon, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx(FileIcon, { className: "size-3.5 shrink-0" }),
2259
+ /* @__PURE__ */ jsx(
2260
+ "input",
2261
+ {
2262
+ ref,
2263
+ value,
2264
+ spellCheck: false,
2265
+ autoComplete: "off",
2266
+ "aria-label": kind === "dir" ? t("fileBrowser.folderName") : t("fileBrowser.fileName"),
2267
+ onChange: (e) => setValue(e.target.value),
2268
+ onBlur: () => finish(true),
2269
+ onKeyDown: (e) => {
2270
+ if (e.key === "Enter") {
2271
+ e.preventDefault();
2272
+ finish(true);
2273
+ } else if (e.key === "Escape") {
2274
+ e.preventDefault();
2275
+ finish(false);
2276
+ }
2277
+ e.stopPropagation();
2278
+ },
2279
+ className: cn(
2280
+ "min-w-0 flex-1 rounded-og-sm border bg-og-bg px-1 py-0 text-og-sm",
2281
+ "border-og-accent text-og-fg",
2282
+ "outline-hidden"
2283
+ )
2284
+ }
2285
+ )
2286
+ ]
2287
+ }
2288
+ );
2289
+ }
2290
+ function ContextMenu({
2291
+ node,
2292
+ x,
2293
+ y,
2294
+ onRename,
2295
+ onDelete,
2296
+ onNewFile,
2297
+ onNewFolder,
2298
+ onClose
2299
+ }) {
2300
+ const t = useOpenGeniText();
2301
+ const isDir = node.kind === "dir";
2302
+ const menuRef = useRef2(null);
2303
+ const vw = typeof window !== "undefined" ? window.innerWidth : 9999;
2304
+ const vh = typeof window !== "undefined" ? window.innerHeight : 9999;
2305
+ const left = Math.max(4, Math.min(x, vw - 180));
2306
+ const top = Math.max(4, Math.min(y, vh - 160));
2307
+ useEffect3(() => {
2308
+ menuRef.current?.querySelector('[role="menuitem"]')?.focus();
2309
+ }, []);
2310
+ const onKeyDown = (event) => {
2311
+ const items = Array.from(
2312
+ menuRef.current?.querySelectorAll('[role="menuitem"]') ?? []
2313
+ );
2314
+ if (items.length === 0) return;
2315
+ const current = items.findIndex((item2) => item2 === document.activeElement);
2316
+ let next = null;
2317
+ if (event.key === "ArrowDown") next = (current + 1 + items.length) % items.length;
2318
+ else if (event.key === "ArrowUp") next = (current - 1 + items.length) % items.length;
2319
+ else if (event.key === "Home") next = 0;
2320
+ else if (event.key === "End") next = items.length - 1;
2321
+ else if (event.key === "Escape") {
2322
+ event.preventDefault();
2323
+ event.stopPropagation();
2324
+ onClose();
2325
+ return;
2326
+ }
2327
+ if (next === null) return;
2328
+ event.preventDefault();
2329
+ event.stopPropagation();
2330
+ items[next]?.focus();
2331
+ };
2332
+ const item = (label, icon, onClick, danger) => /* @__PURE__ */ jsxs(
2333
+ "button",
2334
+ {
2335
+ type: "button",
2336
+ role: "menuitem",
2337
+ onClick: (e) => {
2338
+ e.stopPropagation();
2339
+ onClick();
2340
+ },
2341
+ className: cn(
2342
+ MENU_BUTTON_CLASS,
2343
+ danger && "text-og-status-failed [&_svg]:text-og-status-failed!"
2344
+ ),
2345
+ children: [
2346
+ icon,
2347
+ label
2348
+ ]
2349
+ }
2350
+ );
2351
+ return /* @__PURE__ */ jsxs(
2352
+ "div",
2353
+ {
2354
+ ref: menuRef,
2355
+ role: "menu",
2356
+ "aria-label": t("fileBrowser.actionsForName", { name: node.name }),
2357
+ onKeyDown,
2358
+ onClick: (e) => e.stopPropagation(),
2359
+ style: { left, top },
2360
+ className: cn(MENU_SURFACE_CLASS, "fixed z-50 min-w-[180px] overflow-hidden"),
2361
+ children: [
2362
+ isDir && /* @__PURE__ */ jsxs(Fragment, { children: [
2363
+ item(t("fileBrowser.newFile"), /* @__PURE__ */ jsx(FilePlusIcon, {}), onNewFile),
2364
+ item(t("fileBrowser.newFolder"), /* @__PURE__ */ jsx(FolderPlusIcon, {}), onNewFolder),
2365
+ /* @__PURE__ */ jsx("div", { role: "separator", className: MENU_SEPARATOR_CLASS })
2366
+ ] }),
2367
+ item(t("fileBrowser.rename"), /* @__PURE__ */ jsx(PencilIcon, {}), onRename),
2368
+ item("Delete", /* @__PURE__ */ jsx(Trash2Icon, {}), onDelete, true)
2369
+ ]
2370
+ }
2371
+ );
2372
+ }
2373
+
2374
+ // src/components/sandbox-files.tsx
2375
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
2376
+ function SandboxFiles({
2377
+ files,
2378
+ git,
2379
+ fileSystemAvailable = true,
2380
+ usePierre = true,
2381
+ editable = true,
2382
+ onEditIntent,
2383
+ initialSelectedPath,
2384
+ onSelectedPathChange,
2385
+ isNodeVisible,
2386
+ requestedPath,
2387
+ requestedLine,
2388
+ requestedPathRequestId,
2389
+ requestedPathReady = true,
2390
+ workspaceResting = false,
2391
+ workspaceWaking = false,
2392
+ liveWorkspaceReady = true,
2393
+ workspaceError = null,
2394
+ onWakeWorkspace,
2395
+ themeType,
2396
+ className
2397
+ }) {
2398
+ const t = useOpenGeniText();
2399
+ const [selected, setSelected] = useState3(() => initialSelectedPath ?? null);
2400
+ const [editMode, setEditMode] = useState3(false);
2401
+ const [focusLine, setFocusLine] = useState3(null);
2402
+ const [treeRevealRequest, setTreeRevealRequest] = useState3(null);
2403
+ const [liveRequestedPath, setLiveRequestedPath] = useState3(null);
2404
+ const [viewReloadRevision, setViewReloadRevision] = useState3(0);
2405
+ const viewerScrollRef = useRef3(null);
2406
+ const pendingRequestRef = useRef3(null);
2407
+ const handledRequestRef = useRef3(null);
2408
+ const requestKey = requestedPath ? requestedPathRequestId ?? requestedPath : null;
2409
+ useEffect4(() => {
2410
+ if (!requestedPath || requestKey === null) {
2411
+ pendingRequestRef.current = null;
2412
+ handledRequestRef.current = null;
2413
+ setTreeRevealRequest(null);
2414
+ return;
2415
+ }
2416
+ if (handledRequestRef.current === requestKey) {
2417
+ return;
2418
+ }
2419
+ if (!requestedPathReady) {
2420
+ pendingRequestRef.current = requestKey;
2421
+ setTreeRevealRequest(null);
2422
+ return;
2423
+ }
2424
+ if (isNodeVisible && files.loading && files.tree.length === 0) return;
2425
+ if (isNodeVisible && !files.loading && files.tree.length === 0) {
2426
+ handledRequestRef.current = requestKey;
2427
+ pendingRequestRef.current = null;
2428
+ setTreeRevealRequest(null);
2429
+ return;
2430
+ }
2431
+ if (filePathVisibility(files.tree, requestedPath, isNodeVisible) === "hidden") {
2432
+ handledRequestRef.current = requestKey;
2433
+ pendingRequestRef.current = null;
2434
+ setTreeRevealRequest(null);
2435
+ return;
2436
+ }
2437
+ handledRequestRef.current = requestKey;
2438
+ pendingRequestRef.current = null;
2439
+ setSelected(requestedPath);
2440
+ onSelectedPathChange?.(requestedPath);
2441
+ setEditMode(false);
2442
+ setFocusLine(requestedLine != null && requestedLine > 0 ? requestedLine : null);
2443
+ setTreeRevealRequest({ path: requestedPath, requestId: requestKey });
2444
+ setViewReloadRevision((revision) => revision + 1);
2445
+ }, [
2446
+ files.loading,
2447
+ files.tree,
2448
+ isNodeVisible,
2449
+ onSelectedPathChange,
2450
+ requestKey,
2451
+ requestedLine,
2452
+ requestedPath,
2453
+ requestedPathReady
2454
+ ]);
2455
+ const rootRef = useRef3(null);
2456
+ const [wide, setWide] = useState3(false);
2457
+ useEffect4(() => {
2458
+ const el = rootRef.current;
2459
+ if (!el) return;
2460
+ const update = () => setWide(el.getBoundingClientRect().width >= 720);
2461
+ update();
2462
+ if (typeof ResizeObserver === "undefined") return;
2463
+ const observer = new ResizeObserver(update);
2464
+ observer.observe(el);
2465
+ const surface = el.closest("[data-workspace-surface]");
2466
+ const surfaceObserver = surface && typeof MutationObserver !== "undefined" ? new MutationObserver(update) : null;
2467
+ surfaceObserver?.observe(surface, {
2468
+ attributes: true,
2469
+ attributeFilter: ["class", "style"]
2470
+ });
2471
+ return () => {
2472
+ observer.disconnect();
2473
+ surfaceObserver?.disconnect();
2474
+ };
2475
+ }, []);
2476
+ const resolvedTheme = useThemeType(themeType);
2477
+ const selectedVisibility = selected ? filePathVisibility(files.tree, selected, isNodeVisible) : "unknown";
2478
+ const visibilityPending = Boolean(isNodeVisible && files.loading && files.tree.length === 0);
2479
+ const viewPath = selectedVisibility === "hidden" || visibilityPending ? null : selected;
2480
+ useEffect4(() => {
2481
+ if (selected === null || selectedVisibility !== "hidden") return;
2482
+ setSelected(null);
2483
+ onSelectedPathChange?.(null);
2484
+ setEditMode(false);
2485
+ setFocusLine(null);
2486
+ setTreeRevealRequest(null);
2487
+ setLiveRequestedPath(null);
2488
+ }, [onSelectedPathChange, selected, selectedVisibility]);
2489
+ const fileView = useFileView(
2490
+ viewPath,
2491
+ files.readFile,
2492
+ `${files.contentRevision ?? 0}:${viewReloadRevision}`
2493
+ );
2494
+ useEffect4(() => {
2495
+ if (focusLine === null && viewReloadRevision > 0 && viewerScrollRef.current) {
2496
+ viewerScrollRef.current.scrollTop = 0;
2497
+ }
2498
+ }, [focusLine, viewReloadRevision]);
2499
+ const selectFile = useCallback3(
2500
+ (path) => {
2501
+ if (pendingRequestRef.current !== null) {
2502
+ handledRequestRef.current = pendingRequestRef.current;
2503
+ pendingRequestRef.current = null;
2504
+ }
2505
+ setSelected(path);
2506
+ onSelectedPathChange?.(path);
2507
+ setEditMode(false);
2508
+ setFocusLine(null);
2509
+ setTreeRevealRequest(null);
2510
+ setLiveRequestedPath(null);
2511
+ setViewReloadRevision(0);
2512
+ },
2513
+ [onSelectedPathChange]
2514
+ );
2515
+ const canEdit = editable && viewPath !== null && !fileView.loading && fileView.error === null && !fileView.isBinary && !fileView.truncated && fileView.content !== null;
2516
+ const showEditor = canEdit && editMode;
2517
+ const captureFileUnavailable = fileView.error instanceof CapturedFileUnavailableError ? fileView.error : null;
2518
+ const waitingForSelectedFile = !workspaceError && liveRequestedPath === viewPath && (!liveWorkspaceReady || files.loading) && captureFileUnavailable !== null;
2519
+ if (workspaceError && !liveWorkspaceReady && files.source !== "capture") {
2520
+ return /* @__PURE__ */ jsxs2(
2521
+ Notice,
2522
+ {
2523
+ className,
2524
+ title: t("sandboxFiles.couldNotOpenLiveWorkspace"),
2525
+ announce: "alert",
2526
+ children: [
2527
+ /* @__PURE__ */ jsx2("p", { children: workspaceError.message }),
2528
+ onWakeWorkspace ? /* @__PURE__ */ jsx2(WakeButton, { onClick: onWakeWorkspace, children: t("sandboxFiles.retryLiveWorkspace") }) : null
2529
+ ]
2530
+ }
2531
+ );
2532
+ }
2533
+ if (workspaceResting || workspaceWaking) {
2534
+ return /* @__PURE__ */ jsx2("div", { className: cn("h-full", className), "data-opengeni-workspace-resting": true, children: /* @__PURE__ */ jsxs2(
2535
+ Notice,
2536
+ {
2537
+ icon: workspaceWaking ? /* @__PURE__ */ jsx2(
2538
+ LoaderCircleIcon,
2539
+ {
2540
+ className: "size-5 animate-spin motion-reduce:animate-none",
2541
+ "aria-hidden": true
2542
+ }
2543
+ ) : /* @__PURE__ */ jsx2(FileCode2Icon, { className: "size-5", "aria-hidden": true }),
2544
+ title: workspaceWaking ? t("sandboxFiles.wakingWorkspace") : t("sandboxFiles.workspaceIsResting"),
2545
+ announce: "status",
2546
+ children: [
2547
+ /* @__PURE__ */ jsx2("p", { children: workspaceWaking ? t("sandboxFiles.connectingToTheLiveFile") : t("sandboxFiles.noCapturedRevisionIsAvailable") }),
2548
+ !workspaceWaking && onWakeWorkspace ? /* @__PURE__ */ jsx2(WakeButton, { onClick: onWakeWorkspace, children: t("sandboxFiles.openLiveWorkspace") }) : null
2549
+ ]
2550
+ }
2551
+ ) });
2552
+ }
2553
+ if (!fileSystemAvailable) {
2554
+ return /* @__PURE__ */ jsx2(
2555
+ Notice,
2556
+ {
2557
+ className,
2558
+ icon: /* @__PURE__ */ jsx2(FileWarningIcon, { className: "size-5", "aria-hidden": true }),
2559
+ title: t("sandboxFiles.filesUnavailable"),
2560
+ announce: "alert",
2561
+ children: t("sandboxFiles.thisSandboxDoesNotExpose")
2562
+ }
2563
+ );
2564
+ }
2565
+ return /* @__PURE__ */ jsxs2("div", { ref: rootRef, className: cn("flex h-full min-h-0 min-w-0 flex-col", className), children: [
2566
+ /* @__PURE__ */ jsx2(
2567
+ GitHeader,
2568
+ {
2569
+ loading: Boolean(files.loading || files.gitLoading || files.source === null || git?.loading) && files.gitSummary === null,
2570
+ git: files.gitSummary ?? {
2571
+ branch: git?.branch ?? null,
2572
+ isRepo: git?.isRepo ?? false,
2573
+ repoCount: git?.repoCount ?? 0,
2574
+ ahead: git?.ahead ?? 0,
2575
+ behind: git?.behind ?? 0,
2576
+ dirtyCount: git?.diff.length ?? 0
2577
+ }
2578
+ }
2579
+ ),
2580
+ /* @__PURE__ */ jsxs2(
2581
+ Group,
2582
+ {
2583
+ orientation: wide ? "horizontal" : "vertical",
2584
+ className: cn("min-h-0 flex-1", wide ? "flex-row" : "flex-col"),
2585
+ children: [
2586
+ /* @__PURE__ */ jsx2(
2587
+ Panel,
2588
+ {
2589
+ id: "sandbox-files-tree",
2590
+ defaultSize: wide ? "280px" : "40%",
2591
+ minSize: wide ? "180px" : "120px",
2592
+ maxSize: wide ? "60%" : "70%",
2593
+ className: "flex min-h-0 min-w-0 flex-col",
2594
+ children: /* @__PURE__ */ jsx2(
2595
+ FileBrowser,
2596
+ {
2597
+ result: files,
2598
+ isNodeVisible,
2599
+ selectedPath: selected ?? void 0,
2600
+ ...treeRevealRequest ? {
2601
+ revealPath: treeRevealRequest.path,
2602
+ revealPathRequestId: treeRevealRequest.requestId
2603
+ } : {},
2604
+ onSelectFile: selectFile,
2605
+ editable,
2606
+ emptyState: t("sandboxFiles.thisDirectoryIsEmpty"),
2607
+ className: "min-w-0 flex-1"
2608
+ }
2609
+ )
2610
+ }
2611
+ ),
2612
+ /* @__PURE__ */ jsx2(
2613
+ Separator,
2614
+ {
2615
+ "aria-label": t("sandboxFiles.resizeFileTree"),
2616
+ className: cn(
2617
+ "group relative z-10 shrink-0 cursor-col-resize outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
2618
+ "w-px bg-og-border after:absolute after:inset-y-0 after:left-1/2 after:w-3 after:-translate-x-1/2",
2619
+ "hover:bg-og-accent focus-visible:bg-og-accent data-[separator-state=dragging]:bg-og-accent",
2620
+ !wide && "h-px w-full cursor-row-resize after:inset-x-0 after:inset-y-auto after:top-1/2 after:h-3 after:w-full after:-translate-x-0 after:-translate-y-1/2"
2621
+ )
2622
+ }
2623
+ ),
2624
+ /* @__PURE__ */ jsxs2(
2625
+ Panel,
2626
+ {
2627
+ id: "sandbox-files-viewer",
2628
+ minSize: wide ? "240px" : "160px",
2629
+ className: cn("flex min-h-0 min-w-0 flex-col", !wide && "border-t border-og-border"),
2630
+ children: [
2631
+ /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center justify-between gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1", children: [
2632
+ /* @__PURE__ */ jsx2(
2633
+ "span",
2634
+ {
2635
+ "data-opengeni-selected-file": true,
2636
+ className: "min-w-0 truncate font-og-mono text-og-xs text-og-fg-muted",
2637
+ children: selected ? focusLine !== null ? `${selected}:${focusLine}` : selected : t("sandboxFiles.noFileSelected")
2638
+ }
2639
+ ),
2640
+ canEdit && /* @__PURE__ */ jsx2(
2641
+ Segmented,
2642
+ {
2643
+ options: [
2644
+ { value: "view", label: t("sandboxFiles.view") },
2645
+ { value: "edit", label: t("sandboxFiles.edit") }
2646
+ ],
2647
+ value: editMode ? "edit" : "view",
2648
+ onChange: (v) => setEditMode(v === "edit")
2649
+ }
2650
+ )
2651
+ ] }),
2652
+ /* @__PURE__ */ jsx2(
2653
+ "div",
2654
+ {
2655
+ ref: viewerScrollRef,
2656
+ className: "min-h-0 flex-1 overflow-auto",
2657
+ "data-opengeni-file-viewer-scroll": true,
2658
+ children: viewPath ? showEditor && fileView.content !== null ? /* @__PURE__ */ jsx2(
2659
+ CodeEditor,
2660
+ {
2661
+ path: viewPath,
2662
+ initialContents: fileView.content,
2663
+ themeType: resolvedTheme,
2664
+ onSave: (contents, expectedContents) => files.writeFile(viewPath, contents, { expectedContent: expectedContents }),
2665
+ onOverwrite: (contents) => files.writeFile(viewPath, contents, { force: true }),
2666
+ onReload: () => setViewReloadRevision((revision) => revision + 1),
2667
+ ...onEditIntent ? { onEditIntent } : {},
2668
+ className: "h-full"
2669
+ },
2670
+ viewPath
2671
+ ) : workspaceError && (liveRequestedPath === viewPath || requestedPath === viewPath) && !liveWorkspaceReady ? /* @__PURE__ */ jsxs2(Notice, { title: t("sandboxFiles.couldNotOpenLiveFile"), announce: "alert", children: [
2672
+ /* @__PURE__ */ jsx2("p", { children: workspaceError.message }),
2673
+ onWakeWorkspace ? /* @__PURE__ */ jsx2(WakeButton, { onClick: onWakeWorkspace, children: t("sandboxFiles.retryLiveFile") }) : null
2674
+ ] }) : waitingForSelectedFile ? /* @__PURE__ */ jsx2(
2675
+ Notice,
2676
+ {
2677
+ icon: /* @__PURE__ */ jsx2(
2678
+ LoaderCircleIcon,
2679
+ {
2680
+ className: "size-5 animate-spin motion-reduce:animate-none",
2681
+ "aria-hidden": true
2682
+ }
2683
+ ),
2684
+ title: t("sandboxFiles.wakingWorkspace"),
2685
+ announce: "status",
2686
+ children: t("sandboxFiles.openingViewpathWhenTheLive", { viewPath })
2687
+ }
2688
+ ) : captureFileUnavailable ? /* @__PURE__ */ jsxs2(
2689
+ Notice,
2690
+ {
2691
+ icon: /* @__PURE__ */ jsx2(FileCode2Icon, { className: "size-5", "aria-hidden": true }),
2692
+ title: t("sandboxFiles.onMachine"),
2693
+ children: [
2694
+ /* @__PURE__ */ jsx2("p", { children: captureFileUnavailable.reason === "too-large" ? t("sandboxFiles.thisFileIsLargerThan") : captureFileUnavailable.reason === "content-missing" ? t("sandboxFiles.theCapturedCopyIsNo") : t("sandboxFiles.thisFileWasIndexedBut") }),
2695
+ onWakeWorkspace ? /* @__PURE__ */ jsx2(
2696
+ WakeButton,
2697
+ {
2698
+ onClick: () => {
2699
+ setLiveRequestedPath(viewPath);
2700
+ if (liveWorkspaceReady) void files.refresh();
2701
+ else onWakeWorkspace();
2702
+ },
2703
+ children: liveWorkspaceReady ? t("sandboxFiles.retryLiveFile") : t("sandboxFiles.openLiveFile")
2704
+ }
2705
+ ) : null
2706
+ ]
2707
+ }
2708
+ ) : fileView.error ? /* @__PURE__ */ jsx2(Notice, { announce: "alert", children: t("sandboxFiles.couldNotOpenViewpathMessage", {
2709
+ viewPath,
2710
+ message: fileView.error.message
2711
+ }) }) : fileView.loading ? /* @__PURE__ */ jsx2(Notice, { announce: "status", children: t("sandboxFiles.loadingViewpath", { viewPath }) }) : fileView.imageUrl ? /* @__PURE__ */ jsx2(
2712
+ RasterFilePreview,
2713
+ {
2714
+ src: fileView.imageUrl,
2715
+ path: viewPath
2716
+ },
2717
+ fileView.imageUrl
2718
+ ) : fileView.isBinary ? /* @__PURE__ */ jsxs2(Notice, { children: [
2719
+ t("sandboxFiles.viewpathIsABinaryFile", { viewPath }),
2720
+ fileView.sizeBytes ?? 0,
2721
+ " ",
2722
+ t("sandboxFiles.bytes")
2723
+ ] }) : fileView.content !== null ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
2724
+ fileView.truncated && /* @__PURE__ */ jsxs2("div", { className: "border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-status-running", children: [
2725
+ t("sandboxFiles.largeFileShowingATruncated"),
2726
+ fileView.sizeBytes ?? 0,
2727
+ " ",
2728
+ t("sandboxFiles.bytesLoadedEditingIsDisabled")
2729
+ ] }),
2730
+ usePierre && focusLine === null ? /* @__PURE__ */ jsx2(
2731
+ PierreFile,
2732
+ {
2733
+ path: viewPath,
2734
+ contents: fileView.content,
2735
+ themeType: resolvedTheme,
2736
+ fallback: /* @__PURE__ */ jsx2("pre", { className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg", children: fileView.content }),
2737
+ className: "p-1"
2738
+ },
2739
+ `${viewPath}:${viewReloadRevision}`
2740
+ ) : focusLine !== null ? /* @__PURE__ */ jsx2(
2741
+ LineNumberedFile,
2742
+ {
2743
+ path: viewPath,
2744
+ contents: fileView.content,
2745
+ focusLine
2746
+ }
2747
+ ) : /* @__PURE__ */ jsx2("pre", { className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg", children: fileView.content })
2748
+ ] }) : /* @__PURE__ */ jsx2(Notice, { announce: "status", children: t("sandboxFiles.loadingViewpath", { viewPath }) }) : (
2749
+ // Nothing selected — the tree shows the whole workspace; pick a file.
2750
+ requestedPath && !requestedPathReady ? workspaceError ? /* @__PURE__ */ jsxs2(Notice, { title: t("sandboxFiles.couldNotOpenLiveFile"), announce: "alert", children: [
2751
+ /* @__PURE__ */ jsx2("p", { children: workspaceError.message }),
2752
+ onWakeWorkspace ? /* @__PURE__ */ jsx2(WakeButton, { onClick: onWakeWorkspace, children: t("sandboxFiles.retryLiveFile") }) : null
2753
+ ] }) : /* @__PURE__ */ jsx2(
2754
+ Notice,
2755
+ {
2756
+ icon: /* @__PURE__ */ jsx2(
2757
+ LoaderCircleIcon,
2758
+ {
2759
+ className: "size-5 animate-spin motion-reduce:animate-none",
2760
+ "aria-hidden": true
2761
+ }
2762
+ ),
2763
+ title: t("sandboxFiles.wakingSandbox"),
2764
+ announce: "status",
2765
+ children: t("sandboxFiles.openingRequestedpathWhenTheLive", { requestedPath })
2766
+ }
2767
+ ) : /* @__PURE__ */ jsx2(
2768
+ Notice,
2769
+ {
2770
+ icon: /* @__PURE__ */ jsx2(FileCode2Icon, { className: "size-5", "aria-hidden": true }),
2771
+ title: t("sandboxFiles.chooseAFile"),
2772
+ children: t("sandboxFiles.selectAFileInThe")
2773
+ }
2774
+ )
2775
+ )
2776
+ }
2777
+ )
2778
+ ]
2779
+ }
2780
+ )
2781
+ ]
2782
+ }
2783
+ )
2784
+ ] });
2785
+ }
2786
+ function WakeButton({ children, onClick }) {
2787
+ return /* @__PURE__ */ jsx2(
2788
+ "button",
2789
+ {
2790
+ type: "button",
2791
+ onClick,
2792
+ className: "mt-1 inline-flex min-h-11 items-center justify-center rounded-og-md border border-og-primary-border bg-og-primary text-og-primary-fg px-3 py-2 text-og-sm font-medium transition-colors hover:bg-og-primary-hover focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent focus-visible:ring-offset-2 focus-visible:ring-offset-og-bg",
2793
+ children
2794
+ }
2795
+ );
2796
+ }
2797
+ function LineNumberedFile({
2798
+ path,
2799
+ contents,
2800
+ focusLine
2801
+ }) {
2802
+ const t = useOpenGeniText();
2803
+ const lines = contents.split("\n");
2804
+ const inRange = focusLine >= 1 && focusLine <= lines.length;
2805
+ const targetRef = useRef3(null);
2806
+ useEffect4(() => {
2807
+ targetRef.current?.scrollIntoView({
2808
+ block: "center",
2809
+ behavior: prefersReducedMotion() ? "auto" : "smooth"
2810
+ });
2811
+ }, [path, focusLine, contents]);
2812
+ return /* @__PURE__ */ jsxs2(
2813
+ "div",
2814
+ {
2815
+ className: "h-full min-h-0 overflow-auto font-og-mono text-og-sm text-og-fg",
2816
+ role: "region",
2817
+ "aria-label": inRange ? t("sandboxFiles.pathAtLineFocusline", { path, focusLine }) : path,
2818
+ children: [
2819
+ !inRange ? /* @__PURE__ */ jsx2(
2820
+ "p",
2821
+ {
2822
+ className: "border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-fg-muted",
2823
+ role: "status",
2824
+ children: t("sandboxFiles.lineFocuslineIsPastThe", { focusLine })
2825
+ }
2826
+ ) : null,
2827
+ /* @__PURE__ */ jsx2("div", { children: lines.map((text, index) => {
2828
+ const lineNumber = index + 1;
2829
+ const focused = inRange && lineNumber === focusLine;
2830
+ return /* @__PURE__ */ jsxs2(
2831
+ "div",
2832
+ {
2833
+ ref: focused ? targetRef : void 0,
2834
+ "data-opengeni-file-line": lineNumber,
2835
+ ...focused ? { "data-opengeni-focus-line": "" } : {},
2836
+ "aria-current": focused ? "location" : void 0,
2837
+ className: cn("flex gap-3 px-2 py-0.5 leading-6", focused && "bg-og-accent-soft"),
2838
+ children: [
2839
+ /* @__PURE__ */ jsx2("span", { className: "w-11 shrink-0 select-none text-right tabular-nums text-og-fg-subtle", children: lineNumber }),
2840
+ /* @__PURE__ */ jsx2("pre", { className: "min-w-0 flex-1 whitespace-pre-wrap break-words", children: text || " " })
2841
+ ]
2842
+ },
2843
+ lineNumber
2844
+ );
2845
+ }) })
2846
+ ]
2847
+ }
2848
+ );
2849
+ }
2850
+ function GitHeader({ git, loading }) {
2851
+ const t = useOpenGeniText();
2852
+ if (loading) {
2853
+ return /* @__PURE__ */ jsxs2(
2854
+ "div",
2855
+ {
2856
+ className: "flex shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-sm text-og-fg-muted",
2857
+ role: "status",
2858
+ "aria-live": "polite",
2859
+ children: [
2860
+ /* @__PURE__ */ jsx2(
2861
+ LoaderCircleIcon,
2862
+ {
2863
+ className: "size-3.5 shrink-0 animate-spin motion-reduce:animate-none",
2864
+ "aria-hidden": true
2865
+ }
2866
+ ),
2867
+ /* @__PURE__ */ jsx2("span", { children: t("sandboxFiles.loadingRepository") })
2868
+ ]
2869
+ }
2870
+ );
2871
+ }
2872
+ const dirty = git.dirtyCount > 0;
2873
+ return /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-sm", children: [
2874
+ /* @__PURE__ */ jsx2(
2875
+ "span",
2876
+ {
2877
+ "aria-hidden": "true",
2878
+ className: cn(
2879
+ "size-2 shrink-0 rounded-full",
2880
+ dirty ? "bg-og-status-running" : "bg-og-status-idle"
2881
+ )
2882
+ }
2883
+ ),
2884
+ /* @__PURE__ */ jsx2("span", { className: "sr-only", children: dirty ? t("sandboxFiles.uncommittedChangesInDirtycountFiles", { dirtyCount: git.dirtyCount }) : t("sandboxFiles.noUncommittedChanges") }),
2885
+ /* @__PURE__ */ jsx2("span", { className: "truncate font-og-mono text-og-fg", children: git.repoCount > 1 ? t("sandboxFiles.repocountRepositories", { repoCount: git.repoCount }) : git.branch ?? (git.isRepo ? t("sandboxFiles.detached") : t("sandboxFiles.noRepo")) }),
2886
+ (git.ahead > 0 || git.behind > 0) && /* @__PURE__ */ jsxs2("span", { className: "flex shrink-0 items-center gap-1.5 text-og-xs text-og-fg-subtle", children: [
2887
+ git.ahead > 0 && /* @__PURE__ */ jsxs2("span", { "data-contrast-audited": true, children: [
2888
+ "\u2191",
2889
+ git.ahead
2890
+ ] }),
2891
+ git.behind > 0 && /* @__PURE__ */ jsxs2("span", { "data-contrast-audited": true, children: [
2892
+ "\u2193",
2893
+ git.behind
2894
+ ] })
2895
+ ] }),
2896
+ dirty && /* @__PURE__ */ jsx2(
2897
+ "span",
2898
+ {
2899
+ "aria-hidden": "true",
2900
+ "data-contrast-audited": true,
2901
+ className: "ml-auto shrink-0 text-og-xs text-og-fg-subtle",
2902
+ children: t("sandboxFiles.dirtycountChanged", { dirtyCount: git.dirtyCount })
2903
+ }
2904
+ )
2905
+ ] });
2906
+ }
2907
+ function Segmented({
2908
+ options,
2909
+ value,
2910
+ onChange
2911
+ }) {
2912
+ return /* @__PURE__ */ jsx2("div", { className: "flex flex-wrap items-center rounded-og-sm border border-og-border p-0.5", children: options.map((opt) => /* @__PURE__ */ jsx2(
2913
+ "button",
2914
+ {
2915
+ type: "button",
2916
+ onClick: () => onChange(opt.value),
2917
+ className: cn(
2918
+ "min-h-7 rounded-og-xs px-1.5 py-0.5 text-og-xs focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent max-[1023px]:min-h-11 max-[1023px]:min-w-11 pointer-coarse:min-h-11 pointer-coarse:min-w-11",
2919
+ opt.value === value ? "bg-og-accent-soft text-og-fg" : "text-og-fg-subtle hover:text-og-fg"
2920
+ ),
2921
+ children: opt.label
2922
+ },
2923
+ opt.value
2924
+ )) });
2925
+ }
2926
+ function useFileView(path, readFile, reloadRevision = 0) {
2927
+ const previousPathRef = useRef3(null);
2928
+ const [state, setState] = useState3({
2929
+ content: null,
2930
+ isBinary: false,
2931
+ truncated: false,
2932
+ sizeBytes: null,
2933
+ loading: false,
2934
+ error: null
2935
+ });
2936
+ useEffect4(() => {
2937
+ if (!path) {
2938
+ previousPathRef.current = null;
2939
+ setState({
2940
+ content: null,
2941
+ isBinary: false,
2942
+ truncated: false,
2943
+ sizeBytes: null,
2944
+ loading: false,
2945
+ error: null
2946
+ });
2947
+ return;
2948
+ }
2949
+ const pathChanged = previousPathRef.current !== path;
2950
+ previousPathRef.current = path;
2951
+ let cancelled = false;
2952
+ const abort = new AbortController();
2953
+ if (pathChanged) {
2954
+ setState({
2955
+ content: null,
2956
+ isBinary: false,
2957
+ truncated: false,
2958
+ sizeBytes: null,
2959
+ loading: true,
2960
+ error: null
2961
+ });
2962
+ } else {
2963
+ setState((previous) => ({ ...previous, error: null }));
2964
+ }
2965
+ void readFile(path, { signal: abort.signal }).then((res) => {
2966
+ if (cancelled) return;
2967
+ const content = res.isBinary ? null : res.encoding === "base64" ? decodeBase64Utf8(res.content) : res.content;
2968
+ setState({
2969
+ content,
2970
+ imageUrl: !res.truncated && res.encoding === "base64" ? rasterImageUrl(path, res.content) : null,
2971
+ isBinary: res.isBinary,
2972
+ truncated: res.truncated,
2973
+ sizeBytes: res.sizeBytes,
2974
+ loading: false,
2975
+ error: null
2976
+ });
2977
+ }).catch((cause) => {
2978
+ if (cancelled) return;
2979
+ const error = cause instanceof Error ? cause : new Error(String(cause));
2980
+ setState(
2981
+ (previous) => pathChanged ? {
2982
+ content: null,
2983
+ isBinary: false,
2984
+ truncated: false,
2985
+ sizeBytes: null,
2986
+ loading: false,
2987
+ error
2988
+ } : { ...previous, loading: false, error }
2989
+ );
2990
+ });
2991
+ return () => {
2992
+ cancelled = true;
2993
+ abort.abort();
2994
+ };
2995
+ }, [path, readFile, reloadRevision]);
2996
+ return state;
2997
+ }
2998
+ function rasterImageUrl(path, content) {
2999
+ const extension = path.split(".").pop()?.toLowerCase();
3000
+ const mime = extension === "png" ? "image/png" : extension === "jpg" || extension === "jpeg" ? "image/jpeg" : extension === "gif" ? "image/gif" : extension === "webp" ? "image/webp" : null;
3001
+ return mime ? `data:${mime};base64,${content}` : null;
3002
+ }
3003
+ function RasterFilePreview({ src, path }) {
3004
+ const t = useOpenGeniText();
3005
+ const [failed, setFailed] = useState3(false);
3006
+ return failed ? /* @__PURE__ */ jsx2(Notice, { title: t("sandboxFiles.imagePreviewUnavailable"), announce: "alert", children: t("sandboxFiles.couldNotDecodePathAs", { path }) }) : /* @__PURE__ */ jsx2(
3007
+ "img",
3008
+ {
3009
+ src,
3010
+ alt: path,
3011
+ onError: () => setFailed(true),
3012
+ className: "max-w-full object-contain"
3013
+ }
3014
+ );
3015
+ }
3016
+ function decodeBase64Utf8(b64) {
3017
+ try {
3018
+ if (typeof atob === "function") {
3019
+ const binary = atob(b64);
3020
+ const bytes = new Uint8Array(binary.length);
3021
+ for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
3022
+ return new TextDecoder().decode(bytes);
3023
+ }
3024
+ } catch {
3025
+ }
3026
+ return b64;
3027
+ }
3028
+ function Notice({
3029
+ children,
3030
+ className,
3031
+ icon,
3032
+ title,
3033
+ announce
3034
+ }) {
3035
+ return /* @__PURE__ */ jsx2(
3036
+ "div",
3037
+ {
3038
+ role: announce,
3039
+ "aria-atomic": announce ? "true" : void 0,
3040
+ "aria-live": announce === "alert" ? "assertive" : announce === "status" ? "polite" : void 0,
3041
+ className: cn(
3042
+ "flex h-full items-center justify-center p-4 text-center text-og-sm text-og-fg-subtle",
3043
+ className
3044
+ ),
3045
+ children: /* @__PURE__ */ jsxs2("div", { className: "flex max-w-sm flex-col items-center gap-2.5", children: [
3046
+ icon ? /* @__PURE__ */ jsx2("span", { className: "grid size-10 place-items-center rounded-og-lg border border-og-border bg-og-surface-1 text-og-fg-muted shadow-sm", children: icon }) : null,
3047
+ title ? /* @__PURE__ */ jsx2("p", { className: "font-medium text-og-fg", children: title }) : null,
3048
+ /* @__PURE__ */ jsx2("div", { "data-contrast-audited": true, className: "leading-5", children })
3049
+ ] })
3050
+ }
3051
+ );
3052
+ }
3053
+
3054
+ export {
3055
+ visibleFileTree,
3056
+ filePathVisibility,
3057
+ CapturedFileUnavailableError,
3058
+ FileWriteConflictError,
3059
+ useSandboxFiles,
3060
+ useUnicodeFallbackFonts,
3061
+ FileBrowser,
3062
+ SandboxFiles
3063
+ };
3064
+ //# sourceMappingURL=chunk-MM4FNWI4.js.map