@yuriai/web 0.3.8-beta.14 → 0.3.8-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/dist/assets/{AgentAvatar-BSBHv-65.js → AgentAvatar-DrZGU5TL.js} +1 -1
  2. package/dist/assets/{AgentSelector-DaT_IvwI.js → AgentSelector-D6x-93xO.js} +1 -1
  3. package/dist/assets/ArchivedSessionsDialog-C-Q7IKD0.js +1 -0
  4. package/dist/assets/AssistantConversationSurface-C9S2c33z.css +1 -0
  5. package/dist/assets/AssistantConversationSurface-DNOnoTTE.js +3 -0
  6. package/dist/assets/{AssistantSessionCard-D4cDykNE.js → AssistantSessionCard-B2nmiy2w.js} +2 -2
  7. package/dist/assets/{AssistantUnreadBadge-kuD0NRB3.js → AssistantUnreadBadge-CAgjtCiJ.js} +1 -1
  8. package/dist/assets/{AssistantView-C-UaXYpz.js → AssistantView-yJTsJbIU.js} +1 -1
  9. package/dist/assets/{AssistantWorkingAvatar-VQGkgNuo.js → AssistantWorkingAvatar-C5PFB26I.js} +1 -1
  10. package/dist/assets/{AssistantsSettingsPage-D01452ix.js → AssistantsSettingsPage-Cw2GK4ku.js} +1 -1
  11. package/dist/assets/{BinaryFileFallback-Darn77R4.js → BinaryFileFallback-BGku68Il.js} +1 -1
  12. package/dist/assets/{BtwPanel-CgSxuUbP.js → BtwPanel-CM97m0W-.js} +1 -1
  13. package/dist/assets/{BusyDots-CTw2sYb1.js → BusyDots-BfwpONQS.js} +1 -1
  14. package/dist/assets/ChatContainer-uZMwglI2.js +65 -0
  15. package/dist/assets/{ChatView-BfrJ1ZTv.js → ChatView-CMjNZnr2.js} +1 -1
  16. package/dist/assets/{DiagramView-BcD_t3y-.js → DiagramView-B8KyrEfz.js} +1 -1
  17. package/dist/assets/{DiffView-DyYip1lP.js → DiffView-DpmXkaMB.js} +1 -1
  18. package/dist/assets/{DiffViewToggle-Da3vQFP9.js → DiffViewToggle-C2OUNYuF.js} +1 -1
  19. package/dist/assets/{ErrorBoundary-D6SF_urL.js → ErrorBoundary-DPRw2Hb8.js} +1 -1
  20. package/dist/assets/{FadeInOnReveal-DJrSq3fM.js → FadeInOnReveal-CbsnPxv2.js} +1 -1
  21. package/dist/assets/{GuiPluginMount-BD0R2vTk.js → GuiPluginMount-a0GlByhj.js} +1 -1
  22. package/dist/assets/{GuiPluginPage-DGysjIM8.js → GuiPluginPage-CWIqxrTF.js} +1 -1
  23. package/dist/assets/{GuiPluginSurface-CIbn8VvC.js → GuiPluginSurface-CEJE7Jej.js} +1 -1
  24. package/dist/assets/{GuiPluginTitlebarItems-BYCWC7Ia.js → GuiPluginTitlebarItems-DzUKXkjc.js} +1 -1
  25. package/dist/assets/{GuiPluginWindow-cCmvyMMm.js → GuiPluginWindow-D-YAzycZ.js} +1 -1
  26. package/dist/assets/{Icon-DrsaL1yC.js → Icon-BUHzyKnj.js} +1 -1
  27. package/dist/assets/{ImageLoadingPlaceholder-Br3hw4E6.js → ImageLoadingPlaceholder-C-g4U5hR.js} +1 -1
  28. package/dist/assets/{LoadingImage-BBQSz8J1.js → LoadingImage-B0wwLqli.js} +1 -1
  29. package/dist/assets/{MarkdownRenderer-CGgHX4n3.js → MarkdownRenderer-Cr-3HunB.js} +2 -2
  30. package/dist/assets/{MarkdownRendererImpl-CiuncbTc.js → MarkdownRendererImpl-DnWMM_aX.js} +1 -1
  31. package/dist/assets/{MarkstreamRendererImpl-DT9tgQ6L.js → MarkstreamRendererImpl-DpY69J2T.js} +1 -1
  32. package/dist/assets/{MobileAssistantSettingsPage-DIilwadN.js → MobileAssistantSettingsPage-BDvEr-7Z.js} +1 -1
  33. package/dist/assets/{MobileAssistantTab-CTyT31et.js → MobileAssistantTab-Cko8n9EA.js} +1 -1
  34. package/dist/assets/{MobileBtwPage-Buz1Kf7W.js → MobileBtwPage-DvXj1534.js} +1 -1
  35. package/dist/assets/{MobileChangesSurface-DsnPRa6f.js → MobileChangesSurface-Bs91NGZz.js} +1 -1
  36. package/dist/assets/{MobileChatScreen-DRNBeviQ.js → MobileChatScreen-BCwCAJoA.js} +1 -1
  37. package/dist/assets/{MobileDetailNavigation-_0qkfML1.js → MobileDetailNavigation-Bgns21JD.js} +1 -1
  38. package/dist/assets/{MobileFilesSurface-CKHljNp8.js → MobileFilesSurface-CKnb4sMb.js} +2 -2
  39. package/dist/assets/{MobileHtmlNetworkBoundary-BMTmOSuT.js → MobileHtmlNetworkBoundary-uqjb6Mla.js} +2 -2
  40. package/dist/assets/{MobileOverlayPanel-cwgcgCxI.js → MobileOverlayPanel-DiSPQ_Ds.js} +1 -1
  41. package/dist/assets/{MobileResizableSheet-DKpNzqfc.js → MobileResizableSheet-CTVXT44f.js} +1 -1
  42. package/dist/assets/{MobileSettingsTab-BQnzgATX.js → MobileSettingsTab-BX9NpdML.js} +1 -1
  43. package/dist/assets/{MobileShareBridge-1O5JUriq.js → MobileShareBridge-XOWIghHm.js} +1 -1
  44. package/dist/assets/{MobileSurface-nz7712mA.js → MobileSurface-CSgwDfWV.js} +1 -1
  45. package/dist/assets/{MobileTabPageHeader-B0_vB3Tg.js → MobileTabPageHeader-BhCUjFE_.js} +1 -1
  46. package/dist/assets/{ModelLogo-CwKqpjSR.js → ModelLogo-NNl7OHLT.js} +1 -1
  47. package/dist/assets/{ModelSelector-C0LV5Vo7.js → ModelSelector-DQdCn2b7.js} +1 -1
  48. package/dist/assets/{MultiRunWindow-C0muk8Ec.js → MultiRunWindow-D4LkgbX5.js} +1 -1
  49. package/dist/assets/{OnboardingScreen-T4NAO5Nc.js → OnboardingScreen-DvRHPlCp.js} +1 -1
  50. package/dist/assets/{OverlayScrollbar-CZ86VwiO.js → OverlayScrollbar-DhCgiS2Z.js} +1 -1
  51. package/dist/assets/{PierreDiffViewer-0MHiuNI_.js → PierreDiffViewer-D41Qra1m.js} +1 -1
  52. package/dist/assets/ProjectSettingsPanel-BCB8uMLe.js +2 -0
  53. package/dist/assets/{ProviderLogo-BRhDuhtX.js → ProviderLogo-oCOoqwHl.js} +1 -1
  54. package/dist/assets/{RemoteAssistantSessionCard-BAbf5uBX.js → RemoteAssistantSessionCard-xNxKMyYj.js} +1 -1
  55. package/dist/assets/{RemoteDesktopPanel-vKqD4HzW.js → RemoteDesktopPanel-epeXSiEK.js} +1 -1
  56. package/dist/assets/ScheduledTasksDialog-CjD_d4Mg.js +3 -0
  57. package/dist/assets/{ScrollableOverlay-CFjKY4OJ.js → ScrollableOverlay-BqOsMuIW.js} +1 -1
  58. package/dist/assets/{SettingsGroup-5yNRBDTj.js → SettingsGroup-DOaDdTNM.js} +1 -1
  59. package/dist/assets/{SettingsView-4rxkTHGv.js → SettingsView-BXBFTsek.js} +12 -12
  60. package/dist/assets/{SettingsWindow-D5JUctj6.js → SettingsWindow-CRSH_XPR.js} +1 -1
  61. package/dist/assets/{SetupTourDialog-Bp8wlcPT.js → SetupTourDialog-DaYKYPQf.js} +1 -1
  62. package/dist/assets/{SyncActions-DiGfo7cp.js → SyncActions-C1oPXB4Y.js} +1 -1
  63. package/dist/assets/TerminalView-DlWCt09v.js +9 -0
  64. package/dist/assets/{TextSelectionMenu-DcQCHZnp.js → TextSelectionMenu-Dt5sL7-Z.js} +1 -1
  65. package/dist/assets/{ToolOutputDialog-D_Kl-Bc5.js → ToolOutputDialog-C0nc9IV3.js} +5 -5
  66. package/dist/assets/{YuriLogo-CcVNX93s.js → YuriLogo-JAwGFlRv.js} +1 -1
  67. package/dist/assets/{assistantMessagePreview-a6gzdseQ.js → assistantMessagePreview-DWC6UVyn.js} +1 -1
  68. package/dist/assets/{assistantQueries-6GJP0jCO.js → assistantQueries-Bgxhg5pZ.js} +1 -1
  69. package/dist/assets/{auto-read-context-Dov0luVf.js → auto-read-context-Bk1mCpDV.js} +1 -1
  70. package/dist/assets/{capgoAdapter-CVPNGTnk.js → capgoAdapter-BoD0Rn9k.js} +1 -1
  71. package/dist/assets/{card-DjqjGN8X.js → card-CnJNUKRc.js} +1 -1
  72. package/dist/assets/{chatUpwardIntent-uWd0ddoK.js → chatUpwardIntent-VIpGQNvT.js} +1 -1
  73. package/dist/assets/{checkbox-BIU2MT0K.js → checkbox-Bk8-0KZQ.js} +1 -1
  74. package/dist/assets/{collapsible-B2X0QDoQ.js → collapsible-C5tnXbXB.js} +1 -1
  75. package/dist/assets/{connection-hint-Ca1b_CjA.js → connection-hint-C48bNniv.js} +1 -1
  76. package/dist/assets/{context-menu-C-FLHb_6.js → context-menu-CFyL4DQd.js} +1 -1
  77. package/dist/assets/{diagram-CJeSxjCC.js → diagram-CiQzMXnl.js} +1 -1
  78. package/dist/assets/{dialog-DnZWrDDM.js → dialog-C1xZ7qi4.js} +1 -1
  79. package/dist/assets/{dropdown-menu-CZWYeFpO.js → dropdown-menu-9VcdFkMY.js} +1 -1
  80. package/dist/assets/es-BEjOp002.js +15 -0
  81. package/dist/assets/{fileMentionAutocompleteState-B9411b4o.js → fileMentionAutocompleteState-CEwRZk1h.js} +1 -1
  82. package/dist/assets/{fileMentionTouchSelection-Bwr_ZfU3.js → fileMentionTouchSelection-CzP2ohnN.js} +1 -1
  83. package/dist/assets/{fileReferenceActions-KSYTdo_6.js → fileReferenceActions-BpqKMP6J.js} +1 -1
  84. package/dist/assets/{fr-BoFSg4oh.js → fr-DpO_m9TK.js} +2 -2
  85. package/dist/assets/{gitApi-CT9_Fyh4.js → gitApi-DjtVUPlT.js} +1 -1
  86. package/dist/assets/{gitApiHttp-Cx9rEFyN.js → gitApiHttp-CStyHJBc.js} +2 -2
  87. package/dist/assets/{i18n-BZ_vx76q.js → i18n-CJn52oz0.js} +1 -1
  88. package/dist/assets/{icons-B6gke_oc.js → icons-Dy_xbx4O.js} +1 -1
  89. package/dist/assets/{input-DSY3Mg4G.js → input-DXdhngzo.js} +1 -1
  90. package/dist/assets/{insertionBoundaries-C1ACCndo.js → insertionBoundaries-BRqBLgMY.js} +1 -1
  91. package/dist/assets/{ja-DmxgfcWg.js → ja-0nVMWVFA.js} +2 -2
  92. package/dist/assets/{kbd-U9NdVaVr.js → kbd-C_ERslx0.js} +1 -1
  93. package/dist/assets/{ko-DH3El5QZ.js → ko-B17Bm_ms.js} +2 -2
  94. package/dist/assets/main--h-KJbB4.js +169 -0
  95. package/dist/assets/main-DIHvURq9.js +2 -0
  96. package/dist/assets/{markdownHeightCache-BhpqKZQB.js → markdownHeightCache-DwMwTsag.js} +1 -1
  97. package/dist/assets/{mcpQueries-BInByFPg.js → mcpQueries-B5a60zt5.js} +1 -1
  98. package/dist/assets/miniChat-ByVMduTe.js +2 -0
  99. package/dist/assets/mobile-B_lhvL6h.js +2 -0
  100. package/dist/assets/{mobileBackNavigation-CUoYXnE0.js → mobileBackNavigation-Br4xDLTP.js} +1 -1
  101. package/dist/assets/{mobileConnections-DDPYhrR6.js → mobileConnections-CHYr70nO.js} +2 -2
  102. package/dist/assets/{multirun-h_L8IaS5.js → multirun-DHceRpGb.js} +1 -1
  103. package/dist/assets/{native-config-DJLqkXGY.js → native-config-CUl4EJwt.js} +1 -1
  104. package/dist/assets/{nativeComposerCover-Cnky140u.js → nativeComposerCover-sATsn8i9.js} +1 -1
  105. package/dist/assets/{navigation-b6ZJiTeF.js → navigation-ihRiR3Ol.js} +1 -1
  106. package/dist/assets/{openRemoteProjectSession-C85euMiR.js → openRemoteProjectSession-4G0Mp1ns.js} +1 -1
  107. package/dist/assets/{openSessionFromDeepLink-CDs-skAS.js → openSessionFromDeepLink-B3BzCo20.js} +2 -2
  108. package/dist/assets/{pl-CD38psJG.js → pl-CDqj2zfd.js} +2 -2
  109. package/dist/assets/{pluginPresentation-upXqjrId.js → pluginPresentation-Cw-C09Hc.js} +1 -1
  110. package/dist/assets/{pt-BR-DBB59YTx.js → pt-BR-BXJe1xYL.js} +2 -2
  111. package/dist/assets/{pwa-BSv0q2V7.js → pwa-Djnoay3N.js} +1 -1
  112. package/dist/assets/{queue-abort-optimistic-CkmS8yTs.js → queue-abort-optimistic-CpPpvdxn.js} +1 -1
  113. package/dist/assets/{quota-BFl8FaMm.js → quota-W4rU9QuH.js} +1 -1
  114. package/dist/assets/{reference-history-BfwrDjks.js → reference-history-qVIiJFY6.js} +1 -1
  115. package/dist/assets/remoteProjectQueries-CopzDHZe.js +1 -0
  116. package/dist/assets/{remoteSessionReference-DRv5U8a9.js → remoteSessionReference-9anx54fV.js} +1 -1
  117. package/dist/assets/{renderElectronMiniChatApp-YbsPMg7E.js → renderElectronMiniChatApp-EDpvGixT.js} +2 -2
  118. package/dist/assets/{renderMobileApp-QD_41cfk.js → renderMobileApp-CRTFdfsV.js} +5 -5
  119. package/dist/assets/{runtimeConfig-BT-o1J3r.js → runtimeConfig-D1vp1jXa.js} +1 -1
  120. package/dist/assets/runtimeEndpointReset-D3PK9OY3.js +4 -0
  121. package/dist/assets/{scheduledTaskNavigation-SCU3wxYg.js → scheduledTaskNavigation-BfgxRBkZ.js} +1 -1
  122. package/dist/assets/{select-DNrc5_kl.js → select-ByWzzgfq.js} +1 -1
  123. package/dist/assets/{sessionLookup-DNi6Sfyx.js → sessionLookup-BCD7xQ0s.js} +1 -1
  124. package/dist/assets/shortcuts-BIwHgZl-.js +1 -0
  125. package/dist/assets/{sortable-tabs-strip-DqPiLPN2.js → sortable-tabs-strip-BTww8YS1.js} +1 -1
  126. package/dist/assets/spacedFileMention-DfI79AYT.js +1 -0
  127. package/dist/assets/{speechSettingsQueries-CVATB1QU.js → speechSettingsQueries-BaFoYcSY.js} +1 -1
  128. package/dist/assets/{store-1zpYqZEm.js → store-BUNov-dS.js} +4 -4
  129. package/dist/assets/{switch-COh9mZOL.js → switch-nBnRBAW3.js} +1 -1
  130. package/dist/assets/{terminalApi-Cs8T3taw.js → terminalApi-Cg9eNRXp.js} +1 -1
  131. package/dist/assets/{textarea-DnOdSgZM.js → textarea-DbKqSgXl.js} +1 -1
  132. package/dist/assets/{timeFormat-ZGJSZlGk.js → timeFormat-jyRFc3TA.js} +1 -1
  133. package/dist/assets/{tooltip-wFf92wqJ.js → tooltip-KqYXHoiE.js} +1 -1
  134. package/dist/assets/{truncated-path-CNuLLJYq.js → truncated-path-BVONNNs1.js} +1 -1
  135. package/dist/assets/{types-C4KUivVG.js → types-CuAxZ5HG.js} +1 -1
  136. package/dist/assets/ui-gH75_gWj.js +13 -0
  137. package/dist/assets/{uk-Cvg8_R2n.js → uk-B5z71t0I.js} +2 -2
  138. package/dist/assets/useAppFontEffects-TjnIqwlI.js +7 -0
  139. package/dist/assets/{useAssistantUIStore-jd_I1qR9.js → useAssistantUIStore-D_7_VmeY.js} +1 -1
  140. package/dist/assets/{useDesktopWindowControlsLayout-DJTBs9Ai.js → useDesktopWindowControlsLayout-pEDvGCAI.js} +1 -1
  141. package/dist/assets/{useDictation-Dw4cPz-9.js → useDictation-CtI9i0nb.js} +1 -1
  142. package/dist/assets/{useEffectiveDirectory-DleT4CpD.js → useEffectiveDirectory-DO47kx8J.js} +1 -1
  143. package/dist/assets/{useFontPreferences-D8ajsrAw.js → useFontPreferences-C_U0TdQZ.js} +1 -1
  144. package/dist/assets/{useGitStore-DTlP-L0a.js → useGitStore-DdWKLUCb.js} +1 -1
  145. package/dist/assets/{useInlineCommentDraftStore-Wde2bT5p.js → useInlineCommentDraftStore-BhYBTBtT.js} +1 -1
  146. package/dist/assets/useMcpConfigStore-DeBLHEln.js +1 -0
  147. package/dist/assets/{useMobileSwipeActions-k7KGPpqM.js → useMobileSwipeActions-Ksa_CkbQ.js} +1 -1
  148. package/dist/assets/{useMobileTranscriptSyncHint-BLI4fy8Q.js → useMobileTranscriptSyncHint-i3zhVIUh.js} +1 -1
  149. package/dist/assets/{useModelLists-DUsn2kaq.js → useModelLists-7_E2T5ev.js} +1 -1
  150. package/dist/assets/{useOpenCodeReadiness-Bxz72dNZ.js → useOpenCodeReadiness-JFbJk0Mg.js} +1 -1
  151. package/dist/assets/{usePluginsStore-DzweL9M8.js → usePluginsStore-DP3gcI-s.js} +1 -1
  152. package/dist/assets/{useProjectGitActions-BPlLnhmx.js → useProjectGitActions-C25uO6_j.js} +1 -1
  153. package/dist/assets/{useProjectGitStore-EZRP6D6M.js → useProjectGitStore-BYfY7A74.js} +1 -1
  154. package/dist/assets/{useProjectRuntimeAPIs-Cbt-c1SP.js → useProjectRuntimeAPIs-DGVmHgCx.js} +1 -1
  155. package/dist/assets/{useQuotaStore-cFgc-IG2.js → useQuotaStore-CYSImtuE.js} +1 -1
  156. package/dist/assets/{useSessionBtwStore-DjwWijyt.js → useSessionBtwStore-kbteXiWK.js} +1 -1
  157. package/dist/assets/{useStreamingTextThrottle-B8aWuwgs.js → useStreamingTextThrottle-Cv2XQjeg.js} +1 -1
  158. package/dist/assets/{useTerminalStore-BEY9gQzc.js → useTerminalStore-BRbNqUvc.js} +1 -1
  159. package/dist/assets/useUIStore-1DE4XJOx.js +1 -0
  160. package/dist/assets/{worktreeManager-BbQ4inHD.js → worktreeManager-DDEk6-Rl.js} +1 -1
  161. package/dist/assets/{worktreeSourceBranchPreference-7Id37MxY.js → worktreeSourceBranchPreference-DLhyD194.js} +1 -1
  162. package/dist/assets/{zh-CN-B6Gc3wZh.js → zh-CN-D4vLeHqe.js} +2 -2
  163. package/dist/assets/zh-TW-DPqnNQKu.js +15 -0
  164. package/dist/index.html +8 -8
  165. package/dist/mini-chat.html +8 -8
  166. package/dist/mobile.html +1 -1
  167. package/package.json +1 -1
  168. package/server/index.js +1 -0
  169. package/server/lib/assistants/DOCUMENTATION.md +10 -2
  170. package/server/lib/assistants/builtin-skills.js +4 -4
  171. package/server/lib/assistants/builtin-skills.test.js +7 -4
  172. package/server/lib/assistants/harness.js +2 -1
  173. package/server/lib/assistants/remote-execution.test.js +60 -1
  174. package/server/lib/assistants/service.js +1 -0
  175. package/server/lib/assistants/yuri-tools.js +42 -6
  176. package/server/lib/gui-customization/DOCUMENTATION.md +13 -6
  177. package/server/lib/gui-customization/projects-client.mjs +5 -3
  178. package/server/lib/gui-customization/projects.js +16 -4
  179. package/server/lib/gui-customization/projects.test.js +38 -2
  180. package/server/lib/gui-customization/session-skill.js +3 -3
  181. package/server/lib/gui-customization/session-skill.test.js +9 -7
  182. package/server/lib/gui-customization/skill/SKILL.md +22 -13
  183. package/server/lib/gui-customization/skill/references/projects.md +16 -2
  184. package/server/lib/opencode/feature-routes-runtime.js +6 -2
  185. package/server/lib/opencode/session-directory-runtime.js +5 -1
  186. package/server/lib/opencode/session-directory-runtime.test.js +39 -0
  187. package/server/lib/projects/DOCUMENTATION.md +4 -3
  188. package/server/lib/projects/registry.js +12 -1
  189. package/server/lib/remote-hosts/DOCUMENTATION.md +5 -1
  190. package/server/lib/remote-hosts/gateway.js +21 -0
  191. package/server/lib/remote-hosts/routes.js +44 -0
  192. package/server/lib/remote-hosts/routes.test.js +48 -0
  193. package/server/lib/scheduled-tasks/session-skill.test.js +9 -3
  194. package/server/lib/session-index/DOCUMENTATION.md +6 -2
  195. package/server/lib/session-index/sync-runtime.js +117 -89
  196. package/dist/assets/ArchivedSessionsDialog-C3Yn2T92.js +0 -1
  197. package/dist/assets/AssistantConversationSurface-B59k-lXE.css +0 -1
  198. package/dist/assets/AssistantConversationSurface-BnoGpvaw.js +0 -3
  199. package/dist/assets/ChatContainer-DQ2aAjYQ.js +0 -65
  200. package/dist/assets/ScheduledTasksDialog-BMoHLXYW.js +0 -3
  201. package/dist/assets/TerminalView-BwradFZm.js +0 -9
  202. package/dist/assets/es-Dl_f-VoR.js +0 -15
  203. package/dist/assets/main-Bd77IVQE.js +0 -2
  204. package/dist/assets/main-HeMyVqAF.js +0 -169
  205. package/dist/assets/miniChat-Brvg2KsE.js +0 -2
  206. package/dist/assets/mobile-BOuoV895.js +0 -2
  207. package/dist/assets/remoteProjectQueries-DFbTE2e2.js +0 -1
  208. package/dist/assets/runtimeEndpointReset-CltKCEAq.js +0 -4
  209. package/dist/assets/sessionOwnership-B4NyrdiS.js +0 -2
  210. package/dist/assets/shortcuts-B0XmqH9X.js +0 -1
  211. package/dist/assets/spacedFileMention-Ds4GtgiF.js +0 -1
  212. package/dist/assets/ui-BPOP32rM.js +0 -13
  213. package/dist/assets/useAppFontEffects-BxzLAPb0.js +0 -7
  214. package/dist/assets/useMcpConfigStore-CQCdt0vJ.js +0 -1
  215. package/dist/assets/useUIStore-CxX_u4P7.js +0 -1
  216. package/dist/assets/zh-TW-C2bT0lOZ.js +0 -15
