pisper 0.6.34 → 0.6.35

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 (140) hide show
  1. package/package.json +5 -5
  2. package/web/.vite/manifest.json +662 -669
  3. package/web/assets/{AppDialog-xnUDICdc.js → AppDialog-BIc2uEZh.js} +1 -1
  4. package/web/assets/{AppOverlays-rUZC1kCv.js → AppOverlays-BlJ0uL_P.js} +1 -1
  5. package/web/assets/{AssetsPage-XEKK_C-R.js → AssetsPage-B9lqKmXy.js} +1 -1
  6. package/web/assets/BoardPage-BB_xAnQV.js +3 -0
  7. package/web/assets/{ChannelsPage-qmX4oWnZ.js → ChannelsPage-DgzuzmFL.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-BfSCRq3M.js → ChatAppearancePage-98Sa8ZQW.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-Dn2KO-xs.js → ChatHistoryPage-BHsZFF4a.js} +1 -1
  10. package/web/assets/ChatPage-C3NC9LNG.js +553 -0
  11. package/web/assets/{ConfigPage-bwrsIfQ2.js → ConfigPage-D3SyAsIs.js} +2 -2
  12. package/web/assets/{DesktopWindowControls-BYSFRwAw.js → DesktopWindowControls-BQ0OvDZ8.js} +1 -1
  13. package/web/assets/{FeaturePage-DTDpEz7O.js → FeaturePage-C0bAQ4el.js} +1 -1
  14. package/web/assets/{FileAttachmentPreview-DSXCj6RP.js → FileAttachmentPreview-BdMgsecO.js} +1 -1
  15. package/web/assets/{FloatingWidgets-BbeW1y-O.js → FloatingWidgets-DjMCcqln.js} +1 -1
  16. package/web/assets/FocusRuntimeControls-DeSe12wJ.js +2 -0
  17. package/web/assets/{GitDiffViewer-DQVUfRzI.js → GitDiffViewer-hHSTzUJk.js} +1 -1
  18. package/web/assets/{ManageProjectsDialog-69xTwGhN.js → ManageProjectsDialog-DVLX4ZBu.js} +1 -1
  19. package/web/assets/{MarkdownMessage-CMM5-pzJ.js → MarkdownMessage-CktdHgKM.js} +1 -1
  20. package/web/assets/{McpPage-DuR_f74H.js → McpPage-7wR_N0eS.js} +1 -1
  21. package/web/assets/{MemoryEvolution-Ulreb-P1.js → MemoryEvolution-DBjU-Nr7.js} +1 -1
  22. package/web/assets/MemoryPage-DiO4GHc7.js +2 -0
  23. package/web/assets/{MobileNavigation-B6e3f9M1.js → MobileNavigation-B2NKM8rj.js} +1 -1
  24. package/web/assets/{MorePage-BAEFRO9r.js → MorePage-xB2zBRtU.js} +1 -1
  25. package/web/assets/{NewFolderDialog-CrIBoIPP.js → NewFolderDialog-CjWMsY2Q.js} +1 -1
  26. package/web/assets/{PageHeader-CkkhGH11.js → PageHeader-BN-qcxte.js} +1 -1
  27. package/web/assets/{PhoneDrawer-BQglMtV6.js → PhoneDrawer-utEXi-yp.js} +1 -1
  28. package/web/assets/{PhoneMenuButton-CudQuQyy.js → PhoneMenuButton-uG_T93KL.js} +1 -1
  29. package/web/assets/{PhoneTopBar-DyaB9qif.js → PhoneTopBar-DuLewk2J.js} +1 -1
  30. package/web/assets/{PluginsPage-DMLkkpQg.js → PluginsPage-D0hAMgQ_.js} +1 -1
  31. package/web/assets/{SafeModePrompt-BWzQ6wxr.js → SafeModePrompt-jV-PRvrW.js} +1 -1
  32. package/web/assets/{SchedulesPage-CvsxgvB6.js → SchedulesPage-Diethe4H.js} +1 -1
  33. package/web/assets/{SessionBrowserPane-NHFA_B4m.js → SessionBrowserPane-y7gPArTV.js} +2 -2
  34. package/web/assets/{SessionContextPanel-DTHjt2nZ.js → SessionContextPanel-Ckca3NrN.js} +2 -2
  35. package/web/assets/{SessionHome-B1OsYR84.js → SessionHome-CcjiU1fU.js} +1 -1
  36. package/web/assets/SessionInspector-CNSyVYK6.js +1 -0
  37. package/web/assets/{SessionShell-BfdEBF6l.js → SessionShell-wOw-rTQD.js} +1 -1
  38. package/web/assets/{SettingsSidebar-z1Fxmoyd.js → SettingsSidebar-CpAD5iSt.js} +1 -1
  39. package/web/assets/{ShortcutHelpDialog-DL3H1yOW.js → ShortcutHelpDialog-C2QbSvui.js} +1 -1
  40. package/web/assets/{ShortcutKeys-DPl0NOHr.js → ShortcutKeys-Dl4Suwhz.js} +1 -1
  41. package/web/assets/{SidebarUpdateStatus-Cpew_R7W.js → SidebarUpdateStatus-DrS7u_v_.js} +1 -1
  42. package/web/assets/{SkillsPage-Dl57veVj.js → SkillsPage-CDoMtK-E.js} +1 -1
  43. package/web/assets/{TaskProcessesPane-B6hiVd6p.js → TaskProcessesPane-Z_9HeVX5.js} +1 -1
  44. package/web/assets/{TaskTerminalView-jBOqCyhw.js → TaskTerminalView-BTCVpAHF.js} +1 -1
  45. package/web/assets/{TerminalPanel-CAl3KAS_.js → TerminalPanel-DuUtaPyf.js} +1 -1
  46. package/web/assets/{WebDesktopPet-kcayOmfs.js → WebDesktopPet-CWviMnct.js} +1 -1
  47. package/web/assets/{WorkflowsPage-DrX0d5UQ.js → WorkflowsPage-CHvyXwCg.js} +1 -1
  48. package/web/assets/{WorkspacePicker-Bt_doGjv.js → WorkspacePicker-D6FLo7O1.js} +1 -1
  49. package/web/assets/{api-C35aq3ml.js → api-Cm58F7OP.js} +1 -1
  50. package/web/assets/{app-update-5vmM-tQ5.js → app-update-KLjtuCDT.js} +1 -1
  51. package/web/assets/{approval-confirm-DhWuPa_J.js → approval-confirm-BrorOUHg.js} +1 -1
  52. package/web/assets/board-messages-3qT8nGsd.js +1 -0
  53. package/web/assets/{board-projects-Nk7cPRh8.js → board-projects-CeL6PPiY.js} +1 -1
  54. package/web/assets/{bots-store-CWuQZKi-.js → bots-store-CRGayU4z.js} +1 -1
  55. package/web/assets/chat-api-DQyHZl-V.js +1 -0
  56. package/web/assets/{client-store-D1Oy98mB.js → client-store-4G-xfNKc.js} +1 -1
  57. package/web/assets/{config-search-C5x1n8SB.js → config-search-1BIdouae.js} +1 -1
  58. package/web/assets/{desktop-hosts-9JgAXtsJ.js → desktop-hosts-uMG7lFRY.js} +1 -1
  59. package/web/assets/{dialog-27CgEIc2.js → dialog-D23yIdOZ.js} +1 -1
  60. package/web/assets/{event-stream-DTCmB4AA.js → event-stream-BrDcABQx.js} +1 -1
  61. package/web/assets/{events-DMbz7S1A.js → events-BgEZwyTb.js} +1 -1
  62. package/web/assets/{folder-paths-BB2PvkZ4.js → folder-paths-D0-7xV2n.js} +1 -1
  63. package/web/assets/{hosts-D81SQ3Fm.js → hosts-DljHKUSO.js} +1 -1
  64. package/web/assets/{http-YNvizzuJ.js → http-DtkTCrZ4.js} +1 -1
  65. package/web/assets/{http-response-Bb_1H1lE.js → http-response-B2n7HFQ4.js} +1 -1
  66. package/web/assets/i18n-B7QmqfvO.js +1 -0
  67. package/web/assets/{index-_WvEqLNn.js → index-79gEOxmD.js} +2 -2
  68. package/web/assets/index-XwGsScbB.css +2 -0
  69. package/web/assets/{machine-messages-Cnbja0tj.js → machine-messages-Bd6JwiOe.js} +1 -1
  70. package/web/assets/{machines-api-p5yRMnI5.js → machines-api-Kg457H3y.js} +1 -1
  71. package/web/assets/{memory-api-CSEqYBZN.js → memory-api-DHLgFXzZ.js} +1 -1
  72. package/web/assets/message-square-text-C5MJw0FL.js +1 -0
  73. package/web/assets/mount-app-BlaI2VZs.js +9 -0
  74. package/web/assets/{permission-rules-api-BM5qRwQ-.js → permission-rules-api-BZn4yp-J.js} +1 -1
  75. package/web/assets/{pick-system-directory-CjwfGZuj.js → pick-system-directory-DS_-qn8W.js} +1 -1
  76. package/web/assets/placements-BMxzzGTX.js +2 -0
  77. package/web/assets/{popover-CaaxkJV6.js → popover-C5U02alK.js} +1 -1
  78. package/web/assets/{public-Cs-VgI_R.js → public-B8mbf50i.js} +1 -1
  79. package/web/assets/public-Be05c5M9.js +2 -0
  80. package/web/assets/{public-bgEdGMBy.js → public-Bq1VrNr8.js} +2 -2
  81. package/web/assets/{public-CTCOj1Tc.js → public-DsjuTTt0.js} +1 -1
  82. package/web/assets/{public-components-Cxirb-D4.js → public-components-CMbKXCZU.js} +1 -1
  83. package/web/assets/public-diff-4sBkfeo8.js +1 -0
  84. package/web/assets/public-events-D2kHUhG2.js +1 -0
  85. package/web/assets/{public-flags-BHDCY_aY.js → public-flags-D8CxujmF.js} +1 -1
  86. package/web/assets/{public-folder-dialog-MAINAiLs.js → public-folder-dialog-Dnmn6DIU.js} +1 -1
  87. package/web/assets/{public-greeting-nLVPlZrv.js → public-greeting-Cs-sacVq.js} +1 -1
  88. package/web/assets/{public-session-qCqrUJ6y.js → public-session-DSLmbBcw.js} +1 -1
  89. package/web/assets/{public-sidebar-D6Ujh_8I.js → public-sidebar-UNJ9_fD1.js} +1 -1
  90. package/web/assets/{runtime-capabilities-store-D_0w_fuG.js → runtime-capabilities-store-Y9MaywP8.js} +1 -1
  91. package/web/assets/{safe-mode-instance-B1xRd2Id.js → safe-mode-instance-CYIRMY5i.js} +1 -1
  92. package/web/assets/safe-mode-sentinel-Bq9lNJoA.js +1 -0
  93. package/web/assets/{session-change-summary-api-Bz6qW3dZ.js → session-change-summary-api-Dp9vVPv_.js} +1 -1
  94. package/web/assets/{session-home-CdOoCouS.js → session-home-DqEkX19H.js} +1 -1
  95. package/web/assets/{session-inspector-store-BUq8tTV4.js → session-inspector-store-D_mwa4K7.js} +1 -1
  96. package/web/assets/{session-organization-api-oAt9Tied.js → session-organization-api-ibzfB8fg.js} +1 -1
  97. package/web/assets/session-questions-94KACguh.js +1 -0
  98. package/web/assets/{session-scope-PFTSXL_B.js → session-scope-BJIZo6ty.js} +1 -1
  99. package/web/assets/{session-tree-actions-D-hQZc07.js → session-tree-actions-B8GDKcGe.js} +1 -1
  100. package/web/assets/{session-tree-summary-gqTig55_.js → session-tree-summary-BTcPaCgY.js} +1 -1
  101. package/web/assets/{shortcuts-B5Q10H38.js → shortcuts-DRfz9B_B.js} +1 -1
  102. package/web/assets/side-chat-context-CRQ33Q0D.js +7 -0
  103. package/web/assets/{sidebar-Dct9J7LY.js → sidebar-DrzZKq2i.js} +1 -1
  104. package/web/assets/{sidebar-store-CHqFyueh.js → sidebar-store-BvZAgxJg.js} +1 -1
  105. package/web/assets/{speech-session-BzWOz7_A.js → speech-session-DGkMojp3.js} +1 -1
  106. package/web/assets/{startup-queries-LEtJRewm.js → startup-queries-BjjeYiQ8.js} +1 -1
  107. package/web/assets/{use-i18n-QY-mTTDS.js → use-i18n-8V6eRMcE.js} +1 -1
  108. package/web/assets/{use-open-bot-BCteAGsU.js → use-open-bot-BEhRmhru.js} +1 -1
  109. package/web/assets/{use-studio-actions-CVQo8gWA.js → use-studio-actions-BsdfCptK.js} +1 -1
  110. package/web/assets/{useCatalogProjects-B0P8PrPz.js → useCatalogProjects-DKjmAJ2x.js} +1 -1
  111. package/web/assets/{useMachines-D-YSauyl.js → useMachines-BBeg2uOZ.js} +1 -1
  112. package/web/assets/useNewProjectPicker-Cmw2SOhW.js +2 -0
  113. package/web/assets/{useNow-CvnDomJ8.js → useNow-D-gM4IXU.js} +1 -1
  114. package/web/assets/{usePhoneShell-Cv5Or-Rz.js → usePhoneShell-DRZTDDgZ.js} +1 -1
  115. package/web/assets/useSessionListQuery-DtpEX8a5.js +2 -0
  116. package/web/assets/{useSessionRowActions-DaVD7CkP.js → useSessionRowActions-DBqnVodk.js} +1 -1
  117. package/web/assets/{useSidebarModel-KU2-5Lqq.js → useSidebarModel-DBH3JLQ1.js} +1 -1
  118. package/web/assets/{workspace-folders-BrwI22Ku.js → workspace-folders-Bu3t-gEw.js} +1 -1
  119. package/web/assets/{workspace-order-store-04YPBRRV.js → workspace-order-store-DmEFuNUL.js} +1 -1
  120. package/web/index.html +2 -2
  121. package/web/assets/BoardPage-DsRRgaSA.js +0 -3
  122. package/web/assets/ChatPage-saAM1R5P.js +0 -553
  123. package/web/assets/FocusRuntimeControls-CUqEkAM6.js +0 -1
  124. package/web/assets/MemoryPage-BSAhhmdG.js +0 -2
  125. package/web/assets/SessionInspector-CIfPX9LJ.js +0 -1
  126. package/web/assets/board-messages-D6AWGHuF.js +0 -1
  127. package/web/assets/chat-api-fzSB1i2N.js +0 -1
  128. package/web/assets/focus-session-composer-bits-B_mOqktE.js +0 -1
  129. package/web/assets/i18n-CWhhZ2QN.js +0 -1
  130. package/web/assets/index-BTqJTVNA.css +0 -2
  131. package/web/assets/mount-app-Dee6SQOq.js +0 -9
  132. package/web/assets/placements-BvtgsaIH.js +0 -2
  133. package/web/assets/public-DW6Tkvj2.js +0 -2
  134. package/web/assets/public-diff-B2iBx26D.js +0 -1
  135. package/web/assets/public-events-QnPYL1F-.js +0 -1
  136. package/web/assets/safe-mode-sentinel-DmNv7ZYs.js +0 -1
  137. package/web/assets/session-questions-Cf-1g85h.js +0 -1
  138. package/web/assets/side-chat-context-CoDP1BZc.js +0 -7
  139. package/web/assets/useNewProjectPicker-V3_nwv5l.js +0 -2
  140. package/web/assets/useSessionListQuery-CuUmG2UC.js +0 -2
