@pi-chamber/web 1.0.5 → 1.0.6-rc.2

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 (539) hide show
  1. package/dist/assets/{DiagramView-CrKjR8CR.js → DiagramView-BdDt1SI7.js} +1 -1
  2. package/dist/assets/DiffView-Dk3VIX9E.js +18 -0
  3. package/dist/assets/FileSaveConflictDialog-DpyPjMH1.js +3 -0
  4. package/dist/assets/{FilesView-BRR3N7UA.js → FilesView-CumrwioK.js} +3 -3
  5. package/dist/assets/{GitHubDetailScaffold-C1UHuETI.js → GitHubDetailScaffold-CW2ZqU0Y.js} +3 -3
  6. package/dist/assets/{GitHubLinkPicker-B0O3Vapu.js → GitHubLinkPicker-BjJNQ7Ap.js} +1 -1
  7. package/dist/assets/{GitHubListPrimitives-DvQDU--z.js → GitHubListPrimitives-BcB-cCTs.js} +1 -1
  8. package/dist/assets/{GitView-wAscrRhO.js → GitView-BoCaX5AO.js} +4 -4
  9. package/dist/assets/{IssuesSurface-mh50UUQ8.js → IssuesSurface-CDZENHrE.js} +3 -3
  10. package/dist/assets/{JsonTreeView-BfErTllU.js → JsonTreeView-DpCgOUXg.js} +1 -1
  11. package/dist/assets/{MarkdownRendererImpl-SXAK4uOu.js → MarkdownRendererImpl-BkT5TUWF.js} +2 -2
  12. package/dist/assets/{PatchDiff-CHr79sJ6.js → PatchDiff-Dcr3EQgA.js} +1 -1
  13. package/dist/assets/{PierreDiffViewer-CGpKcLro.js → PierreDiffViewer-o_Edh6ny.js} +3 -3
  14. package/dist/assets/PullRequestsSurface-eSXl6sef.js +2 -0
  15. package/dist/assets/{SessionSwitcherContent-DEAw6v12.js → SessionSwitcherContent-Dm30bfpn.js} +1 -1
  16. package/dist/assets/SessionSwitcherDropdown-CFj9VWSa.js +2 -0
  17. package/dist/assets/SessionUnreadDot-CHlK2awX.js +1 -0
  18. package/dist/assets/SettingsView-CcHRUyev.js +6 -0
  19. package/dist/assets/{SettingsWindow-BiY5FmhZ.js → SettingsWindow-BMzUErrM.js} +1 -1
  20. package/dist/assets/{StickyHorizontalScrollbar-BMITjK4e.js → StickyHorizontalScrollbar-p7EbL2-E.js} +2 -2
  21. package/dist/assets/{ToolOutputDialog-B3RRLhR3.js → ToolOutputDialog-QC8IoeBH.js} +4 -4
  22. package/dist/assets/{ToolPartDiffPreview-D9m_vrht.js → ToolPartDiffPreview-BigGwtul.js} +1 -1
  23. package/dist/assets/{VirtualizedFileDiff-B8lhZGLu.js → VirtualizedFileDiff-DvLCd7Qq.js} +4 -4
  24. package/dist/assets/{Virtualizer-DP6HbEeC.js → Virtualizer-DNJrJKVb.js} +1 -1
  25. package/dist/assets/{appThemeRegistry-gegrE2dq.js → appThemeRegistry-Ca8eGRB9.js} +1 -1
  26. package/dist/assets/{collapsible-9MJx4VhA.js → collapsible-0yfy07W2.js} +1 -1
  27. package/dist/assets/{computeVirtualFileMetrics-Bjhk2CQS.js → computeVirtualFileMetrics-aX6tjjqv.js} +2 -2
  28. package/dist/assets/{contextFileOpenGuard-CsF5Boky.js → contextFileOpenGuard-CZKJuHxf.js} +1 -1
  29. package/dist/assets/{document-attachments-BslE4Ns7.js → document-attachments-CZl9rK1z.js} +5 -5
  30. package/dist/assets/{gitStatusPredicates-B3Zxud6E.js → gitStatusPredicates-3i8CcYWJ.js} +1 -1
  31. package/dist/assets/{githubLink-CbGYxsIq.js → githubLink-BvevcNay.js} +5 -5
  32. package/dist/assets/index-BMdbHCFt.js +1 -0
  33. package/dist/assets/{index-D4n3TVp2.js → index-C2ISrmRR.js} +10 -10
  34. package/dist/assets/index-DgwThEwf.css +1 -0
  35. package/dist/assets/{lua-BgMRiT3U.js → lua-VAEuO923.js} +1 -1
  36. package/dist/assets/main-BM-b2y8p.js +2 -0
  37. package/dist/assets/main-BXZ561E3.js +137 -0
  38. package/dist/assets/{markdown-shiki.worker-DnvH1S1x.js → markdown-shiki.worker-BVA5NZBT.js} +5 -5
  39. package/dist/assets/markdownCore-DbS8DkKw.js +2 -0
  40. package/dist/assets/miniChat-DO3DW6kJ.js +2 -0
  41. package/dist/assets/mobile-BgWLkut6.js +2 -0
  42. package/dist/assets/{nativeFileSave-BJsGPh58.js → nativeFileSave-Bhafll_7.js} +1 -1
  43. package/dist/assets/nsis-LY0VT_u5.js +1 -0
  44. package/dist/assets/permissionStore-zIpxq9Pq.js +1 -0
  45. package/dist/assets/pi-session-focus-preference-ChYVctYk.js +9 -0
  46. package/dist/assets/{registerCustomTheme-DmolaWWZ.js → registerCustomTheme-C-h6lsYW.js} +1 -1
  47. package/dist/assets/{renderDiffWithHighlighter-BhMEWmHn.js → renderDiffWithHighlighter-xlvSvnTf.js} +1 -1
  48. package/dist/assets/renderElectronMiniChatApp-CgVqxKDm.js +2 -0
  49. package/dist/assets/{renderFileWithHighlighter-DUGluXlw.js → renderFileWithHighlighter-CCoYfC-t.js} +1 -1
  50. package/dist/assets/renderMobileApp-CoY1tsk5.js +11 -0
  51. package/dist/assets/ruby-BK5aLJev.js +1 -0
  52. package/dist/assets/runtimeEndpointReset-fozcAShH.js +62 -0
  53. package/dist/assets/runtimeSurface-CJN1oo_1.js +1 -0
  54. package/dist/assets/themeResolver-DrfmQi8i.js +1 -0
  55. package/dist/assets/useAppFontEffects-D_gtiA95.js +215 -0
  56. package/dist/assets/useFilesViewSearch-BUxcZj60.js +7 -0
  57. package/dist/assets/{useGitHubRemoteSearch-DYoLQ4ro.js → useGitHubRemoteSearch-CevR5iLf.js} +1 -1
  58. package/dist/assets/{useSwitcherItems-BS6E199F.js → useSwitcherItems-kaRkXggX.js} +1 -1
  59. package/dist/assets/vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js +1 -0
  60. package/dist/assets/vendor-base-ui-C7vVMZTg.js +1 -0
  61. package/dist/assets/{vendor-beautiful-mermaid-DApbjBp2.js → vendor-beautiful-mermaid-b48gT2g0.js} +1 -1
  62. package/dist/assets/vendor-boot-CoTxysn6.js +65 -0
  63. package/dist/assets/{vendor-capacitor-app-BaupizkW.js → vendor-capacitor-app-NX6DULfp.js} +1 -1
  64. package/dist/assets/{vendor-capacitor-keyboard-9BVxykO7.js → vendor-capacitor-keyboard-DJD81I9f.js} +1 -1
  65. package/dist/assets/{vendor-capacitor-status-bar-BsrUwiaA.js → vendor-capacitor-status-bar-DV24OoQV.js} +1 -1
  66. package/dist/assets/vendor-codemirror-autocomplete-qsuH4Dh-.js +1 -0
  67. package/dist/assets/vendor-codemirror-lang-angular-ZHWyBf7j.js +1 -0
  68. package/dist/assets/vendor-codemirror-lang-cpp-pCTOmv-k.js +1 -0
  69. package/dist/assets/vendor-codemirror-lang-css-2bFuyM70.js +1 -0
  70. package/dist/assets/{vendor-codemirror-lang-go-Crwca_X7.js → vendor-codemirror-lang-go-DrG_c7D7.js} +2 -2
  71. package/dist/assets/vendor-codemirror-lang-html-BV8lrR8v.js +1 -0
  72. package/dist/assets/vendor-codemirror-lang-java-DrsvH6T2.js +1 -0
  73. package/dist/assets/vendor-codemirror-lang-javascript-Dkzl3s07.js +13 -0
  74. package/dist/assets/vendor-codemirror-lang-jinja-8Nn3bnoP.js +1 -0
  75. package/dist/assets/vendor-codemirror-lang-json-CsdmtHhi.js +1 -0
  76. package/dist/assets/vendor-codemirror-lang-less-DJuZ4cZe.js +1 -0
  77. package/dist/assets/vendor-codemirror-lang-liquid-D2RO-Pzr.js +1 -0
  78. package/dist/assets/vendor-codemirror-lang-markdown-C0Zu3b3n.js +1 -0
  79. package/dist/assets/vendor-codemirror-lang-php-CuDtt2Zj.js +1 -0
  80. package/dist/assets/vendor-codemirror-lang-python-Cv2exx_M.js +3 -0
  81. package/dist/assets/vendor-codemirror-lang-rust-C4TxJ6Rg.js +1 -0
  82. package/dist/assets/vendor-codemirror-lang-sass-BmtPz8kf.js +1 -0
  83. package/dist/assets/{vendor-codemirror-lang-sql-B0f-qCZo.js → vendor-codemirror-lang-sql-BF1ZaXqJ.js} +2 -2
  84. package/dist/assets/vendor-codemirror-lang-vue-DZgXrP2k.js +1 -0
  85. package/dist/assets/vendor-codemirror-lang-wast-DsnaGtL_.js +1 -0
  86. package/dist/assets/vendor-codemirror-lang-xml-D8DzzFat.js +1 -0
  87. package/dist/assets/vendor-codemirror-lang-yaml-D5hBv7m6.js +1 -0
  88. package/dist/assets/{vendor-codemirror-language-data-CqU7kHmg.js → vendor-codemirror-language-data-vn2RyN9T.js} +2 -2
  89. package/dist/assets/vendor-codemirror-search-BVCYIV0D.js +2 -0
  90. package/dist/assets/vendor-dompurify-BGCr_sdL.js +3 -0
  91. package/dist/assets/vendor-elkjs-D1S1RCAO.js +24 -0
  92. package/dist/assets/vendor-fuse.js-t_7AcMTv.js +1 -0
  93. package/dist/assets/{vendor-hast-util-to-html-BKBhbTDb.js → vendor-hast-util-to-html-O3stl53j.js} +1 -1
  94. package/dist/assets/{vendor-heic2any-pq-UTQQR.js → vendor-heic2any-sztndhZI.js} +1 -1
  95. package/dist/assets/vendor-lezer-cpp-vqXSn3lv.js +1 -0
  96. package/dist/assets/vendor-lezer-css-JnEzSyZR.js +1 -0
  97. package/dist/assets/{vendor-lezer-go-CHIhCNY6.js → vendor-lezer-go-dD2gQMIL.js} +1 -1
  98. package/dist/assets/{vendor-lezer-html-B3h0MOrG.js → vendor-lezer-html-Cr3U-1pu.js} +1 -1
  99. package/dist/assets/vendor-lezer-java-CRM0IMCo.js +1 -0
  100. package/dist/assets/vendor-lezer-javascript-B3s21DIS.js +1 -0
  101. package/dist/assets/{vendor-lezer-json-BP_UAzLL.js → vendor-lezer-json-DPFM6EBV.js} +1 -1
  102. package/dist/assets/vendor-lezer-lr-Bllrq8hY.js +1 -0
  103. package/dist/assets/vendor-lezer-markdown-6-3PLvXG.js +6 -0
  104. package/dist/assets/vendor-lezer-php-DOyzfHRl.js +1 -0
  105. package/dist/assets/{vendor-lezer-python-EJ4Im4y2.js → vendor-lezer-python-CdHdN5qt.js} +1 -1
  106. package/dist/assets/vendor-lezer-rust-CqnW8EMH.js +1 -0
  107. package/dist/assets/{vendor-lezer-sass-CMi6zfXI.js → vendor-lezer-sass-BbcF4y6A.js} +1 -1
  108. package/dist/assets/{vendor-lezer-xml-0MHMeZDp.js → vendor-lezer-xml-C31AyWoo.js} +1 -1
  109. package/dist/assets/{vendor-lezer-yaml-BE2EFjpA.js → vendor-lezer-yaml-Cv908yC2.js} +1 -1
  110. package/dist/assets/{vendor-lru_map-DOPmc7GU.js → vendor-lru_map-BbiDqlyL.js} +1 -1
  111. package/dist/assets/vendor-marked-Be78pDn1.js +59 -0
  112. package/dist/assets/{vendor-oniguruma-parser-C0D4_9rT.js → vendor-oniguruma-parser-BrbMHgHx.js} +1 -1
  113. package/dist/assets/vendor-oniguruma-to-es-DgwFOwdE.js +94 -0
  114. package/dist/assets/{vendor-pierre-theming-Dgp7B_O4.js → vendor-pierre-theming-BO6EPniU.js} +1 -1
  115. package/dist/assets/vendor-property-information-C40bX6nM.js +1 -0
  116. package/dist/assets/{vendor-qrcode-Dv4uniC1.js → vendor-qrcode-gzL9QFkg.js} +5 -5
  117. package/dist/assets/vendor-react-Bz1tRBxM.js +1 -0
  118. package/dist/assets/{vendor-react-drawio-Duu5LgQA.js → vendor-react-drawio-IYnLUY5N.js} +1 -1
  119. package/dist/assets/vendor-remend-DcBOpbSu.js +24 -0
  120. package/dist/assets/vendor-replit-codemirror-vim-Cwhyn_5f.js +6 -0
  121. package/dist/assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js +34 -0
  122. package/dist/assets/vendor-shiki-BEwTOAFg.js +1 -0
  123. package/dist/assets/{vendor-shikijs-core-CGM_jqPK.js → vendor-shikijs-core-Ck_OPM_T.js} +1 -1
  124. package/dist/assets/{vendor-shikijs-engine-javascript-Cme4830A.js → vendor-shikijs-engine-javascript-DL394yyj.js} +1 -1
  125. package/dist/assets/vendor-shikijs-vscode-textmate-DPFxvYtK.js +3 -0
  126. package/dist/assets/vendor-tailwind-merge-BKkUfl9q.js +1 -0
  127. package/dist/assets/vendor-workbox-window-BBnX5xw4.js +2 -0
  128. package/dist/assets/vendor-zumer-snapdom-SJzqoCHV.js +8 -0
  129. package/dist/assets/vendor-zustand-CXhN0IMY.js +6 -0
  130. package/dist/assets/{web-components-DzQ9ybbb.js → web-components-6ORYp3Iv.js} +1 -1
  131. package/dist/assets/worker-CKCfxIfO.js +153 -0
  132. package/dist/assets/workerFactory-DlGfNFqf.js +1 -0
  133. package/dist/assets/zig-BB16gwVL.js +1 -0
  134. package/dist/index.html +8 -8
  135. package/dist/mini-chat.html +7 -7
  136. package/dist/mobile.html +7 -7
  137. package/package.json +54 -53
  138. package/server/index.js +18 -1
  139. package/server/lib/client-auth/live-revocation.test.js +4 -0
  140. package/server/lib/fs/DOCUMENTATION.md +10 -0
  141. package/server/lib/fs/project-icon.js +243 -0
  142. package/server/lib/fs/project-icon.test.js +114 -0
  143. package/server/lib/fs/routes.js +35 -0
  144. package/server/lib/fs/routes.test.js +74 -0
  145. package/server/lib/git/DOCUMENTATION.md +2 -1
  146. package/server/lib/git/routes.js +11 -3
  147. package/server/lib/git/routes.test.js +80 -0
  148. package/server/lib/git/service.js +38 -3
  149. package/server/lib/git/service.test.js +93 -0
  150. package/server/lib/open-url/DOCUMENTATION.md +35 -0
  151. package/server/lib/open-url/browser-env.js +199 -0
  152. package/server/lib/open-url/browser-env.test.js +147 -0
  153. package/server/lib/open-url/browser-handler.mjs +154 -0
  154. package/server/lib/open-url/browser-handler.test.js +69 -0
  155. package/server/lib/open-url/intake.js +187 -0
  156. package/server/lib/open-url/intake.test.js +75 -0
  157. package/server/lib/pi/extension-protocol.js +149 -0
  158. package/server/lib/pi/extension-protocol.test.js +20 -1
  159. package/server/lib/pi/routes.js +195 -1
  160. package/server/lib/pi/routes.test.js +129 -0
  161. package/server/lib/pi/session-daemon/DOCUMENTATION.md +38 -10
  162. package/server/lib/pi/session-daemon/builtin-extensions.js +14 -4
  163. package/server/lib/pi/session-daemon/daemon-process.js +13 -0
  164. package/server/lib/pi/session-daemon/extension-bridge-draft.test.js +6 -1
  165. package/server/lib/pi/session-daemon/extension-bridge.js +40 -6
  166. package/server/lib/pi/session-daemon/extension-custom-host.js +1259 -0
  167. package/server/lib/pi/session-daemon/extension-custom-host.test.js +759 -0
  168. package/server/lib/pi/session-daemon/extension-keybindings.js +21 -0
  169. package/server/lib/pi/session-daemon/extension-keybindings.test.js +37 -0
  170. package/server/lib/pi/session-daemon/extension-message-render.js +7 -4
  171. package/server/lib/pi/session-daemon/extension-message-render.test.js +14 -2
  172. package/server/lib/pi/session-daemon/extension-tool-render.js +7 -0
  173. package/server/lib/pi/session-daemon/extension-tool-render.test.js +26 -0
  174. package/server/lib/pi/session-daemon/open-request.js +60 -0
  175. package/server/lib/pi/session-daemon/open-request.test.js +54 -0
  176. package/server/lib/pi/session-daemon/prompt-preflight.test.js +134 -0
  177. package/server/lib/pi/session-daemon/sdk-upgrade.test.js +21 -4
  178. package/server/lib/pi/session-daemon/session-daemon-bash.e2e.test.js +225 -0
  179. package/server/lib/pi/session-daemon/session-daemon-directory-catalog.e2e.test.js +156 -0
  180. package/server/lib/pi/session-daemon/session-daemon-directory-catalog.test.js +381 -0
  181. package/server/lib/pi/session-daemon/session-daemon-engines.test.js +11 -2
  182. package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +30 -4
  183. package/server/lib/pi/session-daemon/session-daemon-list-live.test.js +20 -0
  184. package/server/lib/pi/session-daemon/session-daemon-mcp.e2e.test.js +16 -4
  185. package/server/lib/pi/session-daemon/session-daemon-turn.e2e.test.js +7 -2
  186. package/server/lib/pi/session-daemon/session-daemon.js +448 -49
  187. package/server/lib/pi/session-daemon/session-daemon.test.js +91 -4
  188. package/server/lib/pi/session-daemon/session-engine-router.js +9 -3
  189. package/server/lib/pi/session-daemon/session-engine-router.test.js +12 -2
  190. package/server/lib/pi/session-daemon/session-engines.js +7 -2
  191. package/server/lib/pi/session-daemon/session-jsonl.js +170 -75
  192. package/server/lib/pi/session-daemon/session-jsonl.test.js +106 -2
  193. package/server/lib/pi/session-daemon/supervisor.js +4 -0
  194. package/server/lib/pi/session-daemon/user-bash.js +326 -0
  195. package/server/lib/pi/session-daemon/user-bash.test.js +371 -0
  196. package/server/lib/preview/proxy-runtime.js +140 -45
  197. package/server/lib/preview/proxy-runtime.test.js +174 -3
  198. package/server/lib/preview/proxy-runtime.websocket.test.js +89 -0
  199. package/server/lib/relay/tunnel-host.js +1 -0
  200. package/server/lib/security/request-security.js +37 -0
  201. package/server/lib/security/request-security.test.js +54 -0
  202. package/server/lib/security/server-network-host.js +107 -0
  203. package/server/lib/security/server-network-host.test.js +70 -0
  204. package/server/lib/server-browser/DOCUMENTATION.md +243 -0
  205. package/server/lib/server-browser/browser-tab.js +524 -0
  206. package/server/lib/server-browser/chrome-executable.js +138 -0
  207. package/server/lib/server-browser/chrome-launch.js +138 -0
  208. package/server/lib/server-browser/dev-servers.js +288 -0
  209. package/server/lib/server-browser/dev-servers.test.js +152 -0
  210. package/server/lib/server-browser/downloads.js +75 -0
  211. package/server/lib/server-browser/frame-policy.js +183 -0
  212. package/server/lib/server-browser/frame-policy.test.js +98 -0
  213. package/server/lib/server-browser/network-guard.js +235 -0
  214. package/server/lib/server-browser/page-scripts.js +209 -0
  215. package/server/lib/server-browser/runtime.integration.test.js +474 -0
  216. package/server/lib/server-browser/runtime.js +300 -0
  217. package/server/lib/server-browser/runtime.test.js +50 -0
  218. package/server/lib/server-browser/server-browser.js +431 -0
  219. package/server/lib/server-browser/server-browser.test.js +975 -0
  220. package/server/lib/server-browser/tab-input.js +241 -0
  221. package/server/lib/server-browser/tab-prompts.js +125 -0
  222. package/server/lib/server-browser/tab-stream.js +252 -0
  223. package/server/lib/server-browser/uploads.js +98 -0
  224. package/server/lib/stt/runtime.js +4 -1
  225. package/server/lib/stt/runtime.test.js +43 -0
  226. package/server/lib/terminal/runtime.js +4 -1
  227. package/server/lib/terminal/runtime.test.js +41 -0
  228. package/server/lib/ui-auth/DOCUMENTATION.md +29 -1
  229. package/server/lib/ui-auth/ui-auth.js +1 -0
  230. package/server/lib/ui-auth/ui-auth.test.js +9 -1
  231. package/server/lib/workspace/host.js +20 -3
  232. package/dist/assets/DiffView-CSonR3pr.js +0 -18
  233. package/dist/assets/FileSaveConflictDialog-Cun0LIbj.js +0 -3
  234. package/dist/assets/PullRequestsSurface-CfaOpeZn.js +0 -2
  235. package/dist/assets/SessionSwitcherDropdown-BSutduo7.js +0 -2
  236. package/dist/assets/SessionUnreadDot-Dav_rix1.js +0 -1
  237. package/dist/assets/SettingsView-CQJkOPJh.js +0 -6
  238. package/dist/assets/abap-BdImnpbu.js +0 -1
  239. package/dist/assets/actionscript-3-CoDkCxhg.js +0 -1
  240. package/dist/assets/ada-bCR0ucgS.js +0 -1
  241. package/dist/assets/angular-html-CU67Zn6k.js +0 -1
  242. package/dist/assets/angular-ts-BwZT4LLn.js +0 -1
  243. package/dist/assets/apache-Pmp26Uib.js +0 -1
  244. package/dist/assets/apex-D8_7TLub.js +0 -1
  245. package/dist/assets/apl-dKokRX4l.js +0 -1
  246. package/dist/assets/applescript-Co6uUVPk.js +0 -1
  247. package/dist/assets/ara-BRHolxvo.js +0 -1
  248. package/dist/assets/asciidoc-Ve4PFQV2.js +0 -1
  249. package/dist/assets/asm-D_Q5rh1f.js +0 -1
  250. package/dist/assets/astro-CbQHKStN.js +0 -1
  251. package/dist/assets/awk-DMzUqQB5.js +0 -1
  252. package/dist/assets/ballerina-BFfxhgS-.js +0 -1
  253. package/dist/assets/bat-BkioyH1T.js +0 -1
  254. package/dist/assets/beancount-k_qm7-4y.js +0 -1
  255. package/dist/assets/berry-uYugtg8r.js +0 -1
  256. package/dist/assets/bibtex-CHM0blh-.js +0 -1
  257. package/dist/assets/bicep-Bmn6On1c.js +0 -1
  258. package/dist/assets/bird2-DPOp833l.js +0 -1
  259. package/dist/assets/blade-D4QpJJKB.js +0 -1
  260. package/dist/assets/bsl-BO_Y6i37.js +0 -1
  261. package/dist/assets/c-BIGW1oBm.js +0 -1
  262. package/dist/assets/c3-eo99z4R2.js +0 -1
  263. package/dist/assets/cadence-Bv_4Rxtq.js +0 -1
  264. package/dist/assets/cairo-KRGpt6FW.js +0 -1
  265. package/dist/assets/clarity-D53aC0YG.js +0 -1
  266. package/dist/assets/clojure-P80f7IUj.js +0 -1
  267. package/dist/assets/cmake-D1j8_8rp.js +0 -1
  268. package/dist/assets/cobol-nwyudZeR.js +0 -1
  269. package/dist/assets/codeowners-Bp6g37R7.js +0 -1
  270. package/dist/assets/codeql-DsOJ9woJ.js +0 -1
  271. package/dist/assets/coffee-Ch7k5sss.js +0 -1
  272. package/dist/assets/common-lisp-Cg-RD9OK.js +0 -1
  273. package/dist/assets/coq-DkFqJrB1.js +0 -1
  274. package/dist/assets/cpp-CofmeUqb.js +0 -1
  275. package/dist/assets/crystal-tKQVLTB8.js +0 -1
  276. package/dist/assets/csharp-COcwbKMJ.js +0 -1
  277. package/dist/assets/css-DPfMkruS.js +0 -1
  278. package/dist/assets/csv-fuZLfV_i.js +0 -1
  279. package/dist/assets/cue-D82EKSYY.js +0 -1
  280. package/dist/assets/cypher-COkxafJQ.js +0 -1
  281. package/dist/assets/d-85-TOEBH.js +0 -1
  282. package/dist/assets/dart-CF10PKvl.js +0 -1
  283. package/dist/assets/dax-CEL-wOlO.js +0 -1
  284. package/dist/assets/desktop-BmXAJ9_W.js +0 -1
  285. package/dist/assets/diff-D97Zzqfu.js +0 -1
  286. package/dist/assets/docker-BcOcwvcX.js +0 -1
  287. package/dist/assets/dotenv-Da5cRb03.js +0 -1
  288. package/dist/assets/dream-maker-BtqSS_iP.js +0 -1
  289. package/dist/assets/edge-BkV0erSs.js +0 -1
  290. package/dist/assets/elixir-CDX3lj18.js +0 -1
  291. package/dist/assets/elm-DbKCFpqz.js +0 -1
  292. package/dist/assets/emacs-lisp-C9XAeP06.js +0 -1
  293. package/dist/assets/erb-B12qg9BL.js +0 -1
  294. package/dist/assets/erlang-DsQrWhSR.js +0 -1
  295. package/dist/assets/fennel-BYunw83y.js +0 -1
  296. package/dist/assets/fish-BvzEVeQv.js +0 -1
  297. package/dist/assets/fluent-C4IJs8-o.js +0 -1
  298. package/dist/assets/fortran-fixed-form-CkoXwp7k.js +0 -1
  299. package/dist/assets/fortran-free-form-BxgE0vQu.js +0 -1
  300. package/dist/assets/fsharp-CXgrBDvD.js +0 -1
  301. package/dist/assets/gdresource-BOOCDP_w.js +0 -1
  302. package/dist/assets/gdscript-C5YyOfLZ.js +0 -1
  303. package/dist/assets/gdshader-DkwncUOv.js +0 -1
  304. package/dist/assets/genie-D0YGMca9.js +0 -1
  305. package/dist/assets/gherkin-DyxjwDmM.js +0 -1
  306. package/dist/assets/git-commit-F4YmCXRG.js +0 -1
  307. package/dist/assets/git-rebase-r7XF79zn.js +0 -1
  308. package/dist/assets/gleam-BspZqrRM.js +0 -1
  309. package/dist/assets/glimmer-js-Rg0-pVw9.js +0 -1
  310. package/dist/assets/glimmer-ts-U6CK756n.js +0 -1
  311. package/dist/assets/glsl-DplSGwfg.js +0 -1
  312. package/dist/assets/gn-n2N0HUVH.js +0 -1
  313. package/dist/assets/gnuplot-DdkO51Og.js +0 -1
  314. package/dist/assets/go-CxLEBnE3.js +0 -1
  315. package/dist/assets/graphql-ChdNCCLP.js +0 -1
  316. package/dist/assets/groovy-gcz8RCvz.js +0 -1
  317. package/dist/assets/hack-CaT9iCJl.js +0 -1
  318. package/dist/assets/haml-B8DHNrY2.js +0 -1
  319. package/dist/assets/handlebars-BL8al0AC.js +0 -1
  320. package/dist/assets/haskell-Df6bDoY_.js +0 -1
  321. package/dist/assets/haxe-CzTSHFRz.js +0 -1
  322. package/dist/assets/hcl-BWvSN4gD.js +0 -1
  323. package/dist/assets/hjson-D5-asLiD.js +0 -1
  324. package/dist/assets/hlsl-D3lLCCz7.js +0 -1
  325. package/dist/assets/html-GMplVEZG.js +0 -1
  326. package/dist/assets/html-derivative-BFtXZ54Q.js +0 -1
  327. package/dist/assets/http-jrhK8wxY.js +0 -1
  328. package/dist/assets/hurl-irOxFIW8.js +0 -1
  329. package/dist/assets/hxml-Bvhsp5Yf.js +0 -1
  330. package/dist/assets/hy-DFXneXwc.js +0 -1
  331. package/dist/assets/imba-DGztddWO.js +0 -1
  332. package/dist/assets/index-B0h6_x5N.js +0 -1
  333. package/dist/assets/index-BwoW_-vk.css +0 -1
  334. package/dist/assets/ini-BEwlwnbL.js +0 -1
  335. package/dist/assets/java-CylS5w8V.js +0 -1
  336. package/dist/assets/javascript-wDzz0qaB.js +0 -1
  337. package/dist/assets/jinja-4LBKfQ-Z.js +0 -1
  338. package/dist/assets/jison-wvAkD_A8.js +0 -1
  339. package/dist/assets/json-Cp-IABpG.js +0 -1
  340. package/dist/assets/json5-C9tS-k6U.js +0 -1
  341. package/dist/assets/jsonc-Des-eS-w.js +0 -1
  342. package/dist/assets/jsonl-DcaNXYhu.js +0 -1
  343. package/dist/assets/jsonnet-DFQXde-d.js +0 -1
  344. package/dist/assets/jssm-C2t-YnRu.js +0 -1
  345. package/dist/assets/jsx-g9-lgVsj.js +0 -1
  346. package/dist/assets/julia-CxzCAyBv.js +0 -1
  347. package/dist/assets/just-Cw27pwNe.js +0 -1
  348. package/dist/assets/kdl-DV7GczEv.js +0 -1
  349. package/dist/assets/kotlin-BdnUsdx6.js +0 -1
  350. package/dist/assets/kusto-DZf3V79B.js +0 -1
  351. package/dist/assets/latex-CWtU0Tv5.js +0 -1
  352. package/dist/assets/lean-BZvkOJ9d.js +0 -1
  353. package/dist/assets/less-B1dDrJ26.js +0 -1
  354. package/dist/assets/liquid-DYVedYrR.js +0 -1
  355. package/dist/assets/llvm-DjAJT7YJ.js +0 -1
  356. package/dist/assets/log-2UxHyX5q.js +0 -1
  357. package/dist/assets/logo-BtOb2qkB.js +0 -1
  358. package/dist/assets/lua-BaeVxFsk.js +0 -1
  359. package/dist/assets/luau-C-HG3fhB.js +0 -1
  360. package/dist/assets/main-C6i4ph9N.js +0 -2
  361. package/dist/assets/main-r5elIPBi.js +0 -136
  362. package/dist/assets/make-CHLpvVh8.js +0 -1
  363. package/dist/assets/markdown-Cvjx9yec.js +0 -1
  364. package/dist/assets/markdownCore-C2YQ3Z0q.js +0 -2
  365. package/dist/assets/marko-CnJfTvn9.js +0 -1
  366. package/dist/assets/matlab-D7o27uSR.js +0 -1
  367. package/dist/assets/mdc-BMNejdWA.js +0 -1
  368. package/dist/assets/mdx-Cmh6b_Ma.js +0 -1
  369. package/dist/assets/mermaid-mWjccvbQ.js +0 -1
  370. package/dist/assets/miniChat-d_GCHoIf.js +0 -2
  371. package/dist/assets/mipsasm-CKIfxQSi.js +0 -1
  372. package/dist/assets/mobile-BJ3tgyKd.js +0 -2
  373. package/dist/assets/mojo-rZm6bMo-.js +0 -1
  374. package/dist/assets/moonbit-_H4v1dQx.js +0 -1
  375. package/dist/assets/move-IF9eRakj.js +0 -1
  376. package/dist/assets/narrat-DRg8JJMk.js +0 -1
  377. package/dist/assets/nextflow-Zz6hmt5N.js +0 -1
  378. package/dist/assets/nextflow-groovy-BeH2EWoN.js +0 -1
  379. package/dist/assets/nginx-BpAMiNFr.js +0 -1
  380. package/dist/assets/nim-CVrawwO9.js +0 -1
  381. package/dist/assets/nix-CwoSXNpI.js +0 -1
  382. package/dist/assets/nsis-LdVXkNf5.js +0 -1
  383. package/dist/assets/nushell-Cz2AlsmD.js +0 -1
  384. package/dist/assets/objective-c-DXmwc3jG.js +0 -1
  385. package/dist/assets/objective-cpp-CLxacb5B.js +0 -1
  386. package/dist/assets/ocaml-C0hk2d4L.js +0 -1
  387. package/dist/assets/odin-BBf5iR-q.js +0 -1
  388. package/dist/assets/openscad-C4EeE6gA.js +0 -1
  389. package/dist/assets/pascal-D93ZcfNL.js +0 -1
  390. package/dist/assets/perl-C0TMdlhV.js +0 -1
  391. package/dist/assets/permissionStore-B9Hkrqny.js +0 -1
  392. package/dist/assets/php-Dhbhpdrm.js +0 -1
  393. package/dist/assets/pi-session-focus-preference-BFnGFuvP.js +0 -9
  394. package/dist/assets/pkl-u5AG7uiY.js +0 -1
  395. package/dist/assets/plsql-ChMvpjG-.js +0 -1
  396. package/dist/assets/po-BTJTHyun.js +0 -1
  397. package/dist/assets/polar-C0HS_06l.js +0 -1
  398. package/dist/assets/postcss-CXtECtnM.js +0 -1
  399. package/dist/assets/powerquery-CEu0bR-o.js +0 -1
  400. package/dist/assets/powershell-Dpen1YoG.js +0 -1
  401. package/dist/assets/prisma-Dd19v3D-.js +0 -1
  402. package/dist/assets/prolog-CbFg5uaA.js +0 -1
  403. package/dist/assets/proto-C7zT0LnQ.js +0 -1
  404. package/dist/assets/pug-CGlum2m_.js +0 -1
  405. package/dist/assets/puppet-BMWR74SV.js +0 -1
  406. package/dist/assets/purescript-CklMAg4u.js +0 -1
  407. package/dist/assets/python-B6aJPvgy.js +0 -1
  408. package/dist/assets/qml-3beO22l8.js +0 -1
  409. package/dist/assets/qmldir-C8lEn-DE.js +0 -1
  410. package/dist/assets/qss-IeuSbFQv.js +0 -1
  411. package/dist/assets/r-Dspwwk_N.js +0 -1
  412. package/dist/assets/racket-BqYA7rlc.js +0 -1
  413. package/dist/assets/raku-DXvB9xmW.js +0 -1
  414. package/dist/assets/razor-Uh8Bk_45.js +0 -1
  415. package/dist/assets/reg-C-SQnVFl.js +0 -1
  416. package/dist/assets/regexp-CDVJQ6XC.js +0 -1
  417. package/dist/assets/rel-C3B-1QV4.js +0 -1
  418. package/dist/assets/renderElectronMiniChatApp-Bap5OwgB.js +0 -2
  419. package/dist/assets/renderMobileApp-DJbslvby.js +0 -11
  420. package/dist/assets/riscv-BM1_JUlF.js +0 -1
  421. package/dist/assets/ron-D8l8udqQ.js +0 -1
  422. package/dist/assets/rosmsg-BJDFO7_C.js +0 -1
  423. package/dist/assets/rst-BrH8l1NY.js +0 -1
  424. package/dist/assets/ruby-B2Rjki9n.js +0 -1
  425. package/dist/assets/ruby-Dw2BHqvy.js +0 -1
  426. package/dist/assets/runtimeEndpointReset-D22U_Vjs.js +0 -62
  427. package/dist/assets/runtimeSurface-k1Eit61v.js +0 -1
  428. package/dist/assets/rust-B1yitclQ.js +0 -1
  429. package/dist/assets/sas-cz2c8ADy.js +0 -1
  430. package/dist/assets/sass-Cj5Yp3dK.js +0 -1
  431. package/dist/assets/scala-C151Ov-r.js +0 -1
  432. package/dist/assets/scheme-C98Dy4si.js +0 -1
  433. package/dist/assets/scss-OYdSNvt2.js +0 -1
  434. package/dist/assets/sdbl-DVxCFoDh.js +0 -1
  435. package/dist/assets/shaderlab-Dg9Lc6iA.js +0 -1
  436. package/dist/assets/shellscript-Yzrsuije.js +0 -1
  437. package/dist/assets/shellsession-BADoaaVG.js +0 -1
  438. package/dist/assets/smalltalk-BERRCDM3.js +0 -1
  439. package/dist/assets/solidity-rGO070M0.js +0 -1
  440. package/dist/assets/soy-Brmx7dQM.js +0 -1
  441. package/dist/assets/sparql-rVzFXLq3.js +0 -1
  442. package/dist/assets/splunk-BtCnVYZw.js +0 -1
  443. package/dist/assets/sql-BLtJtn59.js +0 -1
  444. package/dist/assets/ssh-config-_ykCGR6B.js +0 -1
  445. package/dist/assets/stata-BH5u7GGu.js +0 -1
  446. package/dist/assets/stylus-BEDo0Tqx.js +0 -1
  447. package/dist/assets/surrealql-Bq5Q-fJD.js +0 -1
  448. package/dist/assets/svelte-C_ipcX3V.js +0 -1
  449. package/dist/assets/swift-D82vCrfD.js +0 -1
  450. package/dist/assets/system-verilog-CnnmHF94.js +0 -1
  451. package/dist/assets/systemd-4A_iFExJ.js +0 -1
  452. package/dist/assets/talonscript-CkByrt1z.js +0 -1
  453. package/dist/assets/tasl-QIJgUcNo.js +0 -1
  454. package/dist/assets/tcl-dwOrl1Do.js +0 -1
  455. package/dist/assets/templ-P3uqSqPl.js +0 -1
  456. package/dist/assets/terraform-BETggiCN.js +0 -1
  457. package/dist/assets/tex-idrVyKtj.js +0 -1
  458. package/dist/assets/themeResolver-yJ9XpNMI.js +0 -1
  459. package/dist/assets/toml-vGWfd6FD.js +0 -1
  460. package/dist/assets/ts-tags-zn1MmPIZ.js +0 -1
  461. package/dist/assets/tsv-B_m7g4N7.js +0 -1
  462. package/dist/assets/tsx-COt5Ahok.js +0 -1
  463. package/dist/assets/turtle-BsS91CYL.js +0 -1
  464. package/dist/assets/twig-DNn4PbVi.js +0 -1
  465. package/dist/assets/typescript-BPQ3VLAy.js +0 -1
  466. package/dist/assets/typespec-BGHnOYBU.js +0 -1
  467. package/dist/assets/typst-DHCkPAjA.js +0 -1
  468. package/dist/assets/useAppFontEffects-CqHhRKmN.js +0 -212
  469. package/dist/assets/useFilesViewSearch-CqoYEK0U.js +0 -7
  470. package/dist/assets/v-BcVCzyr7.js +0 -1
  471. package/dist/assets/vala-CsfeWuGM.js +0 -1
  472. package/dist/assets/vb-D17OF-Vu.js +0 -1
  473. package/dist/assets/vendor-aparajita-capacitor-secure-storage-BDrMx_CE.js +0 -1
  474. package/dist/assets/vendor-base-ui-CKRUCG-f.js +0 -1
  475. package/dist/assets/vendor-boot-EC6IyLt1.js +0 -69
  476. package/dist/assets/vendor-codemirror-autocomplete-CGpAsPWp.js +0 -1
  477. package/dist/assets/vendor-codemirror-lang-angular-CDJoHJSY.js +0 -1
  478. package/dist/assets/vendor-codemirror-lang-cpp-BmHofQls.js +0 -1
  479. package/dist/assets/vendor-codemirror-lang-css-RM2HqXZ0.js +0 -1
  480. package/dist/assets/vendor-codemirror-lang-html-CHSHUpwq.js +0 -1
  481. package/dist/assets/vendor-codemirror-lang-java-lhQXgWu0.js +0 -1
  482. package/dist/assets/vendor-codemirror-lang-javascript-Dw4kFO4e.js +0 -13
  483. package/dist/assets/vendor-codemirror-lang-jinja-_pAC3UTN.js +0 -1
  484. package/dist/assets/vendor-codemirror-lang-json-B-b1vAv-.js +0 -1
  485. package/dist/assets/vendor-codemirror-lang-less-xIgOi1ze.js +0 -1
  486. package/dist/assets/vendor-codemirror-lang-liquid-CP49m5dB.js +0 -1
  487. package/dist/assets/vendor-codemirror-lang-markdown-BTht2ATe.js +0 -1
  488. package/dist/assets/vendor-codemirror-lang-php-BguZDhaO.js +0 -1
  489. package/dist/assets/vendor-codemirror-lang-python-CH6_em9L.js +0 -3
  490. package/dist/assets/vendor-codemirror-lang-rust-EG_DtGyi.js +0 -1
  491. package/dist/assets/vendor-codemirror-lang-sass-BknY5Qpo.js +0 -1
  492. package/dist/assets/vendor-codemirror-lang-vue-CyGn9snv.js +0 -1
  493. package/dist/assets/vendor-codemirror-lang-wast-CsFfSyyB.js +0 -1
  494. package/dist/assets/vendor-codemirror-lang-xml-Cdan_Jp1.js +0 -1
  495. package/dist/assets/vendor-codemirror-lang-yaml-COI5hck8.js +0 -1
  496. package/dist/assets/vendor-codemirror-search-DUfSCF9S.js +0 -2
  497. package/dist/assets/vendor-dompurify-r8glNMJW.js +0 -2
  498. package/dist/assets/vendor-elkjs-D27273Ms.js +0 -24
  499. package/dist/assets/vendor-fuse.js-Dw8P0qyA.js +0 -1
  500. package/dist/assets/vendor-lezer-cpp-DMZOJzBa.js +0 -1
  501. package/dist/assets/vendor-lezer-css-DUkkbMp7.js +0 -1
  502. package/dist/assets/vendor-lezer-java-tMazV_6X.js +0 -1
  503. package/dist/assets/vendor-lezer-javascript-ctwLWf4v.js +0 -1
  504. package/dist/assets/vendor-lezer-lr-B8TQctNw.js +0 -1
  505. package/dist/assets/vendor-lezer-markdown-aGLZf_3h.js +0 -6
  506. package/dist/assets/vendor-lezer-php-D5zCNzlt.js +0 -1
  507. package/dist/assets/vendor-lezer-rust-DO5c7OtA.js +0 -1
  508. package/dist/assets/vendor-marked-CX41MkDF.js +0 -59
  509. package/dist/assets/vendor-oniguruma-to-es-DLBnFDCE.js +0 -94
  510. package/dist/assets/vendor-property-information-rJCbAzvX.js +0 -1
  511. package/dist/assets/vendor-react-DASdDPIk.js +0 -1
  512. package/dist/assets/vendor-remend-BWYYytN3.js +0 -22
  513. package/dist/assets/vendor-replit-codemirror-vim-AnOuN8yJ.js +0 -39
  514. package/dist/assets/vendor-shiki-Bbf2GEcE.js +0 -2
  515. package/dist/assets/vendor-shikijs-vscode-textmate-BgLrS_2D.js +0 -3
  516. package/dist/assets/vendor-tailwind-merge-CPcsbTWB.js +0 -1
  517. package/dist/assets/vendor-workbox-window-BIl4cyR9.js +0 -2
  518. package/dist/assets/vendor-zumer-snapdom-Btyu_Xi2.js +0 -8
  519. package/dist/assets/vendor-zustand-CUi8eEds.js +0 -6
  520. package/dist/assets/verilog-BQ8w6xss.js +0 -1
  521. package/dist/assets/vhdl-CeAyd5Ju.js +0 -1
  522. package/dist/assets/viml-CJc9bBzg.js +0 -1
  523. package/dist/assets/vue-DN_0RTcg.js +0 -1
  524. package/dist/assets/vue-html-AaS7Mt5G.js +0 -1
  525. package/dist/assets/vue-vine-CQOfvN7w.js +0 -1
  526. package/dist/assets/vyper-CDx5xZoG.js +0 -1
  527. package/dist/assets/wasm-MzD3tlZU.js +0 -1
  528. package/dist/assets/wenyan-BV7otONQ.js +0 -1
  529. package/dist/assets/wgsl-Dx-B1_4e.js +0 -1
  530. package/dist/assets/wikitext-BhOHFoWU.js +0 -1
  531. package/dist/assets/wit-5i3qLPDT.js +0 -1
  532. package/dist/assets/wolfram-lXgVvXCa.js +0 -1
  533. package/dist/assets/worker-BBk7yuNN.js +0 -153
  534. package/dist/assets/workerFactory-tw7cIdmV.js +0 -1
  535. package/dist/assets/xml-sdJ4AIDG.js +0 -1
  536. package/dist/assets/xsl-CtQFsRM5.js +0 -1
  537. package/dist/assets/yaml-Buea-lGh.js +0 -1
  538. package/dist/assets/zenscript-DVFEvuxE.js +0 -1
  539. package/dist/assets/zig-VOosw3JB.js +0 -1