@@ -1,3 +0,0 @@
1
- import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{r as n}from"./platform-BQipzOYw.js";import{ot as r,st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{n as o,s,t as c}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{G as l,P as u,W as d}from"./runtime-file-resource-DDGMqGyv.js";import{a as f,r as p}from"./vendor-reactuses-core-DjKFMfz7.js";import{r as m}from"./useUIStore-CxX_u4P7.js";import{Ft as h,Ha as g,Ot as ee,Xn as _,Zi as v,ao as y,ca as b,io as x,t as S}from"./ui-BPOP32rM.js";import{n as C}from"./Icon-DrsaL1yC.js";import{n as w,t as te}from"./i18n-BZ_vx76q.js";import{n as T}from"./ScrollableOverlay-CFjKY4OJ.js";import{n as ne,t as E}from"./MobileResizableSheet-DKpNzqfc.js";import{i as D,t as O}from"./vendor-framer-motion-D5NyyC73.js";import{n as re,o as ie,r as ae,t as k}from"./dialog-DnZWrDDM.js";import{c as oe,n as se,r as A,t as ce}from"./dropdown-menu-CZWYeFpO.js";import{a as j,n as M,r as le,t as ue}from"./context-menu-C-FLHb_6.js";import{t as de}from"./textarea-DnOdSgZM.js";import{n as fe}from"./mobileBackNavigation-CUoYXnE0.js";import{t as pe}from"./input-DSY3Mg4G.js";import{D as N,E as P,O as me,T as he,_ as F,k as ge}from"./assistantQueries-6GJP0jCO.js";import{n as I}from"./AgentAvatar-BSBHv-65.js";import{t as L}from"./MobileDetailNavigation-_0qkfML1.js";import{t as R}from"./checkbox-BIU2MT0K.js";import{a as z,c as B,r as _e}from"./insertionBoundaries-C1ACCndo.js";import{t as ve}from"./MobileOverlayPanel-cwgcgCxI.js";import{t as V}from"./vendor-motion-vLNN8EMu.js";import{c as H,i as ye,n as be,s as xe,t as Se}from"./select-DNrc5_kl.js";import{a as U,i as Ce,n as we}from"./projectMeta-S7fUN1Zp.js";import{r as Te,t as Ee}from"./router-DXUi1sBd.js";import{t as De}from"./scheduledTaskNavigation-SCU3wxYg.js";import{t as Oe}from"./switch-COh9mZOL.js";import{t as ke}from"./MobileTabPageHeader-B0_vB3Tg.js";import{t as Ae}from"./sortAssistantContacts-CcEdm3mS.js";import{t as W}from"./ModelSelector-C0LV5Vo7.js";import{t as je}from"./AgentSelector-DaT_IvwI.js";import{t as Me}from"./vendor-cron-parser-BmO80h0C.js";var G=t(i(),1),Ne=a(),Pe=`yuri-settings-group-row border-b border-[var(--yuri-settings-row-divider)] last:border-b-0`,Fe=`yuri-settings-group-label`,Ie=Me();function K(e){if(!e||!e.trim())return{valid:!1,error:`required`};try{return Ie.CronExpressionParser.parse(e),{valid:!0}}catch(e){return{valid:!1,error:e instanceof Error?e.message:`Invalid cron expression`}}}function Le(e,t,n=4){try{let r=t?{tz:t,currentDate:new Date}:{currentDate:new Date},i=Ie.CronExpressionParser.parse(e,r),a=[];for(let e=0;e<n;e+=1){let e=i.next();e&&a.push(e.toDate())}return a}catch{return[]}}var Re=[{expression:`*/5 * * * *`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.every5min`},{expression:`0 * * * *`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.everyHour`},{expression:`0 9 * * 1`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.monday9am`},{expression:`0 9,17 * * *`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.9am5pm`},{expression:`0 0 1 * *`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.firstOfMonth`}],q=r(),ze=[0,1,2,3,4,5,6],Be=`!h-9 !min-h-9 w-full min-w-0 rounded-full border-0 bg-[var(--surface-elevated)] px-3 py-1 ring-1 ring-inset ring-border/60 transition-[background-color,box-shadow] duration-150 ease-out hover:[&:not(:focus)]:bg-[var(--surface-subtle)] hover:[&:not(:focus)]:ring-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] data-[popup-open]:bg-[var(--surface-subtle)] data-[popup-open]:shadow-sm motion-reduce:transition-none`,Ve=`yuri-settings-inline-value`,He=`yuri-settings-split-row ${Pe}`,J=Ve,Y=He,Ue=()=>{let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`},X=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),a=new Date(n,r-1,i);return Number.isNaN(a.getTime())||a.getFullYear()!==n||a.getMonth()!==r-1||a.getDate()!==i?null:a},We=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`,Ge=(e,t,n)=>{let r=X(e);return r?new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,year:`numeric`}).format(r):t},Z=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),Ke=(e,t)=>{let n=e.getFullYear(),r=e.getMonth(),i=(new Date(n,r,1).getDay()-t+7)%7,a=new Date(n,r+1,0).getDate(),o=new Date(n,r,0).getDate(),s=[];for(let e=0;e<42;e+=1){let t=e-i+1;if(t<=0){let e=o+t;s.push({date:new Date(n,r-1,e),inCurrentMonth:!1});continue}if(t>a){s.push({date:new Date(n,r+1,t-a),inCurrentMonth:!1});continue}s.push({date:new Date(n,r,t),inCurrentMonth:!0})}return s},Q=e=>{let t=/^([01]\d|2[0-3]):([0-5]\d)$/.exec(e);if(!t)return{hour24:`00`,hour12:`12`,minute:`00`,meridiem:`AM`};let n=Number(t[1]),r=t[2],i=n>=12?`PM`:`AM`,a=n%12==0?12:n%12;return{hour24:String(n).padStart(2,`0`),hour12:String(a).padStart(2,`0`),minute:r,meridiem:i}},qe=(e,t,n)=>{let r=Number(e),i=Number(t),a=Number.isFinite(r)?Math.min(12,Math.max(1,r)):12,o=Number.isFinite(i)?Math.min(59,Math.max(0,i)):0,s=a%12;return n===`PM`&&(s+=12),`${String(s).padStart(2,`0`)}:${String(o).padStart(2,`0`)}`},$=(e,t)=>{let{max:n,min:r=0,loop:i=!1}=t,a=Number.parseInt(e,10);return Number.isFinite(a)?(i?(a>n&&(a=r),a<r&&(a=n)):(a>n&&(a=n),a<r&&(a=r)),String(a).padStart(2,`0`)):`00`},Je=e=>/^(0[1-9]|1[0-2])$/.test(e)?e:$(e,{min:1,max:12}),Ye=e=>/^[0-5][0-9]$/.test(e)?e:$(e,{max:59}),Xe=(e,t)=>$(String(Number.parseInt(e,10)+t),{min:1,max:12,loop:!0}),Ze=(e,t)=>$(String(Number.parseInt(e,10)+t),{min:0,max:59,loop:!0}),Qe=e=>{try{let t=Intl.Locale;if(typeof t!=`function`)return 1;let n=new t(e).weekInfo?.firstDay;return typeof n==`number`?n%7:1}catch{return 1}},$e=e=>{try{let t=new Intl.DateTimeFormat(e,{hour:`numeric`}).resolvedOptions();return typeof t.hour12==`boolean`?!t.hour12:t.hourCycle===`h23`||t.hourCycle===`h24`}catch{return!0}},et=e=>{let t=new Intl.DateTimeFormat(e,{weekday:`short`}),n=new Date(2023,0,1);return ze.map(e=>t.format(new Date(n.getFullYear(),n.getMonth(),n.getDate()+e)))},tt=(e,t)=>[...e.slice(t),...e.slice(0,t)],nt=e=>{let t=(0,Ne.c)(9),{htmlFor:n,required:r,className:i,children:a}=e,o;t[0]===i?o=t[1]:(o=x(`typography-ui-label font-normal text-foreground`,i),t[0]=i,t[1]=o);let s;t[2]===r?s=t[3]:(s=r&&(0,q.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`}),t[2]=r,t[3]=s);let c;return t[4]!==a||t[5]!==n||t[6]!==o||t[7]!==s?(c=(0,q.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,q.jsxs)(`label`,{htmlFor:n,className:o,children:[a,s]})}),t[4]=a,t[5]=n,t[6]=o,t[7]=s,t[8]=c):c=t[8],c},rt=e=>{let t=(0,Ne.c)(85),{value:n,onChange:r,className:i,use24Hour:a,hourAriaLabel:o,minuteAriaLabel:s,periodAriaLabel:c,amLabel:l,pmLabel:u}=e,d;t[0]===n?d=t[1]:(d=Q(n),t[0]=n,t[1]=d);let f=d,p=G.useRef(null),m=G.useRef(null),[h,g]=G.useState(null),[ee,_]=G.useState(null),v=G.useRef(null),y=G.useRef(null),b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{v.current=e,g(e)},t[2]=b):b=t[2];let S=b,C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{y.current=e,_(e)},t[3]=C):C=t[3];let w=C,te=pt,T=mt,ne=ht,E;t[4]!==r||t[5]!==f.meridiem||t[6]!==f.minute||t[7]!==a?(E=e=>{let t=e.replace(/\D/g,``).slice(0,2);S(t),t.length===2&&(r(a?ne(te(t),f.minute):qe(Je(t),f.minute,f.meridiem)),S(null),m.current?.focus())},t[4]=r,t[5]=f.meridiem,t[6]=f.minute,t[7]=a,t[8]=E):E=t[8];let D=E,O;t[9]!==r||t[10]!==f.meridiem||t[11]!==f.minute||t[12]!==a?(O=()=>{let e=v.current;if(e!==null&&(S(null),e.length!==0)){if(a){r(ne(te(e.padStart(2,`0`)),f.minute));return}r(qe(Je(e.padStart(2,`0`)),f.minute,f.meridiem))}},t[9]=r,t[10]=f.meridiem,t[11]=f.minute,t[12]=a,t[13]=O):O=t[13];let re=O,ie;t[14]!==r||t[15]!==f.hour12||t[16]!==f.hour24||t[17]!==f.meridiem||t[18]!==a?(ie=e=>{let t=e.replace(/\D/g,``).slice(0,2);w(t),t.length===2&&(r(a?ne(f.hour24,Ye(t)):qe(f.hour12,Ye(t),f.meridiem)),w(null))},t[14]=r,t[15]=f.hour12,t[16]=f.hour24,t[17]=f.meridiem,t[18]=a,t[19]=ie):ie=t[19];let ae=ie,k;t[20]!==r||t[21]!==f.hour12||t[22]!==f.hour24||t[23]!==f.meridiem||t[24]!==a?(k=()=>{let e=y.current;e!==null&&(w(null),e.length!==0&&r(a?ne(f.hour24,Ye(e.padStart(2,`0`))):qe(f.hour12,Ye(e.padStart(2,`0`)),f.meridiem)))},t[20]=r,t[21]=f.hour12,t[22]=f.hour24,t[23]=f.meridiem,t[24]=a,t[25]=k):k=t[25];let oe=k,se;t[26]!==r||t[27]!==f.hour12||t[28]!==f.hour24||t[29]!==f.meridiem||t[30]!==f.minute||t[31]!==a?(se=e=>r(a?ne(T(f.hour24,e),f.minute):qe(Xe(f.hour12,e),f.minute,f.meridiem)),t[26]=r,t[27]=f.hour12,t[28]=f.hour24,t[29]=f.meridiem,t[30]=f.minute,t[31]=a,t[32]=se):se=t[32];let A=se,ce;t[33]!==r||t[34]!==f.hour12||t[35]!==f.hour24||t[36]!==f.meridiem||t[37]!==f.minute||t[38]!==a?(ce=e=>r(a?ne(f.hour24,Ze(f.minute,e)):qe(f.hour12,Ze(f.minute,e),f.meridiem)),t[33]=r,t[34]=f.hour12,t[35]=f.hour24,t[36]=f.meridiem,t[37]=f.minute,t[38]=a,t[39]=ce):ce=t[39];let j=ce,M;t[40]!==r||t[41]!==f.hour12||t[42]!==f.meridiem||t[43]!==f.minute?(M=e=>{e!==f.meridiem&&r(qe(f.hour12,f.minute,e))},t[40]=r,t[41]=f.hour12,t[42]=f.meridiem,t[43]=f.minute,t[44]=M):M=t[44];let le=M,ue;t[45]!==re||t[46]!==A?(ue=e=>{if(e.key===`ArrowRight`){e.preventDefault(),re(),m.current?.focus();return}(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),S(null),A(e.key===`ArrowUp`?1:-1))},t[45]=re,t[46]=A,t[47]=ue):ue=t[47];let de=ue,fe;t[48]!==oe||t[49]!==j?(fe=e=>{if(e.key===`ArrowLeft`&&(e.currentTarget.selectionStart??0)===0){e.preventDefault(),oe(),p.current?.focus();return}(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),w(null),j(e.key===`ArrowUp`?1:-1))},t[48]=oe,t[49]=j,t[50]=fe):fe=t[50];let pe=fe,N=a?`px-2`:`pl-2 pr-1`,P;t[51]!==i||t[52]!==N?(P=x(`flex h-9 w-full min-w-0 items-center gap-1 rounded-full border-0 bg-[var(--surface-elevated)] ring-1 ring-inset ring-border/60 transition duration-200 ease-out hover:[&:not(:focus-within)]:bg-[var(--surface-subtle)] hover:[&:not(:focus-within)]:ring-transparent focus-within:ring-2 focus-within:ring-[var(--interactive-focus-ring)]`,N,i),t[51]=i,t[52]=N,t[53]=P):P=t[53];let me=h??(a?f.hour24:f.hour12),he;t[54]===D?he=t[55]:(he=e=>D(e.target.value),t[54]=D,t[55]=he);let F;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>S(``),t[56]=F):F=t[56];let ge;t[57]!==re||t[58]!==o||t[59]!==de||t[60]!==me||t[61]!==he?(ge=(0,q.jsx)(`input`,{ref:p,inputMode:`numeric`,value:me,onChange:he,onKeyDown:de,onFocus:F,onBlur:re,maxLength:2,"aria-label":o,className:`h-7 w-7 shrink-0 rounded-sm bg-transparent text-center font-mono text-sm tabular-nums text-foreground outline-none caret-transparent focus:bg-interactive-hover`}),t[57]=re,t[58]=o,t[59]=de,t[60]=me,t[61]=he,t[62]=ge):ge=t[62];let I;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,q.jsx)(`span`,{className:`font-mono text-sm text-muted-foreground`,children:`:`}),t[63]=I):I=t[63];let L=ee??f.minute,R;t[64]===ae?R=t[65]:(R=e=>ae(e.target.value),t[64]=ae,t[65]=R);let z;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>w(``),t[66]=z):z=t[66];let B;t[67]!==oe||t[68]!==s||t[69]!==pe||t[70]!==L||t[71]!==R?(B=(0,q.jsx)(`input`,{ref:m,inputMode:`numeric`,value:L,onChange:R,onKeyDown:pe,onFocus:z,onBlur:oe,maxLength:2,"aria-label":s,className:`h-7 w-7 shrink-0 rounded-sm bg-transparent text-center font-mono text-sm tabular-nums text-foreground outline-none caret-transparent focus:bg-interactive-hover`}),t[67]=oe,t[68]=s,t[69]=pe,t[70]=L,t[71]=R,t[72]=B):B=t[72];let _e;t[73]!==l||t[74]!==f.meridiem||t[75]!==c||t[76]!==u||t[77]!==le||t[78]!==a?(_e=a?null:(0,q.jsxs)(Se,{value:f.meridiem,onValueChange:e=>le(e),children:[(0,q.jsx)(xe,{"aria-label":c,className:`ml-1 h-7 w-fit border-0 bg-transparent pl-2 pr-1 shadow-none hover:bg-interactive-hover focus:ring-0`,children:(0,q.jsx)(H,{})}),(0,q.jsxs)(be,{className:`motion-reduce:transition-none`,children:[(0,q.jsx)(ye,{value:`AM`,children:l}),(0,q.jsx)(ye,{value:`PM`,children:u})]})]}),t[73]=l,t[74]=f.meridiem,t[75]=c,t[76]=u,t[77]=le,t[78]=a,t[79]=_e):_e=t[79];let ve;return t[80]!==P||t[81]!==ge||t[82]!==B||t[83]!==_e?(ve=(0,q.jsxs)(`div`,{className:P,children:[ge,I,B,_e]}),t[80]=P,t[81]=ge,t[82]=B,t[83]=_e,t[84]=ve):ve=t[84],ve},it=e=>new Date(e.getFullYear(),e.getMonth(),1),at=()=>{let e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},ot=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),st=e=>{if(!e)return[`09:00`];let t=(Array.isArray(e.schedule.times)?e.schedule.times:e.schedule.time?[e.schedule.time]:[]).filter(e=>typeof e==`string`&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(e)).map(e=>e.trim()),n=Array.from(new Set(t)).sort((e,t)=>e.localeCompare(t));return n.length>0?n:[`09:00`]},ct=(e,t)=>{let n=Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`;return e?{id:e.id,name:e.name,enabled:e.enabled,schedule:{kind:e.schedule.kind===`cron`?`cron`:e.schedule.kind===`once`?`once`:e.schedule.kind===`weekly`?`weekly`:`daily`,times:st(e),onceDate:typeof e.schedule.date==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e.schedule.date)?e.schedule.date:Ue(),onceTime:typeof e.schedule.time==`string`&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(e.schedule.time)?e.schedule.time:`09:00`,weekdays:Array.isArray(e.schedule.weekdays)?e.schedule.weekdays:[1],timezone:e.schedule.timezone||n,cronExpression:e.schedule.kind===`cron`&&typeof e.schedule.cron==`string`?e.schedule.cron:``},execution:{prompt:e.execution.prompt,providerID:e.execution.providerID,modelID:e.execution.modelID,variant:e.execution.variant||``,agent:e.execution.agent||``,goalEnabled:e.execution.goalEnabled===!0},state:e.state}:{name:``,enabled:!0,schedule:{kind:`daily`,times:[`09:00`],onceDate:Ue(),onceTime:`09:00`,weekdays:[1],timezone:n,cronExpression:``},execution:{prompt:``,providerID:t.providerID,modelID:t.modelID,variant:t.variant,agent:t.agent,goalEnabled:!1}}},lt=(e,t)=>{if(!e.name.trim())return t(`sessions.scheduledTasks.editor.validation.taskNameRequired`);if(!e.execution.prompt.trim())return t(`sessions.scheduledTasks.editor.validation.promptRequired`);if(!e.execution.providerID.trim()||!e.execution.modelID.trim())return t(`sessions.scheduledTasks.editor.validation.modelRequired`);if(e.schedule.kind===`once`){if(!/^\d{4}-\d{2}-\d{2}$/.test(e.schedule.onceDate))return t(`sessions.scheduledTasks.editor.validation.dateFormat`);if(!/^([01]\d|2[0-3]):([0-5]\d)$/.test(e.schedule.onceTime))return t(`sessions.scheduledTasks.editor.validation.timeFormat`)}else if(e.schedule.kind===`cron`){if(!e.schedule.cronExpression.trim())return t(`sessions.scheduledTasks.editor.validation.cronRequired`);if(!K(e.schedule.cronExpression).valid)return t(`sessions.scheduledTasks.editor.validation.cronInvalid`)}else if(e.schedule.times.filter(e=>/^([01]\d|2[0-3]):([0-5]\d)$/.test(e)).length===0)return t(`sessions.scheduledTasks.editor.validation.atLeastOneTime`);return e.schedule.kind===`weekly`&&e.schedule.weekdays.length===0?t(`sessions.scheduledTasks.editor.validation.atLeastOneWeekday`):e.schedule.timezone.trim()?null:t(`sessions.scheduledTasks.editor.validation.timezoneRequired`)},ut=e=>{let t=e.filter(e=>/^([01]\d|2[0-3]):([0-5]\d)$/.test(e));return Array.from(new Set(t)).sort((e,t)=>e.localeCompare(t))},dt=e=>{let t=(0,Ne.c)(74),{draft:n,setDraft:r,locale:i,t:a,panel:o,mobilePanel:s}=e,c=o!==void 0&&o,l=s!==void 0&&s,u=c||l,d=l?Y:He,f=n.schedule.cronExpression,p;t[0]===f?p=t[1]:(p=f.trim()?K(f):null,t[0]=f,t[1]=p);let m=p,h;bb0:{if(!m?.valid||!f.trim()){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[2]=e):e=t[2],h=e;break bb0}let e;t[3]!==f||t[4]!==n.schedule.timezone?(e=Le(f,n.schedule.timezone),t[3]=f,t[4]=n.schedule.timezone,t[5]=e):e=t[5],h=e}let g=h,ee;t[6]!==n.schedule.timezone||t[7]!==i?(ee=e=>new Intl.DateTimeFormat(i,{timeZone:n.schedule.timezone,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).format(e),t[6]=n.schedule.timezone,t[7]=i,t[8]=ee):ee=t[8];let v=ee,y=u&&`gap-0`,b;t[9]===y?b=t[10]:(b=x(`flex flex-col gap-3`,y),t[9]=y,t[10]=b);let S=u&&d,C;t[11]===S?C=t[12]:(C=x(`flex flex-col gap-1`,S),t[11]=S,t[12]=C);let w;t[13]===a?w=t[14]:(w=a(`sessions.scheduledTasks.editor.cronExpression.label`),t[13]=a,t[14]=w);let te;t[15]===w?te=t[16]:(te=(0,q.jsx)(nt,{htmlFor:`sched-cron`,required:!0,children:w}),t[15]=w,t[16]=te);let T=u?``:void 0,ne=u&&`yuri-settings-split-row-control flex-wrap`,E;t[17]===ne?E=t[18]:(E=x(`min-w-0`,ne),t[17]=ne,t[18]=E);let D;t[19]===r?D=t[20]:(D=e=>r(t=>({...t,schedule:{...t.schedule,cronExpression:e.target.value}})),t[19]=r,t[20]=D);let O;t[21]===a?O=t[22]:(O=a(`sessions.scheduledTasks.editor.cronExpression.placeholder`),t[21]=a,t[22]=O);let re=u&&`min-w-[140px] text-right`,ie;t[23]===re?ie=t[24]:(ie=x(`w-full font-mono`,re),t[23]=re,t[24]=ie);let ae;t[25]!==f||t[26]!==D||t[27]!==O||t[28]!==ie?(ae=(0,q.jsx)(pe,{id:`sched-cron`,value:f,onChange:D,placeholder:O,className:ie}),t[25]=f,t[26]=D,t[27]=O,t[28]=ie,t[29]=ae):ae=t[29];let k;t[30]!==f||t[31]!==m||t[32]!==a?(k=m&&!m.valid&&f.trim()?(0,q.jsx)(`span`,{className:`w-full typography-micro text-right text-destructive`,children:a(`sessions.scheduledTasks.editor.validation.cronInvalid`)}):null,t[30]=f,t[31]=m,t[32]=a,t[33]=k):k=t[33];let oe;t[34]!==T||t[35]!==E||t[36]!==ae||t[37]!==k?(oe=(0,q.jsxs)(`div`,{"data-settings-value":T,className:E,children:[ae,k]}),t[34]=T,t[35]=E,t[36]=ae,t[37]=k,t[38]=oe):oe=t[38];let se;t[39]!==te||t[40]!==oe||t[41]!==C?(se=(0,q.jsxs)(`div`,{className:C,children:[te,oe]}),t[39]=te,t[40]=oe,t[41]=C,t[42]=se):se=t[42];let A;t[43]!==v||t[44]!==u||t[45]!==g||t[46]!==d||t[47]!==a?(A=g.length>0?(0,q.jsxs)(`div`,{className:x(`flex flex-col gap-1`,u&&[d,`yuri-scheduled-task-detail-row`]),children:[(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:a(`sessions.scheduledTasks.editor.cronExpression.nextRuns`)}),(0,q.jsx)(`span`,{"data-settings-value":u?``:void 0,className:`flex min-w-0 flex-wrap gap-x-4 gap-y-1 typography-micro text-muted-foreground`,children:g.map(e=>(0,q.jsx)(`span`,{className:`whitespace-nowrap tabular-nums`,children:v(e)},e.toISOString()))})]}):null,t[43]=v,t[44]=u,t[45]=g,t[46]=d,t[47]=a,t[48]=A):A=t[48];let ce;t[49]!==u||t[50]!==d?(ce=u&&[d,`yuri-scheduled-task-detail-row`],t[49]=u,t[50]=d,t[51]=ce):ce=t[51];let j;t[52]===ce?j=t[53]:(j=x(`flex flex-col gap-1`,ce),t[52]=ce,t[53]=j);let M;t[54]===a?M=t[55]:(M=a(`sessions.scheduledTasks.editor.cronExpression.examples`),t[54]=a,t[55]=M);let le;t[56]===M?le=t[57]:(le=(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:M}),t[56]=M,t[57]=le);let ue=u?``:void 0,de;t[58]!==f||t[59]!==r||t[60]!==a?(de=Re.map(e=>(0,q.jsx)(_,{type:`button`,variant:`chip`,size:`xs`,"aria-pressed":f.trim()===e.expression,title:e.expression,onClick:()=>r(t=>({...t,schedule:{...t.schedule,cronExpression:e.expression}})),children:a(e.labelKey)},e.expression)),t[58]=f,t[59]=r,t[60]=a,t[61]=de):de=t[61];let fe;t[62]!==ue||t[63]!==de?(fe=(0,q.jsx)(`div`,{"data-settings-value":ue,className:`flex min-w-0 flex-wrap gap-1.5`,children:de}),t[62]=ue,t[63]=de,t[64]=fe):fe=t[64];let N;t[65]!==j||t[66]!==le||t[67]!==fe?(N=(0,q.jsxs)(`div`,{className:j,children:[le,fe]}),t[65]=j,t[66]=le,t[67]=fe,t[68]=N):N=t[68];let P;return t[69]!==se||t[70]!==A||t[71]!==N||t[72]!==b?(P=(0,q.jsxs)(`div`,{className:b,children:[se,A,N]}),t[69]=se,t[70]=A,t[71]=N,t[72]=b,t[73]=P):P=t[73],P};function ft(e){let{open:t,task:n,onOpenChange:r,onSave:i,presentation:a=`dialog`,onDirtyChange:o,onRun:s,onOpenTaskHistory:c,onDelete:l,onToggleEnabled:u,actionBusy:d=!1,projectID:f=``,projectOptions:p=[],onProjectChange:h}=e,g=a===`panel`,ee=a===`mobile-panel`,y=a===`mobile-tab`,w=ee||y,ne=ee||y,E=g||w,D=w?J:Ve,O=w?Y:He,{t:j,locale:M}=te(),le=v(e=>e.loadProviders),ue=v(e=>e.loadAgents),fe=v(e=>e.providers),N=v(e=>e.currentProviderId),P=v(e=>e.currentModelId),me=v(e=>e.currentVariant||``),he=v(e=>e.currentAgentName||``),F=m(e=>e.timeFormatPreference),ge=m(e=>e.weekStartPreference),I=m(e=>e.isMobile),[V,U]=G.useState(()=>ct(n,{providerID:N,modelID:P,variant:me,agent:he})),[Ce,we]=G.useState(!1),[Te,Ee]=G.useState(!1),[De,ke]=G.useState(!1),[Ae,Me]=G.useState(``),[Ne,Pe]=G.useState(!1),[Ie,K]=G.useState(``),[Le,Re]=G.useState(()=>{let e=X(n?.schedule?.date||``)||new Date;return new Date(e.getFullYear(),e.getMonth(),1)}),Ue=G.useRef(null),Q=G.useRef(null),qe=G.useRef(null),$=G.useRef(null),Je=G.useRef(``),Ye=G.useRef(void 0),Xe=G.useRef(n);Xe.current=n;let Ze=n?.id||null,st=G.useMemo(()=>$e(M),[M]),ft=G.useMemo(()=>Qe(M),[M]),pt=G.useMemo(()=>F===`24h`||F!==`12h`&&st,[F,st]),mt=G.useMemo(()=>ge===`sunday`?0:ge===`monday`?1:ft,[ge,ft]),ht=G.useMemo(()=>{let e=et(M);return tt(ze.map(t=>({value:t,label:e[t]||``})),mt)},[M,mt]);G.useEffect(()=>{t&&(le({source:`scheduledTaskEditor`}),ue({source:`scheduledTaskEditor`}))},[t,le,ue]),G.useEffect(()=>{if(!t){Ye.current=void 0;return}if(Ye.current===Ze)return;Ye.current=Ze;let e=Xe.current,n=ct(e,{providerID:N,modelID:P,variant:me,agent:he});Je.current=JSON.stringify(n),U(n),o?.(!1);let r=X(e?.schedule?.date||``)||new Date;Re(new Date(r.getFullYear(),r.getMonth(),1)),Ee(!1),Pe(!1),ke(!1),K(``),Me(``)},[t,Ze,N,P,me,he,o]),G.useEffect(()=>{if(!(!t||!n||V.id!==n.id||V.enabled===n.enabled)&&(U(e=>({...e,enabled:n.enabled})),Je.current)){let e=JSON.parse(Je.current);Je.current=JSON.stringify({...e,enabled:n.enabled})}},[V.enabled,V.id,t,n]),G.useEffect(()=>{!t||!Je.current||o?.(JSON.stringify(V)!==Je.current)},[V,o,t]),G.useEffect(()=>{if(!Te)return;let e=e=>{Ue.current&&!Ue.current.contains(e.target)&&Ee(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[Te]);let gt=G.useMemo(()=>fe.find(e=>e.id===V.execution.providerID)?.models?.find(e=>e.id===V.execution.modelID),[V.execution.modelID,V.execution.providerID,fe]),_t=G.useMemo(()=>gt?.variants?Object.keys(gt.variants):[],[gt]);G.useEffect(()=>{!gt||!V.execution.variant||_t.includes(V.execution.variant)||U(e=>({...e,execution:{...e.execution,variant:``}}))},[_t,V.execution.variant,gt]);let vt=G.useCallback((e,t)=>{U(n=>{let r=new Set(n.schedule.weekdays);return t?r.add(e):r.delete(e),{...n,schedule:{...n.schedule,weekdays:Array.from(r).sort((e,t)=>e-t)}}})},[]),yt=G.useCallback((e,t)=>{U(n=>{let r=n.schedule.times.slice();return r[e]=t,{...n,schedule:{...n.schedule,times:r}}})},[]),bt=G.useCallback(e=>{U(t=>{let n=t.schedule.times.filter((t,n)=>n!==e);return{...t,schedule:{...t.schedule,times:n.length>0?n:[`09:00`]}}})},[]),xt=G.useCallback(()=>{U(e=>({...e,schedule:{...e.schedule,times:[...e.schedule.times,`12:00`]}}))},[]),St=G.useMemo(()=>at(),[]),Ct=G.useMemo(()=>it(St),[St]),wt=G.useMemo(()=>{let e=X(V.schedule.onceDate);return e?ot(e,St)?j(`sessions.scheduledTasks.editor.date.today`):new Intl.DateTimeFormat(M,{weekday:`short`}).format(e):null},[V.schedule.onceDate,M,j,St]),Tt=G.useMemo(()=>it(Le).getTime()<=Ct.getTime(),[Le,Ct]),Et=G.useMemo(()=>ht.map(e=>e.label),[ht]),Dt=G.useCallback(e=>{U(t=>({...t,schedule:{...t.schedule,onceDate:e}}))},[]),Ot=G.useCallback((e,t)=>{if(e.startsWith(`/`)){let n=e.indexOf(` `),r=e.indexOf(`
2
- `),i=Math.min(n===-1?e.length:n,r===-1?e.length:r);if(t<=i&&n===-1){K(e.substring(1,i)),Pe(!0),ke(!1);return}}Pe(!1);let n=e.substring(0,t),r=n.lastIndexOf(`@`);if(r!==-1){let e=r>0?n[r-1]:null,t=n.substring(r+1);(!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
3
- `)?(Me(t),ke(!0)):ke(!1);return}ke(!1)},[]),kt=G.useCallback(e=>{U(t=>({...t,execution:{...t.execution,prompt:e}}))},[]),At=G.useCallback(e=>{let t=V.execution.prompt,n=Q.current?.selectionStart??t.length,r=t.substring(0,n).lastIndexOf(`@`),i=e.relativePath&&e.relativePath.trim().length>0?e.relativePath.trim():e.path||e.name,a=_e(t,r===-1?n:r,n,`@${i}`);kt(a.text),ke(!1),Me(``),requestAnimationFrame(()=>{let e=Q.current;e&&(e.selectionStart=a.caret,e.selectionEnd=a.caret,e.focus()),Ot(a.text,a.caret)})},[V.execution.prompt,kt,Ot]),jt=G.useCallback(e=>{let t=V.execution.prompt,n=Q.current?.selectionStart??t.length,r=t.substring(0,n).lastIndexOf(`@`),i=_e(t,r===-1?n:r,n,`@${e}`);kt(i.text),ke(!1),Me(``),requestAnimationFrame(()=>{let e=Q.current;e&&(e.selectionStart=i.caret,e.selectionEnd=i.caret,e.focus()),Ot(i.text,i.caret)})},[V.execution.prompt,kt,Ot]),Mt=G.useCallback(e=>{let t=`/${e.name} `;kt(t),Pe(!1),K(``),requestAnimationFrame(()=>{let e=Q.current;e&&(e.focus(),e.selectionStart=e.value.length,e.selectionEnd=e.value.length),Ot(t,t.length)})},[kt,Ot]),Nt=G.useCallback(e=>{if(Ne&&$.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)){e.preventDefault(),$.current.handleKeyDown(e.key);return}De&&qe.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),qe.current.handleKeyDown(e.key))},[Ne,De]),Pt=G.useCallback(async()=>{let e=lt(V,j);if(e){S.error(e);return}let t={...V.id?{id:V.id}:{},name:V.name.trim(),enabled:V.enabled,schedule:{kind:V.schedule.kind,timezone:V.schedule.timezone.trim(),...V.schedule.kind===`cron`?{cron:V.schedule.cronExpression.trim()}:V.schedule.kind===`once`?{date:V.schedule.onceDate,time:V.schedule.onceTime}:{times:ut(V.schedule.times),...V.schedule.kind===`weekly`?{weekdays:V.schedule.weekdays}:{}}},execution:{prompt:V.execution.prompt,providerID:V.execution.providerID,modelID:V.execution.modelID,...V.execution.variant.trim()?{variant:V.execution.variant.trim()}:{},...V.execution.agent.trim()?{agent:V.execution.agent.trim()}:{},...V.execution.goalEnabled?{goalEnabled:!0}:{}},...V.state?{state:V.state}:{}};we(!0);try{let e=await i(t);if(a===`panel`){let t=ct(e||n,{providerID:N,modelID:P,variant:me,agent:he});Je.current=JSON.stringify(t),U(t),o?.(!1)}else r(!1)}catch(e){S.error(e instanceof Error?e.message:j(`sessions.scheduledTasks.editor.toast.saveFailed`))}finally{we(!1)}},[he,P,N,me,V,o,r,i,a,j,n]),Ft=G.useId(),It=G.useCallback(()=>typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"], [data-slot="select-content"]`),[]),Lt=j(n?`sessions.scheduledTasks.editor.title.edit`:`sessions.scheduledTasks.editor.title.new`),Rt=j(`sessions.scheduledTasks.editor.description`),zt=(0,q.jsxs)(`div`,{className:x(`yuri-settings-workspace yuri-settings-page-content yuri-scheduled-task-form`,I?`yuri-settings-workspace-mobile`:`yuri-settings-workspace-desktop`),children:[(0,q.jsxs)(`div`,{className:x(`flex flex-col gap-1`,(g||y)&&`hidden`),children:[(0,q.jsx)(nt,{htmlFor:`sched-name`,required:!0,children:j(`sessions.scheduledTasks.editor.taskName.label`)}),(0,q.jsx)(pe,{id:`sched-name`,value:V.name,onChange:e=>U(t=>({...t,name:e.target.value})),placeholder:j(`sessions.scheduledTasks.editor.taskName.placeholder`),maxLength:80,required:!0,"aria-invalid":!V.name.trim(),className:`yuri-scheduled-task-title w-full`})]}),(0,q.jsxs)(`div`,{className:x(`flex flex-col gap-3 border-t border-border/40 pt-5`,E&&`yuri-settings-group order-4 animate-in fade-in slide-in-from-right-1 border-0 pt-0 duration-200 [animation-delay:80ms] [animation-fill-mode:both] motion-reduce:animate-none`),children:[E?(0,q.jsx)(`h3`,{className:Fe,children:j(`sessions.scheduledTasks.editor.panel.frequency`)}):null,(0,q.jsxs)(`div`,{className:x(E&&`yuri-settings-group-card`,E&&V.schedule.kind===`once`&&Te&&`overflow-visible`),children:[(0,q.jsx)(`div`,{className:x(`grid grid-cols-1 gap-x-4 gap-y-3`,E&&`flex flex-col gap-0`,!I&&!E&&`sm:grid-cols-2`),children:(0,q.jsxs)(`div`,{className:x(`flex min-w-0 flex-col gap-1`,E&&[O,`last:border-b`]),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.scheduleType.label`)}),(0,q.jsx)(`div`,{"data-settings-value":E?``:void 0,className:x(E&&`yuri-settings-split-row-control`),children:(0,q.jsxs)(Se,{value:V.schedule.kind,onValueChange:e=>{U(t=>({...t,schedule:{...t.schedule,kind:e,...e===`cron`&&!t.schedule.cronExpression?{cronExpression:`0 * * * *`}:{}}}))},children:[(0,q.jsx)(xe,{className:x(!E&&Be,E&&D),children:(0,q.jsx)(H,{children:e=>j(e===`daily`?`sessions.scheduledTasks.editor.scheduleType.daily`:e===`weekly`?`sessions.scheduledTasks.editor.scheduleType.weekly`:e===`cron`?`sessions.scheduledTasks.editor.scheduleType.cron`:`sessions.scheduledTasks.editor.scheduleType.once`)})}),(0,q.jsxs)(be,{className:`motion-reduce:transition-none`,children:[(0,q.jsx)(ye,{value:`daily`,children:j(`sessions.scheduledTasks.editor.scheduleType.daily`)}),(0,q.jsx)(ye,{value:`weekly`,children:j(`sessions.scheduledTasks.editor.scheduleType.weekly`)}),(0,q.jsx)(ye,{value:`once`,children:j(`sessions.scheduledTasks.editor.scheduleType.once`)}),(0,q.jsx)(ye,{value:`cron`,children:j(`sessions.scheduledTasks.editor.scheduleType.cron`)})]})]})})]})}),V.schedule.kind===`cron`?(0,q.jsx)(dt,{draft:V,setDraft:U,locale:M,t:j,panel:g,mobilePanel:w}):V.schedule.kind===`once`?(0,q.jsxs)(`div`,{className:x(`grid grid-cols-1 gap-x-4 gap-y-3`,E&&`flex flex-col gap-0`,!I&&!E&&`sm:grid-cols-2`),children:[(0,q.jsxs)(`div`,{className:x(`flex min-w-0 flex-col gap-1`,E&&O),ref:Ue,children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.date.label`)}),(0,q.jsxs)(`div`,{"data-settings-value":E?``:void 0,className:x(`relative`,E&&`yuri-settings-split-row-control`),children:[(0,q.jsxs)(`button`,{type:`button`,className:x(!E&&Be,`flex items-center justify-between gap-2 text-left`,E&&[D,`w-full`]),onClick:()=>Ee(e=>!e),children:[(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(C,{name:`calendar`,className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`truncate typography-ui-label text-foreground`,children:Ge(V.schedule.onceDate,j(`sessions.scheduledTasks.editor.date.placeholder`),M)})]}),(0,q.jsx)(C,{name:`arrow-down-s`,className:`h-4 w-4 shrink-0 text-muted-foreground`})]}),Te?(0,q.jsxs)(`div`,{className:x(`absolute top-[calc(100%+6px)] z-50 w-[min(288px,calc(100vw-2rem))] animate-in fade-in zoom-in-95 slide-in-from-top-1 rounded-xl border border-border bg-background p-3 shadow-sm duration-150 motion-reduce:animate-none`,w?`right-0`:`left-0`),children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,q.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-interactive-hover disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>Re(e=>Z(e,-1)),"aria-label":j(`sessions.scheduledTasks.editor.date.previousMonth`),disabled:Tt,children:(0,q.jsx)(C,{name:`arrow-left-s`,className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`typography-ui-label text-foreground`,children:new Intl.DateTimeFormat(M,{month:`long`,year:`numeric`}).format(Le)}),(0,q.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-interactive-hover`,onClick:()=>Re(e=>Z(e,1)),"aria-label":j(`sessions.scheduledTasks.editor.date.nextMonth`),children:(0,q.jsx)(C,{name:`arrow-right-s`,className:`h-4 w-4`})})]}),(0,q.jsx)(`div`,{className:`mb-1 grid grid-cols-7 gap-1 px-1`,children:Et.map((e,t)=>(0,q.jsx)(`div`,{className:`py-1 text-center typography-micro text-muted-foreground`,children:e},`${e}-${t}`))}),(0,q.jsx)(`div`,{className:`grid grid-cols-7 gap-1`,children:Ke(Le,mt).map(({date:e,inCurrentMonth:t})=>{let n=We(e),r=n===V.schedule.onceDate,i=ot(e,St),a=e.getTime()<St.getTime();return(0,q.jsx)(`button`,{type:`button`,onClick:()=>{a||(Dt(n),Ee(!1))},disabled:a,className:[`h-8 rounded-md typography-ui-label`,r?`bg-interactive-selection text-interactive-selection-foreground`:a?`text-muted-foreground/40`:t?`text-foreground hover:bg-interactive-hover`:`text-muted-foreground/60 hover:bg-interactive-hover`,i&&!r?`ring-1 ring-inset ring-interactive-focusRing bg-interactive-hover/50`:``,a?`cursor-not-allowed opacity-45`:``].join(` `),children:e.getDate()},n)})}),(0,q.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-border pt-2`,children:[(0,q.jsx)(`div`,{className:`typography-micro text-muted-foreground`,children:wt||``}),(0,q.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{Dt(We(St)),Re(new Date(St.getFullYear(),St.getMonth(),1))},children:j(`sessions.scheduledTasks.editor.date.jumpToToday`)})]})]}):null]})]}),(0,q.jsxs)(`div`,{className:x(`flex min-w-0 flex-col gap-1`,E&&O),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.time.label`)}),(0,q.jsx)(`div`,{"data-settings-value":E?``:void 0,className:x(E&&`yuri-settings-split-row-control`),children:(0,q.jsx)(rt,{value:V.schedule.onceTime,className:x(E&&`yuri-settings-inline-value w-fit min-w-0 justify-end`),use24Hour:pt,hourAriaLabel:j(`sessions.scheduledTasks.editor.time.hourAria`),minuteAriaLabel:j(`sessions.scheduledTasks.editor.time.minuteAria`),periodAriaLabel:j(`sessions.scheduledTasks.editor.time.periodAria`),amLabel:j(`sessions.scheduledTasks.editor.time.period.am`),pmLabel:j(`sessions.scheduledTasks.editor.time.period.pm`),onChange:e=>U(t=>({...t,schedule:{...t.schedule,onceTime:e}}))})})]})]}):(0,q.jsxs)(`div`,{className:x(`grid grid-cols-1 gap-x-4 gap-y-3`,E&&`flex flex-col gap-0`,!I&&!E&&`sm:grid-cols-2`),children:[V.schedule.kind===`weekly`?(0,q.jsxs)(`div`,{className:x(`flex flex-col gap-1`,E&&[`yuri-settings-group-row border-b border-[var(--yuri-settings-row-divider)] last:border-b-0`,`yuri-settings-split-row`],!I&&!E&&`sm:col-span-2`),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.weekdays.label`)}),(0,q.jsx)(`div`,{"data-settings-value":E?``:void 0,className:x(`flex flex-wrap gap-x-3 gap-y-2`,E&&`yuri-settings-split-row-control justify-end`),children:ht.map(e=>{let t=V.schedule.weekdays.includes(e.value);return(0,q.jsxs)(`div`,{className:[`group inline-flex items-center gap-1.5 px-0.5 py-0.5 typography-meta`,t?`text-foreground`:`text-muted-foreground`].join(` `),children:[(0,q.jsx)(R,{checked:t,onChange:t=>vt(e.value,t),ariaLabel:e.label}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>vt(e.value,!t),className:`group-hover:text-foreground`,children:e.label})]},e.value)})})]}):null,(0,q.jsxs)(`div`,{className:x(`flex min-w-0 flex-col gap-2`,E&&[O,`justify-start`],w&&`flex-col items-stretch`),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.times.label`)}),(0,q.jsxs)(`div`,{"data-settings-value":E?``:void 0,className:x(E?`yuri-settings-split-row-control relative flex-wrap justify-end`:`contents`),children:[(0,q.jsx)(`div`,{className:x(`flex flex-col gap-2`,E&&`flex-row flex-wrap justify-end transition-[padding] motion-reduce:transition-none`,g&&`group-hover:pr-8`),children:V.schedule.times.map((e,t)=>(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(rt,{value:e,className:x(E&&`yuri-settings-inline-value w-fit min-w-0`),use24Hour:pt,hourAriaLabel:j(`sessions.scheduledTasks.editor.time.hourAria`),minuteAriaLabel:j(`sessions.scheduledTasks.editor.time.minuteAria`),periodAriaLabel:j(`sessions.scheduledTasks.editor.time.periodAria`),amLabel:j(`sessions.scheduledTasks.editor.time.period.am`),pmLabel:j(`sessions.scheduledTasks.editor.time.period.pm`),onChange:e=>yt(t,e)}),V.schedule.times.length>1?(0,q.jsx)(_,{type:`button`,size:`icon`,variant:`ghost`,onClick:()=>bt(t),"aria-label":j(`sessions.scheduledTasks.editor.times.removeAria`),children:(0,q.jsx)(C,{name:`close`,className:`h-4 w-4`})}):null]},t))}),(0,q.jsx)(`div`,{className:x(E&&`shrink-0`,g&&`absolute right-0`),children:(0,q.jsxs)(_,{type:`button`,size:E?`icon`:`sm`,variant:E?`ghost`:`outline`,className:x(`h-9`,g&&`size-7 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none`,w&&`size-9`),onClick:xt,"aria-label":j(`sessions.scheduledTasks.editor.times.add`),children:[(0,q.jsx)(C,{name:`add`,className:x(`h-4 w-4`,!E&&`mr-1`)}),E?null:j(`sessions.scheduledTasks.editor.times.add`)]})})]})]})]})]})]}),(0,q.jsxs)(`div`,{className:x(`flex flex-col gap-3 border-t border-border/40 pt-5`,E&&`contents`),children:[(0,q.jsxs)(`div`,{className:x(E?`yuri-settings-group order-2`:`contents`),children:[E?(0,q.jsx)(`h3`,{className:Fe,children:j(`sessions.scheduledTasks.editor.panel.details`)}):null,(0,q.jsxs)(`div`,{className:x(`grid grid-cols-1 gap-x-4 gap-y-3`,E&&[`flex flex-col gap-0 animate-in fade-in slide-in-from-right-1 duration-200 [animation-delay:40ms] [animation-fill-mode:both] motion-reduce:animate-none`,`yuri-settings-group-card`],!I&&!E&&`sm:grid-cols-2`),children:[p.length>0?(0,q.jsxs)(`div`,{className:x(`flex min-w-0 flex-col gap-1`,E&&O),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.dialog.project.label`)}),(0,q.jsx)(`div`,{"data-settings-value":E?``:void 0,className:x(E&&`yuri-settings-split-row-control`),children:(0,q.jsxs)(Se,{value:f,disabled:!h,onValueChange:h,children:[(0,q.jsx)(xe,{className:x(!E&&Be,E&&D),children:(0,q.jsx)(H,{children:e=>p.find(t=>t.id===e)?.label})}),(0,q.jsx)(be,{className:`motion-reduce:transition-none`,children:p.map(e=>(0,q.jsx)(ye,{value:e.id,children:e.label},e.id))})]})})]}):null,(0,q.jsxs)(`div`,{className:x(`flex min-w-0 flex-col gap-1`,E&&O),children:[(0,q.jsx)(nt,{required:!0,children:j(`sessions.scheduledTasks.editor.model.label`)}),(0,q.jsx)(`div`,{"data-settings-value":E?``:void 0,className:x(E&&`yuri-settings-split-row-control`),children:(0,q.jsx)(W,{providerId:V.execution.providerID,modelId:V.execution.modelID,variant:V.execution.variant,className:x(!E&&Be,E&&D,`[&>div]:min-w-0 [&>div]:flex-1 [&_span]:truncate`),showIcon:!g,onChange:(e,t,n=``)=>{U(r=>({...r,execution:{...r.execution,providerID:e,modelID:t,variant:n}}))}})})]}),E?(0,q.jsxs)(`div`,{className:O,children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.agent.label`)}),(0,q.jsx)(`div`,{"data-settings-value":``,className:`yuri-settings-split-row-control`,children:(0,q.jsx)(je,{agentName:V.execution.agent,className:x(D,`[&>div]:min-w-0 [&>div]:flex-1 [&_span]:truncate`),showIcon:!0,filter:e=>b(e.mode),onChange:e=>U(t=>({...t,execution:{...t.execution,agent:e}}))})})]}):null,E?(0,q.jsxs)(`label`,{className:x(O,`cursor-pointer`),children:[(0,q.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:j(`sessions.scheduledTasks.editor.goal.label`)}),(0,q.jsx)(`span`,{"data-settings-value":``,className:`yuri-settings-split-row-control`,children:(0,q.jsx)(R,{checked:V.execution.goalEnabled,onChange:e=>U(t=>({...t,execution:{...t.execution,goalEnabled:e}})),ariaLabel:j(`sessions.scheduledTasks.editor.goal.aria`)})})]}):null]})]}),E?null:(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.agent.label`)}),(0,q.jsx)(je,{agentName:V.execution.agent,className:x(Be,`[&>div]:min-w-0 [&>div]:flex-1 [&_span]:truncate`),filter:e=>b(e.mode),onChange:e=>U(t=>({...t,execution:{...t.execution,agent:e}}))})]}),(0,q.jsxs)(`div`,{className:x(`flex flex-col gap-1`,E&&`order-1`),children:[(0,q.jsx)(`div`,{className:x(E&&`sr-only`),children:(0,q.jsx)(nt,{htmlFor:`sched-prompt`,required:!0,children:j(`sessions.scheduledTasks.editor.prompt.label`)})}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(de,{id:`sched-prompt`,ref:Q,value:V.execution.prompt,onChange:e=>{let t=e.target.value;kt(t);let n=e.target.selectionStart??t.length;Ot(t,n)},onKeyDown:Nt,rows:8,outerClassName:`h-64 min-h-32`,placeholder:j(`sessions.scheduledTasks.editor.prompt.placeholder`),className:x(`typography-meta min-h-0 overflow-y-auto`,E&&`px-4 pt-4 text-base placeholder:text-muted-foreground/65`)}),Ne?(0,q.jsx)(z,{ref:$,searchQuery:Ie,onCommandSelect:Mt,onClose:()=>Pe(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,De?(0,q.jsx)(B,{ref:qe,searchQuery:Ae,onFileSelect:At,onAgentSelect:jt,onSkillSelect:e=>jt(e.name),onClose:()=>ke(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null]})]}),E?null:(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-8 gap-y-2`,children:(0,q.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2`,children:[(0,q.jsx)(R,{checked:V.execution.goalEnabled,onChange:e=>U(t=>({...t,execution:{...t.execution,goalEnabled:e}})),ariaLabel:j(`sessions.scheduledTasks.editor.goal.aria`)}),(0,q.jsx)(`span`,{className:`typography-meta`,children:j(`sessions.scheduledTasks.editor.goal.label`)})]})})]})]}),Bt=(0,q.jsxs)(`div`,{className:x(`flex flex-wrap items-center justify-between gap-3`,a===`panel`&&`justify-end`,ne&&`flex-nowrap gap-2`),children:[(0,q.jsxs)(`label`,{className:x(`inline-flex items-center gap-2`,a===`panel`&&`hidden`),children:[(0,q.jsx)(R,{checked:V.enabled,onChange:e=>U(t=>({...t,enabled:e})),ariaLabel:j(`sessions.scheduledTasks.editor.enabled.aria`)}),(0,q.jsx)(`span`,{className:`typography-meta`,children:j(`sessions.scheduledTasks.editor.enabled.label`)})]}),(0,q.jsxs)(`div`,{className:x(`flex flex-wrap items-center justify-end gap-2`,ne&&`ml-auto flex-nowrap`),children:[a!==`panel`&&!ne?(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r(!1),disabled:Ce,children:j(`sessions.scheduledTasks.editor.actions.cancel`)}):null,(0,q.jsx)(_,{type:`button`,size:`sm`,className:x(a===`panel`&&`rounded-lg`,ne&&`min-h-11 px-5`),onClick:Pt,disabled:Ce,children:j(Ce?`sessions.scheduledTasks.editor.actions.saving`:n?`sessions.scheduledTasks.editor.actions.save`:`sessions.scheduledTasks.dialog.actions.create`)})]})]}),Vt=!!(n&&c),Ht=n&&l&&s?(0,q.jsxs)(ce,{children:[(0,q.jsx)(oe,{asChild:!0,children:(0,q.jsx)(_,{type:`button`,variant:y?`mobileGlass`:`ghost`,size:y?`mobileIcon`:`icon`,className:x(!y&&`rounded-lg`,!y&&(I?`size-11`:`size-8`)),disabled:Ce||d,"aria-label":j(`sessions.scheduledTasks.dialog.actions.moreAria`,{taskName:n.name}),children:(0,q.jsx)(C,{name:`more-2`,className:y?`size-5`:`size-4`})})}),(0,q.jsxs)(se,{align:`end`,className:`min-w-40 motion-reduce:transition-none`,children:[(0,q.jsxs)(A,{className:x(y&&`min-h-11`),onSelect:()=>void s(n),children:[(0,q.jsx)(C,{name:`play`,className:`size-4`}),j(`sessions.scheduledTasks.dialog.actions.runNow`)]}),Vt?(0,q.jsxs)(A,{className:x(y&&`min-h-11`),onSelect:()=>c?.(n),children:[(0,q.jsx)(C,{name:`history`,className:`size-4`}),j(`sessions.scheduledTasks.workspace.views.history`)]}):null,u?(0,q.jsxs)(A,{className:x(y&&`min-h-11`),onSelect:()=>void u(n,!n.enabled),children:[(0,q.jsx)(C,{name:n.enabled?`pause`:`play`,className:`size-4`}),n.enabled?j(`sessions.scheduledTasks.dialog.taskToggle.pauseAria`,{taskName:n.name}):j(`sessions.scheduledTasks.dialog.taskToggle.enableAria`,{taskName:n.name})]}):null,(0,q.jsxs)(A,{variant:`destructive`,className:x(y&&`min-h-11`),onSelect:()=>void l(n),children:[(0,q.jsx)(C,{name:`delete-bin`,className:`size-4`}),j(`sessions.scheduledTasks.dialog.actions.delete`)]})]})]}):null;return a===`panel`?t?(0,q.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-labelledby":`scheduled-task-panel-title`,children:[(0,q.jsxs)(`header`,{className:`shrink-0 animate-in fade-in slide-in-from-right-1 px-6 pb-4 pt-5 duration-200 motion-reduce:animate-none`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(`span`,{className:x(`typography-meta font-medium`,n?.enabled?`text-[var(--status-info)]`:`text-muted-foreground`),children:n?n.enabled?j(`sessions.scheduledTasks.dialog.taskToggle.enabled`):j(`sessions.scheduledTasks.dialog.taskToggle.paused`):Lt}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Ht,n&&u?(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:x(`rounded-lg`,I?`size-11`:`size-8`),disabled:Ce||d,onClick:()=>void u(n,!n.enabled),"aria-label":n.enabled?j(`sessions.scheduledTasks.dialog.taskToggle.pauseAria`,{taskName:n.name}):j(`sessions.scheduledTasks.dialog.taskToggle.enableAria`,{taskName:n.name}),children:(0,q.jsx)(C,{name:n.enabled?`pause`:`play`,className:`size-4`})}):null,(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:x(`rounded-lg`,I?`size-11`:`size-8`),onClick:()=>r(!1),"aria-label":j(`sessions.scheduledTasks.editor.actions.cancel`),children:(0,q.jsx)(C,{name:I?`arrow-left`:`close`,className:`size-4`})})]})]}),(0,q.jsx)(`h2`,{id:`scheduled-task-panel-title`,className:`sr-only`,children:Lt}),(0,q.jsx)(pe,{value:V.name,onChange:e=>U(t=>({...t,name:e.target.value})),placeholder:j(`sessions.scheduledTasks.editor.taskName.placeholder`),"aria-label":j(`sessions.scheduledTasks.editor.taskName.label`),maxLength:80,required:!0,"aria-invalid":!V.name.trim(),className:`yuri-scheduled-task-title mt-1 !h-9 !min-h-9 border-0 bg-transparent px-0 text-lg font-semibold shadow-none ring-0 hover:!bg-transparent focus:!bg-transparent focus:ring-0`})]}),(0,q.jsx)(T,{className:`min-h-0 flex-1 overflow-auto [scrollbar-gutter:stable]`,size:64,hideTopShadow:!0,children:(0,q.jsx)(`div`,{className:`px-6 pb-6 pt-2`,children:zt})}),(0,q.jsx)(`footer`,{className:`shrink-0 border-t border-border/50 bg-background/95 px-6 py-3 backdrop-blur-sm`,children:Bt})]}):null:a===`mobile-panel`?t?(0,q.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"aria-label":Lt,children:[(0,q.jsx)(T,{className:`min-h-0 flex-1 overflow-y-auto overflow-x-hidden`,size:48,hideTopShadow:!0,children:(0,q.jsx)(`div`,{className:`w-full px-3 pb-6 pt-4`,children:zt})}),(0,q.jsx)(`footer`,{className:`shrink-0 border-t border-border/50 bg-background/95 px-3 py-2 backdrop-blur-sm`,children:Bt})]}):null:a===`mobile-tab`?t?(0,q.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":Lt,children:[(0,q.jsx)(L,{sticky:!0,title:Lt,backAriaLabel:j(`header.actions.backAria`),onBack:()=>r(!1),backDisabled:Ce,trailing:[(0,q.jsx)(_,{type:`button`,size:`mobileIcon`,onClick:Pt,disabled:Ce,"aria-label":j(Ce?`sessions.scheduledTasks.editor.actions.saving`:n?`sessions.scheduledTasks.editor.actions.save`:`sessions.scheduledTasks.dialog.actions.create`),"aria-busy":Ce,children:(0,q.jsx)(C,{name:Ce?`loader-4`:`check`,className:x(`size-5`,Ce&&`animate-spin motion-reduce:animate-none`)})},`save`),Ht?(0,q.jsx)(G.Fragment,{children:Ht},`more`):null]}),(0,q.jsxs)(`div`,{className:`yuri-mobile-scheduled-editor-body min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-[var(--yuri-mobile-page-inline-inset)] pt-4`,children:[(0,q.jsxs)(`div`,{className:`mb-5 flex items-center gap-4`,children:[(0,q.jsx)(pe,{value:V.name,onChange:e=>U(t=>({...t,name:e.target.value})),placeholder:j(`sessions.scheduledTasks.editor.taskName.placeholder`),"aria-label":j(`sessions.scheduledTasks.editor.taskName.label`),maxLength:80,required:!0,"aria-invalid":!V.name.trim(),className:`yuri-scheduled-task-title yuri-mobile-detail-editor-title min-w-0 flex-1 !h-auto min-h-0 border-0 bg-transparent px-0 py-0 text-xl font-semibold shadow-none ring-0 hover:!bg-transparent focus:!bg-transparent focus:ring-0`}),(0,q.jsx)(Oe,{checked:V.enabled,onCheckedChange:e=>U(t=>({...t,enabled:e})),disabled:Ce,"aria-label":j(`sessions.scheduledTasks.editor.enabled.aria`)})]}),zt]})]}):null:I?(0,q.jsx)(ve,{open:t,title:Lt,onClose:()=>r(!1),contentMaxHeightClassName:`max-h-[min(80vh,640px)]`,renderHeader:e=>(0,q.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-border/40 px-3 py-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:Lt}),e]}),(0,q.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:Rt})]}),footer:Bt,children:zt}):(0,q.jsx)(k,{open:t,onOpenChange:e=>{!e&&It()||r(e)},children:(0,q.jsxs)(re,{"aria-describedby":Ft,className:`!max-w-[720px] w-[90vw] h-[680px] max-h-[85vh] gap-0 p-0 overflow-hidden`,children:[(0,q.jsx)(ae,{id:Ft,className:`sr-only`,children:Rt}),(0,q.jsx)(`header`,{className:`shrink-0 px-4 sm:px-6 pt-5 pb-3`,children:(0,q.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,q.jsx)(ie,{className:`typography-ui-label font-medium text-foreground`,children:Lt}),(0,q.jsx)(`p`,{className:`typography-meta mt-0.5 text-muted-foreground`,children:Rt})]})}),(0,q.jsx)(T,{className:`flex-1 min-h-0 overflow-auto [scrollbar-gutter:stable_both-edges]`,size:64,hideTopShadow:!0,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-2xl px-4 sm:px-6 pb-5`,children:zt})}),(0,q.jsx)(`div`,{className:`shrink-0 px-4 sm:px-6 py-3`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-2xl`,children:Bt})})]})})}function pt(e){return $(e,{min:0,max:23})}function mt(e,t){return $(String(Number.parseInt(e,10)+t),{min:0,max:23,loop:!0})}function ht(e,t){let n=Number(e),r=Number(t),i=Number.isFinite(n)?Math.min(23,Math.max(0,n)):0,a=Number.isFinite(r)?Math.min(59,Math.max(0,r)):0;return`${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}var gt=e=>{if(!e.enabled)return null;let t=Ae(e.assistants).pinned[0]??e.assistants[0];return t?{id:t.id,name:t.name,seed:t.avatarSeed??t.id}:null};function _t(e){let t=(0,Ne.c)(20),{assistant:n}=e,{t:r}=te(),[i,a]=G.useState(!0),o=i?`true`:`false`,s;t[0]!==n.name||t[1]!==r?(s=r(`sessions.scheduledTasks.assistant.openAria`,{name:n.name}),t[0]=n.name,t[1]=r,t[2]=s):s=t[2];let c;t[3]===n.id?c=t[4]:(c=()=>h.getState().openAssistant(n.id),t[3]=n.id,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{e.target===e.currentTarget&&e.animationName===`yuri-schedule-assistant-clip`&&a(!1)},t[5]=l):l=t[5];let u;t[6]!==n.id||t[7]!==n.seed||t[8]!==i?(u=(0,q.jsx)(`span`,{className:`yuri-mobile-schedule-assistant-face`,"aria-hidden":`true`,children:(0,q.jsx)(I,{seed:n.seed,size:40,motion:`idle`,animateIdle:i,followPointer:!1,animationKey:n.id,blinkOnMount:2})}),t[6]=n.id,t[7]=n.seed,t[8]=i,t[9]=u):u=t[9];let d;t[10]===r?d=t[11]:(d=r(`sessions.scheduledTasks.assistant.offer`),t[10]=r,t[11]=d);let f;t[12]===d?f=t[13]:(f=(0,q.jsx)(`span`,{className:`yuri-mobile-schedule-assistant-label`,"aria-hidden":`true`,children:d}),t[12]=d,t[13]=f);let p;return t[14]!==o||t[15]!==s||t[16]!==c||t[17]!==u||t[18]!==f?(p=(0,q.jsx)(`span`,{className:`yuri-mobile-schedule-assistant-anchor`,children:(0,q.jsxs)(_,{type:`button`,variant:`ghost`,size:`mobileIcon`,className:`yuri-mobile-schedule-assistant`,"data-visiting":o,"aria-label":s,onClick:c,onAnimationEnd:l,children:[u,f]})}),t[14]=o,t[15]=s,t[16]=c,t[17]=u,t[18]=f,t[19]=p):p=t[19],p}function vt(){let e=(0,Ne.c)(2),{data:t}=F(gt),n;return e[0]===t?n=e[1]:(n=t?(0,q.jsx)(_t,{assistant:t},t.id):null,e[0]=t,e[1]=n),n}var yt=G.memo(function(e){let t=(0,Ne.c)(3),{active:n}=e,r=h(bt),i;return t[0]!==n||t[1]!==r?(i=n&&r?(0,q.jsx)(vt,{}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i});function bt(e){return e.activeTab===`scheduled`&&e.secondary===null}var xt=e({ScheduledTasksDialog:()=>Pt,ScheduledTasksWorkspace:()=>zt}),St=e=>{let t=(Array.isArray(e.schedule.times)?e.schedule.times:e.schedule.time?[e.schedule.time]:[]).filter(e=>typeof e==`string`&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(e));return Array.from(new Set(t)).sort((e,t)=>e.localeCompare(t))},Ct=(e,t,n=!0)=>{let r=St(e).join(`, `)||`--:--`,i=e=>t(e===0?`sessions.scheduledTasks.dialog.schedule.weekdayShort.sun`:e===1?`sessions.scheduledTasks.dialog.schedule.weekdayShort.mon`:e===2?`sessions.scheduledTasks.dialog.schedule.weekdayShort.tue`:e===3?`sessions.scheduledTasks.dialog.schedule.weekdayShort.wed`:e===4?`sessions.scheduledTasks.dialog.schedule.weekdayShort.thu`:e===5?`sessions.scheduledTasks.dialog.schedule.weekdayShort.fri`:e===6?`sessions.scheduledTasks.dialog.schedule.weekdayShort.sat`:`sessions.scheduledTasks.dialog.schedule.weekdayShort.unknown`);if(e.schedule.kind===`daily`)return n&&e.schedule.timezone?t(`sessions.scheduledTasks.dialog.schedule.dailyWithTimezone`,{time:r,timezone:e.schedule.timezone}):t(`sessions.scheduledTasks.dialog.schedule.daily`,{time:r});if(e.schedule.kind===`weekly`){let a=Array.isArray(e.schedule.weekdays)?e.schedule.weekdays.map(e=>i(e)).join(`, `):``;return n&&e.schedule.timezone?t(`sessions.scheduledTasks.dialog.schedule.weeklyWithTimezone`,{days:a,time:r,timezone:e.schedule.timezone}):t(`sessions.scheduledTasks.dialog.schedule.weekly`,{days:a,time:r})}if(e.schedule.kind===`once`){let r=typeof e.schedule.date==`string`&&e.schedule.date.trim().length>0?e.schedule.date:t(`sessions.scheduledTasks.dialog.schedule.unknownDate`),i=typeof e.schedule.time==`string`&&e.schedule.time.trim().length>0?e.schedule.time:`--:--`;return n&&e.schedule.timezone?t(`sessions.scheduledTasks.dialog.schedule.onceWithTimezone`,{date:r,time:i,timezone:e.schedule.timezone}):t(`sessions.scheduledTasks.dialog.schedule.once`,{date:r,time:i})}return n&&e.schedule.timezone?t(`sessions.scheduledTasks.dialog.schedule.cronWithTimezone`,{cron:e.schedule.cron||``,timezone:e.schedule.timezone}):t(`sessions.scheduledTasks.dialog.schedule.cron`,{cron:e.schedule.cron||``})},wt=(e,t)=>{if(!e||!Number.isFinite(e))return``;let n=e-Date.now(),r=Math.abs(n),i=6e4,a=60*i,o=24*a,s=n>=0;if(r<i)return t(s?`sessions.scheduledTasks.dialog.relativeTime.inLessThanOneMinute`:`sessions.scheduledTasks.dialog.relativeTime.justNow`);if(r<a){let e=Math.round(r/i);return t(s?`sessions.scheduledTasks.dialog.relativeTime.inMinutes`:`sessions.scheduledTasks.dialog.relativeTime.minutesAgo`,{count:e})}if(r<o){let e=Math.floor(r/a),n=Math.round(r%a/i),o=n>0?`${e}h ${n}m`:`${e}h`;return t(s?`sessions.scheduledTasks.dialog.relativeTime.inDuration`:`sessions.scheduledTasks.dialog.relativeTime.durationAgo`,{duration:o})}let c=Math.floor(r/o),l=Math.round(r%o/a),u=l>0?`${c}d ${l}h`:`${c}d`;return t(s?`sessions.scheduledTasks.dialog.relativeTime.inDuration`:`sessions.scheduledTasks.dialog.relativeTime.durationAgo`,{duration:u})},Tt=e=>new Intl.DateTimeFormat(w(),{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)),Et=(e,t)=>{if(e.status===`running`)return Math.max(0,t-e.startedAt);if(typeof e.finishedAt==`number`&&Number.isFinite(e.finishedAt)){let t=Math.max(0,e.finishedAt-e.startedAt);return typeof e.durationMs==`number`&&Number.isFinite(e.durationMs)&&e.durationMs>=0?Math.max(e.durationMs,t):t}return typeof e.durationMs==`number`&&Number.isFinite(e.durationMs)&&e.durationMs>=0?e.durationMs:null},Dt=e=>{if(e===null||!Number.isFinite(e)||e<0)return null;if(e<1e3)return`<1s`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r>0?`${n}m ${r}s`:`${n}m`;let i=Math.floor(n/60),a=n%60;return a>0?`${i}h ${a}m`:`${i}h`},Ot={success:{tone:`success`,Icon:`checkbox-circle`},error:{tone:`error`,Icon:`error-warning`},running:{tone:`warning`,Icon:`loader-4`,spin:!0},idle:{tone:`muted`,Icon:`pulse`}},kt=e=>e===`muted`?{}:{color:`var(--status-${e})`,backgroundColor:`var(--status-${e}-background)`,borderColor:`var(--status-${e}-border)`},At=({projectId:e,taskId:t})=>`${e}:${t}`,jt=null,Mt=()=>jt?jt():(m.getState().setScheduledTasksDialogOpen(!1),!0),Nt=(e,t,n)=>({tasks:[...e?.tasks.filter(e=>e.projectId!==t)??[],...n.map(e=>({projectId:t,task:e}))],failedProjectIds:e?.failedProjectIds.filter(e=>e!==t)??[]});function Pt(){let e=(0,Ne.c)(18),{t}=te(),n=m(Rt),r=m(Lt);if(!m(It))return null;let i;e[0]===t?i=e[1]:(i=t(`sessions.scheduledTasks.dialog.title`),e[0]=t,e[1]=i);let a;e[2]===t?a=e[3]:(a=t(`sessions.scheduledTasks.dialog.title`),e[2]=t,e[3]=a);let o;e[4]===t?o=e[5]:(o=t(`mobile.surface.closeAria`),e[4]=t,e[5]=o);let s;e[6]===t?s=e[7]:(s=t(`mobile.sessions.sheet.resizeAria`),e[6]=t,e[7]=s);let c;e[8]!==n||e[9]!==r?(c=(0,q.jsx)(zt,{presentation:`mobile-panel`,open:n,onOpenChange:r}),e[8]=n,e[9]=r,e[10]=c):c=e[10];let l;return e[11]!==n||e[12]!==i||e[13]!==a||e[14]!==o||e[15]!==s||e[16]!==c?(l=(0,q.jsx)(E,{id:`scheduled-tasks`,open:n,initiallyExpanded:!0,title:i,ariaLabel:a,closeAriaLabel:o,resizeAriaLabel:s,onOpenChange:Ft,children:c}),e[11]=n,e[12]=i,e[13]=a,e[14]=o,e[15]=s,e[16]=c,e[17]=l):l=e[17],l}function Ft(e){e||Mt()}function It(e){return e.isMobile}function Lt(e){return e.setScheduledTasksDialogOpen}function Rt(e){return e.isScheduledTasksDialogOpen}function zt({presentation:e=`workspace`,open:t=!0,onOpenChange:r,registerEditorBackHandler:i,onEditorActiveChange:a}={}){let{t:h}=te(),v=l.runtime()[0],b=G.useMemo(()=>[v,`scheduled-tasks`],[v]),w=G.useMemo(()=>[v,`scheduled-task-runs`],[v]),T=O(),E=m(e=>e.isMobile),re=m(e=>e.scheduledTaskOpenRequest),ie=m(e=>e.isScheduledTasksDialogOpen),ae=m(e=>e.setMainTabGuard),k=g(e=>e.projects),de=g(e=>e.getActiveProject())?.id||k[0]?.id||``,[F,I]=G.useState(de),[L,R]=G.useState(()=>{if(E&&e!==`mobile-panel`)return null;let t=Te();return t.scheduleProjectId&&t.scheduleTaskId?{projectId:t.scheduleProjectId,taskId:t.scheduleTaskId}:null}),[z,B]=G.useState(()=>L?`edit`:`closed`),[_e,ve]=G.useState(`all`),[H,ye]=G.useState(()=>Te().scheduleView===`history`?`history`:`tasks`),[be,xe]=G.useState(``),[Se,Oe]=G.useState(!1),Ae=G.useRef(!1),W=p(e=>{Ae.current=e,Oe(e)}),[je,Me]=G.useState(null),[Ne,Pe]=G.useState(null),[Fe,Ie]=G.useState(null),[K,Le]=G.useState(null),Re=G.useRef(null),[ze,Be]=G.useState(null),Ve=G.useRef(null),He=G.useRef(null),J=e===`mobile-tab`,Y=e===`mobile-panel`||J,Ue=p(e=>{Be(J?e?.closest(`[role="tabpanel"]`)??null:e)});G.useEffect(()=>{if(J)return a?.(z!==`closed`),()=>a?.(!1)},[z,J,a]),G.useEffect(()=>{if(!t)return;let n=t=>{let n=Te();if(n.tab===`schedule`){if(E&&e!==`mobile-panel`&&n.scheduleTaskId){R(null),B(`closed`),W(!1);return}let t=n.scheduleView===`history`?`history`:`tasks`;ye(e=>e===t?e:t);let r=n.scheduleProjectId&&n.scheduleTaskId?{projectId:n.scheduleProjectId,taskId:n.scheduleTaskId}:null;R(r),B(r?`edit`:`closed`),W(!1)}else t&&e===`mobile-panel`&&r?.(!1)};return n(),window.addEventListener(`popstate`,n),()=>window.removeEventListener(`popstate`,n)},[t,E,e,r,W]),G.useEffect(()=>{!t||!re||E&&e!==`mobile-panel`&&ie||(R(re),B(`edit`),ye(`tasks`),W(!1),m.getState().setScheduledTaskOpenRequest(null))},[t,re,E,e,ie,W]),G.useEffect(()=>{k.some(e=>e.id===F)||I(de)},[F,de,k]);let X=s({queryKey:b,enabled:t,refetchOnMount:`always`,queryFn:P,select:e=>({...e,tasks:[...e.tasks].sort((e,t)=>e.task.enabled===t.task.enabled?e.task.name.localeCompare(t.task.name):e.task.enabled?-1:1)})}),We=G.useMemo(()=>X.data?.tasks??[],[X.data]),Ge=X.data?.failedProjectIds??[],Z=G.useMemo(()=>L?We.find(({projectId:e,task:t})=>e===L.projectId&&t.id===L.taskId)??null:null,[L,We]),Ke=Z?.task??null,Q=c({queryKey:[...w,K?.projectId??``,K?.taskId??``],enabled:t&&H===`history`,initialPageParam:void 0,queryFn:({pageParam:e,signal:t})=>N({before:e,limit:20,...K?{projectId:K.projectId,taskId:K.taskId}:{}},t),getNextPageParam:e=>e.complete?void 0:e.nextCursor??void 0,refetchOnMount:`always`}),qe=t&&H===`history`&&z===`closed`&&!!ze&&Q.hasNextPage&&!Q.isFetching&&!Q.error;f(qe?Re:null,p(e=>{qe&&e.some(e=>e.isIntersecting)&&Q.fetchNextPage({cancelRefetch:!1})}),{root:ze,rootMargin:`0px 0px 240px 0px`});let $=G.useMemo(()=>{let e=new Set,t=[];for(let n of Q.data?.pages??[])for(let r of n.runs)e.has(r.id)||(e.add(r.id),t.push(r));return t},[Q.data]),Je=G.useMemo(()=>$.some(e=>e.status===`running`),[$]),Ye=G.useMemo(()=>{if(!K)return null;let e=We.find(({projectId:e,task:t})=>e===K.projectId&&t.id===K.taskId);return e?.task.name?e.task.name:$.find(e=>e.projectId===K.projectId&&e.taskId===K.taskId)?.taskName||K.taskId},[K,$,We]),[Xe,Ze]=G.useState(()=>Date.now());G.useEffect(()=>{if(!t||H!==`history`||!Je)return;Ze(Date.now());let e=window.setInterval(()=>Ze(Date.now()),1e3);return()=>window.clearInterval(e)},[Je,t,H]);let Qe=G.useMemo(()=>new Map(k.map(e=>[e.id,e])),[k]);G.useEffect(()=>{let e=null,t=u(t=>{(t.type===`scheduled-task-ran`||t.type===`event-stream-ready`)&&(e&&clearTimeout(e),e=setTimeout(()=>{d.invalidateQueries({queryKey:b,exact:!0}),d.invalidateQueries({queryKey:w})},400))});return()=>{e&&clearTimeout(e),t()}},[b,w]);let $e=o({mutationFn:({projectID:e,taskDraft:t})=>ge(e,t),onSuccess:(e,{projectID:t})=>{d.setQueryData(b,n=>Nt(n,t,e))}}),et=o({mutationFn:({projectID:e,taskID:t})=>he(e,t),onSuccess:(e,{projectID:t})=>{d.setQueryData(b,n=>Nt(n,t,e))}}),tt=o({mutationFn:({projectID:e,taskID:t})=>me(e,t),onSuccess:()=>{d.invalidateQueries({queryKey:b,exact:!0}),d.invalidateQueries({queryKey:w})}}),nt=o({mutationFn:({projectID:e,task:t})=>ge(e,t),onMutate:({projectID:e,task:t})=>{let n=d.getQueryData(b);return d.setQueryData(b,n=>n&&{...n,tasks:n.tasks.map(n=>n.projectId===e&&n.task.id===t.id?{projectId:e,task:t}:n)}),{previousTasks:n}},onSuccess:(e,{projectID:t})=>{d.setQueryData(b,n=>Nt(n,t,e))},onError:(e,t,n)=>{n?.previousTasks&&d.setQueryData(b,n.previousTasks)}}),rt=p(()=>!Ae.current||window.confirm(h(`sessions.scheduledTasks.workspace.confirm.discardChanges`)));G.useEffect(()=>{if(!Se){ae(null);return}let e=e=>e===`schedule`||window.confirm(h(`sessions.scheduledTasks.workspace.confirm.discardChanges`));return ae(e),()=>{m.getState().mainTabGuard===e&&ae(null)}},[Se,ae,h]);let it=p(t=>{let n={projectId:t.projectId,taskId:t.task.id};if((At(n)!==(L?At(L):``)||z!==`edit`)&&rt()){if(E&&e!==`mobile-panel`){De(n.projectId,n.taskId);return}R(n),B(`edit`),W(!1),ot(`tasks`,n)}}),at=p(()=>{!F||!rt()||(R(null),B(`create`),W(!1),ot(`tasks`,null))}),ot=p((e,t)=>{let n=m.getState();Ee({sessionId:null,tab:`schedule`,isSettingsOpen:n.isSettingsDialogOpen,settingsPath:n.settingsPage,diffFile:null,scheduleView:e,scheduleProjectId:t?.projectId??null,scheduleTaskId:t?.taskId??null})}),st=p(e=>{H!==e&&(z!==`closed`&&!rt()||(R(null),B(`closed`),W(!1),Le(null),ye(e),ot(e,null)))}),ct=p((t,i)=>{e===`mobile-panel`&&t&&i&&r?.(!1),ee(t,i,{phoneShell:!!(Y&&!n()),switchToChat:!0})}),lt=p(e=>{ct(e.sessionId,e.directory)}),ut=p(e=>{z!==`closed`&&!rt()||(R(null),B(`closed`),W(!1),Le({projectId:e.projectId,taskId:e.task.id}),ye(`history`),ot(`history`,null))}),dt=p(()=>{Le(null)}),pt=p(()=>{Z&&ut(Z)}),mt=p(async()=>{if(Q.data&&Q.hasNextPage){await Q.fetchNextPage();return}await Q.refetch()}),ht=p(e=>{e||!rt()||(R(null),B(`closed`),W(!1),ot(`tasks`,null))}),gt=p(()=>e===`mobile-panel`?!rt()||(R(null),B(`closed`),W(!1),ot(`tasks`,null),r?.(!1),!0):z===`closed`?(r?.(!1),!0):(ht(!1),!0));G.useEffect(()=>{if(e!==`mobile-panel`||!t)return;jt=gt;let n=()=>gt();return window.addEventListener(`yuri:scheduled-tasks-close-request`,n),()=>{jt===gt&&(jt=null),window.removeEventListener(`yuri:scheduled-tasks-close-request`,n)}},[e,t]);let _t=p(()=>z!==`closed`&&(ht(!1),!0));fe({id:`mobile-scheduled-editor`,active:J&&z!==`closed`,onBack:_t,surfaceRef:Ve,underlayRef:He}),G.useEffect(()=>{if(i)return i(_t),()=>i(null)},[i]);let vt=p(async e=>{let t=L?.projectId||F;if(!t)throw Error(h(`sessions.scheduledTasks.dialog.error.chooseProjectFirst`));let n=new Set(We.filter(e=>e.projectId===t).map(e=>e.task.id)),r=await $e.mutateAsync({projectID:t,taskDraft:e}),i=e.id?r.find(t=>t.id===e.id):r.find(e=>!n.has(e.id)),a=[...r].filter(t=>t.name===e.name).sort((e,t)=>(t.state?.updatedAt||0)-(e.state?.updatedAt||0))[0],o=i||a;return o&&(R({projectId:t,taskId:o.id}),B(`edit`),ot(`tasks`,{projectId:t,taskId:o.id})),W(!1),S.success(h(`sessions.scheduledTasks.dialog.toast.saved`)),o}),bt=p(async e=>{let{projectId:t,task:n}=e;if(window.confirm(h(`sessions.scheduledTasks.dialog.confirm.deleteTask`,{taskName:n.name}))){Me(At({projectId:t,taskId:n.id}));try{await et.mutateAsync({projectID:t,taskID:n.id});let e=At({projectId:t,taskId:n.id});L&&At(L)===e&&(R(null),B(`closed`),W(!1),ot(`tasks`,null)),S.success(h(`sessions.scheduledTasks.dialog.toast.deleted`))}catch(e){S.error(e instanceof Error?e.message:h(`sessions.scheduledTasks.dialog.toast.deleteFailed`))}finally{Me(null)}}}),xt=p(async({projectId:e,task:t})=>{Me(At({projectId:e,taskId:t.id}));try{await tt.mutateAsync({projectID:e,taskID:t.id}),S.success(h(`sessions.scheduledTasks.dialog.toast.started`))}catch(e){S.error(e instanceof Error?e.message:h(`sessions.scheduledTasks.dialog.toast.runFailed`))}finally{Me(null)}}),St=p(async({projectId:e,task:t},n)=>{Me(At({projectId:e,taskId:t.id}));try{await nt.mutateAsync({projectID:e,task:{...t,enabled:n}})}catch(e){S.error(e instanceof Error?e.message:h(`sessions.scheduledTasks.dialog.toast.updateFailed`))}finally{Me(null)}}),Mt=G.useMemo(()=>{let e=be.trim().toLocaleLowerCase();return We.filter(({task:t})=>_e===`active`&&!t.enabled||_e===`paused`&&t.enabled?!1:!e||t.name.toLocaleLowerCase().includes(e)||Ct(t,h).toLocaleLowerCase().includes(e))},[_e,be,h,We]),Pt=e=>{let t=e.icon?Ce[e.icon]:null,n=e.color?we[e.color]:void 0,r=(0,q.jsx)(C,{name:t??`folder`,className:`size-3.5`,style:n?{color:n}:void 0});return(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`relative top-px flex size-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,children:e.iconImage?(0,q.jsx)(U,{project:e,className:`size-full object-contain`,fallback:r}):r}),(0,q.jsx)(`span`,{className:`truncate`,children:y(e.path)})]})},Ft=k.map(e=>({id:e.id,label:Pt(e)}));return(0,q.jsxs)(`div`,{className:x(`relative flex min-h-0`,J?`yuri-mobile-scheduled-workspace w-full flex-col overflow-visible bg-transparent`:`h-full overflow-hidden bg-background`,Y&&`flex-col`),"data-presentation":e,children:[(0,q.jsxs)(`div`,{ref:J?He:void 0,"data-mobile-navigation-underlay":J?`true`:void 0,"aria-hidden":J&&z!==`closed`?!0:void 0,inert:J&&z!==`closed`?!0:void 0,className:x(J?`flex w-full min-w-0 flex-col gap-[var(--yuri-mobile-page-gap)]`:`contents`),children:[J?(0,q.jsx)(ke,{title:h(`sessions.scheduledTasks.dialog.title`),trailing:(0,q.jsx)(yt,{active:z===`closed`})}):null,Y&&!J?(0,q.jsx)(ne,{children:z===`edit`&&Z?(0,q.jsxs)(ce,{children:[(0,q.jsx)(oe,{asChild:!0,children:(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 shrink-0 rounded-lg`,disabled:!!je,"aria-label":h(`sessions.scheduledTasks.dialog.actions.moreAria`,{taskName:Z.task.name}),children:(0,q.jsx)(C,{name:`more-2`,className:`size-5`})})}),(0,q.jsxs)(se,{align:`end`,className:`min-w-40`,children:[(0,q.jsxs)(A,{className:`min-h-11`,onSelect:()=>void xt(Z),children:[(0,q.jsx)(C,{name:`play`,className:`size-4`}),h(`sessions.scheduledTasks.dialog.actions.runNow`)]}),(0,q.jsxs)(A,{className:`min-h-11`,onSelect:()=>ut(Z),children:[(0,q.jsx)(C,{name:`history`,className:`size-4`}),h(`sessions.scheduledTasks.workspace.views.history`)]}),(0,q.jsxs)(A,{className:`min-h-11`,onSelect:()=>void St(Z,!Z.task.enabled),children:[(0,q.jsx)(C,{name:Z.task.enabled?`pause`:`play`,className:`size-4`}),Z.task.enabled?h(`sessions.scheduledTasks.dialog.actions.pause`):h(`sessions.scheduledTasks.dialog.actions.resume`)]}),(0,q.jsxs)(A,{variant:`destructive`,className:`min-h-11`,onSelect:()=>void bt(Z),children:[(0,q.jsx)(C,{name:`delete-bin`,className:`size-4`}),h(`sessions.scheduledTasks.dialog.actions.delete`)]})]})]}):null}):null,(0,q.jsxs)(`section`,{className:x(`min-w-0 flex-col transition-[width] duration-300 ease-out`,J?`flex-none overflow-visible`:`flex-1 overflow-hidden`,Y&&!J&&z!==`closed`?`hidden`:`flex`),children:[(0,q.jsx)(`header`,{className:x(`shrink-0`,J?`pb-0 pt-0`:Y?`px-3 pb-3 pt-3`:`px-4 pb-5 pt-4 sm:px-6`),children:(0,q.jsxs)(`div`,{className:x(`mx-auto w-full`,J?`max-w-[26rem]`:`max-w-4xl`),children:[(0,q.jsx)(`div`,{className:x((H===`tasks`||K||!J)&&`mb-3`,J?`yuri-mobile-floating-surface yuri-mobile-segmented-track`:`grid grid-cols-2 gap-1 rounded-xl bg-[var(--surface-muted)] p-1`),role:`tablist`,"aria-label":h(`sessions.scheduledTasks.workspace.views.aria`),children:[`tasks`,`history`].map(e=>(0,q.jsxs)(_,{type:`button`,variant:`ghost`,size:`sm`,role:`tab`,"aria-selected":H===e,className:x(J?`yuri-mobile-segmented-item`:`relative min-h-9 rounded-lg text-muted-foreground transition-[background-color,color,box-shadow] motion-reduce:transition-none`,!J&&Y&&`min-h-11`,!J&&(H===e?`text-foreground hover:bg-transparent hover:text-foreground`:`hover:bg-interactive-hover/40 hover:text-foreground`)),onClick:()=>st(e),children:[H===e?(0,q.jsx)(V.span,{layoutId:`scheduled-workspace-view-pill`,className:x(`yuri-segmented-selected-pill absolute inset-0`,!J&&`rounded-lg`),transition:{duration:T?0:.18,ease:[.22,1,.36,1]},"aria-hidden":`true`}):null,(0,q.jsxs)(`span`,{className:`relative z-[1] inline-flex items-center gap-1.5`,children:[(0,q.jsx)(C,{name:e===`tasks`?`calendar-schedule`:`history`,className:`size-4 shrink-0`}),h(`sessions.scheduledTasks.workspace.views.${e}`)]})]},e))}),H===`history`&&Ye?(0,q.jsx)(`div`,{className:x(`flex min-w-0 items-center`,J?`mt-[var(--yuri-mobile-page-gap)]`:`mt-3`),role:`status`,"aria-label":h(`sessions.scheduledTasks.history.filter.aria`,{name:Ye}),children:(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-border/60 bg-[var(--surface-elevated)] py-1 pl-3 pr-1`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate typography-meta text-foreground`,children:Ye}),(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:x(`shrink-0 rounded-full`,Y?`size-8`:`size-7`),onClick:dt,"aria-label":h(`sessions.scheduledTasks.history.filter.clearAria`),children:(0,q.jsx)(C,{name:`close`,className:`size-3.5`})})]})}):null,H===`tasks`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:x(J?`yuri-mobile-floating-surface yuri-mobile-segmented-track yuri-mobile-scheduled-controls`:x(`flex items-center justify-between`,Y?`gap-2`:`gap-3`)),children:[(0,q.jsx)(`div`,{className:x(J?`yuri-mobile-segmented-group`:x(`flex items-center gap-1`,Y&&`min-w-0 flex-1`)),role:`group`,"aria-label":h(`sessions.scheduledTasks.dialog.title`),children:[`all`,`active`,`paused`].map(e=>(0,q.jsxs)(_,{type:`button`,variant:`ghost`,size:`sm`,className:x(J?`yuri-mobile-segmented-item`:`relative border-0 bg-transparent text-muted-foreground shadow-none transition-[color,background-color] duration-150 ease-out motion-reduce:transition-none`,!J&&(Y?`h-11 min-h-11 min-w-0 flex-1 rounded-xl px-2`:`!h-9 !min-h-9 rounded-xl px-3`),!J&&(_e===e?`text-foreground hover:bg-transparent hover:text-foreground`:`hover:bg-interactive-hover/40 hover:text-foreground`)),"aria-pressed":_e===e,onClick:()=>ve(e),children:[_e===e?(0,q.jsx)(V.span,{layoutId:`scheduled-task-filter-pill`,className:x(`yuri-segmented-selected-pill absolute inset-0`,!J&&`rounded-xl`),transition:{duration:T?0:.18,ease:[.22,1,.36,1]},"aria-hidden":`true`}):null,(0,q.jsx)(`span`,{className:`relative z-[1]`,children:h(`sessions.scheduledTasks.workspace.filters.${e}`)})]},e))}),J?(0,q.jsx)(_,{variant:`mobileGlass`,size:`mobileIcon`,"data-mobile-press-feedback":`compact`,className:`yuri-mobile-segmented-action yuri-mobile-inverse-action shrink-0`,onClick:at,disabled:!F,"aria-label":h(`sessions.scheduledTasks.dialog.actions.create`),children:(0,q.jsx)(C,{name:`add`,className:`size-5`})}):(0,q.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,q.jsxs)(_,{variant:`ghost`,"data-mobile-press-feedback":Y?`compact`:void 0,className:x(`shrink-0 rounded-full bg-foreground text-background transition-[background-color,box-shadow] duration-150 ease-out hover:bg-foreground/90 hover:text-background hover:shadow-sm active:bg-interactive-active motion-reduce:transition-none`,Y?`size-11 min-h-11 px-0 min-[400px]:w-auto min-[400px]:px-3.5`:`!h-9 !min-h-9 px-3.5`),onClick:at,disabled:!F,"aria-label":h(`sessions.scheduledTasks.dialog.actions.create`),children:[(0,q.jsx)(C,{name:`add`,className:`h-4 w-4`}),` `,(0,q.jsx)(`span`,{className:x(Y&&`hidden min-[400px]:inline`),children:h(`sessions.scheduledTasks.dialog.actions.create`)})]})})]}),J?null:(0,q.jsxs)(`div`,{className:x(`group relative w-full`,Y?`mt-3`:`mt-7`),children:[(0,q.jsx)(C,{name:`search`,className:`pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-[color,transform] duration-150 ease-out group-focus-within:scale-105 group-focus-within:text-foreground motion-reduce:transition-none`}),(0,q.jsx)(pe,{value:be,onChange:e=>xe(e.target.value),placeholder:h(`sessions.scheduledTasks.workspace.search.placeholder`),className:x(`rounded-full bg-[var(--surface-elevated)] pl-10 pr-4 ring-1 ring-inset ring-border/50 transition-[background-color,box-shadow,color] duration-200 ease-out hover:[&:not(:focus)]:ring-border focus:bg-[var(--surface-elevated)] focus:shadow-sm focus:ring-2 focus:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,Y?`h-11 min-h-11`:`!h-9 !min-h-9`)})]})]}):null]})}),(0,q.jsx)(`div`,{ref:Ue,className:x(J?`flex-none overflow-visible pt-[var(--yuri-mobile-page-gap)]`:`min-h-0 flex-1 overflow-y-auto`,!J&&(Y?`overscroll-none px-3 pb-[max(1rem,env(safe-area-inset-bottom))]`:`px-6 pb-6 [scrollbar-gutter:stable]`)),children:(0,q.jsx)(`div`,{className:x(`mx-auto w-full`,J?`max-w-[26rem]`:`max-w-4xl pt-4`),children:H===`history`?(0,q.jsxs)(`div`,{className:`space-y-3`,children:[Q.isLoading?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 typography-meta text-muted-foreground`,children:[(0,q.jsx)(C,{name:`loader-4`,className:`size-4 animate-spin motion-reduce:animate-none`}),h(`sessions.scheduledTasks.history.loading`)]}):Q.error&&$.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed border-border p-4`,children:(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(C,{name:`error-warning`,className:`mt-0.5 size-4 shrink-0 text-[var(--status-error)]`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`p`,{className:`typography-ui-label font-medium text-foreground`,children:h(`sessions.scheduledTasks.history.error.title`)}),(0,q.jsx)(`p`,{className:`mt-1 break-words typography-meta text-muted-foreground`,children:Q.error instanceof Error?Q.error.message:h(`sessions.scheduledTasks.history.error.description`)})]}),(0,q.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void mt(),children:h(`sessions.scheduledTasks.history.retry`)})]})}):$.length===0?(0,q.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border p-6 text-center`,children:[(0,q.jsx)(C,{name:`history`,className:`mx-auto size-5 text-muted-foreground`}),(0,q.jsx)(`p`,{className:`mt-2 typography-ui-label font-medium text-foreground`,children:h(`sessions.scheduledTasks.history.empty.title`)}),(0,q.jsx)(`p`,{className:`mt-1 typography-meta text-muted-foreground`,children:h(`sessions.scheduledTasks.history.empty.description`)})]}):(0,q.jsxs)(`div`,{className:x(J?`space-y-4`:Y?`space-y-2`:`divide-y divide-border/50 overflow-hidden rounded-xl border border-border/60 bg-[var(--surface-elevated)]`),children:[$.map(e=>{let t=Qe.get(e.projectId),n=t?y(t.path):e.projectId,r=e.directory?y(e.directory):null,i=r&&r!==n?`${n} · ${r}`:n,a=Ot[e.status],o=!!(e.sessionId&&e.directory),s=Dt(Et(e,Xe))??(e.status===`running`?h(`sessions.scheduledTasks.history.duration.pending`):null),c=Tt(e.startedAt),l=h(`sessions.scheduledTasks.history.trigger.${e.trigger}`),u=e.trigger===`manual`?`play`:`calendar-schedule`,d=h(`sessions.scheduledTasks.dialog.status.${e.status}`),f=a.tone===`muted`?void 0:{color:`var(--status-${a.tone})`},p=t?.icon?Ce[t.icon]??`folder`:`folder`,m=t?.color?we[t.color]:void 0,g=(0,q.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,children:t?.iconImage?(0,q.jsx)(U,{project:t,className:`size-full object-contain`,fallback:(0,q.jsx)(C,{name:p,className:`size-3.5`,style:m?{color:m}:void 0})}):(0,q.jsx)(C,{name:p,className:`size-3.5`,style:m?{color:m}:void 0})}),ee=(0,q.jsx)(`span`,{className:x(`mt-0.5 flex shrink-0 items-center justify-center rounded-full border`,Y?`size-7`:`size-8`),style:kt(a.tone),title:d,"aria-label":d,children:(0,q.jsx)(C,{name:a.Icon,className:x(Y?`size-3.5`:`size-4`,a.spin&&`animate-spin motion-reduce:animate-none`)})}),_=(0,q.jsxs)(`p`,{className:x(`mt-0.5 flex min-w-0 items-center gap-1.5 text-muted-foreground`,Y?`typography-micro`:`truncate typography-meta`),title:e.directory??n,children:[g,(0,q.jsx)(`span`,{className:x(`min-w-0`,Y?`break-words`:`truncate`),children:i})]}),v=(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[s?(0,q.jsx)(`span`,{className:`typography-micro tabular-nums text-muted-foreground`,title:s,children:s}):null,(0,q.jsx)(`span`,{className:`typography-micro font-medium`,style:f,children:d})]}),b=(0,q.jsxs)(`div`,{className:x(`flex w-full min-w-0 items-start`,Y?`gap-2.5`:`gap-3`),children:[ee,(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex w-full min-w-0 items-start justify-between gap-2`,children:[(0,q.jsx)(`h3`,{className:x(`min-w-0 flex-1 font-semibold text-foreground`,Y?`break-words typography-meta leading-snug`:`truncate typography-ui-label`),children:e.taskName}),v]}),_,(0,q.jsxs)(`div`,{className:x(`mt-1 flex w-full min-w-0 gap-2`,Y?`items-center`:`items-center justify-between gap-3`),children:[(0,q.jsxs)(`div`,{className:x(`flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 typography-micro text-muted-foreground`,Y&&`gap-x-2.5 gap-y-0.5`),children:[(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,title:c,children:[(0,q.jsx)(C,{name:`time`,className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`whitespace-nowrap tabular-nums`,children:c})]}),(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,title:l,children:[(0,q.jsx)(C,{name:u,className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`whitespace-nowrap`,children:l})]})]}),!Y&&o?(0,q.jsx)(`span`,{className:`shrink-0 self-center typography-ui-label font-medium text-foreground`,children:h(`sessions.scheduledTasks.history.openSession`)}):null]}),e.error?(0,q.jsxs)(`p`,{className:x(`mt-1.5 min-w-0 break-words typography-micro text-[var(--surface-muted-foreground)] [overflow-wrap:anywhere]`,Y?`line-clamp-3`:`line-clamp-1`),title:e.error.slice(0,300),children:[(0,q.jsx)(C,{name:`error-warning`,className:`mr-1 inline-block size-3 align-[-0.125em] text-[var(--status-error)]`,"aria-hidden":`true`}),e.error.slice(0,300)]}):null]})]});if(Y){let t=h(`sessions.scheduledTasks.history.openSession`),n=x(`yuri-mobile-scheduled-task-card w-full`,J?`yuri-mobile-floating-surface yuri-mobile-project-shell rounded-[var(--yuri-mobile-surface-radius)]`:`rounded-xl border border-border/60 bg-[var(--surface-elevated)] shadow-sm dark:shadow-none`);return o?(0,q.jsx)(`article`,{"data-mobile-press-surface":`soft`,className:n,children:(0,q.jsx)(`button`,{type:`button`,"data-mobile-press-surface-trigger":!0,className:x(`yuri-mobile-scheduled-task-row w-full p-3 text-left outline-none`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`),"aria-label":t,onClick:()=>lt(e),children:b})},e.id):(0,q.jsx)(`article`,{className:x(n,`p-3`),children:b},e.id)}return o?(0,q.jsx)(`article`,{className:`w-full min-w-0`,children:(0,q.jsx)(`button`,{type:`button`,className:`w-full min-w-0 px-4 py-3 text-left outline-none transition-colors hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,"aria-label":h(`sessions.scheduledTasks.history.openSession`),onClick:()=>lt(e),children:b})},e.id):(0,q.jsx)(`article`,{className:`w-full min-w-0 px-4 py-3`,children:b},e.id)}),Q.error?(0,q.jsxs)(`div`,{className:x(`flex flex-wrap items-center justify-between gap-2 p-3 typography-meta text-[var(--status-error-foreground)]`,Y?`rounded-xl border border-[var(--status-error-border)] bg-[var(--status-error-background)]`:`border-t border-[var(--status-error-border)] bg-[var(--status-error-background)]`),children:[(0,q.jsx)(`span`,{children:h(`sessions.scheduledTasks.history.error.more`)}),(0,q.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void mt(),children:h(`sessions.scheduledTasks.history.retry`)})]}):null]}),Q.hasNextPage?(0,q.jsx)(`div`,{ref:Re,className:`flex min-h-px justify-center`,children:Q.isFetchingNextPage?(0,q.jsx)(`span`,{role:`status`,"aria-label":h(`sessions.scheduledTasks.history.loadingMore`),className:`py-1 text-muted-foreground`,children:(0,q.jsx)(C,{name:`loader-4`,className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`})}):null}):null]}):(0,q.jsxs)(q.Fragment,{children:[Ge.length>0?(0,q.jsx)(`div`,{className:`mb-3 rounded-xl border p-3 typography-meta`,style:kt(`warning`),children:h(`sessions.scheduledTasks.workspace.partialLoadWarning`)}):null,X.isLoading?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 typography-meta text-muted-foreground`,children:[(0,q.jsx)(C,{name:`loader-4`,className:`h-4 w-4 animate-spin`}),` `,h(`sessions.scheduledTasks.dialog.loading`)]}):X.error&&!X.data?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed border-border p-4 typography-meta text-muted-foreground`,children:X.error instanceof Error?X.error.message:h(`sessions.scheduledTasks.dialog.toast.loadFailed`)}):(0,q.jsx)(D,{initial:!1,mode:`popLayout`,children:Mt.length===0?(0,q.jsx)(V.div,{initial:T?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:T?{opacity:0}:{opacity:0,y:-4},transition:{duration:T?0:.18,ease:[.22,1,.36,1]},className:`rounded-xl border border-dashed border-border p-4 typography-meta text-muted-foreground`,children:We.length>0?h(`sessions.scheduledTasks.workspace.search.noResults`):h(`sessions.scheduledTasks.dialog.empty.noTasks`)},`empty`):(0,q.jsx)(V.div,{initial:T?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:T?{opacity:0}:{opacity:0,y:-4},transition:{duration:T?0:.18,ease:[.22,1,.36,1]},className:x(J?`space-y-4`:`space-y-1`),children:(0,q.jsx)(D,{initial:!1,mode:`popLayout`,children:Mt.map(e=>{let{projectId:t,task:n}=e,r=At({projectId:t,taskId:n.id}),i=z===`edit`&&L!==null&&At(L)===r,a=n.state?.nextRunAt,o=n.state?.lastStatus||`idle`,s=Ot[o],c=je===r,l=t=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(t,{className:x(Y&&`min-h-11`),onClick:t=>{t.stopPropagation(),xt(e)},disabled:c,children:[(0,q.jsx)(C,{name:`play`,className:`size-4`}),h(`sessions.scheduledTasks.dialog.actions.runNow`)]}),(0,q.jsxs)(t,{className:x(Y&&`min-h-11`),onClick:t=>{t.stopPropagation(),ut(e)},children:[(0,q.jsx)(C,{name:`history`,className:`size-4`}),h(`sessions.scheduledTasks.workspace.views.history`)]}),(0,q.jsxs)(t,{className:x(Y&&`min-h-11`),onClick:t=>{t.stopPropagation(),St(e,!n.enabled)},disabled:c,children:[(0,q.jsx)(C,{name:n.enabled?`pause`:`play`,className:`size-4`}),n.enabled?h(`sessions.scheduledTasks.dialog.actions.pause`):h(`sessions.scheduledTasks.dialog.actions.resume`)]}),(0,q.jsxs)(t,{onClick:t=>{t.stopPropagation(),bt(e)},disabled:c,className:x(`text-destructive focus:text-destructive`,Y&&`min-h-11`),children:[(0,q.jsx)(C,{name:`delete-bin`,className:`size-4 text-inherit`}),h(`sessions.scheduledTasks.dialog.actions.delete`)]})]});return(0,q.jsx)(V.div,{layout:`position`,initial:!T&&{opacity:0,y:6},animate:{opacity:1,y:0},exit:T?{opacity:0}:{opacity:0,y:-6},transition:{duration:T?0:.18,ease:[.22,1,.36,1]},"data-mobile-press-surface":J?`soft`:void 0,className:x(J&&`yuri-mobile-floating-surface yuri-mobile-project-shell yuri-mobile-scheduled-task-card`),children:(0,q.jsxs)(ue,{open:Ne===r,onOpenChange:e=>{e&&Ie(null),Pe(e?r:null)},children:[(0,q.jsxs)(`div`,{className:x(`group flex w-full items-center gap-1`,J&&`yuri-mobile-project-card`),children:[(0,q.jsxs)(j,{render:(0,q.jsx)(`button`,{type:`button`,onClick:()=>it(e),onContextMenu:!Y&&!E?e=>{e.preventDefault(),Ie(null),Pe(r)}:void 0,"data-mobile-press-surface-trigger":J?!0:void 0,className:x(`flex min-h-11 min-w-0 flex-1 items-center rounded-xl border py-3 text-left outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,J?`yuri-mobile-project-trigger yuri-mobile-scheduled-task-row border-0 bg-transparent transition-opacity duration-150`:`transition-[background-color,border-color,box-shadow,opacity] duration-150 ease-out active:bg-interactive-active`,Y&&!J?`gap-2.5 px-3`:J?void 0:`gap-3 px-4`,!J&&(i?`border-border/50 bg-[var(--surface-elevated)] shadow-sm dark:shadow-none`:`border-transparent hover:bg-interactive-hover`),!n.enabled&&`opacity-65`),"aria-pressed":i}),children:[(0,q.jsx)(`span`,{className:x(`flex shrink-0 items-center justify-center rounded-full text-muted-foreground transition-[border-color,color,background-color] duration-150 motion-reduce:transition-none`,J?`yuri-mobile-project-icon yuri-mobile-glass-control`:`size-5 border border-border`),style:n.enabled&&s.tone!==`muted`?{color:`var(--status-${s.tone})`}:void 0,children:(0,q.jsx)(D,{initial:!1,mode:`wait`,children:(0,q.jsx)(V.span,{initial:!T&&{opacity:0,scale:.72},animate:{opacity:1,scale:1},exit:T?{opacity:0}:{opacity:0,scale:.72},transition:{duration:T?0:.15},className:`flex`,children:(0,q.jsx)(C,{name:n.enabled?s.Icon:`pause`,className:x(J?`yuri-mobile-project-icon-glyph`:`size-3.5`,s.spin&&n.enabled&&`animate-spin`)})},`${n.enabled}-${o}`)})}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:x(`block truncate font-medium`,J?`yuri-mobile-project-title yuri-mobile-entity-title font-semibold`:`typography-ui-label`),children:n.name}),(0,q.jsxs)(`span`,{className:x(`mt-1 flex min-w-0 items-center text-muted-foreground`,J?`yuri-mobile-project-meta yuri-mobile-entity-meta`:`gap-1 typography-micro`),children:[(0,q.jsx)(`span`,{className:`truncate`,children:Ct(n,h,!J)}),(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground/50`,children:`·`}),(0,q.jsx)(`span`,{className:`shrink-0 truncate`,children:a?wt(a,h):`—`})]})]})]}),(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:x(`shrink-0 self-center rounded-lg text-muted-foreground`,Y?`size-11 rounded-full`:`size-9`),onClick:t=>{t.stopPropagation(),ut(e)},"aria-label":h(`sessions.scheduledTasks.workspace.views.history`),children:(0,q.jsx)(C,{name:`history`,className:`size-4`})}),(0,q.jsxs)(ce,{open:Fe===r,onOpenChange:e=>{e&&Pe(null),Ie(e?r:null)},children:[(0,q.jsx)(oe,{asChild:!0,children:(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:x(`shrink-0 self-center text-muted-foreground transition-[opacity,transform,background-color] duration-150 ease-out data-[popup-open]:bg-interactive-hover motion-reduce:transition-none`,J?`yuri-mobile-project-action yuri-mobile-scheduled-task-action rounded-full`:`rounded-lg`,J?void 0:Y?`size-11`:`size-8 translate-x-1 opacity-0 group-hover:translate-x-0 group-hover:opacity-100 data-[popup-open]:translate-x-0 data-[popup-open]:opacity-100`,i&&!J&&`opacity-100`),onClick:e=>e.stopPropagation(),"aria-label":h(`sessions.scheduledTasks.dialog.actions.moreAria`,{taskName:n.name}),children:(0,q.jsx)(C,{name:`more-2`,className:J?`size-5`:`size-4`})})}),(0,q.jsx)(se,{align:`end`,className:`min-w-40 motion-reduce:transition-none`,onClick:e=>e.stopPropagation(),children:l(A)})]})]}),(0,q.jsx)(M,{className:`min-w-40 motion-reduce:transition-none`,children:l(le)})]})},r)})})},`tasks`)})]})})})]})]}),z===`edit`&&!Ke?(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4`,role:`status`,children:[X.isPending?h(`sessions.scheduledTasks.dialog.loading`):h(`common.unavailable`),X.isPending?null:(0,q.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void X.refetch(),children:h(`assistants.actions.retry`)})]}):null,E?z===`create`||z===`edit`&&Ke?(0,q.jsx)(`div`,{ref:J?Ve:void 0,className:x(J?`yuri-mobile-scheduled-editor-overlay flex w-full min-w-0 max-w-full flex-col overflow-hidden bg-background [contain:layout_paint]`:`contents`),children:(0,q.jsx)(ft,{open:!0,presentation:J?`mobile-tab`:Y?`mobile-panel`:void 0,task:z===`edit`?Ke:null,onOpenChange:ht,onSave:vt,onDirtyChange:W,onRun:async()=>{Z&&await xt(Z)},onOpenTaskHistory:pt,onDelete:async()=>{Z&&await bt(Z)},onToggleEnabled:async(e,t)=>{Z&&await St(Z,t)},actionBusy:!!je,projectID:L?.projectId||F,projectOptions:Ft,onProjectChange:z===`create`?I:void 0})}):null:(0,q.jsx)(D,{initial:!1,children:z===`create`||z===`edit`&&Ke?(0,q.jsx)(V.div,{initial:T?{opacity:1,width:0}:{opacity:0,width:0,x:24},animate:{opacity:1,width:`clamp(380px, 36vw, 480px)`,x:0},exit:T?{opacity:0,width:0}:{opacity:0,width:0,x:24},transition:{duration:T?0:.26,ease:[.22,1,.36,1]},className:`h-full min-h-0 max-w-[480px] shrink-0 overflow-hidden`,children:(0,q.jsx)(`aside`,{className:`h-full min-h-0 w-[clamp(380px,36vw,480px)] border-l border-border/60 bg-background`,children:(0,q.jsx)(ft,{open:!0,presentation:`panel`,task:z===`edit`?Ke:null,onOpenChange:ht,onSave:vt,onDirtyChange:W,onRun:async()=>{Z&&await xt(Z)},onOpenTaskHistory:pt,onDelete:async()=>{Z&&await bt(Z)},onToggleEnabled:async(e,t)=>{Z&&await St(Z,t)},actionBusy:!!je,projectID:L?.projectId||F,projectOptions:Ft,onProjectChange:z===`create`?I:void 0})})},`scheduled-task-details`):null})]})}export{zt as n,xt as t};
@@ -1,9 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-CSXCC6XM.js";import{n}from"./runtime-fetch-ykYB0sSi.js";import{I as r,s as i}from"./platform-BQipzOYw.js";import{n as a}from"./client-DfhjGjVo.js";import{it as o,ot as s,st as c}from"./vendor-base-ui-wXsskyKm.js";import{o as l,s as u,u as d}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{r as f}from"./vendor-reactuses-core-DjKFMfz7.js";import{f as p,p as m,r as h}from"./useUIStore-CxX_u4P7.js";import{s as g}from"./terminalApi-Cs8T3taw.js";import{n as _,r as v,t as y}from"./vendor-ghostty-web-DbBrwBII.js";import{r as b}from"./vendor-sonner-DX3nfJx4.js";import{Xn as x,f as S,io as ee,ro as te}from"./ui-BPOP32rM.js";import{n as C}from"./Icon-DrsaL1yC.js";import{t as w}from"./i18n-BZ_vx76q.js";import{t as ne}from"./OverlayScrollbar-CZ86VwiO.js";import{n as T}from"./useThemeSystem-BIXghnHj.js";import{r as re}from"./device-5-ZkrAmh.js";import{n as ie}from"./useEffectiveDirectory-DleT4CpD.js";import{n as ae}from"./useProjectRuntimeAPIs-Cbt-c1SP.js";import{t as E}from"./sortable-tabs-strip-DqPiLPN2.js";import{t as D}from"./useTerminalStore-BEY9gQzc.js";import{t as oe}from"./useFontPreferences-D8ajsrAw.js";import{t as se}from"./project-preview-pV9vzL9y.js";import{n as ce}from"./projectActions-D6w3UEHx.js";var O=e(c(),1);function k(e){let{colors:t}=e,n=t.syntax.base;return{background:t.surface.background,foreground:n.foreground,cursor:t.interactive.cursor,cursorAccent:t.surface.background,selectionBackground:t.interactive.selection,selectionForeground:t.interactive.selectionForeground,selectionInactiveBackground:t.interactive.selection+`50`,black:t.surface.muted,red:t.status.error,green:t.status.success,yellow:t.status.warning,blue:n.function,magenta:n.keyword,cyan:n.type,white:n.foreground,brightBlack:n.comment,brightRed:t.status.error,brightGreen:t.status.success,brightYellow:t.status.warning,brightBlue:n.function,brightMagenta:n.keyword,brightCyan:n.type,brightWhite:t.surface.elevatedForeground}}function le(e,t,n,r,i=!1){return{cursorBlink:!1,cursorStyle:`bar`,fontSize:t,lineHeight:1.15,fontFamily:`${e}, "JetBrainsMonoNL Nerd Font", "FiraCode Nerd Font", "Cascadia Code PL", "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace`,allowTransparency:!1,theme:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorAccent:n.cursorAccent,selectionBackground:n.selectionBackground,selectionForeground:n.selectionForeground,black:n.black,red:n.red,green:n.green,yellow:n.yellow,blue:n.blue,magenta:n.magenta,cyan:n.cyan,white:n.white,brightBlack:n.brightBlack,brightRed:n.brightRed,brightGreen:n.brightGreen,brightYellow:n.brightYellow,brightBlue:n.brightBlue,brightMagenta:n.brightMagenta,brightCyan:n.brightCyan,brightWhite:n.brightWhite},scrollback:1e4,ghostty:r,disableStdin:i}}var ue=e(o(),1),A=s(),j=null;function de(){return j||=v.load(),j}function M(e){if(typeof window>`u`)return null;let t=[e,...Array.from(e.querySelectorAll(`*`))],n=null;for(let e of t){let t=window.getComputedStyle(e).overflowY;if(t===`auto`||t===`scroll`){if(e.scrollHeight-e.clientHeight>2)return e;n||=e}}return n}var N=O.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:u=!0,readOnly:d=!1},f)=>{let{t:p}=w(),m=O.useRef(null),h=O.useRef(null),g=O.useRef(null),v=O.useRef(null),b=O.useRef(n),x=O.useRef(r),S=O.useRef(null),C=O.useRef(``),T=O.useRef(null),re=O.useRef(!1),ie=O.useRef(null),ae=O.useRef(!0),E=O.useRef(null),D=O.useRef(null),oe=O.useRef(0),se=O.useRef(null),ce=O.useRef(null),k=O.useRef(!1),j=O.useRef(!1),N=O.useRef(null),fe=O.useRef(null),P=O.useRef(null),F=O.useRef(``),pe=O.useRef(null),me=O.useRef(!c),he=O.useRef(u),[,ge]=O.useReducer(e=>e+1,0),[_e,ve]=O.useReducer(e=>e+1,0);b.current=d?()=>{}:n,x.current=r;let ye=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),I=!!c&&!d;O.useEffect(()=>{if(!c){me.current=!0,he.current=u;return}!he.current&&u&&(me.current=!1),he.current=u},[c,u]);let be=O.useCallback(()=>{if(!I)return;let e=m.current,t=se.current;if(!e)return;let n=[];e.getAttribute(`contenteditable`)===`true`&&n.push(e),n.push(...Array.from(e.querySelectorAll(`[contenteditable="true"]`))),n.forEach(e=>{e.setAttribute(`data-terminal-disabled-contenteditable`,`true`),e.setAttribute(`contenteditable`,`false`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.setProperty(`user-select`,`none`),e.style.setProperty(`-webkit-user-select`,`none`)}),e.tabIndex=-1,e.removeAttribute(`role`),e.removeAttribute(`aria-multiline`),Array.from(e.querySelectorAll(`textarea`)).forEach(e=>{e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.border=`0`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.fontSize=`0`,e.style.lineHeight=`0`,e!==t&&e.getAttribute(`data-terminal-disabled-input`)!==`true`&&(e.setAttribute(`data-terminal-disabled-input`,`true`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.disabled=!0,e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`0px`,e.style.height=`0px`,e.style.pointerEvents=`none`,e.style.zIndex=`-1`)})},[I]),L=O.useCallback(e=>{if(pe.current===e)return;let t=g.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),pe.current=e;return}t.options&&(t.options.cursorBlink=e,pe.current=e)}catch{}},[]),xe=I&&ye,R=O.useCallback((e,t)=>{let n=xe?ce.current:se.current,r=m.current;if(!n||!r)return;let i=r.getBoundingClientRect(),a=typeof window<`u`?window.innerWidth:i.width,o=typeof window<`u`?window.innerHeight:i.height,s=i.left+i.width/2,c=i.top+i.height-12,l=typeof e==`number`?e:s,u=typeof t==`number`?t:c,d=Math.max(8,Math.min(a-8,l)),f=Math.max(8,Math.min(o-8,u));n.style.left=`${d}px`,n.style.top=`${f}px`,n.style.bottom=``,(n instanceof HTMLTextAreaElement||n instanceof HTMLInputElement)&&(n.disabled=!1,n.readOnly=!1,n.removeAttribute(`disabled`),n.removeAttribute(`readonly`));try{n.focus({preventScroll:!0})}catch{try{n.focus()}catch{}}},[xe]),z=O.useCallback(()=>{if(I){R(),L(!0);return}g.current?.focus(),L(!0)},[R,L,I]),B=O.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),V=O.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),Se=O.useCallback(e=>{if(typeof window>`u`||xe)return;P.current!==null&&(window.clearTimeout(P.current),P.current=null);let t=0,n=()=>{P.current=window.setTimeout(()=>{P.current=null;let r=B(e);if(!r){if(t+=1,t<3){n();return}return}let i=F.current;F.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&b.current(a.replace(/\r\n|\r|\n/g,`\r`)),V(e),F.current=``},t===0?0:24)};n()},[V,B,xe]);O.useEffect(()=>{let e=m.current;if(!I||!e||c)return;let t=t=>{let n=t.target;if(n&&n.getAttribute(`data-terminal-hidden-input`)!==`true`&&e.contains(n)){try{n.blur()}catch{}R()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,I,R]);let Ce=O.useCallback(()=>{let e=g.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),H=O.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=m.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),U=O.useCallback(async()=>{if(typeof document>`u`)return;let e=Ce()||H();e.trim()&&await te(e)},[H,Ce]),W=O.useCallback(()=>Ce().trim()?!0:!!H().trim(),[H,Ce]);O.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{W()&&(e.preventDefault(),U())};return window.addEventListener(`yuri:copy`,e),()=>{window.removeEventListener(`yuri:copy`,e)}},[U,W]);let G=O.useCallback(()=>{C.current=``,T.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(T.current),T.current=null,re.current=!1,ie.current=null},[]),K=O.useCallback(()=>{let e=v.current,t=g.current,n=m.current;if(!e||!t||!n)return;let r=n.getBoundingClientRect();if(!(r.width<24||r.height<24))try{e.fit();let n={cols:t.cols,rows:t.rows},r=S.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(S.current=n,x.current(n.cols,n.rows))}catch{}},[]),we=O.useCallback(()=>{if(re.current)return;let e=g.current;if(!e){G();return}if(!C.current)return;let t=C.current;C.current=``,re.current=!0,e.write(t,()=>{re.current=!1,C.current&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,we()}):we())})},[G]),Te=O.useCallback(()=>{T.current===null&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,we()}):we())},[we]),Ee=O.useCallback(e=>{e&&(C.current+=e,Te())},[Te]),De=O.useCallback(()=>{if(E.current?.(),E.current=null,D.current!==null&&typeof window<`u`&&(window.clearTimeout(D.current),D.current=null),!c){oe.current=0;return}let e=m.current;if(!e)return;let t=g.current;if(!t)return;oe.current=0;let n=2.2,r=2.8,i=.25,a=.05,s=.015,l={lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1},u=()=>typeof performance<`u`?performance.now():Date.now(),d=Math.max(12,Math.round(o*1.35)),f=0,p=e=>{if(!e)return!1;let n=t.getViewportY(),r=f+e,i=Math.trunc(r/d);return f=r-i*d,i!==0&&t.scrollLines(i),t.getViewportY()!==n},h=()=>{l.rafId!==null&&typeof window<`u`&&window.cancelAnimationFrame(l.rafId),l.rafId=null},_={passive:!1,capture:!1};if(typeof window<`u`&&`PointerEvent`in window){let t=Object.assign(l,{pointerId:null,startX:null,startY:null,moved:!1}),o=n=>{if(n.pointerType===`touch`){h(),t.pointerId=n.pointerId,t.startX=n.clientX,t.startY=n.clientY,t.moved=!1,t.lastY=n.clientY,t.lastTime=u(),t.velocity=0;try{e.setPointerCapture(n.pointerId)}catch{}}},d=e=>{if(e.pointerType!==`touch`||t.pointerId!==e.pointerId)return;if(t.startX!==null&&t.startY!==null&&!t.moved){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>=6&&(t.moved=!0)}if(t.lastY===null){t.lastY=e.clientY,t.lastTime=u();return}let a=t.lastY,o=t.lastTime??u(),s=u();t.lastY=e.clientY,t.lastTime=s;let c=a-e.clientY;if(Math.abs(c)<1)return;let l=Math.max(s-o,8),d=c*(n+Math.min(r,Math.abs(c)/25)),f=d/l;t.velocity=t.velocity*.75+f*i,t.velocity>8?t.velocity=8:t.velocity<-8&&(t.velocity=-8),t.moved&&(e.cancelable&&e.preventDefault(),e.stopPropagation()),p(d)},f=n=>{if(n.pointerType!==`touch`||t.pointerId!==n.pointerId)return;let r=!t.moved;t.pointerId=null,t.startX=null,t.startY=null,t.moved=!1,t.lastY=null,t.lastTime=null;try{e.releasePointerCapture(n.pointerId)}catch{}if(r){I?R(n.clientX,n.clientY):c&&!me.current&&(me.current=!0,g.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(t.velocity)<a){t.velocity=0;return}let i=u(),o=()=>{let e=u(),n=Math.max(e-i,8);i=e;let r=p(t.velocity*n)??!1,c=Math.sign(t.velocity),l=Math.max(0,Math.abs(t.velocity)-s*n);if(t.velocity=l*c,!r||l<=a){h(),t.velocity=0;return}t.rafId=window.requestAnimationFrame(o)};t.rafId=window.requestAnimationFrame(o)};e.addEventListener(`pointerdown`,o,_),e.addEventListener(`pointermove`,d,_),e.addEventListener(`pointerup`,f,_),e.addEventListener(`pointercancel`,f,_);let m=e.style.touchAction,v=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,E.current=()=>{h(),D.current!==null&&typeof window<`u`&&(window.clearTimeout(D.current),D.current=null),oe.current=0,e.removeEventListener(`pointerdown`,o,_),e.removeEventListener(`pointermove`,d,_),e.removeEventListener(`pointerup`,f,_),e.removeEventListener(`pointercancel`,f,_),e.style.touchAction=m,e.style.overscrollBehaviorY=v};return}let v=e=>{e.touches.length===1&&(h(),l.lastY=e.touches[0].clientY,l.lastTime=u(),l.velocity=0,l.startX=e.touches[0].clientX,l.startY=e.touches[0].clientY,l.didMove=!1)},y=e=>{if(e.touches.length!==1){l.lastY=null,l.lastTime=null,l.velocity=0,l.startX=null,l.startY=null,l.didMove=!1,h();return}let t=e.touches[0].clientX,a=e.touches[0].clientY;if(l.startX!==null&&l.startY!==null&&!l.didMove){let e=t-l.startX,n=a-l.startY;Math.hypot(e,n)>=6&&(l.didMove=!0)}if(l.lastY===null){l.lastY=a,l.lastTime=u();return}let o=l.lastY,s=l.lastTime??u(),c=u();l.lastY=a,l.lastTime=c;let d=o-a;if(Math.abs(d)<1)return;let f=Math.max(c-s,8),m=d*(n+Math.min(r,Math.abs(d)/25)),g=m/f;l.velocity=l.velocity*.75+g*i,l.velocity>8?l.velocity=8:l.velocity<-8&&(l.velocity=-8),l.didMove&&(e.preventDefault(),e.stopPropagation()),p(m)},b=e=>{let t=!l.didMove;l.lastY=null,l.lastTime=null;let n=l.velocity;if(l.startX=null,l.startY=null,l.didMove=!1,t){let t=e.changedTouches?.[0];I?R(t?.clientX,t?.clientY):c&&!me.current&&(me.current=!0,g.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(n)<a){l.velocity=0;return}let r=u(),i=()=>{let e=u(),t=Math.max(e-r,8);r=e;let n=p(l.velocity*t)??!1,o=Math.sign(l.velocity),c=Math.max(0,Math.abs(l.velocity)-s*t);if(l.velocity=c*o,!n||c<=a){h(),l.velocity=0;return}l.rafId=window.requestAnimationFrame(i)};l.rafId=window.requestAnimationFrame(i)};e.addEventListener(`touchstart`,v,_),e.addEventListener(`touchmove`,y,_),e.addEventListener(`touchend`,b,_),e.addEventListener(`touchcancel`,b,_);let x=e.style.touchAction,S=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,E.current=()=>{h(),D.current!==null&&typeof window<`u`&&(window.clearTimeout(D.current),D.current=null),oe.current=0,e.removeEventListener(`touchstart`,v,_),e.removeEventListener(`touchmove`,y,_),e.removeEventListener(`touchend`,b,_),e.removeEventListener(`touchcancel`,b,_),e.style.touchAction=x,e.style.overscrollBehaviorY=S}},[c,I,R,o]);O.useEffect(()=>{let e=!1,t=null,n=null,r=null,s=[],l=null,u=null,f=null,p=m.current;if(!p)return;if(p.tabIndex=I?-1:0,I){let e=p.focus.bind(p),t=p;t.focus=((...e)=>{R()}),f=()=>{t.focus=e}}let x=()=>{L(!0)},ee=()=>{L(!1)},te=e=>{let t=e.target;if(t&&p.contains(t)){if(I&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),R()},0),L(!1);return}if(c&&!me.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),L(!1);return}L(!0);return}L(!1)},C=()=>{L(!1)},w=null;return(async()=>{try{let f=await de();if(e)return;let m=le(a,o,i,f,d),S=new _(m);ae.current=!0,I&&(S.focus=()=>{});let te=S;if(typeof te.scrollToBottom==`function`){let e=te.scrollToBottom.bind(te);te.scrollToBottom=()=>{ae.current&&e()},l=()=>{te.scrollToBottom=e}}let C=new y;if(t=S,g.current=S,v.current=C,S.loadAddon(C),S.open(p),c){let e=S.renderer;if(e&&typeof e.renderScrollbar==`function`){let t=e.renderScrollbar.bind(e);e.renderScrollbar=()=>{},u=()=>{e.renderScrollbar=t}}}ve(),pe.current=!1,w=S.textarea??p.querySelector(`textarea`),w&&(w.readOnly=d,w.addEventListener(`focus`,x),w.addEventListener(`blur`,ee)),be(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{be()}),r.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let ne=M(p);ne?(ne.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),h.current=ne,ge()):h.current=null,K();let T=C;typeof T.observeResize==`function`&&T.observeResize(),De(),s=[S.onData(e=>{b.current(e)}),S.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof S.hasSelection==`function`&&S.hasSelection();ae.current=!t&&e<=.5}}),S.onSelectionChange(()=>{if(typeof S.hasSelection==`function`&&S.hasSelection()){ae.current=!1;return}let e=typeof S.getViewportY==`function`?S.getViewportY():0;ae.current=e<=.5})],n=new ResizeObserver(()=>{K()}),n.observe(p),typeof window<`u`&&window.setTimeout(()=>{K()},0)}catch{}})(),document.addEventListener(`focusin`,te,!0),window.addEventListener(`blur`,C),()=>{e=!0,E.current?.(),E.current=null,document.removeEventListener(`focusin`,te,!0),window.removeEventListener(`blur`,C),s.forEach(e=>e.dispose()),l?.(),l=null,u?.(),u=null,w&&(w.removeEventListener(`focus`,x),w.removeEventListener(`blur`,ee)),n?.disconnect(),r?.disconnect(),f?.(),t?.dispose(),g.current=null,v.current=null,h.current=null,S.current=null,pe.current=null,G()}},[be,c,K,R,a,o,De,i,G,L,I,d]),O.useEffect(()=>{let e=g.current;e&&(e.reset(),G(),S.current=null,K())},[e,_e,K,G]),O.useEffect(()=>{l&&g.current&&z()},[l,z,e,_e]),O.useEffect(()=>(De(),()=>{E.current?.(),E.current=null}),[De,e]),O.useEffect(()=>{let e=g.current;if(!e)return;if(t.length===0){ie.current!==null&&(e.reset(),G(),K());return}let n=ie.current,r;if(n===null)r=t;else{let e=t.findIndex(e=>e.id===n);r=e>=0?t.slice(e+1):t}r.length>0&&Ee(r.map(e=>e.data).join(``)),ie.current=t[t.length-1].id},[t,_e,Ee,K,G]),O.useImperativeHandle(f,()=>({focus:()=>{z()},clear:()=>{let e=g.current;e&&(e.reset(),G(),K())},fit:()=>{K()}}),[z,K,G]);let Oe=O.useCallback(e=>{if(!I)return;let t=m.current,n=e.relatedTarget,r=n?.tagName;r===`INPUT`||r===`TEXTAREA`||n?.isContentEditable,n?.getAttribute(`data-terminal-hidden-input`),n&&t?.contains(n)},[I]),ke=O.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(fe.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){k.current=!0;return}if(!n&&r){if(k.current)return;e.preventDefault(),b.current(r),N.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0;return}if(n===`insertText`&&r){if(k.current)return;e.preventDefault(),b.current(r),N.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0;return}if(n===`insertLineBreak`){if(k.current)return;e.preventDefault(),b.current(`\r`),N.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0;return}if(n===`deleteContentBackward`){if(k.current)return;e.preventDefault(),b.current(``),N.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0}},[]),Ae=O.useCallback(e=>{let t=e.currentTarget;if(fe.current=typeof performance<`u`?performance.now():Date.now(),k.current)return;if(j.current){let e=N.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){j.current=!1,V(t);return}j.current=!1}let n=B(t);if(!n)return;F.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);b.current(r),V(t),F.current=``},[V,B]),q=O.useCallback(e=>{e.stopPropagation();let t=e.key.toLowerCase(),n=e.metaKey&&!e.ctrlKey&&!e.altKey&&t===`c`,r=e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&t===`c`;if((n||r)&&W()){e.preventDefault(),U();return}if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1){let t=e.key.toUpperCase();if(t>=`A`&&t<=`Z`){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),b.current(String.fromCharCode(t.charCodeAt(0)-64)),V(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),b.current(`\x1B`+e.key),V(e.currentTarget);return}let i={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Escape:`\x1B`,Tab:` `,Delete:`\x1B[3~`,Home:`\x1B[H`,End:`\x1B[F`}[e.key];if(i){e.preventDefault(),b.current(i),V(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=N.current,s=typeof performance<`u`?performance.now():Date.now(),c=!!(o&&s-o.at<50);if(e.key===`Enter`){if(c&&o?.type===`insertLineBreak`)return;e.preventDefault(),b.current(`\r`),V(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;B(a)||b.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=fe.current;t&&s-t<50||(e.preventDefault(),b.current(e.key),j.current=!0,N.current={type:`keydown-text`,at:s})}Se(a)},[V,U,W,B,Se]),je=O.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||Se(t)},[Se]),J=O.useCallback(e=>{let t=e.currentTarget;k.current=!1;let n=e.data||B(t);if(fe.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);b.current(r),V(t),N.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0},[V,B]),Me=O.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=g.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;b.current(n)},[]),Y={position:`fixed`,left:0,top:0,width:1,height:1,opacity:0,zIndex:-1,background:`transparent`,color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`transparent`,textShadow:`none`,WebkitAppearance:`none`,appearance:`none`,resize:`none`,overflow:`hidden`,whiteSpace:`nowrap`,border:`0`,padding:0,margin:0,outline:`none`,outlineOffset:0,fontSize:16,fontWeight:400,pointerEvents:`none`,WebkitUserSelect:`none`,userSelect:`none`};return(0,A.jsxs)(`div`,{ref:m,className:ee(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":I?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!I||c)&&!W()){let t=e.touches?.[0];R(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(I){if(W())return;R(e.clientX,e.clientY)}else g.current?.focus()},onMouseUp:()=>{!c&&W()&&U()},onTouchEnd:()=>{!c&&W()&&U()},children:[I&&typeof document<`u`?(0,ue.createPortal)((0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`input`,{ref:ce,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":p(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Y,display:xe?`block`:`none`},onBlur:Oe,onBeforeInput:ke,onCompositionStart:()=>{k.current=!0},onInput:Ae,onKeyDown:q,onKeyUp:je,onCompositionEnd:J,onPaste:Me}),(0,A.jsx)(`textarea`,{ref:se,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":p(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Y,display:xe?`none`:`block`},onBlur:Oe,onBeforeInput:ke,onCompositionStart:()=>{k.current=!0},onInput:Ae,onKeyDown:q,onKeyUp:je,onCompositionEnd:J,onPaste:Me})]}),document.body):null,h.current&&!c?(0,A.jsx)(ne,{containerRef:h,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});N.displayName=`TerminalViewport`;function fe(e,t=!1){return e.replace(/\n/g,(n,r)=>(r===0?t:e[r-1]===`\r`)?n:`\r
2
- `)}function P(e,t){let n=[e.transport,`shellLog`,e.directory,e.id];return l({queryKey:n,queryFn:async({signal:r})=>{let i=t.getQueryData(n),o=a.getScopedSdkClient(e.directory),s={id:e.id,location:{directory:e.directory}},c=await o.shell.get(s,{signal:r}),l=await o.shell.output({...s,cursor:i?.cursor??0,limit:65536},{signal:r});if(!c?.data||!l?.data||typeof l.data.output!=`string`)throw Error(`Shell log unavailable`);let u=i?.chunks??[];if(l.data.output){u=[...u,{id:l.data.cursor,data:fe(l.data.output,i?.endsWithCR)}];let e=0,t=u.length;for(;t>0&&e+u[t-1].data.length<=1e6;)e+=u[--t].data.length;u=u.slice(t)}return{cursor:l.data.cursor,size:l.data.size,chunks:u,status:c.data.status,endsWithCR:l.data.output?l.data.output.endsWith(`\r`):i?.endsWithCR??!1}},refetchInterval:e=>{let t=e.state.data;return e.state.error||!t?2e3:t.cursor<t.size?100:t.status===`running`&&1e3},retry:1,gcTime:6e4})}var F=()=>{},pe=[];function me({shell:e,theme:n,fontFamily:r,fontSize:i}){let{t:o}=w(),s=d(),c=e.transport===t(),l=P(e,s),p=u({...l,enabled:c}),[m,h]=O.useState(!1),g=f(async()=>{if(!(!c||m)){h(!0);try{await a.getScopedSdkClient(e.directory).shell.remove({id:e.id,location:{directory:e.directory}}),await s.invalidateQueries({queryKey:l.queryKey})}catch{b.error(o(`chat.workStatus.shell.stopFailed`))}finally{h(!1)}}});return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-shell-log":e.id,children:[(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-1 text-xs text-muted-foreground`,children:[(0,A.jsx)(C,{name:`lock`,className:`size-3.5`}),(0,A.jsx)(`span`,{children:o(`chat.workStatus.shell.readOnly`)}),p.data&&p.data.status!==`running`?(0,A.jsx)(`span`,{role:`status`,children:o(`chat.workStatus.shell.exited`)}):null,!c||p.isError?(0,A.jsx)(`span`,{role:`alert`,children:o(`chat.workStatus.shell.outputUnavailable`)}):null,c&&p.data?.status===`running`?(0,A.jsxs)(x,{variant:`ghost`,size:`xs`,className:`ml-auto`,disabled:m,onClick:()=>void g(),children:[(0,A.jsx)(C,{name:`stop-circle`,className:`size-3.5`}),o(`chat.workStatus.shell.stop`)]}):null]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-2`,children:(0,A.jsx)(N,{sessionKey:`${e.transport}:${e.id}`,chunks:p.data?.chunks??pe,onInput:F,onResize:F,theme:n,fontFamily:r,fontSize:i,readOnly:!0,autoFocus:!1})})]})}var he=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),ge=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,_e=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,ve=/Serving HTTP on .*? port (\d{2,5})/i,ye=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),I=e=>{let t=e;for(;t.length>0;){let e=t[t.length-1];if(e===`)`||e===`]`||e===`}`||e===`>`){let n=e===`)`?`(`:e===`]`?`[`:e===`}`?`{`:`<`,r=t.slice(0,-1);if((r.match(RegExp(`\\${n}`,`g`))||[]).length>(r.match(RegExp(`\\${e}`,`g`))||[]).length)break;t=r;continue}if(ye.has(e)){t=t.slice(0,-1);continue}break}return t},be=e=>{let t=I(e);return t=t.replace(`0.0.0.0`,`127.0.0.1`),t=t.replace(`[::1]`,`127.0.0.1`),t=t.replace(`[::]`,`127.0.0.1`),t},L=e=>{if(!e)return null;let t=e.replace(he,``),n=t.match(ve);if(n?.[1]){let e=Number.parseInt(n[1],10);if(Number.isFinite(e)&&e>0&&e<=65535)return`http://127.0.0.1:${e}/`}let r=t.split(`
3
- `);for(let e of r){if(!_e.test(e))continue;let t=Array.from(e.matchAll(ge));if(t.length!==0)return be((t.find(e=>{try{return!!new URL(be(e[1])).port}catch{return!1}})??t[0])[1])}return null},xe=async(e,t=1500)=>{if(!e||typeof window>`u`)return!1;let r;try{r=new URL(e)}catch{return!1}if(r.protocol!==`http:`&&r.protocol!==`https:`)return!1;let i=r.hostname.toLowerCase();if(i!==`localhost`&&i!==`127.0.0.1`&&i!==`0.0.0.0`&&i!==`::1`&&i!==`::`)return!1;let a=new AbortController,o=window.setTimeout(()=>a.abort(),t);try{let e=await n(`/api/system/probe-url`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:r.toString()}),cache:`no-store`,signal:a.signal});return e.ok?(await e.json().catch(()=>null))?.ok===!0:!1}catch{return!1}finally{window.clearTimeout(o)}},R={esc:`\x1B`,tab:` `,enter:`\r`,"arrow-up":`\x1B[A`,"arrow-down":`\x1B[B`,"arrow-left":`\x1B[D`,"arrow-right":`\x1B[C`},z={ctrl:`5`,cmd:`3`},B={retry:{maxRetries:3,initialDelayMs:500,maxDelayMs:8e3},connectionTimeoutMs:1e4},V={retry:{maxRetries:8,initialDelayMs:400,maxDelayMs:8e3},connectionTimeoutMs:15e3},Se=(e,t)=>{if(t)switch(e){case`arrow-up`:return`\u001b[1;${z[t]}A`;case`arrow-down`:return`\u001b[1;${z[t]}B`;case`arrow-right`:return`\u001b[1;${z[t]}C`;case`arrow-left`:return`\u001b[1;${z[t]}D`}return R[e]??null},Ce=()=>{let{t:e}=w(),{terminal:t,runtime:n,projectScope:a}=ae(),{currentTheme:o}=T(),{monoFont:s}=oe(),c=h(e=>e.terminalFontSize),l=h(e=>e.bottomTerminalHeight),u=h(e=>e.isBottomTerminalExpanded),{isMobile:d,isTablet:f,hasTouchOnlyPointer:_}=re(),v=d||f,y=(v||_)&&n.platform===`web`,b=n.platform!==`vscode`,te=h(e=>e.showTerminalQuickKeysOnDesktop),ne=!r()&&(v||te),le=S(e=>e.currentSessionId),ue=S(e=>e.newSessionDraft),j=!!a||le!==null||ue?.open===!0,de=ie()??null??a?.location.directory??null,M=a?i({...a.location,directory:de??a.location.directory}):de,fe=D(e=>e.sessions),P=D(e=>e.hasHydrated),F=D(e=>e.ensureDirectory),pe=D(e=>e.createTab),he=D(e=>e.setActiveTab),ge=D(e=>e.closeTab),_e=O.useMemo(()=>a?async(e,n)=>{await ge(e,n,t.close)}:ge,[a,t,ge]),ve=D(e=>e.setTabSessionId),ye=D(e=>e.setTabLifecycle),I=D(e=>e.setConnecting),be=D(e=>e.appendToBuffer),R=D(e=>e.setTabPreviewUrl),z=D(e=>e.clearBuffer),Ce=h(e=>e.openContextPreview),H=O.useMemo(()=>{if(M)return fe.get(M)},[fe,M]),U=O.useMemo(()=>H?b?H.activeTabId??H.tabs[0]?.id??null:H.tabs[0]?.id??null:null,[H,b]),W=O.useMemo(()=>{if(H)return U?H.tabs.find(e=>e.id===U)??H.tabs[0]:H.tabs[0]},[H,U]),G=O.useMemo(()=>(H?.tabs??[]).map(t=>({icon:(()=>{let e=t.iconKey?ce[t.iconKey]??`terminal`:`terminal`;return(0,A.jsx)(C,{name:e,className:`h-4 w-4`})})(),id:t.id,label:t.shellLog?`Agent Shell`:t.label,title:t.label,closeLabel:e(`terminalView.tabs.closeTabTitle`)})),[H?.tabs,e]),K=W?.terminalSessionId??null,we=W?.shellLog,Te=ne&&!we,Ee=W?.lifecycle??`idle`,De=W?.bufferChunks??[],Oe=W?.isConnecting??!1,ke=W?.previewUrl??null,[Ae,q]=O.useState(null),[je,J]=O.useState(!1),[Me,Y]=O.useState(!1),[X,Z]=O.useState(null),[Ne,Pe]=O.useState(!1),[Fe,Ie]=O.useState(0),Le=O.useRef(null),Re=O.useRef(null),ze=O.useRef(U),Be=O.useRef(K),Ve=O.useRef(M),He=O.useRef(null),Ue=O.useRef(null),We=O.useRef(!1),Ge=O.useRef(!1),Ke=O.useRef(null),qe=O.useRef(null),Je=O.useRef(new Set),Ye=O.useRef(!1),Xe=O.useRef(``),Ze=O.useRef(new Set),Qe=O.useRef(0),$e=O.useCallback(()=>{Xe.current=``,Ze.current.clear(),Qe.current+=1},[]),et=O.useCallback(()=>{y||typeof document<`u`&&!document.hasFocus()||He.current?.focus()},[y]),tt=O.useCallback(()=>{y||He.current?.focus()},[y]);O.useEffect(()=>{if(!P||Ye.current)return;Ye.current=!0;let e=new Set;for(let[,t]of D.getState().sessions.entries())for(let n of t.tabs)n.terminalSessionId&&e.add(n.terminalSessionId);Je.current=e},[P]);let nt=h(e=>e.activeMainTab),rt=h(e=>e.isBottomTerminalOpen),it=h(e=>e.setBottomTerminalOpen),at=h(e=>e.setBottomTerminalExpanded),ot=nt===`terminal`,Q=ot||rt,[st,ct]=O.useState(Q);O.useEffect(()=>{!Q||n.platform===`vscode`||a||g()},[Q,n.platform,a]),O.useEffect(()=>{Q&&ct(!0)},[Q]),O.useEffect(()=>{Ge.current=Q},[Q]),O.useEffect(()=>{Be.current=K},[K]),O.useEffect(()=>{ze.current=U,$e()},[U,$e]),O.useEffect(()=>{Ve.current=M},[M]),O.useEffect(()=>{!Te&&X!==null&&Z(null)},[Te,X,Z]),O.useEffect(()=>{!K&&X!==null&&Z(null)},[K,X,Z]);let $=O.useCallback(()=>{Le.current?.(),Le.current=null,Re.current=null,Ke.current=null,Y(!1)},[]);O.useEffect(()=>()=>{$(),Be.current=null},[$]),O.useEffect(()=>($(),$),[t,$]);let lt=O.useCallback((e,t,n)=>{if(!n)return;let r=`${Xe.current}${n}`.replace(/\r\n|\r/g,`
4
- `),i=r.split(`
5
- `),o=r.endsWith(`
6
- `)?i.join(`
7
- `):i.slice(0,-1).join(`
8
- `);if(Xe.current=r.endsWith(`
9
- `)?``:(i[i.length-1]??``).slice(-1024),!o)return;let s=L(o);if(!s||Ze.current.has(s))return;let c=Qe.current;Ze.current.add(s),(a?se(a,s):xe(s)).then(n=>{if(Ze.current.delete(s),!n||Qe.current!==c)return;let r=D.getState().getDirectoryState(e)?.tabs.find(e=>e.id===t);!r||r.previewUrlLocked||r.previewUrl===s||R(e,t,s,{locked:!1,autoOpened:!1})})},[R,a]),ut=O.useCallback((n,r,i,a=B,o=!1)=>{if(Re.current===i)return;$(),Re.current=i;let s=t.connect(i,{onEvent:a=>{if(Re.current===i)switch(a.type){case`connected`:Ke.current=i,I(n,r,!1),q(null),J(!1),Y(!1),et(),qe.current===i&&(qe.current=null,t.sendInput(i,`\r`).catch(()=>{}));break;case`reconnecting`:q(null),J(!1),Y(!0);break;case`data`:a.data&&(be(n,r,a.data),lt(n,r,a.data));break;case`exit`:{let t=typeof a.exitCode==`number`?a.exitCode:null,i=typeof a.signal==`number`?a.signal:null,o=!!(D.getState().getDirectoryState(n)?.tabs.find(e=>e.id===r))?.label?.startsWith(`Action:`);be(n,r,e(`terminalView.stream.processExitedMessage`,{exitCodeSegment:t===null?``:e(`terminalView.stream.processExitedWithCode`,{exitCode:t}),signalSegment:i===null?``:e(`terminalView.stream.processExitedWithSignal`,{signal:i})})),ye(n,r,`exited`),ve(n,r,null),I(n,r,!1),q(o?null:e(`terminalView.error.sessionEnded`)),J(!1),Y(!1),$();break}}},onError:(t,a)=>{if(Re.current===i){if(!a){q(null),J(!1);return}if(/session not found/i.test(t.message)||o){Y(!1),q(null),J(!1),I(n,r,!0),z(n,r),ye(n,r,`idle`),ve(n,r,null),$();return}Y(!1),q(e(`terminalView.error.connectionFailed`,{message:t.message})),J(!0),I(n,r,!1),z(n,r),ye(n,r,`exited`),ve(n,r,null),$()}}},a);Le.current=()=>{s.close(),Re.current=null}},[be,z,$,et,lt,I,ye,ve,e,t]);O.useEffect(()=>{let n=!1;if(!(!P||!st)){if(!M){q(e(j?`terminalView.empty.noWorkingDirectory`:`terminalView.empty.selectSession`));return}return(async()=>{let r=M;if(!Ve.current||Ve.current!==r)return;F(r);let i=D.getState().getDirectoryState(r);if(!i||i.tabs.length===0)return;let a=b?i.activeTabId??i.tabs[0]?.id??null:i.tabs[0]?.id??null;if(!a)return;let o=i.tabs.find(e=>e.id===a)??i.tabs[0];if(o?.shellLog)return;let s=o?.terminalSessionId??null,c=o?.lifecycle??`idle`,l=!!o?.label?.startsWith(`Action:`),u=(o?.bufferLength??0)>0||(o?.bufferChunks?.length??0)>0;if(s)return;if(c===`exited`){I(r,a,!1);return}if(l&&u){I(r,a,!1);return}let d=Ue.current;if(!(!d&&Ge.current)){q(null),J(!1),Y(!1),I(r,a,!0);try{let e=await t.createSession({cwd:de??``,cols:d?.cols,rows:d?.rows});if(!(!n&&Ve.current===r&&ze.current===a)){try{await t.close(e.sessionId)}catch{}return}if(D.getState().getDirectoryState(r)?.tabs.find(e=>e.id===a)?.terminalSessionId){try{await t.close(e.sessionId)}catch{}return}ve(r,a,e.sessionId)}catch(t){n||(q(t instanceof Error?t.message:e(`terminalView.error.startSessionFailed`)),J(!0),Y(!1),I(r,a,!1))}}})(),()=>{n=!0}}},[j,M,de,K,Ee,U,st,Fe,b,P,F,I,ve,e,t]);let dt=O.useRef(ut);dt.current=ut;let ft=O.useRef($);ft.current=$,O.useEffect(()=>{if(!P||!st)return;if(!M){ft.current();return}let e=M,t=D.getState().getDirectoryState(e);if(!t||t.tabs.length===0){ft.current();return}let n=b?t.activeTabId??t.tabs[0]?.id??null:t.tabs[0]?.id??null;if(!n){ft.current();return}let r=t.tabs.find(e=>e.id===n)??t.tabs[0],i=r?.terminalSessionId??null;if(!i){ft.current(),Be.current=null;return}if(Re.current===i&&Le.current){Be.current=i;return}Be.current=i;let a=Je.current.has(i),o=a&&(r?.bufferLength??0)===0&&(r?.bufferChunks?.length??0)===0;a&&Je.current.delete(i),o&&(qe.current=i),dt.current(e,n,i,a?V:B,a)},[M,K,U,b,st,P,t]),O.useEffect(()=>{if(!Q||y)return;if(typeof window>`u`){et();return}let e=window.requestAnimationFrame(()=>{et()});return()=>{window.cancelAnimationFrame(e)}},[U,et,Q,y]);let pt=O.useCallback(async()=>{if(!M||Ne)return;let t=D.getState().getDirectoryState(M),n=b?U??t?.activeTabId??t?.tabs[0]?.id??null:t?.tabs[0]?.id??null;if(n){Pe(!0),q(null),J(!1),Y(!1),$(),z(M,n),$e();try{await _e(M,n)}catch(t){q(t instanceof Error?t.message:e(`terminalView.error.restartFailed`)),J(!0),Y(!1)}finally{Pe(!1)}}},[U,z,_e,$,M,b,Ne,$e,e]),mt=O.useCallback(async()=>{await pt()},[pt]),ht=O.useCallback(()=>{if(!M)return;let e=pe(M);he(M,e),q(null),J(!1),Y(!1),$()},[pe,$,M,he]),gt=O.useCallback(e=>{M&&(he(M,e),q(null),J(!1),Y(!1),$())},[$,M,he]),_t=O.useCallback(e=>{M&&(e===U&&$(),q(null),J(!1),Y(!1),_e(M,e))},[U,_e,$,M]),vt=O.useCallback(n=>{if(!n||Me)return;let r=n,i=!1;if(X&&n.length>0){let e=n[0];if(e.length===1&&/[a-zA-Z]/.test(e)){let t=e.toUpperCase();(X===`ctrl`||X===`cmd`)&&(r=String.fromCharCode(t.charCodeAt(0)&31),i=!0)}i||=!0}let a=Be.current;!a||Ke.current!==a||(t.sendInput(a,r).catch(t=>{Me||q(t instanceof Error?t.message:e(`terminalView.error.sendInputFailed`))}),i&&(Z(null),tt()))},[X,tt,Me,Z,e,t]),yt=O.useCallback((e,n)=>{let r=Ue.current;if((!r||r.cols!==e||r.rows!==n)&&(Ue.current={cols:e,rows:n}),We.current||(We.current=!0,Ie(e=>e+1)),!Ge.current)return;let i=Be.current;!i||Ke.current!==i||t.resize({sessionId:i,cols:e,rows:n}).catch(()=>{})},[t]),bt=O.useCallback(e=>{Z(t=>t===e?null:e),tt()},[tt,Z]),xt=O.useCallback(e=>{let t=Se(e,X);t&&(vt(t),Z(null),tt())},[X,tt,vt,Z]);O.useEffect(()=>{if(!Te||!X||!K)return;let e=e=>{if(e.repeat)return;let t=e.key;if(!t||t===`Control`||t===`Meta`||t===`Alt`||t===`Shift`)return;let n=t.length===1?t.toLowerCase():t,r=e.code??``,i=r.startsWith(`Key`)&&r.length===4?r.slice(3).toUpperCase():null,a=t.length===1&&/[a-zA-Z]/.test(t)?t.toUpperCase():i,o={Tab:`tab`,Enter:`enter`,ArrowUp:`arrow-up`,ArrowDown:`arrow-down`,ArrowLeft:`arrow-left`,ArrowRight:`arrow-right`,Escape:`esc`,tab:`tab`,enter:`enter`,arrowup:`arrow-up`,arrowdown:`arrow-down`,arrowleft:`arrow-left`,arrowright:`arrow-right`,escape:`esc`};if(n in o){e.preventDefault(),e.stopPropagation(),xt(o[n]);return}if(X===`ctrl`&&a&&a.length===1&&a>=`A`&&a<=`Z`){let t=String.fromCharCode(a.charCodeAt(0)&31);e.preventDefault(),e.stopPropagation(),vt(t),Z(null),tt()}};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[X,xt,vt,tt,Te,Z,K]);let St=O.useMemo(()=>{let e=p[m].stack;if(typeof window>`u`)return(p[s]??p[`system-mono`]).stack;let t=window.getComputedStyle(document.documentElement).getPropertyValue(`--font-family-mono`);return t&&t.trim().length>0?t.trim():(p[s]??p[`system-mono`]).stack??e},[s]),Ct=O.useMemo(()=>k(o),[o]),wt=O.useMemo(()=>`${M??`no-dir`}::${U??`no-tab`}`,[M,U]);if(O.useEffect(()=>{if(!Q||y)return;let e=He.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t(),et()}),n=[220,400].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[et,Q,y,wt,K]),O.useEffect(()=>{if(y||!Q||!rt)return;let e=He.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t()}),n=[0,80,180,320].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[l,u,rt,Q,y]),!j)return(0,A.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground`,children:e(`terminalView.empty.selectSession`)});if(!M)return(0,A.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-sm text-muted-foreground`,children:[(0,A.jsx)(`p`,{children:e(`terminalView.empty.noWorkingDirectoryForSession`)}),(0,A.jsx)(x,{onClick:pt,size:`sm`,children:e(`terminalView.actions.retry`)})]});let Tt=!K||Oe||Ne||Me,Et=st,Dt=!v&&rt&&!ot,Ot=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>xt(`esc`),disabled:Tt,children:e(`terminalView.quickKeys.escape`)}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`tab`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-right`,className:`h-4 w-4`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.tabAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`ctrl`,className:`h-6 w-9 p-0`,onClick:()=>bt(`ctrl`),disabled:Tt,children:[(0,A.jsx)(`span`,{className:`text-xs font-medium`,children:e(`terminalView.quickKeys.controlLabel`)}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.controlModifierAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`cmd`,className:`h-6 w-9 p-0`,onClick:()=>bt(`cmd`),disabled:Tt,children:[(0,A.jsx)(C,{name:`command`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.commandModifierAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`arrow-up`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-up`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowUpAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`arrow-left`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-left`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowLeftAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`arrow-down`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-down`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowDownAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`arrow-right`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-right`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowRightAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`enter`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-go-back`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.enterAria`)})]})]});return(0,A.jsxs)(`div`,{"data-terminal-view":`true`,className:`flex h-full flex-col overflow-hidden bg-[var(--surface-background)]`,children:[(0,A.jsxs)(`div`,{className:ee(`app-region-no-drag sticky top-0 z-20 shrink-0 bg-[var(--surface-background)] text-xs`,v?`px-3 py-1.5`:`pl-3 pr-1.5 py-1`),children:[b&&H?(0,A.jsxs)(`div`,{className:`flex items-center gap-2 pl-1 pr-1`,children:[(0,A.jsx)(`div`,{className:ee(`min-w-0 flex-1`,v?`h-8`:`h-7`),children:(0,A.jsx)(E,{items:G,activeId:U,onSelect:gt,onClose:_t,layoutMode:`scrollable`,variant:`default`,className:`h-full bg-transparent`})}),(0,A.jsx)(x,{type:`button`,size:`xs`,variant:`ghost`,className:ee(`shrink-0`,v?`h-8 w-8 p-0`:`h-7 w-7 p-0`),onClick:ht,title:e(`terminalView.tabs.newTabTitle`),children:(0,A.jsx)(C,{name:`add`,className:`${v?`h-[18px] w-[18px]`:`h-4 w-4`}`})}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 overflow-visible`,children:[ke?(0,A.jsxs)(x,{type:`button`,size:`xs`,variant:`outline`,className:`h-6 shrink-0 gap-1 px-2`,onClick:()=>{M&&Ce(M,ke)},title:e(`terminalView.preview.openTitle`),children:[(0,A.jsx)(C,{name:`global`,className:`h-3.5 w-3.5 shrink-0`}),(0,A.jsx)(`span`,{className:`whitespace-nowrap`,children:e(`terminalView.preview.open`)})]}):null,Dt?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(x,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>at(!u),className:ee(`shrink-0 p-0`,d?`h-8 w-8`:`h-7 w-7`),title:e(u?`terminalView.bottomDock.restoreTitle`:`terminalView.bottomDock.expandTitle`),"aria-label":e(u?`terminalView.bottomDock.restoreAria`:`terminalView.bottomDock.expandAria`),children:u?(0,A.jsx)(C,{name:`fullscreen-exit`,className:`h-4 w-4`}):(0,A.jsx)(C,{name:`fullscreen`,className:`h-4 w-4`})}),(0,A.jsx)(x,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>it(!1),className:ee(`shrink-0 p-0`,d?`h-8 w-8`:`h-7 w-7`),title:e(`terminalView.bottomDock.closeTitle`),"aria-label":e(`terminalView.bottomDock.closeAria`),children:(0,A.jsx)(C,{name:`close`,className:`h-4 w-4`})})]}):null]})]}):null,!d&&Te&&b&&H?(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1 pl-1 pr-1`,children:Ot}):null,Te&&(d||!b||!H)?(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:Ot}):null]}),(0,A.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,style:{backgroundColor:Ct.background},children:[we?Q?(0,A.jsx)(me,{shell:we,theme:Ct,fontFamily:St,fontSize:c},U):null:(0,A.jsx)(`div`,{className:`h-full w-full box-border pl-4 pr-1.5 pt-3 pb-4`,children:Et?(0,A.jsx)(N,{ref:e=>{He.current=e},sessionKey:wt,chunks:De,onInput:vt,onResize:yt,theme:Ct,fontFamily:St,fontSize:c,enableTouchScroll:y,autoFocus:!y&&Q,isVisible:Q},wt):null}),!we&&!Me&&Ae&&(0,A.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 bg-[var(--status-error-background)] px-3 py-2 text-xs text-[var(--status-error-foreground)] flex items-center justify-between gap-2`,children:[(0,A.jsx)(`span`,{children:Ae}),je&&d&&(0,A.jsx)(x,{size:`sm`,variant:`secondary`,className:`h-6 px-2 py-0 text-xs`,onClick:mt,disabled:Ne,title:e(`terminalView.actions.hardRestartTitle`),type:`button`,children:e(`terminalView.actions.hardRestart`)})]})]})]})};export{Ce as TerminalView};