@yuriai/web 0.3.6-beta.8 → 0.3.6

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 (275) hide show
  1. package/README.md +19 -3
  2. package/bin/install-portable.sh +102 -0
  3. package/bin/install-portable.test.js +112 -0
  4. package/bin/lib/DOCUMENTATION.md +2 -0
  5. package/bin/lib/cli-startup.js +7 -2
  6. package/bin/lib/cli-startup.portable.test.js +30 -0
  7. package/bin/lib/commands-serve.js +4 -1
  8. package/bin/lib/commands-update.js +3 -0
  9. package/bin/lib/commands-update.test.js +18 -0
  10. package/dist/assets/{AgentAvatar-COZrpK6y.js → AgentAvatar-BOvjZ-DI.js} +1 -1
  11. package/dist/assets/{AgentSelector-7iPujobN.js → AgentSelector-Dl_zIOMk.js} +1 -1
  12. package/dist/assets/ArchivedSessionsDialog-Cr9Ji-RY.js +1 -0
  13. package/dist/assets/{AssistantConversationSurface-C6tCgfuc.js → AssistantConversationSurface-CLdjNFeJ.js} +3 -3
  14. package/dist/assets/{AssistantSessionCard-BLKXoc6z.js → AssistantSessionCard-BufyrOfo.js} +2 -2
  15. package/dist/assets/{AssistantUnreadBadge-BSWBtgFe.js → AssistantUnreadBadge-Dn9HAEDr.js} +1 -1
  16. package/dist/assets/{AssistantView-YdmEtDcb.js → AssistantView-Cg0wPomu.js} +1 -1
  17. package/dist/assets/{AssistantWorkingAvatar-Cnl5oL-I.js → AssistantWorkingAvatar-1KNjr2A2.js} +1 -1
  18. package/dist/assets/{AssistantsSettingsPage-CqtitUB4.js → AssistantsSettingsPage-DeYfZAYH.js} +1 -1
  19. package/dist/assets/{BinaryFileFallback-ITV09rfY.js → BinaryFileFallback-DfD02fS_.js} +1 -1
  20. package/dist/assets/{BtwPanel-SwSsRp_l.js → BtwPanel-B_2w8P0X.js} +2 -2
  21. package/dist/assets/BusyDots-CAv4ygIO.js +4 -0
  22. package/dist/assets/{ChatContainer-C_-17prp.js → ChatContainer-Dgv075jT.js} +23 -23
  23. package/dist/assets/ChatView-Cr71C0ZB.js +3 -0
  24. package/dist/assets/{DiagramView-DDMO_6X5.js → DiagramView-CTnpBsWU.js} +1 -1
  25. package/dist/assets/{DiffView-DCQrow3l.js → DiffView-j_yWF1Mz.js} +2 -2
  26. package/dist/assets/{DiffViewToggle-uJM3Jn3y.js → DiffViewToggle-CYusbmY5.js} +1 -1
  27. package/dist/assets/{ErrorBoundary-BFXVt5ct.js → ErrorBoundary-yr_JeVdx.js} +1 -1
  28. package/dist/assets/{FadeInOnReveal-CrbIIB5N.js → FadeInOnReveal-C56koblQ.js} +1 -1
  29. package/dist/assets/{GuiPluginMount-FFI3j0Vq.js → GuiPluginMount-CBJiLdzR.js} +1 -1
  30. package/dist/assets/{GuiPluginPage-B9I2nkDa.js → GuiPluginPage-DJa8gFLk.js} +1 -1
  31. package/dist/assets/{GuiPluginSurface-D_IoxXvc.js → GuiPluginSurface-Cc7q80jp.js} +1 -1
  32. package/dist/assets/{GuiPluginTitlebarItems-C4eqm-dM.js → GuiPluginTitlebarItems-rbK3leaL.js} +1 -1
  33. package/dist/assets/{GuiPluginWindow-BMeBjsJ4.js → GuiPluginWindow-Cpg2HYWe.js} +1 -1
  34. package/dist/assets/{Icon-C1m8PihJ.js → Icon-C1rjS64C.js} +1 -1
  35. package/dist/assets/{ImageLoadingPlaceholder-CJmo4kkb.js → ImageLoadingPlaceholder-2hMqBtYh.js} +1 -1
  36. package/dist/assets/{LoadingImage-956pmYDm.js → LoadingImage-Bs-621ZL.js} +1 -1
  37. package/dist/assets/MarkdownRenderer-BZl_T1ng.js +2 -0
  38. package/dist/assets/{MarkdownRendererImpl-B0BDlD7a.js → MarkdownRendererImpl-DiCCNjDr.js} +3 -3
  39. package/dist/assets/{MarkstreamRendererImpl-CNodTwpI.js → MarkstreamRendererImpl-Bzz3OZlX.js} +2 -2
  40. package/dist/assets/{MobileAssistantSettingsPage-DMLyFaSP.js → MobileAssistantSettingsPage-pBhJR2t6.js} +1 -1
  41. package/dist/assets/{MobileAssistantTab-C8r9diC7.js → MobileAssistantTab-Ceo442NF.js} +1 -1
  42. package/dist/assets/{MobileBtwPage-CoQGTHvz.js → MobileBtwPage-DPPmDMA6.js} +1 -1
  43. package/dist/assets/{MobileChangesSurface-CmZpDOwU.js → MobileChangesSurface-DfDoSkTS.js} +1 -1
  44. package/dist/assets/{MobileChatScreen-Db2VIMuY.js → MobileChatScreen-DHTbrnAr.js} +1 -1
  45. package/dist/assets/{MobileDetailNavigation-DX3hD4c-.js → MobileDetailNavigation-e1u1y59T.js} +1 -1
  46. package/dist/assets/{MobileFilesSurface-BERQLtDW.js → MobileFilesSurface-CJoqR3By.js} +2 -2
  47. package/dist/assets/{MobileHtmlNetworkBoundary-5XyCoKjL.js → MobileHtmlNetworkBoundary-GBhYVYvu.js} +2 -2
  48. package/dist/assets/{MobileOverlayPanel-XkMrn5-W.js → MobileOverlayPanel-DzKTKeZX.js} +1 -1
  49. package/dist/assets/{MobileResizableSheet-CcOOlg4R.js → MobileResizableSheet-CkA7qhco.js} +1 -1
  50. package/dist/assets/{MobileSettingsTab-iRC8w_jI.js → MobileSettingsTab-Bv0HsXFH.js} +1 -1
  51. package/dist/assets/{MobileShareBridge-DSL2iOvl.js → MobileShareBridge-B-co2UPE.js} +1 -1
  52. package/dist/assets/{MobileSurface-CkgVejQ3.js → MobileSurface-D63k27t5.js} +1 -1
  53. package/dist/assets/{MobileTabPageHeader-DDqtoIoS.js → MobileTabPageHeader-FmtbGhwq.js} +1 -1
  54. package/dist/assets/{ModelLogo-DK6xHKii.js → ModelLogo-CMnp5fyy.js} +1 -1
  55. package/dist/assets/{ModelSelector-DMmMUIB2.js → ModelSelector-BF4wYwaz.js} +1 -1
  56. package/dist/assets/{MultiRunWindow-B6jL_lNE.js → MultiRunWindow-D0OU63re.js} +1 -1
  57. package/dist/assets/{OnboardingScreen-BCIOJR5C.js → OnboardingScreen-CDHtDQ0k.js} +1 -1
  58. package/dist/assets/{OverlayScrollbar-CbdvcSXs.js → OverlayScrollbar-m1EAqRES.js} +1 -1
  59. package/dist/assets/{PierreDiffViewer-Dn1NIerc.js → PierreDiffViewer-CZk1tZ3K.js} +1 -1
  60. package/dist/assets/{ProviderLogo-CmOgqmZH.js → ProviderLogo-BqQTME35.js} +1 -1
  61. package/dist/assets/{RemoteAssistantSessionCard-BydwHPmQ.js → RemoteAssistantSessionCard-CrbCVhqD.js} +1 -1
  62. package/dist/assets/{RemoteDesktopPanel-q0HrpV8w.js → RemoteDesktopPanel-BzLmzmjb.js} +1 -1
  63. package/dist/assets/ScheduledTasksDialog-DmtcDZHc.js +3 -0
  64. package/dist/assets/{ScrollableOverlay-DIkp2MKc.js → ScrollableOverlay-CEglrXfm.js} +1 -1
  65. package/dist/assets/{SettingsGroup-YUId7nD5.js → SettingsGroup-Bm-l3IIs.js} +1 -1
  66. package/dist/assets/{SettingsView-DLMfj0mQ.js → SettingsView-CYEjDYWC.js} +15 -15
  67. package/dist/assets/{SettingsWindow-DCPFcip-.js → SettingsWindow-CvJsxUyu.js} +1 -1
  68. package/dist/assets/{SetupTourDialog-0bzhfhsY.js → SetupTourDialog-DWaVtkY0.js} +1 -1
  69. package/dist/assets/{SyncActions-8f50jzAU.js → SyncActions-C0gph0P8.js} +1 -1
  70. package/dist/assets/TerminalView-Cm8Ts51w.js +9 -0
  71. package/dist/assets/{TextSelectionMenu-BozjXtuL.js → TextSelectionMenu-Dcv_PdES.js} +2 -2
  72. package/dist/assets/{ToolOutputDialog-BK0D8GxM.js → ToolOutputDialog-QJpQjmqK.js} +2 -2
  73. package/dist/assets/{YuriLogo-KR0TAQlB.js → YuriLogo-BbS_Wj4g.js} +1 -1
  74. package/dist/assets/{YuriWordmark-B0uXpGcz.js → YuriWordmark-CqkcfAJl.js} +1 -1
  75. package/dist/assets/{assistant-attachment-cache-BNDj8_aw.js → assistant-attachment-cache-CIij0OGm.js} +1 -1
  76. package/dist/assets/{assistantMessagePreview-Ccp5_-kq.js → assistantMessagePreview-wmP-d_oa.js} +1 -1
  77. package/dist/assets/{assistantQueries-DDTlQu6m.js → assistantQueries-Dpxq78yP.js} +1 -1
  78. package/dist/assets/{auto-read-context-C8RimaOE.js → auto-read-context-aRn5yhDb.js} +1 -1
  79. package/dist/assets/{capgoAdapter-DvATpyxN.js → capgoAdapter-BSnmtwX8.js} +1 -1
  80. package/dist/assets/{card-alsnQayp.js → card-aoveY4I3.js} +1 -1
  81. package/dist/assets/{chatUpwardIntent-D_Yt_quU.js → chatUpwardIntent-WxxmOppY.js} +1 -1
  82. package/dist/assets/{checkbox-LzFeQCyX.js → checkbox-CljLXON1.js} +1 -1
  83. package/dist/assets/{client-i5Q82JUc.js → client-CmtAKi5B.js} +1 -1
  84. package/dist/assets/{collapsible-HsY9X-Ve.js → collapsible-DkeWKEAb.js} +1 -1
  85. package/dist/assets/{connection-hint-DsbzB6Ms.js → connection-hint-DsKyICgn.js} +1 -1
  86. package/dist/assets/{context-menu-Dpuzxt3o.js → context-menu-XuMa5TsA.js} +1 -1
  87. package/dist/assets/{desktopHosts-DRAWu-NH.js → desktopHosts-COI-czjF.js} +1 -1
  88. package/dist/assets/{desktopRelayRestore-DFWsoSoG.js → desktopRelayRestore-BEPNc7qb.js} +1 -1
  89. package/dist/assets/device-TCHW5U2y.js +2 -0
  90. package/dist/assets/{diagram-COwAj2NM.js → diagram-DFv7Lh0h.js} +1 -1
  91. package/dist/assets/dialog-B6B8FIrL.css +1 -0
  92. package/dist/assets/{dialog-Cv20xnEj.js → dialog-Cx20I73q.js} +1 -1
  93. package/dist/assets/{dropdown-menu-B_P1dDl7.js → dropdown-menu-XdfySbu2.js} +1 -1
  94. package/dist/assets/es-CLAEdHpc.js +15 -0
  95. package/dist/assets/{fileMentionTouchSelection-BRu1cBlZ.js → fileMentionTouchSelection-pXNTKHAc.js} +1 -1
  96. package/dist/assets/{fileReferenceActions-FVCTQlDH.js → fileReferenceActions-wN7mWY3w.js} +1 -1
  97. package/dist/assets/fr-BOB0gfdQ.js +13 -0
  98. package/dist/assets/{gitApi-BH7j-M9u.js → gitApi-LXGRaDt8.js} +1 -1
  99. package/dist/assets/{gitApiHttp-Be5VpQHC.js → gitApiHttp-ZjM4HkSo.js} +2 -2
  100. package/dist/assets/{githubAuthQueries-Dli4cDU7.js → githubAuthQueries-3AJp5LD5.js} +1 -1
  101. package/dist/assets/{historyImportQueries-SUqjfVSc.js → historyImportQueries-B_mfphxe.js} +1 -1
  102. package/dist/assets/host-fTclNJST.js +1 -0
  103. package/dist/assets/{i18n-CBCskgqa.js → i18n-iu4pzqPi.js} +1 -1
  104. package/dist/assets/{icons-BQMGp0ts.js → icons-BWijARKS.js} +1 -1
  105. package/dist/assets/{imageSource-DoyhaY3E.js → imageSource-qzgDdfT4.js} +1 -1
  106. package/dist/assets/{input-CY-NU-bG.js → input-BMYgp87Q.js} +1 -1
  107. package/dist/assets/{input-store-C4dE7Hgl.js → input-store-CzG_3qFv.js} +1 -1
  108. package/dist/assets/insertionBoundaries-bmxIeFzH.js +1 -0
  109. package/dist/assets/ja-CfM9jZ6u.js +15 -0
  110. package/dist/assets/{kbd-DJnHCHPh.js → kbd-6RW-BxuR.js} +1 -1
  111. package/dist/assets/ko-DZOSVPHB.js +15 -0
  112. package/dist/assets/main-B-Wdp6An.js +169 -0
  113. package/dist/assets/main-BLBAaohb.js +2 -0
  114. package/dist/assets/{markdownHeightCache-BAuvVQZt.js → markdownHeightCache-ojT5txMS.js} +1 -1
  115. package/dist/assets/{mcpQueries-lBUNZsO9.js → mcpQueries-BRuytwhB.js} +1 -1
  116. package/dist/assets/miniChat-BsrHy2rU.js +2 -0
  117. package/dist/assets/mobile-B8SHiXyq.js +2 -0
  118. package/dist/assets/{mobileBackNavigation-BzQ0WYuk.js → mobileBackNavigation-CVrR_jtn.js} +1 -1
  119. package/dist/assets/{mobileConnections-CSyrEiXH.js → mobileConnections-iSUwFNqu.js} +2 -2
  120. package/dist/assets/{multirun-BUjPLUCQ.js → multirun-Y3K5yS-8.js} +1 -1
  121. package/dist/assets/{native-config-C-fqN2Cf.js → native-config-tvqKHwCC.js} +1 -1
  122. package/dist/assets/{nativeComposerCover-DT9d7IrX.js → nativeComposerCover-5rYz1E3W.js} +1 -1
  123. package/dist/assets/{navigation-D2V5N7IH.js → navigation-DFmCAq2g.js} +2 -2
  124. package/dist/assets/openRemoteProjectSession-CeSahDtQ.js +1 -0
  125. package/dist/assets/openSessionFromDeepLink-DsZnNy4W.js +2 -0
  126. package/dist/assets/pl-CaT81Sz8.js +15 -0
  127. package/dist/assets/platform-B2ylz14u.js +1 -0
  128. package/dist/assets/{pluginPresentation-CbOzLlWM.js → pluginPresentation-rls1AMJN.js} +2 -2
  129. package/dist/assets/{project-preview-ClK_VQFz.js → project-preview-yQerlKs2.js} +1 -1
  130. package/dist/assets/{projectActions-CD3dKulN.js → projectActions-B11KAI3f.js} +1 -1
  131. package/dist/assets/{prompt-attachment-upload-BG4nBKxi.js → prompt-attachment-upload-BzYqZdzd.js} +1 -1
  132. package/dist/assets/pt-BR-9p1IKCEF.js +15 -0
  133. package/dist/assets/pwa-BrLPfcLk.js +2 -0
  134. package/dist/assets/{queue-abort-optimistic-DcW7tzaK.js → queue-abort-optimistic-CXKdQu_T.js} +1 -1
  135. package/dist/assets/{quota-Cyq21PUF.js → quota-BhdKv_Wc.js} +1 -1
  136. package/dist/assets/{reference-history-BZIwpng4.js → reference-history-Bzn-aPYg.js} +1 -1
  137. package/dist/assets/{remote-input-store-CiwwBt7K.js → remote-input-store-DPw_n0MZ.js} +1 -1
  138. package/dist/assets/{remoteProjectQueries-CuuZggLJ.js → remoteProjectQueries-BQzoY_Y9.js} +1 -1
  139. package/dist/assets/{remoteSessionReference-DAt2R0UC.js → remoteSessionReference-DORvqUYQ.js} +1 -1
  140. package/dist/assets/{renderElectronMiniChatApp-C7YpH2qP.js → renderElectronMiniChatApp-DXKgwBat.js} +2 -2
  141. package/dist/assets/renderMobileApp-CKN6rWxR.js +17 -0
  142. package/dist/assets/{runtime-file-download-RzAqq2xr.js → runtime-file-download-CaeLqIEY.js} +1 -1
  143. package/dist/assets/{runtime-file-resource-COtIWnSi.js → runtime-file-resource-BGZ4tGr5.js} +1 -1
  144. package/dist/assets/{runtimeConfig-Byc5NYTD.js → runtimeConfig-BqUZF6Wt.js} +1 -1
  145. package/dist/assets/runtimeEndpointReset-Bu02gAs3.js +4 -0
  146. package/dist/assets/{scheduledTaskNavigation-DuM1gQ9g.js → scheduledTaskNavigation-r3g3DfXq.js} +1 -1
  147. package/dist/assets/{select-DxI3wkmK.js → select-BPIsJWhM.js} +1 -1
  148. package/dist/assets/{sessionLookup-UJH1iLm2.js → sessionLookup-DZhrkKRI.js} +1 -1
  149. package/dist/assets/{sessionOwnership-W4KQ8CbY.js → sessionOwnership-LoUNVeuJ.js} +1 -1
  150. package/dist/assets/{shortcuts-FWBXko6F.js → shortcuts-DMupfl7l.js} +1 -1
  151. package/dist/assets/{sortable-tabs-strip-Bq5JCAvR.js → sortable-tabs-strip-1bKw81VO.js} +1 -1
  152. package/dist/assets/{speechSettingsQueries-Cybc1zo2.js → speechSettingsQueries-C3JgzCqy.js} +1 -1
  153. package/dist/assets/src-BacdFOCS.css +2 -0
  154. package/dist/assets/{store-BRt8bo0A.js → store-BgsgBTwJ.js} +5 -5
  155. package/dist/assets/{switch-BDwSWOjd.js → switch-B4-v9kvg.js} +1 -1
  156. package/dist/assets/{terminalApi-BMMDklSX.js → terminalApi-wdwb9MVG.js} +1 -1
  157. package/dist/assets/{textarea-BshZJgqE.js → textarea-DExmj0ZR.js} +1 -1
  158. package/dist/assets/{timeFormat-7kWOlby7.js → timeFormat-BlSO2-ws.js} +1 -1
  159. package/dist/assets/{tooltip-Cdy71vjH.js → tooltip-Di-WRJUZ.js} +1 -1
  160. package/dist/assets/{truncated-path-YngMm0g8.js → truncated-path-nKzykV5p.js} +1 -1
  161. package/dist/assets/types-4xeqxklF.js +2 -0
  162. package/dist/assets/ui-BCYkB585.js +13 -0
  163. package/dist/assets/uk-BUSl_Y_1.js +15 -0
  164. package/dist/assets/useAppFontEffects-BCJPQstm.js +7 -0
  165. package/dist/assets/{useAssistantUIStore-LaS5RREA.js → useAssistantUIStore-BUWPTwNV.js} +1 -1
  166. package/dist/assets/{useDesktopWindowControlsLayout-Icn9KYUk.js → useDesktopWindowControlsLayout-BtpyMlOS.js} +1 -1
  167. package/dist/assets/{useDictation-C1sdxoEy.js → useDictation-4HBMkISY.js} +1 -1
  168. package/dist/assets/{useEffectiveDirectory-BnoYSkb7.js → useEffectiveDirectory-BYswRwIv.js} +1 -1
  169. package/dist/assets/useFontPreferences-C4dQT72k.js +1 -0
  170. package/dist/assets/{useGitStore-FAEWrkVE.js → useGitStore-DqBPgmf-.js} +1 -1
  171. package/dist/assets/{useInlineCommentDraftStore-CjyZgWKx.js → useInlineCommentDraftStore-CGJ6dM8d.js} +1 -1
  172. package/dist/assets/useMcpConfigStore-DEcxFuzW.js +1 -0
  173. package/dist/assets/{useMobileSwipeActions-3JgGyG-s.js → useMobileSwipeActions-DqlR4X-T.js} +1 -1
  174. package/dist/assets/useMobileTranscriptSyncHint-BDKcqtq_.js +10 -0
  175. package/dist/assets/{useModelLists-Cz7CBWNr.js → useModelLists-DsFTBlMr.js} +1 -1
  176. package/dist/assets/{useOpenCodeReadiness-DSTj-ijS.js → useOpenCodeReadiness-CHybAoBh.js} +1 -1
  177. package/dist/assets/usePluginsStore-BIBHPK4A.js +1 -0
  178. package/dist/assets/{useProjectGitActions-C0z5ldH7.js → useProjectGitActions-DeFcqi_O.js} +1 -1
  179. package/dist/assets/{useProjectGitStore-C6ZCDvmO.js → useProjectGitStore-JGZk-NCk.js} +1 -1
  180. package/dist/assets/{useProjectRuntimeAPIs-Fi6XrG43.js → useProjectRuntimeAPIs-BMBBtJB-.js} +1 -1
  181. package/dist/assets/{useQuotaStore-yM_EeU_A.js → useQuotaStore-C3qJTiD7.js} +1 -1
  182. package/dist/assets/{useSessionBtwStore-1yHVqSCf.js → useSessionBtwStore-D7P-pknd.js} +1 -1
  183. package/dist/assets/{useStreamingTextThrottle-BbawjMGN.js → useStreamingTextThrottle-CjWAE0oQ.js} +1 -1
  184. package/dist/assets/useTerminalStore-C_QzSEgP.js +1 -0
  185. package/dist/assets/{useUIStore-Dz0bOfkB.js → useUIStore-68ZPpgYA.js} +1 -1
  186. package/dist/assets/worktreeManager-pRvX5dQT.js +1 -0
  187. package/dist/assets/{worktreeSourceBranchPreference-BJrbhZ4m.js → worktreeSourceBranchPreference-B7d3RYcc.js} +1 -1
  188. package/dist/assets/zh-CN-BGKgQtWd.js +15 -0
  189. package/dist/assets/zh-TW-jM5lIKfe.js +15 -0
  190. package/dist/index.html +16 -16
  191. package/dist/mini-chat.html +16 -16
  192. package/dist/mobile.html +2 -2
  193. package/package.json +2 -1
  194. package/server/index.js +22 -10
  195. package/server/lib/assistants/DOCUMENTATION.md +11 -6
  196. package/server/lib/assistants/builtin-skills.js +19 -3
  197. package/server/lib/assistants/builtin-skills.test.js +17 -0
  198. package/server/lib/assistants/contact-tools.js +47 -3
  199. package/server/lib/assistants/contact-tools.test.js +59 -0
  200. package/server/lib/assistants/harness.js +5 -2
  201. package/server/lib/assistants/harness.test.js +1 -1
  202. package/server/lib/assistants/routes.js +1 -0
  203. package/server/lib/assistants/service.js +7 -2
  204. package/server/lib/assistants/yuri-tools.js +1 -1
  205. package/server/lib/assistants/yuri-tools.test.js +1 -1
  206. package/server/lib/gui-customization/DOCUMENTATION.md +32 -7
  207. package/server/lib/gui-customization/projects-client.mjs +1 -1
  208. package/server/lib/gui-customization/projects.js +6 -6
  209. package/server/lib/gui-customization/projects.test.js +13 -2
  210. package/server/lib/gui-customization/remote-connections-client.mjs +1 -1
  211. package/server/lib/gui-customization/remote-connections.js +7 -6
  212. package/server/lib/gui-customization/remote-connections.test.js +17 -0
  213. package/server/lib/gui-customization/session-skill.js +16 -4
  214. package/server/lib/gui-customization/session-skill.test.js +16 -0
  215. package/server/lib/gui-customization/skill/SKILL.md +2 -2
  216. package/server/lib/gui-customization/skill/references/deep-links.md +15 -11
  217. package/server/lib/gui-customization/skill/references/gui-api.md +50 -1
  218. package/server/lib/gui-customization/skill/references/projects.md +19 -0
  219. package/server/lib/gui-customization/skill/references/remote-connections.md +3 -0
  220. package/server/lib/gui-customization/skill-caller.js +18 -0
  221. package/server/lib/host-update/DOCUMENTATION.md +5 -0
  222. package/server/lib/host-update/cli.js +5 -2
  223. package/server/lib/host-update/cli.test.js +15 -2
  224. package/server/lib/opencode/DOCUMENTATION.md +2 -1
  225. package/server/lib/opencode/custom-provider.test.js +41 -0
  226. package/server/lib/opencode/feature-routes-runtime.js +20 -3
  227. package/server/lib/opencode/settings-helpers.js +5 -0
  228. package/server/lib/opencode/settings-helpers.test.js +10 -0
  229. package/server/lib/package-manager.js +14 -0
  230. package/server/lib/package-manager.test.js +7 -0
  231. package/server/lib/portable-installation.js +34 -0
  232. package/server/lib/portable-installation.test.js +38 -0
  233. package/server/lib/session-index/DOCUMENTATION.md +8 -0
  234. package/server/lib/session-index/adopt-unindexed-session.js +46 -0
  235. package/server/lib/session-index/adopt-unindexed-session.test.js +77 -0
  236. package/server/lib/session-index/event-ingest.js +14 -1
  237. package/server/lib/session-index/event-ingest.test.js +18 -0
  238. package/dist/assets/ArchivedSessionsDialog-DLZzsdyB.js +0 -1
  239. package/dist/assets/BusyDots-C2pMtufA.js +0 -4
  240. package/dist/assets/ChatView-CNNGCekk.js +0 -3
  241. package/dist/assets/MarkdownRenderer-GdoxOy4f.js +0 -2
  242. package/dist/assets/ScheduledTasksDialog-DY9GJF-s.js +0 -3
  243. package/dist/assets/TerminalView-B9AFgs54.js +0 -8
  244. package/dist/assets/device-gKeFQDLT.js +0 -2
  245. package/dist/assets/dialog-D9CkSNCA.css +0 -1
  246. package/dist/assets/es-BuXtFKUW.js +0 -15
  247. package/dist/assets/fr-BaZeffY9.js +0 -13
  248. package/dist/assets/host-CgzhgNKF.js +0 -1
  249. package/dist/assets/insertionBoundaries-DUMGOIsz.js +0 -1
  250. package/dist/assets/ja-CGVx5A8U.js +0 -15
  251. package/dist/assets/ko-C663nzbf.js +0 -15
  252. package/dist/assets/main-CSPEphQ0.js +0 -169
  253. package/dist/assets/main-VozcdE4o.js +0 -2
  254. package/dist/assets/miniChat-DuIhQwv6.js +0 -2
  255. package/dist/assets/mobile-zYF3NcbJ.js +0 -2
  256. package/dist/assets/openRemoteProjectSession-Dz9GJCUz.js +0 -1
  257. package/dist/assets/openSessionFromDeepLink-DHu8AmBy.js +0 -2
  258. package/dist/assets/pl-CeBOMwg9.js +0 -15
  259. package/dist/assets/platform-z1TeG-ky.js +0 -1
  260. package/dist/assets/pt-BR-r8268Pk6.js +0 -15
  261. package/dist/assets/pwa-Dc46OTi7.js +0 -2
  262. package/dist/assets/renderMobileApp-DkFS7I4O.js +0 -17
  263. package/dist/assets/runtimeEndpointReset-BOfBQwJk.js +0 -4
  264. package/dist/assets/src-DYCPWwUH.css +0 -2
  265. package/dist/assets/types-CjZZGQvx.js +0 -2
  266. package/dist/assets/ui-DeV7Us1B.js +0 -13
  267. package/dist/assets/uk-CeQ1XJ99.js +0 -15
  268. package/dist/assets/useAppFontEffects-CWZFjoHJ.js +0 -7
  269. package/dist/assets/useFontPreferences-CLUZvRho.js +0 -1
  270. package/dist/assets/useMcpConfigStore-n8Iyj2v9.js +0 -1
  271. package/dist/assets/useMobileTranscriptSyncHint-CgAaYuLF.js +0 -10
  272. package/dist/assets/usePluginsStore-CsChIifx.js +0 -1
  273. package/dist/assets/worktreeManager-XchvRN9O.js +0 -1
  274. package/dist/assets/zh-CN-Bv854olO.js +0 -15
  275. package/dist/assets/zh-TW-gx8cO-Cx.js +0 -15