@@ -1 +1 @@
1
- import{k as c}from"./vendor-boot-EC6IyLt1.js";import{R as t}from"./vendor-react-DASdDPIk.js";import{z as $,t as d,I as B}from"./useAppFontEffects-CqHhRKmN.js";import{f as W,a as A,m as ee,bW as T}from"./index-D4n3TVp2.js";import{b as te,D as re,F as ne}from"./FileSaveConflictDialog-Cun0LIbj.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CUi8eEds.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-k1Eit61v.js";import"./nativeFileSave-BJsGPh58.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-react-drawio-Duu5LgQA.js";const se=l=>l.split("/").pop()||l;function xe(){const{files:l}=$(),[x,k]=t.useState(null),[L,R]=t.useState(""),[M,E]=t.useState(!0),[b,h]=t.useState(null),[m,F]=t.useState(!1),[U,p]=t.useState(!1),[j,P]=t.useState(!1),[q,H]=t.useState(0),g=t.useRef(void 0),C=t.useRef(""),v=t.useRef(0),S=t.useRef(0),y=t.useRef(0),D=t.useRef(null),I=t.useRef(!0),w=t.useRef(null),G=W(e=>e.pendingDiagramFile);t.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]);const i=t.useCallback((e,n,s)=>I.current&&v.current===e&&A()===n&&w.current===s,[]),z=t.useCallback(async e=>{const n=v.current+1;v.current=n;const s=A(),u=l?.readFile;S.current+=1,y.current+=1,E(!0),k(e),w.current=e,h(null),p(!1),P(!1),F(!1);try{const r=await u?.(e);if(!i(n,s,e))return;if(!r){d.error("Failed to read file"),k(null),w.current=null,C.current="",R(""),g.current=void 0,E(!1);return}C.current=r.content,R(r.content),g.current=r.revision}catch(r){if(!i(n,s,e))return;d.error(r instanceof Error?r.message:"Failed to read file"),k(null),w.current=null,C.current="",R(""),g.current=void 0,E(!1);return}finally{i(n,s,e)&&E(!1)}},[l,i]);t.useEffect(()=>ee(()=>{if(v.current+=1,g.current=void 0,S.current+=1,y.current+=1,!I.current)return;h(null),p(!1),P(!1),F(!1);const e=w.current;e&&z(e)}),[z]),t.useEffect(()=>{if(!G)return;const e=W.getState().consumePendingDiagramFile();e&&z(e)},[z,G]);const K=t.useCallback(async(e,n,s,u,r,o)=>{let a=null,f=s,V=u;try{if(V){const N=await l?.readFile?.(e);if(!i(r,o,e))return;N&&(a=N.content??null,typeof N.revision=="string"&&(f=N.revision),V=N.exists!==!1)}}catch{if(!i(r,o,e))return}i(r,o,e)&&(h({path:e,displayPath:se(e),exists:V,currentRevision:f,currentContent:a,dirtyContent:n,runtimeKey:o}),p(!1))},[l,i]),X=t.useCallback(async(e,n,s,u,r)=>{const o=await l?.writeFile?.(e,n,te(g.current,s?!0:void 0));return i(u,r,e)?{stale:!1,success:!!o?.success,revision:o?.revision}:{stale:!0}},[l,i]),O=t.useCallback((e,n)=>{C.current=e,typeof n<"u"&&(g.current=n),D.current?.getXml()===e&&R(e)},[]),J=t.useCallback(async()=>{const e=D.current?.getXml();if(!x||!l?.writeFile||!e||e===C.current||j||m)return;const n=v.current,s=A(),u=x,r=e,o=S.current+1;S.current=o,P(!0);try{const a=await X(u,r,!1,n,s);if(a.stale)return;if(!a.success){d.error("Failed to write file");return}O(r,a.revision)}catch(a){if(!i(n,s,u))return;if(T(a)){await K(u,r,a.currentRevision??null,a.exists,n,s);return}d.error(a instanceof Error?a.message:"Save failed")}finally{S.current===o&&P(!1)}},[O,x,l,i,m,j,K,X]),Q=t.useCallback(async()=>{const e=b;if(!e||m||!i(v.current,e.runtimeKey,e.path))return;const n=v.current,s=e.runtimeKey;if(!e.exists){k(null),w.current=null,C.current="",R(""),g.current=void 0,h(null),p(!1);return}const u=y.current+1;y.current=u,F(!0);try{const r=await l?.readFile?.(e.path);if(!i(n,s,e.path))return;if(!r){d.error("Failed to read file");return}C.current=r.content??"",R(r.content??""),g.current=r.revision,H(o=>o+1),h(null),p(!1)}catch(r){if(!i(n,s,e.path))return;d.error(r instanceof Error?r.message:"Failed to read file")}finally{y.current===u&&F(!1)}},[l,i,m,b]),Y=t.useCallback(async()=>{const e=b;if(!e||m||!i(v.current,e.runtimeKey,e.path))return;const n=v.current,s=e.runtimeKey;if(!l?.writeFile){d.error("Saving not supported");return}const o=D.current?.getXml()??e.dirtyContent;if(!o){d.error("Failed to write file");return}const a=y.current+1;y.current=a,F(!0);try{const f=await X(e.path,o,!0,n,s);if(f.stale)return;if(!f.success){d.error("Failed to write file");return}O(o,f.revision),h(null),p(!1)}catch(f){if(!i(n,s,e.path))return;if(T(f)){await K(e.path,o,f.currentRevision??e.currentRevision,f.exists,n,s);return}d.error(f instanceof Error?f.message:"Save failed")}finally{y.current===a&&F(!1)}},[O,l,i,m,K,X,b]),Z=t.useCallback(()=>{m||j||(h(null),p(!1))},[m,j]),_=x?x.split("/").pop()||x:"";return x?M?c.jsx("div",{className:"flex h-full items-center justify-center p-3",children:c.jsx(B,{name:"loader-4",className:"size-4 animate-spin"})}):c.jsxs("div",{className:"flex h-full flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 px-3 py-1.5",children:[c.jsx(B,{name:"file",className:"size-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"typography-ui text-muted-foreground truncate flex-1",children:_}),c.jsx("button",{type:"button",onClick:()=>{J()},className:"size-6 flex items-center justify-center rounded-md text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",title:"Save diagram",children:c.jsx(B,{name:"save-3",className:"size-4"})}),c.jsx("button",{type:"button",onClick:()=>W.getState().setActiveMainTab("chat"),className:"size-6 flex items-center justify-center rounded-md text-muted-foreground hover:bg-interactive-hover/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",title:"Close diagram view",children:c.jsx(B,{name:"close",className:"size-4"})})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(re,{ref:D,xml:L,className:"h-full"},q)}),c.jsx(ne,{open:!!b,conflict:b,isResolving:m||j,showCompare:U,onToggleCompare:()=>p(e=>!e),onReload:()=>{Q()},onOverwrite:()=>{Y()},onClose:Z})]}):c.jsx("div",{className:"flex h-full items-center justify-center p-3",children:c.jsx("div",{className:"typography-ui text-muted-foreground",children:"Pick a file from the tree."})})}export{xe as DiagramView};
1
+ import{j as c}from"./vendor-boot-CoTxysn6.js";import{R as t}from"./vendor-react-Bz1tRBxM.js";import{z as $,t as d,I as B}from"./useAppFontEffects-D_gtiA95.js";import{h as A,b as G,o as ee,cF as W}from"./index-C2ISrmRR.js";import{b as te,D as re,F as ne}from"./FileSaveConflictDialog-DpyPjMH1.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./vendor-react-drawio-IYnLUY5N.js";const se=l=>l.split("/").pop()||l;function xe(){const{files:l}=$(),[x,k]=t.useState(null),[L,R]=t.useState(""),[M,E]=t.useState(!0),[b,h]=t.useState(null),[m,F]=t.useState(!1),[U,p]=t.useState(!1),[j,P]=t.useState(!1),[q,H]=t.useState(0),g=t.useRef(void 0),C=t.useRef(""),v=t.useRef(0),S=t.useRef(0),y=t.useRef(0),D=t.useRef(null),I=t.useRef(!0),w=t.useRef(null),T=A(e=>e.pendingDiagramFile);t.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]);const i=t.useCallback((e,n,s)=>I.current&&v.current===e&&G()===n&&w.current===s,[]),z=t.useCallback(async e=>{const n=v.current+1;v.current=n;const s=G(),u=l?.readFile;S.current+=1,y.current+=1,E(!0),k(e),w.current=e,h(null),p(!1),P(!1),F(!1);try{const r=await u?.(e);if(!i(n,s,e))return;if(!r){d.error("Failed to read file"),k(null),w.current=null,C.current="",R(""),g.current=void 0,E(!1);return}C.current=r.content,R(r.content),g.current=r.revision}catch(r){if(!i(n,s,e))return;d.error(r instanceof Error?r.message:"Failed to read file"),k(null),w.current=null,C.current="",R(""),g.current=void 0,E(!1);return}finally{i(n,s,e)&&E(!1)}},[l,i]);t.useEffect(()=>ee(()=>{if(v.current+=1,g.current=void 0,S.current+=1,y.current+=1,!I.current)return;h(null),p(!1),P(!1),F(!1);const e=w.current;e&&z(e)}),[z]),t.useEffect(()=>{if(!T)return;const e=A.getState().consumePendingDiagramFile();e&&z(e)},[z,T]);const K=t.useCallback(async(e,n,s,u,r,o)=>{let a=null,f=s,V=u;try{if(V){const N=await l?.readFile?.(e);if(!i(r,o,e))return;N&&(a=N.content??null,typeof N.revision=="string"&&(f=N.revision),V=N.exists!==!1)}}catch{if(!i(r,o,e))return}i(r,o,e)&&(h({path:e,displayPath:se(e),exists:V,currentRevision:f,currentContent:a,dirtyContent:n,runtimeKey:o}),p(!1))},[l,i]),X=t.useCallback(async(e,n,s,u,r)=>{const o=await l?.writeFile?.(e,n,te(g.current,s?!0:void 0));return i(u,r,e)?{stale:!1,success:!!o?.success,revision:o?.revision}:{stale:!0}},[l,i]),O=t.useCallback((e,n)=>{C.current=e,typeof n<"u"&&(g.current=n),D.current?.getXml()===e&&R(e)},[]),J=t.useCallback(async()=>{const e=D.current?.getXml();if(!x||!l?.writeFile||!e||e===C.current||j||m)return;const n=v.current,s=G(),u=x,r=e,o=S.current+1;S.current=o,P(!0);try{const a=await X(u,r,!1,n,s);if(a.stale)return;if(!a.success){d.error("Failed to write file");return}O(r,a.revision)}catch(a){if(!i(n,s,u))return;if(W(a)){await K(u,r,a.currentRevision??null,a.exists,n,s);return}d.error(a instanceof Error?a.message:"Save failed")}finally{S.current===o&&P(!1)}},[O,x,l,i,m,j,K,X]),Q=t.useCallback(async()=>{const e=b;if(!e||m||!i(v.current,e.runtimeKey,e.path))return;const n=v.current,s=e.runtimeKey;if(!e.exists){k(null),w.current=null,C.current="",R(""),g.current=void 0,h(null),p(!1);return}const u=y.current+1;y.current=u,F(!0);try{const r=await l?.readFile?.(e.path);if(!i(n,s,e.path))return;if(!r){d.error("Failed to read file");return}C.current=r.content??"",R(r.content??""),g.current=r.revision,H(o=>o+1),h(null),p(!1)}catch(r){if(!i(n,s,e.path))return;d.error(r instanceof Error?r.message:"Failed to read file")}finally{y.current===u&&F(!1)}},[l,i,m,b]),Y=t.useCallback(async()=>{const e=b;if(!e||m||!i(v.current,e.runtimeKey,e.path))return;const n=v.current,s=e.runtimeKey;if(!l?.writeFile){d.error("Saving not supported");return}const o=D.current?.getXml()??e.dirtyContent;if(!o){d.error("Failed to write file");return}const a=y.current+1;y.current=a,F(!0);try{const f=await X(e.path,o,!0,n,s);if(f.stale)return;if(!f.success){d.error("Failed to write file");return}O(o,f.revision),h(null),p(!1)}catch(f){if(!i(n,s,e.path))return;if(W(f)){await K(e.path,o,f.currentRevision??e.currentRevision,f.exists,n,s);return}d.error(f instanceof Error?f.message:"Save failed")}finally{y.current===a&&F(!1)}},[O,l,i,m,K,X,b]),Z=t.useCallback(()=>{m||j||(h(null),p(!1))},[m,j]),_=x?x.split("/").pop()||x:"";return x?M?c.jsx("div",{className:"flex h-full items-center justify-center p-3",children:c.jsx(B,{name:"loader-4",className:"size-4 animate-spin"})}):c.jsxs("div",{className:"flex h-full flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 px-3 py-1.5",children:[c.jsx(B,{name:"file",className:"size-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"typography-ui text-muted-foreground truncate flex-1",children:_}),c.jsx("button",{type:"button",onClick:()=>{J()},className:"size-6 flex items-center justify-center rounded-md text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",title:"Save diagram",children:c.jsx(B,{name:"save-3",className:"size-4"})}),c.jsx("button",{type:"button",onClick:()=>A.getState().setActiveMainTab("chat"),className:"size-6 flex items-center justify-center rounded-md text-muted-foreground hover:bg-interactive-hover/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",title:"Close diagram view",children:c.jsx(B,{name:"close",className:"size-4"})})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(re,{ref:D,xml:L,className:"h-full"},q)}),c.jsx(ne,{open:!!b,conflict:b,isResolving:m||j,showCompare:U,onToggleCompare:()=>p(e=>!e),onReload:()=>{Q()},onOverwrite:()=>{Y()},onClose:Z})]}):c.jsx("div",{className:"flex h-full items-center justify-center p-3",children:c.jsx("div",{className:"typography-ui text-muted-foreground",children:"Pick a file from the tree."})})}export{xe as DiagramView};
@@ -0,0 +1,18 @@
1
+ import{j as t,aP as Nt}from"./vendor-boot-CoTxysn6.js";import{R as r}from"./vendor-react-Bz1tRBxM.js";import{f as ne,h as Y,b as et,q as ze}from"./index-C2ISrmRR.js";import{eh as Ct,dW as St,ef as Lt,aO as tt,cG as nt,dv as Dt,d0 as De,B as je,I as W,z as st,bh as ce,t as it,e7 as rt,a$ as kt,b0 as Rt,b1 as Et,bu as Ge,dl as At,ei as Tt,ej as Mt,y as It,as as Pt,bw as $t,cH as Wt,dT as _t,h as Bt,b9 as Ot,aB as zt,aQ as Gt,aR as Ht,aS as Ut}from"./useAppFontEffects-D_gtiA95.js";import{d as ot,b as Vt,i as He,a as Ue,c as Kt,C as qt}from"./gitStatusPredicates-3i8CcYWJ.js";import{p as Xt}from"./VirtualizedFileDiff-DvLCd7Qq.js";import{P as Qt}from"./PierreDiffViewer-o_Edh6ny.js";import{v as Yt,g as Jt}from"./contextFileOpenGuard-CZKJuHxf.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./web-components-6ORYp3Iv.js";import"./computeVirtualFileMetrics-aX6tjjqv.js";import"./vendor-shiki-BEwTOAFg.js";import"./vendor-shikijs-core-Ck_OPM_T.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-DPFxvYtK.js";import"./vendor-hast-util-to-html-O3stl53j.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-C40bX6nM.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import"./themeResolver-DrfmQi8i.js";import"./vendor-pierre-theming-BO6EPniU.js";import"./vendor-shikijs-engine-javascript-DL394yyj.js";import"./vendor-oniguruma-to-es-DgwFOwdE.js";import"./vendor-oniguruma-parser-BrbMHgHx.js";import"./vendor-regex-BBWcyTkg.js";import"./vendor-regex-utilities-2BQyy0xI.js";import"./vendor-regex-recursion-JU4mF-dD.js";import"./vendor-shikijs-transformers-CZWsLLKm.js";import"./renderDiffWithHighlighter-xlvSvnTf.js";import"./vendor-diff-C3JhlQdm.js";import"./StickyHorizontalScrollbar-p7EbL2-E.js";import"./runtimeEndpointReset-fozcAShH.js";import"./SessionUnreadDot-CHlK2awX.js";/* empty css */import"./permissionStore-zIpxq9Pq.js";import"./appThemeRegistry-Ca8eGRB9.js";import"./registerCustomTheme-C-h6lsYW.js";function Zt(n,s=10){const e=[];let i;for(const l of n.split(`
2
+ `)){const f=l.match(Ct);if(f!=null){i!=null&&(i.hunkLines.length>0&&(Ee(i,s,"trailing"),Ie(i,e)),i=void 0);const d=parseInt(f[3]),y=parseInt(f[1]),m=parseInt(f[4]??"1"),c=parseInt(f[2]??"1");isNaN(d)||isNaN(y)||isNaN(m)||isNaN(c)?e.push(l):i={additionStart:d,deletionStart:y,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(i==null){e.push(l);continue}if(l.startsWith(" "))i.contextLines.push(l);else if(l!==""){if(i.hunkLines.length>0&&i.contextLines.length>s*2){const d=i.contextLines.length-s*2,y=i.contextLines.slice(-s);Ee(i,s,"trailing");const{additionCount:m,deletionCount:c}=i;Ie(i,e),i={additionStart:i.additionStart+m+d,deletionStart:i.deletionStart+c+d,deletionCount:0,additionCount:0,contextLines:y,hunkLines:[]}}Ee(i,s,i.hunkLines.length===0?"leading":"before-change"),i.hunkLines.push(l),l.startsWith("+")?i.additionCount+=1:l.startsWith("-")&&(i.deletionCount+=1)}}i!=null&&i.hunkLines.length>0&&(Ee(i,s,"trailing"),Ie(i,e));const a=e.join(`
3
+ `);return n.endsWith(`
4
+ `)?`${a}
5
+ `:a}function Ee(n,s,e){if(e==="leading"&&n.contextLines.length>s){const i=n.contextLines.length-s;n.contextLines.splice(0,i),n.additionStart+=i,n.deletionStart+=i}return e==="trailing"&&n.contextLines.length>s&&(n.contextLines.length=s),n.contextLines.length>0&&(n.hunkLines.push(...n.contextLines),n.additionCount+=n.contextLines.length,n.deletionCount+=n.contextLines.length,n.contextLines.length=0),n}function Ie(n,s){s.push(`@@ -${Ve(n.deletionStart,n.deletionCount)} +${Ve(n.additionStart,n.additionCount)} @@`),s.push(...n.hunkLines)}function Ve(n,s){return s===1?`${n}`:`${n},${s}`}const en=64,tn=3,pe=new Map,nn=(n,s,e=tn)=>{const i=`${n}\0${e}\0${s}`,a=pe.get(i);if(a)return pe.delete(i),pe.set(i,a),a;const l=rn(s),f=l?St(Zt(s,e),{oldFile:{name:n,contents:l.before},newFile:{name:n,contents:l.after}})??qe(n):Lt(sn(n,s))[0]?.files[0]??qe(n);for(pe.set(i,f);pe.size>en;){const d=pe.keys().next().value;if(!d)break;pe.delete(d)}return f},sn=(n,s)=>!s.trim()||s.startsWith("diff --git ")||/^--- [^\n]*\r?\n\+\+\+ /m.test(s)?s:`Index: ${n}
6
+ ===================================================================
7
+ --- ${n}
8
+ +++ ${n}
9
+ ${s}`,rn=n=>{if(!n.startsWith("diff --git ")&&!/^--- [^\n]*\t?\r?\n\+\+\+ [^\n]*\t?(?:\r?\n|$)/m.test(n))return;const s=[...n.matchAll(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@[^\n]*(?:\r?\n|$)/gm)];if(s.length!==1)return;const e=s[0],i=Number.parseInt(e[1]??"",10),a=Number.parseInt(e[2]??"",10);if(i>1||a>1||!Number.isFinite(i)||!Number.isFinite(a))return;const l=(e.index??0)+e[0].length,f=n.slice(l),d=[],y=[];let m;for(const c of f.split(/\r?\n/)){if(c.startsWith("diff --git ")||c.startsWith("@@ "))break;if(c.startsWith("\\")){if(m==="-"||m===" "){const p=d.at(-1);p&&(p.newline=!1)}if(m==="+"||m===" "){const p=y.at(-1);p&&(p.newline=!1)}continue}if(c.startsWith("-")){d.push({text:c.slice(1),newline:!0}),m="-";continue}if(c.startsWith("+")){y.push({text:c.slice(1),newline:!0}),m="+";continue}c.startsWith(" ")&&(d.push({text:c.slice(1),newline:!0}),y.push({text:c.slice(1),newline:!0}),m=" ")}return{before:Ke(d),after:Ke(y)}},Ke=n=>n.map(s=>s.text+(s.newline?`
10
+ `:"")).join(""),qe=n=>Xt({name:n,contents:""},{name:n,contents:""}),on=n=>/^Binary files .+ differ$/m.test(n)||/^GIT binary patch$/m.test(n),$e=(n,s,e)=>on(s)?{original:"",modified:"",isBinary:!0,patch:s,contextMode:e}:{original:"",modified:"",patch:s,fileDiff:nn(n,s),contextMode:e},at=(n,s,e)=>{const i=n??0,a=s??0;return!i&&!a?null:t.jsxs("span",{className:ne("typography-meta flex items-center gap-1 text-xs whitespace-nowrap","flex-shrink-0",e?.className),children:[i?t.jsxs("span",{style:{color:"var(--status-success)"},children:["+",i]}):null,a?t.jsxs("span",{style:{color:"var(--status-error)"},children:["-",a]}):null]})},an=r.memo(function({changedFiles:s,selectedFile:e,onSelectFile:i}){return s.length===0?null:t.jsx(tt,{outerClassName:"flex-1 min-h-0",className:"px-1 py-2",children:t.jsx("ul",{className:"flex flex-col gap-1",children:s.map(a=>{const l=ot(a),f=e===a.path;return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>i(a.path),className:ne("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors",f?"bg-interactive-selection text-interactive-selection-foreground":"text-muted-foreground hover:bg-interactive-hover hover:text-foreground"),children:[t.jsx(nt,{filePath:a.path,className:"h-3.5 w-3.5 flex-shrink-0"}),t.jsx("span",{className:"typography-micro font-semibold w-4 text-center uppercase",style:{color:l.color},title:l.description,"aria-label":l.description,children:l.code}),t.jsx("span",{className:"min-w-0 flex-1 truncate typography-meta",style:{direction:"rtl",textAlign:"left",unicodeBidi:"plaintext"},title:a.path,children:a.path}),at(a.insertions,a.deletions)]})},a.path)})})})});function ln(n,s,e){return n==="staged"?{source:"staged",staged:!0}:n==="working"?{source:"unstaged",staged:!1}:{source:"head",staged:e.staged&&s.path===e.path||Vt(s)}}const cn=r.memo(function(){return t.jsx("div",{className:"rounded-lg border border-border/60 bg-background px-3 py-2",children:t.jsx("div",{className:"typography-meta text-muted-foreground",children:"Content of this file cannot be viewed."})})}),un=r.memo(function({filePath:s,diff:e,renderSideBySide:i}){const a=e.original.length>0,l=e.modified.length>0,f=i?"flex flex-row gap-6 items-start justify-center":"flex flex-col gap-4 items-center",d=i?"flex flex-col items-center gap-2 flex-1 min-w-0":"flex flex-col items-center gap-2";return t.jsx("div",{className:"w-full overflow-auto p-4",style:{contain:"layout"},children:t.jsxs("div",{className:f,children:[a&&t.jsxs("div",{className:d,children:[t.jsx("span",{className:"typography-meta text-muted-foreground font-medium",children:"Original"}),t.jsx("img",{src:e.original,alt:`Original: ${s}`,className:i?"max-w-full max-h-[70vh] object-contain":"max-w-full object-contain",style:{imageRendering:"auto"}})]}),l&&t.jsxs("div",{className:d,children:[t.jsx("span",{className:"typography-meta text-muted-foreground font-medium",children:a?"Modified":"New"}),t.jsx("img",{src:e.modified,alt:`Modified: ${s}`,className:i?"max-w-full max-h-[70vh] object-contain":"max-w-full object-contain",style:{imageRendering:"auto"}})]})]})})}),dn=r.memo(function({filePath:s,diff:e,renderSideBySide:i,wrapLines:a}){const l=r.useMemo(()=>Dt(s)||"text",[s]);return e.isBinary?t.jsx(cn,{}):De(s)?t.jsx(un,{filePath:s,diff:e,renderSideBySide:i}):t.jsx("div",{className:"w-full",style:{contain:"layout"},children:t.jsx(Qt,{original:e.original,modified:e.modified,fileDiff:e.fileDiff,language:l,fileName:s,renderSideBySide:i,wrapLines:a,layout:"inline"})})}),Pe=({label:n,icon:s,loading:e,disabled:i,tone:a,onClick:l})=>t.jsx(je,{variant:"ghost",size:"sm",className:ne("h-6 w-6 rounded-none bg-transparent p-0 text-muted-foreground opacity-70 hover:bg-transparent hover:text-foreground hover:opacity-100",a==="failure"&&"text-[var(--status-error)] hover:text-[var(--status-error)]",a==="success"&&"text-[var(--status-success)] hover:text-[var(--status-success)]"),disabled:i,title:n,"aria-label":n,onClick:f=>{f.stopPropagation(),l()},children:e?t.jsx(W,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(W,{name:s,className:s==="add"?"size-4":"size-3.5"})}),fn=r.memo(function({filePath:s,staged:e,busyAction:i,disabled:a,onAction:l}){return t.jsx("div",{className:"flex items-center gap-0.5 rounded-full border border-[var(--interactive-border)]/45 bg-[var(--surface-background)]/95 px-1 py-0.5 shadow-sm backdrop-blur-md",children:e?t.jsx(Pe,{label:`Unstage ${s}`,icon:"arrow-go-back",loading:i==="unstage",disabled:a,onClick:()=>l("unstage")}):t.jsxs(t.Fragment,{children:[t.jsx(Pe,{label:`Revert changes in ${s}`,icon:"arrow-go-back",loading:i==="discard",disabled:a,tone:"failure",onClick:()=>l("discard")}),t.jsx(Pe,{label:`Stage ${s}`,icon:"add",loading:i==="stage",disabled:a,tone:"success",onClick:()=>l("stage")})]})})}),lt=3,pn=1e6,hn=15e3,Xe=500,mn=r.memo(function({directory:s,file:e,layout:i,wrapLines:a,isSelected:l,isExpanded:f,isMounted:d,onSelect:y,onExpandedChange:m,registerSectionRef:c,showOpenInEditorAction:p=!1,isOpeningInEditor:F=!1,onOpenInEditor:R,diffSource:x,staged:C=!1,showFileActions:g=!0,loadFullFiles:h=!1,initialDiffData:H=null}){const{git:M}=st(),E=ce(r.useCallback(u=>u.directories.get(s)?.diffCache.get(e.path)??null,[s,e.path])),S=ce(u=>u.setDiff),_=ce(u=>u.fetchStatus),j=Y(u=>u.setDiffFileLayout),w=Y(u=>u.setDiffWrapLines),[L,D]=r.useState(0),[A,k]=r.useState(null),[I,B]=r.useState(!1),[$,ee]=r.useState(null),[ue,Ne]=r.useState(!1),[b,se]=r.useState(null),U=r.useRef(null),ie=r.useRef(null),K=r.useMemo(()=>ot(e),[e]),J=i==="side-by-side",O=h?"full":"patch",re=`${e.index}:${e.working_dir}:${e.insertions}:${e.deletions}`,q=r.useMemo(()=>H||(b?.source===x?b.data:x!=="head"||!E?null:{original:E.original,modified:E.modified,isBinary:E.isBinary,contextMode:"full"}),[E,x,H,b]),he=q?.contextMode===O,de=r.useCallback(u=>{ie.current=u,c(e.path,u)},[e.path,c]),me=r.useCallback(u=>{m(e.path,u)},[e.path,m]),ge=r.useCallback(()=>{y(e.path)},[e.path,y]);r.useEffect(()=>{se(null),k(null),U.current=null},[x,re]),r.useEffect(()=>{if(!f||!d)return;if(!s||H||q&&he){U.current=null,B(!1);return}const u=`${s}::${e.path}::${x}::${re}::${O}::${L}`;if(U.current===u)return;U.current=u,k(null),B(!0);let P=!1;const te=et(),xe=h?pn:lt,be=De(e.path)?M.getGitFileDiff(s,{path:e.path,staged:x==="staged"}):M.getGitDiff(s,{path:e.path,source:x,contextLines:xe}),ae=hn,le=new Promise((V,X)=>{setTimeout(()=>X(new Error(`Timed out after ${ae}ms`)),ae)});return Promise.race([be,le]).then(V=>{if(!P){if("diff"in V){const X=$e(e.path,V.diff,O);se({source:x,data:X})}else{const X={original:V.original??"",modified:V.modified??"",isBinary:V.isBinary,contextMode:"full"};x==="head"?S(s,e.path,X,te):se({source:x,data:X})}B(!1)}}).catch(V=>{if(P)return;const X=V instanceof Error?V.message:String(V);k(X),B(!1)}),()=>{P=!0,U.current===u&&(U.current=null)}},[O,q,he,L,x,s,e.path,re,M,H,f,d,h,S]);const oe=r.useCallback(()=>{me(!f),ge()},[me,ge,f]),Ce=r.useCallback(async u=>{if(!(!s||$!==null)){ee(u);try{u==="stage"?await M.stageGitFile(s,e.path):u==="unstage"?await M.unstageGitFile(s,e.path):await M.revertGitFile(s,e.path,{scope:"working"}),D(P=>P+1),await _(s,M)}catch(P){const te=u==="unstage"?"Failed to unstage changes":u==="stage"?"Failed to stage changes":"Failed to revert changes";it.error(P instanceof Error?P.message:te)}finally{ee(P=>P===u?null:P)}}},[s,_,e.path,$,M]);return t.jsxs("div",{ref:de,className:ne("scroll-mt-9 border-b border-[var(--interactive-border)]/40 last:border-b-0"),children:[t.jsx("div",{className:ne("z-30 border-b border-[var(--interactive-border)]/35 bg-[var(--surface-elevated)]/90 backdrop-blur-md supports-[backdrop-filter]:bg-[var(--surface-elevated)]/80","sticky top-0"),children:t.jsxs("div",{role:"button",tabIndex:0,onClick:oe,onKeyDown:u=>{u.target===u.currentTarget&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),oe())},className:ne("cursor-pointer","group/header relative grid min-h-9 w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 overflow-hidden px-3 py-2","bg-transparent","text-muted-foreground hover:text-foreground",l?"bg-[var(--interactive-selection)]/35":null),children:[t.jsx("div",{className:"absolute inset-0 pointer-events-none group-hover/header:bg-[var(--interactive-hover)]/50"}),t.jsxs("div",{className:"relative flex min-w-0 flex-1 items-center gap-2",children:[t.jsx("span",{className:"flex size-5 items-center justify-center opacity-70 group-hover/header:opacity-100",children:f?t.jsx(W,{name:"arrow-down-s",className:"size-4"}):t.jsx(W,{name:"arrow-right-s",className:"size-4"})}),t.jsx("span",{className:"typography-micro font-semibold leading-none w-4 text-center uppercase",style:{color:K.color},title:K.description,"aria-label":K.description,children:K.code}),t.jsx("span",{className:"min-w-0 flex-1 overflow-hidden typography-ui-label",title:e.path,children:t.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(nt,{filePath:e.path,className:"h-3.5 w-3.5 flex-shrink-0 align-middle"}),(()=>{const u=e.path.lastIndexOf("/");if(u===-1)return t.jsx("span",{className:"block min-w-0 truncate typography-ui-label text-foreground",style:{direction:"rtl",textAlign:"left",unicodeBidi:"plaintext"},children:e.path});const P=e.path.slice(0,u),te=e.path.slice(u+1);return t.jsxs("span",{className:"flex min-w-0 items-baseline overflow-hidden",children:[t.jsx("span",{className:"min-w-0 truncate typography-ui-label text-muted-foreground",style:{direction:"rtl",textAlign:"left",unicodeBidi:"plaintext"},children:P}),t.jsxs("span",{className:"flex-shrink-0 typography-ui-label",children:[t.jsx("span",{className:"text-muted-foreground",children:"/"}),t.jsx("span",{className:"text-foreground",children:te})]})]})})()]})})]}),t.jsxs("div",{className:"relative flex shrink-0 items-center justify-self-end gap-2",children:[at(e.insertions,e.deletions),p&&R?t.jsx(je,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0 opacity-70 hover:opacity-100",title:"Open this file in editor at change",onClick:u=>{u.stopPropagation(),R(e.path,q)},disabled:F,children:F?t.jsx(W,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(W,{name:"edit",className:"size-3.5"})}):null,t.jsx(rt,{mode:J?"side-by-side":"unified",onModeChange:u=>{const P=u==="side-by-side"?"side-by-side":"inline";j(e.path,P)},className:"opacity-70"}),t.jsxs(kt,{children:[t.jsx(Rt,{asChild:!0,children:t.jsx(je,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0 opacity-70 hover:opacity-100",title:"File view options","aria-label":"File view options",onClick:u=>{u.stopPropagation()},onPointerDown:u=>{u.stopPropagation()},children:t.jsx(W,{name:"more-2-fill",className:"size-3.5"})})}),t.jsxs(Et,{align:"end",onClick:u=>{u.stopPropagation()},onPointerDown:u=>{u.stopPropagation()},children:[t.jsxs(Ge,{onSelect:()=>{w(!a)},children:[t.jsx(W,{name:"text-wrap",className:"size-4"}),t.jsx("span",{className:"flex-1",children:"Wrap lines"}),a?t.jsx(W,{name:"check",className:"size-4"}):null]}),t.jsxs(Ge,{onSelect:()=>{j(e.path,J?"inline":"side-by-side")},children:[t.jsx(W,{name:J?"align-justify":"layout-column",className:"size-4"}),J?"Switch to unified view":"Switch to side-by-side view"]})]})]})]})]})}),f&&t.jsxs("div",{className:"relative overflow-clip bg-background",children:[!d&&!A?t.jsx("div",{className:"h-40 border border-border/40 bg-background/40"}):null,A?t.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-sm text-muted-foreground",children:[t.jsx("div",{className:"typography-ui-label font-semibold text-foreground",children:"Failed to load diff"}),t.jsx("div",{className:"typography-meta text-muted-foreground max-w-[32rem] text-center",children:A}),t.jsx("button",{type:"button",className:"typography-ui-label text-primary hover:underline",onClick:()=>D(u=>u+1),children:"Retry"})]}):null,d&&I&&!q&&!A?t.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 py-8 text-sm text-muted-foreground",children:[t.jsx(W,{name:"loader-4",className:"size-4 animate-spin"}),"Loading diff..."]}):null,d&&q&&!ue&&e.insertions+e.deletions>Xe?t.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-sm text-muted-foreground",children:[t.jsx("div",{className:"typography-ui-label font-semibold text-foreground",children:`Large diff (${e.insertions+e.deletions} changed lines)`}),t.jsx("div",{className:"typography-meta text-muted-foreground",children:"Rendering may be slow. You can still view the diff by clicking below."}),t.jsx("button",{type:"button",className:"typography-ui-label text-primary hover:underline",onClick:()=>Ne(!0),children:"Render anyway"})]}):null,d&&q&&(ue||e.insertions+e.deletions<=Xe)?t.jsxs(t.Fragment,{children:[t.jsx(dn,{filePath:e.path,diff:q,renderSideBySide:J,wrapLines:a}),g?t.jsx("div",{className:"pointer-events-none absolute bottom-3 right-3 z-20",children:t.jsx("div",{className:"pointer-events-auto",children:t.jsx(fn,{filePath:e.path,staged:C,busyAction:$,disabled:$!==null,onAction:Ce})})}):null]}):null]})]})}),gn=1100,Qe=300,xn=n=>n<=6?n:n<=12?6:n<=25?4:2,bn=(n,s)=>At(n,s),Ye=(n,s)=>{const e=n.split(`
11
+ `),i=s.split(`
12
+ `),a=Math.min(e.length,i.length);for(let l=0;l<a;l+=1)if(e[l]!==i[l])return l+1;return i.length>e.length?e.length+1:e.length>i.length?Math.max(1,i.length):1},yn=n=>Array.isArray(n)?n.filter(s=>!s||typeof s!="object"?!1:typeof s.file=="string"):[],wn=n=>n.split(/^diff --git /m).slice(1).flatMap(e=>{const[i=""]=e.split(`
13
+ `,1),a=i.lastIndexOf(" b/");if(a<=2)return[];const l=i.slice(2,a),f=i.slice(a+3).trim(),d=`diff --git ${e}`,y=d.includes(`
14
+ new file mode `)?"added":d.includes(`
15
+ deleted file mode `)?"deleted":d.includes(`
16
+ rename from `)?"renamed":"modified";let m=0,c=0;for(const p of d.split(`
17
+ `))p.startsWith("+")&&!p.startsWith("+++")&&(m+=1),p.startsWith("-")&&!p.startsWith("---")&&(c+=1);return[{file:y==="deleted"?l:f,status:y,additions:m,deletions:c,patch:d}]}),Fn=n=>n==="added"?"A":n==="deleted"?"D":"M";function vn({activeDiffScope:n,effectiveDirectory:s,branchBase:e,branchHead:i,git:a,sessionMessageRecords:l}){const[f,d]=r.useState([]),[y,m]=r.useState(null),[c,p]=r.useState(!1),F=r.useMemo(()=>{const C=Tt(l,{showTextJustificationActivity:!1,mergeHiddenUserTurns:!0});for(let g=C.turns.length-1;g>=0;g-=1){const h=C.turns[g];if(!h)continue;const H=h.activityParts.map(S=>S.part).filter(S=>S.type==="tool"),M=Mt(H);if(M.length>0)return M.map(S=>({file:S.path,status:"modified",additions:S.additions,deletions:S.deletions,patch:S.patch}));const E=yn(h.userMessage.info?.summary?.diffs);if(E.length>0)return E}return[]},[l]);r.useEffect(()=>{if(n!=="branch"||!s||!e||!i||!a.getGitRangeDiff){d([]),m(null),p(!1);return}let C=!1;return p(!0),m(null),a.getGitRangeDiff(s,{base:e,head:i,contextLines:lt}).then(g=>{C||(d(wn(g.diff??"")),p(!1))}).catch(g=>{C||(d([]),p(!1),m(g instanceof Error?g.message:String(g)))}),()=>{C=!0}},[n,e,i,s,a]);const R=r.useMemo(()=>{const C=new Map;for(const g of F)if(g.file){if(typeof g.patch=="string"){C.set(g.file,$e(g.file,g.patch,"patch"));continue}typeof g.before!="string"&&typeof g.after!="string"||C.set(g.file,{original:g.before??"",modified:g.after??"",contextMode:"full"})}return C},[F]),x=r.useMemo(()=>{const C=new Map;for(const g of f)!g.file||typeof g.patch!="string"||C.set(g.file,$e(g.file,g.patch,"patch"));return C},[f]);return{branchDiffs:f,branchDiffError:y,branchDiffLoading:c,lastTurnDiffs:F,lastTurnDiffData:R,branchDiffData:x}}const Je=(n,s)=>{if(s.length===0)return null;let e=null,i=null;for(const l of s)l.top<=n?(!e||l.top>e.top)&&(e=l):(!i||l.top<i.top)&&(i=l);const a=e??i;return a?{path:a.path,topOffset:a.top-n}:null},jn=(n,s,e,i)=>Math.min(Math.max(0,i),Math.max(0,n+e-s));function Nn({pinSelectedFileHeaderToTopOnNavigate:n,scrollRequestNonce:s,changedFiles:e,expandedFiles:i,setMountedStackedFiles:a,fileDiffRefreshNonce:l}){const f=r.useRef(null),d=r.useRef(new Map),[y,m]=r.useState(null),c=r.useRef(null),p=r.useRef(null),F=r.useRef(!1),R=r.useRef(null),x=r.useRef(i),C=r.useRef(null);r.useLayoutEffect(()=>{x.current=i},[i]);const g=r.useRef(null),h=r.useCallback(()=>{const j=f.current;if(!j)return null;const w=j.getBoundingClientRect().top,L=[];for(const[D,A]of d.current)A&&L.push({path:D,top:A.getBoundingClientRect().top});return Je(w,L)},[]),H=r.useCallback(()=>{c.current=null,F.current=!1,m(null),p.current!==null&&(window.cancelAnimationFrame(p.current),p.current=null)},[]),M=r.useCallback(()=>{R.current=null;const j=f.current;if(!j)return;const w=j.getBoundingClientRect(),L=w.top-Qe,D=w.bottom+Qe,A={},k=[];for(const[I,B]of d.current){if(!B)continue;const $=B.getBoundingClientRect();k.push({path:I,top:$.top}),x.current.has(I)&&($.bottom<L||$.top>D||(A[I]=!0))}C.current=Je(w.top,k),a(I=>{let B=!1;const $=new Set(I);for(const ee of Object.keys(A))$.has(ee)||($.add(ee),B=!0);return B?$:I})},[a]),E=r.useCallback(()=>{typeof window>"u"||R.current===null&&(R.current=window.requestAnimationFrame(M))},[M]);r.useEffect(()=>{const j=f.current;if(j)return E(),j.addEventListener("scroll",E,{passive:!0}),window.addEventListener("resize",E),()=>{j.removeEventListener("scroll",E),window.removeEventListener("resize",E),R.current!==null&&(window.cancelAnimationFrame(R.current),R.current=null)}},[e,i,E]),r.useLayoutEffect(()=>{const j=g.current;if(!j)return;g.current=null;const w=f.current,L=d.current.get(j.path);if(!w||!L)return;const D=w.getBoundingClientRect().top,A=L.getBoundingClientRect().top-D;w.scrollTop=jn(w.scrollTop,j.topOffset,A,w.scrollHeight-w.clientHeight),C.current=j},[l]);const S=r.useCallback((j,w)=>{const L=d.current;w?L.set(j,w):L.delete(j),E()},[E]),_=r.useCallback(j=>{const w=d.current.get(j),L=f.current;if(!w||!L)return!1;const D=w.getBoundingClientRect().top-L.getBoundingClientRect().top;return L.scrollTo({top:L.scrollTop+D,behavior:"auto"}),!0},[]);return r.useEffect(()=>{if(!c.current)return;let w=0;const L=20;let D=!1;const A=(I=!0)=>{D||(D=!0,c.current=null,F.current=!1,I&&m(null),p.current!==null&&(window.cancelAnimationFrame(p.current),p.current=null))},k=()=>{if(D){p.current=null;return}const I=c.current;if(!I){A(),p.current=null;return}if(!_(I)){w+=1,w<L?p.current=window.requestAnimationFrame(k):(A(),p.current=null);return}if(n&&F.current){m(I),A(!1);return}A()};return p.current=window.requestAnimationFrame(k),()=>{D=!0,p.current!==null&&(window.cancelAnimationFrame(p.current),p.current=null)}},[n,s,_]),{diffScrollRef:f,fileSectionRefs:d,pinnedStackedTarget:y,pendingScrollTargetRef:c,shouldPinAfterAlignRef:F,pendingScrollAnchorRestoreRef:g,lastScrollAnchorRef:C,captureScrollAnchor:h,cancelPendingScrollAlignment:H,queueVisibleStackedFilesSync:E,registerSectionRef:S,scrollToFile:_}}const Ze=n=>{if(!n)return null;const s=n.split(`
18
+ `);let e=null;for(const i of s){const a=i.match(/^@@\s*-\d+(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s*@@/);if(a){const l=Number.parseInt(a[1]??"",10);e=Number.isFinite(l)&&l>=1?l:null;continue}if(e!==null){if(i.startsWith(" ")){e+=1;continue}if(i.startsWith("+"))return e;if(i.startsWith("-"))return Math.max(1,e)}}return null};function Cn({effectiveDirectory:n,activeDiffStaged:s,git:e,files:i,setDiff:a,openContextFileAtLine:l}){const[f,d]=r.useState(null),y=r.useCallback(async(m,c)=>{if(!n||!m)return;d(m);const p=et();try{let F=null;if(c?.patch&&!c.isBinary&&!De(m)?F=Ze(c.patch):c&&c.contextMode==="full"&&!c.isBinary&&!De(m)&&(F=Ye(c.original,c.modified)),F===null)try{const h=await e.getGitDiff(n,{path:m,staged:s,contextLines:3});F=Ze(h.diff)}catch{F=null}let R=c;if(F===null||!R){const h=await e.getGitFileDiff(n,{path:m,staged:s});R={original:h.original??"",modified:h.modified??"",isBinary:h.isBinary},s||a(n,m,R,p??void 0)}const x=F??(R.isBinary||De(m)?1:Ye(R.original,R.modified)),C=bn(n,m),g=await Yt(i,C,{directory:n});if(!g.ok){it.error(Jt(g.reason));return}l(n,C,x,1)}finally{d(F=>F===m?null:F)}},[s,n,i,e,l,a]);return{openingEditorFilePath:f,openFileInEditorAtChange:y}}function Sn(n){const{hideStackedFileSidebar:s=!1,stackedDefaultCollapsedAll:e=!1,pinSelectedFileHeaderToTopOnNavigate:i=!1,diffScope:a="all",branchBase:l=null,branchHead:f=null,targetFilePath:d=null}=n,{git:y,files:m}=st(),c=It(),{screenWidth:p,isMobile:F}=Pt(),R=$t(c??null),x=Wt(c??null),C=_t(c??null),g=ce(o=>o.setActiveDirectory),h=ce(o=>o.ensureStatus),H=ce(o=>o.fetchStatus),M=ce(o=>o.clearDiffCache),E=ce(o=>o.setDiff),[S,_]=r.useState(null),[j,w]=r.useState(!1),[L,D]=r.useState(()=>new Set),[A,k]=r.useState(()=>new Set),[I,B]=r.useState(!1),[$,ee]=r.useState(0),[ue,Ne]=r.useState(()=>new Map),[b,se]=r.useState(a);r.useEffect(()=>{se(a)},[a]);const U=Y(o=>o.pendingDiffFile),ie=Y(o=>o.pendingDiffStaged),K=Y(o=>o.pendingDiffScope),J=Y(o=>o.setPendingDiffFile),O=Y(o=>o.diffLayoutPreference),re=Y(o=>o.diffFileLayout),q=Y(o=>o.setDiffFileLayout),he=Y(o=>o.diffWrapLinesOverride),de=Y(o=>o.wrapLinesByDefault),me=Y(o=>o.setDiffWrapLines),ge=Y(o=>o.openContextFileAtLine),oe=Bt(o=>o.currentSessionId),Ce=Ot(oe??""),u=he??de,te=(b==="staged"?!0:b==="working"?!1:null)??j,xe=F||p<=768,be=!s&&!xe&&p>=1024,ae=r.useRef(null),{branchDiffs:le,branchDiffError:V,branchDiffLoading:X,lastTurnDiffs:Z,lastTurnDiffData:Q,branchDiffData:ke}=vn({activeDiffScope:b,effectiveDirectory:c,branchBase:l,branchHead:f,git:y,sessionMessageRecords:Ce}),z=r.useMemo(()=>{if(b==="turn"||b==="branch")return(b==="branch"?le:Z).map(T=>({path:T.file??"",index:"",working_dir:Fn(T.status),insertions:T.additions??0,deletions:T.deletions??0,isNew:T.status==="added"})).filter(T=>T.path).sort((T,G)=>T.path.localeCompare(G.path));if(!x?.files)return[];const o=x.diffStats??{},N=b==="staged"?He:b==="working"?Ue:()=>!0;return x.files.filter(N).map(v=>({...v,insertions:o[v.path]?.insertions??0,deletions:o[v.path]?.deletions??0,isNew:Kt(v)})).sort((v,T)=>v.path.localeCompare(T.path))},[b,le,Z,x]),Ae=r.useMemo(()=>x?.files?x.files.filter(Ue).length:0,[x]),ct=r.useMemo(()=>x?.files?x.files.filter(He).length:0,[x]),ut=Z.length,dt=x?.files?.length??0,ft=le.length,{diffScrollRef:pt,pinnedStackedTarget:ht,pendingScrollTargetRef:ye,shouldPinAfterAlignRef:we,pendingScrollAnchorRestoreRef:We,lastScrollAnchorRef:_e,captureScrollAnchor:Be,cancelPendingScrollAlignment:Fe,queueVisibleStackedFilesSync:Re,registerSectionRef:mt,scrollToFile:Oe}=Nn({pinSelectedFileHeaderToTopOnNavigate:i,scrollRequestNonce:$,changedFiles:z,expandedFiles:L,setMountedStackedFiles:k,fileDiffRefreshNonce:ue}),ve=r.useCallback(o=>{D(N=>{if(N.has(o))return N;const v=new Set(N);return v.add(o),v})},[]),Te=r.useMemo(()=>z.map(o=>o.path).join("\0"),[z]);r.useEffect(()=>{const o=Te?Te.split("\0"):[],N=new Set(o),v=`${c??""}:${b}:${e?"collapsed":"default"}`,T=ae.current!==v;ae.current=v,D(G=>{if(T){const fe=e?0:xn(o.length);return new Set(o.slice(0,fe))}let Se=!1;const Le=new Set;for(const fe of G){if(!N.has(fe)){Se=!0;continue}Le.add(fe)}return Se?Le:G}),k(G=>{if(T)return new Set;let Se=!1;const Le=new Set;for(const fe of G){if(!N.has(fe)){Se=!0;continue}Le.add(fe)}return Se?Le:G})},[b,Te,c,k,e]);const Me=r.useCallback(o=>{const N=re[o.path];if(N)return N;if(O==="inline")return"inline";if(O==="side-by-side")return"side-by-side";const v=p<gn;return o.isNew||v?"inline":"side-by-side"},[re,O,p]),gt=r.useMemo(()=>z.length===0?null:z.every(o=>Me(o)==="side-by-side")?"side-by-side":"inline",[z,Me]);r.useEffect(()=>{c&&(g(c),h(c,y))},[c,g,h,y]),r.useEffect(()=>{if(c)return zt.onGitRefreshHint(o=>{ze(o.directory)===ze(c)&&(o.paths?.length&&(We.current=Be()??_e.current,M(c,o.paths),Ne(N=>{const v=new Map(N);for(const T of o.paths??[])v.set(T,(v.get(T)??0)+1);return v})),H(c,y,{silent:!0}))})},[Be,M,c,H,y,_e,We]),r.useEffect(()=>{b!=="all"&&!K||U&&(K&&se(K),_(U),w(K==="staged"||!K&&ie),J(null),we.current=!0,ye.current=U,ve(U),ee(o=>o+1))},[b,ve,U,K,ie,ye,J,we]),r.useEffect(()=>{if(b==="all")return;const o=d?.trim();o&&(_(o),w(b==="staged"),we.current=!0,ye.current=o,ve(o),ee(N=>N+1))},[b,ve,ye,we,d]),r.useEffect(()=>{if(!S)return;z.some(N=>N.path===S)||(_(null),w(!1))},[z,S]);const xt=r.useCallback((o,N)=>{Fe(),D(v=>{const T=v.has(o);if(N===T)return v;const G=new Set(v);return N?G.add(o):G.delete(o),G}),k(v=>{const T=v.has(o);if(N===T)return v;const G=new Set(v);return N?G.add(o):G.delete(o),G}),Re()},[Fe,Re,k]),bt=r.useCallback(()=>{Fe(),D(o=>o.size>0?new Set:new Set(z.map(N=>N.path))),k(new Set),Re()},[Fe,z,Re,k]),yt=r.useCallback(o=>{},[]),wt=r.useCallback(o=>{Fe(),_(o),w(!1),we.current=!0,ye.current=o,ve(o),ee(N=>N+1),Oe(o)},[Fe,ve,ye,Oe,we]),Ft=r.useCallback(o=>{const N=o==="side-by-side"?"side-by-side":"inline";z.forEach(v=>{q(v.path,N)})},[z,q]),{openingEditorFilePath:vt,openFileInEditorAtChange:jt}=Cn({effectiveDirectory:c,activeDiffStaged:te,git:y,files:m,setDiff:E,openContextFileAtLine:ge});return{git:y,files:m,effectiveDirectory:c,screenWidth:p,isMobile:F,isGitRepo:R,status:x,isLoadingStatus:C,activeDiffScope:b,setActiveDiffScope:se,branchDiffs:le,branchDiffError:V,branchDiffLoading:X,diffWrapLines:u,setDiffWrapLines:me,displayFileStaged:j,displayFile:S,pinnedStackedTarget:ht,expandedFiles:L,mountedStackedFiles:A,loadFullFiles:I,setLoadFullFiles:B,fileDiffRefreshNonce:ue,showFileSidebar:be,diffScrollRef:pt,lastTurnDiffData:Q,branchDiffData:ke,changedFiles:z,workingFileCount:Ae,stagedFileCount:ct,turnFileCount:ut,allFileCount:dt,branchFileCount:ft,currentLayoutForAllFiles:gt,openingEditorFilePath:vt,registerSectionRef:mt,handleStackedEntryExpandedChange:xt,handleExpandOrCollapseAll:bt,handleSelectFile:yt,handleSelectFileAndScroll:wt,handleHeaderLayoutChange:Ft,openFileInEditorAtChange:jt,getLayoutForFile:Me}}const Ns=({hideStackedFileSidebar:n=!1,stackedDefaultCollapsedAll:s=!1,pinSelectedFileHeaderToTopOnNavigate:e=!1,showOpenInEditorAction:i=!1,diffScope:a="all",onDiffScopeChange:l,branchBase:f=null,branchHead:d=null,targetFilePath:y=null,flushContent:m=!1,hideToolbar:c=!1,onHeaderControlsStateChange:p,toolbarSlot:F=null})=>{const{effectiveDirectory:R,isGitRepo:x,status:C,isLoadingStatus:g,activeDiffScope:h,setActiveDiffScope:H,branchDiffError:M,branchDiffLoading:E,diffWrapLines:S,setDiffWrapLines:_,displayFileStaged:j,displayFile:w,pinnedStackedTarget:L,expandedFiles:D,mountedStackedFiles:A,loadFullFiles:k,setLoadFullFiles:I,fileDiffRefreshNonce:B,showFileSidebar:$,diffScrollRef:ee,lastTurnDiffData:ue,branchDiffData:Ne,changedFiles:b,workingFileCount:se,stagedFileCount:U,turnFileCount:ie,allFileCount:K,branchFileCount:J,currentLayoutForAllFiles:O,openingEditorFilePath:re,registerSectionRef:q,handleStackedEntryExpandedChange:he,handleExpandOrCollapseAll:de,handleSelectFile:me,handleSelectFileAndScroll:ge,handleHeaderLayoutChange:oe,openFileInEditorAtChange:Ce,getLayoutForFile:u}=Sn({hideStackedFileSidebar:n,stackedDefaultCollapsedAll:s,pinSelectedFileHeaderToTopOnNavigate:e,diffScope:a,branchBase:f,branchHead:d,targetFilePath:y});r.useEffect(()=>{c&&l?.(h)},[h,c,l]);const P=r.useCallback(()=>{I(Z=>!Z)},[I]),te=r.useCallback(()=>{_(!S)},[S,_]),xe=r.useCallback(()=>{oe(O==="side-by-side"?"unified":"side-by-side")},[O,oe]),be=D.size,ae=r.useMemo(()=>({turnCount:ie,branchCount:J,expandedCount:be,totalCount:b.length,loadFullFiles:k,wrapLines:S,layoutMode:O,onExpandOrCollapseAll:de,onToggleLoadFullFiles:P,onToggleWrapLines:te,onToggleLayout:xe}),[ie,J,be,b.length,k,S,O,de,P,te,xe]);r.useEffect(()=>{c&&p?.(ae)},[c,ae,p]);const le=()=>{if(!R)return null;const Z={path:w,staged:j};return t.jsxs("div",{className:ne("flex min-w-0 flex-1 min-h-0 h-full",m?"gap-0":"gap-3 px-3 pb-3 pt-2"),children:[$&&t.jsxs("section",{className:"hidden lg:flex w-72 flex-col rounded-xl border border-border/60 bg-background/70 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/40",children:[t.jsx("span",{className:"typography-ui-header font-semibold text-foreground",children:"Files"}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:b.length})]}),t.jsx(an,{changedFiles:b,selectedFile:null,onSelectFile:ge})]}),t.jsx("div",{className:"relative flex-1 min-w-0 min-h-0 h-full",children:t.jsxs(tt,{ref:ee,outerClassName:"min-h-0 h-full",className:"[overflow-anchor:none]",disableHorizontal:!0,observeMutations:!1,preventOverscroll:!0,"data-diff-virtual-root":!0,children:[t.jsx("div",{className:"flex flex-col [overflow-anchor:none]","data-diff-virtual-content":!0,children:b.map(Q=>{const ke=ln(h,Q,Z);return t.jsx(mn,{directory:R,file:Q,layout:u(Q),wrapLines:S,isSelected:!1,isExpanded:D.has(Q.path),isMounted:A.has(Q.path)||Q.path===L,onSelect:me,onExpandedChange:he,registerSectionRef:q,showOpenInEditorAction:i&&h!=="turn"&&h!=="branch",isOpeningInEditor:re===Q.path,onOpenInEditor:(z,Ae)=>{Ce(z,Ae)},diffSource:ke.source,staged:ke.staged,showFileActions:h!=="turn"&&h!=="branch",loadFullFiles:k,initialDiffData:h==="turn"?ue.get(Q.path)??null:h==="branch"?Ne.get(Q.path)??null:null},`${Q.path}:${B.get(Q.path)??0}`)})}),t.jsx("div",{"aria-hidden":"true",className:"h-16 shrink-0"})]})})]})},V=()=>R?h!=="turn"&&g&&!C?t.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(W,{name:"loader-4",className:"size-4 animate-spin"}),"Loading repository status..."]}):h!=="turn"&&h!=="branch"&&x===!1?t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Not a git repository. Use the Git tab to initialize or change directories."}):h==="branch"&&E?t.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(W,{name:"loader-4",className:"size-4 animate-spin"}),"Loading branch changes..."]}):h==="branch"&&M?t.jsx("div",{className:"flex flex-1 items-center justify-center px-4 text-center text-sm text-muted-foreground",children:`Failed to load branch changes: ${M}`}):b.length===0?t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:h==="turn"?"No last turn changes to display":"Working tree clean, no changes to display"}):le():t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Select a session directory to view diffs"}),X=t.jsxs("div",{className:F?"flex min-w-0 flex-1 items-center gap-1.5":"@container/diff-toolbar flex min-w-0 items-center gap-2 px-3 py-2 bg-background",children:[(x!==!1||h==="turn")&&(h==="all"||h==="working"||h==="staged"||h==="turn"||h==="branch")?t.jsx(qt,{scope:h,isGitRepo:x,branchAvailable:!!(f&&d),allCount:K,workingCount:se,stagedCount:U,turnCount:ie,branchCount:J,onScopeChange:Z=>{H(Z),l?.(Z)}}):t.jsx("div",{className:"flex items-center gap-1 rounded-md px-2 py-1 text-muted-foreground shrink-0",children:t.jsx("span",{className:"typography-ui-label font-medium text-foreground",children:g&&!C?"Loading changes...":b.length===1?`${b.length} file changed`:`${b.length} files changed`})}),b.length>0&&t.jsxs(je,{variant:"ghost",size:"sm",onClick:de,className:ne("diff-toolbar__expand-button h-7 flex-shrink-0 gap-1 px-1.5 text-muted-foreground hover:text-foreground","ml-auto"),title:D.size>0?"Collapse all":"Expand all",children:[t.jsx(W,{name:"expand-up-down",className:"size-4"}),t.jsx("span",{className:"diff-toolbar__expand-label typography-ui-label",children:D.size>0?"Collapse all":"Expand all"})]}),b.length>0&&h!=="turn"&&h!=="branch"&&t.jsxs(Gt,{children:[t.jsx(Ht,{asChild:!0,children:t.jsx(je,{variant:"ghost",size:"sm",onClick:()=>I(Z=>!Z),"aria-pressed":k,"aria-label":k?"Unload full files":"Load full files",className:ne("h-7 w-7 flex-shrink-0 p-0 text-muted-foreground hover:text-foreground",k&&"bg-interactive-selection text-interactive-selection-foreground"),children:t.jsx(W,{name:"file-download",className:"size-4"})})}),t.jsx(Ut,{children:t.jsx("p",{children:k?"Unload full files":"Load full files"})})]}),b.length>0&&t.jsx(je,{variant:"ghost",size:"sm",onClick:()=>_(!S),className:ne("h-5 w-5 p-0 transition-opacity",S?"text-foreground opacity-100":"text-muted-foreground opacity-60 hover:opacity-100"),title:S?"Disable line wrap":"Enable line wrap",children:t.jsx(W,{name:"text-wrap",className:"size-4"})}),O&&t.jsx(rt,{mode:O==="side-by-side"?"side-by-side":"unified",onModeChange:oe})]});return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background",children:[F?Nt.createPortal(X,F):c?null:X,V()]})};export{Ns as DiffView};
@@ -0,0 +1,3 @@
1
+ import{j as r}from"./vendor-boot-CoTxysn6.js";import{R as a}from"./vendor-react-Bz1tRBxM.js";import{D}from"./vendor-react-drawio-IYnLUY5N.js";import{f as C}from"./index-C2ISrmRR.js";import{av as E,aw as S,ax as N,ay as B,az as A,aA as F,B as p}from"./useAppFontEffects-D_gtiA95.js";const H='<mxfile><diagram id="new" name="Page-1"><mxGraphModel dx="0" dy="0" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel></diagram></mxfile>';function w(){if(typeof document>"u")return!1;const t=document.documentElement.getAttribute("data-theme");return t==="dark"||!t&&window.matchMedia("(prefers-color-scheme: dark)").matches}const T=a.forwardRef(function({xml:e,readOnly:s,className:d,onChange:u},m){const l=a.useRef(e),c=a.useRef(null),i=a.useRef(!1),[o,y]=a.useState(w),f=a.useRef(e),h=a.useRef(e);h.current!==e&&(h.current=e,f.current=e,l.current=e);const v=a.useRef(o);v.current!==o&&(v.current=o,f.current=l.current);const g=a.useRef(null);a.useEffect(()=>{const n=()=>y(w());n();const x=new MutationObserver(n);return x.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>x.disconnect()},[]),a.useEffect(()=>{const n=setTimeout(()=>{g.current?.querySelector(".diagrams-iframe")?.focus()},600);return()=>clearTimeout(n)},[]),a.useImperativeHandle(m,()=>({getXml:()=>l.current}));const R=a.useCallback(()=>{!e&&!i.current&&(i.current=!0,setTimeout(()=>{c.current?.template({})},500))},[e]),j=a.useCallback(n=>{l.current=n.xml,u?.(n.xml)},[u]);return r.jsx("div",{ref:g,className:C("h-full w-full",d),children:r.jsx(D,{ref:c,xml:f.current||H,autosave:!0,urlParameters:{ui:s?"simple":o?"dark":"kennedy",spin:!0,libraries:!s,chrome:s,nav:s,layers:s,noSaveBtn:!0,noExitBtn:!0,saveAndExit:!1},onLoad:R,onAutoSave:j},o?"dark":"light")})}),X=(t,e)=>!t||t.runtimeKey!==e.runtimeKey||t.root!==e.root||t.path!==e.path||t.generation!==e.generation,b=t=>{if(typeof t=="string")return t;if(t===null)return null},G=(t,e)=>{if(e===!0)return t!==void 0?{expectedRevision:b(t),overwrite:!0}:{overwrite:!0};if(t!==void 0)return{expectedRevision:b(t)}},W=(t,e)=>!!(t&&e&&t.runtimeKey===e.runtimeKey&&t.root===e.root&&t.path===e.path&&t.generation===e.generation),k=(t,e=4e3)=>t.length>e?`${t.slice(0,e)}
2
+
3
+ … truncated …`:t,Y=({open:t,conflict:e,isResolving:s,showCompare:d,onToggleCompare:u,onReload:m,onOverwrite:l,onClose:c})=>{if(!e)return null;const i=!e.exists;return r.jsx(E,{open:t,onOpenChange:o=>{o||c()},children:r.jsxs(S,{showCloseButton:!1,className:"max-w-lg",children:[r.jsxs(N,{children:[r.jsx(B,{children:i?"File deleted on disk":"File changed on disk"}),r.jsx(A,{children:i?`“${e.displayPath}” was deleted since you opened it. Your edits are preserved. Reload to discard them, or overwrite to recreate the file.`:`“${e.displayPath}” changed since you opened it. Your edits are preserved. Reload to discard them and load the current version, or overwrite to keep your edits.`})]}),d&&!i?r.jsxs("div",{className:"grid max-h-64 grid-cols-1 gap-2 overflow-auto py-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"typography-meta text-muted-foreground",children:"Current version on disk"}),r.jsx("pre",{className:"mt-1 max-h-28 overflow-auto rounded-md bg-[var(--surface-subtle)] p-2 text-xs whitespace-pre-wrap break-words",children:k(e.currentContent??"")})]}),r.jsxs("div",{children:[r.jsx("div",{className:"typography-meta text-muted-foreground",children:"Your edits"}),r.jsx("pre",{className:"mt-1 max-h-28 overflow-auto rounded-md bg-[var(--surface-subtle)] p-2 text-xs whitespace-pre-wrap break-words",children:k(e.dirtyContent)})]})]}):null,r.jsxs(F,{className:"flex flex-wrap gap-2",children:[i?null:r.jsx(p,{variant:"outline",onClick:u,disabled:s,"aria-label":d?"Hide version comparison":"Compare versions",title:d?"Hide version comparison":"Compare versions",children:d?"Hide compare":"Compare"}),r.jsx(p,{variant:"outline",onClick:m,disabled:s,"aria-label":i?"Discard edits and close":"Reload current version",title:i?"Discard edits and close":"Reload current version",children:i?"Discard edits":"Reload"}),r.jsx(p,{variant:"destructive",onClick:l,disabled:s,"aria-label":i?"Recreate file with my edits":"Overwrite with my edits",title:i?"Recreate file with my edits":"Overwrite with my edits",children:s?"Working…":"Overwrite"})]})]})})};export{T as D,Y as F,G as b,W as i,X as s};