@@ -0,0 +1,7 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AnimatedList-DB5vqafO.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/vendor-motion-DSW3wzXK.js","assets/react-bits-BsPlLi8F.css","assets/public-session-DSLmbBcw.js","assets/vendor-router-CSN_DGvx.js","assets/use-i18n-8V6eRMcE.js","assets/i18n-B7QmqfvO.js","assets/index-79gEOxmD.js","assets/index-XwGsScbB.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/settings-2-CXJjXJS9.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/BotAvatar-CNL-APwP.js","assets/motion-DTR4ZVle.js","assets/bots-store-CRGayU4z.js","assets/startup-queries-BjjeYiQ8.js","assets/query-DFQayLF5.js","assets/mutation-b4pPvB7p.js","assets/api-Cm58F7OP.js","assets/abort-signal-f4JsiYKX.js","assets/http-response-B2n7HFQ4.js","assets/event-stream-BrDcABQx.js","assets/http-DtkTCrZ4.js","assets/workspace-folders-Bu3t-gEw.js","assets/public-flags-D8CxujmF.js","assets/runtime-capabilities-CPDBo3tu.js","assets/runtime-capabilities-store-Y9MaywP8.js","assets/events-BgEZwyTb.js","assets/public-events-D2kHUhG2.js","assets/public-greeting-Cs-sacVq.js","assets/arrow-right-DqLOhpA2.js","assets/check-2vYc6QaP.js","assets/WorkspacePicker-D6FLo7O1.js","assets/arrow-up-DST6-qVQ.js","assets/chevron-right-C3t2Rckj.js","assets/folder-open-FIShC5Qk.js","assets/folder-DPM8D8cf.js","assets/triangle-alert-CE1q54ci.js","assets/dialog-D23yIdOZ.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/input-CPw-zkYh.js","assets/PageState-Cz6vFMXv.js","assets/alert-DRIrgNI4.js","assets/message-circle-D-XrK6Ft.js","assets/separator-BPh_qxvc.js","assets/pick-system-directory-DS_-qn8W.js","assets/AppSelect-DQYKUW5E.js","assets/use-mobile-C2tPBAza.js","assets/select-Bbk9bmXO.js","assets/chevron-down-CxtxIjiP.js","assets/chevron-up-D_ZcXjqr.js","assets/chevrons-up-down-C2sEPdAh.js","assets/dist-BiRPwy4W.js","assets/dist-DzGQ7sLi.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/dist-BS3ekNDj.js","assets/ClickSpark-B1Rn7ZwL.js","assets/approval-confirm-BrorOUHg.js","assets/shield-alert-oZqX6MNu.js","assets/kbd-CAufZTkl.js","assets/sheet-BTaIEX4w.js","assets/card-presentation-1oph2b8P.js","assets/session-board-status-D2lpFPiI.js","assets/HoldToConfirmButton-BxdJ7icc.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,n as r,r as i}from"./vendor-react-DwNgTV1j.js";import{f as a}from"./routes-DIeaqWVc.js";import{r as o}from"./i18n-B7QmqfvO.js";import{t as s}from"./use-i18n-8V6eRMcE.js";import{n as c}from"./http-DtkTCrZ4.js";import{a as l}from"./session-board-status-D2lpFPiI.js";import{t as u}from"./usePhoneShell-DRZTDDgZ.js";import{t as d}from"./createLucideIcon-Cd-3GVxJ.js";import{n as f,r as p,t as m}from"./permission-rules-api-BZn4yp-J.js";import{t as h}from"./arrow-down-CDGua-ue.js";import{t as g}from"./check-2vYc6QaP.js";import{t as _}from"./chevron-down-CxtxIjiP.js";import{t as v}from"./chevron-left-BAtyp3_6.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./chevron-up-D_ZcXjqr.js";import{t as x}from"./copy-DHmIFc52.js";import{t as S}from"./download-BCfIiuaL.js";import{t as C}from"./ellipsis-CfGKfbq6.js";import{t as w}from"./eye-uWAPXNzJ.js";import{a as T,o as E,t as D}from"./GitDiffViewer-hHSTzUJk.js";import{t as O}from"./file-Bllajneu.js";import{t as k}from"./folder-open-FIShC5Qk.js";import{t as A}from"./info-DATxy0fb.js";import{r as j,t as M}from"./undo-2-C-xQ0UVT.js";import{t as N}from"./loader-circle-BOwQzHB-.js";import{t as P}from"./message-square-text-C5MJw0FL.js";import{t as F}from"./refresh-cw-TbWxTY4K.js";import{t as I}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as L}from"./rotate-ccw-C0v8V77_.js";import{t as R}from"./shield-alert-oZqX6MNu.js";import{t as ee}from"./shield-check-Gvek4RJ7.js";import{t as z}from"./square-bHHVTT3G.js";import{t as B}from"./tag-CqkeJlBf.js";import{t as V}from"./trash-2-CNrPOoPR.js";import{t as H}from"./x-07u4-129.js";import{i as te,p as ne,r as re,t as U}from"./dropdown-menu-Ds0gD8S8.js";import{i as W,n as ie,r as G,t as ae}from"./popover-C5U02alK.js";import{i as oe,n as se,t as ce}from"./tooltip-D4MFbqcG.js";import{t as K}from"./utils-C8uzG5AZ.js";import{n as le,t as q}from"./button-CCcCN8tE.js";import{a as ue,d as de,m as fe,o as pe,y as me}from"./events-BgEZwyTb.js";import{a as he,c as ge,g as _e,n as ve}from"./shortcuts-DRfz9B_B.js";import{t as ye}from"./chat-api-DQyHZl-V.js";import{r as be}from"./format-DMJQzoZ7.js";import{t as xe}from"./StatusGlyph-1KgitlUg.js";import{d as Se,f as Ce,l as we,m as Te,n as Ee,p as J,r as De,s as Oe,t as ke}from"./run-activity-CwfO0cui.js";import{t as Ae}from"./input-CPw-zkYh.js";import{t as je}from"./PageState-Cz6vFMXv.js";import{t as Me}from"./alert-DRIrgNI4.js";import{t as Ne}from"./vendor-motion-DSW3wzXK.js";import{i as Pe,n as Fe,r as Ie,t as Le}from"./MarkdownMessage-CktdHgKM.js";import{t as Re}from"./route-context-DvWDul4T.js";import{t as ze}from"./esm-DCV8yILT.js";import{t as Be}from"./motion-DTR4ZVle.js";import{t as Ve}from"./HoldToConfirmButton-BxdJ7icc.js";import{t as He}from"./card-C3A0b5KR.js";import{n as Ue,r as We}from"./session-web-preview-guvsmkWE.js";import{t as Ge}from"./BrandLogo-k3CvJjd4.js";import{n as Ke,r as qe,t as Je}from"./collapsible-Dcoy-qnz.js";import{a as Ye,o as Xe,r as Ze,t as Qe}from"./session-tree-summary-BTcPaCgY.js";import{t as $e}from"./FileAttachmentPreview-BdMgsecO.js";var et=d(`files`,[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]),tt=d(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),nt=d(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),rt=d(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),it=d(`octagon-pause`,[[`path`,{d:`M10 15V9`,key:`1lckn7`}],[`path`,{d:`M14 15V9`,key:`1muqhk`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}]]),at=d(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Y=e(n(),1),ot=Object.freeze({messages:[],tools:[],approvals:[],questions:[],agents:[],team:null,currentActivity:null,activityFeed:[],lifecycle:null,sessionTreeRevision:0,thinkingText:``,queuedInputs:[],hadQueuedInput:!1,plan:null,executionMode:null,runMode:null,contextUsage:null,sessionUsage:null,promptCache:null,compaction:null,streaming:!1,error:``,loaded:!1,messageStart:null,hasOlder:!1,olderCursor:null});function st(e,t){if(e===t)return!1;if(!e||!t)return!0;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n)if(e[r]!==t[r])return!0;return!1}function ct(e,t){let n=e||ot,r=typeof t==`function`?t(n):{...n,...t};return st(n,r)?r:n}function lt(e,t){return t===void 0?e||[]:Array.isArray(t)?t:[]}function ut(e,t){return Number.isSafeInteger(e.queueRevision)&&Number.isSafeInteger(t.queueRevision)&&t.queueRevision<e.queueRevision}function dt(e,t){let n=t.removedInputId?[...new Set([...e.withdrawnInputIds||[],t.removedInputId])]:e.withdrawnInputIds||[],r=new Set(n),i=r.size?e.messages.filter(e=>!r.has(e.queuedInputId??``)):e.messages;if(ut(e,t))return{...e,messages:i,withdrawnInputIds:n};let a=lt(e.queuedInputs,t.queuedInputs);return{...e,messages:i,withdrawnInputIds:n,queuedInputs:r.size?a.filter(e=>!r.has(e.id)):a,...Number.isSafeInteger(t.queueRevision)?{queueRevision:t.queueRevision}:{},hadQueuedInput:!!(e.hadQueuedInput||a.length)}}function ft(e){return e?.role===`user`&&e.queuedPending===!0}function pt(e=[]){let t=e.length-1;for(;t>=0&&(ft(e[t])||e[t]?.role===`event`);)--t;return t}function mt(e=[],t){let n=Array.isArray(e)?e:[];if(ft(t))return[...n,t];let r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]?.role===`agent`){r=e;break}return r<0?[...n,t]:[...n.slice(0,r),t,...n.slice(r)]}function ht(e,{agentId:t,deliveredIds:n,frozenText:r,interrupted:i}){if(!n.length)return e;let a=new Set(n),o=e=>e.role===`user`&&typeof e.queuedInputId==`string`&&a.has(e.queuedInputId),s=e.messages.filter(o).map(e=>({...e,queuedPending:!1})),c=e.messages.filter(e=>!o(e)),l=[...new Set([...e.deliveredInputIds||[],...n])],u=c.findIndex(e=>e.id===t);if(u<0)return{...e,deliveredInputIds:l};let d=c[u],f=c.filter(e=>e.id.startsWith(`${t}-part-`)).length,p=r?[{id:`${t}-part-${f+1}`,role:`agent`,text:r,streaming:!1,...i?{interrupted:!0}:{}}]:[];return{...e,deliveredInputIds:l,messages:[...c.slice(0,u),...p,...s,r?{...d,text:``}:d,...c.slice(u+1)]}}function gt(e){return!!(e?.streaming||e?.recovering||e?.pendingRuntimeSelection||e?.switchingModel||e?.switchingThinking||e?.agents?.some(e=>[`queued`,`starting`,`running`].includes(e.status)))}function _t(e){return!!(e&&(e.streaming||String(e.thinkingText||``).trim()||e.tools?.length||e.currentActivity?.type===`agent`||e.activityFeed?.some(e=>e.type===`agent`)||e.team))}function vt(e,t,n){return t&&_t(n)?n:_t(e.runActivity)?e.runActivity:null}function yt(e,t){if(e&&(e.loaded||e.streaming||J(e)!==void 0))return Te(e,null);let n=J(t);return n===void 0?Te(e,null):n}function bt(e,t={}){return!!e?.items?.length}var xt=(0,Y.createContext)(null);function St(e,t,n=!1){let r=Object.fromEntries(T(e).filter(e=>e.hunks.length>0).map(e=>{let t=0,n=0;for(let r of e.hunks)for(let e of r.rows)e.kind===`pair`&&(e.next.tone===`added`&&t++,e.old.tone===`deleted`&&n++);return[e.path,{added:t,removed:n}]}));return{added:Object.values(r).reduce((e,t)=>e+t.added,0),removed:Object.values(r).reduce((e,t)=>e+t.removed,0),partial:n||t.some(e=>!Object.hasOwn(r,e)),files:r}}var X=i(),Ct=e(r(),1),wt=(0,Y.createContext)(null),Tt=(0,Y.createContext)(null),Et=(0,Y.createContext)(null);function Dt({error:e,title:t,pending:n=!1,onRetry:r,className:i}){let{t:a}=s(),[o,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1);return(0,X.jsx)(Me,{role:`group`,className:K(`min-w-0 rounded-md border-stroke bg-surface-subtle px-3 py-2 text-content-secondary`,i),children:(0,X.jsxs)(Je,{open:o,onOpenChange:c,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,X.jsxs)(`div`,{role:`status`,className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[n?(0,X.jsx)(le,{className:`size-4`}):(0,X.jsx)(A,{"aria-hidden":`true`,className:`size-4 shrink-0 text-content-muted`}),(0,X.jsx)(`span`,{children:t||a(`chat:requestNotice.incomplete`)})]}),r&&(0,X.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 shrink-0 gap-1 px-2 text-xs text-content-secondary max-[650px]:min-h-11 pointer-coarse:min-h-11`,disabled:n||l,onClick:async()=>{if(!l){u(!0);try{await r()}catch{}finally{u(!1)}}},children:[(0,X.jsx)(L,{"aria-hidden":`true`,className:K(`size-3.5`,l&&`animate-spin`)}),a(`chat:chatMessage.retry`)]}),e&&(0,X.jsx)(qe,{asChild:!0,children:(0,X.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 shrink-0 gap-1 px-2 text-xs text-content-muted max-[650px]:min-h-11 pointer-coarse:min-h-11`,children:[a(o?`chat:requestNotice.hideDetails`:`chat:requestNotice.showDetails`),(0,X.jsx)(_,{"aria-hidden":`true`,className:K(`size-3 transition-transform`,o&&`rotate-180`)})]})})]}),(0,X.jsx)(Ke,{children:(0,X.jsx)(`pre`,{tabIndex:0,"aria-label":a(`chat:requestNotice.details`),className:`mt-2 max-h-48 overflow-auto rounded-sm border border-stroke-soft bg-code p-[8px_10px] font-mono text-[12px] leading-[1.6] whitespace-pre-wrap text-content-soft [overflow-wrap:anywhere] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus`,children:e})})]})})}var Ot=[`queued`,`starting`,`running`,`completed`,`failed`,`interrupted`];function kt(e){return e.status===`queued`||e.status===`starting`||e.status===`running`}function Z(e,t=500){return typeof e==`string`?e.slice(0,t):``}function At(e){let t=e&&typeof e==`object`?e.agents:void 0;return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e,n=Ot.find(e=>e===t.status);if(typeof t.id!=`string`||!t.id||!n)return[];let r=t.currentActivity&&typeof t.currentActivity==`object`?t.currentActivity:{},i=Number(t.toolCallCount);return[{id:t.id,kind:t.kind===`command`?`command`:`agent`,taskName:Z(t.title,120)||Z(t.taskName,120)||`agent`,status:n,message:Z(t.message),model:Z(t.model,120),output:Z(t.output),error:Z(t.error),startedAt:Z(t.startedAt,40),completedAt:Z(t.completedAt,40)||null,toolCallCount:Number.isInteger(i)&&i>0?i:0,activity:Z(r.name,80)||Z(r.stage,40)}]}):[]}var jt=[`waiting`,`answered`,`stopped`];function Mt(e){let t=e&&typeof e==`object`?e.links:void 0;return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e,n=jt.find(e=>e===t.status);return typeof t.id!=`string`||!t.id||typeof t.botId!=`string`||!n?[]:[{id:t.id,botId:t.botId,direction:t.direction===`in`?`in`:`out`,text:Z(t.text,300),status:n,reason:Z(t.reason,20),openedAt:Z(t.openedAt,40)}]}):[]}function Nt(e,t){return c(`/api/sessions/${encodeURIComponent(e)}/agents`,{signal:t,parse:e=>({agents:At(e),links:Mt(e)})})}function Pt(e,t){return c(`/api/sessions/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}/stop`,{method:`POST`,data:{}})}var Ft=(0,Y.createContext)(null),It=2500,Lt=15e3;function Rt(e,t,n){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)([]),[s,c]=(0,Y.useState)(0),l=(0,Y.useRef)(!1),u=(0,Y.useRef)(null),d=(0,Y.useRef)(null),f=(0,Y.useRef)(new Set),p=(0,Y.useRef)(n);return p.current=n,(0,Y.useEffect)(()=>{i([]),o([]),u.current=null,d.current=null,f.current=new Set},[e]),(0,Y.useEffect)(()=>{if(!t||!e)return;let n=new AbortController,r=0,a=async()=>{try{let t=await Nt(e,n.signal);if(n.signal.aborted)return;let r=t.agents,a=new Set(t.links.filter(e=>e.status===`waiting`).map(e=>e.id));l.current=r.some(kt)||a.size>0;let s=new Set(r.filter(kt).map(e=>e.id)),c=u.current,m=d.current,h=[...f.current].some(e=>!a.has(e));u.current=s,d.current=new Set(r.map(e=>e.id)),f.current=a,(h||c&&m&&([...c].some(e=>!s.has(e))||r.some(e=>!m.has(e.id)&&!kt(e))))&&p.current?.(),i(r),o(t.links)}catch{}n.signal.aborted||(r=window.setTimeout(a,l.current?It:Lt))};return a(),()=>{n.abort(),window.clearTimeout(r)}},[t,s,e]),{agents:r,links:a,reload:(0,Y.useCallback)(()=>c(e=>e+1),[])}}function zt(e){return{id:`agent-event-${e.id}`,role:`event`,timestamp:e.startedAt,agentId:e.id}}function Bt(e){let t=e.timestamp;if(typeof t==`number`)return t;let n=typeof t==`string`?Date.parse(t):NaN;return Number.isFinite(n)?n:null}function Vt(e){return{id:`link-event-${e.id}`,role:`event`,timestamp:e.openedAt,linkId:e.id}}function Ht(e,t,n=[]){if(!t.length&&!n.length)return e;let r=[...t.map(zt),...n.map(Vt)].sort((e,t)=>(Bt(e)??0)-(Bt(t)??0)),i=[],a=0,o=-1/0;for(let t of e){for(o=Bt(t)??o;a<r.length&&(Bt(r[a])??0)<o;)i.push(r[a++]);i.push(t)}for(;a<r.length;)i.push(r[a++]);return i}function Ut(e,{threshold:t=64,onUnreadChange:n,requestFrame:r=e=>requestAnimationFrame(e),cancelFrame:i=e=>cancelAnimationFrame(e),reducedMotion:a}){let o=e.ownerDocument,s=o.defaultView?.matchMedia?.(`(prefers-reduced-motion: reduce)`),c=a||(()=>{let e=o.documentElement.dataset.motion;return e===`reduced`||e!==`full`&&!!s?.matches}),l=!0,u=!1,d=!1,f=null,p=null,m=null,h=e.scrollTop,g=!1,_=!1,v=null,y=()=>Math.max(0,e.scrollHeight-e.clientHeight),b=()=>_||v!==null,x=()=>h-e.scrollTop>Math.max(t,e.clientHeight/2)&&y()-e.scrollTop>t,S=e=>{u!==e&&(u=e,n(e))},C=()=>{p!==null&&i(p),p=null},w=()=>{f!==null&&i(f),f=null,m=null,C(),g=!1,h=e.scrollTop},T=()=>{C(),g=!0},E=()=>{C(),p=r(()=>{p=r(()=>{if(p=null,x()){A();return}if(l&&!b()&&Math.abs(y()-e.scrollTop)>1){k();return}g=!1,h=e.scrollTop})})},D=t=>{e.scrollTo({top:t,behavior:`instant`}),h=e.scrollTop},O=t=>{if(f=null,d||!l||b())return;if(x()){A();return}let n=y(),i=n-e.scrollTop,a=m===null?1e3/60:Math.min(64,t-m);m=t;let o=1-.85**(Math.max(0,a)/(1e3/60));if(c()||Math.abs(i)<=1){i!==0&&D(n),m=null,E();return}D(e.scrollTop+Math.sign(i)*Math.min(Math.abs(i),Math.max(1,Math.abs(i)*o))),f=r(O)},k=()=>{d||!l||b()||(T(),f===null&&(f=r(O)))},A=()=>{d||(l=!1,w())},j=()=>{l=!0,S(!1),k()},M=()=>{if(d)return;if(g){x()&&A();return}let n=e.scrollTop-h;h=e.scrollTop,n<-.5&&y()-e.scrollTop>1?A():n>.5&&y()-e.scrollTop<=t&&j()},N=t=>{t.ctrlKey||Math.abs(t.deltaX)>Math.abs(t.deltaY)||(t.deltaY<0?A():t.deltaY>0&&y()-e.scrollTop<=1&&j())},P=e=>{let t=e.touches[0];t&&(v={x:t.clientX,y:t.clientY},w())},F=e=>{let t=e.touches[0];if(!t||!v)return;let n=t.clientX-v.x,r=t.clientY-v.y;Math.abs(r)<2||(r>0&&r>Math.abs(n)&&A(),v={x:t.clientX,y:t.clientY})},I=()=>{v=null,k()},L=e=>{e.pointerType===`touch`||e.button>1||(_=!0,w())},R=()=>{_&&(_=!1,k())},ee=e=>{let t=e.target;e.defaultPrevented||t?.closest?.(`input, textarea, select, [contenteditable]`)||(e.key===`ArrowUp`||e.key===`PageUp`||e.key===`Home`||e.key===` `&&e.shiftKey)&&A()};e.addEventListener(`scroll`,M,{passive:!0}),e.addEventListener(`wheel`,N,{passive:!0}),e.addEventListener(`touchstart`,P,{passive:!0}),e.addEventListener(`touchmove`,F,{passive:!0}),e.addEventListener(`touchend`,I,{passive:!0}),e.addEventListener(`touchcancel`,I,{passive:!0}),e.addEventListener(`pointerdown`,L,{passive:!0}),e.addEventListener(`keydown`,ee),o.addEventListener(`pointerup`,R,{passive:!0}),o.addEventListener(`pointercancel`,R,{passive:!0}),s?.addEventListener?.(`change`,k);let z=typeof ResizeObserver>`u`?null:new ResizeObserver(k);return z?.observe(e),{maintainBottom:k,pauseFollowing:A,restorePosition(e){d||!Number.isFinite(e)||(A(),S(!1),D(Math.max(0,e)))},contentChanged(){d||(l?k():S(!0))},scrollToBottom(e=`auto`){d||(w(),l=!0,S(!1),e===`smooth`?k():(T(),D(y()),E()))},dispose(){d=!0,w(),z?.disconnect(),e.removeEventListener(`scroll`,M),e.removeEventListener(`wheel`,N),e.removeEventListener(`touchstart`,P),e.removeEventListener(`touchmove`,F),e.removeEventListener(`touchend`,I),e.removeEventListener(`touchcancel`,I),e.removeEventListener(`pointerdown`,L),e.removeEventListener(`keydown`,ee),o.removeEventListener(`pointerup`,R),o.removeEventListener(`pointercancel`,R),s?.removeEventListener?.(`change`,k)}}}function Wt(e,{threshold:t=64,resetKey:n,readInitialPosition:r}={}){let i=(0,Y.useRef)(r);i.current=r;let a=(0,Y.useRef)(null),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(null),d=(0,Y.useCallback)(e=>{a.current=e,s(e)},[]);return(0,Y.useLayoutEffect)(()=>{if(!o)return;let e=Ut(o,{threshold:t,onUnreadChange:l});u.current=e,l(!1);let n=i.current?.();return typeof n==`number`?e.restorePosition(n):e.scrollToBottom(),()=>{e.dispose(),u.current=null}},[n,o,t]),(0,Y.useEffect)(()=>{u.current?.contentChanged()},[e]),{scrollRef:a,scrollElement:o,setScrollRef:d,hasUnread:c,scrollToBottom:(0,Y.useCallback)((e=`auto`)=>{u.current?.scrollToBottom(e)},[]),maintainBottom:(0,Y.useCallback)(()=>{u.current?.maintainBottom()},[]),pauseFollowing:(0,Y.useCallback)(()=>{u.current?.pauseFollowing()},[])}}function Gt(e){let t=e.runActivity,n=t?.activityFeed,r=t?.tools;return Array.isArray(n)&&n.length?n.length:Array.isArray(r)?r.length:0}function Kt(e){return String(e||``).split(`
3
+ `).map(e=>e.trim()).find(Boolean)||``}function qt(e,{turnsKnown:t}){let n=-1;for(let t=pt(e);t>=0;--t)if(e[t]?.role===`user`){n=t;break}if(n<=0)return null;let r=-1,i=0;for(let t=0;t<n;t+=1)e[t]?.role===`user`&&(r=t,i+=1);let a=0,o=!1;for(let t=Math.max(0,r);t<n;t+=1){let n=e[t];n?.role===`agent`&&(a+=Gt(n),o=!!n.error)}return{latestIndex:n,turnBase:i,previous:{turn:t&&r>=0?i:null,text:r>=0?Kt(e[r]?.text):``,operations:a,failed:o}}}function Jt({text:e,copyLabel:t,getText:n}){let{t:r}=s(),[i,a]=(0,Y.useState)(`idle`),o=(0,Y.useRef)(0),c=(0,Y.useRef)(null);(0,Y.useEffect)(()=>(a(`idle`),()=>{o.current+=1,c.current!==null&&clearTimeout(c.current)}),[e]);let l=async()=>{if(i===`pending`||i===`copied`)return;let t=++o.current;c.current!==null&&clearTimeout(c.current),a(`pending`);try{if(await navigator.clipboard.writeText(n?.()||e),t!==o.current)return;a(`copied`),c.current=setTimeout(()=>a(`idle`),1800)}catch{t===o.current&&a(`failed`)}},u=i===`copied`?r(`common:markdownMessage.copied`):t??r(`chat:chatMessage.copyReply`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(ce,{children:[(0,X.jsx)(oe,{asChild:!0,children:(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,disabledMode:`focusable`,"aria-label":u,"aria-busy":i===`pending`||void 0,"aria-disabled":i===`pending`||i===`copied`||void 0,onClick:i===`copied`||i===`pending`?void 0:()=>void l(),children:i===`copied`?(0,X.jsx)(g,{size:16,className:`text-success`}):i===`pending`?(0,X.jsx)(N,{size:16,className:`animate-spin`}):(0,X.jsx)(x,{size:16})})}),(0,X.jsx)(se,{children:u})]}),(0,X.jsx)(`span`,{role:`status`,className:i===`failed`?`order-last basis-full text-xs text-destructive`:`sr-only`,children:i===`failed`?r(`chat:chatMessage.copyReplyFailed`):i===`copied`?r(`common:markdownMessage.copied`):``})]})}var Yt=new Map,Xt=e=>{let t=Yt.get(e);return t||(t=Ne.create(e),Yt.set(e,t)),t};(0,Y.memo)(({children:e,as:t=`p`,className:n,duration:r=2,spread:i=2})=>{let a=Xt(t),o=(0,Y.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,X.jsx)(a,{animate:{backgroundPosition:`0% center`},className:K(`relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent`,`[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]`,n),initial:{backgroundPosition:`100% center`},style:{"--spread":`${o}px`,backgroundImage:`var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))`},transition:{duration:r,ease:`linear`,repeat:1/0},children:e})});var Zt=(0,Y.createContext)(null),Qt=({className:e,isStreaming:t=!1,children:n,...r})=>{let i=(0,Y.useMemo)(()=>({isStreaming:t}),[t]);return(0,X.jsx)(Zt.Provider,{value:i,children:(0,X.jsx)(Je,{asChild:!0,"data-slot":`plan`,...r,children:(0,X.jsx)(He,{className:K(`shadow-none`,e),children:n})})})},$t=({defaultOpen:e=!0,className:t,...n})=>(0,X.jsx)(Je,{className:K(t),defaultOpen:e,...n}),en=4e3,tn=`… earlier output omitted …`;function nn(e){let t=String(e||``),n=``;for(let e=0;e<t.length;e+=1){let r=t.charCodeAt(e);if(r===27){let n=t.charCodeAt(e+1);if(n===91)for(e+=2;e<t.length&&t.charCodeAt(e)<64;)e+=1;else if(n===93)for(e+=2;e<t.length;){let n=t.charCodeAt(e);if(n===7)break;if(n===27&&t.charCodeAt(e+1)===92){e+=1;break}e+=1}else e+=1;continue}(r===9||r===10||r===13||r>=32&&r!==127)&&(n+=t[e])}return n}function rn(e,t=en){let n=String(e||``),r=Math.max(1,Math.floor(Number(t)||4e3));if(n.length<=r)return{text:nn(n),truncated:!1};let i=n.slice(-r),a=i.indexOf(`
4
+ `);return a>=0&&a<Math.floor(r/3)&&(i=i.slice(a+1)),{text:nn(`${tn}\n${i}`),truncated:!0}}function an(e,t){return e===`read`?t(`chat:agentRunActivity.readingFiles`):e===`grep`?t(`chat:agentRunActivity.searchingContent`):e===`find`?t(`chat:agentRunActivity.findingFiles`):e===`ls`?t(`chat:agentRunActivity.browsingDirectories`):e===`edit`?t(`chat:agentRunActivity.editingFiles`):e===`write`?t(`chat:agentRunActivity.writingFiles`):e===`bash`?t(`chat:agentRunActivity.runningCommands`):e===`codemode`?t(`chat:agentRunActivity.runningScript`):e===`memory_search`?t(`chat:agentRunActivity.searchingMemory`):e===`memory_remember`?t(`chat:agentRunActivity.savingMemory`):e===`memory_open`?t(`chat:agentRunActivity.openingMemory`):e===`memory_confirm`?t(`chat:agentRunActivity.confirmingMemory`):e===`memory_forget`?t(`chat:agentRunActivity.forgettingMemory`):e===`spawn_agent`?t(`chat:agentRunActivity.startingSubagent`):e===`list_agents`?t(`chat:agentRunActivity.checkingSubagents`):e===`send_message`?t(`chat:agentRunActivity.messagingSubagent`):e===`send_team_message`?t(`chat:agentRunActivity.messagingTeamMember`):e===`list_team_members`?t(`chat:agentRunActivity.checkingTeamMembers`):e===`run_team_workflow`?t(`chat:agentRunActivity.runningTeamWorkflow`):e===`followup_task`?t(`chat:agentRunActivity.addingSubagentTask`):e===`wait_agent`?t(`chat:agentRunActivity.waitingForSubagent`):e===`interrupt_agent`?t(`chat:agentRunActivity.interruptingSubagent`):we(e)?t(`chat:agentRunActivity.readingPlan`):Se(e)?t(`chat:agentRunActivity.updatingPlan`):e===`browser_automation`?t(`chat:agentRunActivity.controllingBrowser`):e===`computer_use`?t(`chat:agentRunActivity.operatingComputer`):e===`observe_ui`||e===`inspect_ui`||e===`expand_ui`?t(`chat:agentRunActivity.observingInterface`):e===`act_ui`?t(`chat:agentRunActivity.operatingInterface`):e===`search_ui`?t(`chat:agentRunActivity.searchingInterface`):e===`find_roots`?t(`chat:agentRunActivity.findingAppWindows`):e===`ocr_ui`?t(`chat:agentRunActivity.readingInterfaceText`):e===`wait_for`?t(`chat:agentRunActivity.waitingForInterface`):e===`read_text`?t(`chat:agentRunActivity.readingInterfaceText`):e===`generate_visual`?t(`chat:agentRunActivity.generatingVisualContent`):e===`discover_tools`?t(`chat:agentRunActivity.discoveringTools`):t(`chat:agentRunActivity.usingTool`,{tool:String(e||t(`chat:agentRunActivity.tools`))})}function on(e,t){return e===`read`?t(`chat:agentRunActivity.filesRead`):e===`grep`?t(`chat:agentRunActivity.searchCompleted`):e===`find`?t(`chat:agentRunActivity.findCompleted`):e===`ls`?t(`chat:agentRunActivity.directoriesBrowsed`):e===`edit`?t(`chat:agentRunActivity.filesEdited`):e===`write`?t(`chat:agentRunActivity.filesWritten`):e===`bash`?t(`chat:agentRunActivity.commandCompleted`):e===`codemode`?t(`chat:agentRunActivity.scriptCompleted`):e===`spawn_agent`?t(`chat:agentRunActivity.subagentStarted`):e===`send_team_message`?t(`chat:agentRunActivity.teamMessageSent`):e===`list_team_members`?t(`chat:agentRunActivity.teamMembersListed`):e===`run_team_workflow`?t(`chat:agentRunActivity.teamWorkflowStarted`):e===`wait_agent`?t(`chat:agentRunActivity.subagentStatusUpdated`):e===`observe_ui`||e===`inspect_ui`||e===`expand_ui`?t(`chat:agentRunActivity.interfaceObserved`):e===`act_ui`?t(`chat:agentRunActivity.interfaceActionCompleted`):e===`ocr_ui`||e===`read_text`?t(`chat:agentRunActivity.interfaceTextRead`):Se(e)?t(`chat:agentRunActivity.planUpdated`):t(e===`discover_tools`?`chat:agentRunActivity.toolsDiscovered`:`chat:agentRunActivity.currentOperationCompleted`)}function sn(e,t,n){return n(e===`queued`?`chat:agentRunActivity.agentQueued`:e===`starting`?`chat:agentRunActivity.agentStarting`:e===`running`?`chat:agentRunActivity.agentRunning`:e===`completed`?`chat:agentRunActivity.agentCompleted`:e===`interrupted`?`chat:agentRunActivity.agentInterrupted`:e===`failed`?`chat:agentRunActivity.agentFailed`:`chat:agentRunActivity.agentStatusUpdated`,{name:t})}function cn(e,t){let n=e?.items||[],r=e?.counts?.completed??n.filter(e=>e.status===`completed`).length,i=e?.counts?.inProgress??n.filter(e=>e.status===`in_progress`).length;return[n.length?t(`chat:agentRunActivity.completedTotalCompleted`,{completed:r,total:n.length}):``,i?t(`chat:agentRunActivity.countInProgress`,{count:i}):``].filter(Boolean).join(` · `)||t(`chat:agentRunActivity.planCleared`)}function ln(e,t){return e.kind===`removed`?t(`chat:agentRunActivity.removedTitle`,{title:e.title}):e.status===`completed`?t(`chat:agentRunActivity.completedTitle`,{title:e.title}):e.status===`in_progress`?t(`chat:agentRunActivity.inProgressTitle`,{title:e.title}):e.status===`blocked`?t(`chat:agentRunActivity.blockedTitle`,{title:e.title}):e.kind===`added`?t(`chat:agentRunActivity.addedTitle`,{title:e.title}):t(`chat:agentRunActivity.pendingTitle`,{title:e.title})}function un(e,t){return e?.active?e.reason===`overflow`?t(`chat:agentRunActivity.contextIsFullTheRequestWillRetryAfterCompaction`):e.reason===`manual`?t(`chat:agentRunActivity.summarizingOlderMessagesAsRequested`):t(`chat:agentRunActivity.contextIsNearingItsLimitSummarizingOlderMessages`):e?.tokensBefore!=null&&e?.estimatedTokensAfter!=null?t(`chat:agentRunActivity.contextCompactedBeforeAfterTokens`,{before:be(e.tokensBefore),after:be(e.estimatedTokensAfter)}):t(`chat:agentRunActivity.summarizingOlderMessages`)}function dn(e){if(typeof e!=`string`&&typeof e!=`number`)return 0;let t=new Date(e).getTime();return Number.isFinite(t)?t:0}function fn(e){if(!e||e.status===`running`)return null;let t=e.type===`agent`&&e.agent||{},n=dn(e.startedAt||t.startedAt),r=dn(e.finishedAt||t.completedAt||e.updatedAt);return!n||!r||r<n?null:r-n}function pn(e,t=!1){let n=Math.max(0,Math.round(e));if(n<1e3)return t?`0 s`:`${n} ms`;if(n<1e4&&!t)return`${(n/1e3).toFixed(1)} s`;let r=Math.floor(n/1e3);if(r<60)return`${r} s`;let i=Math.floor(r/60),a=String(r%60).padStart(2,`0`);return i<60?`${i}:${a}`:`${Math.floor(i/60)}:${String(i%60).padStart(2,`0`)}:${a}`}function mn(e){if(e?.type!==`tool`||e.status!==`error`)return null;let t=/Command exited with code (\d+)/.exec(`${String(e.output||``)}\n${String(e.message||``)}`);return t?t[1]:null}var hn=[],gn=`flex min-h-[36px] min-w-0 items-center gap-[10px] px-[12px] py-[5px] text-[13px] max-[650px]:min-h-11 pointer-coarse:min-h-11 [.agent-run-activity.compact_&]:min-h-[30px]`,_n=`cursor-pointer list-none transition-colors duration-(--d-fast) ease-precise focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,vn=`${_n} hover:bg-surface-subtle [details[open]>&]:bg-surface-subtle`,yn=`${_n} bg-st-run-soft`,bn=`agent-run-disclosure size-[14px] flex-none text-content-muted transition-transform duration-(--d-fast) ease-precise [details[open]>summary_&]:rotate-90`,xn=(0,Y.lazy)(()=>t(()=>import(`./AnimatedList-DB5vqafO.js`).then(e=>({default:e.AnimatedList})),__vite__mapDeps([0,1,2,3,4,5,6])));function Sn(e,t){return t(e===`queued`?`chat:agentRunActivity.teamTaskQueued`:e===`starting`?`chat:agentRunActivity.teamTaskStarting`:e===`running`?`chat:agentRunActivity.teamTaskRunning`:e===`completed`?`chat:agentRunActivity.teamTaskCompleted`:e===`failed`?`chat:agentRunActivity.teamTaskFailed`:e===`interrupted`?`chat:agentRunActivity.teamTaskInterrupted`:e===`blocked`?`chat:agentRunActivity.teamTaskBlocked`:`chat:agentRunActivity.teamTaskStatusUpdated`)}function Cn(e){let[t,n]=(0,Y.useState)(()=>Date.now());return(0,Y.useEffect)(()=>{if(n(Date.now()),!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function wn({startedAt:e,finishedAt:t,streaming:n}){let r=Cn(n),i=Oe(e,t,r);return!i&&!n?null:(0,X.jsx)(`span`,{className:`agent-run-duration flex-none text-[12px] whitespace-nowrap text-content-muted tabular-nums`,children:pn(i,!!n)})}function Q(e){return String(e||``).replace(/\s+/g,` `).trim()}function Tn(e){let t=e?.args||{};return e?.name===`bash`?{text:String(t.command||``).trim(),command:!0}:e?.name===`codemode`?{text:String(t.code||``).split(`
5
+ `).map(e=>e.trim()).find(e=>e&&!e.startsWith(`// @options:`))||``,command:!0}:[`read`,`edit`,`write`,`ls`].includes(e?.name)?{text:Q(t.path)}:e?.name===`grep`?{text:[t.pattern?`“${Q(t.pattern)}”`:``,Q(t.path)].filter(Boolean).join(` · `)}:e?.name===`find`?{text:[Q(t.pattern),Q(t.path)].filter(Boolean).join(` · `)}:e?.name===`browser_automation`?{text:[Q(t.action),Q(t.url||t.selector)].filter(Boolean).join(` · `)}:e?.name===`computer_use`?{text:[Q(t.action),Q(t.keys)].filter(Boolean).join(` · `)}:e?.name===`observe_ui`?{text:Q(t.root||t.mode)}:e?.name===`act_ui`?{text:Array.isArray(t.actions)?t.actions.slice(0,3).map(e=>Q(e?.action)).filter(Boolean).join(` · `):``}:e?.name===`search_ui`?{text:Q(t.text||t.role)}:e?.name===`find_roots`?{text:Q(t.app||t.text)}:e?.name===`ocr_ui`?{text:Q(t.language)}:e?.name===`spawn_agent`?{text:Q(t.taskName)}:[`send_message`,`followup_task`,`wait_agent`,`interrupt_agent`].includes(e?.name)?{text:Q(t.target)}:e?.name===`generate_visual`?{text:Q(t.outputName||t.kind)}:e?.name===`discover_tools`?{text:Q(t.query)}:{text:``}}function En(e,{t,streaming:n,text:r,thinkingText:i,compaction:a,error:o,stopped:s,notice:c,lastActivityAt:l,now:u}){let d=`running`,f=t(`chat:agentRunActivity.understandingTheTask`),p=c||``,m=``,h=!1,g=e.startedAt,_=hn;if(e.type===`tool`){let n=e.status===`error`,r=e.status===`done`;d=n?`failed`:r?`completed`:`running`,f=n?t(`chat:agentRunActivity.toolFailed`,{tool:an(e.name,t)}):r?on(e.name,t):an(e.name,t);let i=Tn(e);p=i.text,h=!!i.command,m=Q(e.message)}else if(e.type===`plan`){d=`plan`;let n=Ce(e);f=n?.items?.length?t(`chat:agentRunActivity.planUpdated`):t(`chat:agentRunActivity.planCleared`),_=e.changes||hn,p=_.length?t(`chat:agentRunActivity.countPlanChanges`,{count:_.length}):cn(n,t)}else if(e.type===`agent`){let n=e.agent||{},r=Q(n.taskName)||t(`chat:agentRunActivity.subagent`),i=Q(n.agentProfile),a=Q(n.modelTier),o=Q(n.model),s=i||a?t(`chat:agentRunActivity.subagentWithProfile`,{name:r,profile:i||a,model:o}):r,c=!Array.isArray(n.modelFallbackReasons)||!n.modelFallbackReasons.length?``:n.modelSource===`tier`?t(`chat:agentRunActivity.subagentTierModelFallback`,{model:o}):t(i?`chat:agentRunActivity.subagentParentModelFallback`:`chat:agentRunActivity.subagentTierUnavailableFallback`,{model:o}),l=De(n.status);f=sn(n.status,s,t),d=l.tone,p=(n.currentActivity?.type===`tool`?Tn(n.currentActivity).text||n.currentActivity.name:``)||Q(n.error)||c||Q(n.message),m=n.status===`running`?Q(n.output):``,g=n.startedAt||g}else if(e.type===`communication`){let n=e.communication||{};d=`running`,f=t(`chat:agentRunActivity.teamMessageActivity`),p=t(`chat:agentRunActivity.teamMessageDetail`,{from:n.fromTaskName||n.fromAgentId||`lead`,to:n.toTaskName||n.toAgentId||``}),m=Q(n.message)}else if(e.type===`compaction`)d=`compacting`,f=t(`chat:agentRunActivity.compactingContext`),p=un(e.compaction||a,t);else if(e.type===`retry`)d=`waiting`,f=t(`chat:agentRunActivity.retryingRequest`),p=e.summary||c||``;else{let a=Math.max(0,u-new Date(l||u).getTime());o?(d=`failed`,f=t(`chat:agentRunActivity.thisRunFailed`),p=o):s?(d=`stopped`,f=t(`chat:agentRunActivity.runStopped`)):n?a>=1e4?(d=`waiting`,f=t(`chat:agentRunActivity.waitingForTheModel`),p=t(`chat:agentRunActivity.noNewProgressForCountS`,{count:Math.floor(a/1e3)})):f=e.stage===`starting`?t(`chat:agentRunActivity.startingTheModel`):e.stage===`responding`?t(`chat:agentRunActivity.preparingTheResponse`):e.stage===`processing_result`?t(`chat:agentRunActivity.processingToolResult`):e.stage===`waiting_retry`?t(`chat:agentRunActivity.waitingToRetry`):e.stage===`finalizing`?t(`chat:agentRunActivity.finalizingTheRun`):e.stage===`working`?t(`chat:agentRunActivity.advancingTheTask`):String(i||``).trim()?t(`chat:agentRunActivity.reasoningAboutTheNextStep`):String(r||``).trim()?t(`chat:agentRunActivity.preparingTheResponse`):t(`chat:agentRunActivity.understandingTheTask`):(d=`completed`,f=t(`chat:agentRunActivity.reasoningCompleted`),p=Q(i)),String(i||``).trim()&&(p=Q(i))}return{tone:d,title:f,detail:p,output:m,command:h,startedAt:g,changes:_}}var Dn={running:{kind:`run`,color:`text-st-run`},compacting:{kind:`run`,color:`text-st-run`},completed:{kind:`done`,color:`text-st-done`},plan:{kind:`done`,color:`text-st-done`},failed:{kind:`failed`,color:`text-st-fail`},stopped:{kind:`stopped`,color:`text-st-queue`},waiting:{kind:`queued`,color:`text-st-queue`}};function On({tone:e,spin:t=!0}){let n=Dn[e]??{kind:`queued`,color:`text-st-queue`};return(0,X.jsx)(`span`,{className:`agent-run-status-icon grid size-[18px] flex-none place-items-center`,children:(0,X.jsx)(xe,{status:n.kind,spin:t&&n.kind===`run`,className:`size-[15px] ${n.color}`})})}function kn(e,t){let n=e.type===`agent`?e.agent?.status:e.status;return n===`error`||n===`failed`?`failed`:t&&[`running`,`starting`,`queued`].includes(String(n))||t&&e.type===`compaction`?`running`:`done`}function An(e,t){let n={total:e.length,done:0,running:0,failed:0};for(let r of e)n[kn(r,t)]+=1;return n}function jn({activity:e,className:t,children:n}){return e.type===`tool`?(0,X.jsx)(`div`,{className:t,"data-pisper-activity-type":`tool`,children:n}):e.type===`plan`?(0,X.jsx)(Qt,{className:`${t} !gap-0 !rounded-none !border-0 !bg-transparent !p-0 !shadow-none`,"data-pisper-activity-type":`plan`,children:n}):e.type===`agent`?(0,X.jsx)($t,{className:t,"data-pisper-activity-type":`agent`,children:n}):(0,X.jsx)(`div`,{className:t,"data-pisper-activity-type":e.type,children:n})}var Mn=/^\s*(?:●|✗|✕|×|npm ERR!|ERR!|(?:Error|TypeError|SyntaxError|ReferenceError)\b:?)|^Command exited with code \d+/,Nn=/^\s*[✓✔]/;function Pn({line:e}){let t=/^(PASS|FAIL)(?=\s|$)/.exec(e)?.[1];if(t)return(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`b`,{className:`mr-[6px] rounded-[3px] px-[5px] text-[11.5px] font-semibold tracking-[.02em] ${t===`PASS`?`bg-success-soft text-success`:`bg-danger-soft text-danger`}`,children:t}),e.slice(t.length).trimStart()]});let n=Mn.test(e)?`text-danger`:Nn.test(e)?`text-success`:void 0;return(0,X.jsx)(`span`,{className:n,children:e})}function Fn({output:e,command:t,streaming:n,t:r,children:i}){let a=rn(e),o=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{let e=o.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[a.text,n]),!a.text.trim()&&!(n&&t)?(0,X.jsx)(`div`,{className:gn,children:i}):(0,X.jsxs)(`details`,{className:`agent-run-command-output [.agent-run-feed:has(&[open])]:max-h-[320px] [&_>_pre]:max-h-[112px] [&_>_pre]:overflow-auto [&_>_pre]:m-0 [&_>_pre]:relative [&_>_pre]:border-t [&_>_pre]:border-well-stroke [&_>_pre]:bg-well [&_>_pre]:py-[8px] [&_>_pre]:pr-[14px] [&_>_pre]:pl-[40px] [&_>_pre]:font-mono [&_>_pre]:text-[12px] [&_>_pre]:leading-[1.7] [&_>_pre]:text-well-text [&_>_pre]:whitespace-pre-wrap [&_>_pre]:[overflow-wrap:anywhere] [&_>_pre>span]:block [&_>_pre>span]:min-h-[1.7em] [&_>_pre]:before:absolute [&_>_pre]:before:top-0 [&_>_pre]:before:bottom-[12px] [&_>_pre]:before:left-[20px] [&_>_pre]:before:w-px [&_>_pre]:before:bg-well-stroke max-[650px]:[&_>_pre]:pl-[12px] max-[650px]:[&_>_pre]:before:hidden min-w-0`,"data-truncated":a.truncated||void 0,"data-running":n||void 0,open:n||void 0,children:[(0,X.jsxs)(`summary`,{className:`${gn} ${n?yn:vn}`,children:[i,(0,X.jsx)(`span`,{className:`sr-only`,children:r(n?`chat:agentRunActivity.liveCommandOutput`:`chat:agentRunActivity.commandOutput`)}),(0,X.jsx)(y,{className:bn,"aria-hidden":`true`})]}),(0,X.jsxs)(`pre`,{ref:o,children:[t?(0,X.jsxs)(`span`,{className:`text-well-text`,children:[(0,X.jsx)(`span`,{className:`text-well-muted select-none`,children:`$ `}),t]}):null,a.text?a.text.split(`
6
+ `).map((e,t)=>(0,X.jsx)(Pn,{line:e},t)):null]})]})}function In({image:e,t}){let n=String(e.url||``);return n?(0,X.jsx)(`a`,{className:`agent-run-tool-preview block w-full overflow-hidden rounded-sm border border-stroke-soft bg-surface-subtle`,href:n,target:`_blank`,rel:`noreferrer`,title:String(e.name||``),children:(0,X.jsx)(`img`,{alt:String(e.name||t(`chat:agentRunActivity.toolPreviewAlt`)),className:`block max-h-[168px] w-full object-contain object-top`,loading:`lazy`,src:n})}):null}function Ln(e,t){return e.activity!==t.activity||e.latest!==t.latest||e.t!==t.t||e.streaming!==t.streaming?!1:[`tool`,`plan`,`agent`].includes(t.activity.type)?!0:e.text===t.text&&e.thinkingText===t.thinkingText&&e.compaction===t.compaction&&e.error===t.error&&e.stopped===t.stopped&&e.notice===t.notice&&e.lastActivityAt===t.lastActivityAt}var Rn=(0,Y.memo)(function({activity:e,latest:t,t:n,streaming:r,text:i,thinkingText:a,compaction:o,error:s,stopped:c,notice:l,lastActivityAt:u}){let d=En(e,{t:n,streaming:r,text:i,thinkingText:a,compaction:o,error:s,stopped:c,notice:l,lastActivityAt:u,now:Date.now()}),f=!!(r&&e.type===`tool`&&e.status===`running`),p=e.name===`bash`&&!!(e.output||f);if(e.type===`retry`)return(0,X.jsx)(Dt,{title:e.summary||n(`chat:agentRunActivity.retryingRequest`),error:String(e.message||``),pending:!!(r&&t),className:`rounded-none border-0 bg-transparent`});let m=e.type===`tool`?String(e.name||``):``,h=mn(e),g=fn(e),_=d.tone===`failed`,v=!p&&d.output&&d.output!==d.detail?d.output:``,y=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(On,{tone:d.tone,spin:!!r}),m?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`agent-run-verb max-w-[40%] min-w-[34px] flex-none truncate font-mono text-[12px] font-semibold ${f?`text-st-run`:`text-content-secondary`}`,children:m}),(0,X.jsx)(`span`,{className:`agent-run-arg min-w-0 flex-1 truncate font-mono text-[12.5px] ${d.detail?`text-foreground`:`text-content-muted`}`,title:d.detail||d.title,children:d.detail||d.title}),d.detail?(0,X.jsx)(`span`,{className:`sr-only`,children:d.title}):null]}):(0,X.jsxs)(`span`,{className:`agent-run-arg min-w-0 flex-1 truncate`,title:[d.title,d.detail].filter(Boolean).join(` · `),children:[(0,X.jsx)(`span`,{className:`text-foreground`,children:d.title}),d.detail?(0,X.jsxs)(`span`,{className:`text-content-muted`,children:[` · `,d.detail]}):null]}),h!==null&&(0,X.jsx)(`span`,{className:`flex-none font-mono text-[12px] font-medium text-st-fail`,children:n(`chat:agentRunActivity.exitCode`,{code:h})}),g===null?f&&e.startedAt?(0,X.jsx)(wn,{startedAt:String(e.startedAt),streaming:!0}):null:(0,X.jsx)(`span`,{className:`agent-run-elapsed min-w-[44px] flex-none text-right font-mono text-[12px] text-content-muted tabular-nums`,children:pn(g)})]});return(0,X.jsxs)(jn,{activity:e,className:`agent-run-summary flex w-full min-w-0 flex-none flex-col [transition:background_var(--d-fast)_var(--ease)] ${d.tone} ${t?`current [.agent-run-feed.live_&]:bg-surface-subtle`:``}`,children:[p?(0,X.jsx)(Fn,{output:e.output,command:d.detail,streaming:f,t:n,children:y}):(0,X.jsxs)(`div`,{className:`${gn} ${f?`bg-st-run-soft`:``}`,children:[y,(0,X.jsx)(`span`,{className:`size-[14px] flex-none`,"aria-hidden":`true`})]}),(d.changes.length>0||v||e.previewImage?.url)&&(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[4px] pr-[12px] pb-[8px] pl-[40px] text-[12px] leading-[1.45]`,children:[d.changes.length>0&&(0,X.jsxs)(`span`,{className:`agent-run-plan-changes flex min-w-0 flex-col gap-[1px] border-l border-stroke pl-[8px] text-content-secondary`,children:[d.changes.slice(0,4).map(e=>(0,X.jsx)(`small`,{className:`truncate text-[12px]`,children:ln(e,n)},`${e.id}-${e.kind}-${e.status}`)),d.changes.length>4&&(0,X.jsx)(`small`,{className:`text-[12px] text-content-muted`,children:n(`chat:agentRunActivity.countMoreChanges`,{count:d.changes.length-4})})]}),v?(0,X.jsx)(`small`,{className:`truncate text-[12px] ${_?`text-st-fail`:`text-content-muted`}`,title:v,children:v}):null,e.previewImage&&e.previewImage.url?(0,X.jsx)(In,{image:e.previewImage,t:n}):null]})]})},Ln);function zn({streaming:e,text:t,thinkingText:n,team:r,activityFeed:i=hn,tools:a=hn,compaction:o,error:c,stopped:l,notice:u,startedAt:d,lastActivityAt:f,finishedAt:m,compact:h=!1}){let{t:g}=s(),_=String(n||``).trim(),v=(0,Y.useRef)(null),b=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(!_)return;let e=window.requestAnimationFrame(()=>{let e=v.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[_]);let x=i.length?i:a,[S,C]=(0,Y.useState)(!!e),w=(0,Y.useRef)(!!e);(0,Y.useEffect)(()=>{w.current!==!!e&&(w.current=!!e,C(!!e))},[e]);let T=Ee(x),E=Array.isArray(r?.tasks)?r.tasks:[],D=Number(r?.completedTaskCount??0),O=Number(r?.taskCount??E.length),k=Number(r?.tokenUsed??r?.tokensUsed??0),A=Number(r?.tokenBudget??r?.teamTokenBudget??0),M=Array.isArray(r?.communications)?r.communications:[],N=O>0?Math.min(100,Math.round(D/O*100)):0;if((0,Y.useEffect)(()=>{if(!e||!x.length)return;let t=window.requestAnimationFrame(()=>{let e=b.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(t)},[T,x.length,e]),!_&&!x.length&&!r)return null;let P=An(x,e),F=(r=>r.map((i,a)=>(0,X.jsx)(Rn,{activity:i,compaction:o,error:c,lastActivityAt:f,latest:a===r.length-1,notice:u,stopped:l,streaming:e,t:g,text:t,thinkingText:_?``:n},ke(i,a))))(x),I=!!(r&&(E.length>0||M.length>0||(r.blockers?.length??0)>0||(r.conflicts?.length??0)>0||r.scriptPath||r.summary?.text)),L=!!(I||x.length>0),R=[g(`board:transcript.operations`,{count:P.total}),P.running?g(`board:transcript.running`,{count:P.running}):``,P.failed?g(`board:transcript.failed`,{count:P.failed}):``,!e&&!P.failed&&!P.running?g(`board:transcript.allDone`):``].filter(Boolean);return(0,X.jsxs)(`section`,{className:`agent-run-activity flex w-full flex-col items-start gap-[10px] [margin:2px_0_14px] text-foreground [&.compact]:m-[4px_0_0_40px] ${h?`compact`:``}`,"aria-live":`polite`,children:[_&&(0,X.jsxs)(`details`,{className:`agent-thinking-window group/thinking w-full min-w-0 ${e?`running`:`completed`}`,"data-pisper-activity-type":`reasoning`,children:[(0,X.jsxs)(`summary`,{className:`agent-thinking-head inline-flex h-7 max-w-full items-center gap-[6px] rounded-sm pr-[8px] pl-[6px] text-[12px] text-content-secondary ring-1 ring-stroke ring-inset ${_n} hover:bg-surface-hover max-[650px]:h-11 pointer-coarse:h-11`,"aria-label":g(`chat:agentRunActivity.toggleReasoning`),children:[e?(0,X.jsx)(xe,{status:`run`,className:`size-[14px] text-st-run`}):(0,X.jsx)(j,{className:`size-[14px] flex-none text-content-muted`,strokeWidth:1.75}),(0,X.jsxs)(`strong`,{className:`flex min-w-0 items-center truncate font-medium`,children:[g(e?`chat:agentRunActivity.reasoningInProgress`:`chat:agentRunActivity.reasoningCompleted`),e?(0,X.jsxs)(`span`,{className:`agent-thinking-dots [&_i]:w-[3px] [&_i]:h-[3px] [&_i]:rounded-[50%] [&_i]:bg-[currentColor] [&_i]:[animation:agent-thinking-dot_1.15s_ease-in-out_infinite] [&_i:nth-child(2)]:[animation-delay:.14s] [&_i:nth-child(3)]:[animation-delay:.28s] inline-flex items-end gap-[2px] [margin-left:5px]`,"aria-hidden":`true`,children:[(0,X.jsx)(`i`,{}),(0,X.jsx)(`i`,{}),(0,X.jsx)(`i`,{})]}):null]}),!x.length&&(0,X.jsx)(wn,{startedAt:d,finishedAt:m,streaming:e}),(0,X.jsx)(y,{className:bn,"aria-hidden":`true`})]}),(0,X.jsx)(`div`,{ref:v,className:`agent-thinking-scroll mt-[8px] max-h-[190px] overflow-auto rounded-md border border-stroke-soft bg-surface-subtle px-[14px] py-[9px] text-content-secondary [scroll-behavior:smooth]`,children:(0,X.jsx)(Le,{streaming:e,children:_})})]}),L&&(0,X.jsxs)(`div`,{className:`agent-run-log w-full overflow-hidden rounded-[var(--r-md)] border border-stroke bg-solid [&>*+*]:border-t [&>*+*]:border-stroke-soft`,children:[r&&I&&(0,X.jsxs)(`details`,{className:`agent-team-panel min-w-0`,children:[(0,X.jsxs)(`summary`,{className:`${gn} ${vn} justify-between`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,X.jsx)(`span`,{className:`grid size-[18px] flex-none place-items-center`,"aria-hidden":`true`,children:(0,X.jsx)(`span`,{className:`team-status-dot h-[7px] w-[7px] shrink-0 rounded-full ${r.status===`complete`?`bg-success`:r.status===`stalled`||r.status===`budget_limited`?`bg-warning-strong`:r.status===`paused`?`bg-content-muted`:`bg-star [animation:agent-status-pulse_1.6s_ease-in-out_infinite]`}`})}),(0,X.jsx)(`span`,{className:`min-w-0 truncate font-medium text-content-secondary`,children:r.status===`complete`?g(`chat:agentRunActivity.teamComplete`):r.status===`budget_limited`?g(`chat:agentRunActivity.teamBudgetLimited`):r.status===`paused`?g(`chat:agentRunActivity.teamPaused`):r.status===`stalled`?g(`chat:agentRunActivity.teamStalled`):g(`chat:agentRunActivity.teamActive`)}),O>0&&(0,X.jsxs)(`small`,{className:`shrink-0 text-[12px] text-content-muted tabular-nums`,children:[D,`/`,O,` · `,N,`%`]})]}),(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-[8px]`,children:[A>0&&(0,X.jsx)(`small`,{className:`text-[12px] whitespace-nowrap text-content-muted tabular-nums`,children:g(`chat:agentRunActivity.teamBudget`,{used:k,budget:A})}),(0,X.jsx)(y,{className:bn,"aria-hidden":`true`})]})]}),O>0&&(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`team-progress-track mx-[12px] mb-[6px] h-[4px] overflow-hidden rounded-full bg-surface-active`,children:(0,X.jsx)(`div`,{className:`team-progress-fill h-full rounded-full bg-content-secondary [transition:width_var(--d-base)_var(--ease)]`,style:{width:`${N}%`}})}),(0,X.jsxs)(`div`,{className:`grid max-h-[min(42vh,360px)] grid-cols-[repeat(auto-fit,minmax(190px,1fr))] gap-[6px] overflow-y-auto overscroll-contain border-t border-stroke-soft bg-surface-subtle p-[8px_12px]`,children:[E.map(e=>{let t=typeof e.role==`string`?e.role.trim():``,n=Sn(e.status,g);return(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-[4px] rounded-sm border border-stroke-soft bg-panel p-[7px_8px] text-[12px]`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-[6px]`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`team-task-dot mt-[5px] h-[6px] w-[6px] shrink-0 rounded-full ${e.status===`running`?`bg-star [animation:agent-status-pulse_1.6s_ease-in-out_infinite]`:e.status===`completed`?`bg-success`:e.status===`failed`||e.status===`interrupted`?`bg-danger`:e.status===`blocked`?`bg-warning-strong`:`bg-stroke-strong`}`}),(0,X.jsxs)(`span`,{className:`grid min-w-0 gap-[1px]`,children:[(0,X.jsx)(`strong`,{className:`font-medium break-words`,children:t?g(`chat:agentRunActivity.teamTaskStatus`,{name:e.taskName,role:t,status:n}):g(`chat:agentRunActivity.teamTaskStatusWithoutRole`,{name:e.taskName,status:n})}),(0,X.jsx)(`small`,{className:`text-[12px] text-content-muted`,children:n})]})]}),e.error&&(0,X.jsx)(`small`,{className:`text-[12px] break-words text-danger`,children:e.error}),e.output&&(0,X.jsx)(`small`,{className:`text-[12px] break-words text-content-muted`,children:e.output})]},e.id||e.taskName)}),(r.blockers?.length??0)>0&&(0,X.jsx)(`small`,{className:`text-[12px] text-warning-strong`,children:g(`chat:agentRunActivity.teamBlocked`,{count:r.blockers?.length??0})}),(r.conflicts?.length??0)>0&&(0,X.jsx)(`small`,{className:`text-[12px] text-danger`,children:g(`chat:agentRunActivity.teamConflicts`,{count:r.conflicts?.length??0})}),r.scriptPath&&(0,X.jsx)(`small`,{className:`font-mono text-[12px] break-all text-content-muted`,children:g(`chat:agentRunActivity.teamScript`,{path:r.scriptPath})}),M.length>0&&(0,X.jsxs)(`div`,{className:`grid gap-[3px] border-t border-stroke-soft pt-[6px]`,children:[(0,X.jsx)(`small`,{className:`text-[12px] text-content-muted`,children:g(`chat:agentRunActivity.teamCommunicationCount`,{count:M.length})}),M.slice(-6).map(e=>(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-[1px] rounded-xs border-l-2 border-stroke-strong bg-panel p-[4px_8px]`,children:[(0,X.jsxs)(`strong`,{className:`font-mono text-[12px] font-medium break-all`,children:[e.fromTaskName||e.fromAgentId||`lead`,` ->`,` `,e.toTaskName||e.toAgentId]}),(0,X.jsx)(`small`,{className:`text-[12px] break-words text-content-secondary`,children:e.message})]},e.id))]}),r.summary?.text&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`small`,{className:`text-[12px] text-content-muted`,children:g(`chat:agentRunActivity.teamSummary`)}),r.summary.text&&(0,X.jsx)(`p`,{className:`m-0 line-clamp-4 text-[12px] leading-[1.45] text-content-secondary`,children:r.summary.text})]})]})]},String(r.id||r.scriptPath||`team`)),x.length>0&&(0,X.jsxs)(`details`,{className:`agent-run-history min-w-0`,open:S,onToggle:e=>C(e.currentTarget.open),"data-tool-group":e?`running`:`done`,children:[(0,X.jsxs)(`summary`,{className:`flex min-h-[38px] min-w-0 items-center gap-[8px] px-[12px] py-[4px] text-[13px] text-content-secondary ${_n} hover:bg-surface-hover max-[650px]:min-h-11 pointer-coarse:min-h-11`,"data-tool-group-summary":!0,children:[(0,X.jsx)(p,{className:`size-[14px] flex-none text-content-muted`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-[6px] truncate tabular-nums`,children:R.map((e,t)=>(0,X.jsxs)(`span`,{className:t===0?`font-semibold text-content`:void 0,children:[t>0&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`mr-[6px] text-content-muted`,children:`·`}),e]},t))}),(0,X.jsx)(wn,{startedAt:d,finishedAt:m,streaming:e}),(0,X.jsx)(y,{className:bn,"aria-hidden":`true`})]}),(0,X.jsx)(`div`,{ref:b,className:`agent-run-feed focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus flex max-h-[184px] flex-col overflow-y-auto [overscroll-behavior:contain] border-t border-stroke-soft [&>*+*]:border-t [&>*+*]:border-stroke-soft ${e?`live`:`completed`}`,"aria-label":g(`chat:agentRunActivity.toolActivityAriaLabel`),tabIndex:x.length>3?0:void 0,children:e?(0,X.jsx)(Y.Suspense,{fallback:F,children:(0,X.jsx)(xn,{children:F})}):(0,X.jsx)(Y.Suspense,{fallback:F,children:F})})]})]})]})}function Bn(e,t){return e.streaming===t.streaming&&e.text===t.text&&e.thinkingText===t.thinkingText&&e.currentActivity===t.currentActivity&&e.team===t.team&&e.activityFeed===t.activityFeed&&e.compaction===t.compaction&&e.error===t.error&&e.stopped===t.stopped&&e.notice===t.notice&&e.startedAt===t.startedAt&&e.lastActivityAt===t.lastActivityAt&&e.finishedAt===t.finishedAt&&e.compact===t.compact&&e.tools===t.tools}var Vn=(0,Y.memo)(zn,Bn);function Hn({className:e,from:t,...n}){return(0,X.jsx)(`div`,{"data-ai-element":`message`,"data-role":t,className:K(`group flex w-full max-w-[95%] flex-col gap-2`,t===`user`?`is-user ml-auto justify-end`:`is-assistant`,e),...n})}var Un=(0,Y.lazy)(()=>t(()=>import(`./public-session-DSLmbBcw.js`),__vite__mapDeps([7,1,8,2,9,10,11,12,13,14,15,16,17,4,18,3,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35])));function Wn({images:e,index:t,onClose:n,onNavigate:r}){let{t:i}=s(),a=(0,Y.useRef)(null),o=e[t],c=t>0,l=t<e.length-1,u=(0,Y.useCallback)(t=>{t>=0&&t<e.length&&r(t)},[e.length,r]);return(0,Y.useEffect)(()=>{let e=document.body.style.overflow,r=e=>{e.key===`Escape`?n():e.key===`ArrowLeft`?(e.preventDefault(),u(t-1)):e.key===`ArrowRight`&&(e.preventDefault(),u(t+1))};return document.body.style.overflow=`hidden`,window.addEventListener(`keydown`,r),()=>{document.body.style.overflow=e,window.removeEventListener(`keydown`,r)}},[t,u,n]),o?(0,X.jsxs)(`div`,{className:`image-lightbox [&_img]:h-full [&_img]:min-h-0 [&_img]:w-full [&_img]:object-contain fixed z-[100] inset-0 grid grid-rows-[auto_minmax(0,1fr)] gap-[12px] bg-[var(--lightbox-bg)] [padding:18px_72px_24px_24px] max-sm:[padding:12px_56px_16px_12px]`,role:`dialog`,"aria-modal":`true`,"aria-label":i(`chat:chatMessage.fullScreenImagePreview`),children:[(0,X.jsxs)(`div`,{className:`image-lightbox-toolbar flex min-w-0 items-center justify-between gap-[16px] text-[var(--on-ink)]`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,X.jsx)(`span`,{className:`overflow-hidden text-[13px] font-medium text-ellipsis whitespace-nowrap`,title:o.attachment.name,children:o.attachment.name||i(`chat:chatMessage.generatedImage`)}),e.length>1&&(0,X.jsxs)(`span`,{className:`flex-none text-[12px] text-[var(--on-ink)]/70 tabular-nums`,children:[t+1,` / `,e.length]})]}),(0,X.jsxs)(`div`,{className:`flex flex-none items-center gap-[8px]`,children:[(0,X.jsx)(q,{asChild:!0,size:`lg`,className:`border border-[var(--lightbox-action-border)] bg-[var(--lightbox-action-bg)] text-[var(--lightbox-action-text)] shadow-[0_8px_24px_var(--lightbox-action-shadow)] hover:bg-[var(--accent-soft)] hover:text-[var(--star-strong)]`,children:(0,X.jsxs)(`a`,{href:o.attachment.downloadUrl||o.source,download:o.attachment.name||`generated-image`,"aria-label":i(`chat:chatMessage.downloadOriginal`),title:i(`chat:chatMessage.downloadOriginal`),children:[(0,X.jsx)(S,{size:14}),(0,X.jsx)(`span`,{className:`max-sm:hidden`,children:i(`chat:chatMessage.downloadOriginal`)})]})}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-lg`,className:`size-11 bg-[var(--lightbox-control-bg)] text-[var(--on-ink)] hover:bg-[var(--lightbox-control-bg)] hover:text-[var(--on-ink)]`,"aria-label":i(`chat:chatMessage.closePreview`),title:i(`chat:chatMessage.closePreview`),onClick:n,children:(0,X.jsx)(H,{size:20})})]})]}),(0,X.jsxs)(`div`,{className:`relative flex min-h-0 items-center justify-center [touch-action:pan-y]`,onTouchStart:e=>{a.current=e.changedTouches[0]?.clientX??null},onTouchEnd:e=>{let n=a.current;a.current=null;let r=e.changedTouches[0]?.clientX;n===null||r===void 0||Math.abs(r-n)<48||u(t+(r<n?1:-1))},onTouchCancel:()=>{a.current=null},children:[e.length>1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-lg`,className:`absolute left-0 z-10 size-11 rounded-full bg-[var(--lightbox-control-bg)] text-[var(--on-ink)] shadow-[0_8px_24px_var(--lightbox-action-shadow)] hover:bg-[var(--lightbox-control-bg)] hover:text-[var(--on-ink)] disabled:opacity-30`,"aria-label":i(`chat:chatMessage.previousImage`),title:i(`chat:chatMessage.previousImage`),disabled:!c,onClick:()=>u(t-1),children:(0,X.jsx)(v,{size:22})}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-lg`,className:`absolute right-0 z-10 size-11 rounded-full bg-[var(--lightbox-control-bg)] text-[var(--on-ink)] shadow-[0_8px_24px_var(--lightbox-action-shadow)] hover:bg-[var(--lightbox-control-bg)] hover:text-[var(--on-ink)] disabled:opacity-30`,"aria-label":i(`chat:chatMessage.nextImage`),title:i(`chat:chatMessage.nextImage`),disabled:!l,onClick:()=>u(t+1),children:(0,X.jsx)(y,{size:22})})]}),(0,X.jsx)(`img`,{alt:o.attachment.name||i(`chat:chatMessage.generatedImage`),decoding:`async`,src:o.source})]})]}):null}function Gn(e,t){window.dispatchEvent(new CustomEvent(Re,{detail:{message:e,tone:t}}))}function Kn({icon:e,label:t,onClick:n,disabled:r=!1}){return(0,X.jsxs)(`button`,{type:`button`,disabled:r,onClick:n,className:`flex min-h-[30px] cursor-pointer items-center gap-[8px] rounded-sm border-0 bg-transparent px-[8px] text-left text-[13px] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11`,children:[e,t]})}var qn=6,Jn=4;function Yn(e){let t=!!(e.url||e.data);return(e.kind===`image`||e.kind===`video`)&&t}function Xn({attachments:e,compact:t=!1,sessionId:n,sessionStreaming:r=!1}){let{t:i}=s(),[a,o]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),g=(0,Y.useRef)(null),[v,y]=(0,Y.useState)(null),[x,C]=(0,Y.useState)(null),[T,A]=(0,Y.useState)(null),[j,P]=(0,Y.useState)({}),F=e.flatMap((e,t)=>{let n=e.url||(e.data?`data:${e.mimeType};base64,${e.data}`:``);return e.kind===`image`&&n?[{attachment:e,source:n,attachmentIndex:t}]:[]}),I=new Map;e.forEach((e,t)=>{Yn(e)||I.set(t,I.size)});let L=!c&&I.size>qn?I.size-Jn:0,R=async e=>{try{await Ie(e,Pe),Gn(i(`common:markdownMessage.revealLocalPathOk`,{path:e}),`info`)}catch(t){Gn(t instanceof Fe&&t.reason===`unavailable`?i(`common:markdownMessage.revealLocalPathUnavailable`):t instanceof Fe&&t.reason===`timeout`?i(`common:markdownMessage.revealLocalPathTimeout`):i(`common:markdownMessage.revealLocalPathFailed`,{path:e}),`error`)}},ee=async(e,t)=>{if(n)try{let r=await ye.getFileDiff(n,t,{preferSession:!0});P(t=>({...t,[e]:r.diff?.trim()?{diff:r.diff,truncated:!!r.diffTruncated,canRevert:!!r.canRevert}:null}))}catch{P(t=>({...t,[e]:null}))}},z=async(e,t)=>{if(!(!n||r||x)){if(v!==e){y(e);return}y(null),C(e);try{await ye.revertSessionFileChanges(n,t),P(t=>({...t,[e]:null})),Gn(i(`chat:chatMessage.fileActionRevertDone`,{path:t}),`info`)}catch(e){Gn(i(`chat:chatMessage.fileActionRevertFailed`,{path:t}),`error`),console.error(`[chat] 撤销文件改动失败。`,e)}finally{C(null)}}},B=async(e,t)=>{if(!(!n||m)){h(e);try{let e=await ye.getFileDiff(n,t,{preferSession:!0});e.diff?.trim()?(d(null),A({diff:e.diff,truncated:!!e.diffTruncated})):Gn(i(`chat:chatMessage.fileDiffEmpty`),`info`)}catch(e){Gn(e instanceof Error?e.message:i(`chat:chatMessage.fileDiffFailed`),`error`)}finally{h(null)}}},V=e=>{if(!e.downloadUrl)return;let t=document.createElement(`a`);t.href=e.downloadUrl,e.name&&(t.download=e.name),t.click()};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`message-attachments flex flex-wrap items-start gap-[6px] [margin-top:6px] ${t?`compact`:``}`,children:[e.map((e,t)=>{if(L&&(I.get(t)??-1)>=Jn)return null;let a=String(e.id||t),s=e.url||(e.data?`data:${e.mimeType};base64,${e.data}`:``);return e.kind===`image`&&s?(0,X.jsxs)(`button`,{type:`button`,className:`generated-media [.message-attachments_&]:flex [.message-attachments_&]:w-[min(360px,100%)] [.message-attachments_&]:flex-col [.message-attachments_&]:gap-[5px] [.message-attachments_&]:text-[var(--text-muted)] [.message-attachments_&]:no-underline [.message-attachments_button&]:border-0 [.message-attachments_button&]:bg-transparent [.message-attachments_button&]:p-0 [.message-attachments_button&]:text-left [.message-attachments_button&]:[cursor:zoom-in] [.message-attachments_&_img]:w-full [.message-attachments_&_img]:max-h-[320px] [.message-attachments_&_img]:[border:1px_solid_var(--stroke)] [.message-attachments_&_img]:rounded-[var(--r-sm)] [.message-attachments_&_img]:object-contain [.message-attachments_&_img]:bg-[var(--media-bg)] [.message-attachments_&_video]:w-full [.message-attachments_&_video]:max-h-[320px] [.message-attachments_&_video]:[border:1px_solid_var(--stroke)] [.message-attachments_&_video]:rounded-[var(--r-sm)] [.message-attachments_&_video]:object-contain [.message-attachments_&_video]:bg-[var(--media-bg)] [.message-attachments_&_small]:overflow-hidden [.message-attachments_&_small]:text-[13px] [.message-attachments_&_small]:text-ellipsis [.message-attachments_&_small]:whitespace-nowrap [.message-attachments.compact_&]:w-[min(190px,100%)] [.message-attachments.compact_&_img]:max-h-[130px] [.message-attachments.compact_&_video]:max-h-[130px]`,onClick:()=>{let e=F.findIndex(e=>e.attachmentIndex===t);e>=0&&o({images:F,index:e})},title:i(`chat:chatMessage.openFullScreenPreview`),children:[(0,X.jsx)(`img`,{alt:e.name||i(`chat:chatMessage.imageAttachment`),decoding:`async`,loading:`lazy`,src:s}),(0,X.jsx)(`small`,{children:e.name||i(`chat:chatMessage.generatedImage`)})]},a):e.kind===`video`&&s?(0,X.jsxs)(`div`,{className:`generated-media [.message-attachments_&]:flex [.message-attachments_&]:w-[min(360px,100%)] [.message-attachments_&]:flex-col [.message-attachments_&]:gap-[5px] [.message-attachments_&]:text-[var(--text-muted)] [.message-attachments_&]:no-underline [.message-attachments_button&]:border-0 [.message-attachments_button&]:bg-transparent [.message-attachments_button&]:p-0 [.message-attachments_button&]:text-left [.message-attachments_button&]:[cursor:zoom-in] [.message-attachments_&_img]:w-full [.message-attachments_&_img]:max-h-[320px] [.message-attachments_&_img]:[border:1px_solid_var(--stroke)] [.message-attachments_&_img]:rounded-[var(--r-sm)] [.message-attachments_&_img]:object-contain [.message-attachments_&_img]:bg-[var(--media-bg)] [.message-attachments_&_video]:w-full [.message-attachments_&_video]:max-h-[320px] [.message-attachments_&_video]:[border:1px_solid_var(--stroke)] [.message-attachments_&_video]:rounded-[var(--r-sm)] [.message-attachments_&_video]:object-contain [.message-attachments_&_video]:bg-[var(--media-bg)] [.message-attachments_&_small]:overflow-hidden [.message-attachments_&_small]:text-[13px] [.message-attachments_&_small]:text-ellipsis [.message-attachments_&_small]:whitespace-nowrap [.message-attachments.compact_&]:w-[min(190px,100%)] [.message-attachments.compact_&_img]:max-h-[130px] [.message-attachments.compact_&_video]:max-h-[130px] video`,children:[(0,X.jsx)(`video`,{controls:!0,preload:`metadata`,src:s}),(0,X.jsx)(`small`,{children:e.name||i(`chat:chatMessage.generatedVideo`)})]},a):e.kind===`link`?(0,X.jsxs)(`a`,{className:`inline-flex min-h-[28px] max-w-full min-w-0 items-center gap-[6px] rounded-sm border border-stroke bg-panel px-[9px] text-[13px] text-content-secondary no-underline transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground max-[650px]:min-h-11`,href:e.downloadUrl||void 0,children:[(0,X.jsx)(O,{size:14,className:`shrink-0 text-content-muted`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name||i(`chat:chatMessage.fileAttachment`)})]},a):(0,X.jsxs)(ae,{open:u===a,onOpenChange:t=>{d(t?a:null),t&&e.path&&n?ee(a,String(e.path)):y(null)},children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:e=>{g.current=e.currentTarget},className:`inline-flex min-h-[28px] max-w-full min-w-0 cursor-pointer items-center gap-[6px] rounded-sm border border-stroke bg-panel px-[9px] text-[13px] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground max-[650px]:min-h-11`,children:[(0,X.jsx)(O,{size:14,className:`shrink-0 text-content-muted`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name||i(`chat:chatMessage.fileAttachment`)})]})}),(0,X.jsxs)(ie,{align:`start`,sideOffset:6,className:`flex w-[190px] max-w-[calc(100vw-2rem)] flex-col gap-[2px] p-[4px]`,children:[(0,X.jsx)(Kn,{icon:(0,X.jsx)(w,{size:13}),label:i(`chat:chatMessage.fileActionPreview`),onClick:()=>{d(null),p(e)}}),(0,X.jsx)(Kn,{icon:(0,X.jsx)(S,{size:13}),label:i(`chat:chatMessage.fileActionDownload`),disabled:!e.downloadUrl,onClick:()=>V(e)}),e.path&&(0,X.jsx)(Kn,{icon:(0,X.jsx)(k,{size:13}),label:i(`chat:chatMessage.fileActionReveal`),onClick:()=>void R(String(e.path))}),n&&e.path&&(0,X.jsx)(Kn,{icon:m===a?(0,X.jsx)(N,{size:13,className:`animate-spin`}):(0,X.jsx)(E,{size:13}),label:i(`chat:chatMessage.fileActionDiff`),disabled:!!m,onClick:()=>void B(a,String(e.path))}),j[String(a)]?.canRevert&&(0,X.jsx)(Kn,{icon:x===String(a)?(0,X.jsx)(N,{className:`animate-spin`,size:13}):(0,X.jsx)(M,{size:13}),label:i(v===String(a)?`chat:chatMessage.fileActionConfirmRevert`:`chat:chatMessage.fileActionRevert`),disabled:!!(r||x),onClick:()=>void z(String(a),String(e.path))})]})]},a)}),I.size>qn&&(0,X.jsx)(`button`,{type:`button`,"aria-expanded":!L,onClick:()=>l(e=>!e),className:`inline-flex min-h-[28px] cursor-pointer items-center gap-[4px] rounded-sm border border-dashed border-stroke bg-transparent px-[9px] text-[13px] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground max-[650px]:min-h-11`,children:L?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_,{size:14,className:`shrink-0`}),i(`chat:chatMessage.moreFiles`,{count:L})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(b,{size:14,className:`shrink-0`}),i(`chat:chatMessage.fewerFiles`)]})})]}),a&&(0,Ct.createPortal)((0,X.jsx)(Wn,{images:a.images,index:a.index,onClose:()=>o(null),onNavigate:e=>o(t=>t&&{...t,index:e})}),document.body),f&&(0,X.jsx)($e,{attachment:f,onClose:()=>p(null),onRestoreFocus:()=>g.current?.focus(),onDownload:()=>V(f)}),T&&(0,X.jsx)(D,{diff:T.diff,truncated:T.truncated,onClose:()=>A(null)})]})}function Zn({sessionId:e,entryId:t,savedLabel:n,openRequest:r=0}){let{t:i}=s(),[a,o]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{r&&o(!0)},[r]);let[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{if(!a)return;let n=!0;return d(!0),h(``),Ze(e).then(e=>n&&l(e.labels[t]||``)).catch(e=>n&&h(Xe(e))).finally(()=>n&&d(!1)),()=>{n=!1}},[t,a,e]);let _=async()=>{if(!(f||u)){p(!0),h(``);try{let n=await ye.setSessionTreeLabel(e,t,c);Qe(e,n),o(!1)}catch(e){h(Xe(e))}finally{p(!1)}}},v=async()=>{if(!(f||u)){p(!0),h(``);try{let n=await ye.setSessionTreeLabel(e,t,``);Qe(e,n),l(``),o(!1)}catch(e){h(Xe(e))}finally{p(!1)}}};return(0,X.jsxs)(ae,{open:a,onOpenChange:o,children:[(0,X.jsxs)(ce,{children:[(0,X.jsx)(oe,{asChild:!0,children:(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,className:n?`bg-surface-hover text-brand`:void 0,"aria-label":i(`chat:chatMessage.labelThisTurn`),"aria-pressed":!!n,"data-pisper-label-entry":t,children:(0,X.jsx)(B,{size:14})})})}),(0,X.jsx)(se,{side:`top`,sideOffset:6,children:i(`chat:chatMessage.labelThisTurn`)})]}),(0,X.jsx)(ie,{className:`message-label-popover [&_form]:grid [&_form]:gap-[10px] [&_[data-slot='popover-title']]:text-[12px]`,align:`end`,sideOffset:6,children:(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_()},children:[(0,X.jsx)(G,{children:i(`chat:sessionTree.nodeLabel`)}),(0,X.jsx)(Ae,{autoFocus:!0,value:c,maxLength:80,disabled:u||f,placeholder:i(`chat:sessionTree.labelPlaceholder`),onChange:e=>l(e.target.value)}),m&&(0,X.jsx)(`small`,{className:`danger-text`,children:m}),(0,X.jsxs)(`div`,{className:`message-label-actions flex items-center justify-between gap-[8px]`,children:[(0,X.jsx)(q,{type:`button`,size:`icon-sm`,variant:`ghost`,title:i(`chat:sessionTree.removeLabel`),"aria-label":i(`chat:sessionTree.removeLabel`),disabled:u||f,onClick:()=>void v(),children:(0,X.jsx)(V,{})}),(0,X.jsxs)(q,{className:`message-label-save [.message-label-actions_&]:min-w-[104px] [.message-label-actions_&]:text-[var(--primary-foreground)]`,type:`submit`,disabled:u||f,children:[f?(0,X.jsx)(N,{className:`animate-spin`}):(0,X.jsx)(g,{}),i(f?`chat:sessionTree.savingLabel`:`chat:sessionTree.saveLabel`)]})]})]})})]})}function Qn(e){if(e<6e4)return`${(Math.max(e,100)/1e3).toFixed(1)}s`;let t=Math.round(e/1e3);return`${Math.floor(t/60)}m ${t%60}s`}function $n(e,t){if(typeof e!=`number`&&typeof e!=`string`)return null;let n=new Date(e);if(!Number.isFinite(n.getTime()))return null;let r=new Date().toDateString()===n.toDateString();return{iso:n.toISOString(),label:n.toLocaleString(t,{...r?{}:{month:`2-digit`,day:`2-digit`},hour:`2-digit`,minute:`2-digit`,hour12:!1}),full:n.toLocaleString(t)}}function er(e,t){return e.sessionId===t.sessionId&&e.message===t.message&&e.agentState===t.agentState&&e.showRunActivity===t.showRunActivity&&e.runProps===t.runProps&&e.cwd===t.cwd&&e.sessionStreaming===t.sessionStreaming&&e.onBranchFromHere===t.onBranchFromHere&&e.onCreateChildSession===t.onCreateChildSession&&e.retryUserMessageId===t.retryUserMessageId&&e.hideErrorNotice===t.hideErrorNotice&&e.onRetryLastTurn===t.onRetryLastTurn&&e.latest===t.latest&&e.turn===t.turn}var tr=(0,Y.memo)(function({sessionId:e,message:t,agentState:n,showRunActivity:r,runProps:i,cwd:a,sessionStreaming:o,onBranchFromHere:c,onCreateChildSession:l,retryUserMessageId:u,hideErrorNotice:d,onRetryLastTurn:f,latest:p=!1,turn:m}){let{t:h,language:g}=s(),_=(0,Y.useContext)(Et),[v,y]=(0,Y.useState)(!1),[b,S]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)(0),O=(0,Y.useRef)(!1),k=(0,Y.useRef)(null),A=!!(t.turnBoundaryEntryId&&c&&l),j=Ye(e,A?t.turnBoundaryEntryId:void 0),M=!!t.streaming,F=t.text||``,R=t.error&&F===t.error?``:F,ee=(0,Y.useCallback)(async t=>{let{url:n}=await ye.createHtmlPreview(e,t);if(!Ue(e,new URL(n,window.location.href).href))throw Error(`preview page limit reached`)},[e]),z=!!(i&&(String(i.thinkingText||``).trim()||(i.activityFeed?.length??0)>0||(i.tools?.length??0)>0||i.team)),V=t.role===`agent`?$n(t.timestamp,g):null,H=t.role===`agent`&&typeof t.thinkingMs==`number`&&Number.isFinite(t.thinkingMs)&&t.thinkingMs>0?t.thinkingMs:null,W=H===null?``:h(`chat:chatMessage.thinkingTime`,{duration:Qn(H)}),ie=t.role===`agent`&&!!(M||R||z||t.error||t.attachments?.length);return(0,X.jsxs)(Hn,{from:t.role===`agent`?`assistant`:`user`,className:K(`message group/message mx-auto mb-[var(--chat-message-gap,32px)] w-full max-w-[var(--chat-content-width,1040px)] min-w-0 gap-0`,t.role===`agent`?`items-stretch`:`items-end [[data-chat-message-style='plain']_&]:items-start`,t.role),"data-pisper-message-id":t.id,"data-pisper-role":t.role,"data-pisper-turn":m,"data-pisper-streaming":M||void 0,"data-pisper-error":t.error?`true`:void 0,children:[ie&&(0,X.jsxs)(`div`,{className:`agent-message-head mb-2 flex h-6 min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`agent-message-mark grid size-[22px] flex-none place-items-center`,"data-state":n,"aria-hidden":`true`,children:_?.botId?(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ge,{size:22}),children:(0,X.jsx)(Un,{botId:_.botId,part:`mark`,animate:p,fallback:(0,X.jsx)(Ge,{size:22})})}):(0,X.jsx)(Ge,{size:22})}),(0,X.jsx)(`span`,{className:`min-w-0 truncate font-medium text-content-secondary`,"data-agent-model":_&&p&&_.model?_.model:void 0,title:_?.botId&&p&&_.model?_.model:void 0,children:_?.botId?(0,X.jsx)(Y.Suspense,{fallback:p&&_.model?_.model:`Pisper`,children:(0,X.jsx)(Un,{botId:_.botId,part:`name`,fallback:p&&_.model?_.model:`Pisper`})}):_&&p&&_.model?_.model:`Pisper`}),W&&(0,X.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted tabular-nums`,"data-agent-thinking":H??void 0,children:W}),n===`thinking`&&(0,X.jsx)(le,{className:`size-3.5`}),j&&(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex h-[22px] min-w-0 max-w-[45%] items-center gap-1 rounded-full bg-surface-muted px-2 text-[12px] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus max-[650px]:h-11 pointer-coarse:h-11`,"aria-label":h(`chat:chatMessage.turnLabel`,{label:j}),title:h(`chat:chatMessage.turnLabel`,{label:j}),"data-turn-label":t.turnBoundaryEntryId,disabled:M,onClick:()=>D(e=>e+1),children:[(0,X.jsx)(B,{size:12,"aria-hidden":`true`,className:`flex-none`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:j})]}),V&&(0,X.jsx)(`time`,{className:`ml-auto flex-none text-[12px] text-content-muted tabular-nums`,dateTime:V.iso,title:V.full,children:V.label})]}),t.role===`user`&&t.fromBot&&(0,X.jsxs)(`div`,{className:`mb-1.5 flex h-6 min-w-0 items-center gap-1.5 text-[13px] text-content-secondary`,"data-message-from-bot":t.fromBot,children:[(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(Un,{botId:t.fromBot,part:`mark`,animate:!1})}),(0,X.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(Un,{botId:t.fromBot,part:`name`})})})]}),t.role===`user`&&!t.fromBot&&Array.isArray(t.fromSessions)&&t.fromSessions.length>0&&(0,X.jsxs)(`div`,{className:`mb-1.5 flex h-6 min-w-0 items-center gap-1.5 text-[13px] text-content-secondary`,"data-message-from-session":!0,children:[(0,X.jsx)(P,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:h(`chat:chatMessage.fromSession`,{title:t.fromSessions.map(e=>e.title||h(`chat:chatHistoryPage.untitledChat`)).join(` / `)})})]}),(0,X.jsxs)(`div`,{ref:k,className:K(`message-content relative min-w-0`,t.role===`agent`?`w-full`:`w-fit max-w-[min(640px,88%)] [[data-chat-message-style='plain']_&]:w-full [[data-chat-message-style='plain']_&]:max-w-full`),children:[r&&i&&(0,X.jsx)(Vn,{...i}),R&&(0,X.jsx)(Le,{cwd:a,onOpenLocalHtml:ee,streaming:M,className:K(`min-h-[34px] [overflow-wrap:anywhere] text-[length:var(--app-message-font-size)] [font-family:var(--font-content-family)] font-[400]`,t.role===`agent`?`w-full max-w-full rounded-none border-0 bg-transparent pt-1 leading-[1.625] [&_h1]:text-[1.5em]! [&_h1]:leading-[1.333333]! [&_h2]:text-[1.25em]! [&_h2]:leading-[1.4]! [&_h3]:text-[1.125em]! [&_h3]:leading-[1.555556]! [&_h1]:mt-[1em]! [&_h2]:mt-[1em]! [&_h3]:mt-[1em]! [&_h1]:mb-[.25em]! [&_h2]:mb-[.25em]! [&_h3]:mb-[.25em]! [&_li]:py-0! [&_li+li]:mt-[.25em]! [&_p]:mt-0! [&_p]:mb-[.25em]! [&_ul]:my-[.25em]! [&_ol]:my-[.25em]! [&_.markdown-content>p:first-child]:mt-0! [&_.markdown-content>p:last-child]:mb-0!`:`rounded-[18px] border-0 bg-[var(--user-bubble-bg)] px-4 py-2.5 text-[length:calc(var(--app-message-font-size)*.9375)]! leading-[1.65] text-[var(--user-bubble-text)] [&_.markdown-content>p]:my-0! [&_h1]:text-inherit! [&_h2]:text-inherit! [&_h3]:text-inherit! [&_h4]:text-inherit! [&_a]:text-inherit! [&_blockquote]:text-inherit! [&_code]:bg-panel [&_code]:shadow-[0_0_0_1px_var(--stroke-soft)] [[data-chat-message-style='plain']_&]:rounded-none [[data-chat-message-style='plain']_&]:bg-transparent [[data-chat-message-style='plain']_&]:px-0 [[data-chat-message-style='plain']_&]:py-1`),children:R}),t.attachments&&t.attachments.length>0&&(0,X.jsx)(Xn,{attachments:t.attachments,sessionId:e,sessionStreaming:o}),t.role===`user`&&R&&(0,X.jsxs)(`div`,{className:`message-actions mt-1 -mr-1.5 flex flex-wrap justify-end min-h-5 gap-0 text-muted-foreground opacity-0 group-hover/message:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100 max-[650px]:opacity-100 min-[651px]:absolute min-[651px]:right-full min-[651px]:bottom-0 min-[651px]:mr-1 min-[651px]:mt-0 [[data-chat-message-style='plain']_&]:static [[data-chat-message-style='plain']_&]:mr-0 [[data-chat-message-style='plain']_&]:justify-start [&_button]:size-7 [&_button]:min-h-7 max-[650px]:[&_button]:size-11 max-[650px]:[&_button]:min-h-11 pointer-coarse:[&_button]:size-11 pointer-coarse:[&_button]:min-h-11 [&_button]:rounded-md`,children:[t.queuedPending&&(0,X.jsx)(`span`,{className:`mr-auto self-center px-1.5 text-xs text-content-muted`,"data-message-queued":!0,children:h(`chat:chatMessage.queued`)}),(0,X.jsx)(Jt,{text:R,copyLabel:h(`chat:chatMessage.copyMessage`)})]})]}),t.role===`agent`&&t.interrupted&&(0,X.jsx)(`p`,{className:`mt-1 text-xs text-content-muted`,"data-message-interrupted":!0,children:h(`chat:chatMessage.interrupted`)}),t.error&&!M&&!d&&(0,X.jsx)(Dt,{error:String(t.error),className:`mt-3`}),t.role===`agent`&&!M&&(R||t.turnBoundaryEntryId||u)&&(0,X.jsxs)(`div`,{className:`message-actions mt-2 -ml-1.5 flex flex-wrap items-center min-h-5 gap-0 text-[var(--text-muted)] opacity-0 transition-opacity duration-(--d-fast) group-hover/message:opacity-100 focus-within:opacity-100 has-[[data-state=open]]:opacity-100 has-[[aria-busy=true]]:opacity-100 [@media(hover:none)]:opacity-100 max-[650px]:opacity-100 [&_button]:size-7 [&_button]:min-h-7 max-[650px]:[&_button]:size-11 max-[650px]:[&_button]:min-h-11 pointer-coarse:[&_button]:size-11 pointer-coarse:[&_button]:min-h-11 [&_button]:rounded-md [&_button]:text-[var(--text-muted)] [&_button:hover]:bg-[var(--surface-hover)] [&_button:hover]:text-[var(--text)]`,"data-reply-actions":!0,children:[R&&(0,X.jsx)(Jt,{text:R,getText:()=>k.current?.querySelector(`.markdown-content`)?.innerText.trim()||``}),A&&t.turnBoundaryEntryId&&(0,X.jsx)(Zn,{sessionId:e,entryId:t.turnBoundaryEntryId,savedLabel:j,openRequest:E}),u&&(0,X.jsxs)(ce,{children:[(0,X.jsx)(oe,{asChild:!0,children:(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":h(`chat:chatMessage.retry`),"data-pisper-retry-message":u,disabled:w||o,onClick:async()=>{T(!0);try{await f()}finally{T(!1)}},children:w?(0,X.jsx)(N,{className:`animate-spin`,size:14}):(0,X.jsx)(L,{size:14})})}),(0,X.jsx)(se,{side:`top`,sideOffset:6,children:h(`chat:chatMessage.retry`)})]}),(R||A)&&(0,X.jsxs)(U,{children:[(0,X.jsx)(ne,{asChild:!0,children:(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":h(`chat:chatMessage.moreReplyActions`),"data-reply-more":!0,children:(0,X.jsx)(C,{size:16})})}),(0,X.jsxs)(re,{align:`start`,className:`min-w-52 p-1 [&_[role=menuitem]]:min-h-9 max-[650px]:[&_[role=menuitem]]:min-h-11`,onCloseAutoFocus:e=>{O.current&&(O.current=!1,e.preventDefault())},children:[A&&t.turnBoundaryEntryId&&(0,X.jsxs)(te,{"data-pisper-derive-entry":t.turnBoundaryEntryId,disabled:v||b||o,onSelect:async()=>{let e=t.turnBoundaryEntryId;if(!(!e||!c)){y(!0);try{await c(e)}finally{y(!1)}}},children:[(0,X.jsx)(tt,{size:16}),h(`chat:chatMessage.deriveFromHere`)]}),A&&t.turnBoundaryEntryId&&(0,X.jsxs)(te,{"data-pisper-rewind-entry":t.turnBoundaryEntryId,disabled:v||b||o,onSelect:async()=>{let e=t.turnBoundaryEntryId;if(!(!e||!c)){y(!0);try{await c(e,{rewindFiles:!0})}finally{y(!1)}}},children:[(0,X.jsx)(I,{size:16}),h(`chat:chatMessage.rewindHere`)]}),A&&t.turnBoundaryEntryId&&(0,X.jsxs)(te,{"data-reply-label":!0,onSelect:()=>{O.current=!0,window.setTimeout(()=>D(e=>e+1),0)},children:[(0,X.jsx)(B,{size:16}),h(`chat:chatMessage.labelThisTurn`)]}),R&&(0,X.jsxs)(te,{"data-reply-copy-markdown":!0,onSelect:()=>{navigator.clipboard?.writeText(R).catch(()=>void 0)},children:[(0,X.jsx)(x,{size:16}),h(`board:transcript.copyMarkdown`)]}),A&&t.turnBoundaryEntryId&&(0,X.jsxs)(te,{"data-pisper-child-entry":t.turnBoundaryEntryId,disabled:v||b,onSelect:async()=>{let e=t.turnBoundaryEntryId;if(!(!e||!l)){S(!0);try{await l(e)}finally{S(!1)}}},children:[(0,X.jsx)(rt,{size:16}),h(`chat:chatMessage.createChildChat`)]})]})]})]})]})},er);function nr(e,t){return e.message===t.message}(0,Y.memo)(function({message:e}){return(0,X.jsxs)(Hn,{from:e.role===`agent`?`assistant`:`user`,className:`[&_>_span]:pt-[5px] [&_>_span]:text-[var(--text-muted)] [&_>_span]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_>_span]:text-[12px] [&_>_span]:font-medium [&.agent_>_span::before]:[content:'✦'] [&.agent_>_span::before]:mr-[4px] [&.agent_>_span::before]:text-content-muted [&_.markdown-body]:rounded-[var(--r-xs)] [&_.markdown-body]:bg-[var(--surface-subtle)] [&_.markdown-body]:[padding:6px_8px] [&_.markdown-body]:text-[13px] [&_.markdown-body]:leading-[1.45] [&_.markdown-body]:[overflow-wrap:anywhere] [&.agent_.markdown-body]:bg-[var(--surface-muted)] [&_.markdown-body_pre]:max-h-[130px] [&_.markdown-body_pre]:[padding:7px] grid grid-cols-[34px_minmax(0,1fr)] gap-[6px] [margin-bottom:6px] [align-items:start] ${e.role}`,"data-pisper-message-id":e.id,"data-pisper-role":e.role,"data-pisper-streaming":e.streaming||void 0,children:[(0,X.jsx)(`span`,{children:e.role===`agent`?`Pisper`:`You`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(e.text||!e.streaming)&&(0,X.jsx)(Le,{streaming:e.streaming,children:e.text}),e.attachments&&e.attachments.length>0&&(0,X.jsx)(Xn,{attachments:e.attachments,compact:!0})]})]})},nr);function rr(e,t,n){let r=Date.parse(e),i=t?Date.parse(t):n;if(!Number.isFinite(r)||!Number.isFinite(i))return``;let a=Math.max(0,Math.round((i-r)/1e3)),o=Math.floor(a/60);return o?`${o}:${String(a%60).padStart(2,`0`)}`:`${a}s`}function ir({sessionId:e,agent:t,onChanged:n}){let{t:r}=s(),[i,a]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(()=>Date.now()),d=kt(t);(0,Y.useEffect)(()=>{if(!d)return;let e=window.setInterval(()=>u(Date.now()),1e3);return()=>window.clearInterval(e)},[d]);let f=t.status===`completed`?r(`chat:agentJob.completed`):t.status===`failed`?r(`chat:agentJob.failed`):t.status===`interrupted`?r(`chat:agentJob.interrupted`):t.status===`running`?r(`chat:agentJob.running`):r(`chat:agentJob.queued`),p=rr(t.startedAt,t.completedAt,l),m=`agent-job-${t.id}`,h=async()=>{c(!0);try{await Pt(e,t.id)}catch{}finally{c(!1),n()}};return(0,X.jsxs)(`div`,{"data-agent-job":t.id,"data-agent-job-status":t.status,className:`mx-auto mb-[var(--chat-message-gap,32px)] w-full max-w-[var(--chat-content-width,1040px)] min-w-0 rounded-lg border border-stroke-soft bg-surface-subtle text-[13px]`,children:[(0,X.jsxs)(`div`,{className:`flex min-h-10 items-center gap-2 px-3 py-1.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 flex-none place-items-center`,children:d?(0,X.jsx)(le,{className:`size-3.5`}):t.status===`completed`?(0,X.jsx)(g,{size:14,className:`text-st-done`}):(0,X.jsx)(H,{size:14,className:`text-content-muted`})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,X.jsx)(`span`,{className:`font-medium text-content`,children:t.kind===`command`?r(`chat:agentJob.command`,{command:t.taskName}):r(`chat:agentJob.title`,{task:t.taskName})}),(0,X.jsxs)(`span`,{className:`text-content-muted`,children:[` · `,f,d&&t.activity?` · ${t.activity}`:``]})]}),p&&(0,X.jsx)(`span`,{className:`flex-none font-mono text-xs text-content-muted tabular-nums`,children:p}),d&&(0,X.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`flex-none pointer-coarse:h-11`,disabled:o,onClick:()=>void h(),children:[(0,X.jsx)(z,{"aria-hidden":`true`}),r(`chat:agentJob.stop`)]}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none pointer-coarse:size-11`,"aria-expanded":i,"aria-controls":m,"aria-label":r(i?`chat:agentJob.collapse`:`chat:agentJob.expand`),title:r(i?`chat:agentJob.collapse`:`chat:agentJob.expand`),onClick:()=>a(e=>!e),children:(0,X.jsx)(_,{"aria-hidden":`true`,className:K(`transition-transform`,i&&`rotate-180`)})})]}),i&&(0,X.jsxs)(`div`,{id:m,className:`flex flex-col gap-2 border-t border-stroke-soft px-3 py-2.5`,children:[(0,X.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:[t.model?r(`chat:agentJob.model`,{model:t.model}):``,t.toolCallCount?r(`chat:agentJob.tools`,{count:t.toolCallCount}):``].filter(Boolean).join(` · `)}),(0,X.jsx)(`p`,{className:`m-0 line-clamp-4 whitespace-pre-wrap text-content-secondary`,children:t.message}),(t.output||t.error)&&(0,X.jsx)(`p`,{className:`m-0 line-clamp-6 whitespace-pre-wrap text-content`,children:t.error||t.output})]})]})}var ar=(0,Y.lazy)(()=>t(()=>import(`./public-session-DSLmbBcw.js`),__vite__mapDeps([7,1,8,2,9,10,11,12,13,14,15,16,17,4,18,3,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35])));function or({link:e}){let{t}=s(),n=e.status===`stopped`?e.reason===`rate`?t(`chat:botLink.stoppedRate`):t(`chat:botLink.stoppedHops`):e.status===`answered`?t(`chat:botLink.answered`):t(`chat:botLink.waiting`);return(0,X.jsxs)(`div`,{"data-bot-link":e.id,"data-bot-link-status":e.status,className:`mx-auto mb-[var(--chat-message-gap,32px)] flex min-h-10 w-full max-w-[var(--chat-content-width,1040px)] min-w-0 items-center gap-2 rounded-lg border border-stroke-soft bg-surface-subtle px-3 py-1.5 text-[13px]`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 flex-none place-items-center`,children:e.status===`waiting`?(0,X.jsx)(nt,{size:14,className:`text-content-muted`}):e.status===`answered`?(0,X.jsx)(g,{size:14,className:`text-st-done`}):(0,X.jsx)(it,{size:14,className:`text-content-muted`})}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex flex-none items-center`,children:(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(ar,{botId:e.botId,part:`mark`,animate:!1})})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,X.jsx)(`span`,{className:`font-medium text-content`,children:(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(ar,{botId:e.botId,part:`name`})})}),(0,X.jsxs)(`span`,{className:`text-content-muted`,children:[` · `,n,e.direction===`out`&&e.text?` — ${e.text}`:``]})]})]})}function sr(e){return(e||0)>0&&Number(e)<650?260:164}function cr(e,t){let n=t?.borderBoxSize?.[0];return Math.ceil(n?.blockSize??e.getBoundingClientRect().height)}function lr(e,t,n){let[r,i]=(0,Y.useState)(0);return(0,Y.useLayoutEffect)(()=>{let r=n.current;if(!e||!r)return;let a=()=>{let t=Math.max(0,r.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop);i(e=>Math.abs(e-t)<1?e:t)},o=null,s=()=>{o===null&&(o=window.requestAnimationFrame(()=>{o=null,a()}))};a();let c=typeof ResizeObserver>`u`?null:new ResizeObserver(s);return c?.observe(e),t.current&&c?.observe(t.current),c?.observe(r),window.addEventListener(`resize`,s),()=>{c?.disconnect(),window.removeEventListener(`resize`,s),o!==null&&window.cancelAnimationFrame(o)}},[n,t,e]),r}var ur=(0,Y.memo)(function({sessionId:e,layoutMeasurementKey:t,messages:n,historical:r=!1,streaming:i,latestRunProps:a,scrollElement:o,prefixRef:s,cwd:c,targetEntryId:l,onContentSizeChange:u,onTargetScroll:d,onTargetLocated:f,onBranchFromHere:p,onCreateChildSession:m,onRetryLastTurn:h,turnsKnown:g=!1,turnBase:_=0}){let v=(0,Y.useContext)(Ft),y=(0,Y.useRef)(null),[b,x]=(0,Y.useState)(``),S=n.map(e=>e.id),C=(0,Y.useRef)(S);(C.current.length!==S.length||C.current.some((e,t)=>e!==S[t]))&&(C.current=S);let w=C.current,T=(0,Y.useMemo)(()=>{let e=Array.from({length:n.length}),t;for(let r=0;r<n.length;r+=1)n[r]?.role===`user`&&(t=n[r].id),e[r]=t;return e},[n]),E=(0,Y.useMemo)(()=>{if(!g)return null;let e=Array.from({length:n.length}),t=_;for(let r=0;r<n.length;r+=1)n[r]?.role===`user`&&(t+=1),e[r]=t;return e},[n,_,g]),D=lr(o,s,y),O=(0,Y.useCallback)(e=>w[e]??`transcript-message-${e}`,[w]),k=(0,Y.useCallback)(()=>sr(o?.clientWidth),[o]),A=ze({useFlushSync:!1,anchorTo:`end`,followOnAppend:!1,count:n.length,getScrollElement:()=>o,getItemKey:O,estimateSize:k,measureElement:cr,overscan:6,scrollMargin:D,useAnimationFrameWithResizeObserver:!0}),j=A.getVirtualItems(),M=A.getTotalSize(),N=(0,Y.useCallback)(()=>{let e=y.current;if(!e||!o||e.getBoundingClientRect().width<1)return;let t=o.scrollTop,n=A.getVirtualItems().find(e=>e.end>t),r=n?Math.max(0,t-n.start):0;A.measure(),A.getTotalSize();for(let t of e.children)t instanceof HTMLDivElement&&A.measureElement(t);if(A.getTotalSize(),n){let e=A.getOffsetForIndex(n.index,`start`)?.[0];e!==void 0&&A.scrollToOffset(e+r)}u()},[u,o,A]);(0,Y.useLayoutEffect)(()=>{N()},[t,N]),(0,Y.useLayoutEffect)(()=>{let e=y.current;if(!e||typeof ResizeObserver>`u`)return;let t=e.getBoundingClientRect().width,n=null,r=new ResizeObserver(()=>{let r=e.getBoundingClientRect().width;Math.abs(r-t)<1||(t=r,n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,N()}))});return r.observe(e),()=>{r.disconnect(),n!==null&&window.cancelAnimationFrame(n)}},[N]),(0,Y.useLayoutEffect)(()=>{u()},[u,M]),(0,Y.useEffect)(()=>{if(!l)return;let e=n.findIndex(e=>e.turnBoundaryEntryId===l);if(e<0)return;d(),A.scrollToIndex(e,{align:`center`}),x(l);let t=window.requestAnimationFrame(()=>{A.scrollToIndex(e,{align:`center`}),f(l)});return()=>window.cancelAnimationFrame(t)},[n,f,d,l,A]),(0,Y.useEffect)(()=>{if(!b)return;let e=window.setTimeout(()=>x(``),2200);return()=>window.clearTimeout(e)},[b]);let P=pt(n);return(0,X.jsx)(`div`,{className:`relative w-full`,"data-pisper-transcript-size":n.length,"data-pisper-rendered-count":j.length,ref:y,style:{height:`${M}px`},children:j.map(t=>{let o=n[t.index];if(!o)return null;if(o.role===`event`){let e=v?.agents.get(String(o.agentId||``)),n=v?.links.get(String(o.linkId||``));return(0,X.jsx)(`div`,{className:`virtual-transcript-item absolute left-0 [display:flow-root] w-full`,"data-index":t.index,"data-pisper-virtual-item":o.id,ref:A.measureElement,style:{top:`${t.start-D}px`},children:e&&v?(0,X.jsx)(ir,{sessionId:v.sessionId,agent:e,onChanged:v.reload}):n?(0,X.jsx)(or,{link:n}):null},t.key)}let s=!r&&o.role===`agent`&&t.index===P,l=o.streaming||s&&i?`thinking`:s&&!o.error?`waiting`:`idle`,u=vt(o,s,a);return(0,X.jsx)(`div`,{className:`virtual-transcript-item absolute left-0 [display:flow-root] w-full rounded-[var(--r-sm)] ${o.turnBoundaryEntryId===b?`targeted [.virtual-transcript-item&]:bg-[var(--star-soft)] [.virtual-transcript-item&]:shadow-[inset_3px_0_0_var(--star-strong)]`:``}`,"data-index":t.index,"data-pisper-target-entry":o.turnBoundaryEntryId===b?o.turnBoundaryEntryId:void 0,"data-pisper-virtual-item":o.id,ref:A.measureElement,style:{top:`${t.start-D}px`},children:(0,X.jsx)(tr,{sessionId:e,message:o,agentState:l,showRunActivity:!!u,runProps:u,cwd:c,sessionStreaming:i,onBranchFromHere:p,onCreateChildSession:m,retryUserMessageId:s?T[t.index]:void 0,hideErrorNotice:s&&!!o.error,onRetryLastTurn:h,latest:s,turn:E?.[t.index]||void 0})},t.key)})})}),dr=(0,Y.lazy)(()=>t(()=>import(`./public-greeting-Cs-sacVq.js`),__vite__mapDeps([36,1,8,2,4,9,10,11,12,13,14,16,37,38,39,27,33,25,26,28,29,32,40,41,42,43,44,17,18,3,45,46,47,48,49,50,51,52,30,53,54,34,55,19,20,56,57,58,59,60,61,62,63,64,65,66,21,22,23,24,35,31])));function fr({label:e}){return(0,X.jsxs)(`div`,{className:`session-history-loading grid min-h-[100%] place-content-center justify-items-center gap-[20px] text-content-muted [animation:transcript-stage-enter_.18s_var(--ease-out)_both]`,role:`status`,"aria-live":`polite`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-[10px]`,children:[(0,X.jsx)(Ge,{size:22}),(0,X.jsx)(`strong`,{className:`text-[13px] font-medium text-content-secondary`,children:e}),(0,X.jsx)(le,{className:`size-4`})]}),(0,X.jsxs)(`div`,{className:`grid w-[min(560px,78vw)] gap-[12px]`,"aria-hidden":`true`,children:[(0,X.jsx)(`div`,{className:`h-[40px] w-[46%] justify-self-end rounded-[12px_12px_3px_12px] bg-[var(--user-bubble-bg)]`}),(0,X.jsxs)(`div`,{className:`grid gap-[8px]`,children:[(0,X.jsx)(`div`,{className:`h-[34px] rounded-md border border-stroke-soft bg-surface-subtle`}),(0,X.jsx)(`div`,{className:`h-[10px] w-[82%] rounded-full bg-surface-muted`}),(0,X.jsx)(`div`,{className:`h-[10px] w-[64%] rounded-full bg-surface-muted`})]})]})]})}function pr(e){return e.map(e=>e.id).join(`
7
+ `)}function mr(e){let{pathname:t,search:n,hash:r}=window.location;return r.startsWith(`#/`)?`${t}${n}#${a(e)}`:a(e)}function hr({sessionId:e,botId:t,emptyState:n,messages:r,layoutMeasurementKey:i,transcriptLoadState:a=`ready`,messageStart:o,hasOlder:c,hasNewer:l,onLoadLatest:u,loadingOlder:d,olderError:f,currentActivity:p,team:m,activityFeed:g,tools:_,thinkingText:v,compaction:b,streaming:x,runStartedAt:S,lastActivityAt:C,runFinishedAt:w,runStopped:T,runNotice:E,error:D,scrollRequest:O,cwd:k,lineage:A,onLoadOlder:j,onBranchFromHere:M,onCreateChildSession:N,onRetryLastTurn:P,collapseEarlierTurns:I=!1}){let{t:L}=s(),[R,ee]=(0,Y.useState)(!1),z=(0,Y.useRef)(null),[B,V]=(0,Y.useState)(!1),H=(0,Y.useRef)(e);H.current=e,(0,Y.useEffect)(()=>{z.current=null,V(!1)},[e]);let te=(0,Y.useRef)(null),[ne,re]=(0,Y.useState)(()=>fe(e)),U=(0,Y.useMemo)(()=>I?qt(r,{turnsKnown:!c}):null,[I,c,r]),W=!!U&&!R&&!ne,ie=W&&U?r.slice(U.latestIndex):r,G=r[pt(r)],ae=Math.floor((G?.text?.length||0)/64),oe=Ee(g),se=Math.floor(String(v||``).length/128),ce=`${e}:${r.length}:${G?.id||``}:${ae}:${se}:${G?.attachments?.length||0}:${oe}:${b?.status||``}:${b?.finishedAt||``}:${D||``}:${x?`1`:`0`}`,he=(0,Y.useRef)(!1),ge=(0,Y.useRef)(We.getState().sessions[e]?.conversationScrollTop??null),{scrollRef:_e,scrollElement:ve,setScrollRef:ye,hasUnread:be,scrollToBottom:Se,maintainBottom:Ce,pauseFollowing:we}=Wt(ce,{resetKey:`${e}:${a}`,readInitialPosition:()=>a===`ready`?ge.current:null});(0,Y.useEffect)(()=>{let t=null,n=()=>{let t=ve;if(!t||a!==`ready`||t.clientHeight<=0)return;let n=We.getState();n.sessions[e]?.conversationScrollTop!==t.scrollTop&&n.update(e,`files`,{type:`workspace`,conversationScrollTop:t.scrollTop})},r=()=>{n(),he.current=!0,t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{he.current=!1,t=null})};return window.addEventListener(ue,r),window.addEventListener(`pointerdown`,n,!0),()=>{window.removeEventListener(ue,r),t!==null&&cancelAnimationFrame(t),window.removeEventListener(`pointerdown`,n,!0)}},[e,ve,a]),(0,Y.useLayoutEffect)(()=>{let t=ve;if(!(!t||a!==`ready`))return()=>{if(t.clientHeight<=0)return;let n=We.getState();n.sessions[e]?.conversationScrollTop!==t.scrollTop&&n.update(e,`files`,{type:`workspace`,conversationScrollTop:t.scrollTop})}},[e,ve,a]);let Te=(0,Y.useMemo)(()=>({streaming:x,text:G?.role===`agent`?G.text:``,currentActivity:p,team:m,activityFeed:g,tools:_,thinkingText:v,compaction:b,error:D||(G?.role===`agent`?G.error:``),stopped:T,notice:E,startedAt:S,lastActivityAt:C,finishedAt:w}),[x,G,p,m,g,_,v,b,D,T,E,S,C,w]),J=(0,Y.useCallback)(async()=>{if(!_e.current||!c||d||z.current)return;we();let t={};z.current=t;let n=e,r=await j?.();H.current===n&&!r&&z.current===t&&(z.current=null)},[c,d,j,we,e,_e]),De=(0,Y.useCallback)(t=>{!he.current&&a===`ready`&&t.currentTarget.clientHeight>0&&We.getState().update(e,`files`,{type:`workspace`,conversationScrollTop:t.currentTarget.scrollTop}),!W&&t.currentTarget.scrollTop<=96&&J()},[W,J,e,a]);(0,Y.useLayoutEffect)(()=>{z.current=null},[o]);let Oe=(0,Y.useRef)(r);(0,Y.useEffect)(()=>{Oe.current=r});let ke=(0,Y.useRef)(null),[Ae,Me]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{re(fe(e));let t=0,n=n=>{let r=n.detail;r?.sessionId===e&&r.targetEntryId&&(ke.current=pr(Oe.current),window.clearTimeout(t),t=window.setTimeout(()=>{ke.current=null,Me(e=>e+1)},4e3),re(r.targetEntryId))};return window.addEventListener(pe,n),()=>{window.clearTimeout(t),ke.current=null,window.removeEventListener(pe,n)}},[e]),(0,Y.useEffect)(()=>{if(!(!ne||o==null)&&!r.some(e=>e.turnBoundaryEntryId===ne)){if(ke.current!==null){if(ke.current===pr(r))return;ke.current=null}if(!d){if(c){J();return}de(e,ne),re(``)}}},[c,J,d,o,r,e,ne,Ae]),(0,Y.useEffect)(()=>{O&&Se(`smooth`)},[O,Se]);let Ne=(0,X.jsx)(je,{compact:!0,className:`min-h-full`,title:L(`chat:focusSession.emptyTitle`),description:L(`chat:focusSession.emptyDescription`)});return(0,X.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`transcript flex flex-col [.focus-session.has-conversation_&]:p-[var(--chat-transcript-block-padding,30px)_max(24px,calc((100%_-_var(--chat-content-width,1040px))/2))] [.focus-session.has-conversation_&]:[scroll-padding-bottom:32px] @max-[700px]:p-[20px_14px] @max-[700px]:[.focus-session.has-conversation_&]:p-[24px_16px] @max-[470px]:[padding-inline:10px] max-[650px]:p-[20px_14px] min-h-0 h-full flex-1 overflow-auto overscroll-contain scroll-auto [overflow-anchor:none] [scrollbar-gutter:stable_both-edges] m-0 border-0 [padding:26px_max(24px,calc((100%_-_var(--chat-content-width,1040px))/2))] [padding-bottom:70px] [scroll-padding-bottom:70px]`,"data-pisper-transcript-state":a,"aria-busy":a===`loading`,ref:ye,onScroll:De,tabIndex:0,children:[(0,X.jsxs)(`div`,{className:`[display:flow-root] w-full ${a===`ready`&&r.length>0?`mt-auto`:``}`,ref:te,children:[t&&a===`ready`&&r.length>0&&!c&&!W&&(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(dr,{botId:t,collapsed:!0})}),typeof A?.parentSessionId==`string`&&A.parentSessionId&&(0,X.jsx)(`div`,{className:`history-page-loader flex w-[min(var(--chat-content-width,1040px),100%)] min-h-[42px] items-center justify-center [margin:0_auto_18px] text-[var(--text-muted)] text-[12px] session-lineage`,children:(0,X.jsxs)(`a`,{href:mr(A.parentSessionId),className:`inline-flex min-h-8 max-w-full items-center gap-[7px] rounded-md px-2 text-inherit underline-offset-2 transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content hover:underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus max-[650px]:min-h-11`,"data-pisper-parent-session":A.parentSessionId,title:L(`chat:focusSession.openSourceTurn`),onClick:e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),me(String(A.parentSessionId),`open`,typeof A.sourceEntryId==`string`?A.sourceEntryId:``))},children:[(0,X.jsx)(tt,{size:13,"aria-hidden":`true`,className:`flex-none`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:L(`chat:focusSession.derivedFromSession`,{name:A.sourceSessionName||L(`chat:focusSession.unknownSourceSession`)})})]})}),W&&U&&(0,X.jsx)(`div`,{className:`flex justify-center pb-3`,children:(0,X.jsxs)(`button`,{type:`button`,"data-earlier-turns":U.turnBase,"aria-expanded":!1,"aria-label":L(`board:phone.earlierTurns`,{summary:[U.previous.turn?L(`board:transcript.turn`,{count:U.previous.turn}):L(`board:phone.previousTurn`),U.previous.text].filter(Boolean).join(` · `)}),className:`inline-flex min-h-11 max-w-full min-w-0 items-center gap-1.5 rounded-full px-3 text-xs text-content-muted ring-1 ring-stroke ring-inset transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus`,onClick:()=>ee(!0),children:[(0,X.jsx)(xe,{status:U.previous.failed?`failed`:`done`,className:K(`size-3.5 flex-none`,U.previous.failed?`text-st-fail`:`text-st-done`)}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:[U.previous.turn?L(`board:transcript.turn`,{count:U.previous.turn}):L(`board:phone.previousTurn`),U.previous.text,U.previous.operations?L(`board:transcript.operations`,{count:U.previous.operations}):``].filter(Boolean).join(` · `)}),(0,X.jsx)(y,{className:`size-3.5 flex-none`,"aria-hidden":`true`})]})}),!W&&(c||d||f)&&(0,X.jsx)(`div`,{className:`history-page-loader flex w-[min(var(--chat-content-width,1040px),100%)] min-h-[42px] items-center justify-center gap-[7px] [margin:0_auto_18px] text-[var(--text-muted)] text-[12px]`,children:f?(0,X.jsxs)(q,{type:`button`,variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:J,children:[(0,X.jsx)(F,{size:13}),L(`chat:focusSession.retryOlderMessages`)]}):d?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(le,{className:`size-3.5`}),L(`chat:focusSession.loadingOlderMessages`)]}):(0,X.jsxs)(q,{type:`button`,variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:J,children:[(0,X.jsx)(h,{className:`history-up-arrow [.history-page-loader_&]:[transform:rotate(180deg)]`,size:14}),L(`chat:focusSession.loadOlderMessages`)]})})]}),a===`loading`&&(0,X.jsx)(fr,{label:L(`chat:focusSession.loadingConversationHistory`)}),a===`ready`&&!r.length&&(n??(t?(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(dr,{botId:t,fallback:Ne})}):Ne)),a===`ready`&&r.length>0&&(0,X.jsx)(`div`,{className:`[animation:transcript-reveal-enter_.22s_var(--ease-out)_both]`,children:(0,X.jsx)(ur,{layoutMeasurementKey:i,sessionId:e,messages:ie,historical:l,streaming:x,latestRunProps:Te,scrollElement:ve,prefixRef:te,cwd:k,targetEntryId:ne,onContentSizeChange:Ce,onTargetScroll:we,onTargetLocated:t=>{de(e,t),re(``)},onBranchFromHere:M,onCreateChildSession:N,onRetryLastTurn:P,turnsKnown:!c,turnBase:W&&U?U.turnBase:0},e)})]}),a===`ready`&&r.length>0&&(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-x-0 top-0 z-[2] h-6 bg-linear-to-b from-panel to-transparent max-[650px]:h-10`}),(be||l)&&(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[6px] z-[5] flex justify-center`,children:(0,X.jsxs)(q,{type:`button`,variant:`secondary`,size:`sm`,className:`pointer-events-auto rounded-full px-3 shadow-float max-[650px]:h-11`,disabled:B,"aria-busy":B||void 0,onClick:async()=>{if(!l){Se(`smooth`);return}let t=e;if(l){V(!0);try{await u?.()}finally{H.current===t&&V(!1)}}H.current===t&&requestAnimationFrame(()=>Se(`auto`))},children:[(0,X.jsx)(h,{size:14}),L(l?`chat:focusSession.returnToLatest`:`chat:focusSession.newContent`)]})})]})}(0,Y.lazy)(()=>t(()=>import(`./ClickSpark-B1Rn7ZwL.js`).then(e=>({default:e.ClickSpark})),__vite__mapDeps([67,1,2,3,4,6])));var gr=(0,Y.createContext)(null),_r=({className:e,approval:t,state:n,...r})=>{let i=(0,Y.useMemo)(()=>({approval:t,state:n}),[t,n]);return!t||n===`input-streaming`||n===`input-available`?null:(0,X.jsx)(gr.Provider,{value:i,children:(0,X.jsx)(Me,{className:K(`flex flex-col gap-2`,e),...r})})},vr=(0,Y.lazy)(async()=>{let[{ApprovalConfirm:e}]=await Promise.all([t(()=>import(`./approval-confirm-BrorOUHg.js`),__vite__mapDeps([68,1,2,9,10,8,11,12,13,14,69,16,3,4,17,18,70,71,46,47,48,49,72,73,45,74])),o()]);return{default:e}});function $(e){return typeof e==`string`?e:``}function yr(e){let t=e.args&&typeof e.args==`object`&&!Array.isArray(e.args)?e.args:{};return{id:$(e.id),toolName:$(e.toolName),toolCallId:$(e.toolCallId),args:t,command:$(t.command),path:$(t.path),reason:$(e.reason),risk:$(e.risk),severity:`critical`,createdAt:$(e.createdAt)||null}}function br(e){return e.trimStart().startsWith(`命令守卫拦截`)&&e.trimStart().slice(6).replace(/^[\s::·-]+/u,``).split(/[\n。;;]/u)[0]?.trim()||``}function xr({text:e,prefix:t}){let{t:n}=s(),r=(0,Y.useRef)(null),[i,a]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(!1);return(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e||o)return;let t=()=>a(e.scrollHeight>e.clientHeight+1);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[o,e]),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-sm border border-well-stroke bg-well`,"data-approval-command":!0,children:[(0,X.jsx)(`div`,{className:`px-2.5 py-1.5`,children:(0,X.jsxs)(`pre`,{ref:r,className:K(`min-w-0 font-mono text-xs leading-5 whitespace-pre-wrap wrap-anywhere text-well-text`,!o&&`line-clamp-3`),children:[t&&(0,X.jsxs)(`span`,{className:`text-well-muted select-none`,children:[t,` `]}),e]})}),(i||o)&&(0,X.jsx)(`button`,{type:`button`,className:`w-full border-t border-well-stroke px-2.5 py-1 text-left text-xs text-content-secondary hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-11 pointer-coarse:min-h-11`,"aria-expanded":o,onClick:()=>c(e=>!e),children:n(o?`board:card.collapse`:`board:card.expand`)})]})}function Sr({approvals:e,onResolve:t,compact:n=!1,sessionTitle:r=``,cwd:i=``}){let{t:a}=s(),o=u(),[c,d]=(0,Y.useState)(!1),[p,h]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(!1),[b]=(0,Y.useState)(()=>Be()),x=(0,Y.useRef)(!1),[S,C]=(0,Y.useState)(``),w=(0,Y.useRef)(null),T=ge(e=>e.boardBindings),O=e[0];(0,Y.useEffect)(()=>{h(!1),v(!1),C(``)},[O?.id]);let k=O?.id;if((0,Y.useEffect)(()=>{if(!k)return;let e=e=>{if(he(e)||ve(e.target)||e.target instanceof Element&&e.target.closest(`[data-shell-sidebar]`))return;let t=w.current;if(!t||t.getClientRects().length===0)return;let n=_e(e,T.boardApprove)?`[data-approval-primary]`:_e(e,T.boardDeny)?`[data-approval-deny]`:``,r=n?t.querySelector(n):null;!r||r.disabled||(e.preventDefault(),r.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[k,T.boardApprove,T.boardDeny]),!O)return null;let A=l(O)===`critical`,j=O.fileChange,M=typeof j?.diff==`string`?j.diff:``,N=O.args&&typeof O.args==`object`&&!Array.isArray(O.args)?O.args:{},P=$(N.command)||$(N.path),I=A?br($(O.reason)):``,L=I?``:$(O.reason),z=A&&!b,B=async e=>{if(!x.current){x.current=!0,d(!0);try{await t(O.id,e)}finally{x.current=!1,d(!1)}}},V=!A&&O.toolName===`bash`&&i?f($(N.command)):``,H=async()=>{if(!(x.current||!V)){x.current=!0,d(!0),C(``);try{await m.add({effect:`allow`,tool:`bash`,pattern:V,cwd:i}),await t(O.id,!0)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x.current=!1,d(!1)}}};return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,ref:w,"data-approval-stack":!0,children:[(0,X.jsxs)(_r,{approval:{id:O.id},state:`approval-requested`,className:`tool-approval grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2.5 rounded-(--r-lg) border border-st-attn-border bg-st-attn-soft px-3.5 py-3 text-foreground [&.compact]:px-2.5 [&.compact]:py-1.5 max-[470px]:grid-cols-1 ${n?`compact`:``}`,"data-pisper-approval-id":O.id,"data-approval-current":!0,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5 [grid-column:1/-1]`,children:[(0,X.jsx)(`span`,{className:`grid size-[18px] flex-none place-items-center text-st-attn`,children:A?(0,X.jsx)(R,{size:16,strokeWidth:1.75}):(0,X.jsx)(ee,{size:16,strokeWidth:1.75})}),(0,X.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-medium`,children:a(`chat:focusSession.toolRequestsApproval`,{tool:O.toolName})}),(0,X.jsx)(`span`,{className:K(`min-w-0 flex-none truncate text-xs`,A?`font-medium text-st-attn`:`text-content-muted`),"data-severity":A?`critical`:`standard`,children:A?I?a(`board:card.criticalWithReason`,{reason:I}):a(`board:card.critical`):a(`board:card.standard`)})]}),P&&(0,X.jsx)(`div`,{className:`min-w-0 [grid-column:1/-1]`,children:(0,X.jsx)(xr,{text:P,prefix:N.command?`$`:``})}),L&&(0,X.jsx)(`p`,{className:`min-w-0 text-xs text-content-secondary [grid-column:1/-1] [overflow-wrap:anywhere]`,children:L}),!n&&(M||Object.keys(N).length>0)&&(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-x-3 gap-y-1.5 [grid-column:1/-1]`,children:[M&&(0,X.jsxs)(`button`,{type:`button`,className:`tool-approval-view-diff inline-flex min-h-7 flex-none cursor-pointer items-center gap-1.5 rounded-sm border border-stroke-strong bg-solid px-2 text-xs font-medium text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground max-[650px]:min-h-11`,onClick:()=>h(!0),children:[(0,X.jsx)(E,{size:13}),a(`chat:focusSession.gitViewDiff`)]}),(0,X.jsxs)(`details`,{className:`group/args min-w-0 flex-1 text-xs text-content-muted`,children:[(0,X.jsxs)(`summary`,{className:`inline-flex min-h-7 cursor-pointer list-none items-center gap-1 rounded-sm hover:text-foreground focus-visible:outline-2 focus-visible:outline-focus max-[650px]:min-h-11 [&::-webkit-details-marker]:hidden`,children:[(0,X.jsx)(y,{size:13,className:`transition-transform duration-(--d-fast) group-open/args:rotate-90`}),a(`chat:focusSession.viewCallArguments`)]}),(0,X.jsx)(`pre`,{className:`mt-1.5 max-h-[130px] overflow-auto rounded-sm border border-well-stroke bg-well p-[8px_10px] font-mono text-xs leading-[1.6] whitespace-pre-wrap text-well-text`,children:JSON.stringify(O.args,null,2)})]})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2 [grid-column:1/-1]`,children:[(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`bg-solid max-[650px]:h-11 max-[650px]:px-4`,disabled:c,"data-approval-deny":!0,onClick:()=>B(!1),children:a(`chat:focusSession.deny`)}),(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[z&&(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs text-content-muted max-[470px]:hidden`,children:a(o?`board:confirm.hintTouch`:`board:card.holdHint`)}),V&&(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`min-w-0 bg-solid max-[650px]:h-11 max-[650px]:px-4`,disabled:c,"data-approval-allow-rule":!0,title:a(`chat:focusSession.allowAlwaysHint`,{prefix:V}),onClick:()=>void H(),children:(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:a(`chat:focusSession.allowAlways`,{prefix:V})})}),z?(0,X.jsxs)(Ve,{size:`sm`,className:`max-[650px]:h-11 max-[650px]:px-4`,disabled:c,"data-approval-critical":!0,"data-approval-primary":!0,"data-approval-hold":!0,"aria-label":a(`board:card.holdToApprove`),onConfirm:()=>void B(!0),onActivate:()=>v(!0),children:[c?(0,X.jsx)(F,{className:`animate-spin`,size:12}):(0,X.jsx)(g,{size:12}),a(`board:card.holdToApprove`)]}):(0,X.jsxs)(q,{type:`button`,size:`sm`,variant:A?`outline`:`default`,className:K(`max-[650px]:h-11 max-[650px]:px-4`,A&&`bg-solid`),disabled:c,"data-approval-critical":A||void 0,"data-approval-primary":!0,"aria-haspopup":A?`dialog`:void 0,onClick:()=>A?v(!0):B(!0),children:[c?(0,X.jsx)(F,{className:`animate-spin`,size:12}):(0,X.jsx)(g,{size:12}),a(A?`board:card.approveCritical`:`chat:focusSession.allow`)]})]})]}),S&&(0,X.jsx)(`p`,{role:`alert`,className:`min-w-0 text-xs text-danger [grid-column:1/-1]`,children:S}),A&&_&&(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(vr,{target:{sessionId:``,title:r||$(O.toolName),cwd:i,approval:yr(O)},phone:o,pending:c,error:``,onConfirm:()=>{B(!0).then(()=>v(!1),()=>void 0)},onOpenChange:e=>{e||v(!1)}})}),p&&(0,X.jsx)(D,{diff:M,truncated:!!j?.truncated,onClose:()=>h(!1)})]}),e.length>1&&(0,X.jsxs)(`p`,{className:`flex min-h-8 min-w-0 items-center gap-2 rounded-(--r-md) border border-st-attn-border px-3 text-xs text-st-attn`,"data-approval-more":e.length-1,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),a(`board:card.moreWaiting`,{count:e.length-1})]})]})}function Cr(e,t){return e?.streaming?!0:!e?.loaded&&!!t?.streaming}var wr={session:null,expiresAt:null,created:!1,loading:!1,error:``,draft:``,expired:!1},Tr=(0,Y.createContext)(null);function Er(e){let t=(0,Y.useContext)(Tr);if(!t)throw Error(`Side chat requires its runtime provider`);return{...t,entry:t.entries[e]??wr}}export{dt as C,rt as D,at as E,tt as O,pt as S,gt as T,ct as _,Sr as a,ft as b,Rt as c,Tt as d,wt as f,ot as g,xt as h,Cr as i,et as k,Ht as l,St as m,Tr as n,hr as o,Et as p,Er as r,Ft as s,wr as t,Dt as u,ht as v,yt as w,bt as x,mt as y};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{f as i}from"./routes-DIeaqWVc.js";import{t as a}from"./use-i18n-QY-mTTDS.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{t as s}from"./pin-CU0FG0lI.js";import{t as c}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as l}from"./utils-C8uzG5AZ.js";import{c as u,g as d}from"./shortcuts-B5Q10H38.js";import{t as f}from"./sidebar-store-CHqFyueh.js";import{r as p}from"./useSessionListQuery-CuUmG2UC.js";import{f as m,l as h,n as g,r as _,s as v}from"./useNow-CvnDomJ8.js";import{n as y}from"./card-presentation-1oph2b8P.js";import{t as b}from"./useSidebarModel-KU2-5Lqq.js";import{t as x}from"./StatusGlyph-1KgitlUg.js";import{a as S,c as C,d as w,i as T,l as E,n as D,o as O,r as k,s as A,t as j}from"./useSessionRowActions-DaVD7CkP.js";import{n as M}from"./BotAvatar-CNL-APwP.js";import{t as N}from"./shortcut-aria-jHRmld9z.js";import{t as P}from"./sidebar-commands-ZA1UOA_F.js";var F=e(n(),1);function I(e){let t=v(e);return t.some(e=>e.kind===`failed`)?`failed`:t.some(e=>e.kind===`approval`||e.kind===`question`)?`waiting`:e.lane===`running`?`running`:e.lane===`done`?`done`:`other`}function L(e,t){let n=new Map,r=[];for(let i of t){if(!i||typeof i.id!=`string`||!i.id||n.has(i.id))continue;let t=I(i);if(n.set(i.id,t),!e)continue;let a=e.get(i.id);t!==a&&(t===`waiting`?r.push({kind:`waiting`,id:i.id,title:i.title}):t===`failed`&&(a===`running`||a===`waiting`)?r.push({kind:`failed`,id:i.id,title:i.title}):t===`done`&&(a===`running`||a===`waiting`)&&r.push({kind:`finished`,id:i.id,title:i.title}))}return{snapshot:n,alerts:r}}function R(e){let t=Date.parse(e.modified||``);return Number.isFinite(t)?t:null}function z(e,{items:t,shownIds:n,currentId:r,limit:i=8}){let a=new Map(t.map(e=>[e.id,e])),o=new Set,s=[];for(let t of e){if(!t||typeof t.id!=`string`||!t.id||o.has(t.id)||(o.add(t.id),t.archived===!0||n.has(t.id))||t.botId||typeof t.messageCount==`number`&&t.messageCount<=0&&t.id!==r)continue;let e=a.get(t.id);s.push({group:`recent`,id:t.id,title:p(t),...e?.bot?{bot:e.bot}:{},status:e?.status??`done`,pinned:t.pinned===!0,glyph:e?y(e):`done`,at:R(t),unread:t.unread===!0})}s.sort((e,t)=>Number(t.pinned)-Number(e.pinned)||(t.at??-1/0)-(e.at??-1/0)||(e.id<t.id?-1:+(e.id>t.id)));let c=s.filter((e,t)=>t<i||e.id===r);return{rows:c,hidden:s.length-c.length}}function B(e){return e.groups.filter(e=>e.id===`attention`||e.id===`running`||e.id===`queued`&&e.count>0)}function V(e,t,n,r){let i=(0,F.useMemo)(()=>new Set(B(e).flatMap(e=>e.rows.map(e=>e.id))),[e]);return(0,F.useMemo)(()=>z(n??[],{items:t,shownIds:i,currentId:r}),[r,t,n,i])}var H=r(),U=160,W=600;function ee(e,t){switch(t){case`attention`:return e(`board:sidebar.group.attention`);case`running`:return e(`board:sidebar.group.running`);case`queued`:return e(`board:sidebar.group.queued`);case`pinned`:return e(`board:sidebar.group.pinned`);default:return e(`board:sidebar.group.done`)}}function G(e){return e?[...e.querySelectorAll(`[data-sidebar-row]`)]:[]}function K(e,t={}){q(()=>e(G(document.querySelector(`[data-sidebar-groups]`))),t)}function q(e,{unclaimed:t=!1}={}){let n=0,r=()=>{let i=document.activeElement;if(t&&i&&i!==document.body&&!i.closest(`[data-shell-sidebar]`))return;let a=e();if(a){a.focus(),a.scrollIntoView?.({block:`nearest`});return}(n+=1)<20&&requestAnimationFrame(r)};requestAnimationFrame(r)}function J({resolveCurrentId:e,renderedSessionId:t,onOpenSession:n,onWaiting:r,onAlerts:i}){let{t:o}=a(),{model:s,items:c,sessions:l,isLoading:u}=b(),d=(0,F.useRef)(i);d.current=i;let p=(0,F.useRef)(null);(0,F.useEffect)(()=>{if(u)return;let{snapshot:e,alerts:t}=L(p.current,c);p.current=e,t.length&&d.current?.(t)},[c,u]);let m=V(s,c,l,t??``),h=(0,F.useRef)(s);h.current=s;let g=(0,F.useRef)([]);g.current=[...B(s).flatMap(e=>e.rows.map(e=>e.id)),...m.rows.map(e=>e.id)];let v=(0,F.useRef)({resolveCurrentId:e,onOpenSession:n});v.current={resolveCurrentId:e,onOpenSession:n},(0,F.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t)return;let n=h.current;if(t.kind===`adjacent`){let e=_(g.current,v.current.resolveCurrentId()||null,t.direction);e&&v.current.onOpenSession(e);return}let r=f.getState();if(document.documentElement.hasAttribute(`data-phone-shell`)){let e=t.kind===`focus-attention`?n.longestWaitingId:v.current.resolveCurrentId();if(t.kind===`focus-attention`&&!e)return;r.setDrawerOpen(!0),K(n=>n.find(t=>t.dataset.sidebarRow===e)??(t.kind===`focus-list`?n[0]:void 0));return}let i=document.querySelector(`[data-settings-sidebar]`);if(i){let e=t.kind===`focus-attention`?`[data-sidebar-fleet-line]`:`[data-settings-section][aria-current="page"]`;q(()=>i.querySelector(e)??void 0);return}let a=document.querySelector(`[data-overview]`);if(t.kind===`focus-attention`){let e=n.longestWaitingId;if(!e)return;if(a){w(e);return}r.collapsed&&r.setPeeking(!0),K(t=>t.find(t=>t.dataset.sidebarRow===e));return}r.collapsed&&r.setPeeking(!0);let o=v.current.resolveCurrentId();K(e=>e.find(e=>e.dataset.sidebarRow===o)??e[0])};return window.addEventListener(P,e),()=>window.removeEventListener(P,e)},[]);let y=(0,F.useRef)(t),x=(0,F.useRef)(null);(0,F.useEffect)(()=>{let e=y.current;if(y.current=t,t===null){e&&(x.current=e);return}if(e!==null)return;let n=x.current;x.current=null,!(!n||n!==t||f.getState().collapsed)&&K(e=>e.find(e=>e.dataset.sidebarRow===n),{unclaimed:!0})},[t]);let S=(0,F.useRef)(r);S.current=r;let T=(0,F.useRef)(null),[E,D]=(0,F.useState)(``);return(0,F.useEffect)(()=>{if(u)return;let e=s.groups.find(e=>e.id===`attention`)?.rows??[],t=T.current;if(T.current=new Set(e.map(e=>e.id)),!t)return;let n=e.filter(e=>!t.has(e.id));if(n.length){for(let e of n)e.reasons.some(e=>e.kind===`approval`||e.kind===`question`)&&S.current?.({title:e.title,reason:C(o,e.reasons)});D(n.map(e=>o(`board:sidebar.announce`,{title:e.title,reason:C(o,e.reasons)})).join(o(`board:sidebar.announceSeparator`)))}},[s.groups,u,o]),(0,H.jsx)(`p`,{"data-sidebar-announce":!0,"aria-live":`polite`,role:`status`,className:`sr-only`,children:E})}function Y({onOpenBoard:e}){let{t}=a(),{model:n,isLoading:r}=b(),i=h(e=>e.setLaneFilter),o=t=>{i([t]),e()},s=n.counts.attention,c=n.counts.running,u=`grid size-10 place-items-center rounded-[var(--r-md)] text-xs font-semibold tabular-nums transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus pointer-coarse:size-11`;return(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,"aria-busy":r||void 0,children:[(0,H.jsx)(`button`,{type:`button`,"data-rail-count":`attention`,"aria-label":t(`board:sidebar.railAttention`,{count:s}),title:t(`board:sidebar.railAttention`,{count:s}),className:l(u,s>0?`bg-warning-soft text-warning-strong ring-1 ring-st-attn-border ring-inset hover:brightness-[.98]`:`text-content-muted hover:bg-surface-hover`),onClick:()=>o(`attention`),children:(0,H.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5 leading-none`,children:[(0,H.jsx)(x,{status:`attention`,className:l(`size-3.5`,s===0&&`text-content-faint`)}),(0,H.jsx)(`span`,{children:s})]})}),(0,H.jsx)(`button`,{type:`button`,"data-rail-count":`running`,"aria-label":t(`board:sidebar.railRunning`,{count:c}),title:t(`board:sidebar.railRunning`,{count:c}),className:l(u,`hover:bg-surface-hover`,c>0?`text-content-secondary`:`text-content-muted`),onClick:()=>o(`running`),children:(0,H.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5 leading-none`,children:[(0,H.jsx)(x,{status:`run`,spin:c>0,className:l(`size-3.5`,c===0&&`text-content-faint`)}),(0,H.jsx)(`span`,{children:c})]})})]})}function X({onOpenBoard:e}){let{t}=a(),{model:n,isLoading:r}=b(),i=h(e=>e.setLaneFilter),s=n.counts.attention,c=n.counts.running;return(0,H.jsxs)(`button`,{type:`button`,"data-sidebar-fleet-line":!0,"aria-busy":r||void 0,"aria-label":t(`board:sidebar.fleet.label`,{attention:s,running:c}),className:`flex h-10 w-full min-w-0 items-center gap-1.5 rounded-[var(--r-md)] px-2.5 text-left text-[12.5px] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:()=>{i([]),e()},children:[(0,H.jsx)(x,{status:`attention`,className:l(`size-3.5 flex-none`,s===0&&`text-content-faint`)}),(0,H.jsx)(`span`,{"data-sidebar-fleet":`attention`,className:l(`truncate`,s>0&&`font-medium text-warning-strong`),children:t(`board:sidebar.fleet.attention`,{count:s})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`·`}),(0,H.jsx)(x,{status:`run`,spin:c>0,className:`size-3.5 flex-none`}),(0,H.jsx)(`span`,{"data-sidebar-fleet":`running`,className:`truncate`,children:t(`board:sidebar.fleet.running`,{count:c})}),(0,H.jsx)(o,{className:`ml-auto size-3.5 flex-none text-content-muted`,"aria-hidden":`true`})]})}function Z({currentId:e,notify:n,requestText:r,onOpenSession:o,onOpenBoard:s,onOpenHistory:l,onArchived:f,drawer:p=!1}){let{t:_}=a(),{model:v,items:y,sessions:x,isLoading:S,error:C,refetch:w}=b(),T=V(v,y,x,e),E=m(),O=(0,F.useRef)(E);O.current=E;let k=h(e=>e.setLaneFilter),A=u(e=>e.boardBindings),M=t(`/`),N=(0,F.useCallback)(e=>M.replace(/\/$/,``)+i(e),[M]),P=v.counts.attention+v.counts.running>0,I=g(P),L=(0,F.useRef)(null),[R,z]=(0,F.useState)(()=>new Set),U=(e,t)=>z(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),W=(0,F.useRef)(null),[K,q]=(0,F.useState)(()=>new Set),J=(0,F.useMemo)(()=>v.groups.find(e=>e.id===`attention`)?.rows??[],[v.groups]),Y=(0,F.useRef)(new Set);Y.current=new Set(J.map(e=>e.id)),(0,F.useEffect)(()=>{if(S)return;let e=new Set(J.map(e=>e.id)),t=W.current;if(W.current=e,!t)return;let n=J.filter(e=>!t.has(e.id));n.length&&q(new Set(n.map(e=>e.id)))},[J,S]);let X=j({notify:n,requestText:r,onOpenSession:o,onArchived:f}),Z=X.report,Q=(0,F.useCallback)(async(e,t,n)=>{if(e.quickAction.kind!==`decide`){o(e.id);return}let{approvalId:r,remaining:i}=e.quickAction,a=i===0,s=!!n?.contains(document.activeElement),c=G(L.current),l=c.findIndex(t=>t.dataset.sidebarRow===e.id),u=c[l+1]??c[l-1];s&&a&&u?.focus();let d=!1,f=a?D(n,{duration:160,scale:.6}).then(()=>{d||U(e.id,!0)}):Promise.resolve(),p=t?await O.current.approve(e.id,r,{confirmCritical:!1}):await O.current.deny(e.id,r);if(p.ok){if(!a||(await f,!Y.current.has(e.id)))return;U(e.id,!1),n?.getAnimations?.().forEach(e=>e.cancel());return}d=!0,await f,U(e.id,!1),n?.getAnimations?.().forEach(e=>e.cancel()),p.reason===`confirmation-required`?o(e.id):Z(p)},[o,Z]);(0,F.useEffect)(()=>{z(e=>{if(!e.size)return e;let t=new Set(J.map(e=>e.id)),n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[J]);let $=(0,F.useMemo)(()=>({...X,decide:(e,t,n)=>void Q(e,t,n)}),[Q,X]),oe=(e,t)=>{if(e.altKey||e.metaKey||e.ctrlKey)return;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=G(L.current);t[t.indexOf(e.currentTarget)+(e.key===`ArrowDown`?1:-1)]?.focus();return}if(t.group!==`attention`||e.shiftKey)return;let n=d(e.nativeEvent,A.boardApprove),r=!n&&d(e.nativeEvent,A.boardDeny);!n&&!r||(e.preventDefault(),t.quickAction.kind===`decide`&&$.decide(t,n,e.currentTarget.closest(`[data-sidebar-item]`)))},se=()=>{k([`running`]),s()};if(S)return(0,H.jsx)(ne,{label:_(`board:sidebar.loading`)});let ce=B(v),le={now:I,handlers:$,approveBinding:A.boardApprove,denyBinding:A.boardDeny,onKeyDown:oe,drawer:p};return(0,H.jsxs)(`div`,{ref:L,"data-sidebar-groups":!0,className:`flex flex-col gap-3 pb-2`,children:[C&&v.groups.every(e=>e.count===0)?(0,H.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5 px-2.5 py-2 text-xs text-content-muted`,children:[(0,H.jsx)(`p`,{children:_(`board:sidebar.error`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-sm text-content-secondary underline underline-offset-2 hover:text-content focus-visible:outline-2 focus-visible:outline-focus`,onClick:w,children:_(`board:sidebar.retry`)})]}):ce.map(t=>(0,H.jsx)(ie,{group:t,title:ee(_,t.id),footer:t.id===`running`&&t.hidden>0?(0,H.jsx)(re,{onClick:se,children:_(`board:sidebar.moreRunning`,{count:t.hidden})}):null,children:t.rows.map(t=>(0,H.jsx)(ae,{row:t,href:N(t.id),current:t.id===e,hidden:R.has(t.id),fresh:K.has(t.id),...le},t.id))},t.id)),(0,H.jsxs)(`section`,{"aria-labelledby":`sidebar-group-recent`,"data-sidebar-group":`recent`,children:[(0,H.jsx)(`h2`,{id:`sidebar-group-recent`,className:`m-0 flex h-7 items-center px-2.5 text-xs font-medium text-content-muted`,children:_(`board:sidebar.group.recent`)}),T.rows.length?(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:T.rows.map(t=>(0,H.jsx)(ae,{row:t,href:N(t.id),current:t.id===e,hidden:!1,fresh:!1,...le},t.id))}):(0,H.jsx)(`p`,{className:`px-2.5 text-xs leading-7 text-content-faint`,children:_(`board:sidebar.emptyRecent`)})]}),(0,H.jsxs)(`a`,{href:M.replace(/\/$/,``)+`/chat/history`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] px-2.5 text-[13px] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:e=>{te(e)&&(e.preventDefault(),l())},children:[(0,H.jsx)(c,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":`true`}),_(`board:sidebar.allChats`)]})]})}function te(e){return e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey}function ne({label:e}){return(0,H.jsx)(`div`,{role:`status`,"aria-busy":`true`,"aria-label":e,className:`flex flex-col gap-1 px-1 pt-1`,children:[64,48,72,56].map(e=>(0,H.jsxs)(`div`,{className:`flex h-9 items-center gap-2.5 px-1.5`,"aria-hidden":`true`,children:[(0,H.jsx)(`span`,{className:`size-4 flex-none rounded-full bg-surface-hover`}),(0,H.jsx)(`span`,{className:`h-3 rounded-sm bg-surface-hover`,style:{width:`${e}%`}})]},e))})}function re({children:e,onClick:t}){return(0,H.jsx)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 pl-[34px] text-left text-xs text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:t,children:e})}function ie({group:e,title:t,footer:n,children:r}){let i=`sidebar-group-${e.id}`,a=e.id===`attention`;return(0,H.jsxs)(`section`,{"aria-labelledby":i,"data-sidebar-group":e.id,children:[(0,H.jsx)(`h2`,{id:i,className:`m-0`,children:(0,H.jsxs)(`span`,{className:l(`flex h-7 items-center gap-1.5 px-2.5 text-xs font-medium`,a&&e.count>0?`text-warning-strong`:`text-content-muted`),children:[t,(0,H.jsx)(`span`,{"data-sidebar-count":!0,className:l(`tabular-nums`,a&&e.count>0&&`inline-grid h-[18px] min-w-[18px] place-items-center rounded-full bg-warning-soft px-1.5 text-[11.5px] font-semibold ring-1 ring-st-attn-border ring-inset`),children:e.count})]})}),e.rows.length>0&&(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:r}),n]})}function ae({row:e,href:t,current:n,now:r,hidden:i,fresh:o,handlers:c,approveBinding:u,denyBinding:d,onKeyDown:f,drawer:p=!1}){let{t:m}=a(),h=(0,F.useRef)(null),g=(0,F.useRef)(null),_=(0,F.useRef)(null),[v,y]=(0,F.useState)(!1),b=e.group===`attention`;(0,F.useLayoutEffect)(()=>{if(!o||!k())return;let e=h.current,t=g.current;e&&typeof e.animate==`function`&&(e.style.transformOrigin=`top center`,e.animate([{transform:`scaleY(.6)`,opacity:0},{transform:`scaleY(1)`,opacity:1}],{duration:U,easing:`ease-out`})),t&&typeof t.animate==`function`&&t.animate([{transform:`scale(1)`,opacity:.55},{transform:`scale(2.6)`,opacity:0}],{duration:W,easing:`ease-out`})},[o]),(0,F.useLayoutEffect)(()=>{let e=h.current,t=_.current;if(!e||!t)return;let n=()=>e.style.setProperty(`--quick-w`,`${t.offsetWidth+12}px`);if(n(),typeof ResizeObserver!=`function`)return;let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[]);let w=e.group===`recent`,D=``,j=``;w?D=``:e.group===`attention`?(D=A(e.waitingSince===null?null:r-e.waitingSince),j=C(m,e.reasons)):D=e.group===`running`?T(e.startedAt===null?null:r-e.startedAt):e.group===`queued`?`#${e.position}`:e.group===`pinned`?S(e.at,r):O(e.finishedAt);let P=e.group===`attention`?D?m(`board:sidebar.attentionRow`,{title:e.title,reason:j,wait:D}):m(`board:sidebar.attentionRowNoWait`,{title:e.title,reason:j}):void 0,I=`flex h-[26px] flex-none items-center gap-1 rounded-[var(--r-sm)] px-2 text-[12.5px] leading-none font-medium transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus`;return(0,H.jsxs)(`li`,{ref:h,"data-sidebar-item":e.id,"data-menu-open":v||void 0,hidden:i,className:`group/row relative`,children:[(0,H.jsxs)(`a`,{href:t,"data-sidebar-row":e.id,"data-sidebar-group-row":e.group,"aria-current":n?`page`:void 0,"aria-label":P,className:l(`flex min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-base text-content [transition:color_var(--d-fast),background-color_var(--d-fast),padding-right_0s_80ms] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,b?p?`h-14`:`h-12 pointer-coarse:h-14`:p?`h-11`:w?`h-8 pointer-coarse:h-11`:`h-9 pointer-coarse:h-11`,`group-hover/row:pr-[max(10px,var(--quick-w,0px))] group-focus-within/row:pr-[max(10px,var(--quick-w,0px))] group-data-[menu-open]/row:pr-[max(10px,var(--quick-w,0px))]`,n?`bg-surface-active`:`group-hover/row:bg-surface-hover`),onClick:t=>{te(t)&&(t.preventDefault(),c.open(e))},onKeyDown:t=>f(t,e),children:[(0,H.jsxs)(`span`,{hidden:w,className:l(`relative grid size-4 flex-none place-items-center`,b&&`self-start mt-[7px]`),children:[e.group===`pinned`?(0,H.jsx)(s,{className:`size-3.5 text-content-muted`,strokeWidth:1.75,role:`img`,"aria-label":m(`board:sidebar.group.pinned`)}):(0,H.jsx)(x,{status:e.glyph,phase:e.group===`running`?e.phase:void 0,label:b?void 0:$(m,e)}),b&&(0,H.jsx)(`span`,{ref:g,"aria-hidden":`true`,className:`pointer-events-none absolute inset-1 rounded-full bg-st-attn-fill opacity-0`})]}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[e.bot&&(0,H.jsx)(M,{character:e.bot.character,color:e.bot.color,size:16,className:`self-center`}),(0,H.jsx)(`span`,{className:l(`min-w-0 truncate leading-5`,e.group===`done`&&`text-content-secondary`),children:e.title}),w&&e.pinned&&(0,H.jsx)(s,{className:`size-3 flex-none self-center text-content-faint`,strokeWidth:1.75,role:`img`,"aria-label":m(`board:sidebar.group.pinned`)}),(e.group===`done`||w)&&e.unread&&(0,H.jsx)(`span`,{role:`img`,"aria-label":m(`board:sidebar.unread`),className:`size-1.5 flex-none translate-y-[-1px] self-center rounded-full bg-content-secondary`})]}),b&&(0,H.jsx)(`span`,{className:`truncate text-xs leading-[17px] text-warning-strong`,children:j})]}),D&&(0,H.jsx)(`span`,{"aria-hidden":b||void 0,className:l(`flex-none text-xs tabular-nums`,e.group===`running`?`font-mono text-content-secondary`:n?`text-content-secondary`:`text-content-muted`,b&&`self-start mt-[7px]`,`max-w-24 overflow-hidden whitespace-nowrap [transition:opacity_120ms_80ms,max-width_0s_80ms] group-hover/row:max-w-0 group-hover/row:opacity-0 group-focus-within/row:max-w-0 group-focus-within/row:opacity-0 group-data-[menu-open]/row:max-w-0 group-data-[menu-open]/row:opacity-0 pointer-coarse:group-hover/row:max-w-24 pointer-coarse:group-hover/row:opacity-100`),children:D})]}),p&&e.group===`attention`&&e.quickAction.kind===`decide`&&(0,H.jsxs)(`div`,{"data-sidebar-drawer-actions":!0,className:`flex gap-2 pr-2.5 pb-1.5 pl-[36px]`,children:[(0,H.jsx)(`button`,{type:`button`,className:`flex h-11 min-w-0 flex-1 items-center justify-center rounded-[var(--r-md)] bg-solid text-sm font-medium text-content ring-1 ring-stroke-strong ring-inset focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus active:bg-surface-hover`,"aria-label":m(`board:sidebar.denyNamed`,{title:e.title}),onClick:t=>c.decide(e,!1,t.currentTarget.closest(`[data-sidebar-item]`)),children:m(`board:sidebar.deny`)}),(0,H.jsx)(`button`,{type:`button`,className:`flex h-11 min-w-0 flex-1 items-center justify-center rounded-[var(--r-md)] bg-star text-sm font-medium text-on-accent focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus active:bg-star-hover`,"aria-label":m(`board:sidebar.approveNamed`,{title:e.title}),onClick:t=>c.decide(e,!0,t.currentTarget.closest(`[data-sidebar-item]`)),children:m(`board:sidebar.approve`)})]}),(0,H.jsxs)(`div`,{ref:_,"data-sidebar-quick":!0,className:l(`absolute top-1/2 right-1.5 flex -translate-y-1/2 items-center gap-1`,`invisible opacity-0 transition-[opacity,visibility] delay-[80ms] duration-[120ms] group-hover/row:visible group-hover/row:opacity-100 group-focus-within/row:visible group-focus-within/row:opacity-100 group-data-[menu-open]/row:visible group-data-[menu-open]/row:opacity-100 pointer-coarse:hidden`,p&&`hidden`),children:[e.group===`attention`&&(e.quickAction.kind===`decide`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{type:`button`,className:l(I,`bg-solid text-content ring-1 ring-stroke-strong ring-inset hover:bg-surface-hover`),"aria-label":m(`board:sidebar.denyNamed`,{title:e.title}),"aria-keyshortcuts":N(d),onClick:t=>c.decide(e,!1,t.currentTarget.closest(`[data-sidebar-item]`)),children:[m(`board:sidebar.deny`),(0,H.jsx)(Q,{binding:d})]}),(0,H.jsxs)(`button`,{type:`button`,className:l(I,`bg-star text-on-accent hover:bg-star-hover`),"aria-label":m(`board:sidebar.approveNamed`,{title:e.title}),"aria-keyshortcuts":N(u),onClick:t=>c.decide(e,!0,t.currentTarget.closest(`[data-sidebar-item]`)),children:[m(`board:sidebar.approve`),(0,H.jsx)(Q,{binding:u})]})]}):(0,H.jsxs)(`button`,{type:`button`,className:l(I,`bg-solid text-content ring-1 ring-stroke-strong ring-inset hover:bg-surface-hover`),"aria-label":m(`board:sidebar.openNamed`,{title:e.title}),onClick:()=>c.open(e),children:[m(`board:sidebar.open`),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`↵`})]})),(0,H.jsx)(E,{row:e,actions:c,canMarkHandled:e.group===`attention`&&e.status===`failed`,open:v,onOpenChange:y,side:`right`})]})]})}function Q({binding:e}){let t=e&&/^Key[A-Z]$/.test(e)?e.slice(3):``;return t?(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`font-normal opacity-60`,children:t}):null}function $(e,t){switch(t.glyph){case`run`:return e(`common:statusGlyph.run`);case`queued`:return e(`common:statusGlyph.queued`);case`failed`:return e(`common:statusGlyph.failed`);case`stopped`:return e(`common:statusGlyph.stopped`);case`attention`:return e(`common:statusGlyph.attention`);default:return e(`common:statusGlyph.done`)}}export{J as SidebarCommands,X as SidebarFleetLine,Y as SidebarRailCounts,Z as SidebarSessions};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{f as i}from"./routes-DIeaqWVc.js";import{t as a}from"./use-i18n-8V6eRMcE.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{t as s}from"./pin-CU0FG0lI.js";import{t as c}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as l}from"./utils-C8uzG5AZ.js";import{c as u,g as d}from"./shortcuts-DRfz9B_B.js";import{t as f}from"./sidebar-store-BvZAgxJg.js";import{r as p}from"./useSessionListQuery-DtpEX8a5.js";import{f as m,l as h,n as g,r as _,s as v}from"./useNow-D-gM4IXU.js";import{n as y}from"./card-presentation-1oph2b8P.js";import{t as b}from"./useSidebarModel-DBH3JLQ1.js";import{t as x}from"./StatusGlyph-1KgitlUg.js";import{a as S,c as C,d as w,i as T,l as E,n as D,o as O,r as k,s as A,t as j}from"./useSessionRowActions-DBqnVodk.js";import{n as M}from"./BotAvatar-CNL-APwP.js";import{t as N}from"./shortcut-aria-jHRmld9z.js";import{t as P}from"./sidebar-commands-ZA1UOA_F.js";var F=e(n(),1);function I(e){let t=v(e);return t.some(e=>e.kind===`failed`)?`failed`:t.some(e=>e.kind===`approval`||e.kind===`question`)?`waiting`:e.lane===`running`?`running`:e.lane===`done`?`done`:`other`}function L(e,t){let n=new Map,r=[];for(let i of t){if(!i||typeof i.id!=`string`||!i.id||n.has(i.id))continue;let t=I(i);if(n.set(i.id,t),!e)continue;let a=e.get(i.id);t!==a&&(t===`waiting`?r.push({kind:`waiting`,id:i.id,title:i.title}):t===`failed`&&(a===`running`||a===`waiting`)?r.push({kind:`failed`,id:i.id,title:i.title}):t===`done`&&(a===`running`||a===`waiting`)&&r.push({kind:`finished`,id:i.id,title:i.title}))}return{snapshot:n,alerts:r}}function R(e){let t=Date.parse(e.modified||``);return Number.isFinite(t)?t:null}function z(e,{items:t,shownIds:n,currentId:r,limit:i=8}){let a=new Map(t.map(e=>[e.id,e])),o=new Set,s=[];for(let t of e){if(!t||typeof t.id!=`string`||!t.id||o.has(t.id)||(o.add(t.id),t.archived===!0||n.has(t.id))||t.botId||typeof t.messageCount==`number`&&t.messageCount<=0&&t.id!==r)continue;let e=a.get(t.id);s.push({group:`recent`,id:t.id,title:p(t),...e?.bot?{bot:e.bot}:{},status:e?.status??`done`,pinned:t.pinned===!0,glyph:e?y(e):`done`,at:R(t),unread:t.unread===!0})}s.sort((e,t)=>Number(t.pinned)-Number(e.pinned)||(t.at??-1/0)-(e.at??-1/0)||(e.id<t.id?-1:+(e.id>t.id)));let c=s.filter((e,t)=>t<i||e.id===r);return{rows:c,hidden:s.length-c.length}}function B(e){return e.groups.filter(e=>e.id===`attention`||e.id===`running`||e.id===`queued`&&e.count>0)}function V(e,t,n,r){let i=(0,F.useMemo)(()=>new Set(B(e).flatMap(e=>e.rows.map(e=>e.id))),[e]);return(0,F.useMemo)(()=>z(n??[],{items:t,shownIds:i,currentId:r}),[r,t,n,i])}var H=r(),U=160,W=600;function ee(e,t){switch(t){case`attention`:return e(`board:sidebar.group.attention`);case`running`:return e(`board:sidebar.group.running`);case`queued`:return e(`board:sidebar.group.queued`);case`pinned`:return e(`board:sidebar.group.pinned`);default:return e(`board:sidebar.group.done`)}}function G(e){return e?[...e.querySelectorAll(`[data-sidebar-row]`)]:[]}function K(e,t={}){q(()=>e(G(document.querySelector(`[data-sidebar-groups]`))),t)}function q(e,{unclaimed:t=!1}={}){let n=0,r=()=>{let i=document.activeElement;if(t&&i&&i!==document.body&&!i.closest(`[data-shell-sidebar]`))return;let a=e();if(a){a.focus(),a.scrollIntoView?.({block:`nearest`});return}(n+=1)<20&&requestAnimationFrame(r)};requestAnimationFrame(r)}function J({resolveCurrentId:e,renderedSessionId:t,onOpenSession:n,onWaiting:r,onAlerts:i}){let{t:o}=a(),{model:s,items:c,sessions:l,isLoading:u}=b(),d=(0,F.useRef)(i);d.current=i;let p=(0,F.useRef)(null);(0,F.useEffect)(()=>{if(u)return;let{snapshot:e,alerts:t}=L(p.current,c);p.current=e,t.length&&d.current?.(t)},[c,u]);let m=V(s,c,l,t??``),h=(0,F.useRef)(s);h.current=s;let g=(0,F.useRef)([]);g.current=[...B(s).flatMap(e=>e.rows.map(e=>e.id)),...m.rows.map(e=>e.id)];let v=(0,F.useRef)({resolveCurrentId:e,onOpenSession:n});v.current={resolveCurrentId:e,onOpenSession:n},(0,F.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t)return;let n=h.current;if(t.kind===`adjacent`){let e=_(g.current,v.current.resolveCurrentId()||null,t.direction);e&&v.current.onOpenSession(e);return}let r=f.getState();if(document.documentElement.hasAttribute(`data-phone-shell`)){let e=t.kind===`focus-attention`?n.longestWaitingId:v.current.resolveCurrentId();if(t.kind===`focus-attention`&&!e)return;r.setDrawerOpen(!0),K(n=>n.find(t=>t.dataset.sidebarRow===e)??(t.kind===`focus-list`?n[0]:void 0));return}let i=document.querySelector(`[data-settings-sidebar]`);if(i){let e=t.kind===`focus-attention`?`[data-sidebar-fleet-line]`:`[data-settings-section][aria-current="page"]`;q(()=>i.querySelector(e)??void 0);return}let a=document.querySelector(`[data-overview]`);if(t.kind===`focus-attention`){let e=n.longestWaitingId;if(!e)return;if(a){w(e);return}r.collapsed&&r.setPeeking(!0),K(t=>t.find(t=>t.dataset.sidebarRow===e));return}r.collapsed&&r.setPeeking(!0);let o=v.current.resolveCurrentId();K(e=>e.find(e=>e.dataset.sidebarRow===o)??e[0])};return window.addEventListener(P,e),()=>window.removeEventListener(P,e)},[]);let y=(0,F.useRef)(t),x=(0,F.useRef)(null);(0,F.useEffect)(()=>{let e=y.current;if(y.current=t,t===null){e&&(x.current=e);return}if(e!==null)return;let n=x.current;x.current=null,!(!n||n!==t||f.getState().collapsed)&&K(e=>e.find(e=>e.dataset.sidebarRow===n),{unclaimed:!0})},[t]);let S=(0,F.useRef)(r);S.current=r;let T=(0,F.useRef)(null),[E,D]=(0,F.useState)(``);return(0,F.useEffect)(()=>{if(u)return;let e=s.groups.find(e=>e.id===`attention`)?.rows??[],t=T.current;if(T.current=new Set(e.map(e=>e.id)),!t)return;let n=e.filter(e=>!t.has(e.id));if(n.length){for(let e of n)e.reasons.some(e=>e.kind===`approval`||e.kind===`question`)&&S.current?.({title:e.title,reason:C(o,e.reasons)});D(n.map(e=>o(`board:sidebar.announce`,{title:e.title,reason:C(o,e.reasons)})).join(o(`board:sidebar.announceSeparator`)))}},[s.groups,u,o]),(0,H.jsx)(`p`,{"data-sidebar-announce":!0,"aria-live":`polite`,role:`status`,className:`sr-only`,children:E})}function Y({onOpenBoard:e}){let{t}=a(),{model:n,isLoading:r}=b(),i=h(e=>e.setLaneFilter),o=t=>{i([t]),e()},s=n.counts.attention,c=n.counts.running,u=`grid size-10 place-items-center rounded-[var(--r-md)] text-xs font-semibold tabular-nums transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus pointer-coarse:size-11`;return(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,"aria-busy":r||void 0,children:[(0,H.jsx)(`button`,{type:`button`,"data-rail-count":`attention`,"aria-label":t(`board:sidebar.railAttention`,{count:s}),title:t(`board:sidebar.railAttention`,{count:s}),className:l(u,s>0?`bg-warning-soft text-warning-strong ring-1 ring-st-attn-border ring-inset hover:brightness-[.98]`:`text-content-muted hover:bg-surface-hover`),onClick:()=>o(`attention`),children:(0,H.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5 leading-none`,children:[(0,H.jsx)(x,{status:`attention`,className:l(`size-3.5`,s===0&&`text-content-faint`)}),(0,H.jsx)(`span`,{children:s})]})}),(0,H.jsx)(`button`,{type:`button`,"data-rail-count":`running`,"aria-label":t(`board:sidebar.railRunning`,{count:c}),title:t(`board:sidebar.railRunning`,{count:c}),className:l(u,`hover:bg-surface-hover`,c>0?`text-content-secondary`:`text-content-muted`),onClick:()=>o(`running`),children:(0,H.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5 leading-none`,children:[(0,H.jsx)(x,{status:`run`,spin:c>0,className:l(`size-3.5`,c===0&&`text-content-faint`)}),(0,H.jsx)(`span`,{children:c})]})})]})}function X({onOpenBoard:e}){let{t}=a(),{model:n,isLoading:r}=b(),i=h(e=>e.setLaneFilter),s=n.counts.attention,c=n.counts.running;return(0,H.jsxs)(`button`,{type:`button`,"data-sidebar-fleet-line":!0,"aria-busy":r||void 0,"aria-label":t(`board:sidebar.fleet.label`,{attention:s,running:c}),className:`flex h-10 w-full min-w-0 items-center gap-1.5 rounded-[var(--r-md)] px-2.5 text-left text-[12.5px] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:()=>{i([]),e()},children:[(0,H.jsx)(x,{status:`attention`,className:l(`size-3.5 flex-none`,s===0&&`text-content-faint`)}),(0,H.jsx)(`span`,{"data-sidebar-fleet":`attention`,className:l(`truncate`,s>0&&`font-medium text-warning-strong`),children:t(`board:sidebar.fleet.attention`,{count:s})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`·`}),(0,H.jsx)(x,{status:`run`,spin:c>0,className:`size-3.5 flex-none`}),(0,H.jsx)(`span`,{"data-sidebar-fleet":`running`,className:`truncate`,children:t(`board:sidebar.fleet.running`,{count:c})}),(0,H.jsx)(o,{className:`ml-auto size-3.5 flex-none text-content-muted`,"aria-hidden":`true`})]})}function Z({currentId:e,notify:n,requestText:r,onOpenSession:o,onOpenBoard:s,onOpenHistory:l,onArchived:f,drawer:p=!1}){let{t:_}=a(),{model:v,items:y,sessions:x,isLoading:S,error:C,refetch:w}=b(),T=V(v,y,x,e),E=m(),O=(0,F.useRef)(E);O.current=E;let k=h(e=>e.setLaneFilter),A=u(e=>e.boardBindings),M=t(`/`),N=(0,F.useCallback)(e=>M.replace(/\/$/,``)+i(e),[M]),P=v.counts.attention+v.counts.running>0,I=g(P),L=(0,F.useRef)(null),[R,z]=(0,F.useState)(()=>new Set),U=(e,t)=>z(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),W=(0,F.useRef)(null),[K,q]=(0,F.useState)(()=>new Set),J=(0,F.useMemo)(()=>v.groups.find(e=>e.id===`attention`)?.rows??[],[v.groups]),Y=(0,F.useRef)(new Set);Y.current=new Set(J.map(e=>e.id)),(0,F.useEffect)(()=>{if(S)return;let e=new Set(J.map(e=>e.id)),t=W.current;if(W.current=e,!t)return;let n=J.filter(e=>!t.has(e.id));n.length&&q(new Set(n.map(e=>e.id)))},[J,S]);let X=j({notify:n,requestText:r,onOpenSession:o,onArchived:f}),Z=X.report,Q=(0,F.useCallback)(async(e,t,n)=>{if(e.quickAction.kind!==`decide`){o(e.id);return}let{approvalId:r,remaining:i}=e.quickAction,a=i===0,s=!!n?.contains(document.activeElement),c=G(L.current),l=c.findIndex(t=>t.dataset.sidebarRow===e.id),u=c[l+1]??c[l-1];s&&a&&u?.focus();let d=!1,f=a?D(n,{duration:160,scale:.6}).then(()=>{d||U(e.id,!0)}):Promise.resolve(),p=t?await O.current.approve(e.id,r,{confirmCritical:!1}):await O.current.deny(e.id,r);if(p.ok){if(!a||(await f,!Y.current.has(e.id)))return;U(e.id,!1),n?.getAnimations?.().forEach(e=>e.cancel());return}d=!0,await f,U(e.id,!1),n?.getAnimations?.().forEach(e=>e.cancel()),p.reason===`confirmation-required`?o(e.id):Z(p)},[o,Z]);(0,F.useEffect)(()=>{z(e=>{if(!e.size)return e;let t=new Set(J.map(e=>e.id)),n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[J]);let $=(0,F.useMemo)(()=>({...X,decide:(e,t,n)=>void Q(e,t,n)}),[Q,X]),oe=(e,t)=>{if(e.altKey||e.metaKey||e.ctrlKey)return;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=G(L.current);t[t.indexOf(e.currentTarget)+(e.key===`ArrowDown`?1:-1)]?.focus();return}if(t.group!==`attention`||e.shiftKey)return;let n=d(e.nativeEvent,A.boardApprove),r=!n&&d(e.nativeEvent,A.boardDeny);!n&&!r||(e.preventDefault(),t.quickAction.kind===`decide`&&$.decide(t,n,e.currentTarget.closest(`[data-sidebar-item]`)))},se=()=>{k([`running`]),s()};if(S)return(0,H.jsx)(ne,{label:_(`board:sidebar.loading`)});let ce=B(v),le={now:I,handlers:$,approveBinding:A.boardApprove,denyBinding:A.boardDeny,onKeyDown:oe,drawer:p};return(0,H.jsxs)(`div`,{ref:L,"data-sidebar-groups":!0,className:`flex flex-col gap-3 pb-2`,children:[C&&v.groups.every(e=>e.count===0)?(0,H.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5 px-2.5 py-2 text-xs text-content-muted`,children:[(0,H.jsx)(`p`,{children:_(`board:sidebar.error`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-sm text-content-secondary underline underline-offset-2 hover:text-content focus-visible:outline-2 focus-visible:outline-focus`,onClick:w,children:_(`board:sidebar.retry`)})]}):ce.map(t=>(0,H.jsx)(ie,{group:t,title:ee(_,t.id),footer:t.id===`running`&&t.hidden>0?(0,H.jsx)(re,{onClick:se,children:_(`board:sidebar.moreRunning`,{count:t.hidden})}):null,children:t.rows.map(t=>(0,H.jsx)(ae,{row:t,href:N(t.id),current:t.id===e,hidden:R.has(t.id),fresh:K.has(t.id),...le},t.id))},t.id)),(0,H.jsxs)(`section`,{"aria-labelledby":`sidebar-group-recent`,"data-sidebar-group":`recent`,children:[(0,H.jsx)(`h2`,{id:`sidebar-group-recent`,className:`m-0 flex h-7 items-center px-2.5 text-xs font-medium text-content-muted`,children:_(`board:sidebar.group.recent`)}),T.rows.length?(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:T.rows.map(t=>(0,H.jsx)(ae,{row:t,href:N(t.id),current:t.id===e,hidden:!1,fresh:!1,...le},t.id))}):(0,H.jsx)(`p`,{className:`px-2.5 text-xs leading-7 text-content-faint`,children:_(`board:sidebar.emptyRecent`)})]}),(0,H.jsxs)(`a`,{href:M.replace(/\/$/,``)+`/chat/history`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] px-2.5 text-[13px] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:e=>{te(e)&&(e.preventDefault(),l())},children:[(0,H.jsx)(c,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":`true`}),_(`board:sidebar.allChats`)]})]})}function te(e){return e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey}function ne({label:e}){return(0,H.jsx)(`div`,{role:`status`,"aria-busy":`true`,"aria-label":e,className:`flex flex-col gap-1 px-1 pt-1`,children:[64,48,72,56].map(e=>(0,H.jsxs)(`div`,{className:`flex h-9 items-center gap-2.5 px-1.5`,"aria-hidden":`true`,children:[(0,H.jsx)(`span`,{className:`size-4 flex-none rounded-full bg-surface-hover`}),(0,H.jsx)(`span`,{className:`h-3 rounded-sm bg-surface-hover`,style:{width:`${e}%`}})]},e))})}function re({children:e,onClick:t}){return(0,H.jsx)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 pl-[34px] text-left text-xs text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:t,children:e})}function ie({group:e,title:t,footer:n,children:r}){let i=`sidebar-group-${e.id}`,a=e.id===`attention`;return(0,H.jsxs)(`section`,{"aria-labelledby":i,"data-sidebar-group":e.id,children:[(0,H.jsx)(`h2`,{id:i,className:`m-0`,children:(0,H.jsxs)(`span`,{className:l(`flex h-7 items-center gap-1.5 px-2.5 text-xs font-medium`,a&&e.count>0?`text-warning-strong`:`text-content-muted`),children:[t,(0,H.jsx)(`span`,{"data-sidebar-count":!0,className:l(`tabular-nums`,a&&e.count>0&&`inline-grid h-[18px] min-w-[18px] place-items-center rounded-full bg-warning-soft px-1.5 text-[11.5px] font-semibold ring-1 ring-st-attn-border ring-inset`),children:e.count})]})}),e.rows.length>0&&(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:r}),n]})}function ae({row:e,href:t,current:n,now:r,hidden:i,fresh:o,handlers:c,approveBinding:u,denyBinding:d,onKeyDown:f,drawer:p=!1}){let{t:m}=a(),h=(0,F.useRef)(null),g=(0,F.useRef)(null),_=(0,F.useRef)(null),[v,y]=(0,F.useState)(!1),b=e.group===`attention`;(0,F.useLayoutEffect)(()=>{if(!o||!k())return;let e=h.current,t=g.current;e&&typeof e.animate==`function`&&(e.style.transformOrigin=`top center`,e.animate([{transform:`scaleY(.6)`,opacity:0},{transform:`scaleY(1)`,opacity:1}],{duration:U,easing:`ease-out`})),t&&typeof t.animate==`function`&&t.animate([{transform:`scale(1)`,opacity:.55},{transform:`scale(2.6)`,opacity:0}],{duration:W,easing:`ease-out`})},[o]),(0,F.useLayoutEffect)(()=>{let e=h.current,t=_.current;if(!e||!t)return;let n=()=>e.style.setProperty(`--quick-w`,`${t.offsetWidth+12}px`);if(n(),typeof ResizeObserver!=`function`)return;let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[]);let w=e.group===`recent`,D=``,j=``;w?D=``:e.group===`attention`?(D=A(e.waitingSince===null?null:r-e.waitingSince),j=C(m,e.reasons)):D=e.group===`running`?T(e.startedAt===null?null:r-e.startedAt):e.group===`queued`?`#${e.position}`:e.group===`pinned`?S(e.at,r):O(e.finishedAt);let P=e.group===`attention`?D?m(`board:sidebar.attentionRow`,{title:e.title,reason:j,wait:D}):m(`board:sidebar.attentionRowNoWait`,{title:e.title,reason:j}):void 0,I=`flex h-[26px] flex-none items-center gap-1 rounded-[var(--r-sm)] px-2 text-[12.5px] leading-none font-medium transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus`;return(0,H.jsxs)(`li`,{ref:h,"data-sidebar-item":e.id,"data-menu-open":v||void 0,hidden:i,className:`group/row relative`,children:[(0,H.jsxs)(`a`,{href:t,"data-sidebar-row":e.id,"data-sidebar-group-row":e.group,"aria-current":n?`page`:void 0,"aria-label":P,className:l(`flex min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-base text-content [transition:color_var(--d-fast),background-color_var(--d-fast),padding-right_0s_80ms] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,b?p?`h-14`:`h-12 pointer-coarse:h-14`:p?`h-11`:w?`h-8 pointer-coarse:h-11`:`h-9 pointer-coarse:h-11`,`group-hover/row:pr-[max(10px,var(--quick-w,0px))] group-focus-within/row:pr-[max(10px,var(--quick-w,0px))] group-data-[menu-open]/row:pr-[max(10px,var(--quick-w,0px))]`,n?`bg-surface-active`:`group-hover/row:bg-surface-hover`),onClick:t=>{te(t)&&(t.preventDefault(),c.open(e))},onKeyDown:t=>f(t,e),children:[(0,H.jsxs)(`span`,{hidden:w,className:l(`relative grid size-4 flex-none place-items-center`,b&&`self-start mt-[7px]`),children:[e.group===`pinned`?(0,H.jsx)(s,{className:`size-3.5 text-content-muted`,strokeWidth:1.75,role:`img`,"aria-label":m(`board:sidebar.group.pinned`)}):(0,H.jsx)(x,{status:e.glyph,phase:e.group===`running`?e.phase:void 0,label:b?void 0:$(m,e)}),b&&(0,H.jsx)(`span`,{ref:g,"aria-hidden":`true`,className:`pointer-events-none absolute inset-1 rounded-full bg-st-attn-fill opacity-0`})]}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[e.bot&&(0,H.jsx)(M,{character:e.bot.character,color:e.bot.color,size:16,className:`self-center`}),(0,H.jsx)(`span`,{className:l(`min-w-0 truncate leading-5`,e.group===`done`&&`text-content-secondary`),children:e.title}),w&&e.pinned&&(0,H.jsx)(s,{className:`size-3 flex-none self-center text-content-faint`,strokeWidth:1.75,role:`img`,"aria-label":m(`board:sidebar.group.pinned`)}),(e.group===`done`||w)&&e.unread&&(0,H.jsx)(`span`,{role:`img`,"aria-label":m(`board:sidebar.unread`),className:`size-1.5 flex-none translate-y-[-1px] self-center rounded-full bg-content-secondary`})]}),b&&(0,H.jsx)(`span`,{className:`truncate text-xs leading-[17px] text-warning-strong`,children:j})]}),D&&(0,H.jsx)(`span`,{"aria-hidden":b||void 0,className:l(`flex-none text-xs tabular-nums`,e.group===`running`?`font-mono text-content-secondary`:n?`text-content-secondary`:`text-content-muted`,b&&`self-start mt-[7px]`,`max-w-24 overflow-hidden whitespace-nowrap [transition:opacity_120ms_80ms,max-width_0s_80ms] group-hover/row:max-w-0 group-hover/row:opacity-0 group-focus-within/row:max-w-0 group-focus-within/row:opacity-0 group-data-[menu-open]/row:max-w-0 group-data-[menu-open]/row:opacity-0 pointer-coarse:group-hover/row:max-w-24 pointer-coarse:group-hover/row:opacity-100`),children:D})]}),p&&e.group===`attention`&&e.quickAction.kind===`decide`&&(0,H.jsxs)(`div`,{"data-sidebar-drawer-actions":!0,className:`flex gap-2 pr-2.5 pb-1.5 pl-[36px]`,children:[(0,H.jsx)(`button`,{type:`button`,className:`flex h-11 min-w-0 flex-1 items-center justify-center rounded-[var(--r-md)] bg-solid text-sm font-medium text-content ring-1 ring-stroke-strong ring-inset focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus active:bg-surface-hover`,"aria-label":m(`board:sidebar.denyNamed`,{title:e.title}),onClick:t=>c.decide(e,!1,t.currentTarget.closest(`[data-sidebar-item]`)),children:m(`board:sidebar.deny`)}),(0,H.jsx)(`button`,{type:`button`,className:`flex h-11 min-w-0 flex-1 items-center justify-center rounded-[var(--r-md)] bg-star text-sm font-medium text-on-accent focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus active:bg-star-hover`,"aria-label":m(`board:sidebar.approveNamed`,{title:e.title}),onClick:t=>c.decide(e,!0,t.currentTarget.closest(`[data-sidebar-item]`)),children:m(`board:sidebar.approve`)})]}),(0,H.jsxs)(`div`,{ref:_,"data-sidebar-quick":!0,className:l(`absolute top-1/2 right-1.5 flex -translate-y-1/2 items-center gap-1`,`invisible opacity-0 transition-[opacity,visibility] delay-[80ms] duration-[120ms] group-hover/row:visible group-hover/row:opacity-100 group-focus-within/row:visible group-focus-within/row:opacity-100 group-data-[menu-open]/row:visible group-data-[menu-open]/row:opacity-100 pointer-coarse:hidden`,p&&`hidden`),children:[e.group===`attention`&&(e.quickAction.kind===`decide`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{type:`button`,className:l(I,`bg-solid text-content ring-1 ring-stroke-strong ring-inset hover:bg-surface-hover`),"aria-label":m(`board:sidebar.denyNamed`,{title:e.title}),"aria-keyshortcuts":N(d),onClick:t=>c.decide(e,!1,t.currentTarget.closest(`[data-sidebar-item]`)),children:[m(`board:sidebar.deny`),(0,H.jsx)(Q,{binding:d})]}),(0,H.jsxs)(`button`,{type:`button`,className:l(I,`bg-star text-on-accent hover:bg-star-hover`),"aria-label":m(`board:sidebar.approveNamed`,{title:e.title}),"aria-keyshortcuts":N(u),onClick:t=>c.decide(e,!0,t.currentTarget.closest(`[data-sidebar-item]`)),children:[m(`board:sidebar.approve`),(0,H.jsx)(Q,{binding:u})]})]}):(0,H.jsxs)(`button`,{type:`button`,className:l(I,`bg-solid text-content ring-1 ring-stroke-strong ring-inset hover:bg-surface-hover`),"aria-label":m(`board:sidebar.openNamed`,{title:e.title}),onClick:()=>c.open(e),children:[m(`board:sidebar.open`),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`↵`})]})),(0,H.jsx)(E,{row:e,actions:c,canMarkHandled:e.group===`attention`&&e.status===`failed`,open:v,onOpenChange:y,side:`right`})]})]})}function Q({binding:e}){let t=e&&/^Key[A-Z]$/.test(e)?e.slice(3):``;return t?(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`font-normal opacity-60`,children:t}):null}function $(e,t){switch(t.glyph){case`run`:return e(`common:statusGlyph.run`);case`queued`:return e(`common:statusGlyph.queued`);case`failed`:return e(`common:statusGlyph.failed`);case`stopped`:return e(`common:statusGlyph.stopped`);case`attention`:return e(`common:statusGlyph.attention`);default:return e(`common:statusGlyph.done`)}}export{J as SidebarCommands,X as SidebarFleetLine,Y as SidebarRailCounts,Z as SidebarSessions};
@@ -1 +1 @@
1
- import{t as e}from"./index-_WvEqLNn.js";import{o as t}from"./vendor-state-GkUciC5H.js";import{t as n}from"./storage-DtvZ_lEu.js";var r=Object.freeze({collapsed:!1,doneCollapsed:!1});function i(e){let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return{...r}}if(!t||typeof t!=`object`||Array.isArray(t))return{...r};let n=t;return{collapsed:n.collapsed===!0,doneCollapsed:n.doneCollapsed===!0}}function a(e){return JSON.stringify({collapsed:e.collapsed===!0,doneCollapsed:e.doneCollapsed===!0})}function o(){try{return i(e.getItem(n.sidebar))}catch{return{...r}}}var s=t((t,r)=>{let i=i=>{let o=r(),s={...o,collapsed:o.preferenceCollapsed,...i};try{e.setItem(n.sidebar,a(s))}catch{}t(i.collapsed===void 0?i:{...i,preferenceCollapsed:i.collapsed})},s=e=>{t({peeking:!1}),r().routeRail||r().narrowRail?t({collapsed:e}):i({collapsed:e})},c=o();return{...c,preferenceCollapsed:c.collapsed,routeRail:!1,narrowRail:!1,peeking:!1,drawerOpen:!1,setCollapsed:e=>s(e),toggleCollapsed:()=>s(!r().collapsed),enterRouteRail:()=>t({routeRail:!0,collapsed:!0,peeking:!1}),leaveRouteRail:()=>{r().routeRail&&t({routeRail:!1,collapsed:r().narrowRail||r().preferenceCollapsed,peeking:!1})},enterNarrowRail:()=>{r().narrowRail||t({narrowRail:!0,collapsed:!0,peeking:!1})},leaveNarrowRail:()=>{r().narrowRail&&t({narrowRail:!1,collapsed:r().routeRail||r().preferenceCollapsed,peeking:!1})},setDoneCollapsed:e=>i({doneCollapsed:e}),setPeeking:e=>t({peeking:e}),setDrawerOpen:e=>t({drawerOpen:e})}});typeof window<`u`&&window.addEventListener(`storage`,e=>{if(e.key!==n.sidebar&&e.key!==null)return;let t=o();s.setState(e=>e.routeRail||e.narrowRail?{doneCollapsed:t.doneCollapsed,preferenceCollapsed:t.collapsed}:{...t,preferenceCollapsed:t.collapsed})});export{s as t};
1
+ import{t as e}from"./index-79gEOxmD.js";import{o as t}from"./vendor-state-GkUciC5H.js";import{t as n}from"./storage-DtvZ_lEu.js";var r=Object.freeze({collapsed:!1,doneCollapsed:!1});function i(e){let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return{...r}}if(!t||typeof t!=`object`||Array.isArray(t))return{...r};let n=t;return{collapsed:n.collapsed===!0,doneCollapsed:n.doneCollapsed===!0}}function a(e){return JSON.stringify({collapsed:e.collapsed===!0,doneCollapsed:e.doneCollapsed===!0})}function o(){try{return i(e.getItem(n.sidebar))}catch{return{...r}}}var s=t((t,r)=>{let i=i=>{let o=r(),s={...o,collapsed:o.preferenceCollapsed,...i};try{e.setItem(n.sidebar,a(s))}catch{}t(i.collapsed===void 0?i:{...i,preferenceCollapsed:i.collapsed})},s=e=>{t({peeking:!1}),r().routeRail||r().narrowRail?t({collapsed:e}):i({collapsed:e})},c=o();return{...c,preferenceCollapsed:c.collapsed,routeRail:!1,narrowRail:!1,peeking:!1,drawerOpen:!1,setCollapsed:e=>s(e),toggleCollapsed:()=>s(!r().collapsed),enterRouteRail:()=>t({routeRail:!0,collapsed:!0,peeking:!1}),leaveRouteRail:()=>{r().routeRail&&t({routeRail:!1,collapsed:r().narrowRail||r().preferenceCollapsed,peeking:!1})},enterNarrowRail:()=>{r().narrowRail||t({narrowRail:!0,collapsed:!0,peeking:!1})},leaveNarrowRail:()=>{r().narrowRail&&t({narrowRail:!1,collapsed:r().routeRail||r().preferenceCollapsed,peeking:!1})},setDoneCollapsed:e=>i({doneCollapsed:e}),setPeeking:e=>t({peeking:e}),setDrawerOpen:e=>t({drawerOpen:e})}});typeof window<`u`&&window.addEventListener(`storage`,e=>{if(e.key!==n.sidebar&&e.key!==null)return;let t=o();s.setState(e=>e.routeRail||e.narrowRail?{doneCollapsed:t.doneCollapsed,preferenceCollapsed:t.collapsed}:{...t,preferenceCollapsed:t.collapsed})});export{s as t};
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/speech-text-BTwYi9Sb.js","assets/vendor-markdown-CT6Z4fh8.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-router-CSN_DGvx.js","assets/vendor-react-DwNgTV1j.js","assets/vendor-markdown-plugins-CT5L3KA9.js","assets/vendor-shiki-runtime-DM7fm4Bl.js","assets/vendor-markdown-plugins-DEcVZfaU.css","assets/vendor-ui-DvrYggeS.js","assets/speech-stream-text-DF6aAUVb.js","assets/abort-signal-f4JsiYKX.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{n,r,t as i}from"./abort-signal-f4JsiYKX.js";import{t as a}from"./event-stream-DTCmB4AA.js";import{t as o}from"./api-C35aq3ml.js";function s(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`Local speech bridge is unavailable.`))}function c(e,t=256){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\uD800-\uDFFF]/u.test(e)}function l(e){if(e===void 0)return!0;if(!e||!c(e.name)||!c(e.url,2048))return!1;try{let t=new URL(e.url);return t.protocol===`https:`&&!t.username&&!t.password}catch{return!1}}function u(e){let t=new Set([`not-installed`,`downloading`,`verifying`,`installed`,`cancelled`,`error`]);if(!e||!e.defaults||!Array.isArray(e.models)||e.models.length>16||e.models.some(e=>!e||!c(e.id,128)||!c(e.name)||![`asr`,`tts`].includes(e.kind)||!t.has(e.status)||!Array.isArray(e.languages)||e.languages.length>16||e.languages.some(e=>!c(e,40))||!l(e.license)||!Number.isSafeInteger(e.totalBytes)||e.totalBytes<0||!Number.isSafeInteger(e.filesBytes)||e.filesBytes<0||!Number.isSafeInteger(e.downloadedBytes)||e.downloadedBytes<0||e.downloadedBytes>e.totalBytes||e.voices!==void 0&&(!Array.isArray(e.voices)||e.voices.length>256||e.voices.some(e=>!e||!c(e.id,128)||!c(e.name)||!c(e.language,40))))||new Set(e.models.map(e=>e.id)).size!==e.models.length||![`asr`,`tts`].every(t=>e.models.some(n=>n.id===e.defaults[t]&&n.kind===t)))throw Error(`Invalid local speech model catalog.`);let n=e.models.flatMap(e=>e.voices||[]);if(new Set(n.map(e=>e.id)).size!==n.length||!e.models.find(t=>t.id===e.defaults.tts)?.voices?.some(t=>t.id===e.defaults.voice))throw Error(`Invalid local speech model catalog.`);return e}async function d(e){e?.throwIfAborted();let t=window.__PISPER_MOBILE_APP__?await s(`mobile_speech_models`):await o(`/api/speech/models`,{signal:e});return e?.throwIfAborted(),u(t)}async function f(e){return window.__PISPER_MOBILE_APP__?s(`mobile_download_speech_model`,{modelId:e}):o(`/api/speech/models/download`,{method:`POST`,body:{modelId:e}})}async function p(e){return window.__PISPER_MOBILE_APP__?s(`mobile_cancel_speech_model_download`,{modelId:e}):o(`/api/speech/models/cancel`,{method:`POST`,body:{modelId:e}})}function m(e,t){return e.models.filter(n=>t.some(t=>n.id===e.defaults[t]))}function h(e){return String(e).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/[_-]+/g,` `).replace(/\s+/g,` `).trim().toLowerCase()}function g(e){return[...new Set(e.map(h).filter(Boolean))].join(`
2
+ import{r as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{n,r,t as i}from"./abort-signal-f4JsiYKX.js";import{t as a}from"./event-stream-BrDcABQx.js";import{t as o}from"./api-Cm58F7OP.js";function s(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`Local speech bridge is unavailable.`))}function c(e,t=256){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\uD800-\uDFFF]/u.test(e)}function l(e){if(e===void 0)return!0;if(!e||!c(e.name)||!c(e.url,2048))return!1;try{let t=new URL(e.url);return t.protocol===`https:`&&!t.username&&!t.password}catch{return!1}}function u(e){let t=new Set([`not-installed`,`downloading`,`verifying`,`installed`,`cancelled`,`error`]);if(!e||!e.defaults||!Array.isArray(e.models)||e.models.length>16||e.models.some(e=>!e||!c(e.id,128)||!c(e.name)||![`asr`,`tts`].includes(e.kind)||!t.has(e.status)||!Array.isArray(e.languages)||e.languages.length>16||e.languages.some(e=>!c(e,40))||!l(e.license)||!Number.isSafeInteger(e.totalBytes)||e.totalBytes<0||!Number.isSafeInteger(e.filesBytes)||e.filesBytes<0||!Number.isSafeInteger(e.downloadedBytes)||e.downloadedBytes<0||e.downloadedBytes>e.totalBytes||e.voices!==void 0&&(!Array.isArray(e.voices)||e.voices.length>256||e.voices.some(e=>!e||!c(e.id,128)||!c(e.name)||!c(e.language,40))))||new Set(e.models.map(e=>e.id)).size!==e.models.length||![`asr`,`tts`].every(t=>e.models.some(n=>n.id===e.defaults[t]&&n.kind===t)))throw Error(`Invalid local speech model catalog.`);let n=e.models.flatMap(e=>e.voices||[]);if(new Set(n.map(e=>e.id)).size!==n.length||!e.models.find(t=>t.id===e.defaults.tts)?.voices?.some(t=>t.id===e.defaults.voice))throw Error(`Invalid local speech model catalog.`);return e}async function d(e){e?.throwIfAborted();let t=window.__PISPER_MOBILE_APP__?await s(`mobile_speech_models`):await o(`/api/speech/models`,{signal:e});return e?.throwIfAborted(),u(t)}async function f(e){return window.__PISPER_MOBILE_APP__?s(`mobile_download_speech_model`,{modelId:e}):o(`/api/speech/models/download`,{method:`POST`,body:{modelId:e}})}async function p(e){return window.__PISPER_MOBILE_APP__?s(`mobile_cancel_speech_model_download`,{modelId:e}):o(`/api/speech/models/cancel`,{method:`POST`,body:{modelId:e}})}function m(e,t){return e.models.filter(n=>t.some(t=>n.id===e.defaults[t]))}function h(e){return String(e).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/[_-]+/g,` `).replace(/\s+/g,` `).trim().toLowerCase()}function g(e){return[...new Set(e.map(h).filter(Boolean))].join(`
3
3
  `)}var _;function v(){if(_===void 0)try{RegExp(`(?<=a)`),_=!0}catch{_=!1}return _}var y=/[A-Za-z0-9_./\\-]/;function b(e,t){let n=new Map;for(let e of t){let t=h(e);if(!(!/[A-Z]/.test(e)&&!e.includes(` `)||!/^[A-Za-z][A-Za-z0-9 ]*$/.test(e)))for(let r of[t,e.toLowerCase()])r.length>=3&&!n.has(r)&&n.set(r,e)}if(!n.size)return e;let r=`(?:${[...n.keys()].sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/ /g,`[ \\t]+`)).join(`|`)})`,i=`(?![A-Za-z0-9_/\\\\-]|\\.[A-Za-z0-9_])`,a=v(),o=RegExp(a?`(?<![A-Za-z0-9_./\\\\-])${r}${i}`:`${r}${i}`,`gi`);return e.replace(o,(e,...t)=>{if(!a){let n=t[t.length-2],r=t[t.length-1];if(n>0&&y.test(r[n-1]))return e}return n.get(e.toLowerCase().replace(/[ \t]+/g,` `))||e})}var x=e({loadSpeechHotwords:()=>S,prepareSpeechSession:()=>C});async function S(e,t){let i=n(t,3e4);try{let t=await o(`/api/speech/terms?sessionId=${encodeURIComponent(e)}`,{signal:i.signal});if(r(i.signal),!Array.isArray(t.terms)||t.terms.some(e=>typeof e!=`string`))throw Error(`语音术语响应无效。`);return{terms:t.terms,hotwords:g(t.terms)}}finally{i.dispose()}}async function C(e,o){r(o);let c=crypto.randomUUID(),l={requestId:c,...e,kinds:[...e.kinds]},u=!!window.__PISPER_MOBILE_APP__,d=!e.kinds.includes(`tts`),f=n(o),p=n(f.signal,6e4),m=!1,h=!1,g,_,v=new Promise((e,t)=>{g=e,_=t}),y=()=>{s(`mobile_release_speech_session`,{requestId:c}).catch(()=>{})},b=()=>{p.signal.removeEventListener(`abort`,S),f.signal.removeEventListener(`abort`,x),p.dispose(),f.dispose()},x=()=>{_(i(f.signal)),b(),u&&y()},S=()=>f.abort(i(p.signal));p.signal.addEventListener(`abort`,S,{once:!0}),f.signal.addEventListener(`abort`,x,{once:!0});let C=()=>{r(f.signal),!(!h||!d||m)&&(m=!0,p.signal.removeEventListener(`abort`,S),p.dispose(),g())},w=e=>{f.signal.aborted||(_(e),f.abort(e),m&&window.dispatchEvent(new Event(`pisper:speech-interrupted`)))},T=e=>{if(!e||typeof e!=`object`||!(`ready`in e)||e.ready!==!0)throw Error(`Invalid speech session readiness.`);h=!0,C()};d||Promise.all([t(()=>import(`./speech-text-BTwYi9Sb.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),t(()=>import(`./speech-stream-text-DF6aAUVb.js`),__vite__mapDeps([9,1,2,3,4,5,6,7,8,10,0]))]).then(()=>{d=!0,C()}).catch(w),(async()=>{if(u){try{T(await s(`mobile_prepare_speech_session`,l))}finally{f.signal.aborted&&y()}return}let e=await fetch(`/api/speech/session`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(l),signal:f.signal});throw await a(e,(e,t)=>{if(r(f.signal),e===`ready`)T(t);else if(e===`error`)throw Error(t.error||`Speech session failed.`)}),Error(`Speech session connection was interrupted.`)})().catch(w);try{return await v,r(f.signal),{requestId:c,signal:f.signal}}catch(e){throw f.abort(e),b(),e}}export{g as a,d as c,b as i,s as l,C as n,p as o,x as r,f as s,S as t,m as u};