@@ -0,0 +1,3 @@
1
+ import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n}from"./runtime-switch-DEPKHgdL.js";import{s as r,z as i}from"./platform-B2ylz14u.js";import{o as a}from"./vendor-zustand-CTekDqaS.js";import{ot as o,st as s}from"./vendor-base-ui-wXsskyKm.js";import{Lt as c,n as l}from"./client-CmtAKi5B.js";import{n as u}from"./pathNormalization-ewtPqJWn.js";import{n as d}from"./vendor-react-BkccXcWz.js";import{o as f,s as p,u as m}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as h,G as g,O as _}from"./runtime-file-resource-BGZ4tGr5.js";import{h as v,r as y,u as b}from"./vendor-reactuses-core-DjKFMfz7.js";import{n as x,r as S,t as C}from"./useUIStore-68ZPpgYA.js";import{r as w}from"./vendor-sonner-DX3nfJx4.js";import{$r as T,Ga as E,Ha as D,U as O,W as k,Xn as A,Y as j,ar as M,dr as N,f as P,gn as ee,io as F,mn as te,mr as ne,ot as I,ro as L}from"./ui-BCYkB585.js";import{n as R}from"./Icon-C1rjS64C.js";import{t as z}from"./i18n-iu4pzqPi.js";import{n as B}from"./react-CPBNl-S9.js";import{n as re}from"./useEffectiveDirectory-BYswRwIv.js";import{n as V}from"./useProjectRuntimeAPIs-BMBBtJB-.js";import{a as ie,o as ae,r as oe,s as H}from"./useProjectGitStore-JGZk-NCk.js";import{t as U}from"./AgentAvatar-BOvjZ-DI.js";import{i as W,n as se,r as ce,t as G}from"./card-aoveY4I3.js";import{g as K,h as q,m as le,t as ue,v as J}from"./ChatContainer-Dgv075jT.js";import{f as Y,g as X,h as de,m as fe,p as pe}from"./ToolOutputDialog-QJpQjmqK.js";import{t as me}from"./useTerminalStore-C_QzSEgP.js";var Z=d(),Q=t(s(),1),$=o(),he=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t})}handleReset=()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})};render(){return this.state.hasError?(0,$.jsx)(`div`,{className:`flex items-center justify-center min-h-screen p-4`,children:(0,$.jsxs)(G,{className:`w-full max-w-md`,children:[(0,$.jsx)(ce,{className:`text-center`,children:(0,$.jsxs)(W,{className:`flex items-center justify-center gap-2 text-destructive`,children:[(0,$.jsx)(R,{name:`chat-3`,className:`h-5 w-5`}),this.props.texts.title]})}),(0,$.jsxs)(se,{className:`space-y-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground text-center`,children:this.props.texts.description}),this.props.sessionId&&(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground text-center`,children:[this.props.texts.sessionLabel,`: `,this.props.sessionId]}),this.state.error&&(0,$.jsxs)(`details`,{className:`text-xs font-mono bg-muted p-3 rounded`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer hover:bg-interactive-hover/80`,children:this.props.texts.detailsSummary}),(0,$.jsx)(`pre`,{className:`mt-2 max-h-48 overflow-auto`,children:this.state.error.toString()})]}),(0,$.jsx)(`div`,{className:`flex gap-2`,children:(0,$.jsxs)(A,{onClick:this.handleReset,variant:`outline`,className:`flex-1`,children:[(0,$.jsx)(R,{name:`restart`,className:`h-4 w-4 mr-2`}),this.props.texts.resetAction]})}),(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground text-center`,children:this.props.texts.persistentHint})]})]})}):this.props.children}};function ge(e){let t=(0,Z.c)(22),{t:n}=z(),r;t[0]===n?r=t[1]:(r=n(`chat.errorBoundary.title`),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=n(`chat.errorBoundary.description`),t[2]=n,t[3]=i);let a;t[4]===n?a=t[5]:(a=n(`chat.errorBoundary.sessionLabel`),t[4]=n,t[5]=a);let o;t[6]===n?o=t[7]:(o=n(`chat.errorBoundary.detailsSummary`),t[6]=n,t[7]=o);let s;t[8]===n?s=t[9]:(s=n(`chat.errorBoundary.resetAction`),t[8]=n,t[9]=s);let c;t[10]===n?c=t[11]:(c=n(`chat.errorBoundary.persistentHint`),t[10]=n,t[11]=c);let l;t[12]!==r||t[13]!==i||t[14]!==a||t[15]!==o||t[16]!==s||t[17]!==c?(l={title:r,description:i,sessionLabel:a,detailsSummary:o,resetAction:s,persistentHint:c},t[12]=r,t[13]=i,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l):l=t[18];let u;return t[19]!==e||t[20]!==l?(u=(0,$.jsx)(he,{...e,texts:l}),t[19]=e,t[20]=l,t[21]=u):u=t[21],u}var _e=1440,ve=e=>{let t=(0,Z.c)(10),{isMobile:n,isVSCode:r,directory:i}=e,a=b(`(min-width: ${_e}px)`),o;t[0]===i?o=t[1]:(o=i?x(i):``,t[0]=i,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c=e=>{let t=C(e,s);return t?.isOpen?(t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[t.tabs.length-1]??null)?.mode!==`chat`:!1},t[2]=s,t[3]=c);let l=S(c),u=S(ye),d;t[4]===s?d=t[5]:(d=e=>e.isRightSidebarOpen&&!!C(e,s)?.isOpen,t[4]=s,t[5]=d);let f=S(d),p=!n&&!r&&!l&&!f,m=p&&a,h=u&&m,g;return t[6]!==m||t[7]!==p||t[8]!==h?(g={visible:h,fits:m,layoutAllows:p},t[6]=m,t[7]=p,t[8]=h,t[9]=g):g=t[9],g};function ye(e){return e.workStatusPanelEnabled}var be=async({directory:e,sessionID:t,signal:n})=>{let r=await l.getScopedSdkClient(e).session.list({directory:e,parentID:t,limit:200},{signal:n});if(!Array.isArray(r?.data))throw Error(`session.list children returned no data`);return r.data.flatMap(e=>{if(!e?.id)return[];let t=typeof e.title==`string`?e.title:void 0;return[{id:e.id,title:t}]})},xe=(e,t,n={})=>{let r=n.entry,i=n.listChildren??(r?async({directory:e,sessionID:t,signal:n})=>{let i=await r.sdk().session.list({directory:e,parentID:t,limit:200},{signal:n});if(r.sdk(),!Array.isArray(i?.data))throw Error(`session.list children returned no data`);return i.data.map(e=>({id:e.id,title:e.title}))}:be);return f({queryKey:[...g.workStatusChildren.list(e,t,n.transport),...r?.queryScope??[]],enabled:!!(e&&t),queryFn:({signal:n})=>i({directory:e,sessionID:t,signal:n}),staleTime:5e3,refetchInterval:1e4})},Se=[],Ce=(...e)=>{let t=K(...e);return t?t.charAt(0).toUpperCase()+t.slice(1):``},we=(...e)=>{for(let t of e){if(!t||typeof t!=`object`)continue;let e=t.description;if(typeof e!=`string`)continue;let n=e.trim();if(n)return n}return``},Te=e=>e===`pending`||e===`running`,Ee=e=>{let t=[],n=new Set;for(let r of e.messageOrder){let i=e.partsByMessageID[r];if(i)for(let e of i){if(!e?.id||n.has(e.id))continue;if(e.type===`tool`&&le(e.tool)){n.add(e.id);let r=e.state;t.push({id:e.id,sessionID:q(e),label:Ce(r?.input,r?.metadata,e.metadata),description:we(r?.input,e.metadata,r?.metadata),running:Te(r?.status)});continue}if(e.type!==`subtask`)continue;let r=e,i=typeof r.taskSessionID==`string`?r.taskSessionID.trim():``,a=typeof r.agent==`string`?r.agent.trim():``,o=typeof r.description==`string`?r.description.trim():``;n.add(e.id),t.push({id:e.id,sessionID:i||void 0,label:a?a.charAt(0).toUpperCase()+a.slice(1):``,description:o,running:Te(r.status)})}}return t.length===0?Se:t},De=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.id!==i.id||r.sessionID!==i.sessionID||r.label!==i.label||r.description!==i.description||r.running!==i.running)return!1}return!0},Oe=e=>e.childTitle||e.description||e.agent,ke=e=>({key:e.key,sessionID:e.sessionID,seed:e.key,label:Oe(e),phase:e.working?`working`:`done`}),Ae=(e,t,n)=>{let r=new Map(t.map(e=>[e.id,e])),i=new Set,a=[],o=new Map,s=e=>{let t=e.sessionID;if(!t){a.push(e);return}i.add(t);let n=o.get(t);if(n===void 0){o.set(t,a.length),a.push({...e,key:t,sessionID:t});return}let r=a[n];r&&(a[n]={...r,description:r.description||e.description,agent:r.agent||e.agent,childTitle:e.childTitle||r.childTitle,working:r.working||e.working})};for(let t of e){let e=t.sessionID?r.get(t.sessionID):void 0;s({key:t.id,sessionID:t.sessionID,description:t.description,agent:t.label,childTitle:e?.title?.trim()||``,working:t.running||!!e?.busy||!!(t.sessionID&&n?.has(t.sessionID))})}for(let e of t)i.has(e.id)||s({key:e.id,sessionID:e.id,description:``,agent:``,childTitle:e.title?.trim()||``,working:e.busy});let c=a.map(ke),l=c.filter(e=>e.phase===`working`),u=c.filter(e=>e.phase===`done`);return l.length===0?u:u.length===0?l:[...l,...u]},je=new Set,Me=e=>{if(!e)return``;let t=[];for(let n of Object.keys(e)){let r=e[n]?.type;(r===`busy`||r===`retry`)&&t.push(n)}return t.sort(),t.join(`
2
+ `)},Ne=(e,t)=>{let n=(0,Z.c)(4),r;n[0]===t?r=n[1]:(r=e=>t?Me(e.session_status):``,n[0]=t,n[1]=r);let i=a(e,r),o;return n[2]===i?o=n[3]:(o=i?new Set(i.split(`
3
+ `)):je,n[2]=i,n[3]=o),o},Pe=(e,t)=>{let n=[];for(let r of e)!r.id||r.parentID!==t||n.push(`${r.id}\u0001${r.title??``}`);return n.join(``)},Fe=e=>e?e.split(``).map(e=>{let t=e.indexOf(``);return{id:e.slice(0,t),title:e.slice(t+1)}}):[],Ie=(e,t,n)=>{let r=new Map;for(let t of e)t.id&&r.set(t.id,{id:t.id,title:t.title,busy:n.has(t.id)});for(let e of t??[]){if(!e.id)continue;let t=r.get(e.id),i=e.title?.trim()||t?.title;r.set(e.id,{id:e.id,title:i,busy:n.has(e.id)})}return[...r.values()]},Le=(e,t)=>{let n=(0,Z.c)(18),r=!!(e&&t),i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={bootstrap:!1},n[0]=i):i=n[0];let o=O(t||void 0,i),s;n[1]!==r||n[2]!==e?(s=t=>r&&e?Pe(t.session,e):``,n[1]=r,n[2]=e,n[3]=s):s=n[3];let l=a(o,s),u=t??``,d=e??``,f;n[4]!==u||n[5]!==d?(f=xe(u,d),n[4]=u,n[5]=d,n[6]=f):f=n[6];let m;n[7]!==r||n[8]!==f?(m={...f,enabled:r},n[7]=r,n[8]=f,n[9]=m):m=n[9];let h=p(m),g;n[10]===r?g=n[11]:(g={enabled:r},n[10]=r,n[11]=g);let _=c(e??``,t??``,o,Ee,De,g),v=Ne(o,r),y;bb0:{if(!e){let e;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],n[12]=e):e=n[12],y=e;break bb0}let t;n[13]!==v||n[14]!==l||n[15]!==h.data||n[16]!==_?(t=Ae(_,Ie(Fe(l),h.data,v),v),n[13]=v,n[14]=l,n[15]=h.data,n[16]=_,n[17]=t):t=n[17],y=t}return y},Re=[],ze=e=>{let t=(0,Z.c)(11),{sessionId:n,directory:r}=e,i;t[0]===n?i=t[1]:(i=e=>(n?e.todo[n]:void 0)??Re,t[0]=n,t[1]=i);let a=k(i,r??void 0),o;t[2]===n?o=t[3]:(o=e=>{let t=n?e.session_status?.[n]?.type:void 0;return t===`busy`||t===`retry`},t[2]=n,t[3]=o);let s=k(o,r??void 0),c;t[4]===n?c=t[5]:(c=e=>n?e.sessions[n]?.todos:void 0,t[4]=n,t[5]=c);let l=ee(c),u=I(n??``,r??void 0)??(a.length>0?a:l??Re),d;t[6]===u?d=t[7]:(d=u.filter(He),t[6]=u,t[7]=d);let f=d,p;return t[8]!==s||t[9]!==f?(p=(0,$.jsx)(Ve,{todos:f,isWorking:s}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p},Be=e=>{let t=(0,Z.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({remote:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=r?(0,$.jsx)(Ve,{...r}):(0,$.jsx)(ze,{...n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i},Ve=e=>{let t=(0,Z.c)(52),{todos:n,isWorking:r}=e,{t:i}=z(),a=Q.useId(),[o,s]=Q.useState(!0),[c,l]=Q.useState(!1),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{l(!0)},d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),Q.useEffect(u,d);let f;t[2]===n?f=t[3]:(f=n.filter(Ue),t[2]=n,t[3]=f);let p=f.length,m;t[4]===n?m=t[5]:(m=n.filter(X),t[4]=n,t[5]=m);let h=m.length,g=Q.useRef(null),_=n.findIndex(We),v,y;if(t[6]===_?(v=t[7],y=t[8]):(v=()=>{_<0||g.current?.children[_]?.scrollIntoView?.({block:`nearest`})},y=[_],t[6]=_,t[7]=v,t[8]=y),Q.useEffect(v,y),n.length===0)return null;let b=h===n.length,x=r&&!b,S;t[9]===i?S=t[10]:(S=i(`chat.workStatus.todos.title`),t[9]=i,t[10]=S);let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>s(Ge),t[11]=C):C=t[11];let w=b?`done`:`open`,T=c&&`yuri-todo-icon-pop`,E;t[12]===T?E=t[13]:(E=F(`inline-flex shrink-0`,T),t[12]=T,t[13]=E);let D;t[14]!==b||t[15]!==p||t[16]!==x||t[17]!==n.length?(D=b?(0,$.jsx)(Y,{}):(0,$.jsx)(de,{done:p,total:n.length,spinning:x}),t[14]=b,t[15]=p,t[16]=x,t[17]=n.length,t[18]=D):D=t[18];let O;t[19]!==E||t[20]!==D||t[21]!==w?(O=(0,$.jsx)(`span`,{className:E,children:D},w),t[19]=E,t[20]=D,t[21]=w,t[22]=O):O=t[22];let k;t[23]===i?k=t[24]:(k=i(`chat.workStatus.todos.title`),t[23]=i,t[24]=k);let j;t[25]===k?j=t[26]:(j=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:k}),t[25]=k,t[26]=j);let M;t[27]!==p||t[28]!==n.length?(M=(0,$.jsx)(pe,{done:p,total:n.length,className:`text-[0.92em]`}),t[27]=p,t[28]=n.length,t[29]=M):M=t[29];let N;t[30]!==o||t[31]!==a||t[32]!==O||t[33]!==j||t[34]!==M?(N=(0,$.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,className:`yuri-work-status-action flex w-full min-w-0 items-center justify-start gap-2 px-2 text-left text-[1em] font-normal leading-5 tracking-normal text-muted-foreground [&_svg]:size-3.5`,"aria-expanded":o,"aria-controls":a,onClick:C,children:[O,j,M]}),t[30]=o,t[31]=a,t[32]=O,t[33]=j,t[34]=M,t[35]=N):N=t[35];let P=!o,ee=!o,te=o?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,ne;t[36]===te?ne=t[37]:(ne=F(`grid min-w-0 transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,te),t[36]=te,t[37]=ne);let I;t[38]!==r||t[39]!==c||t[40]!==n?(I=(0,$.jsx)(fe,{id:void 0,todos:n,isWorking:r,animate:c,listRef:g,rowClassName:`px-2 gap-2 [&_svg]:size-3.5 [&>span:first-child]:w-3.5`,className:`max-h-[15em] min-h-0 overflow-y-auto pt-[0.125em]`}),t[38]=r,t[39]=c,t[40]=n,t[41]=I):I=t[41];let L;t[42]!==a||t[43]!==P||t[44]!==ee||t[45]!==ne||t[46]!==I?(L=(0,$.jsx)(`div`,{id:a,"aria-hidden":P,inert:ee,className:ne,children:I}),t[42]=a,t[43]=P,t[44]=ee,t[45]=ne,t[46]=I,t[47]=L):L=t[47];let R;return t[48]!==N||t[49]!==L||t[50]!==S?(R=(0,$.jsxs)(`div`,{role:`group`,"aria-label":S,className:`mt-2 flex min-w-0 flex-col text-[13px]`,children:[N,L]}),t[48]=N,t[49]=L,t[50]=S,t[51]=R):R=t[51],R};function He(e){return e.content.length>0}function Ue(e){return e.status===`completed`}function We(e){return e.status===`in_progress`}function Ge(e){return!e}var Ke=Q.memo(function(e){let t=(0,Z.c)(19),{host:n,entry:r,input:i}=e,a=Q.useRef(null),o=Q.useRef(null),s;t[0]!==r||t[1]!==n||t[2]!==i?(s=e=>n.mountWorkStatus(r,e,i),t[0]=r,t[1]=n,t[2]=i,t[3]=s):s=t[3];let c=y(s),l;t[4]===c?l=t[5]:(l=()=>{if(!a.current)return;let e=c(a.current);return o.current=e,()=>{o.current=null,e.dispose()}},t[4]=c,t[5]=l);let u;t[6]!==r.generation||t[7]!==r.key||t[8]!==n||t[9]!==i.directory||t[10]!==i.scope||t[11]!==i.sessionId||t[12]!==c?(u=[n,r.key,r.generation,i.sessionId,i.directory,i.scope,c],t[6]=r.generation,t[7]=r.key,t[8]=n,t[9]=i.directory,t[10]=i.scope,t[11]=i.sessionId,t[12]=c,t[13]=u):u=t[13],Q.useLayoutEffect(l,u);let d,f;t[14]===i?(d=t[15],f=t[16]):(d=()=>{o.current?.update(i)},f=[i],t[14]=i,t[15]=d,t[16]=f),Q.useLayoutEffect(d,f);let p;return t[17]===r.key?p=t[18]:(p=(0,$.jsx)(`div`,{ref:a,"data-gui-plugin-mount":`work-status`,"data-gui-work-status":r.key,className:`min-w-0 empty:hidden`}),t[17]=r.key,t[18]=p),p}),qe=Q.memo(function(e){let t=(0,Z.c)(9),{host:n,input:r}=e,i=Q.useSyncExternalStore(n.workStatus.subscribe,n.workStatus.getSnapshot,n.workStatus.getSnapshot),a;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>(0,$.jsx)(Ke,{host:n,entry:e,input:r},e.key),t[4]=n,t[5]=r,t[6]=e):e=t[6],a=i.map(e),t[0]=i,t[1]=n,t[2]=r,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,$.jsx)($.Fragment,{children:a}),t[7]=a,t[8]=o),o}),Je=Q.memo(function(e){let t=(0,Z.c)(3),{input:n}=e,r=Q.useContext(B),i;return t[0]!==r||t[1]!==n?(i=r?(0,$.jsx)(qe,{host:r,input:n}):null,t[0]=r,t[1]=n,t[2]=i):i=t[2],i}),Ye=[],Xe=(e,t)=>{let n=u(e),r=u(t);return!!(n&&r&&(n===r||n.startsWith(`${r}/`)))};function Ze(e){let t=(0,Z.c)(103),n=h();if(!n?.entry.location.hostId)throw Error(`Remote work status requires Host scope`);let{entry:r,registry:i}=n,{directory:a,hubId:o}=r.location,s=r.location.hostId,c;t[0]!==r||t[1]!==i?(c=N(i,r),t[0]=r,t[1]=i,t[2]=c):c=t[2];let l=c,d,g;t[3]===l?(d=t[4],g=t[5]):(d=()=>l.retain(),g=[l],t[3]=l,t[4]=d,t[5]=g),Q.useEffect(d,g);let[v,y]=Q.useState(),b;t[6]!==l.state||t[7]!==e?(b=()=>e?l.state.observe(e,y):void 0,t[6]=l.state,t[7]=e,t[8]=b):b=t[8];let x;t[9]!==l||t[10]!==e?(x=[l,e],t[9]=l,t[10]=e,t[11]=x):x=t[11],Q.useEffect(b,x);let S;t[12]!==l.state||t[13]!==e?(S=t=>e?l.state.repository.subscribe(l.state.scope(e),t):rt,t[12]=l.state,t[13]=e,t[14]=S):S=t[14];let C=S,w;t[15]!==l.state||t[16]!==e?(w=()=>e?l.state.repository.getTranscript(l.state.scope(e)):null,t[15]=l.state,t[16]=e,t[17]=w):w=t[17];let T=w,O=Q.useSyncExternalStore(C,T,T),k=l.state.subscribeSnapshot,A;t[18]!==l.state||t[19]!==e?(A=()=>l.state.getSnapshot(e??``),t[18]=l.state,t[19]=e,t[20]=A):A=t[20];let j=A,P=Q.useSyncExternalStore(k,j,j),ee=D(nt),F=E(tt),I;t[21]===r?I=t[22]:(I=M(r),t[21]=r,t[22]=I);let L=I,R=ae(et),z;if(t[23]!==a||t[24]!==r.queryScope||t[25]!==L){let e;t[27]!==a||t[28]!==L?(e=()=>L.listGitWorktrees(a),t[27]=a,t[28]=L,t[29]=e):e=t[29],z=f({queryKey:[...r.queryScope,`work-status`,`worktrees`],queryFn:e,staleTime:3e4}),t[23]=a,t[24]=r.queryScope,t[25]=L,t[26]=z}else z=t[26];let B=z,re;t[30]===r?re=t[31]:(re=ne(r),t[30]=r,t[31]=re);let V=re,ie=e??``,oe;t[32]!==a||t[33]!==r||t[34]!==ie?(oe=xe(a,ie,{entry:r}),t[32]=a,t[33]=r,t[34]=ie,t[35]=oe):oe=t[35];let H=oe,U=p(B),W=p(V),se=!!e,ce;t[36]!==H||t[37]!==se?(ce={...H,enabled:se},t[36]=H,t[37]=se,t[38]=ce):ce=t[38];let G=p(ce),K=m(),q;t[39]!==H||t[40]!==K||t[41]!==a||t[42]!==R||t[43]!==L||t[44]!==V||t[45]!==B?(q=async()=>{await Promise.all([K.fetchQuery({...B,staleTime:0}),K.fetchQuery({...V,staleTime:0}),K.fetchQuery({...H,staleTime:0}),R(a,L,{silent:!0})]),y(void 0)},t[39]=H,t[40]=K,t[41]=a,t[42]=R,t[43]=L,t[44]=V,t[45]=B,t[46]=q):q=t[46],_(e,q,y);let le,ue;t[47]!==H.queryKey||t[48]!==K||t[49]!==a||t[50]!==R||t[51]!==L||t[52]!==s||t[53]!==i||t[54]!==V.queryKey||t[55]!==B.queryKey?(le=()=>i.subscribeEvents(s,e=>{if(e.directory&&u(e.directory)!==u(a))return;let t=e.payload?.type??``;t.startsWith(`session.`)&&!t.startsWith(`session.message.`)&&!t.startsWith(`session.tool.`)&&(/status|execution|retry|idle/.test(t)&&K.invalidateQueries({queryKey:V.queryKey}),/created|updated|renamed|deleted/.test(t)&&K.invalidateQueries({queryKey:H.queryKey})),t.startsWith(`worktree.`)||t===`vcs.branch.updated`?(K.invalidateQueries({queryKey:B.queryKey}),R(a,L,{silent:!0})):/^session\.(execution\.(succeeded|failed|interrupted)|idle)$/.test(t)&&R(a,L,{silent:!0})}),ue=[i,s,a,K,V.queryKey,H.queryKey,B.queryKey,R,L],t[47]=H.queryKey,t[48]=K,t[49]=a,t[50]=R,t[51]=L,t[52]=s,t[53]=i,t[54]=V.queryKey,t[55]=B.queryKey,t[56]=le,t[57]=ue):(le=t[56],ue=t[57]),Q.useEffect(le,ue);let J;if(t[58]!==a||t[59]!==s||t[60]!==o||t[61]!==ee||t[62]!==F||t[63]!==U.data){bb0:{let e;t[65]!==s||t[66]!==o?(e=e=>e.hostId===s&&e.hubId===o,t[65]=s,t[66]=o,t[67]=e):e=t[67];let n=ee.filter(e),r=F&&F.location.hostId===s&&F.location.hubId===o?n.find(e=>e.id===F.projectId):void 0;if(r){J=r;break bb0}let i;t[68]!==a||t[69]!==U.data?(i=e=>Xe(a,e.path)||U.data?.some(t=>u(t.path)===u(e.path)),t[68]=a,t[69]=U.data,t[70]=i):i=t[70],J=n.filter(i).sort($e)[0]}t[58]=a,t[59]=s,t[60]=o,t[61]=ee,t[62]=F,t[63]=U.data,t[64]=J}else J=t[64];let Y=J,X;t[71]!==a||t[72]!==Y?.path||t[73]!==U.data?(X=()=>{let e=U.data?.filter(e=>Xe(a,e.path)).sort(Qe)[0];if(e)return{...e,projectDirectory:Y?.path??a,label:e.name,worktreeStatus:`ready`}},t[71]=a,t[72]=Y?.path,t[73]=U.data,t[74]=X):X=t[74],Y?.path;let de;t[75]===X?de=t[76]:(de=X(),t[75]=X,t[76]=de);let fe=de,pe;if(t[77]!==G.data||t[78]!==W.data||t[79]!==O){let e;t[81]===W.data?e=t[82]:(e=W.data??{},t[81]=W.data,t[82]=e);let n=new Set(Object.keys(e));pe=Ae(O?Ee(O):[],(G.data??[]).map(e=>({...e,busy:n.has(e.id)})),n),t[77]=G.data,t[78]=W.data,t[79]=O,t[80]=pe}else pe=t[80];let me=pe,$;t[83]!==P.session?.revert?.messageID||t[84]!==P.status?.type||t[85]!==O?($=()=>({todos:(O?te(O,P.session?.revert?.messageID):void 0)??Ye,isWorking:P.status?.type===`busy`||P.status?.type===`retry`}),t[83]=P.session?.revert?.messageID,t[84]=P.status?.type,t[85]=O,t[86]=$):$=t[86],P.session?.revert?.messageID;let he;t[87]===$?he=t[88]:(he=$(),t[87]=$,t[88]=he);let ge=he,_e;t[89]!==G||t[90]!==l.state||t[91]!==e||t[92]!==W||t[93]!==U?(_e=async()=>{y(void 0),await Promise.allSettled([U.refetch(),W.refetch(),G.refetch(),e?l.state.refreshMetadata(e):Promise.resolve()])},t[89]=G,t[90]=l.state,t[91]=e,t[92]=W,t[93]=U,t[94]=_e):_e=t[94];let ve=_e,ye=v??U.error??W.error??G.error,be;return t[95]!==r.key||t[96]!==Y||t[97]!==ge||t[98]!==ve||t[99]!==me||t[100]!==ye||t[101]!==fe?(be={project:Y,worktree:fe,subagents:me,remoteTodos:ge,stateKey:r.key,error:ye,retry:ve},t[95]=r.key,t[96]=Y,t[97]=ge,t[98]=ve,t[99]=me,t[100]=ye,t[101]=fe,t[102]=be):be=t[102],be}function Qe(e,t){return t.path.length-e.path.length}function $e(e,t){return t.path.length-e.path.length}function et(e){return e.fetchStatus}function tt(e){return e.remoteSession}function nt(e){return e.projects}function rt(){}function it(e,t){return f({queryKey:g.workStatusShell.info(e,t),queryFn:async({signal:n})=>{let r=(await l.getScopedSdkClient(e).shell.get({id:t,location:{directory:e}},{signal:n}))?.data;if(!r||typeof r.command!=`string`)throw Error(`shell.get returned no data`);return{command:r.command,status:r.status,exit:r.exit}},staleTime:3e4})}function at(e){return p(it(e.directory,e.id)).data?.command}var ot=Q.memo(function(e){let t=(0,Z.c)(10),{shell:n,onOpen:r}=e,{t:i}=z(),a=at(n)??i(`chat.workStatus.shell.untitled`),o;t[0]!==a||t[1]!==r||t[2]!==n?(o=()=>r(n,a),t[0]=a,t[1]=r,t[2]=n,t[3]=o):o=t[3];let s=y(o),c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(R,{name:`terminal`,className:`size-3.5 shrink-0`}),t[4]=c):c=t[4];let l;t[5]===a?l=t[6]:(l=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,title:a,children:a}),t[5]=a,t[6]=l);let u;return t[7]!==s||t[8]!==l?(u=(0,$.jsxs)(A,{variant:`ghost`,size:`sm`,className:`yuri-work-status-action flex w-full min-w-0 items-center justify-start gap-2 text-left text-[12px] font-normal leading-5 text-muted-foreground`,onClick:s,children:[c,l]}),t[7]=s,t[8]=l,t[9]=u):u=t[9],u}),st=[],ct=`flex w-full min-w-0 items-center justify-start gap-2 text-left text-[13px] font-normal leading-5 tracking-normal text-muted-foreground`,lt=`size-3.5 shrink-0`,ut=`yuri-work-status-action pointer-events-none shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/copy:pointer-events-auto group-hover/copy:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,dt=e=>e.split(/[\\/]/).filter(Boolean).pop()||e,ft=e=>{let t=(0,Z.c)(3),n=h(),r;return t[0]!==n||t[1]!==e?(r=n?.entry.location.hostId?(0,$.jsx)(pt,{...e},n.entry.key):(0,$.jsx)(mt,{...e}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r},pt=Q.memo(function(e){let t=(0,Z.c)(9),{t:n}=z(),r=Ze(e.sessionId),i;t[0]!==r||t[1]!==e?(i=(0,$.jsx)(ht,{...e,...r}),t[0]=r,t[1]=e,t[2]=i):i=t[2];let a;t[3]!==r||t[4]!==n?(a=r.error?(0,$.jsxs)(`div`,{role:`status`,className:`px-2 text-xs text-muted-foreground`,title:String(r.error),children:[n(`common.unavailable`),(0,$.jsx)(A,{variant:`ghost`,size:`xs`,onClick:()=>void r.retry(),children:n(`chat.history.retry`)})]}):null,t[3]=r,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==i||t[7]!==a?(o=(0,$.jsxs)($.Fragment,{children:[i,a]}),t[6]=i,t[7]=a,t[8]=o):o=t[8],o}),mt=e=>{let t=(0,Z.c)(21),{sessionId:n,directory:r}=e,i=D(gt),a=P(_t),o;t[0]===n?o=t[1]:(o=e=>n?e.worktreeMetadata.get(n):void 0,t[0]=n,t[1]=o);let s=P(o),c,l;if(t[2]!==a||t[3]!==r||t[4]!==i||t[5]!==s){let e=u(r),n=t=>{let n=u(t);return!!(e&&n&&(e===n||e.startsWith(`${n}/`)))},o=s&&n(s.path)?s:void 0;c=T(i.filter(vt),a,o?.projectDirectory||r);let d=c?a.get(c.path):void 0;l=o??d?.filter(e=>n(e.path)).sort(yt)[0],t[2]=a,t[3]=r,t[4]=i,t[5]=s,t[6]=c,t[7]=l}else c=t[6],l=t[7];let d=l,f;t[8]!==c||t[9]!==d?(f={project:c,worktree:d},t[8]=c,t[9]=d,t[10]=f):f=t[10];let{project:p,worktree:m}=f,h=Le(n,r),g=j(),_;bb0:{if(!n){let e;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[11]=e):e=t[11],_=e;break bb0}let e;t[12]!==g||t[13]!==n?(e=[...g].filter(e=>{let[,t]=e;return t.sessionID===n}).map(bt).sort(xt),t[12]=g,t[13]=n,t[14]=e):e=t[14],_=e}let v=_,y=p??void 0,b;return t[15]!==e||t[16]!==v||t[17]!==h||t[18]!==y||t[19]!==m?(b=(0,$.jsx)(ht,{...e,project:y,worktree:m,subagents:h,shells:v}),t[15]=e,t[16]=v,t[17]=h,t[18]=y,t[19]=m,t[20]=b):b=t[20],b},ht=({sessionId:e,directory:t,active:r=!0,placement:i=`inline`,project:a,worktree:o,subagents:s,shells:c=st,remoteTodos:l,stateKey:d})=>{let{t:f}=z(),{git:p}=V(),m=h(),g=m?.entry.location.hostId?m.entry:void 0,_=ae(e=>e.ensureStatus),b=ie(t),x=oe(t),C=H(t),T=a?.path||o?.projectDirectory||t,E=a?.label?.trim()||(T?dt(T):null),D=o&&u(o.path)!==u(T)?o.name?.trim()||dt(o.path):null,O=[{phase:`working`,labelKey:`chat.workStatus.subagent.workingCount`,items:s.filter(e=>e.phase===`working`)},{phase:`done`,labelKey:`chat.workStatus.subagent.doneCount`,items:s.filter(e=>e.phase===`done`)}],k=O[0].items,j=O.map(e=>({...e,count:e.items.length+(e.phase===`working`?c.length:0)})).filter(e=>e.count>0),M=(k.length>0?k:s).slice(0,3),[N,P]=Q.useState(!1),ee=Q.useId(),F=y((e,t)=>{me.getState().openShellTab(d??e.directory,{id:e.id,directory:e.directory,transport:n()},t),S.getState().setBottomTerminalOpen(!0)}),te=S(e=>e.setRightSidebarOpen),ne=S(e=>e.openContextPanel),I=S(e=>e.openContextPanelTab),B=S(e=>e.setRightSidebarTab),[re,W]=Q.useState(null),[,se]=v(()=>W(null),1500,{immediate:!1}),ce=y(async(e,t)=>{try{let n=await L(t);if(!n.ok)throw Error(n.error);W(e),se()}catch{w.error(f(`gitView.toast.copyFailed`))}});Q.useEffect(()=>{!t||!p||_(t,p)},[t,_,p]);let G=b?.current||null,K=o?.worktreeStatus===`pending`?0:b?.files.length??0,{additions:q,deletions:le}=Q.useMemo(()=>{let e=0,t=0;for(let n of Object.values(b?.diffStats??{}))e+=n?.insertions??0,t+=n?.deletions??0;return{additions:e,deletions:t}},[b?.diffStats]),ue=o?.worktreeStatus===`pending`,J=!ue&&!!b&&C!==!1,Y=ue?`unknown`:C===!1?`not-repository`:J?`ready`:`unknown`,X=J&&!!b?.diffStats,de=Q.useMemo(()=>({state:Y,loading:x,branch:J?G:null,changedFiles:J?K:null,additions:X?q:null,deletions:X?le:null}),[Y,x,J,G,K,X,q,le]),fe=Q.useMemo(()=>({sessionId:e,directory:t,placement:i,scope:g,project:T&&E?{id:a?.id,name:E,directory:T}:null,worktree:o?{name:o.name?.trim()||dt(o.path),directory:o.path}:null,git:de}),[e,t,i,g,T,E,a?.id,o,de]),pe=G?`branch:${G}`:``,Z=o?.path?`worktree:${o.path}`:``,he=!!(pe&&re===pe),ge=!!(Z&&re===Z),_e=y(()=>{G&&ce(pe,G)}),ve=y(()=>{let e=o?.path;e&&ce(Z,e)}),ye=y(()=>{t&&(ne(d??t),B(`git`),te(!0))});return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[E?(0,$.jsxs)(`div`,{className:`${ct} h-8 px-2`,title:`${f(`chat.workStatus.section.project`)}: ${T}`,children:[(0,$.jsx)(R,{name:`folder`,weight:`medium`,className:lt}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:E})]}):null,G?(0,$.jsxs)(`div`,{className:`${ct} group/copy h-8 px-2`,title:`${f(`gitView.branch.currentBranchTooltip`)}: ${G}`,children:[(0,$.jsx)(R,{name:`git-branch`,weight:`medium`,className:lt}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:G}),(0,$.jsx)(A,{variant:`ghost`,size:`xs`,className:ut,"aria-label":f(`chat.workStatus.action.copyBranch`),title:f(he?`contextSidebar.actions.copied`:`chat.workStatus.action.copyBranch`),onClick:_e,children:(0,$.jsx)(R,{name:he?`check`:`file-copy`,className:lt})})]}):null,D?(0,$.jsxs)(`div`,{className:`${ct} group/copy h-8 px-2`,title:`${f(`sessions.sidebar.sessionDialogs.worktree.label`)}: ${o?.path}`,children:[(0,$.jsx)(R,{name:`node-tree`,weight:`medium`,className:lt}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:D}),(0,$.jsx)(A,{variant:`ghost`,size:`xs`,className:ut,"aria-label":f(`agentManager.detail.actions.copyWorktreePath`),title:f(ge?`contextSidebar.actions.copied`:`agentManager.detail.actions.copyWorktreePath`),onClick:ve,children:(0,$.jsx)(R,{name:ge?`check`:`file-copy`,className:lt})})]}):null,K>0?(0,$.jsxs)(A,{variant:`ghost`,size:`sm`,className:`yuri-work-status-action ${ct}`,title:f(K===1?`chat.workStatus.git.changedFileSingle`:`chat.workStatus.git.changedFilePlural`,{count:K}),"aria-label":f(`chat.workStatus.action.openGit`),onClick:ye,children:[(0,$.jsx)(R,{name:`changes`,weight:`medium`,className:lt}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:f(`chat.workStatus.compact.changes`)}),q>0||le>0?(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 gap-1.5 text-[12px] tabular-nums`,children:[(0,$.jsx)(`span`,{className:`text-[var(--status-success)]`,children:`+${q}`}),(0,$.jsx)(`span`,{className:`text-[var(--status-error)]`,children:`−${le}`})]}):(0,$.jsx)(`span`,{className:`ml-auto tabular-nums`,children:K})]}):null,r?(0,$.jsx)(Je,{input:fe}):null,(0,$.jsx)(Be,{sessionId:e,directory:t,remote:l}),s.length+c.length>0?(0,$.jsxs)(`div`,{role:`group`,"aria-label":f(c.length>0?`chat.workStatus.section.background`:`chat.workStatus.section.subagents`),className:`flex min-w-0 flex-col`,children:[(0,$.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,className:`yuri-work-status-action ${ct} h-auto min-h-8 gap-1.5 py-1`,"aria-expanded":N,"aria-controls":ee,onClick:()=>P(e=>!e),children:[(0,$.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0 items-center`,children:[M.map((e,t)=>{let n=e.label.trim()||f(`chat.workStatus.subagent.untitled`);return(0,$.jsx)(U,{name:e.seed,label:n,size:14,className:`relative bg-background ring-2 ring-background ${t>0?`-ml-1`:``}`},e.key)}),s.length===0?(0,$.jsx)(R,{name:`terminal`,className:lt}):null]}),(0,$.jsx)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-1 text-left text-[11px] leading-5 tabular-nums`,children:j.map((e,t)=>(0,$.jsxs)(Q.Fragment,{children:[t>0?(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,(0,$.jsx)(`span`,{children:f(e.labelKey,{count:e.count})})]},e.phase))}),(0,$.jsx)(R,{name:N?`arrow-down-s`:`arrow-right-s`,className:`size-3.5 shrink-0 text-muted-foreground opacity-70`})]}),(0,$.jsx)(`div`,{id:ee,hidden:!N,className:N?`mt-1 mb-1 flex min-w-0 flex-col gap-1`:`hidden`,children:N?j.map(e=>(0,$.jsxs)(`section`,{"aria-label":f(e.labelKey,{count:e.count}),className:`flex min-w-0 flex-col gap-1 [&+section]:mt-2`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[11px] leading-4 text-muted-foreground/70`,children:f(e.labelKey,{count:e.count})}),e.items.map(e=>{let n=e.label.trim()||f(`chat.workStatus.subagent.untitled`);return(0,$.jsxs)(A,{variant:`ghost`,size:`sm`,disabled:!e.sessionID||!t,className:`yuri-work-status-action flex w-full min-w-0 items-center justify-start gap-2 text-left text-[12px] font-normal leading-5 text-muted-foreground`,onClick:()=>{!e.sessionID||!t||I(d??t,{mode:`chat`,dedupeKey:`session:${e.sessionID}`,label:n,readOnly:!0})},children:[(0,$.jsx)(U,{name:e.seed,label:n,size:14}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:n,children:n})]},e.key)}),e.phase===`working`?c.map(e=>(0,$.jsx)(ot,{shell:e,onOpen:F},e.id)):null]},e.phase)):null})]}):null]})};function gt(e){return e.projects}function _t(e){return e.availableWorktreesByProject}function vt(e){return!e.hostId}function yt(e,t){return t.path.length-e.path.length}function bt(e){let[t,n]=e;return{id:t,directory:n.directory,startedAt:n.startedAt}}function xt(e,t){return(e.startedAt??0)-(t.startedAt??0)}var St=200,Ct=264,wt=e=>{let t=(0,Z.c)(31),{sessionId:n,directory:r,visible:i,overlay:a}=e,o=a!==void 0&&a,{t:s}=z(),c=S(Tt),l=Q.useRef(null),[u,d]=Q.useState(i),f,p;t[0]===i?(f=t[1],p=t[2]):(f=()=>{if(i){d(!0);return}let e=window.setTimeout(()=>d(!1),St);return()=>window.clearTimeout(e)},p=[i],t[0]=i,t[1]=f,t[2]=p),Q.useEffect(f,p);let m,h;t[3]!==o||t[4]!==c||t[5]!==i?(m=()=>{if(!o||!i)return;let e=e=>{let t=e.target instanceof Element?e.target:null;l.current?.contains(t)||t?.closest(`[data-work-status-toggle]`)||c(!1)},t=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,t)}},h=[o,c,i],t[3]=o,t[4]=c,t[5]=i,t[6]=m,t[7]=h):(m=t[6],h=t[7]),Q.useEffect(m,h);let g;t[8]===s?g=t[9]:(g=s(`chat.workStatus.ariaLabel`),t[8]=s,t[9]=g);let _=!i,v=!i,y=o?`top-3 z-30 max-h-[calc(100%-1.5rem)] rounded-xl p-2 ${J}`:`top-2`,b;t[10]===y?b=t[11]:(b=F(`absolute z-20 flex max-h-[calc(100%-1rem)] flex-col overflow-x-hidden overflow-y-auto scrollbar-hidden bg-transparent`,y),t[10]=y,t[11]=b);let x=o?Ct:i?196:0,C=+!!i,w=i?`none`:o?`translateY(-6px)`:`translateX(24px)`,T=o?`opacity, transform`:`none`,E=i?void 0:`none`,D;t[12]!==x||t[13]!==C||t[14]!==w||t[15]!==T||t[16]!==E?(D={right:14,width:x,opacity:C,transform:w,transitionProperty:T,transitionDuration:`${St}ms`,transitionTimingFunction:`cubic-bezier(0.22, 1, 0.36, 1)`,pointerEvents:E},t[12]=x,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=D):D=t[17];let O;t[18]!==u||t[19]!==r||t[20]!==o||t[21]!==n||t[22]!==i?(O=i||o&&u?(0,$.jsx)(ft,{sessionId:n,directory:r,active:i,placement:o?`popover`:`inline`}):null,t[18]=u,t[19]=r,t[20]=o,t[21]=n,t[22]=i,t[23]=O):O=t[23];let k;return t[24]!==b||t[25]!==D||t[26]!==O||t[27]!==g||t[28]!==_||t[29]!==v?(k=(0,$.jsx)(`aside`,{ref:l,"aria-label":g,"aria-hidden":_,inert:v,className:b,style:D,children:O}),t[24]=b,t[25]=D,t[26]=O,t[27]=g,t[28]=_,t[29]=v,t[30]=k):k=t[30],k};function Tt(e){return e.setWorkStatusOverlayOpen}var Et=e({ChatView:()=>Ot}),Dt=e=>{let t=(0,Z.c)(10),{sessionId:n,directory:r,visible:i,overlay:a,publishVisible:o}=e,s=a!==void 0&&a,c=o!==void 0&&o,l=S(kt),u,d;t[0]!==c||t[1]!==l||t[2]!==i?(u=()=>{if(c)return l(i),()=>l(!1)},d=[c,l,i],t[0]=c,t[1]=l,t[2]=i,t[3]=u,t[4]=d):(u=t[3],d=t[4]),Q.useEffect(u,d);let f;return t[5]!==r||t[6]!==s||t[7]!==n||t[8]!==i?(f=(0,$.jsx)(wt,{overlay:s,visible:i,sessionId:n,directory:r}),t[5]=r,t[6]=s,t[7]=n,t[8]=i,t[9]=f):f=t[9],f},Ot=({readOnly:e=!1,active:t=!0,selectionOverride:n})=>{let a=h(),o=E(e=>e.remoteSession),s=n?.location??(a?.entry.location.hostId?a.entry.location:void 0),c=n?{...n,active:t,...s?{location:s,directory:n.directory??s.directory,sessionId:n.sessionId||(o&&r(o.location)===r(s)?o.sessionId:null)}:{}}:void 0,l=P(e=>e.currentSessionId),u=P(e=>e.currentSessionDirectory),d=P(e=>!!e.newSessionDraft?.open),f=P(e=>!!(e.newSessionDraft?.open&&e.newSessionDraft.pendingUserMessage&&(e.newSessionDraft.draftEstablishing||e.newSessionDraft.draftSubmitting))),p=re(),m=S(e=>e.isMobile),g=S(e=>e.isExpandedInput),_=i(),v=S(e=>e.workStatusPanelEnabled),y=S(e=>e.workStatusOverlayOpen),b=S(e=>e.setWorkStatusPanelFits),x=s&&o&&r(o.location)===r(s)?o:null,C=s?c?.sessionId??x?.sessionId??null:n?.sessionId??l,w=C,T=s?s.directory:n?.directory??u??p??null,{visible:D,fits:O,layoutAllows:k}=ve({isMobile:m,isVSCode:_,directory:s?r(s):T}),A=s?!!C:n?!!n.sessionId:d?f:!!C,j=t&&!m&&!_&&!g&&A,M=j&&D,N=j&&v&&!O&&y;return Q.useEffect(()=>(b(j&&O),()=>b(!1)),[O,j,b]),(0,$.jsxs)(`div`,{className:F(`relative h-full min-h-0 min-w-0`,M&&`yuri-chat-work-status-inline`),style:M?{"--yuri-work-status-reserve":`210px`}:void 0,children:[(0,$.jsx)(`div`,{className:`absolute inset-0 min-h-0 min-w-0`,children:(0,$.jsx)(ge,{sessionId:w||void 0,children:(0,$.jsx)(ue,{readOnly:e,active:t,explicitSession:c})})}),j&&k?(0,$.jsx)(Dt,{publishVisible:!0,visible:M,sessionId:C,directory:T}):null,j&&v&&!O?(0,$.jsx)(Dt,{overlay:!0,visible:N,sessionId:C,directory:T}):null]})};function kt(e){return e.setWorkStatusPanelVisible}export{Et as n,Ot as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-DEPKHgdL.js";import{ot as n,st as r}from"./vendor-base-ui-wXsskyKm.js";import{u as i}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{S as a,_ as o,x as s}from"./runtime-file-resource-COtIWnSi.js";import{r as c}from"./useUIStore-Dz0bOfkB.js";import{r as l}from"./vendor-sonner-DX3nfJx4.js";import{n as u}from"./Icon-C1m8PihJ.js";import{t as d}from"./i18n-CBCskgqa.js";import{n as f}from"./useEffectiveDirectory-BnoYSkb7.js";import{n as p}from"./useProjectRuntimeAPIs-Fi6XrG43.js";import{t as m}from"./diagram-COwAj2NM.js";var h=e(r(),1),g=n();function _(){let{t:e}=d(),{files:n}=p(),r=i(),_=f()??null,v=t(),[y,b]=h.useState(null),[x,S]=h.useState(``),C=h.useRef(null),w=h.useRef(!1),T=h.useRef(null),E=h.useRef(0),D=h.useRef(Promise.resolve()),O=c(e=>e.pendingDiagramFile),k=a({scopeDirectory:_,path:y},{enabled:!!y});if(y&&(T.current?.path!==y||T.current.transport!==v||T.current.scopeDirectory!==_)){let e=E.current+1;E.current=e,T.current={path:y,generation:e,transport:v,scopeDirectory:_}}h.useEffect(()=>(w.current=!0,()=>{w.current=!1,E.current+=1}),[]),h.useEffect(()=>{if(!O)return;let e=c.getState().consumePendingDiagramFile();if(e){let t=E.current+1;E.current=t,T.current={path:e,generation:t,transport:v,scopeDirectory:_},b(e)}},[_,O,v]),h.useEffect(()=>{let e=T.current;if(!(!e||e.path!==y||e.transport!==v||e.scopeDirectory!==_)){if(k.data!==void 0){S(k.data);return}k.isError&&S(``)}},[_,y,k.data,k.isError,v]);let A=h.useCallback(async()=>{let t=C.current?.getXml(),i=T.current,a=n?.writeFile;if(!y||!a||!t||t===x||i?.path!==y)return;let{path:c,generation:u,scopeDirectory:d,transport:f}=i,p=D.current.then(async()=>{try{if(!(await a(c,t))?.success)throw Error(e(`filesView.toast.writeFileFailed`));let n={scopeDirectory:d,path:c};await r.cancelQueries({queryKey:o(n,f),exact:!0}),s(r,n,f,t);let i=T.current;w.current&&i?.path===c&&i.generation===u&&i.transport===f&&i.scopeDirectory===d&&S(t)}catch(t){l.error(t instanceof Error?t.message:e(`filesView.toast.saveFailed`))}});D.current=p.catch(()=>void 0),await p},[y,n,r,e,x]),j=y?y.split(`/`).pop()||y:``;return y?k.isPending?(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-3`,children:(0,g.jsx)(u,{name:`loader-4`,className:`size-4 animate-spin`})}):(0,g.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/30 px-3 py-1.5`,children:[(0,g.jsx)(u,{name:`file`,className:`size-4 shrink-0 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`typography-ui text-muted-foreground truncate flex-1`,children:j}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>void A(),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:e(`filesView.diagram.saveDiagram`),children:(0,g.jsx)(u,{name:`save-3`,className:`size-4`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>c.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:e(`filesView.diagram.closeDiagramView`),children:(0,g.jsx)(u,{name:`close`,className:`size-4`})})]}),(0,g.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,g.jsx)(m,{ref:C,xml:x,className:`h-full`})})]}):(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-3`,children:(0,g.jsx)(`div`,{className:`typography-ui text-muted-foreground`,children:e(`filesView.editor.pickFileFromTree`)})})}export{_ as DiagramView};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-DEPKHgdL.js";import{ot as n,st as r}from"./vendor-base-ui-wXsskyKm.js";import{u as i}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{S as a,_ as o,x as s}from"./runtime-file-resource-BGZ4tGr5.js";import{r as c}from"./useUIStore-68ZPpgYA.js";import{r as l}from"./vendor-sonner-DX3nfJx4.js";import{n as u}from"./Icon-C1rjS64C.js";import{t as d}from"./i18n-iu4pzqPi.js";import{n as f}from"./useEffectiveDirectory-BYswRwIv.js";import{n as p}from"./useProjectRuntimeAPIs-BMBBtJB-.js";import{t as m}from"./diagram-DFv7Lh0h.js";var h=e(r(),1),g=n();function _(){let{t:e}=d(),{files:n}=p(),r=i(),_=f()??null,v=t(),[y,b]=h.useState(null),[x,S]=h.useState(``),C=h.useRef(null),w=h.useRef(!1),T=h.useRef(null),E=h.useRef(0),D=h.useRef(Promise.resolve()),O=c(e=>e.pendingDiagramFile),k=a({scopeDirectory:_,path:y},{enabled:!!y});if(y&&(T.current?.path!==y||T.current.transport!==v||T.current.scopeDirectory!==_)){let e=E.current+1;E.current=e,T.current={path:y,generation:e,transport:v,scopeDirectory:_}}h.useEffect(()=>(w.current=!0,()=>{w.current=!1,E.current+=1}),[]),h.useEffect(()=>{if(!O)return;let e=c.getState().consumePendingDiagramFile();if(e){let t=E.current+1;E.current=t,T.current={path:e,generation:t,transport:v,scopeDirectory:_},b(e)}},[_,O,v]),h.useEffect(()=>{let e=T.current;if(!(!e||e.path!==y||e.transport!==v||e.scopeDirectory!==_)){if(k.data!==void 0){S(k.data);return}k.isError&&S(``)}},[_,y,k.data,k.isError,v]);let A=h.useCallback(async()=>{let t=C.current?.getXml(),i=T.current,a=n?.writeFile;if(!y||!a||!t||t===x||i?.path!==y)return;let{path:c,generation:u,scopeDirectory:d,transport:f}=i,p=D.current.then(async()=>{try{if(!(await a(c,t))?.success)throw Error(e(`filesView.toast.writeFileFailed`));let n={scopeDirectory:d,path:c};await r.cancelQueries({queryKey:o(n,f),exact:!0}),s(r,n,f,t);let i=T.current;w.current&&i?.path===c&&i.generation===u&&i.transport===f&&i.scopeDirectory===d&&S(t)}catch(t){l.error(t instanceof Error?t.message:e(`filesView.toast.saveFailed`))}});D.current=p.catch(()=>void 0),await p},[y,n,r,e,x]),j=y?y.split(`/`).pop()||y:``;return y?k.isPending?(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-3`,children:(0,g.jsx)(u,{name:`loader-4`,className:`size-4 animate-spin`})}):(0,g.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/30 px-3 py-1.5`,children:[(0,g.jsx)(u,{name:`file`,className:`size-4 shrink-0 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`typography-ui text-muted-foreground truncate flex-1`,children:j}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>void A(),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:e(`filesView.diagram.saveDiagram`),children:(0,g.jsx)(u,{name:`save-3`,className:`size-4`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>c.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:e(`filesView.diagram.closeDiagramView`),children:(0,g.jsx)(u,{name:`close`,className:`size-4`})})]}),(0,g.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,g.jsx)(m,{ref:C,xml:x,className:`h-full`})})]}):(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-3`,children:(0,g.jsx)(`div`,{className:`typography-ui text-muted-foreground`,children:e(`filesView.editor.pickFileFromTree`)})})}export{_ as DiagramView};
@@ -1,6 +1,6 @@
1
- import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n}from"./runtime-switch-DEPKHgdL.js";import{n as r}from"./runtime-fetch-V-iMWR8t.js";import{ot as i,st as a}from"./vendor-base-ui-wXsskyKm.js";import{n as o}from"./client-i5Q82JUc.js";import{n as s}from"./vendor-react-BkccXcWz.js";import{s as c}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{G as l}from"./runtime-file-resource-COtIWnSi.js";import{o as u}from"./path-utils-jGozTg9d.js";import{r as d}from"./vendor-reactuses-core-DjKFMfz7.js";import{r as f}from"./useUIStore-Dz0bOfkB.js";import{a as p,d as m,f as h,u as g}from"./vendor-pierre-diffs-B0OmIhMO.js";import{Yn as _,ar as v,f as y,no as b,t as x,ut as S}from"./ui-DeV7Us1B.js";import{n as C}from"./Icon-C1m8PihJ.js";import{t as ee}from"./i18n-CBCskgqa.js";import{a as w,c as T}from"./toolHelpers-iEHVHQ9p.js";import{t as E}from"./ScrollableOverlay-DIkp2MKc.js";import{n as D}from"./MobileResizableSheet-CcOOlg4R.js";import{n as O}from"./mobileAppContext-BQgdTp5T.js";import{i as k,n as A,t as j}from"./tooltip-Cdy71vjH.js";import{n as M}from"./useInlineCommentDraftStore-CjyZgWKx.js";import{t as N}from"./truncated-path-YngMm0g8.js";import{r as te}from"./device-gKeFQDLT.js";import{a as ne,c as P,n as F,o as re,t as ie}from"./dropdown-menu-B_P1dDl7.js";import{n as I}from"./PierreDiffViewer-Dn1NIerc.js";import{n as ae,t as oe}from"./useProjectRuntimeAPIs-Fi6XrG43.js";import{a as se,o as L,r as ce,s as le}from"./useProjectGitStore-C6ZCDvmO.js";import{t as R}from"./LoadingImage-956pmYDm.js";import{t as ue}from"./DiffViewToggle-uJM3Jn3y.js";var z=t(a(),1),B=s(),de=64,fe=3,V=new Map,H=(e,t,n=fe)=>{let r=`${e}\0${n}\0${t}`,i=V.get(r);if(i)return V.delete(r),V.set(r,i),i;let a=pe(t),o=a?h(p(t,n),{oldFile:{name:e,contents:a.before},newFile:{name:e,contents:a.after}})??W(e):m(U(e,t))[0]?.files[0]??W(e);for(V.set(r,o);V.size>de;){let e=V.keys().next().value;if(!e)break;V.delete(e)}return o},U=(e,t)=>!t.trim()||t.startsWith(`diff --git `)||/^--- [^\n]*\r?\n\+\+\+ /m.test(t)?t:`Index: ${e}\n===================================================================\n--- ${e}\t\n+++ ${e}\t\n${t}`,pe=e=>{if(!e.startsWith(`diff --git `)&&!/^--- [^\n]*\t?\r?\n\+\+\+ [^\n]*\t?(?:\r?\n|$)/m.test(e))return;let t=[...e.matchAll(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@[^\n]*(?:\r?\n|$)/gm)];if(t.length!==1)return;let n=t[0],r=Number.parseInt(n[1]??``,10),i=Number.parseInt(n[2]??``,10);if(r>1||i>1||!Number.isFinite(r)||!Number.isFinite(i))return;let a=(n.index??0)+n[0].length,o=e.slice(a),s=[],c=[],l;for(let e of o.split(/\r?\n/)){if(e.startsWith(`diff --git `)||e.startsWith(`@@ `))break;if(e.startsWith(`\\`)){if(l===`-`||l===` `){let e=s.at(-1);e&&(e.newline=!1)}if(l===`+`||l===` `){let e=c.at(-1);e&&(e.newline=!1)}continue}if(e.startsWith(`-`)){s.push({text:e.slice(1),newline:!0}),l=`-`;continue}if(e.startsWith(`+`)){c.push({text:e.slice(1),newline:!0}),l=`+`;continue}e.startsWith(` `)&&(s.push({text:e.slice(1),newline:!0}),c.push({text:e.slice(1),newline:!0}),l=` `)}return{before:me(s),after:me(c)}},me=e=>e.map(e=>e.text+(e.newline?`
1
+ import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n}from"./runtime-switch-DEPKHgdL.js";import{n as r}from"./runtime-fetch-V-iMWR8t.js";import{ot as i,st as a}from"./vendor-base-ui-wXsskyKm.js";import{n as o}from"./client-CmtAKi5B.js";import{n as s}from"./vendor-react-BkccXcWz.js";import{s as c}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{G as l}from"./runtime-file-resource-BGZ4tGr5.js";import{o as u}from"./path-utils-jGozTg9d.js";import{r as d}from"./vendor-reactuses-core-DjKFMfz7.js";import{r as f}from"./useUIStore-68ZPpgYA.js";import{a as p,d as m,f as h,u as g}from"./vendor-pierre-diffs-B0OmIhMO.js";import{Xn as _,dt as v,f as y,io as b,or as x,t as S}from"./ui-BCYkB585.js";import{n as C}from"./Icon-C1rjS64C.js";import{t as ee}from"./i18n-iu4pzqPi.js";import{a as w,c as T}from"./toolHelpers-iEHVHQ9p.js";import{t as E}from"./ScrollableOverlay-CEglrXfm.js";import{n as D}from"./MobileResizableSheet-CkA7qhco.js";import{n as O}from"./mobileAppContext-BQgdTp5T.js";import{i as k,n as A,t as j}from"./tooltip-Di-WRJUZ.js";import{n as M}from"./useInlineCommentDraftStore-CGJ6dM8d.js";import{t as N}from"./truncated-path-nKzykV5p.js";import{r as te}from"./device-TCHW5U2y.js";import{a as ne,c as P,n as F,o as re,t as ie}from"./dropdown-menu-XdfySbu2.js";import{n as I}from"./PierreDiffViewer-CZk1tZ3K.js";import{n as ae,t as oe}from"./useProjectRuntimeAPIs-BMBBtJB-.js";import{a as se,o as L,r as ce,s as le}from"./useProjectGitStore-JGZk-NCk.js";import{t as R}from"./LoadingImage-Bs-621ZL.js";import{t as ue}from"./DiffViewToggle-CYusbmY5.js";var z=t(a(),1),B=s(),de=64,fe=3,V=new Map,H=(e,t,n=fe)=>{let r=`${e}\0${n}\0${t}`,i=V.get(r);if(i)return V.delete(r),V.set(r,i),i;let a=pe(t),o=a?h(p(t,n),{oldFile:{name:e,contents:a.before},newFile:{name:e,contents:a.after}})??W(e):m(U(e,t))[0]?.files[0]??W(e);for(V.set(r,o);V.size>de;){let e=V.keys().next().value;if(!e)break;V.delete(e)}return o},U=(e,t)=>!t.trim()||t.startsWith(`diff --git `)||/^--- [^\n]*\r?\n\+\+\+ /m.test(t)?t:`Index: ${e}\n===================================================================\n--- ${e}\t\n+++ ${e}\t\n${t}`,pe=e=>{if(!e.startsWith(`diff --git `)&&!/^--- [^\n]*\t?\r?\n\+\+\+ [^\n]*\t?(?:\r?\n|$)/m.test(e))return;let t=[...e.matchAll(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@[^\n]*(?:\r?\n|$)/gm)];if(t.length!==1)return;let n=t[0],r=Number.parseInt(n[1]??``,10),i=Number.parseInt(n[2]??``,10);if(r>1||i>1||!Number.isFinite(r)||!Number.isFinite(i))return;let a=(n.index??0)+n[0].length,o=e.slice(a),s=[],c=[],l;for(let e of o.split(/\r?\n/)){if(e.startsWith(`diff --git `)||e.startsWith(`@@ `))break;if(e.startsWith(`\\`)){if(l===`-`||l===` `){let e=s.at(-1);e&&(e.newline=!1)}if(l===`+`||l===` `){let e=c.at(-1);e&&(e.newline=!1)}continue}if(e.startsWith(`-`)){s.push({text:e.slice(1),newline:!0}),l=`-`;continue}if(e.startsWith(`+`)){c.push({text:e.slice(1),newline:!0}),l=`+`;continue}e.startsWith(` `)&&(s.push({text:e.slice(1),newline:!0}),c.push({text:e.slice(1),newline:!0}),l=` `)}return{before:me(s),after:me(c)}},me=e=>e.map(e=>e.text+(e.newline?`
2
2
  `:``)).join(``),W=e=>g({name:e,contents:``},{name:e,contents:``}),he=e=>{if(!e)return null;let t=e.split(`
3
3
  `),n=null;for(let e of t){let t=e.match(/^@@\s*-\d+(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s*@@/);if(t){let e=Number.parseInt(t[1]??``,10);n=Number.isFinite(e)&&e>=1?e:null;continue}if(n!==null){if(e.startsWith(` `)){n+=1;continue}if(e.startsWith(`+`))return n;if(e.startsWith(`-`))return Math.max(1,n)}}return null},G=e=>{let t=[],n=new Set;for(let r of e){let e=r.path.trim(),i=r.patch;if(!e||!i.trim()||n.has(e))continue;n.add(e);let a=0,o=0;for(let e of i.split(`
4
4
  `))e.startsWith(`+++`)||e.startsWith(`---`)||(e.startsWith(`+`)&&(a+=1),e.startsWith(`-`)&&(o+=1));let s=/^---\s+\/dev\/null(?:\s|$)/m.test(i)?`added`:/^\+\+\+\s+\/dev\/null(?:\s|$)/m.test(i)?`deleted`:`modified`;t.push({file:e,patch:i,status:s,additions:a,deletions:o})}return t},ge=e=>`${e.scope}:${e.navigationRequestKey??``}:${(e.targetFilePath??``).trim()}:${e.targetLine??``}`,_e=(e,t,n)=>n&&e!==t,ve=e=>`/api/yuri/sessions/${encodeURIComponent(e)}/changes`,ye=e=>e.trim(),be=e=>e===404||e===405||e===501,K=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.diff;return!!t&&typeof t==`object`&&!Array.isArray(t)},xe=(e,t)=>{if(!Array.isArray(e))return null;for(let n of e)if(n&&typeof n==`object`&&!Array.isArray(n)&&n.file===t)return n;return null},Se=async(e,t)=>{let n={messageID:e.messageID,directory:e.directory};return typeof e.file==`string`&&e.file.length>0&&(n.file=e.file),r(ve(e.sessionID),{method:`GET`,headers:{Accept:`application/json`,"x-opencode-directory":e.directory},query:n,signal:t})},Ce=async(e,t)=>{if(t.aborted)throw new DOMException(`Aborted`,`AbortError`);return o.getSessionDiff({sessionID:e.sessionID,directory:e.directory,messageID:e.messageID},{signal:t})},we=(e,t=n())=>l.sessionTurnChanges.file(e.directory,e.sessionID,e.messageID,e.file,e.diffCount,t),Te=(e,t=n())=>({queryKey:we(e,t),queryFn:async({signal:t})=>{let n=await Se(e,t);if(n.ok){let e=await n.json().catch(()=>null);if(K(e))return e}else if(!be(n.status))throw Error(`Session turn change file request failed (${n.status})`);let r=xe(await Ce(e,t),e.file);if(!r)throw Error(`change file not found`);return{diff:r}},staleTime:0,gcTime:6e4,retry:!1}),Ee=(e,t)=>{let r=(0,B.c)(10),i;r[0]===t?i=r[1]:(i=t===void 0?{}:t,r[0]=t,r[1]=i);let a=i,o,s,l;if(r[2]!==e||r[3]!==a){let t=n();o=!!e&&!!e?.sessionID?.trim()&&!!e?.directory?.trim()&&!!e?.messageID?.trim()&&!!e?.file?.trim()&&a.enabled!==!1;let i=e??{sessionID:``,directory:``,messageID:``,file:``};l=c,s=Te({...i,directory:ye(i.directory),file:i.file},t),r[2]=e,r[3]=a,r[4]=o,r[5]=s,r[6]=l}else o=r[4],s=r[5],l=r[6];let u;return r[7]!==o||r[8]!==s?(u={...s,enabled:o},r[7]=o,r[8]=s,r[9]=u):u=r[9],l(u)},De=e({DiffView:()=>it}),q=i(),Oe=1100,J=15e3,ke=500,Ae=300,je=1e6,Me=3,Ne=e=>e<=6?e:e<=12?6:e<=25?4:2,Pe=z.memo(()=>{let e=(0,B.c)(4),{t}=ee(),n;e[0]===t?n=e[1]:(n=t(`diffView.binary.unavailable`),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,q.jsx)(`div`,{className:`rounded-lg border border-border/60 bg-background px-3 py-2`,children:(0,q.jsx)(`div`,{className:`typography-meta text-muted-foreground`,children:n})}),e[2]=n,e[3]=r),r}),Fe={"?":{code:`?`,color:`var(--status-info)`,descriptionKey:`diffView.change.untracked`},A:{code:`A`,color:`var(--status-success)`,descriptionKey:`diffView.change.new`},D:{code:`D`,color:`var(--status-error)`,descriptionKey:`diffView.change.deleted`},R:{code:`R`,color:`var(--status-info)`,descriptionKey:`diffView.change.renamed`},C:{code:`C`,color:`var(--status-info)`,descriptionKey:`diffView.change.copied`},M:{code:`M`,color:`var(--status-warning)`,descriptionKey:`diffView.change.modified`}},Ie=Fe.M,Le=e=>{let t=e.index?.trim(),n=e.working_dir?.trim();return t&&t!==`?`?t.charAt(0):n?n.charAt(0):t?.charAt(0)||n?.charAt(0)||`M`},Re=e=>Fe[Le(e)]??Ie,ze=e=>{let{index:t,working_dir:n}=e;return t===`A`||n===`A`||t===`?`||n===`?`},Be=e=>{let t=e.index?.trim();return!!(t&&t!==`?`)},Ve=e=>!!e.working_dir?.trim()||e.index===`?`,He=(e,t)=>u(e,t),Ue=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/,``),We=(e,t)=>{let n=e.split(`
5
5
  `),r=t.split(`
6
- `),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1)if(n[e]!==r[e])return e+1;return r.length>n.length?n.length+1:n.length>r.length?Math.max(1,r.length):1},Ge=e=>/^Binary files .+ differ$/m.test(e)||/^GIT binary patch$/m.test(e),Ke=e=>Array.isArray(e)?e.filter(e=>!e||typeof e!=`object`?!1:typeof e.file==`string`):[],qe=e=>e===`added`?`A`:e===`deleted`?`D`:`M`,Je=e=>e.isBinary||typeof e.patch==`string`&&e.patch.length>0||e.fileDiff?!0:e.original.length>0||e.modified.length>0,Ye=(e,t,n)=>Ge(t)?{original:``,modified:``,isBinary:!0,patch:t,contextMode:n}:{original:``,modified:``,patch:t,fileDiff:H(e,t),contextMode:n},Xe=(e,t,n)=>{let r=e??0,i=t??0;return!r&&!i?null:(0,q.jsxs)(`span`,{className:b(`typography-code flex items-center gap-1 whitespace-nowrap`,n?.shrink?`min-w-0 overflow-hidden`:`flex-shrink-0`,n?.className),children:[r?(0,q.jsxs)(`span`,{style:{color:`var(--status-success)`},children:[`+`,r]}):null,i?(0,q.jsxs)(`span`,{style:{color:`var(--status-error)`},children:[`-`,i]}):null]})},Ze=z.memo(e=>{let t=(0,B.c)(53),{scope:n,workingCount:r,stagedCount:i,turnCount:a,onScopeChange:o}=e,{t:s}=ee(),[c,l]=z.useState(!1),u=n===`staged`?i:n===`turn`?a:r,d;t[0]!==n||t[1]!==s?(d=s(n===`staged`?`diffView.scope.staged`:n===`turn`?`diffView.scope.lastTurn`:`diffView.scope.changed`),t[0]=n,t[1]=s,t[2]=d):d=t[2];let f=d,p;t[3]===s?p=t[4]:(p=s(`diffView.scope.selectorAria`),t[3]=s,t[4]=p);let m;t[5]===u?m=t[6]:(m=(0,q.jsxs)(`span`,{className:`diff-toolbar__scope-count`,children:[`: `,u]}),t[5]=u,t[6]=m);let h;t[7]!==f||t[8]!==m?(h=(0,q.jsxs)(`span`,{className:`whitespace-nowrap`,children:[f,m]}),t[7]=f,t[8]=m,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,q.jsx)(C,{name:`arrow-down-s`,className:`size-4 flex-shrink-0 opacity-60`}),t[10]=g):g=t[10];let _;t[11]!==p||t[12]!==h?(_=(0,q.jsx)(P,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:`flex h-7 flex-shrink-0 items-center gap-1.5 rounded-md px-2 typography-code font-semibold text-foreground outline-none hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":p,children:[h,g]})}),t[11]=p,t[12]=h,t[13]=_):_=t[13];let v;t[14]===o?v=t[15]:(v=e=>{(e===`working`||e===`staged`||e===`turn`)&&(o?.(e),l(!1))},t[14]=o,t[15]=v);let y;t[16]===s?y=t[17]:(y=s(`diffView.scope.changed`),t[16]=s,t[17]=y);let b;t[18]===y?b=t[19]:(b=(0,q.jsx)(`span`,{children:y}),t[18]=y,t[19]=b);let x;t[20]===r?x=t[21]:(x=(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:r}),t[20]=r,t[21]=x);let S;t[22]!==x||t[23]!==b?(S=(0,q.jsx)(re,{value:`working`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-3`,children:[b,x]})}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let w;t[25]===s?w=t[26]:(w=s(`diffView.scope.staged`),t[25]=s,t[26]=w);let T;t[27]===w?T=t[28]:(T=(0,q.jsx)(`span`,{children:w}),t[27]=w,t[28]=T);let E;t[29]===i?E=t[30]:(E=(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:i}),t[29]=i,t[30]=E);let D;t[31]!==T||t[32]!==E?(D=(0,q.jsx)(re,{value:`staged`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-3`,children:[T,E]})}),t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]===s?O=t[35]:(O=s(`diffView.scope.lastTurn`),t[34]=s,t[35]=O);let k;t[36]===O?k=t[37]:(k=(0,q.jsx)(`span`,{children:O}),t[36]=O,t[37]=k);let A;t[38]===a?A=t[39]:(A=(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:a}),t[38]=a,t[39]=A);let j;t[40]!==k||t[41]!==A?(j=(0,q.jsx)(re,{value:`turn`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-3`,children:[k,A]})}),t[40]=k,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n||t[44]!==S||t[45]!==D||t[46]!==j||t[47]!==v?(M=(0,q.jsx)(F,{align:`start`,className:`w-40`,children:(0,q.jsxs)(ne,{value:n,onValueChange:v,children:[S,D,j]})}),t[43]=n,t[44]=S,t[45]=D,t[46]=j,t[47]=v,t[48]=M):M=t[48];let N;return t[49]!==c||t[50]!==M||t[51]!==_?(N=(0,q.jsxs)(ie,{open:c,onOpenChange:l,children:[_,M]}),t[49]=c,t[50]=M,t[51]=_,t[52]=N):N=t[52],N}),Qe=z.memo(e=>{let t=(0,B.c)(11),{changedFiles:n,selectedFile:r,onSelectFile:i}=e,{t:a}=ee();if(n.length===0)return null;let o;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e;t[5]!==i||t[6]!==r||t[7]!==a?(e=e=>{let t=Re(e),n=r===e.path;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i(e.path),className:b(`flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left transition-colors`,n?`bg-interactive-selection text-interactive-selection-foreground`:`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`),children:[(0,q.jsx)(M,{filePath:e.path,className:`size-3 flex-shrink-0`}),(0,q.jsx)(`span`,{className:`typography-code font-semibold w-3.5 text-center uppercase`,style:{color:t.color},title:a(t.descriptionKey),"aria-label":a(t.descriptionKey),children:t.code}),(0,q.jsx)(N,{path:e.path,className:`min-w-0 flex-1 typography-code`,dirClassName:n?`text-interactive-selection-foreground`:`text-muted-foreground`,nameClassName:n?`text-interactive-selection-foreground`:`text-foreground`}),Xe(e.insertions,e.deletions)]})},e.path)},t[5]=i,t[6]=r,t[7]=a,t[8]=e):e=t[8],o=n.map(e),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,q.jsx)(E,{outerClassName:`flex-1 min-h-0`,className:`px-2 py-2`,children:(0,q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o})}),t[9]=o,t[10]=s),s}),$e=z.memo(e=>{let t=(0,B.c)(20),{filePath:n,diff:r,renderSideBySide:i}=e,{t:a}=ee(),o=r.original.length>0,s=r.modified.length>0,c=i?`flex flex-row gap-6 items-start justify-center`:`flex flex-col gap-4 items-center`,l=i?`flex flex-col items-center gap-2 flex-1 min-w-0`:`flex flex-col items-center gap-2`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={contain:`layout`},t[0]=u):u=t[0];let d;t[1]!==r.original||t[2]!==n||t[3]!==o||t[4]!==l||t[5]!==i||t[6]!==a?(d=o&&(0,q.jsxs)(`div`,{className:l,children:[(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground font-medium`,children:a(`diffView.image.original`)}),(0,q.jsx)(R,{src:r.original,alt:a(`diffView.image.originalAlt`,{path:n}),className:i?`max-w-full max-h-[70vh] object-contain`:`max-w-full object-contain`,style:{imageRendering:`auto`}})]}),t[1]=r.original,t[2]=n,t[3]=o,t[4]=l,t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;t[8]!==r.modified||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==l||t[13]!==i||t[14]!==a?(f=s&&(0,q.jsxs)(`div`,{className:l,children:[(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground font-medium`,children:a(o?`diffView.image.modified`:`diffView.image.new`)}),(0,q.jsx)(R,{src:r.modified,alt:a(`diffView.image.modifiedAlt`,{path:n}),className:i?`max-w-full max-h-[70vh] object-contain`:`max-w-full object-contain`,style:{imageRendering:`auto`}})]}),t[8]=r.modified,t[9]=n,t[10]=s,t[11]=o,t[12]=l,t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;return t[16]!==c||t[17]!==d||t[18]!==f?(p=(0,q.jsx)(`div`,{className:`w-full overflow-auto p-4`,style:u,children:(0,q.jsxs)(`div`,{className:c,children:[d,f]})}),t[16]=c,t[17]=d,t[18]=f,t[19]=p):p=t[19],p}),et=z.memo(e=>{let t=(0,B.c)(18),{filePath:n,diff:r,renderSideBySide:i,wrapLines:a,expandUnchanged:o,focusLine:s}=e,c=o!==void 0&&o,l;t[0]===n?l=t[1]:(l=w(n)||`text`,t[0]=n,t[1]=l);let u=l;if(r.isBinary){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(Pe,{}),t[2]=e):e=t[2],e}if(T(n)){let e;return t[3]!==r||t[4]!==n||t[5]!==i?(e=(0,q.jsx)($e,{filePath:n,diff:r,renderSideBySide:i}),t[3]=r,t[4]=n,t[5]=i,t[6]=e):e=t[6],e}let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d={contain:`layout`},t[7]=d):d=t[7];let f=c&&!r.fileDiff?.isPartial,p;return t[8]!==r.fileDiff||t[9]!==r.modified||t[10]!==r.original||t[11]!==n||t[12]!==s||t[13]!==u||t[14]!==i||t[15]!==f||t[16]!==a?(p=(0,q.jsx)(`div`,{className:`w-full`,style:d,children:(0,q.jsx)(I,{original:r.original,modified:r.modified,fileDiff:r.fileDiff,language:u,fileName:n,renderSideBySide:i,wrapLines:a,expandUnchanged:f,focusLine:s,layout:`inline`,enableSelectionActions:!0})}),t[8]=r.fileDiff,t[9]=r.modified,t[10]=r.original,t[11]=n,t[12]=s,t[13]=u,t[14]=i,t[15]=f,t[16]=a,t[17]=p):p=t[17],p}),tt=z.memo(e=>{let t=(0,B.c)(7),{filePath:n,staged:r,busyAction:i,disabled:a,onAction:o}=e,{t:s}=ee(),c;return t[0]!==i||t[1]!==a||t[2]!==n||t[3]!==o||t[4]!==r||t[5]!==s?(c=(0,q.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-lg backdrop-blur-md`,children:r?(0,q.jsx)(nt,{label:s(`gitView.changes.unstageFileAria`,{path:n}),icon:`arrow-go-back`,loading:i===`unstage`,disabled:a,onClick:()=>o(`unstage`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(nt,{label:s(`gitView.changes.revertFileAria`,{path:n}),icon:`arrow-go-back`,loading:i===`discard`,disabled:a,tone:`failure`,onClick:()=>o(`discard`)}),(0,q.jsx)(nt,{label:s(`gitView.changes.stageFileAria`,{path:n}),icon:`add`,loading:i===`stage`,disabled:a,tone:`success`,onClick:()=>o(`stage`)})]})}),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=r,t[5]=s,t[6]=c):c=t[6],c}),nt=e=>{let t=(0,B.c)(14),{label:n,icon:r,loading:i,disabled:a,tone:o,onClick:s}=e,c=o===`failure`&&`text-[var(--status-error)] hover:text-[var(--status-error)]`,l=o===`success`&&`text-[var(--status-success)] hover:text-[var(--status-success)]`,u;t[0]!==c||t[1]!==l?(u=b(`h-6 w-6 rounded-none bg-transparent p-0 text-muted-foreground opacity-70 hover:bg-transparent hover:text-foreground hover:opacity-100`,c,l),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d;t[3]===s?d=t[4]:(d=e=>{e.stopPropagation(),s()},t[3]=s,t[4]=d);let f;t[5]!==r||t[6]!==i?(f=i?(0,q.jsx)(C,{name:`loader-4`,className:`size-3.5 animate-spin`}):(0,q.jsx)(C,{name:r,className:r===`add`?`size-4`:`size-3.5`}),t[5]=r,t[6]=i,t[7]=f):f=t[7];let p;return t[8]!==a||t[9]!==n||t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,q.jsx)(_,{variant:`ghost`,size:`sm`,className:u,disabled:a,title:n,"aria-label":n,onClick:d,children:f}),t[8]=a,t[9]=n,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13],p},rt=z.memo(({directory:e,file:t,layout:n,wrapLines:r,isSelected:i,isExpanded:a,isMounted:o,onSelect:s,onExpandedChange:c,registerSectionRef:l,showOpenInEditorAction:u=!1,isOpeningInEditor:d=!1,onOpenInEditor:f,onOpenFile:p,staged:m=!1,loadFullFiles:h=!1,preloadFullFiles:g=!1,initialDiffData:v=null,focusLine:y=null,showFileActions:S=!0,disableGitFetch:w=!1,turnChangesRequest:E=null,loadTurnChangeFile:D=!1})=>{let{t:O}=ee(),{git:k}=ae(),A=L(z.useCallback(n=>n.directories.get(e)?.diffCache.get(t.path)??null,[e,t.path])),j=L(e=>e.setDiff),te=L(e=>e.fetchStatus),[ne,P]=z.useState(0),[F,re]=z.useState(null),[ie,I]=z.useState(!1),[oe,se]=z.useState(null),[ce,le]=z.useState(!1),[R,ue]=z.useState(null),[B,de]=z.useState(null),fe=z.useRef(null),V=z.useMemo(()=>Re(t),[t]),H=n===`side-by-side`,U=g||h,pe=U?`full`:`patch`,me=`${t.index}:${t.working_dir}:${t.insertions}:${t.deletions}`,W=Ee({sessionID:E?.sessionID??``,directory:E?.directory??``,messageID:E?.messageID??``,diffCount:E?.diffCount,file:t.path},{enabled:D&&!!E&&a&&o}),he=z.useMemo(()=>{let e=W.data?.diff;return e?typeof e.patch==`string`&&e.patch.length>0?Ye(t.path,e.patch,`patch`):typeof e.before==`string`&&e.before.length>0||typeof e.after==`string`&&e.after.length>0?{original:e.before??``,modified:e.after??``,contextMode:`full`}:null:null},[t.path,W.data]),G=z.useMemo(()=>{if(v)return v;if(he)return he;if(m)return B;if(R)return R;if(!A)return null;let e={original:A.original,modified:A.modified,isBinary:A.isBinary,contextMode:`full`};return Je(e)?e:null},[A,v,R,m,B,he]),ge=W.error instanceof Error?W.error.message:W.error?String(W.error):null,_e=G?null:ge??F,ve=D&&W.isPending||ie,ye=z.useCallback(e=>{fe.current=e,l(t.path,e)},[t.path,l]),be=z.useCallback(e=>{c(t.path,e)},[t.path,c]),K=z.useCallback(()=>{s(t.path)},[t.path,s]);z.useEffect(()=>{if(!a||!o||w||!e||v){I(!1);return}re(null),I(!0);let n=!1,r=U?je:Me,i=T(t.path)||U?k.getGitFileDiff(e,{path:t.path,staged:m}):k.getGitDiff(e,{path:t.path,staged:m,contextLines:r}),s=J,c,l=new Promise((e,t)=>{c=setTimeout(()=>t(Error(`Timed out after ${s}ms`)),s)});return Promise.race([i,l]).then(r=>{if(!n){if(`diff`in r){let e=Ye(t.path,r.diff,pe);m?de(e):ue(e)}else{let n={original:r.original??``,modified:r.modified??``,isBinary:r.isBinary,contextMode:`full`};m?de(n):(ue(n),j(e,t.path,n))}I(!1)}}).catch(e=>{if(n)return;let t=e instanceof Error?e.message:String(e);re(t),I(!1)}).finally(()=>clearTimeout(c)),()=>{n=!0,clearTimeout(c)}},[pe,ne,e,w,t.path,me,k,v,a,o,U,j,m]);let xe=z.useCallback(()=>{be(!a),K()},[be,K,a]),Se=z.useCallback(async n=>{if(!(!e||oe!==null)){se(n);try{n===`stage`?await k.stageGitFile(e,t.path):n===`unstage`?await k.unstageGitFile(e,t.path):await k.revertGitFile(e,t.path,{scope:`working`}),P(e=>e+1),await te(e,k)}catch(e){let t=n===`unstage`?`gitView.toast.unstageFileFailed`:n===`stage`?`gitView.toast.stageFileFailed`:`gitView.toast.revertFailed`;x.error(e instanceof Error?e.message:O(t))}finally{se(e=>e===n?null:e)}}},[e,te,t.path,oe,k,O]);return(0,q.jsxs)(`div`,{ref:ye,"aria-busy":ve,className:`scroll-mt-9 border-b border-[var(--interactive-border)]/40 last:border-b-0`,children:[(0,q.jsx)(`div`,{className:`sticky top-0 z-30 border-b border-[var(--interactive-border)]/35 bg-background/95 backdrop-blur-md supports-[backdrop-filter]:bg-background/90`,"data-diff-file-header":!0,children:(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:xe,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),xe())},className:b(`cursor-pointer`,`group/header relative grid min-h-8 w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-1.5 overflow-hidden px-2 py-1`,`bg-transparent`,`text-muted-foreground hover:text-foreground`,i?`bg-[var(--interactive-selection)]/35`:null),children:[(0,q.jsx)(`div`,{className:`absolute inset-0 pointer-events-none group-hover/header:bg-[var(--interactive-hover)]/50`}),(0,q.jsxs)(`div`,{className:`relative flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`flex size-4 items-center justify-center opacity-70 group-hover/header:opacity-100`,children:a?(0,q.jsx)(C,{name:`arrow-down-s`,className:`size-3.5`}):(0,q.jsx)(C,{name:`arrow-right-s`,className:`size-3.5`})}),(0,q.jsx)(`span`,{className:`typography-code font-semibold leading-none w-3.5 text-center uppercase`,style:{color:V.color},title:O(V.descriptionKey),"aria-label":O(V.descriptionKey),children:V.code}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden typography-code`,title:t.path,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,q.jsx)(M,{filePath:t.path,className:`size-3 flex-shrink-0 align-middle`}),(0,q.jsx)(N,{path:t.path,className:`min-w-0 flex-1 typography-code`})]})})]}),(0,q.jsxs)(`div`,{className:`relative flex shrink-0 items-center justify-self-end gap-1.5`,children:[ve&&G?(0,q.jsx)(`span`,{role:`status`,"aria-label":O(`diffView.state.loadingDiff`),children:(0,q.jsx)(C,{name:`loader-4`,className:`size-3.5 animate-spin`})}):null,Xe(t.insertions,t.deletions),u&&f?(0,q.jsx)(_,{variant:`ghost`,size:`sm`,className:`h-5 w-5 p-0 opacity-70 hover:opacity-100`,title:O(`diffView.actions.openFileInEditorAtChange`),onClick:e=>{e.stopPropagation(),f(t.path,G)},disabled:d,children:d?(0,q.jsx)(C,{name:`loader-4`,className:`size-3.5 animate-spin`}):(0,q.jsx)(C,{name:`edit`,className:`size-3.5`})}):null,p?(0,q.jsx)(_,{variant:`ghost`,size:`sm`,className:`h-5 w-5 p-0 opacity-70 hover:opacity-100`,title:O(`diffView.actions.openFilePreview`),"aria-label":O(`diffView.actions.openFilePreview`),onClick:e=>{e.stopPropagation(),p(t.path)},children:(0,q.jsx)(C,{name:`eye`,className:`size-3.5`})}):null]})]})}),a&&(0,q.jsxs)(`div`,{className:`relative bg-background overflow-hidden`,children:[G&&F?(0,q.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 px-3 py-2 typography-meta text-muted-foreground`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[O(`diffView.state.failedToLoadDiff`),`: `,F]}),(0,q.jsx)(_,{variant:`ghost`,size:`xs`,onClick:()=>P(e=>e+1),children:O(`diffView.actions.retry`)})]}):null,!o&&!_e?(0,q.jsx)(`div`,{className:`h-40 border border-border/40 bg-background/40`}):null,_e?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-8 text-sm text-muted-foreground`,children:[(0,q.jsx)(`div`,{className:`typography-ui-label font-semibold text-foreground`,children:O(`diffView.state.failedToLoadDiff`)}),(0,q.jsx)(`div`,{className:`typography-meta text-muted-foreground max-w-[32rem] text-center`,children:_e}),(0,q.jsx)(`button`,{type:`button`,className:`typography-ui-label text-primary hover:underline`,onClick:()=>{if(D){W.refetch();return}P(e=>e+1)},children:O(`diffView.actions.retry`)})]}):null,o&&ve&&!G&&!_e?(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-4 py-8 text-sm text-muted-foreground`,children:[(0,q.jsx)(C,{name:`loader-4`,className:`size-4 animate-spin`}),O(`diffView.state.loadingDiff`)]}):null,o&&G&&!ce&&t.insertions+t.deletions>ke?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-8 text-sm text-muted-foreground`,children:[(0,q.jsx)(`div`,{className:`typography-ui-label font-semibold text-foreground`,children:O(`diffView.state.largeDiff`,{count:t.insertions+t.deletions})}),(0,q.jsx)(`div`,{className:`typography-meta text-muted-foreground`,children:O(`diffView.state.largeDiffDescription`)}),(0,q.jsx)(`button`,{type:`button`,className:`typography-ui-label text-primary hover:underline`,onClick:()=>le(!0),children:O(`diffView.actions.renderAnyway`)})]}):null,o&&G&&(ce||t.insertions+t.deletions<=ke)?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(et,{filePath:t.path,diff:G,renderSideBySide:H,wrapLines:r,expandUnchanged:h&&G.contextMode===`full`,focusLine:y}),S?(0,q.jsx)(`div`,{className:`pointer-events-none absolute bottom-3 right-3 z-20`,children:(0,q.jsx)(`div`,{className:`pointer-events-auto`,children:(0,q.jsx)(tt,{filePath:t.path,staged:m,busyAction:oe,disabled:oe!==null,onAction:Se})})}):null]}):null]})]})}),it=({hideStackedFileSidebar:e=!1,stackedDefaultCollapsedAll:t=!1,pinSelectedFileHeaderToTopOnNavigate:n=!1,showOpenInEditorAction:r=!1,diffScope:i=`all`,turnMessageId:a=null,sessionId:o=null,directory:s=null,onDiffScopeChange:c,targetFilePath:l=null,targetLine:u=null,toolPatches:p=null,flushContent:m=!1,singleFileView:h=!1,toolbarInSheetHeader:g=!1,preloadFullFiles:x=!1,navigationRequestKey:w})=>{let{t:M}=ee(),{git:N}=ae(),ne=oe(),P=typeof s==`string`&&s.trim()?s.trim():ne,{screenWidth:F,isMobile:re}=te({includeScreenWidth:!0}),ie=le(P??null),I=se(P??null),R=ce(P??null),B=L(e=>e.setActiveDirectory),de=L(e=>e.ensureStatus),fe=L(e=>e.fetchStatus),V=L(e=>e.setDiff),[H,U]=z.useState(null),[pe,me]=z.useState(!1),[W,ve]=z.useState(null),[ye,be]=z.useState(null),[K,xe]=z.useState(()=>new Set),[Se,Ce]=z.useState(()=>new Set),[we,Te]=z.useState(!1),[Ee,De]=z.useState(0),[J,ke]=z.useState(i);z.useEffect(()=>{ke(i)},[i]);let je=f(e=>e.pendingDiffFile),Me=f(e=>e.pendingDiffStaged),Pe=f(e=>e.pendingDiffScope),Fe=f(e=>e.pendingDiffLine),Ie=f(e=>e.setPendingDiffFile),Le=f(e=>e.diffLayoutPreference),Re=f(e=>e.diffFileLayout),Ge=f(e=>e.setDiffFileLayout),Je=f(e=>e.diffWrapLines),Xe=f(e=>e.setDiffWrapLines),$e=f(e=>e.openContextFileAtLine),et=f(e=>e.openContextFile),tt=O(),nt=y(e=>e.currentSessionId),it=typeof o==`string`&&o.trim()?o.trim():nt,at=S(it??``,P??void 0),ot=Je,st=J===`staged`||J!==`working`&&null,ct=st??pe,lt=!e&&!(re||F<=768)&&F>=1024,ut=z.useRef(null),dt=z.useRef(new Map),ft=z.useRef(null),Y=z.useRef(null),pt=z.useRef(!1),mt=z.useRef(null),ht=z.useRef(null),gt=z.useRef(null),_t=z.useRef(null),vt=z.useCallback(()=>{ft.current=null,pt.current=!1,be(null),Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null)},[]),yt=z.useCallback(e=>{xe(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),X=z.useMemo(()=>{let e=at.length-1;if(a&&(e=at.findIndex(e=>e.id===a),e<0))return{messageID:null,count:0,hasDiffs:!1,thinDiffs:[]};for(let t=e;t>=0;--t){let e=at[t];if(e.role!==`user`)continue;let n=Ke(e.summary?.diffs),r=typeof e.summary?.diffCount==`number`&&Number.isFinite(e.summary.diffCount)?Math.max(0,Math.trunc(e.summary.diffCount)):n.length;return{messageID:typeof e.id==`string`&&e.id?e.id:null,count:r,hasDiffs:e.summary?.hasDiffs===!0||r>0||n.length>0,thinDiffs:n}}return{messageID:null,count:0,hasDiffs:!1,thinDiffs:[]}},[at,a]),bt=z.useMemo(()=>G(p??[]),[p]),xt=bt.length>0,St=z.useMemo(()=>!it||!P||!X.messageID?null:{sessionID:it,directory:P,messageID:X.messageID,diffCount:X.count},[P,it,X.count,X.messageID]),Ct=z.useMemo(()=>xt?bt:X.thinDiffs,[bt,X.thinDiffs,xt]),wt=z.useMemo(()=>{let e=new Map;for(let t of Ct)if(t.file){if(typeof t.patch==`string`&&t.patch.length>0){e.set(t.file,Ye(t.file,t.patch,`patch`));continue}(typeof t.before==`string`&&t.before.length>0||typeof t.after==`string`&&t.after.length>0)&&e.set(t.file,{original:t.before??``,modified:t.after??``,contextMode:`full`})}return e},[Ct]),Z=z.useMemo(()=>{if(J===`turn`)return Ct.map(e=>({path:e.file??``,index:``,working_dir:qe(e.status),insertions:e.additions??0,deletions:e.deletions??0,isNew:e.status===`added`})).filter(e=>e.path).sort((e,t)=>e.path.localeCompare(t.path));if(!I?.files)return[];let e=I.diffStats??{},t=J===`staged`?Be:J===`working`?Ve:()=>!0;return I.files.filter(t).map(t=>({...t,insertions:e[t.path]?.insertions??0,deletions:e[t.path]?.deletions??0,isNew:ze(t)})).sort((e,t)=>e.path.localeCompare(t.path))},[J,Ct,I]),Tt=z.useMemo(()=>I?.files?I.files.filter(Ve).length:0,[I]),Et=z.useMemo(()=>I?.files?I.files.filter(Be).length:0,[I]),Dt=xt?Ct.length:X.count,Ot=z.useMemo(()=>Z.map(e=>e.path).join(`\0`),[Z]),Q=z.useMemo(()=>{if(!h)return Z;let e=l?.trim()||H;return e?Z.filter(t=>t.path===e):[]},[Z,H,h,l]);z.useEffect(()=>{let e=Ot?Ot.split(`\0`):[],n=new Set(e),r=`${P??``}:${J}:${a??``}:${t?`collapsed`:`default`}`,i=p!==null&&gt.current!==p,o=ht.current!==r||i;ht.current=r,gt.current=p,xe(r=>{if(o){let n=t||J===`turn`&&!xt?0:Ne(e.length);return new Set(e.slice(0,n))}let i=!1,a=new Set;for(let e of r){if(!n.has(e)){i=!0;continue}a.add(e)}return i?a:r}),Ce(e=>{if(o)return new Set;let t=!1,r=new Set;for(let i of e){if(!n.has(i)){t=!0;continue}r.add(i)}return t?r:e})},[J,Ot,P,t,p,a,xt]);let kt=z.useCallback(()=>{mt.current=null;let e=ut.current;if(!e)return;let t=e.getBoundingClientRect(),n=t.top-Ae,r=t.bottom+Ae,i={};for(let[e,t]of dt.current){if(!t||!K.has(e))continue;let a=t.getBoundingClientRect();a.bottom<n||a.top>r||(i[e]=!0)}Ce(e=>{let t=!1,n=new Set(e);for(let e of Object.keys(i))n.has(e)||(n.add(e),t=!0);return t?n:e})},[K]),$=z.useCallback(()=>{typeof window>`u`||mt.current===null&&(mt.current=window.requestAnimationFrame(kt))},[kt]);z.useEffect(()=>{let e=ut.current;if(e)return $(),e.addEventListener(`scroll`,$,{passive:!0}),window.addEventListener(`resize`,$),()=>{e.removeEventListener(`scroll`,$),window.removeEventListener(`resize`,$),mt.current!==null&&(window.cancelAnimationFrame(mt.current),mt.current=null)}},[Z,K,$]);let At=z.useCallback(e=>{let t=Re[e.path];if(t)return t;if(Le===`inline`)return`inline`;if(Le===`side-by-side`)return`side-by-side`;let n=F<Oe;return e.isNew||n?`inline`:`side-by-side`},[Re,Le,F]),jt=z.useMemo(()=>Q.length===0?null:Q.every(e=>At(e)===`side-by-side`)?`side-by-side`:`inline`,[At,Q]);z.useEffect(()=>{P&&(B(P),de(P,N))},[P,B,de,N]),z.useEffect(()=>{if(P)return v.onGitRefreshHint(e=>{Ue(e.directory)===Ue(P)&&fe(P,N)})},[P,fe,N]),z.useEffect(()=>{J!==`all`&&!Pe||je&&(Pe&&ke(Pe),U(je),me(Pe===`staged`||!Pe&&Me),ve(Fe),Ie(null),pt.current=!0,ft.current=je,yt(je),De(e=>e+1))},[J,yt,je,Fe,Pe,Me,Ie]),z.useEffect(()=>{if(J===`all`)return;let e=l?.trim();if(!e)return;yt(e),U(e),me(J===`staged`),ve(u);let t=ge({scope:J,navigationRequestKey:w,targetFilePath:e,targetLine:u}),n=Z.some(t=>t.path===e);_e(_t.current,t,n)&&(_t.current=t,pt.current=!0,ft.current=e,De(e=>e+1))},[J,Z,yt,w,l,u]),z.useEffect(()=>{H&&(Z.some(e=>e.path===H)||(U(null),me(!1)))},[Z,H]);let Mt=z.useCallback((e,t)=>{let n=dt.current;t?n.set(e,t):n.delete(e),$()},[$]),Nt=z.useCallback((e,t)=>{vt(),xe(n=>{if(t===n.has(e))return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),t||Ce(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),$()},[vt,$]),Pt=z.useCallback(()=>{vt(),xe(e=>e.size>0?new Set:new Set(Z.map(e=>e.path))),Ce(new Set),$()},[vt,Z,$]),Ft=z.useCallback(e=>{let t=dt.current.get(e),n=ut.current;if(!t||!n)return!1;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect().top-r.top,a=Math.max(0,n.scrollHeight-n.clientHeight);return n.scrollTop=Math.min(a,Math.max(0,n.scrollTop+i)),!0},[]);z.useEffect(()=>{if(!ft.current)return;let e=0,t=!1,r=()=>{t||(t=!0,ft.current=null,pt.current=!1,be(null),Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null))},i=()=>{if(t){Y.current=null;return}let a=ft.current;if(!a){r(),Y.current=null;return}if(!Ft(a)){e+=1,e<20?Y.current=window.requestAnimationFrame(i):(r(),Y.current=null);return}n&&pt.current&&be(a),r()};return Y.current=window.requestAnimationFrame(i),()=>{t=!0,Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null)}},[n,Ee,Ft]);let It=z.useCallback(e=>{},[]),Lt=z.useCallback(e=>{vt(),U(e),me(!1),pt.current=!0,ft.current=e,yt(e),De(e=>e+1),Ft(e)},[vt,yt,Ft]),Rt=z.useCallback(e=>{let t=e===`side-by-side`?`side-by-side`:`inline`;Q.forEach(e=>{Ge(e.path,t)})},[Ge,Q]),[zt,Bt]=z.useState(null),Vt=z.useCallback(async(e,t)=>{if(!(!P||!e)){Bt(e);try{let n=null;if(t?.patch&&!t.isBinary&&!T(e)?n=he(t.patch):t&&t.contextMode===`full`&&!t.isBinary&&!T(e)&&(n=We(t.original,t.modified)),n===null)try{n=he((await N.getGitDiff(P,{path:e,staged:ct,contextLines:3})).diff)}catch{n=null}let r=t;if(n===null||!r){let t=await N.getGitFileDiff(P,{path:e,staged:ct});r={original:t.original??``,modified:t.modified??``,isBinary:t.isBinary},ct||V(P,e,r)}let i=n??(r.isBinary||T(e)?1:We(r.original,r.modified)),a=He(P,e);$e(P,a,i,1)}finally{Bt(t=>t===e?null:t)}}},[ct,P,N,$e,V]),Ht=d(e=>{if(!P||!e)return;let t=He(P,e);if(tt){tt.openFile({path:t});return}et(P,t)}),Ut=()=>{if(!P)return null;let e=e=>st===null?pe&&e===H:st;return(0,q.jsxs)(`div`,{className:b(`flex min-w-0 flex-1 min-h-0 h-full`,m?`gap-0`:`gap-3 px-3 pb-3 pt-2`),children:[lt&&(0,q.jsxs)(`section`,{className:`hidden lg:flex w-72 flex-col rounded-xl border border-border/60 bg-background/70 overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-b border-border/40`,children:[(0,q.jsx)(`span`,{className:`typography-code font-semibold text-foreground`,children:M(`diffView.section.files`)}),(0,q.jsx)(`span`,{className:`typography-code text-muted-foreground`,children:Z.length})]}),(0,q.jsx)(Qe,{changedFiles:Z,selectedFile:null,onSelectFile:Lt})]}),(0,q.jsx)(`div`,{className:`relative flex-1 min-w-0 min-h-0 h-full`,children:(0,q.jsx)(E,{ref:ut,outerClassName:`min-h-0 h-full`,className:`[overflow-anchor:none] pb-16 pwa-overlay-scroll`,disableHorizontal:!0,observeMutations:!1,preventOverscroll:!0,"data-diff-virtual-root":!0,children:(0,q.jsx)(`div`,{className:`flex flex-col [overflow-anchor:none]`,"data-diff-virtual-content":!0,children:Q.map(t=>(0,q.jsx)(rt,{directory:P,file:t,layout:At(t),wrapLines:ot,isSelected:!1,isExpanded:K.has(t.path),isMounted:Se.has(t.path)||t.path===ye||h&&Q.length===1,onSelect:It,onExpandedChange:Nt,registerSectionRef:Mt,showOpenInEditorAction:r&&J!==`turn`,isOpeningInEditor:zt===t.path,onOpenInEditor:(e,t)=>{Vt(e,t)},onOpenFile:Ht,staged:e(t.path),loadFullFiles:we,preloadFullFiles:x,initialDiffData:J===`turn`?wt.get(t.path)??null:null,focusLine:t.path===(l?.trim()||H)?u??W:null,showFileActions:J!==`turn`,disableGitFetch:J===`turn`,turnChangesRequest:St,loadTurnChangeFile:J===`turn`&&!xt},t.path))})})})]})},Wt=()=>P?J!==`turn`&&R&&!I?(0,q.jsxs)(`div`,{className:`flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,q.jsx)(C,{name:`loader-4`,className:`size-4 animate-spin`}),M(`diffView.state.loadingRepositoryStatus`)]}):J!==`turn`&&ie===!1?(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:M(`diffView.state.notGitRepository`)}):Q.length===0?(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:M(J===`turn`?`diffView.state.noLastTurnChanges`:`diffView.state.cleanWorkingTree`)}):Ut():(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:M(`diffView.state.selectSessionDirectory`)}),Gt=h?null:(0,q.jsxs)(q.Fragment,{children:[!re&&!g&&(J===`working`||J===`staged`||J===`turn`?(0,q.jsx)(Ze,{scope:J,workingCount:Tt,stagedCount:Et,turnCount:Dt,onScopeChange:e=>{ke(e),c?.(e)}}):(0,q.jsx)(`div`,{className:`flex items-center gap-1 rounded-md px-2 py-1 text-muted-foreground shrink-0`,children:(0,q.jsx)(`span`,{className:`typography-code font-semibold text-foreground`,children:R&&!I?M(`diffView.state.loadingChanges`):Q.length===1?M(`diffView.summary.changedFilesSingle`,{count:Q.length}):M(`diffView.summary.changedFilesPlural`,{count:Q.length})})})),!h&&Z.length>0&&(J!==`turn`||xt)&&(0,q.jsxs)(_,{variant:`ghost`,size:`sm`,onClick:Pt,className:b(`diff-toolbar__expand-button h-7 flex-shrink-0 gap-1 px-1.5 text-muted-foreground hover:text-foreground`,`ml-auto`),title:K.size>0?M(`diffView.actions.collapseAll`):M(`diffView.actions.expandAll`),children:[(0,q.jsx)(C,{name:`expand-up-down`,className:`size-4`}),(0,q.jsx)(`span`,{className:b(`diff-toolbar__expand-label typography-code`,g&&`hidden`),children:K.size>0?M(`diffView.actions.collapseAll`):M(`diffView.actions.expandAll`)})]}),Z.length>0&&J!==`turn`&&(0,q.jsxs)(j,{children:[(0,q.jsx)(k,{asChild:!0,children:(0,q.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>Te(e=>!e),"aria-pressed":we,"aria-label":M(we?`diffView.actions.disableFullFiles`:`diffView.actions.loadFullFiles`),className:b(`h-7 w-7 flex-shrink-0 p-0 text-muted-foreground hover:text-foreground`,we&&`bg-interactive-selection text-interactive-selection-foreground`),children:(0,q.jsx)(C,{name:`file-download`,className:`size-4`})})}),(0,q.jsx)(A,{children:(0,q.jsx)(`p`,{children:M(we?`diffView.actions.disableFullFiles`:`diffView.actions.loadFullFiles`)})})]}),Z.length>0&&(0,q.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>Xe(!Je),className:b(`h-5 w-5 p-0 transition-opacity`,ot?`text-foreground opacity-100`:`text-muted-foreground opacity-60 hover:opacity-100`),title:M(ot?`diffView.actions.disableLineWrap`:`diffView.actions.enableLineWrap`),children:(0,q.jsx)(C,{name:`text-wrap`,className:`size-4`})}),jt&&(0,q.jsx)(ue,{mode:jt===`side-by-side`?`side-by-side`:`unified`,onModeChange:Rt})]});return(0,q.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-background`,children:[Gt?g?(0,q.jsx)(D,{children:Gt}):(0,q.jsx)(`div`,{className:`@container/diff-toolbar flex min-w-0 items-center gap-1.5 px-2 py-1.5 bg-background`,children:Gt}):null,Wt()]})};export{De as n,it as t};
6
+ `),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1)if(n[e]!==r[e])return e+1;return r.length>n.length?n.length+1:n.length>r.length?Math.max(1,r.length):1},Ge=e=>/^Binary files .+ differ$/m.test(e)||/^GIT binary patch$/m.test(e),Ke=e=>Array.isArray(e)?e.filter(e=>!e||typeof e!=`object`?!1:typeof e.file==`string`):[],qe=e=>e===`added`?`A`:e===`deleted`?`D`:`M`,Je=e=>e.isBinary||typeof e.patch==`string`&&e.patch.length>0||e.fileDiff?!0:e.original.length>0||e.modified.length>0,Ye=(e,t,n)=>Ge(t)?{original:``,modified:``,isBinary:!0,patch:t,contextMode:n}:{original:``,modified:``,patch:t,fileDiff:H(e,t),contextMode:n},Xe=(e,t,n)=>{let r=e??0,i=t??0;return!r&&!i?null:(0,q.jsxs)(`span`,{className:b(`typography-code flex items-center gap-1 whitespace-nowrap`,n?.shrink?`min-w-0 overflow-hidden`:`flex-shrink-0`,n?.className),children:[r?(0,q.jsxs)(`span`,{style:{color:`var(--status-success)`},children:[`+`,r]}):null,i?(0,q.jsxs)(`span`,{style:{color:`var(--status-error)`},children:[`-`,i]}):null]})},Ze=z.memo(e=>{let t=(0,B.c)(53),{scope:n,workingCount:r,stagedCount:i,turnCount:a,onScopeChange:o}=e,{t:s}=ee(),[c,l]=z.useState(!1),u=n===`staged`?i:n===`turn`?a:r,d;t[0]!==n||t[1]!==s?(d=s(n===`staged`?`diffView.scope.staged`:n===`turn`?`diffView.scope.lastTurn`:`diffView.scope.changed`),t[0]=n,t[1]=s,t[2]=d):d=t[2];let f=d,p;t[3]===s?p=t[4]:(p=s(`diffView.scope.selectorAria`),t[3]=s,t[4]=p);let m;t[5]===u?m=t[6]:(m=(0,q.jsxs)(`span`,{className:`diff-toolbar__scope-count`,children:[`: `,u]}),t[5]=u,t[6]=m);let h;t[7]!==f||t[8]!==m?(h=(0,q.jsxs)(`span`,{className:`whitespace-nowrap`,children:[f,m]}),t[7]=f,t[8]=m,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,q.jsx)(C,{name:`arrow-down-s`,className:`size-4 flex-shrink-0 opacity-60`}),t[10]=g):g=t[10];let _;t[11]!==p||t[12]!==h?(_=(0,q.jsx)(P,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:`flex h-7 flex-shrink-0 items-center gap-1.5 rounded-md px-2 typography-code font-semibold text-foreground outline-none hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":p,children:[h,g]})}),t[11]=p,t[12]=h,t[13]=_):_=t[13];let v;t[14]===o?v=t[15]:(v=e=>{(e===`working`||e===`staged`||e===`turn`)&&(o?.(e),l(!1))},t[14]=o,t[15]=v);let y;t[16]===s?y=t[17]:(y=s(`diffView.scope.changed`),t[16]=s,t[17]=y);let b;t[18]===y?b=t[19]:(b=(0,q.jsx)(`span`,{children:y}),t[18]=y,t[19]=b);let x;t[20]===r?x=t[21]:(x=(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:r}),t[20]=r,t[21]=x);let S;t[22]!==x||t[23]!==b?(S=(0,q.jsx)(re,{value:`working`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-3`,children:[b,x]})}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let w;t[25]===s?w=t[26]:(w=s(`diffView.scope.staged`),t[25]=s,t[26]=w);let T;t[27]===w?T=t[28]:(T=(0,q.jsx)(`span`,{children:w}),t[27]=w,t[28]=T);let E;t[29]===i?E=t[30]:(E=(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:i}),t[29]=i,t[30]=E);let D;t[31]!==T||t[32]!==E?(D=(0,q.jsx)(re,{value:`staged`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-3`,children:[T,E]})}),t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]===s?O=t[35]:(O=s(`diffView.scope.lastTurn`),t[34]=s,t[35]=O);let k;t[36]===O?k=t[37]:(k=(0,q.jsx)(`span`,{children:O}),t[36]=O,t[37]=k);let A;t[38]===a?A=t[39]:(A=(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:a}),t[38]=a,t[39]=A);let j;t[40]!==k||t[41]!==A?(j=(0,q.jsx)(re,{value:`turn`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-3`,children:[k,A]})}),t[40]=k,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n||t[44]!==S||t[45]!==D||t[46]!==j||t[47]!==v?(M=(0,q.jsx)(F,{align:`start`,className:`w-40`,children:(0,q.jsxs)(ne,{value:n,onValueChange:v,children:[S,D,j]})}),t[43]=n,t[44]=S,t[45]=D,t[46]=j,t[47]=v,t[48]=M):M=t[48];let N;return t[49]!==c||t[50]!==M||t[51]!==_?(N=(0,q.jsxs)(ie,{open:c,onOpenChange:l,children:[_,M]}),t[49]=c,t[50]=M,t[51]=_,t[52]=N):N=t[52],N}),Qe=z.memo(e=>{let t=(0,B.c)(11),{changedFiles:n,selectedFile:r,onSelectFile:i}=e,{t:a}=ee();if(n.length===0)return null;let o;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e;t[5]!==i||t[6]!==r||t[7]!==a?(e=e=>{let t=Re(e),n=r===e.path;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i(e.path),className:b(`flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left transition-colors`,n?`bg-interactive-selection text-interactive-selection-foreground`:`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`),children:[(0,q.jsx)(M,{filePath:e.path,className:`size-3 flex-shrink-0`}),(0,q.jsx)(`span`,{className:`typography-code font-semibold w-3.5 text-center uppercase`,style:{color:t.color},title:a(t.descriptionKey),"aria-label":a(t.descriptionKey),children:t.code}),(0,q.jsx)(N,{path:e.path,className:`min-w-0 flex-1 typography-code`,dirClassName:n?`text-interactive-selection-foreground`:`text-muted-foreground`,nameClassName:n?`text-interactive-selection-foreground`:`text-foreground`}),Xe(e.insertions,e.deletions)]})},e.path)},t[5]=i,t[6]=r,t[7]=a,t[8]=e):e=t[8],o=n.map(e),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,q.jsx)(E,{outerClassName:`flex-1 min-h-0`,className:`px-2 py-2`,children:(0,q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o})}),t[9]=o,t[10]=s),s}),$e=z.memo(e=>{let t=(0,B.c)(20),{filePath:n,diff:r,renderSideBySide:i}=e,{t:a}=ee(),o=r.original.length>0,s=r.modified.length>0,c=i?`flex flex-row gap-6 items-start justify-center`:`flex flex-col gap-4 items-center`,l=i?`flex flex-col items-center gap-2 flex-1 min-w-0`:`flex flex-col items-center gap-2`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={contain:`layout`},t[0]=u):u=t[0];let d;t[1]!==r.original||t[2]!==n||t[3]!==o||t[4]!==l||t[5]!==i||t[6]!==a?(d=o&&(0,q.jsxs)(`div`,{className:l,children:[(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground font-medium`,children:a(`diffView.image.original`)}),(0,q.jsx)(R,{src:r.original,alt:a(`diffView.image.originalAlt`,{path:n}),className:i?`max-w-full max-h-[70vh] object-contain`:`max-w-full object-contain`,style:{imageRendering:`auto`}})]}),t[1]=r.original,t[2]=n,t[3]=o,t[4]=l,t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;t[8]!==r.modified||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==l||t[13]!==i||t[14]!==a?(f=s&&(0,q.jsxs)(`div`,{className:l,children:[(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground font-medium`,children:a(o?`diffView.image.modified`:`diffView.image.new`)}),(0,q.jsx)(R,{src:r.modified,alt:a(`diffView.image.modifiedAlt`,{path:n}),className:i?`max-w-full max-h-[70vh] object-contain`:`max-w-full object-contain`,style:{imageRendering:`auto`}})]}),t[8]=r.modified,t[9]=n,t[10]=s,t[11]=o,t[12]=l,t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;return t[16]!==c||t[17]!==d||t[18]!==f?(p=(0,q.jsx)(`div`,{className:`w-full overflow-auto p-4`,style:u,children:(0,q.jsxs)(`div`,{className:c,children:[d,f]})}),t[16]=c,t[17]=d,t[18]=f,t[19]=p):p=t[19],p}),et=z.memo(e=>{let t=(0,B.c)(18),{filePath:n,diff:r,renderSideBySide:i,wrapLines:a,expandUnchanged:o,focusLine:s}=e,c=o!==void 0&&o,l;t[0]===n?l=t[1]:(l=w(n)||`text`,t[0]=n,t[1]=l);let u=l;if(r.isBinary){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(Pe,{}),t[2]=e):e=t[2],e}if(T(n)){let e;return t[3]!==r||t[4]!==n||t[5]!==i?(e=(0,q.jsx)($e,{filePath:n,diff:r,renderSideBySide:i}),t[3]=r,t[4]=n,t[5]=i,t[6]=e):e=t[6],e}let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d={contain:`layout`},t[7]=d):d=t[7];let f=c&&!r.fileDiff?.isPartial,p;return t[8]!==r.fileDiff||t[9]!==r.modified||t[10]!==r.original||t[11]!==n||t[12]!==s||t[13]!==u||t[14]!==i||t[15]!==f||t[16]!==a?(p=(0,q.jsx)(`div`,{className:`w-full`,style:d,children:(0,q.jsx)(I,{original:r.original,modified:r.modified,fileDiff:r.fileDiff,language:u,fileName:n,renderSideBySide:i,wrapLines:a,expandUnchanged:f,focusLine:s,layout:`inline`,enableSelectionActions:!0})}),t[8]=r.fileDiff,t[9]=r.modified,t[10]=r.original,t[11]=n,t[12]=s,t[13]=u,t[14]=i,t[15]=f,t[16]=a,t[17]=p):p=t[17],p}),tt=z.memo(e=>{let t=(0,B.c)(7),{filePath:n,staged:r,busyAction:i,disabled:a,onAction:o}=e,{t:s}=ee(),c;return t[0]!==i||t[1]!==a||t[2]!==n||t[3]!==o||t[4]!==r||t[5]!==s?(c=(0,q.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-lg backdrop-blur-md`,children:r?(0,q.jsx)(nt,{label:s(`gitView.changes.unstageFileAria`,{path:n}),icon:`arrow-go-back`,loading:i===`unstage`,disabled:a,onClick:()=>o(`unstage`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(nt,{label:s(`gitView.changes.revertFileAria`,{path:n}),icon:`arrow-go-back`,loading:i===`discard`,disabled:a,tone:`failure`,onClick:()=>o(`discard`)}),(0,q.jsx)(nt,{label:s(`gitView.changes.stageFileAria`,{path:n}),icon:`add`,loading:i===`stage`,disabled:a,tone:`success`,onClick:()=>o(`stage`)})]})}),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=r,t[5]=s,t[6]=c):c=t[6],c}),nt=e=>{let t=(0,B.c)(14),{label:n,icon:r,loading:i,disabled:a,tone:o,onClick:s}=e,c=o===`failure`&&`text-[var(--status-error)] hover:text-[var(--status-error)]`,l=o===`success`&&`text-[var(--status-success)] hover:text-[var(--status-success)]`,u;t[0]!==c||t[1]!==l?(u=b(`h-6 w-6 rounded-none bg-transparent p-0 text-muted-foreground opacity-70 hover:bg-transparent hover:text-foreground hover:opacity-100`,c,l),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d;t[3]===s?d=t[4]:(d=e=>{e.stopPropagation(),s()},t[3]=s,t[4]=d);let f;t[5]!==r||t[6]!==i?(f=i?(0,q.jsx)(C,{name:`loader-4`,className:`size-3.5 animate-spin`}):(0,q.jsx)(C,{name:r,className:r===`add`?`size-4`:`size-3.5`}),t[5]=r,t[6]=i,t[7]=f):f=t[7];let p;return t[8]!==a||t[9]!==n||t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,q.jsx)(_,{variant:`ghost`,size:`sm`,className:u,disabled:a,title:n,"aria-label":n,onClick:d,children:f}),t[8]=a,t[9]=n,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13],p},rt=z.memo(({directory:e,file:t,layout:n,wrapLines:r,isSelected:i,isExpanded:a,isMounted:o,onSelect:s,onExpandedChange:c,registerSectionRef:l,showOpenInEditorAction:u=!1,isOpeningInEditor:d=!1,onOpenInEditor:f,onOpenFile:p,staged:m=!1,loadFullFiles:h=!1,preloadFullFiles:g=!1,initialDiffData:v=null,focusLine:y=null,showFileActions:x=!0,disableGitFetch:w=!1,turnChangesRequest:E=null,loadTurnChangeFile:D=!1})=>{let{t:O}=ee(),{git:k}=ae(),A=L(z.useCallback(n=>n.directories.get(e)?.diffCache.get(t.path)??null,[e,t.path])),j=L(e=>e.setDiff),te=L(e=>e.fetchStatus),[ne,P]=z.useState(0),[F,re]=z.useState(null),[ie,I]=z.useState(!1),[oe,se]=z.useState(null),[ce,le]=z.useState(!1),[R,ue]=z.useState(null),[B,de]=z.useState(null),fe=z.useRef(null),V=z.useMemo(()=>Re(t),[t]),H=n===`side-by-side`,U=g||h,pe=U?`full`:`patch`,me=`${t.index}:${t.working_dir}:${t.insertions}:${t.deletions}`,W=Ee({sessionID:E?.sessionID??``,directory:E?.directory??``,messageID:E?.messageID??``,diffCount:E?.diffCount,file:t.path},{enabled:D&&!!E&&a&&o}),he=z.useMemo(()=>{let e=W.data?.diff;return e?typeof e.patch==`string`&&e.patch.length>0?Ye(t.path,e.patch,`patch`):typeof e.before==`string`&&e.before.length>0||typeof e.after==`string`&&e.after.length>0?{original:e.before??``,modified:e.after??``,contextMode:`full`}:null:null},[t.path,W.data]),G=z.useMemo(()=>{if(v)return v;if(he)return he;if(m)return B;if(R)return R;if(!A)return null;let e={original:A.original,modified:A.modified,isBinary:A.isBinary,contextMode:`full`};return Je(e)?e:null},[A,v,R,m,B,he]),ge=W.error instanceof Error?W.error.message:W.error?String(W.error):null,_e=G?null:ge??F,ve=D&&W.isPending||ie,ye=z.useCallback(e=>{fe.current=e,l(t.path,e)},[t.path,l]),be=z.useCallback(e=>{c(t.path,e)},[t.path,c]),K=z.useCallback(()=>{s(t.path)},[t.path,s]);z.useEffect(()=>{if(!a||!o||w||!e||v){I(!1);return}re(null),I(!0);let n=!1,r=U?je:Me,i=T(t.path)||U?k.getGitFileDiff(e,{path:t.path,staged:m}):k.getGitDiff(e,{path:t.path,staged:m,contextLines:r}),s=J,c,l=new Promise((e,t)=>{c=setTimeout(()=>t(Error(`Timed out after ${s}ms`)),s)});return Promise.race([i,l]).then(r=>{if(!n){if(`diff`in r){let e=Ye(t.path,r.diff,pe);m?de(e):ue(e)}else{let n={original:r.original??``,modified:r.modified??``,isBinary:r.isBinary,contextMode:`full`};m?de(n):(ue(n),j(e,t.path,n))}I(!1)}}).catch(e=>{if(n)return;let t=e instanceof Error?e.message:String(e);re(t),I(!1)}).finally(()=>clearTimeout(c)),()=>{n=!0,clearTimeout(c)}},[pe,ne,e,w,t.path,me,k,v,a,o,U,j,m]);let xe=z.useCallback(()=>{be(!a),K()},[be,K,a]),Se=z.useCallback(async n=>{if(!(!e||oe!==null)){se(n);try{n===`stage`?await k.stageGitFile(e,t.path):n===`unstage`?await k.unstageGitFile(e,t.path):await k.revertGitFile(e,t.path,{scope:`working`}),P(e=>e+1),await te(e,k)}catch(e){let t=n===`unstage`?`gitView.toast.unstageFileFailed`:n===`stage`?`gitView.toast.stageFileFailed`:`gitView.toast.revertFailed`;S.error(e instanceof Error?e.message:O(t))}finally{se(e=>e===n?null:e)}}},[e,te,t.path,oe,k,O]);return(0,q.jsxs)(`div`,{ref:ye,"aria-busy":ve,className:`scroll-mt-9 border-b border-[var(--interactive-border)]/40 last:border-b-0`,children:[(0,q.jsx)(`div`,{className:`sticky top-0 z-30 border-b border-[var(--interactive-border)]/35 bg-background/95 backdrop-blur-md supports-[backdrop-filter]:bg-background/90`,"data-diff-file-header":!0,children:(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:xe,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),xe())},className:b(`cursor-pointer`,`group/header relative grid min-h-8 w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-1.5 overflow-hidden px-2 py-1`,`bg-transparent`,`text-muted-foreground hover:text-foreground`,i?`bg-[var(--interactive-selection)]/35`:null),children:[(0,q.jsx)(`div`,{className:`absolute inset-0 pointer-events-none group-hover/header:bg-[var(--interactive-hover)]/50`}),(0,q.jsxs)(`div`,{className:`relative flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`flex size-4 items-center justify-center opacity-70 group-hover/header:opacity-100`,children:a?(0,q.jsx)(C,{name:`arrow-down-s`,className:`size-3.5`}):(0,q.jsx)(C,{name:`arrow-right-s`,className:`size-3.5`})}),(0,q.jsx)(`span`,{className:`typography-code font-semibold leading-none w-3.5 text-center uppercase`,style:{color:V.color},title:O(V.descriptionKey),"aria-label":O(V.descriptionKey),children:V.code}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden typography-code`,title:t.path,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,q.jsx)(M,{filePath:t.path,className:`size-3 flex-shrink-0 align-middle`}),(0,q.jsx)(N,{path:t.path,className:`min-w-0 flex-1 typography-code`})]})})]}),(0,q.jsxs)(`div`,{className:`relative flex shrink-0 items-center justify-self-end gap-1.5`,children:[ve&&G?(0,q.jsx)(`span`,{role:`status`,"aria-label":O(`diffView.state.loadingDiff`),children:(0,q.jsx)(C,{name:`loader-4`,className:`size-3.5 animate-spin`})}):null,Xe(t.insertions,t.deletions),u&&f?(0,q.jsx)(_,{variant:`ghost`,size:`sm`,className:`h-5 w-5 p-0 opacity-70 hover:opacity-100`,title:O(`diffView.actions.openFileInEditorAtChange`),onClick:e=>{e.stopPropagation(),f(t.path,G)},disabled:d,children:d?(0,q.jsx)(C,{name:`loader-4`,className:`size-3.5 animate-spin`}):(0,q.jsx)(C,{name:`edit`,className:`size-3.5`})}):null,p?(0,q.jsx)(_,{variant:`ghost`,size:`sm`,className:`h-5 w-5 p-0 opacity-70 hover:opacity-100`,title:O(`diffView.actions.openFilePreview`),"aria-label":O(`diffView.actions.openFilePreview`),onClick:e=>{e.stopPropagation(),p(t.path)},children:(0,q.jsx)(C,{name:`eye`,className:`size-3.5`})}):null]})]})}),a&&(0,q.jsxs)(`div`,{className:`relative bg-background overflow-hidden`,children:[G&&F?(0,q.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 px-3 py-2 typography-meta text-muted-foreground`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[O(`diffView.state.failedToLoadDiff`),`: `,F]}),(0,q.jsx)(_,{variant:`ghost`,size:`xs`,onClick:()=>P(e=>e+1),children:O(`diffView.actions.retry`)})]}):null,!o&&!_e?(0,q.jsx)(`div`,{className:`h-40 border border-border/40 bg-background/40`}):null,_e?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-8 text-sm text-muted-foreground`,children:[(0,q.jsx)(`div`,{className:`typography-ui-label font-semibold text-foreground`,children:O(`diffView.state.failedToLoadDiff`)}),(0,q.jsx)(`div`,{className:`typography-meta text-muted-foreground max-w-[32rem] text-center`,children:_e}),(0,q.jsx)(`button`,{type:`button`,className:`typography-ui-label text-primary hover:underline`,onClick:()=>{if(D){W.refetch();return}P(e=>e+1)},children:O(`diffView.actions.retry`)})]}):null,o&&ve&&!G&&!_e?(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-4 py-8 text-sm text-muted-foreground`,children:[(0,q.jsx)(C,{name:`loader-4`,className:`size-4 animate-spin`}),O(`diffView.state.loadingDiff`)]}):null,o&&G&&!ce&&t.insertions+t.deletions>ke?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-8 text-sm text-muted-foreground`,children:[(0,q.jsx)(`div`,{className:`typography-ui-label font-semibold text-foreground`,children:O(`diffView.state.largeDiff`,{count:t.insertions+t.deletions})}),(0,q.jsx)(`div`,{className:`typography-meta text-muted-foreground`,children:O(`diffView.state.largeDiffDescription`)}),(0,q.jsx)(`button`,{type:`button`,className:`typography-ui-label text-primary hover:underline`,onClick:()=>le(!0),children:O(`diffView.actions.renderAnyway`)})]}):null,o&&G&&(ce||t.insertions+t.deletions<=ke)?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(et,{filePath:t.path,diff:G,renderSideBySide:H,wrapLines:r,expandUnchanged:h&&G.contextMode===`full`,focusLine:y}),x?(0,q.jsx)(`div`,{className:`pointer-events-none absolute bottom-3 right-3 z-20`,children:(0,q.jsx)(`div`,{className:`pointer-events-auto`,children:(0,q.jsx)(tt,{filePath:t.path,staged:m,busyAction:oe,disabled:oe!==null,onAction:Se})})}):null]}):null]})]})}),it=({hideStackedFileSidebar:e=!1,stackedDefaultCollapsedAll:t=!1,pinSelectedFileHeaderToTopOnNavigate:n=!1,showOpenInEditorAction:r=!1,diffScope:i=`all`,turnMessageId:a=null,sessionId:o=null,directory:s=null,onDiffScopeChange:c,targetFilePath:l=null,targetLine:u=null,toolPatches:p=null,flushContent:m=!1,singleFileView:h=!1,toolbarInSheetHeader:g=!1,preloadFullFiles:S=!1,navigationRequestKey:w})=>{let{t:M}=ee(),{git:N}=ae(),ne=oe(),P=typeof s==`string`&&s.trim()?s.trim():ne,{screenWidth:F,isMobile:re}=te({includeScreenWidth:!0}),ie=le(P??null),I=se(P??null),R=ce(P??null),B=L(e=>e.setActiveDirectory),de=L(e=>e.ensureStatus),fe=L(e=>e.fetchStatus),V=L(e=>e.setDiff),[H,U]=z.useState(null),[pe,me]=z.useState(!1),[W,ve]=z.useState(null),[ye,be]=z.useState(null),[K,xe]=z.useState(()=>new Set),[Se,Ce]=z.useState(()=>new Set),[we,Te]=z.useState(!1),[Ee,De]=z.useState(0),[J,ke]=z.useState(i);z.useEffect(()=>{ke(i)},[i]);let je=f(e=>e.pendingDiffFile),Me=f(e=>e.pendingDiffStaged),Pe=f(e=>e.pendingDiffScope),Fe=f(e=>e.pendingDiffLine),Ie=f(e=>e.setPendingDiffFile),Le=f(e=>e.diffLayoutPreference),Re=f(e=>e.diffFileLayout),Ge=f(e=>e.setDiffFileLayout),Je=f(e=>e.diffWrapLines),Xe=f(e=>e.setDiffWrapLines),$e=f(e=>e.openContextFileAtLine),et=f(e=>e.openContextFile),tt=O(),nt=y(e=>e.currentSessionId),it=typeof o==`string`&&o.trim()?o.trim():nt,at=v(it??``,P??void 0),ot=Je,st=J===`staged`||J!==`working`&&null,ct=st??pe,lt=!e&&!(re||F<=768)&&F>=1024,ut=z.useRef(null),dt=z.useRef(new Map),ft=z.useRef(null),Y=z.useRef(null),pt=z.useRef(!1),mt=z.useRef(null),ht=z.useRef(null),gt=z.useRef(null),_t=z.useRef(null),vt=z.useCallback(()=>{ft.current=null,pt.current=!1,be(null),Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null)},[]),yt=z.useCallback(e=>{xe(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),X=z.useMemo(()=>{let e=at.length-1;if(a&&(e=at.findIndex(e=>e.id===a),e<0))return{messageID:null,count:0,hasDiffs:!1,thinDiffs:[]};for(let t=e;t>=0;--t){let e=at[t];if(e.role!==`user`)continue;let n=Ke(e.summary?.diffs),r=typeof e.summary?.diffCount==`number`&&Number.isFinite(e.summary.diffCount)?Math.max(0,Math.trunc(e.summary.diffCount)):n.length;return{messageID:typeof e.id==`string`&&e.id?e.id:null,count:r,hasDiffs:e.summary?.hasDiffs===!0||r>0||n.length>0,thinDiffs:n}}return{messageID:null,count:0,hasDiffs:!1,thinDiffs:[]}},[at,a]),bt=z.useMemo(()=>G(p??[]),[p]),xt=bt.length>0,St=z.useMemo(()=>!it||!P||!X.messageID?null:{sessionID:it,directory:P,messageID:X.messageID,diffCount:X.count},[P,it,X.count,X.messageID]),Ct=z.useMemo(()=>xt?bt:X.thinDiffs,[bt,X.thinDiffs,xt]),wt=z.useMemo(()=>{let e=new Map;for(let t of Ct)if(t.file){if(typeof t.patch==`string`&&t.patch.length>0){e.set(t.file,Ye(t.file,t.patch,`patch`));continue}(typeof t.before==`string`&&t.before.length>0||typeof t.after==`string`&&t.after.length>0)&&e.set(t.file,{original:t.before??``,modified:t.after??``,contextMode:`full`})}return e},[Ct]),Z=z.useMemo(()=>{if(J===`turn`)return Ct.map(e=>({path:e.file??``,index:``,working_dir:qe(e.status),insertions:e.additions??0,deletions:e.deletions??0,isNew:e.status===`added`})).filter(e=>e.path).sort((e,t)=>e.path.localeCompare(t.path));if(!I?.files)return[];let e=I.diffStats??{},t=J===`staged`?Be:J===`working`?Ve:()=>!0;return I.files.filter(t).map(t=>({...t,insertions:e[t.path]?.insertions??0,deletions:e[t.path]?.deletions??0,isNew:ze(t)})).sort((e,t)=>e.path.localeCompare(t.path))},[J,Ct,I]),Tt=z.useMemo(()=>I?.files?I.files.filter(Ve).length:0,[I]),Et=z.useMemo(()=>I?.files?I.files.filter(Be).length:0,[I]),Dt=xt?Ct.length:X.count,Ot=z.useMemo(()=>Z.map(e=>e.path).join(`\0`),[Z]),Q=z.useMemo(()=>{if(!h)return Z;let e=l?.trim()||H;return e?Z.filter(t=>t.path===e):[]},[Z,H,h,l]);z.useEffect(()=>{let e=Ot?Ot.split(`\0`):[],n=new Set(e),r=`${P??``}:${J}:${a??``}:${t?`collapsed`:`default`}`,i=p!==null&&gt.current!==p,o=ht.current!==r||i;ht.current=r,gt.current=p,xe(r=>{if(o){let n=t||J===`turn`&&!xt?0:Ne(e.length);return new Set(e.slice(0,n))}let i=!1,a=new Set;for(let e of r){if(!n.has(e)){i=!0;continue}a.add(e)}return i?a:r}),Ce(e=>{if(o)return new Set;let t=!1,r=new Set;for(let i of e){if(!n.has(i)){t=!0;continue}r.add(i)}return t?r:e})},[J,Ot,P,t,p,a,xt]);let kt=z.useCallback(()=>{mt.current=null;let e=ut.current;if(!e)return;let t=e.getBoundingClientRect(),n=t.top-Ae,r=t.bottom+Ae,i={};for(let[e,t]of dt.current){if(!t||!K.has(e))continue;let a=t.getBoundingClientRect();a.bottom<n||a.top>r||(i[e]=!0)}Ce(e=>{let t=!1,n=new Set(e);for(let e of Object.keys(i))n.has(e)||(n.add(e),t=!0);return t?n:e})},[K]),$=z.useCallback(()=>{typeof window>`u`||mt.current===null&&(mt.current=window.requestAnimationFrame(kt))},[kt]);z.useEffect(()=>{let e=ut.current;if(e)return $(),e.addEventListener(`scroll`,$,{passive:!0}),window.addEventListener(`resize`,$),()=>{e.removeEventListener(`scroll`,$),window.removeEventListener(`resize`,$),mt.current!==null&&(window.cancelAnimationFrame(mt.current),mt.current=null)}},[Z,K,$]);let At=z.useCallback(e=>{let t=Re[e.path];if(t)return t;if(Le===`inline`)return`inline`;if(Le===`side-by-side`)return`side-by-side`;let n=F<Oe;return e.isNew||n?`inline`:`side-by-side`},[Re,Le,F]),jt=z.useMemo(()=>Q.length===0?null:Q.every(e=>At(e)===`side-by-side`)?`side-by-side`:`inline`,[At,Q]);z.useEffect(()=>{P&&(B(P),de(P,N))},[P,B,de,N]),z.useEffect(()=>{if(P)return x.onGitRefreshHint(e=>{Ue(e.directory)===Ue(P)&&fe(P,N)})},[P,fe,N]),z.useEffect(()=>{J!==`all`&&!Pe||je&&(Pe&&ke(Pe),U(je),me(Pe===`staged`||!Pe&&Me),ve(Fe),Ie(null),pt.current=!0,ft.current=je,yt(je),De(e=>e+1))},[J,yt,je,Fe,Pe,Me,Ie]),z.useEffect(()=>{if(J===`all`)return;let e=l?.trim();if(!e)return;yt(e),U(e),me(J===`staged`),ve(u);let t=ge({scope:J,navigationRequestKey:w,targetFilePath:e,targetLine:u}),n=Z.some(t=>t.path===e);_e(_t.current,t,n)&&(_t.current=t,pt.current=!0,ft.current=e,De(e=>e+1))},[J,Z,yt,w,l,u]),z.useEffect(()=>{H&&(Z.some(e=>e.path===H)||(U(null),me(!1)))},[Z,H]);let Mt=z.useCallback((e,t)=>{let n=dt.current;t?n.set(e,t):n.delete(e),$()},[$]),Nt=z.useCallback((e,t)=>{vt(),xe(n=>{if(t===n.has(e))return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),t||Ce(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),$()},[vt,$]),Pt=z.useCallback(()=>{vt(),xe(e=>e.size>0?new Set:new Set(Z.map(e=>e.path))),Ce(new Set),$()},[vt,Z,$]),Ft=z.useCallback(e=>{let t=dt.current.get(e),n=ut.current;if(!t||!n)return!1;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect().top-r.top,a=Math.max(0,n.scrollHeight-n.clientHeight);return n.scrollTop=Math.min(a,Math.max(0,n.scrollTop+i)),!0},[]);z.useEffect(()=>{if(!ft.current)return;let e=0,t=!1,r=()=>{t||(t=!0,ft.current=null,pt.current=!1,be(null),Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null))},i=()=>{if(t){Y.current=null;return}let a=ft.current;if(!a){r(),Y.current=null;return}if(!Ft(a)){e+=1,e<20?Y.current=window.requestAnimationFrame(i):(r(),Y.current=null);return}n&&pt.current&&be(a),r()};return Y.current=window.requestAnimationFrame(i),()=>{t=!0,Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null)}},[n,Ee,Ft]);let It=z.useCallback(e=>{},[]),Lt=z.useCallback(e=>{vt(),U(e),me(!1),pt.current=!0,ft.current=e,yt(e),De(e=>e+1),Ft(e)},[vt,yt,Ft]),Rt=z.useCallback(e=>{let t=e===`side-by-side`?`side-by-side`:`inline`;Q.forEach(e=>{Ge(e.path,t)})},[Ge,Q]),[zt,Bt]=z.useState(null),Vt=z.useCallback(async(e,t)=>{if(!(!P||!e)){Bt(e);try{let n=null;if(t?.patch&&!t.isBinary&&!T(e)?n=he(t.patch):t&&t.contextMode===`full`&&!t.isBinary&&!T(e)&&(n=We(t.original,t.modified)),n===null)try{n=he((await N.getGitDiff(P,{path:e,staged:ct,contextLines:3})).diff)}catch{n=null}let r=t;if(n===null||!r){let t=await N.getGitFileDiff(P,{path:e,staged:ct});r={original:t.original??``,modified:t.modified??``,isBinary:t.isBinary},ct||V(P,e,r)}let i=n??(r.isBinary||T(e)?1:We(r.original,r.modified)),a=He(P,e);$e(P,a,i,1)}finally{Bt(t=>t===e?null:t)}}},[ct,P,N,$e,V]),Ht=d(e=>{if(!P||!e)return;let t=He(P,e);if(tt){tt.openFile({path:t});return}et(P,t)}),Ut=()=>{if(!P)return null;let e=e=>st===null?pe&&e===H:st;return(0,q.jsxs)(`div`,{className:b(`flex min-w-0 flex-1 min-h-0 h-full`,m?`gap-0`:`gap-3 px-3 pb-3 pt-2`),children:[lt&&(0,q.jsxs)(`section`,{className:`hidden lg:flex w-72 flex-col rounded-xl border border-border/60 bg-background/70 overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-b border-border/40`,children:[(0,q.jsx)(`span`,{className:`typography-code font-semibold text-foreground`,children:M(`diffView.section.files`)}),(0,q.jsx)(`span`,{className:`typography-code text-muted-foreground`,children:Z.length})]}),(0,q.jsx)(Qe,{changedFiles:Z,selectedFile:null,onSelectFile:Lt})]}),(0,q.jsx)(`div`,{className:`relative flex-1 min-w-0 min-h-0 h-full`,children:(0,q.jsx)(E,{ref:ut,outerClassName:`min-h-0 h-full`,className:`[overflow-anchor:none] pb-16 pwa-overlay-scroll`,disableHorizontal:!0,observeMutations:!1,preventOverscroll:!0,"data-diff-virtual-root":!0,children:(0,q.jsx)(`div`,{className:`flex flex-col [overflow-anchor:none]`,"data-diff-virtual-content":!0,children:Q.map(t=>(0,q.jsx)(rt,{directory:P,file:t,layout:At(t),wrapLines:ot,isSelected:!1,isExpanded:K.has(t.path),isMounted:Se.has(t.path)||t.path===ye||h&&Q.length===1,onSelect:It,onExpandedChange:Nt,registerSectionRef:Mt,showOpenInEditorAction:r&&J!==`turn`,isOpeningInEditor:zt===t.path,onOpenInEditor:(e,t)=>{Vt(e,t)},onOpenFile:Ht,staged:e(t.path),loadFullFiles:we,preloadFullFiles:S,initialDiffData:J===`turn`?wt.get(t.path)??null:null,focusLine:t.path===(l?.trim()||H)?u??W:null,showFileActions:J!==`turn`,disableGitFetch:J===`turn`,turnChangesRequest:St,loadTurnChangeFile:J===`turn`&&!xt},t.path))})})})]})},Wt=()=>P?J!==`turn`&&R&&!I?(0,q.jsxs)(`div`,{className:`flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,q.jsx)(C,{name:`loader-4`,className:`size-4 animate-spin`}),M(`diffView.state.loadingRepositoryStatus`)]}):J!==`turn`&&ie===!1?(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:M(`diffView.state.notGitRepository`)}):Q.length===0?(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:M(J===`turn`?`diffView.state.noLastTurnChanges`:`diffView.state.cleanWorkingTree`)}):Ut():(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:M(`diffView.state.selectSessionDirectory`)}),Gt=h?null:(0,q.jsxs)(q.Fragment,{children:[!re&&!g&&(J===`working`||J===`staged`||J===`turn`?(0,q.jsx)(Ze,{scope:J,workingCount:Tt,stagedCount:Et,turnCount:Dt,onScopeChange:e=>{ke(e),c?.(e)}}):(0,q.jsx)(`div`,{className:`flex items-center gap-1 rounded-md px-2 py-1 text-muted-foreground shrink-0`,children:(0,q.jsx)(`span`,{className:`typography-code font-semibold text-foreground`,children:R&&!I?M(`diffView.state.loadingChanges`):Q.length===1?M(`diffView.summary.changedFilesSingle`,{count:Q.length}):M(`diffView.summary.changedFilesPlural`,{count:Q.length})})})),!h&&Z.length>0&&(J!==`turn`||xt)&&(0,q.jsxs)(_,{variant:`ghost`,size:`sm`,onClick:Pt,className:b(`diff-toolbar__expand-button h-7 flex-shrink-0 gap-1 px-1.5 text-muted-foreground hover:text-foreground`,`ml-auto`),title:K.size>0?M(`diffView.actions.collapseAll`):M(`diffView.actions.expandAll`),children:[(0,q.jsx)(C,{name:`expand-up-down`,className:`size-4`}),(0,q.jsx)(`span`,{className:b(`diff-toolbar__expand-label typography-code`,g&&`hidden`),children:K.size>0?M(`diffView.actions.collapseAll`):M(`diffView.actions.expandAll`)})]}),Z.length>0&&J!==`turn`&&(0,q.jsxs)(j,{children:[(0,q.jsx)(k,{asChild:!0,children:(0,q.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>Te(e=>!e),"aria-pressed":we,"aria-label":M(we?`diffView.actions.disableFullFiles`:`diffView.actions.loadFullFiles`),className:b(`h-7 w-7 flex-shrink-0 p-0 text-muted-foreground hover:text-foreground`,we&&`bg-interactive-selection text-interactive-selection-foreground`),children:(0,q.jsx)(C,{name:`file-download`,className:`size-4`})})}),(0,q.jsx)(A,{children:(0,q.jsx)(`p`,{children:M(we?`diffView.actions.disableFullFiles`:`diffView.actions.loadFullFiles`)})})]}),Z.length>0&&(0,q.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>Xe(!Je),className:b(`h-5 w-5 p-0 transition-opacity`,ot?`text-foreground opacity-100`:`text-muted-foreground opacity-60 hover:opacity-100`),title:M(ot?`diffView.actions.disableLineWrap`:`diffView.actions.enableLineWrap`),children:(0,q.jsx)(C,{name:`text-wrap`,className:`size-4`})}),jt&&(0,q.jsx)(ue,{mode:jt===`side-by-side`?`side-by-side`:`unified`,onModeChange:Rt})]});return(0,q.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-background`,children:[Gt?g?(0,q.jsx)(D,{children:Gt}):(0,q.jsx)(`div`,{className:`@container/diff-toolbar flex min-w-0 items-center gap-1.5 px-2 py-1.5 bg-background`,children:Gt}):null,Wt()]})};export{De as n,it as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-wXsskyKm.js";import{n}from"./vendor-react-BkccXcWz.js";import{Yn as r,no as i}from"./ui-DeV7Us1B.js";import{n as a}from"./Icon-C1m8PihJ.js";var o=n();t();var s=e(),c=e=>{let t=(0,o.c)(12),{mode:n,onModeChange:c,className:l}=e,u;t[0]!==n||t[1]!==c?(u=e=>{e.stopPropagation(),c(n===`side-by-side`?`unified`:`side-by-side`)},t[0]=n,t[1]=c,t[2]=u):u=t[2];let d=u,f;t[3]===l?f=t[4]:(f=i(`h-5 w-5 p-0 opacity-60 hover:opacity-100`,l),t[3]=l,t[4]=f);let p=n===`side-by-side`?`Switch to unified view`:`Switch to side-by-side view`,m;t[5]===n?m=t[6]:(m=n===`side-by-side`?(0,s.jsx)(a,{name:`align-justify`,className:`h-3 w-3`}):(0,s.jsx)(a,{name:`layout-column`,className:`h-3 w-3`}),t[5]=n,t[6]=m);let h;return t[7]!==d||t[8]!==f||t[9]!==p||t[10]!==m?(h=(0,s.jsx)(r,{size:`sm`,variant:`ghost`,className:f,onClick:d,title:p,children:m}),t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h):h=t[11],h};export{c as t};
1
+ import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-wXsskyKm.js";import{n}from"./vendor-react-BkccXcWz.js";import{Xn as r,io as i}from"./ui-BCYkB585.js";import{n as a}from"./Icon-C1rjS64C.js";var o=n();t();var s=e(),c=e=>{let t=(0,o.c)(12),{mode:n,onModeChange:c,className:l}=e,u;t[0]!==n||t[1]!==c?(u=e=>{e.stopPropagation(),c(n===`side-by-side`?`unified`:`side-by-side`)},t[0]=n,t[1]=c,t[2]=u):u=t[2];let d=u,f;t[3]===l?f=t[4]:(f=i(`h-5 w-5 p-0 opacity-60 hover:opacity-100`,l),t[3]=l,t[4]=f);let p=n===`side-by-side`?`Switch to unified view`:`Switch to side-by-side view`,m;t[5]===n?m=t[6]:(m=n===`side-by-side`?(0,s.jsx)(a,{name:`align-justify`,className:`h-3 w-3`}):(0,s.jsx)(a,{name:`layout-column`,className:`h-3 w-3`}),t[5]=n,t[6]=m);let h;return t[7]!==d||t[8]!==f||t[9]!==p||t[10]!==m?(h=(0,s.jsx)(r,{size:`sm`,variant:`ghost`,className:f,onClick:d,title:p,children:m}),t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h):h=t[11],h};export{c as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{Yn as i,to as a}from"./ui-DeV7Us1B.js";import{n as o}from"./Icon-C1m8PihJ.js";import{t as s}from"./i18n-CBCskgqa.js";import{i as c,n as l,r as u,t as d}from"./card-alsnQayp.js";var f=r(),p=e(n(),1),m=t(),h=class extends p.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t,copied:!1}),console.error(`Error caught by boundary:`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})};handleCopy=async()=>{let{strings:e}=this.props,t=`${this.state.error?String(this.state.error):e.unknownError}${this.state.error?.stack?`\n\nStack:\n${this.state.error.stack}`:``}${this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``}`;(await a(t)).ok&&(this.setState({copied:!0}),window.setTimeout(()=>{this.setState(e=>e.copied?{copied:!1}:null)},1500))};render(){let{strings:e}=this.props;return this.state.hasError?this.props.fallback?this.props.fallback:(0,m.jsx)(`div`,{className:`p-4 flex items-center justify-center min-h-screen`,children:(0,m.jsxs)(d,{className:`w-full max-w-md`,children:[(0,m.jsx)(u,{className:`text-center`,children:(0,m.jsxs)(c,{className:`flex items-center justify-center gap-2 text-destructive`,children:[(0,m.jsx)(o,{name:`error-warning`,className:`h-5 w-5`}),e.title]})}),(0,m.jsxs)(l,{className:`space-y-4`,children:[(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground text-center`,children:e.description}),this.state.error&&(0,m.jsxs)(`details`,{className:`text-xs font-mono bg-muted p-3 rounded`,children:[(0,m.jsx)(`summary`,{className:`cursor-pointer hover:bg-interactive-hover/80`,children:e.detailsSummary}),(0,m.jsxs)(`pre`,{className:`mt-2 max-h-48 overflow-auto`,children:[this.state.error.toString(),this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``]})]}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsxs)(i,{onClick:this.handleReset,variant:`outline`,className:`flex-1`,children:[(0,m.jsx)(o,{name:`restart`,className:`h-4 w-4 mr-2`}),e.tryAgain]}),(0,m.jsx)(i,{onClick:this.handleCopy,variant:`outline`,className:`flex-1`,children:this.state.copied?e.copied:e.copy})]})]})]})}):this.props.children}},g=e=>{let t=(0,f.c)(29),{children:n,fallback:r}=e,{t:i}=s(),a;t[0]===i?a=t[1]:(a=i(`errorBoundary.state.unknownError`),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i(`errorBoundary.title`),t[2]=i,t[3]=o);let c;t[4]===i?c=t[5]:(c=i(`errorBoundary.description`),t[4]=i,t[5]=c);let l;t[6]===i?l=t[7]:(l=i(`errorBoundary.actions.errorDetails`),t[6]=i,t[7]=l);let u;t[8]===i?u=t[9]:(u=i(`errorBoundary.state.componentStackLabel`),t[8]=i,t[9]=u);let d;t[10]===i?d=t[11]:(d=i(`errorBoundary.actions.tryAgain`),t[10]=i,t[11]=d);let p;t[12]===i?p=t[13]:(p=i(`errorBoundary.actions.copied`),t[12]=i,t[13]=p);let g;t[14]===i?g=t[15]:(g=i(`errorBoundary.actions.copy`),t[14]=i,t[15]=g);let _;t[16]!==a||t[17]!==o||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==p||t[23]!==g?(_={unknownError:a,title:o,description:c,detailsSummary:l,componentStackLabel:u,tryAgain:d,copied:p,copy:g},t[16]=a,t[17]=o,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=p,t[23]=g,t[24]=_):_=t[24];let v=_,y;return t[25]!==n||t[26]!==r||t[27]!==v?(y=(0,m.jsx)(h,{fallback:r,strings:v,children:n}),t[25]=n,t[26]=r,t[27]=v,t[28]=y):y=t[28],y};export{g as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{Xn as i,ro as a}from"./ui-BCYkB585.js";import{n as o}from"./Icon-C1rjS64C.js";import{t as s}from"./i18n-iu4pzqPi.js";import{i as c,n as l,r as u,t as d}from"./card-aoveY4I3.js";var f=r(),p=e(n(),1),m=t(),h=class extends p.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t,copied:!1}),console.error(`Error caught by boundary:`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})};handleCopy=async()=>{let{strings:e}=this.props,t=`${this.state.error?String(this.state.error):e.unknownError}${this.state.error?.stack?`\n\nStack:\n${this.state.error.stack}`:``}${this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``}`;(await a(t)).ok&&(this.setState({copied:!0}),window.setTimeout(()=>{this.setState(e=>e.copied?{copied:!1}:null)},1500))};render(){let{strings:e}=this.props;return this.state.hasError?this.props.fallback?this.props.fallback:(0,m.jsx)(`div`,{className:`p-4 flex items-center justify-center min-h-screen`,children:(0,m.jsxs)(d,{className:`w-full max-w-md`,children:[(0,m.jsx)(u,{className:`text-center`,children:(0,m.jsxs)(c,{className:`flex items-center justify-center gap-2 text-destructive`,children:[(0,m.jsx)(o,{name:`error-warning`,className:`h-5 w-5`}),e.title]})}),(0,m.jsxs)(l,{className:`space-y-4`,children:[(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground text-center`,children:e.description}),this.state.error&&(0,m.jsxs)(`details`,{className:`text-xs font-mono bg-muted p-3 rounded`,children:[(0,m.jsx)(`summary`,{className:`cursor-pointer hover:bg-interactive-hover/80`,children:e.detailsSummary}),(0,m.jsxs)(`pre`,{className:`mt-2 max-h-48 overflow-auto`,children:[this.state.error.toString(),this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``]})]}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsxs)(i,{onClick:this.handleReset,variant:`outline`,className:`flex-1`,children:[(0,m.jsx)(o,{name:`restart`,className:`h-4 w-4 mr-2`}),e.tryAgain]}),(0,m.jsx)(i,{onClick:this.handleCopy,variant:`outline`,className:`flex-1`,children:this.state.copied?e.copied:e.copy})]})]})]})}):this.props.children}},g=e=>{let t=(0,f.c)(29),{children:n,fallback:r}=e,{t:i}=s(),a;t[0]===i?a=t[1]:(a=i(`errorBoundary.state.unknownError`),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i(`errorBoundary.title`),t[2]=i,t[3]=o);let c;t[4]===i?c=t[5]:(c=i(`errorBoundary.description`),t[4]=i,t[5]=c);let l;t[6]===i?l=t[7]:(l=i(`errorBoundary.actions.errorDetails`),t[6]=i,t[7]=l);let u;t[8]===i?u=t[9]:(u=i(`errorBoundary.state.componentStackLabel`),t[8]=i,t[9]=u);let d;t[10]===i?d=t[11]:(d=i(`errorBoundary.actions.tryAgain`),t[10]=i,t[11]=d);let p;t[12]===i?p=t[13]:(p=i(`errorBoundary.actions.copied`),t[12]=i,t[13]=p);let g;t[14]===i?g=t[15]:(g=i(`errorBoundary.actions.copy`),t[14]=i,t[15]=g);let _;t[16]!==a||t[17]!==o||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==p||t[23]!==g?(_={unknownError:a,title:o,description:c,detailsSummary:l,componentStackLabel:u,tryAgain:d,copied:p,copy:g},t[16]=a,t[17]=o,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=p,t[23]=g,t[24]=_):_=t[24];let v=_,y;return t[25]!==n||t[26]!==r||t[27]!==v?(y=(0,m.jsx)(h,{fallback:r,strings:v,children:n}),t[25]=n,t[26]=r,t[27]=v,t[28]=y):y=t[28],y};export{g as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{no as i}from"./ui-DeV7Us1B.js";var a=[`user-blocking`,`visible`,`background`],o=e=>{let t={"user-blocking":{head:null,tail:null},visible:{head:null,tail:null},background:{head:null,tail:null}},n=Math.max(1,Math.floor(e.maxTasksPerFrame)),r=Math.max(1,e.frameBudgetMs),i=null,o=!1,s=0,c=e=>{let n=t[e.priority];e.previous=n.tail,n.tail?n.tail.next=e:n.head=e,n.tail=e},l=e=>{let n=t[e.priority];e.previous?e.previous.next=e.next:n.head=e.next,e.next?e.next.previous=e.previous:n.tail=e.previous,e.next=null,e.previous=null},u=()=>{for(let e of a){let n=t[e].head;if(n)return l(n),n.consumed=!0,--s,n}return null},d=()=>{i===null&&s!==0&&(i=e.requestFrame(f))},f=()=>{i=null;let t=e.now(),a=0;for(;s>0&&a<n;){let n=u();if(!n||(n.run(),a+=1,e.now()-t>=r))break}d()},p=()=>{i!==null||o||s===0||(o=!0,i=e.requestFrame(()=>{i=null,o=!1,d()}))};return{enqueue(t,n){let r={cancelled:!1,consumed:!1,next:null,previous:null,priority:n?.priority??`background`,run:t};return c(r),s+=1,!o&&i===null&&p(),()=>{r.cancelled||r.consumed||(r.cancelled=!0,l(r),--s,s===0&&(i!==null&&(e.cancelFrame(i),i=null),o=!1))}},clear(){for(let e of a){let n=t[e],r=n.head;for(;r;){let e=r.next;r.cancelled=!0,r.next=null,r.previous=null,r=e}n.head=null,n.tail=null}s=0,i!==null&&(e.cancelFrame(i),i=null),o=!1}}},s=null,c=()=>typeof window>`u`?null:s||(s=o({requestFrame:e=>window.requestAnimationFrame(e),cancelFrame:e=>window.cancelAnimationFrame(e),now:()=>performance.now(),maxTasksPerFrame:2,frameBudgetMs:6}),s),l=(e,t)=>{let n=c();return n?n.enqueue(e,t):(e(),()=>{})},u={textThrottleMs:20,markdownPaceMs:64},d={textThrottleMs:100,markdownPaceMs:128},f=e=>e===`android`?d:u,p=r(),m=e(n(),1),h=t(),g=m.createContext(!1),_=e=>{let t=(0,p.c)(3),{disabled:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,h.jsx)(g.Provider,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i},v=e=>{let t=(0,p.c)(6),{children:n,className:r,animate:a}=e,o=a===void 0||a,[s]=m.useState(o),c=s&&`animate-in fade-in slide-in-from-bottom-2 duration-300 ease-out`,l;t[0]!==r||t[1]!==c?(l=i(`w-full`,c,r),t[0]=r,t[1]=c,t[2]=l):l=t[2];let u;return t[3]!==n||t[4]!==l?(u=(0,h.jsx)(`div`,{className:l,children:n}),t[3]=n,t[4]=l,t[5]=u):u=t[5],u},y=e=>{let t=(0,p.c)(11),{children:n,className:r,skipAnimation:i,forceAnimation:a,ignoreContextDisabled:o,respectReducedMotion:s}=e,c=a!==void 0&&a,l=o!==void 0&&o,u=s!==void 0&&s,d=m.useContext(g),f;t[0]===u?f=t[1]:(f=u&&typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,t[0]=u,t[1]=f);let _=!!i||!l&&d||f,y=c;if(c){let e=!_,i;return t[2]!==n||t[3]!==r||t[4]!==e?(i=(0,h.jsx)(v,{className:r,animate:e,children:n}),t[2]=n,t[3]=r,t[4]=e,t[5]=i):i=t[5],i}if(!y||_){let e;return t[6]===n?e=t[7]:(e=(0,h.jsx)(h.Fragment,{children:n}),t[6]=n,t[7]=e),e}let b;return t[8]!==n||t[9]!==r?(b=(0,h.jsx)(v,{className:r,children:n}),t[8]=n,t[9]=r,t[10]=b):b=t[10],b};export{l as i,y as n,f as r,_ as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{io as i}from"./ui-BCYkB585.js";var a=[`user-blocking`,`visible`,`background`],o=e=>{let t={"user-blocking":{head:null,tail:null},visible:{head:null,tail:null},background:{head:null,tail:null}},n=Math.max(1,Math.floor(e.maxTasksPerFrame)),r=Math.max(1,e.frameBudgetMs),i=null,o=!1,s=0,c=e=>{let n=t[e.priority];e.previous=n.tail,n.tail?n.tail.next=e:n.head=e,n.tail=e},l=e=>{let n=t[e.priority];e.previous?e.previous.next=e.next:n.head=e.next,e.next?e.next.previous=e.previous:n.tail=e.previous,e.next=null,e.previous=null},u=()=>{for(let e of a){let n=t[e].head;if(n)return l(n),n.consumed=!0,--s,n}return null},d=()=>{i===null&&s!==0&&(i=e.requestFrame(f))},f=()=>{i=null;let t=e.now(),a=0;for(;s>0&&a<n;){let n=u();if(!n||(n.run(),a+=1,e.now()-t>=r))break}d()},p=()=>{i!==null||o||s===0||(o=!0,i=e.requestFrame(()=>{i=null,o=!1,d()}))};return{enqueue(t,n){let r={cancelled:!1,consumed:!1,next:null,previous:null,priority:n?.priority??`background`,run:t};return c(r),s+=1,!o&&i===null&&p(),()=>{r.cancelled||r.consumed||(r.cancelled=!0,l(r),--s,s===0&&(i!==null&&(e.cancelFrame(i),i=null),o=!1))}},clear(){for(let e of a){let n=t[e],r=n.head;for(;r;){let e=r.next;r.cancelled=!0,r.next=null,r.previous=null,r=e}n.head=null,n.tail=null}s=0,i!==null&&(e.cancelFrame(i),i=null),o=!1}}},s=null,c=()=>typeof window>`u`?null:s||(s=o({requestFrame:e=>window.requestAnimationFrame(e),cancelFrame:e=>window.cancelAnimationFrame(e),now:()=>performance.now(),maxTasksPerFrame:2,frameBudgetMs:6}),s),l=(e,t)=>{let n=c();return n?n.enqueue(e,t):(e(),()=>{})},u={textThrottleMs:20,markdownPaceMs:64},d={textThrottleMs:100,markdownPaceMs:128},f=e=>e===`android`?d:u,p=r(),m=e(n(),1),h=t(),g=m.createContext(!1),_=e=>{let t=(0,p.c)(3),{disabled:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,h.jsx)(g.Provider,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i},v=e=>{let t=(0,p.c)(6),{children:n,className:r,animate:a}=e,o=a===void 0||a,[s]=m.useState(o),c=s&&`animate-in fade-in slide-in-from-bottom-2 duration-300 ease-out`,l;t[0]!==r||t[1]!==c?(l=i(`w-full`,c,r),t[0]=r,t[1]=c,t[2]=l):l=t[2];let u;return t[3]!==n||t[4]!==l?(u=(0,h.jsx)(`div`,{className:l,children:n}),t[3]=n,t[4]=l,t[5]=u):u=t[5],u},y=e=>{let t=(0,p.c)(11),{children:n,className:r,skipAnimation:i,forceAnimation:a,ignoreContextDisabled:o,respectReducedMotion:s}=e,c=a!==void 0&&a,l=o!==void 0&&o,u=s!==void 0&&s,d=m.useContext(g),f;t[0]===u?f=t[1]:(f=u&&typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,t[0]=u,t[1]=f);let _=!!i||!l&&d||f,y=c;if(c){let e=!_,i;return t[2]!==n||t[3]!==r||t[4]!==e?(i=(0,h.jsx)(v,{className:r,animate:e,children:n}),t[2]=n,t[3]=r,t[4]=e,t[5]=i):i=t[5],i}if(!y||_){let e;return t[6]===n?e=t[7]:(e=(0,h.jsx)(h.Fragment,{children:n}),t[6]=n,t[7]=e),e}let b;return t[8]!==n||t[9]!==r?(b=(0,h.jsx)(v,{className:r,children:n}),t[8]=n,t[9]=r,t[10]=b):b=t[10],b};export{l as i,y as n,f as r,_ as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./platform-z1TeG-ky.js";import{ot as n,st as r}from"./vendor-base-ui-wXsskyKm.js";import{n as i}from"./vendor-react-BkccXcWz.js";import{r as a}from"./vendor-reactuses-core-DjKFMfz7.js";import{t as o}from"./ui-DeV7Us1B.js";import{t as s}from"./i18n-CBCskgqa.js";import{i as c,t as l}from"./MobileHtmlNetworkBoundary-5XyCoKjL.js";function u(e,t){return JSON.stringify(e.filter(({id:e})=>t===void 0||e===t).map(({id:e,status:t,revision:n})=>[e,t,n]))}var d=i(),f=e(r(),1),p=n();function m(e){let t=(0,d.c)(4),{target:n}=e,r=f.useRef(null),i,a;t[0]===n?(i=t[1],a=t[2]):(i=()=>(r.current?.append(n),()=>{n.remove()}),a=[n],t[0]=n,t[1]=i,t[2]=a),f.useLayoutEffect(i,a);let o;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{ref:r,className:`relative z-30 flex items-center gap-1 empty:hidden [&>div]:flex [&>div]:items-center [&>div]:gap-1`,"data-gui-preview-actions":!0}),t[3]=o):o=t[3],o}var h=f.memo(function(e){let n=(0,d.c)(2),r;return n[0]===e?r=n[1]:(r=t()?(0,p.jsx)(l,{connect:!1,children:()=>(0,p.jsx)(g,{...e})}):(0,p.jsx)(g,{...e}),n[0]=e,n[1]=r),r});function g({host:e,contributionKey:t,kind:n,revision:r,fallback:i,actions:l}){let{t:u}=s(),d=f.useRef(null),[h]=f.useState(()=>document.createElement(`div`)),g=l??h,[_,v]=f.useState(null),y=i!=null,[b,x]=f.useState(y),S=a(e=>{o.error(e instanceof Error?e.message:u(`guiPlugins.error`))});return f.useLayoutEffect(()=>{let r=d.current;if(!r)return;v(null),x(y);let i,a=!1,o=0,s=()=>{if(!a)try{i=n===`panel`?e.mountPanel(t,r,g):n===`page`?e.mountPage(t,r):e.mountSettings(t,r)}catch(e){r.replaceChildren(),v({cause:e})}finally{x(!1)}};return y?o=requestAnimationFrame(()=>{o=requestAnimationFrame(s)}):s(),()=>{a=!0,cancelAnimationFrame(o);try{i?.()}catch(e){S(e)}finally{r.replaceChildren()}}},[e,t,n,r,y,S,g]),(0,p.jsxs)(`div`,{className:`relative flex flex-1 flex-col ${b?`min-h-[240px]!`:`min-h-0`}`,children:[n===`panel`&&!l?(0,p.jsx)(`div`,{className:`absolute right-3 top-3 z-30 flex items-center gap-1`,children:(0,p.jsx)(m,{target:h})}):null,_?(0,p.jsx)(c,{message:_.cause instanceof Error?_.cause.message:u(`guiPlugins.error`)}):null,(0,p.jsx)(`div`,{ref:d,className:`min-h-0 min-w-0 flex-1 overflow-auto${n===`page`?` overlay-scrollbar-target`:``}${_?` hidden`:``}`,"data-gui-plugin-mount":n}),b?(0,p.jsx)(`div`,{className:`absolute inset-0 flex`,children:i}):null]})}export{m as n,u as r,h as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./platform-B2ylz14u.js";import{ot as n,st as r}from"./vendor-base-ui-wXsskyKm.js";import{n as i}from"./vendor-react-BkccXcWz.js";import{r as a}from"./vendor-reactuses-core-DjKFMfz7.js";import{t as o}from"./ui-BCYkB585.js";import{t as s}from"./i18n-iu4pzqPi.js";import{i as c,t as l}from"./MobileHtmlNetworkBoundary-GBhYVYvu.js";function u(e,t){return JSON.stringify(e.filter(({id:e})=>t===void 0||e===t).map(({id:e,status:t,revision:n})=>[e,t,n]))}var d=i(),f=e(r(),1),p=n();function m(e){let t=(0,d.c)(4),{target:n}=e,r=f.useRef(null),i,a;t[0]===n?(i=t[1],a=t[2]):(i=()=>(r.current?.append(n),()=>{n.remove()}),a=[n],t[0]=n,t[1]=i,t[2]=a),f.useLayoutEffect(i,a);let o;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{ref:r,className:`relative z-30 flex items-center gap-1 empty:hidden [&>div]:flex [&>div]:items-center [&>div]:gap-1`,"data-gui-preview-actions":!0}),t[3]=o):o=t[3],o}var h=f.memo(function(e){let n=(0,d.c)(2),r;return n[0]===e?r=n[1]:(r=t()?(0,p.jsx)(l,{connect:!1,children:()=>(0,p.jsx)(g,{...e})}):(0,p.jsx)(g,{...e}),n[0]=e,n[1]=r),r});function g({host:e,contributionKey:t,kind:n,revision:r,fallback:i,actions:l}){let{t:u}=s(),d=f.useRef(null),[h]=f.useState(()=>document.createElement(`div`)),g=l??h,[_,v]=f.useState(null),y=i!=null,[b,x]=f.useState(y),S=a(e=>{o.error(e instanceof Error?e.message:u(`guiPlugins.error`))});return f.useLayoutEffect(()=>{let r=d.current;if(!r)return;v(null),x(y);let i,a=!1,o=0,s=()=>{if(!a)try{i=n===`panel`?e.mountPanel(t,r,g):n===`page`?e.mountPage(t,r):e.mountSettings(t,r)}catch(e){r.replaceChildren(),v({cause:e})}finally{x(!1)}};return y?o=requestAnimationFrame(()=>{o=requestAnimationFrame(s)}):s(),()=>{a=!0,cancelAnimationFrame(o);try{i?.()}catch(e){S(e)}finally{r.replaceChildren()}}},[e,t,n,r,y,S,g]),(0,p.jsxs)(`div`,{className:`relative flex flex-1 flex-col ${b?`min-h-[240px]!`:`min-h-0`}`,children:[n===`panel`&&!l?(0,p.jsx)(`div`,{className:`absolute right-3 top-3 z-30 flex items-center gap-1`,children:(0,p.jsx)(m,{target:h})}):null,_?(0,p.jsx)(c,{message:_.cause instanceof Error?_.cause.message:u(`guiPlugins.error`)}):null,(0,p.jsx)(`div`,{ref:d,className:`min-h-0 min-w-0 flex-1 overflow-auto${n===`page`?` overlay-scrollbar-target`:``}${_?` hidden`:``}`,"data-gui-plugin-mount":n}),b?(0,p.jsx)(`div`,{className:`absolute inset-0 flex`,children:i}):null]})}export{m as n,u as r,h as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./platform-z1TeG-ky.js";import{ot as n,st as r}from"./vendor-base-ui-wXsskyKm.js";import{n as i}from"./vendor-react-BkccXcWz.js";import{r as a}from"./useUIStore-Dz0bOfkB.js";import{Yn as o,no as s}from"./ui-DeV7Us1B.js";import{n as c}from"./Icon-C1m8PihJ.js";import{t as l}from"./i18n-CBCskgqa.js";import{a as u}from"./react-CPBNl-S9.js";import{i as d}from"./MobileHtmlNetworkBoundary-5XyCoKjL.js";import{t as f}from"./GuiPluginMount-FFI3j0Vq.js";import{t as p}from"./ErrorBoundary-BFXVt5ct.js";import{i as m}from"./pages-CYkE04ml.js";var h=e(r(),1),g=i(),_=n();function v(e){let t=(0,g.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=s(`relative isolate flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-background shadow-sm [--background:oklch(from_var(--surface-background)_min(1,calc(l_+_0.015))_c_h)] dark:[--background:color-mix(in_srgb,var(--surface-foreground)_4%,var(--surface-background))]`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,_.jsx)(`span`,{"aria-hidden":`true`,"data-workspace-surface-ring":!0,className:`pointer-events-none absolute inset-0 z-50 rounded-[inherit] ring-1 ring-inset ring-[var(--interactive-border)]`}),t[6]=o):o=t[6];let c;return t[7]!==n||t[8]!==i||t[9]!==a?(c=(0,_.jsxs)(`section`,{...i,"data-workspace-surface":!0,className:a,children:[n,o]}),t[7]=n,t[8]=i,t[9]=a,t[10]=c):c=t[10],c}function y(){let e=(0,g.c)(33),{host:n,snapshot:r,inventory:i,error:s,loading:y,requested:S,requestLoad:C,refresh:w}=u(),{t:T}=l(),E=a(x),D=a(b),O,k;e[0]!==C||e[1]!==S?(O=()=>{S||C()},k=[S,C],e[0]=C,e[1]=S,e[2]=O,e[3]=k):(O=e[2],k=e[3]),h.useEffect(O,k);let A=r.pages,j,M,N,P,F,I;if(e[4]!==s||e[5]!==n||e[6]!==i||e[7]!==D||e[8]!==E||e[9]!==y||e[10]!==w||e[11]!==S||e[12]!==r.pages||e[13]!==r.plugins||e[14]!==T){I=Symbol.for(`react.early_return_sentinel`);bb0:{let a;e[21]===E?a=e[22]:(a=e=>e.key===E,e[21]=E,e[22]=a);let l=A.find(a),u=r.plugins.find(e=>e.id===l?.pluginId)?.revision,h=m(E),g=r.plugins.some(e=>e.id===h&&e.status===`failed`)||i.some(e=>e.id===h&&e.error)||!l&&!!s;if(D){let r=!t()||s===`unsupported`?(0,_.jsx)(d,{message:T(`guiPlugins.mobile.unsupported`)}):n&&l?(0,_.jsx)(p,{fallback:(0,_.jsx)(d,{message:T(`guiPlugins.error`)}),children:(0,_.jsx)(f,{host:n,kind:`page`,contributionKey:l.key,revision:u})},JSON.stringify([l.key,u])):g?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(d,{message:T(s===`relay_required`?`guiPlugins.mobile.relayRequired`:s===`relay_unavailable`?`guiPlugins.mobile.networkFailed`:`guiPlugins.error`)}),s?(0,_.jsx)(o,{className:`m-4 self-center`,onClick:w,children:T(`guiPlugins.mobile.retry`)}):null]}):y||!S?(0,_.jsxs)(`div`,{role:`status`,className:`flex min-h-0 flex-1 items-center justify-center gap-2 text-muted-foreground`,children:[(0,_.jsx)(c,{name:`loader-4`,className:`size-4 animate-spin motion-reduce:animate-none`}),T(`guiPlugins.loading`)]}):null,i;e[23]===r?i=e[24]:(i=(0,_.jsx)(`div`,{"data-gui-plugin-page":!0,className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-mobile-edge-to-edge-preview":`true`,children:r}),e[23]=r,e[24]=i),I=i;break bb0}P=!0,F=`flex h-full min-h-0 min-w-0 flex-col py-1.5 pl-1 pr-1.5 text-foreground`,j=v,M=!0,N=n&&l?(0,_.jsx)(p,{fallback:(0,_.jsx)(d,{message:T(`guiPlugins.error`)}),children:(0,_.jsx)(f,{host:n,kind:`page`,contributionKey:l.key,revision:u})},JSON.stringify([l.key,u])):g?(0,_.jsx)(d,{message:T(`guiPlugins.error`)}):null}e[4]=s,e[5]=n,e[6]=i,e[7]=D,e[8]=E,e[9]=y,e[10]=w,e[11]=S,e[12]=r.pages,e[13]=r.plugins,e[14]=T,e[15]=j,e[16]=M,e[17]=N,e[18]=P,e[19]=F,e[20]=I}else j=e[15],M=e[16],N=e[17],P=e[18],F=e[19],I=e[20];if(I!==Symbol.for(`react.early_return_sentinel`))return I;let L;e[25]!==j||e[26]!==M||e[27]!==N?(L=(0,_.jsx)(j,{"data-gui-plugin-page-surface":M,children:N}),e[25]=j,e[26]=M,e[27]=N,e[28]=L):L=e[28];let R;return e[29]!==P||e[30]!==F||e[31]!==L?(R=(0,_.jsx)(`div`,{"data-gui-plugin-page":P,className:F,children:L}),e[29]=P,e[30]=F,e[31]=L,e[32]=R):R=e[32],R}function b(e){return e.isMobile}function x(e){return e.activeGuiPage}export{v as n,y as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./platform-B2ylz14u.js";import{ot as n,st as r}from"./vendor-base-ui-wXsskyKm.js";import{n as i}from"./vendor-react-BkccXcWz.js";import{r as a}from"./useUIStore-68ZPpgYA.js";import{Xn as o,io as s}from"./ui-BCYkB585.js";import{n as c}from"./Icon-C1rjS64C.js";import{t as l}from"./i18n-iu4pzqPi.js";import{a as u}from"./react-CPBNl-S9.js";import{i as d}from"./MobileHtmlNetworkBoundary-GBhYVYvu.js";import{t as f}from"./GuiPluginMount-CBJiLdzR.js";import{t as p}from"./ErrorBoundary-yr_JeVdx.js";import{i as m}from"./pages-CYkE04ml.js";var h=e(r(),1),g=i(),_=n();function v(e){let t=(0,g.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=s(`relative isolate flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-background shadow-sm [--background:oklch(from_var(--surface-background)_min(1,calc(l_+_0.015))_c_h)] dark:[--background:color-mix(in_srgb,var(--surface-foreground)_4%,var(--surface-background))]`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,_.jsx)(`span`,{"aria-hidden":`true`,"data-workspace-surface-ring":!0,className:`pointer-events-none absolute inset-0 z-50 rounded-[inherit] ring-1 ring-inset ring-[var(--interactive-border)]`}),t[6]=o):o=t[6];let c;return t[7]!==n||t[8]!==i||t[9]!==a?(c=(0,_.jsxs)(`section`,{...i,"data-workspace-surface":!0,className:a,children:[n,o]}),t[7]=n,t[8]=i,t[9]=a,t[10]=c):c=t[10],c}function y(){let e=(0,g.c)(33),{host:n,snapshot:r,inventory:i,error:s,loading:y,requested:S,requestLoad:C,refresh:w}=u(),{t:T}=l(),E=a(x),D=a(b),O,k;e[0]!==C||e[1]!==S?(O=()=>{S||C()},k=[S,C],e[0]=C,e[1]=S,e[2]=O,e[3]=k):(O=e[2],k=e[3]),h.useEffect(O,k);let A=r.pages,j,M,N,P,F,I;if(e[4]!==s||e[5]!==n||e[6]!==i||e[7]!==D||e[8]!==E||e[9]!==y||e[10]!==w||e[11]!==S||e[12]!==r.pages||e[13]!==r.plugins||e[14]!==T){I=Symbol.for(`react.early_return_sentinel`);bb0:{let a;e[21]===E?a=e[22]:(a=e=>e.key===E,e[21]=E,e[22]=a);let l=A.find(a),u=r.plugins.find(e=>e.id===l?.pluginId)?.revision,h=m(E),g=r.plugins.some(e=>e.id===h&&e.status===`failed`)||i.some(e=>e.id===h&&e.error)||!l&&!!s;if(D){let r=!t()||s===`unsupported`?(0,_.jsx)(d,{message:T(`guiPlugins.mobile.unsupported`)}):n&&l?(0,_.jsx)(p,{fallback:(0,_.jsx)(d,{message:T(`guiPlugins.error`)}),children:(0,_.jsx)(f,{host:n,kind:`page`,contributionKey:l.key,revision:u})},JSON.stringify([l.key,u])):g?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(d,{message:T(s===`relay_required`?`guiPlugins.mobile.relayRequired`:s===`relay_unavailable`?`guiPlugins.mobile.networkFailed`:`guiPlugins.error`)}),s?(0,_.jsx)(o,{className:`m-4 self-center`,onClick:w,children:T(`guiPlugins.mobile.retry`)}):null]}):y||!S?(0,_.jsxs)(`div`,{role:`status`,className:`flex min-h-0 flex-1 items-center justify-center gap-2 text-muted-foreground`,children:[(0,_.jsx)(c,{name:`loader-4`,className:`size-4 animate-spin motion-reduce:animate-none`}),T(`guiPlugins.loading`)]}):null,i;e[23]===r?i=e[24]:(i=(0,_.jsx)(`div`,{"data-gui-plugin-page":!0,className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-mobile-edge-to-edge-preview":`true`,children:r}),e[23]=r,e[24]=i),I=i;break bb0}P=!0,F=`flex h-full min-h-0 min-w-0 flex-col py-1.5 pl-1 pr-1.5 text-foreground`,j=v,M=!0,N=n&&l?(0,_.jsx)(p,{fallback:(0,_.jsx)(d,{message:T(`guiPlugins.error`)}),children:(0,_.jsx)(f,{host:n,kind:`page`,contributionKey:l.key,revision:u})},JSON.stringify([l.key,u])):g?(0,_.jsx)(d,{message:T(`guiPlugins.error`)}):null}e[4]=s,e[5]=n,e[6]=i,e[7]=D,e[8]=E,e[9]=y,e[10]=w,e[11]=S,e[12]=r.pages,e[13]=r.plugins,e[14]=T,e[15]=j,e[16]=M,e[17]=N,e[18]=P,e[19]=F,e[20]=I}else j=e[15],M=e[16],N=e[17],P=e[18],F=e[19],I=e[20];if(I!==Symbol.for(`react.early_return_sentinel`))return I;let L;e[25]!==j||e[26]!==M||e[27]!==N?(L=(0,_.jsx)(j,{"data-gui-plugin-page-surface":M,children:N}),e[25]=j,e[26]=M,e[27]=N,e[28]=L):L=e[28];let R;return e[29]!==P||e[30]!==F||e[31]!==L?(R=(0,_.jsx)(`div`,{"data-gui-plugin-page":P,className:F,children:L}),e[29]=P,e[30]=F,e[31]=L,e[32]=R):R=e[32],R}function b(e){return e.isMobile}function x(e){return e.activeGuiPage}export{v as n,y as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{r as i}from"./useUIStore-Dz0bOfkB.js";import{Yn as a}from"./ui-DeV7Us1B.js";import{t as o}from"./i18n-CBCskgqa.js";import{a as s}from"./react-CPBNl-S9.js";import{r as c}from"./device-gKeFQDLT.js";import{n as l,r as u,t as d}from"./GuiPluginMount-FFI3j0Vq.js";import{t as f}from"./GuiPluginWindow-BMeBjsJ4.js";import{t as p}from"./GuiPluginPage-B9I2nkDa.js";import{i as m}from"./pages-CYkE04ml.js";var h=r(),g=e(n(),1),_=t();function v(){let e=(0,h.c)(57),{host:t,snapshot:n,inventory:r,error:v,loading:S,requested:C}=s(),{t:w}=o(),{isMobile:T}=c(),E=i(x),D;if(e[0]!==E||e[1]!==n.pages){let t;e[3]===E?t=e[4]:(t=e=>e.key===E,e[3]=E,e[4]=t),D=n.pages.find(t),e[0]=E,e[1]=n.pages,e[2]=D}else D=e[2];let O=D,k;e[5]===E?k=e[6]:(k=m(E),e[5]=E,e[6]=k);let A=k,j;e[7]!==v||e[8]!==r||e[9]!==A||e[10]!==n.plugins?(j=!!v||n.plugins.some(e=>e.id===A&&e.status===`failed`)||r.some(e=>e.id===A&&e.error),e[7]=v,e[8]=r,e[9]=A,e[10]=n.plugins,e[11]=j):j=e[11];let M=j,N,P;e[12]!==M||e[13]!==T||e[14]!==S||e[15]!==O||e[16]!==E||e[17]!==C?(N=()=>{T&&E&&C&&!S&&!O&&!M&&i.getState().closeGuiPage()},P=[T,E,C,S,O,M],e[12]=M,e[13]=T,e[14]=S,e[15]=O,e[16]=E,e[17]=C,e[18]=N,e[19]=P):(N=e[18],P=e[19]),g.useEffect(N,P);let[F]=g.useState(b),I,L,R,z,B,V,H,U;if(e[20]!==F||e[21]!==t||e[22]!==T||e[23]!==O?.title||e[24]!==E||e[25]!==n.activePanel||e[26]!==n.panels||e[27]!==n.plugins||e[28]!==w){let r;e[37]===n.activePanel?r=e[38]:(r=e=>e.key===n.activePanel&&!e.inline,e[37]=n.activePanel,e[38]=r);let i=n.panels.find(r);e[39]!==T||e[40]!==O?.title||e[41]!==E||e[42]!==w?(R=T&&E?(0,_.jsx)(f,{id:`gui-plugin-page`,open:!0,title:O?.title??w(`guiPlugins.title`),onClose:y,children:(0,_.jsx)(p,{})}):null,e[39]=T,e[40]=O?.title,e[41]=E,e[42]=w,e[43]=R):R=e[43],I=f,z=`gui-plugin-panel`,B=!!(t&&i),V=i?.title??w(`guiPlugins.title`),e[44]===t?H=e[45]:(H=()=>t?.hidePanel(),e[44]=t,e[45]=H),U=T&&i?(0,_.jsx)(l,{target:F}):null,L=t&&i?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,"aria-label":w(`guiPlugins.panels`),children:n.panels.map(e=>(0,_.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,_.jsx)(a,{variant:`chip`,size:`sm`,"aria-pressed":e.key===i.key,onClick:()=>t.selectPanel(e.key),className:`max-w-64 truncate`,children:e.title}),(0,_.jsx)(a,{variant:`ghost`,size:`xs`,"aria-label":w(`guiPlugins.closePanel`,{title:e.title}),onClick:()=>t.closePanel(e.key),children:w(`guiPlugins.close`)})]},e.key))}),(0,_.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-mobile-edge-to-edge-preview":`true`,children:(0,_.jsx)(d,{host:t,contributionKey:i.key,kind:`panel`,actions:T?F:void 0,revision:u(n.plugins,i.pluginId)})})]}):null,e[20]=F,e[21]=t,e[22]=T,e[23]=O?.title,e[24]=E,e[25]=n.activePanel,e[26]=n.panels,e[27]=n.plugins,e[28]=w,e[29]=I,e[30]=L,e[31]=R,e[32]=z,e[33]=B,e[34]=V,e[35]=H,e[36]=U}else I=e[29],L=e[30],R=e[31],z=e[32],B=e[33],V=e[34],H=e[35],U=e[36];let W;e[46]!==I||e[47]!==L||e[48]!==z||e[49]!==B||e[50]!==V||e[51]!==H||e[52]!==U?(W=(0,_.jsx)(I,{id:z,open:B,title:V,onClose:H,actions:U,children:L}),e[46]=I,e[47]=L,e[48]=z,e[49]=B,e[50]=V,e[51]=H,e[52]=U,e[53]=W):W=e[53];let G;return e[54]!==R||e[55]!==W?(G=(0,_.jsxs)(_.Fragment,{children:[R,W]}),e[54]=R,e[55]=W,e[56]=G):G=e[56],G}function y(){return i.getState().closeGuiPage()}function b(){return document.createElement(`div`)}function x(e){return e.activeMainTab===`plugin`?e.activeGuiPage:null}export{v as GuiPluginSurface};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{r as i}from"./useUIStore-68ZPpgYA.js";import{Xn as a}from"./ui-BCYkB585.js";import{t as o}from"./i18n-iu4pzqPi.js";import{a as s}from"./react-CPBNl-S9.js";import{r as c}from"./device-TCHW5U2y.js";import{n as l,r as u,t as d}from"./GuiPluginMount-CBJiLdzR.js";import{t as f}from"./GuiPluginWindow-Cpg2HYWe.js";import{t as p}from"./GuiPluginPage-DJa8gFLk.js";import{i as m}from"./pages-CYkE04ml.js";var h=r(),g=e(n(),1),_=t();function v(){let e=(0,h.c)(57),{host:t,snapshot:n,inventory:r,error:v,loading:S,requested:C}=s(),{t:w}=o(),{isMobile:T}=c(),E=i(x),D;if(e[0]!==E||e[1]!==n.pages){let t;e[3]===E?t=e[4]:(t=e=>e.key===E,e[3]=E,e[4]=t),D=n.pages.find(t),e[0]=E,e[1]=n.pages,e[2]=D}else D=e[2];let O=D,k;e[5]===E?k=e[6]:(k=m(E),e[5]=E,e[6]=k);let A=k,j;e[7]!==v||e[8]!==r||e[9]!==A||e[10]!==n.plugins?(j=!!v||n.plugins.some(e=>e.id===A&&e.status===`failed`)||r.some(e=>e.id===A&&e.error),e[7]=v,e[8]=r,e[9]=A,e[10]=n.plugins,e[11]=j):j=e[11];let M=j,N,P;e[12]!==M||e[13]!==T||e[14]!==S||e[15]!==O||e[16]!==E||e[17]!==C?(N=()=>{T&&E&&C&&!S&&!O&&!M&&i.getState().closeGuiPage()},P=[T,E,C,S,O,M],e[12]=M,e[13]=T,e[14]=S,e[15]=O,e[16]=E,e[17]=C,e[18]=N,e[19]=P):(N=e[18],P=e[19]),g.useEffect(N,P);let[F]=g.useState(b),I,L,R,z,B,V,H,U;if(e[20]!==F||e[21]!==t||e[22]!==T||e[23]!==O?.title||e[24]!==E||e[25]!==n.activePanel||e[26]!==n.panels||e[27]!==n.plugins||e[28]!==w){let r;e[37]===n.activePanel?r=e[38]:(r=e=>e.key===n.activePanel&&!e.inline,e[37]=n.activePanel,e[38]=r);let i=n.panels.find(r);e[39]!==T||e[40]!==O?.title||e[41]!==E||e[42]!==w?(R=T&&E?(0,_.jsx)(f,{id:`gui-plugin-page`,open:!0,title:O?.title??w(`guiPlugins.title`),onClose:y,children:(0,_.jsx)(p,{})}):null,e[39]=T,e[40]=O?.title,e[41]=E,e[42]=w,e[43]=R):R=e[43],I=f,z=`gui-plugin-panel`,B=!!(t&&i),V=i?.title??w(`guiPlugins.title`),e[44]===t?H=e[45]:(H=()=>t?.hidePanel(),e[44]=t,e[45]=H),U=T&&i?(0,_.jsx)(l,{target:F}):null,L=t&&i?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,"aria-label":w(`guiPlugins.panels`),children:n.panels.map(e=>(0,_.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,_.jsx)(a,{variant:`chip`,size:`sm`,"aria-pressed":e.key===i.key,onClick:()=>t.selectPanel(e.key),className:`max-w-64 truncate`,children:e.title}),(0,_.jsx)(a,{variant:`ghost`,size:`xs`,"aria-label":w(`guiPlugins.closePanel`,{title:e.title}),onClick:()=>t.closePanel(e.key),children:w(`guiPlugins.close`)})]},e.key))}),(0,_.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-mobile-edge-to-edge-preview":`true`,children:(0,_.jsx)(d,{host:t,contributionKey:i.key,kind:`panel`,actions:T?F:void 0,revision:u(n.plugins,i.pluginId)})})]}):null,e[20]=F,e[21]=t,e[22]=T,e[23]=O?.title,e[24]=E,e[25]=n.activePanel,e[26]=n.panels,e[27]=n.plugins,e[28]=w,e[29]=I,e[30]=L,e[31]=R,e[32]=z,e[33]=B,e[34]=V,e[35]=H,e[36]=U}else I=e[29],L=e[30],R=e[31],z=e[32],B=e[33],V=e[34],H=e[35],U=e[36];let W;e[46]!==I||e[47]!==L||e[48]!==z||e[49]!==B||e[50]!==V||e[51]!==H||e[52]!==U?(W=(0,_.jsx)(I,{id:z,open:B,title:V,onClose:H,actions:U,children:L}),e[46]=I,e[47]=L,e[48]=z,e[49]=B,e[50]=V,e[51]=H,e[52]=U,e[53]=W):W=e[53];let G;return e[54]!==R||e[55]!==W?(G=(0,_.jsxs)(_.Fragment,{children:[R,W]}),e[54]=R,e[55]=W,e[56]=G):G=e[56],G}function y(){return i.getState().closeGuiPage()}function b(){return document.createElement(`div`)}function x(e){return e.activeMainTab===`plugin`?e.activeGuiPage:null}export{v as GuiPluginSurface};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{Yn as i,no as a}from"./ui-DeV7Us1B.js";import{n as o}from"./Icon-C1m8PihJ.js";import{a as s}from"./react-CPBNl-S9.js";import{t as c}from"./icons-BQMGp0ts.js";var l=r(),u=e(n(),1),d=t();function f(e){let t=(0,l.c)(28),{item:n,host:r,mobile:s,sidebar:f}=e,[p,m]=(0,u.useState)(),h;t[0]===n.icon?h=t[1]:(h=c(n.icon),t[0]=n.icon,t[1]=h);let g=h,_;t[2]!==p||t[3]!==n.icon?(_=n.icon?.startsWith(`data:image/`)&&n.icon!==p?n.icon:void 0,t[2]=p,t[3]=n.icon,t[4]=_):_=t[4];let v=_,y=!!(g||v),b;t[5]!==g||t[6]!==v||t[7]!==n.busy||t[8]!==f?(b=n.busy?(0,d.jsx)(o,{name:`loader-4`,className:a(f?`size-4`:`size-3.5`,`shrink-0 animate-spin motion-reduce:animate-none`)}):g?(0,d.jsx)(o,{name:g,className:f?`size-4 shrink-0`:`size-3.5`}):v?(0,d.jsx)(`img`,{src:v,alt:``,draggable:!1,className:a(f?`size-4`:`size-3.5`,`shrink-0 object-contain`),onError:()=>m(v)},v):f?(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`size-4 shrink-0`}):null,t[5]=g,t[6]=v,t[7]=n.busy,t[8]=f,t[9]=b):b=t[9];let x;t[10]!==y||t[11]!==n.label||t[12]!==f?(x=f||!y?(0,d.jsx)(`span`,{className:f?`truncate`:`max-w-24 truncate`,children:n.label}):null,t[10]=y,t[11]=n.label,t[12]=f,t[13]=x):x=t[13];let S;t[14]!==b||t[15]!==x?(S=(0,d.jsxs)(d.Fragment,{children:[b,x]}),t[14]=b,t[15]=x,t[16]=S):S=t[16];let C=S,w;return t[17]!==C||t[18]!==r||t[19]!==n.actionable||t[20]!==n.busy||t[21]!==n.key||t[22]!==n.label||t[23]!==n.pressed||t[24]!==n.title||t[25]!==s||t[26]!==f?(w=n.actionable?(0,d.jsx)(i,{size:f||s?`sm`:`xs`,variant:f?`ghost`:`default`,className:a(`aria-pressed:bg-interactive-selection aria-pressed:text-interactive-selection-foreground`,f&&`w-full justify-start px-2 font-normal`,f&&s&&`h-11`),title:n.label,"aria-label":n.title??n.label,"aria-pressed":n.pressed,"aria-busy":!!n.busy,disabled:!!n.busy,onClick:()=>void r.runTitlebarItem(n.key),children:C}):(0,d.jsx)(`span`,{role:`status`,title:n.label,"aria-label":n.title??n.label,"aria-busy":!!n.busy,className:a(`inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-muted-foreground`,f?`w-full text-sm`:`bg-muted text-xs`),children:C}),t[17]=C,t[18]=r,t[19]=n.actionable,t[20]=n.busy,t[21]=n.key,t[22]=n.label,t[23]=n.pressed,t[24]=n.title,t[25]=s,t[26]=f,t[27]=w):w=t[27],w}function p(e){let t=(0,l.c)(14),{mobile:n,sidebar:r}=e,i=n!==void 0&&n,a=r!==void 0&&r,{host:o,snapshot:c}=s();if(!o||c.titlebarItems.length===0)return null;let u=!a||void 0,p=a||void 0,m=a?`app-region-no-drag space-y-0.5`:`app-region-no-drag flex min-w-0 max-w-32 items-center gap-1 overflow-x-auto scrollbar-hidden`,h;if(t[0]!==o||t[1]!==i||t[2]!==a||t[3]!==c.titlebarItems){let e;t[5]!==o||t[6]!==i||t[7]!==a?(e=e=>(0,d.jsx)(f,{item:e,host:o,mobile:i,sidebar:a},e.key),t[5]=o,t[6]=i,t[7]=a,t[8]=e):e=t[8],h=c.titlebarItems.map(e),t[0]=o,t[1]=i,t[2]=a,t[3]=c.titlebarItems,t[4]=h}else h=t[4];let g;return t[9]!==u||t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,d.jsx)(`div`,{"data-gui-titlebar-items":u,"data-gui-sidebar-items":p,className:m,children:h}),t[9]=u,t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13],g}export{p as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{Xn as i,io as a}from"./ui-BCYkB585.js";import{n as o}from"./Icon-C1rjS64C.js";import{a as s}from"./react-CPBNl-S9.js";import{t as c}from"./icons-BWijARKS.js";var l=r(),u=e(n(),1),d=t();function f(e){let t=(0,l.c)(28),{item:n,host:r,mobile:s,sidebar:f}=e,[p,m]=(0,u.useState)(),h;t[0]===n.icon?h=t[1]:(h=c(n.icon),t[0]=n.icon,t[1]=h);let g=h,_;t[2]!==p||t[3]!==n.icon?(_=n.icon?.startsWith(`data:image/`)&&n.icon!==p?n.icon:void 0,t[2]=p,t[3]=n.icon,t[4]=_):_=t[4];let v=_,y=!!(g||v),b;t[5]!==g||t[6]!==v||t[7]!==n.busy||t[8]!==f?(b=n.busy?(0,d.jsx)(o,{name:`loader-4`,className:a(f?`size-4`:`size-3.5`,`shrink-0 animate-spin motion-reduce:animate-none`)}):g?(0,d.jsx)(o,{name:g,className:f?`size-4 shrink-0`:`size-3.5`}):v?(0,d.jsx)(`img`,{src:v,alt:``,draggable:!1,className:a(f?`size-4`:`size-3.5`,`shrink-0 object-contain`),onError:()=>m(v)},v):f?(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`size-4 shrink-0`}):null,t[5]=g,t[6]=v,t[7]=n.busy,t[8]=f,t[9]=b):b=t[9];let x;t[10]!==y||t[11]!==n.label||t[12]!==f?(x=f||!y?(0,d.jsx)(`span`,{className:f?`truncate`:`max-w-24 truncate`,children:n.label}):null,t[10]=y,t[11]=n.label,t[12]=f,t[13]=x):x=t[13];let S;t[14]!==b||t[15]!==x?(S=(0,d.jsxs)(d.Fragment,{children:[b,x]}),t[14]=b,t[15]=x,t[16]=S):S=t[16];let C=S,w;return t[17]!==C||t[18]!==r||t[19]!==n.actionable||t[20]!==n.busy||t[21]!==n.key||t[22]!==n.label||t[23]!==n.pressed||t[24]!==n.title||t[25]!==s||t[26]!==f?(w=n.actionable?(0,d.jsx)(i,{size:f||s?`sm`:`xs`,variant:f?`ghost`:`default`,className:a(`aria-pressed:bg-interactive-selection aria-pressed:text-interactive-selection-foreground`,f&&`w-full justify-start px-2 font-normal`,f&&s&&`h-11`),title:n.label,"aria-label":n.title??n.label,"aria-pressed":n.pressed,"aria-busy":!!n.busy,disabled:!!n.busy,onClick:()=>void r.runTitlebarItem(n.key),children:C}):(0,d.jsx)(`span`,{role:`status`,title:n.label,"aria-label":n.title??n.label,"aria-busy":!!n.busy,className:a(`inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-muted-foreground`,f?`w-full text-sm`:`bg-muted text-xs`),children:C}),t[17]=C,t[18]=r,t[19]=n.actionable,t[20]=n.busy,t[21]=n.key,t[22]=n.label,t[23]=n.pressed,t[24]=n.title,t[25]=s,t[26]=f,t[27]=w):w=t[27],w}function p(e){let t=(0,l.c)(14),{mobile:n,sidebar:r}=e,i=n!==void 0&&n,a=r!==void 0&&r,{host:o,snapshot:c}=s();if(!o||c.titlebarItems.length===0)return null;let u=!a||void 0,p=a||void 0,m=a?`app-region-no-drag space-y-0.5`:`app-region-no-drag flex min-w-0 max-w-32 items-center gap-1 overflow-x-auto scrollbar-hidden`,h;if(t[0]!==o||t[1]!==i||t[2]!==a||t[3]!==c.titlebarItems){let e;t[5]!==o||t[6]!==i||t[7]!==a?(e=e=>(0,d.jsx)(f,{item:e,host:o,mobile:i,sidebar:a},e.key),t[5]=o,t[6]=i,t[7]=a,t[8]=e):e=t[8],h=c.titlebarItems.map(e),t[0]=o,t[1]=i,t[2]=a,t[3]=c.titlebarItems,t[4]=h}else h=t[4];let g;return t[9]!==u||t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,d.jsx)(`div`,{"data-gui-titlebar-items":u,"data-gui-sidebar-items":p,className:m,children:h}),t[9]=u,t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13],g}export{p as t};
@@ -1 +1 @@
1
- import{ot as e}from"./vendor-base-ui-wXsskyKm.js";import{n as t}from"./vendor-react-BkccXcWz.js";import{t as n}from"./i18n-CBCskgqa.js";import{t as r}from"./MobileResizableSheet-CcOOlg4R.js";import{a as i,n as a,o,t as s}from"./dialog-Cv20xnEj.js";import{r as c}from"./device-gKeFQDLT.js";var l=t(),u=e();function d(e){let t=(0,l.c)(24),{id:d,open:f,title:p,onClose:m,children:h,actions:g}=e,{isMobile:_}=c(),{t:v}=n(),y;t[0]===m?y=t[1]:(y=e=>{e||m()},t[0]=m,t[1]=y);let b=y;if(_){let e;t[2]===v?e=t[3]:(e=v(`guiPlugins.close`),t[2]=v,t[3]=e);let n;t[4]===v?n=t[5]:(n=v(`guiPlugins.resize`),t[4]=v,t[5]=n);let i;return t[6]!==g||t[7]!==h||t[8]!==d||t[9]!==b||t[10]!==f||t[11]!==e||t[12]!==n||t[13]!==p?(i=(0,u.jsx)(r,{id:d,open:f,onOpenChange:b,title:p,ariaLabel:p,closeAriaLabel:e,resizeAriaLabel:n,trailing:g,initiallyExpanded:!0,compactHeader:!0,showCloseButton:!1,children:h}),t[6]=g,t[7]=h,t[8]=d,t[9]=b,t[10]=f,t[11]=e,t[12]=n,t[13]=p,t[14]=i):i=t[14],i}let x;t[15]===p?x=t[16]:(x=(0,u.jsx)(i,{children:(0,u.jsx)(o,{children:p})}),t[15]=p,t[16]=x);let S;t[17]!==h||t[18]!==x?(S=(0,u.jsxs)(a,{className:`flex h-[80dvh] max-w-5xl flex-col overflow-hidden`,"aria-describedby":void 0,children:[x,h]}),t[17]=h,t[18]=x,t[19]=S):S=t[19];let C;return t[20]!==b||t[21]!==f||t[22]!==S?(C=(0,u.jsx)(s,{open:f,onOpenChange:b,children:S}),t[20]=b,t[21]=f,t[22]=S,t[23]=C):C=t[23],C}export{d as t};
1
+ import{ot as e}from"./vendor-base-ui-wXsskyKm.js";import{n as t}from"./vendor-react-BkccXcWz.js";import{t as n}from"./i18n-iu4pzqPi.js";import{t as r}from"./MobileResizableSheet-CkA7qhco.js";import{a as i,n as a,o,t as s}from"./dialog-Cx20I73q.js";import{r as c}from"./device-TCHW5U2y.js";var l=t(),u=e();function d(e){let t=(0,l.c)(24),{id:d,open:f,title:p,onClose:m,children:h,actions:g}=e,{isMobile:_}=c(),{t:v}=n(),y;t[0]===m?y=t[1]:(y=e=>{e||m()},t[0]=m,t[1]=y);let b=y;if(_){let e;t[2]===v?e=t[3]:(e=v(`guiPlugins.close`),t[2]=v,t[3]=e);let n;t[4]===v?n=t[5]:(n=v(`guiPlugins.resize`),t[4]=v,t[5]=n);let i;return t[6]!==g||t[7]!==h||t[8]!==d||t[9]!==b||t[10]!==f||t[11]!==e||t[12]!==n||t[13]!==p?(i=(0,u.jsx)(r,{id:d,open:f,onOpenChange:b,title:p,ariaLabel:p,closeAriaLabel:e,resizeAriaLabel:n,trailing:g,initiallyExpanded:!0,compactHeader:!0,showCloseButton:!1,children:h}),t[6]=g,t[7]=h,t[8]=d,t[9]=b,t[10]=f,t[11]=e,t[12]=n,t[13]=p,t[14]=i):i=t[14],i}let x;t[15]===p?x=t[16]:(x=(0,u.jsx)(i,{children:(0,u.jsx)(o,{children:p})}),t[15]=p,t[16]=x);let S;t[17]!==h||t[18]!==x?(S=(0,u.jsxs)(a,{className:`flex h-[80dvh] max-w-5xl flex-col overflow-hidden`,"aria-describedby":void 0,children:[x,h]}),t[17]=h,t[18]=x,t[19]=S):S=t[19];let C;return t[20]!==b||t[21]!==f||t[22]!==S?(C=(0,u.jsx)(s,{open:f,onOpenChange:b,children:S}),t[20]=b,t[21]=f,t[22]=S,t[23]=C):C=t[23],C}export{d as t};