@@ -1 +1 @@
1
- import{D as e,O as t,_ as n,a as r,d as i,g as a,h as o,l as s,m as c,o as l,t as u,u as d,w as f,x as p}from"./query-DFQayLF5.js";import{t as m}from"./mutation-b4pPvB7p.js";import{t as h}from"./api-C35aq3ml.js";var g=class extends t{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new m({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){l.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>c(t,e))}findAll(e={}){return this.getAll().filter(t=>c(e,t))}notify(e){l.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return l.batch(()=>Promise.all(e.map(e=>e.continue().catch(a))))}};function _(e){return e.options.scope?.id}var v=class extends t{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,a=t.queryHash??i(r,t),o=this.get(a);return o||(o=new u({client:e,queryKey:r,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){l.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){l.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){l.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){l.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},y=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new v,this.#t=e.mutationCache||new g,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=e.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=r.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(p(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=s(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return l.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;l.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return l.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=l.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(a).catch(a)}invalidateQueries(e,t={}){return l.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=l.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(a)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(a)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(p(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(a).catch(a)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(a).catch(a)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return r.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(d(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],r={};return t.forEach(t=>{n(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#i.set(d(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],r={};return t.forEach(t=>{n(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=i(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===f&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},b=new Set;function x(e){if(!(typeof window>`u`)){try{if(window.localStorage.getItem(`pisper:startup-diagnostics`)!==`1`)return}catch{return}b.has(e)||(b.add(e),performance.mark(`pisper-${e}`),console.debug(`[startup]`,e,Math.round(performance.now())))}}var S=new y({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:15e3},mutations:{retry:0}}}),C={config:`/api/config`,sessions:`/api/sessions`,"notification-settings":`/api/settings/notifications`,plugins:`/api/plugins`},w=new Map,T=[`sessions`,`board`];function E(e){return e===`sessions`?T:[e]}function D(e){return{queryKey:E(e),queryFn:async()=>{for(;;){let t=w.get(e);try{let n=await h(C[e]);if(t!==w.get(e))continue;return e===`sessions`&&x(`sessions-loaded`),n}catch(n){if(t!==w.get(e))continue;throw n}}},staleTime:15e3}}function O(e,t=!1){return S.fetchQuery({...D(e),...t?{staleTime:0}:{}})}function k(e){return w.set(e,(w.get(e)??0)+1),S.invalidateQueries({queryKey:E(e),exact:!0},{cancelRefetch:!1})}function A(e){let t=()=>{k(`sessions`)};return e.addEventListener(`pisper:sessions-updated`,t),()=>e.removeEventListener(`pisper:sessions-updated`,t)}export{S as a,k as i,O as n,D as o,A as r,x as s,T as t};
1
+ import{D as e,O as t,_ as n,a as r,d as i,g as a,h as o,l as s,m as c,o as l,t as u,u as d,w as f,x as p}from"./query-DFQayLF5.js";import{t as m}from"./mutation-b4pPvB7p.js";import{t as h}from"./api-Cm58F7OP.js";var g=class extends t{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new m({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){l.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>c(t,e))}findAll(e={}){return this.getAll().filter(t=>c(e,t))}notify(e){l.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return l.batch(()=>Promise.all(e.map(e=>e.continue().catch(a))))}};function _(e){return e.options.scope?.id}var v=class extends t{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,a=t.queryHash??i(r,t),o=this.get(a);return o||(o=new u({client:e,queryKey:r,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){l.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){l.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){l.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){l.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},y=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new v,this.#t=e.mutationCache||new g,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=e.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=r.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(p(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=s(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return l.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;l.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return l.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=l.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(a).catch(a)}invalidateQueries(e,t={}){return l.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=l.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(a)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(a)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(p(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(a).catch(a)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(a).catch(a)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return r.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(d(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],r={};return t.forEach(t=>{n(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#i.set(d(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],r={};return t.forEach(t=>{n(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=i(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===f&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},b=new Set;function x(e){if(!(typeof window>`u`)){try{if(window.localStorage.getItem(`pisper:startup-diagnostics`)!==`1`)return}catch{return}b.has(e)||(b.add(e),performance.mark(`pisper-${e}`),console.debug(`[startup]`,e,Math.round(performance.now())))}}var S=new y({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:15e3},mutations:{retry:0}}}),C={config:`/api/config`,sessions:`/api/sessions`,"notification-settings":`/api/settings/notifications`,plugins:`/api/plugins`},w=new Map,T=[`sessions`,`board`];function E(e){return e===`sessions`?T:[e]}function D(e){return{queryKey:E(e),queryFn:async()=>{for(;;){let t=w.get(e);try{let n=await h(C[e]);if(t!==w.get(e))continue;return e===`sessions`&&x(`sessions-loaded`),n}catch(n){if(t!==w.get(e))continue;throw n}}},staleTime:15e3}}function O(e,t=!1){return S.fetchQuery({...D(e),...t?{staleTime:0}:{}})}function k(e){return w.set(e,(w.get(e)??0)+1),S.invalidateQueries({queryKey:E(e),exact:!0},{cancelRefetch:!1})}function A(e){let t=()=>{k(`sessions`)};return e.addEventListener(`pisper:sessions-updated`,t),()=>e.removeEventListener(`pisper:sessions-updated`,t)}export{S as a,k as i,O as n,D as o,A as r,x as s,T as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{d as n,h as r,m as i,p as a,t as o}from"./i18n-CWhhZ2QN.js";import{s}from"./vendor-state-GkUciC5H.js";var c=e(t()),l=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);g(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},u={},d=(e,t,n,r)=>{g(n)&&u[n]||(g(n)&&(u[n]=new Date),l(e,t,n,r))},f=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},p=(e,t,n)=>{e.loadNamespaces(t,f(e,n))},m=(e,t,n,r)=>{if(g(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return p(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,f(e,r))},h=(e,t,n={})=>!t.languages||!t.languages.length?(d(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),g=e=>typeof e==`string`,_=e=>typeof e==`object`&&!!e,v=(0,c.createContext)(),y=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},b=s(),x={t:(e,t)=>{if(g(t))return t;if(_(t)&&g(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},S=()=>()=>{},C=(e,t={})=>{let{i18n:n}=t,{i18n:a,defaultNS:o}=(0,c.useContext)(v)||{},s=n||a||i();s&&!s.reportNamespaces&&(s.reportNamespaces=new y),s||d(s,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`);let l=(0,c.useMemo)(()=>({...r(),...s?.options?.react,...t}),[s,t]),{useSuspense:u,keyPrefix:f}=l,_=e||o||s?.options?.defaultNS,C=g(_)?[_]:_||[`translation`],w=(0,c.useMemo)(()=>C,C);s?.reportNamespaces?.addUsedNamespaces?.(w);let T=(0,c.useRef)(0),E=(0,c.useCallback)(e=>{if(!s)return S;let{bindI18n:t,bindI18nStore:n}=l,r=()=>{T.current+=1,e()};return t&&s.on(t,r),n&&s.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>s.off(e,r)),n&&n.split(` `).forEach(e=>s.store.off(e,r))}},[s,l]),D=(0,c.useRef)(),O=(0,c.useCallback)(()=>{if(!s)return x;let e=!!(s.isInitialized||s.initializedStoreOnce)&&w.every(e=>h(e,s,l)),n=t.lng||s.language,r=T.current,i=D.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===f&&i.revision===r)return i;let a={t:s.getFixedT(n,l.nsMode===`fallback`?w:w[0],f,{scopeNs:w}),ready:e,lng:n,keyPrefix:f,revision:r};return D.current=a,a},[s,w,f,l,t.lng]),[k,A]=(0,c.useState)(0),{t:j,ready:M}=(0,b.useSyncExternalStore)(E,O,O);(0,c.useEffect)(()=>{if(s&&!M&&!u){let e=()=>A(e=>e+1);t.lng?m(s,t.lng,w,e):p(s,w,e)}},[s,t.lng,w,M,u,k]);let N=s||{},P=(0,c.useRef)(null),F=(0,c.useRef)(),I=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},L=(0,c.useMemo)(()=>{let e=N,t=e?.language,n=e;e&&(P.current&&P.current.__original===e&&F.current===t?n=P.current:(n=I(e),P.current=n,F.current=t));let r=!M&&!u?(...e)=>(d(s,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),j(...e)):j,i=[r,n,M];return i.t=r,i.i18n=n,i.ready=M,i},[j,N,M,N.resolvedLanguage,N.language,N.languages]);if(s&&u&&!M){let e=!1;try{e=!1}catch{}throw e&&d(s,`SUSPENDED_WHILE_LOADING`,`useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook`),new Promise(e=>{let n=()=>e();t.lng?m(s,t.lng,w,n):p(s,w,n)})}return L};function w(){let{i18n:e}=C(),t=n(e.resolvedLanguage)?e.resolvedLanguage:o;return{language:t,locale:t,setLanguage:(0,c.useCallback)(t=>{n(t)&&e.changeLanguage(t)},[e]),t:(0,c.useCallback)((e,n)=>a(e,t,n),[t])}}export{C as n,v as r,w as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{d as n,h as r,m as i,p as a,t as o}from"./i18n-B7QmqfvO.js";import{s}from"./vendor-state-GkUciC5H.js";var c=e(t()),l=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);g(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},u={},d=(e,t,n,r)=>{g(n)&&u[n]||(g(n)&&(u[n]=new Date),l(e,t,n,r))},f=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},p=(e,t,n)=>{e.loadNamespaces(t,f(e,n))},m=(e,t,n,r)=>{if(g(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return p(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,f(e,r))},h=(e,t,n={})=>!t.languages||!t.languages.length?(d(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),g=e=>typeof e==`string`,_=e=>typeof e==`object`&&!!e,v=(0,c.createContext)(),y=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},b=s(),x={t:(e,t)=>{if(g(t))return t;if(_(t)&&g(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},S=()=>()=>{},C=(e,t={})=>{let{i18n:n}=t,{i18n:a,defaultNS:o}=(0,c.useContext)(v)||{},s=n||a||i();s&&!s.reportNamespaces&&(s.reportNamespaces=new y),s||d(s,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`);let l=(0,c.useMemo)(()=>({...r(),...s?.options?.react,...t}),[s,t]),{useSuspense:u,keyPrefix:f}=l,_=e||o||s?.options?.defaultNS,C=g(_)?[_]:_||[`translation`],w=(0,c.useMemo)(()=>C,C);s?.reportNamespaces?.addUsedNamespaces?.(w);let T=(0,c.useRef)(0),E=(0,c.useCallback)(e=>{if(!s)return S;let{bindI18n:t,bindI18nStore:n}=l,r=()=>{T.current+=1,e()};return t&&s.on(t,r),n&&s.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>s.off(e,r)),n&&n.split(` `).forEach(e=>s.store.off(e,r))}},[s,l]),D=(0,c.useRef)(),O=(0,c.useCallback)(()=>{if(!s)return x;let e=!!(s.isInitialized||s.initializedStoreOnce)&&w.every(e=>h(e,s,l)),n=t.lng||s.language,r=T.current,i=D.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===f&&i.revision===r)return i;let a={t:s.getFixedT(n,l.nsMode===`fallback`?w:w[0],f,{scopeNs:w}),ready:e,lng:n,keyPrefix:f,revision:r};return D.current=a,a},[s,w,f,l,t.lng]),[k,A]=(0,c.useState)(0),{t:j,ready:M}=(0,b.useSyncExternalStore)(E,O,O);(0,c.useEffect)(()=>{if(s&&!M&&!u){let e=()=>A(e=>e+1);t.lng?m(s,t.lng,w,e):p(s,w,e)}},[s,t.lng,w,M,u,k]);let N=s||{},P=(0,c.useRef)(null),F=(0,c.useRef)(),I=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},L=(0,c.useMemo)(()=>{let e=N,t=e?.language,n=e;e&&(P.current&&P.current.__original===e&&F.current===t?n=P.current:(n=I(e),P.current=n,F.current=t));let r=!M&&!u?(...e)=>(d(s,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),j(...e)):j,i=[r,n,M];return i.t=r,i.i18n=n,i.ready=M,i},[j,N,M,N.resolvedLanguage,N.language,N.languages]);if(s&&u&&!M){let e=!1;try{e=!1}catch{}throw e&&d(s,`SUSPENDED_WHILE_LOADING`,`useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook`),new Promise(e=>{let n=()=>e();t.lng?m(s,t.lng,w,n):p(s,w,n)})}return L};function w(){let{i18n:e}=C(),t=n(e.resolvedLanguage)?e.resolvedLanguage:o;return{language:t,locale:t,setLanguage:(0,c.useCallback)(t=>{n(t)&&e.changeLanguage(t)},[e]),t:(0,c.useCallback)((e,n)=>a(e,t,n),[t])}}export{C as n,v as r,w as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{f as i}from"./routes-DIeaqWVc.js";import{t as a}from"./use-i18n-QY-mTTDS.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./WorkspacePicker-Bt_doGjv.js";import{t as c}from"./folder-open-FIShC5Qk.js";import{t as l}from"./utils-C8uzG5AZ.js";import{t as u}from"./button-CCcCN8tE.js";import{a as d,i as f,l as p,o as m,s as h,t as g}from"./dialog-27CgEIc2.js";import{t as _}from"./input-CPw-zkYh.js";import{t as v}from"./textarea-DmATpOqT.js";import{t as y}from"./pick-system-directory-CjwfGZuj.js";import{n as b}from"./field-DoLEb0np.js";import{i as x,r as S,s as C,t as w}from"./BotAvatar-CNL-APwP.js";import{S as T,c as E,n as D}from"./bots-store-CWuQZKi-.js";var O=o(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),k=e(n(),1);function A(e,t){switch(t){case`bean`:return e(`bots:character.bean`);case`robot`:return e(`bots:character.robot`);case`cat`:return e(`bots:character.cat`);case`owl`:return e(`bots:character.owl`);case`ghost`:return e(`bots:character.ghost`);case`cloud`:return e(`bots:character.cloud`);case`octo`:return e(`bots:character.octo`);case`bunny`:return e(`bots:character.bunny`);case`bear`:return e(`bots:character.bear`);case`fox`:return e(`bots:character.fox`);case`star`:return e(`bots:character.star`);default:return e(`bots:character.blob`)}}function j(e,t){return e(t===`full-access`?`bots:details.modeFull`:t===`workspace-write`?`bots:details.modeWorkspace`:`bots:details.modeApproval`)}function M(e,t){return`ref`in t?t.ref.split(`/`).at(-1)||t.ref:t.tier===`fast`?e(`bots:model.tierFast`):t.tier===`strong`?e(`bots:model.tierStrong`):e(`bots:model.tierStandard`)}function N(e,t){switch(t){case`off`:return e(`bots:model.thinkingOff`);case`minimal`:return e(`bots:model.thinkingMinimal`);case`low`:return e(`bots:model.thinkingLow`);case`medium`:return e(`bots:model.thinkingMedium`);case`high`:return e(`bots:model.thinkingHigh`);case`xhigh`:return e(`bots:model.thinkingXhigh`);default:return e(`bots:model.thinkingDefault`)}}function P(e,t){return e(t===`weixin`?`bots:triggers.weixin`:t===`qq`?`bots:triggers.qq`:t===`telegram`?`bots:triggers.telegram`:`bots:triggers.feishu`)}function F(e,t){switch(t){case 0:return e(`bots:triggers.sunday`);case 2:return e(`bots:triggers.tuesday`);case 3:return e(`bots:triggers.wednesday`);case 4:return e(`bots:triggers.thursday`);case 5:return e(`bots:triggers.friday`);case 6:return e(`bots:triggers.saturday`);default:return e(`bots:triggers.monday`)}}function I(e,t){return t.frequency===`once`?e(`bots:triggers.onceAt`,{date:t.date,time:t.time}):t.frequency===`weekly`?e(`bots:triggers.weeklyAt`,{day:F(e,t.dayOfWeek),time:t.time}):t.frequency===`daily`?e(`bots:triggers.dailyAt`,{time:t.time}):e(`bots:triggers.otherSchedule`)}function L(e){return[...new Set(e.split(/[\s,,、]+/).map(e=>e.trim()).filter(Boolean))]}var R=r();function z({value:e,onChange:t,disabled:n=!1}){let{t:r}=a();return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`bots:new.character`),className:`grid grid-cols-6 gap-2`,children:S.map(i=>(0,R.jsx)(`button`,{type:`button`,role:`radio`,disabled:n,"aria-checked":e.character===i,"aria-label":A(r,i),title:A(r,i),className:l(`grid place-items-center rounded-[12px] p-0.5 ring-offset-2 ring-offset-surface-raised`,e.character===i&&`ring-2 ring-content`),onClick:()=>t({...e,character:i}),children:(0,R.jsx)(w,{avatar:{...e,character:i},size:40,animate:!1})},i))}),(0,R.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`bots:new.color`),className:`flex gap-2`,children:x.map(i=>(0,R.jsx)(`button`,{type:`button`,role:`radio`,disabled:n,"aria-checked":e.color===i,"aria-label":r(`bots:new.colorOption`,{index:x.indexOf(i)+1}),className:l(`rounded-full p-0.5 ring-offset-2 ring-offset-surface-raised`,e.color===i&&`ring-2 ring-content`),onClick:()=>t({...e,color:i}),children:(0,R.jsx)(w,{avatar:{...e,color:i},size:24,animate:!1,className:`rounded-full`})},i))})]})}function B({open:e,onOpenChange:t,onCreated:n}){let{t:r}=a(),i=D(e=>e.upsert),[o,l]=(0,k.useState)(``),[x,S]=(0,k.useState)(``),[T,A]=(0,k.useState)(C),[j,M]=(0,k.useState)(!1),[N,P]=(0,k.useState)(``),[F,I]=(0,k.useState)(!1),[L,B]=(0,k.useState)(!1),[V,H]=(0,k.useState)(!1),[U,W]=(0,k.useState)(!1),[G,K]=(0,k.useState)(``);(0,k.useEffect)(()=>{e&&(A(C()),M(!1),I(!1),K(``))},[e]);let q=async()=>{if(!L){B(!0),K(``);try{let e=await y(N.trim(),r(`bots:new.folder`));e.status===`picked`?P(e.path):e.status===`unavailable`&&H(!0)}catch(e){K(e instanceof Error?e.message:String(e))}finally{B(!1)}}};return(0,R.jsx)(g,{open:e,onOpenChange:t,children:(0,R.jsxs)(f,{className:`sm:max-w-[440px]`,children:[(0,R.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),W(!0),K(``);try{let e=await E({name:o.trim(),avatar:T,instructions:x.trim(),workspace:{cwd:N.trim()}});i(e),t(!1),l(``),S(``),P(``),n(e)}catch(e){K(e instanceof Error?e.message:String(e))}finally{W(!1)}},className:`flex flex-col gap-4`,children:[(0,R.jsxs)(h,{children:[(0,R.jsx)(p,{children:r(`bots:new.title`)}),(0,R.jsx)(d,{children:r(`bots:new.description`)})]}),(0,R.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`group relative flex-none rounded-[28%]`,"aria-label":r(`bots:new.shuffle`),title:r(`bots:new.shuffle`),onClick:()=>A(C()),children:[(0,R.jsx)(w,{avatar:T,size:56}),(0,R.jsx)(`span`,{className:`absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-full border border-stroke bg-surface-raised text-content-muted group-hover:text-content`,children:(0,R.jsx)(O,{className:`size-3`,"aria-hidden":`true`})})]}),(0,R.jsxs)(b,{variant:`control`,className:`flex-1`,children:[r(`bots:new.name`),(0,R.jsx)(_,{value:o,autoFocus:!0,maxLength:24,placeholder:r(`bots:new.namePlaceholder`),onChange:e=>l(e.target.value)})]})]}),j?(0,R.jsx)(z,{value:T,onChange:A}):(0,R.jsx)(`button`,{type:`button`,className:`-mt-2 self-start text-xs text-content-muted underline-offset-2 hover:text-content hover:underline`,onClick:()=>M(!0),children:r(`bots:new.chooseLook`)}),(0,R.jsxs)(b,{variant:`control`,children:[r(`bots:new.duty`),(0,R.jsx)(v,{value:x,rows:3,maxLength:12e3,placeholder:r(`bots:new.dutyPlaceholder`),onChange:e=>S(e.target.value)})]}),F?(0,R.jsxs)(b,{variant:`control`,children:[r(`bots:new.folder`),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(_,{value:N,className:`font-mono`,placeholder:r(`bots:new.folderDefault`),onChange:e=>P(e.target.value)}),(0,R.jsxs)(u,{type:`button`,variant:`outline`,disabled:L,onClick:()=>void q(),children:[(0,R.jsx)(c,{"aria-hidden":`true`}),r(`bots:new.pick`)]})]})]}):(0,R.jsxs)(`p`,{className:`text-xs text-content-muted`,children:[r(`bots:new.folderSummary`),` `,(0,R.jsx)(`button`,{type:`button`,className:`text-content-secondary underline underline-offset-2 hover:text-content`,onClick:()=>I(!0),children:r(`bots:new.changeFolder`)})]}),G&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:G}),(0,R.jsxs)(m,{children:[(0,R.jsx)(u,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:r(`bots:new.cancel`)}),(0,R.jsx)(u,{type:`submit`,disabled:U||!o.trim(),children:r(U?`bots:new.creating`:`bots:new.create`)})]})]}),(0,R.jsx)(s,{open:V,initialPath:N,onOpenChange:H,onSelect:e=>{P(e),H(!1)}})]})})}function V(e){let n=t(),r=D(e=>e.load);return(0,k.useCallback)(async t=>{try{let e=await T(t.id);e!==t.threadSessionId&&r(),n(i(e))}catch(n){e(n instanceof Error?n.message:String(n),t.id)}},[r,n,e])}export{N as a,I as c,M as i,L as l,B as n,j as o,z as r,P as s,V as t,F as u};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{f as i}from"./routes-DIeaqWVc.js";import{t as a}from"./use-i18n-8V6eRMcE.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./WorkspacePicker-D6FLo7O1.js";import{t as c}from"./folder-open-FIShC5Qk.js";import{t as l}from"./utils-C8uzG5AZ.js";import{t as u}from"./button-CCcCN8tE.js";import{a as d,i as f,l as p,o as m,s as h,t as g}from"./dialog-D23yIdOZ.js";import{t as _}from"./input-CPw-zkYh.js";import{t as v}from"./textarea-DmATpOqT.js";import{t as y}from"./pick-system-directory-DS_-qn8W.js";import{n as b}from"./field-DoLEb0np.js";import{i as x,r as S,s as C,t as w}from"./BotAvatar-CNL-APwP.js";import{S as T,c as E,n as D}from"./bots-store-CRGayU4z.js";var O=o(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),k=e(n(),1);function A(e,t){switch(t){case`bean`:return e(`bots:character.bean`);case`robot`:return e(`bots:character.robot`);case`cat`:return e(`bots:character.cat`);case`owl`:return e(`bots:character.owl`);case`ghost`:return e(`bots:character.ghost`);case`cloud`:return e(`bots:character.cloud`);case`octo`:return e(`bots:character.octo`);case`bunny`:return e(`bots:character.bunny`);case`bear`:return e(`bots:character.bear`);case`fox`:return e(`bots:character.fox`);case`star`:return e(`bots:character.star`);default:return e(`bots:character.blob`)}}function j(e,t){return e(t===`full-access`?`bots:details.modeFull`:t===`workspace-write`?`bots:details.modeWorkspace`:`bots:details.modeApproval`)}function M(e,t){return`ref`in t?t.ref.split(`/`).at(-1)||t.ref:t.tier===`fast`?e(`bots:model.tierFast`):t.tier===`strong`?e(`bots:model.tierStrong`):e(`bots:model.tierStandard`)}function N(e,t){switch(t){case`off`:return e(`bots:model.thinkingOff`);case`minimal`:return e(`bots:model.thinkingMinimal`);case`low`:return e(`bots:model.thinkingLow`);case`medium`:return e(`bots:model.thinkingMedium`);case`high`:return e(`bots:model.thinkingHigh`);case`xhigh`:return e(`bots:model.thinkingXhigh`);default:return e(`bots:model.thinkingDefault`)}}function P(e,t){return e(t===`weixin`?`bots:triggers.weixin`:t===`qq`?`bots:triggers.qq`:t===`telegram`?`bots:triggers.telegram`:`bots:triggers.feishu`)}function F(e,t){switch(t){case 0:return e(`bots:triggers.sunday`);case 2:return e(`bots:triggers.tuesday`);case 3:return e(`bots:triggers.wednesday`);case 4:return e(`bots:triggers.thursday`);case 5:return e(`bots:triggers.friday`);case 6:return e(`bots:triggers.saturday`);default:return e(`bots:triggers.monday`)}}function I(e,t){return t.frequency===`once`?e(`bots:triggers.onceAt`,{date:t.date,time:t.time}):t.frequency===`weekly`?e(`bots:triggers.weeklyAt`,{day:F(e,t.dayOfWeek),time:t.time}):t.frequency===`daily`?e(`bots:triggers.dailyAt`,{time:t.time}):e(`bots:triggers.otherSchedule`)}function L(e){return[...new Set(e.split(/[\s,,、]+/).map(e=>e.trim()).filter(Boolean))]}var R=r();function z({value:e,onChange:t,disabled:n=!1}){let{t:r}=a();return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`bots:new.character`),className:`grid grid-cols-6 gap-2`,children:S.map(i=>(0,R.jsx)(`button`,{type:`button`,role:`radio`,disabled:n,"aria-checked":e.character===i,"aria-label":A(r,i),title:A(r,i),className:l(`grid place-items-center rounded-[12px] p-0.5 ring-offset-2 ring-offset-surface-raised`,e.character===i&&`ring-2 ring-content`),onClick:()=>t({...e,character:i}),children:(0,R.jsx)(w,{avatar:{...e,character:i},size:40,animate:!1})},i))}),(0,R.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`bots:new.color`),className:`flex gap-2`,children:x.map(i=>(0,R.jsx)(`button`,{type:`button`,role:`radio`,disabled:n,"aria-checked":e.color===i,"aria-label":r(`bots:new.colorOption`,{index:x.indexOf(i)+1}),className:l(`rounded-full p-0.5 ring-offset-2 ring-offset-surface-raised`,e.color===i&&`ring-2 ring-content`),onClick:()=>t({...e,color:i}),children:(0,R.jsx)(w,{avatar:{...e,color:i},size:24,animate:!1,className:`rounded-full`})},i))})]})}function B({open:e,onOpenChange:t,onCreated:n}){let{t:r}=a(),i=D(e=>e.upsert),[o,l]=(0,k.useState)(``),[x,S]=(0,k.useState)(``),[T,A]=(0,k.useState)(C),[j,M]=(0,k.useState)(!1),[N,P]=(0,k.useState)(``),[F,I]=(0,k.useState)(!1),[L,B]=(0,k.useState)(!1),[V,H]=(0,k.useState)(!1),[U,W]=(0,k.useState)(!1),[G,K]=(0,k.useState)(``);(0,k.useEffect)(()=>{e&&(A(C()),M(!1),I(!1),K(``))},[e]);let q=async()=>{if(!L){B(!0),K(``);try{let e=await y(N.trim(),r(`bots:new.folder`));e.status===`picked`?P(e.path):e.status===`unavailable`&&H(!0)}catch(e){K(e instanceof Error?e.message:String(e))}finally{B(!1)}}};return(0,R.jsx)(g,{open:e,onOpenChange:t,children:(0,R.jsxs)(f,{className:`sm:max-w-[440px]`,children:[(0,R.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),W(!0),K(``);try{let e=await E({name:o.trim(),avatar:T,instructions:x.trim(),workspace:{cwd:N.trim()}});i(e),t(!1),l(``),S(``),P(``),n(e)}catch(e){K(e instanceof Error?e.message:String(e))}finally{W(!1)}},className:`flex flex-col gap-4`,children:[(0,R.jsxs)(h,{children:[(0,R.jsx)(p,{children:r(`bots:new.title`)}),(0,R.jsx)(d,{children:r(`bots:new.description`)})]}),(0,R.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`group relative flex-none rounded-[28%]`,"aria-label":r(`bots:new.shuffle`),title:r(`bots:new.shuffle`),onClick:()=>A(C()),children:[(0,R.jsx)(w,{avatar:T,size:56}),(0,R.jsx)(`span`,{className:`absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-full border border-stroke bg-surface-raised text-content-muted group-hover:text-content`,children:(0,R.jsx)(O,{className:`size-3`,"aria-hidden":`true`})})]}),(0,R.jsxs)(b,{variant:`control`,className:`flex-1`,children:[r(`bots:new.name`),(0,R.jsx)(_,{value:o,autoFocus:!0,maxLength:24,placeholder:r(`bots:new.namePlaceholder`),onChange:e=>l(e.target.value)})]})]}),j?(0,R.jsx)(z,{value:T,onChange:A}):(0,R.jsx)(`button`,{type:`button`,className:`-mt-2 self-start text-xs text-content-muted underline-offset-2 hover:text-content hover:underline`,onClick:()=>M(!0),children:r(`bots:new.chooseLook`)}),(0,R.jsxs)(b,{variant:`control`,children:[r(`bots:new.duty`),(0,R.jsx)(v,{value:x,rows:3,maxLength:12e3,placeholder:r(`bots:new.dutyPlaceholder`),onChange:e=>S(e.target.value)})]}),F?(0,R.jsxs)(b,{variant:`control`,children:[r(`bots:new.folder`),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(_,{value:N,className:`font-mono`,placeholder:r(`bots:new.folderDefault`),onChange:e=>P(e.target.value)}),(0,R.jsxs)(u,{type:`button`,variant:`outline`,disabled:L,onClick:()=>void q(),children:[(0,R.jsx)(c,{"aria-hidden":`true`}),r(`bots:new.pick`)]})]})]}):(0,R.jsxs)(`p`,{className:`text-xs text-content-muted`,children:[r(`bots:new.folderSummary`),` `,(0,R.jsx)(`button`,{type:`button`,className:`text-content-secondary underline underline-offset-2 hover:text-content`,onClick:()=>I(!0),children:r(`bots:new.changeFolder`)})]}),G&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:G}),(0,R.jsxs)(m,{children:[(0,R.jsx)(u,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:r(`bots:new.cancel`)}),(0,R.jsx)(u,{type:`submit`,disabled:U||!o.trim(),children:r(U?`bots:new.creating`:`bots:new.create`)})]})]}),(0,R.jsx)(s,{open:V,initialPath:N,onOpenChange:H,onSelect:e=>{P(e),H(!1)}})]})})}function V(e){let n=t(),r=D(e=>e.load);return(0,k.useCallback)(async t=>{try{let e=await T(t.id);e!==t.threadSessionId&&r(),n(i(e))}catch(n){e(n instanceof Error?n.message:String(n),t.id)}},[r,n,e])}export{N as a,I as c,M as i,L as l,B as n,j as o,z as r,P as s,V as t,F as u};